summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/irq.h
diff options
context:
space:
mode:
authorRadim Krčmář <rkrcmar@redhat.com>2016-12-16 16:10:02 +0100
committerRadim Krčmář <rkrcmar@redhat.com>2017-01-09 14:42:47 +0100
commit49776faf93f8074bb4990beac04781a9507d3650 (patch)
tree6a045c43997415ab5d5ff1fa8338908d7a83cc8c /arch/x86/kvm/irq.h
parentKVM: x86: don't allow kernel irqchip with split irqchip (diff)
downloadlinux-49776faf93f8074bb4990beac04781a9507d3650.tar.xz
linux-49776faf93f8074bb4990beac04781a9507d3650.zip
KVM: x86: decouple irqchip_in_kernel() and pic_irqchip()
irqchip_in_kernel() tried to save a bit by reusing pic_irqchip(), but it just complicated the code. Add a separate state for the irqchip mode. Reviewed-by: David Hildenbrand <david@redhat.com> [Used Paolo's version of condition in irqchip_in_kernel().] Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Diffstat (limited to 'arch/x86/kvm/irq.h')
-rw-r--r--arch/x86/kvm/irq.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/arch/x86/kvm/irq.h b/arch/x86/kvm/irq.h
index 035731eb3897..f4965bc2613c 100644
--- a/arch/x86/kvm/irq.h
+++ b/arch/x86/kvm/irq.h
@@ -93,18 +93,19 @@ static inline int pic_in_kernel(struct kvm *kvm)
static inline int irqchip_split(struct kvm *kvm)
{
- return kvm->arch.irqchip_split;
+ return kvm->arch.irqchip_mode == KVM_IRQCHIP_SPLIT;
}
-static inline int irqchip_in_kernel(struct kvm *kvm)
+static inline int irqchip_kernel(struct kvm *kvm)
{
- struct kvm_pic *vpic = pic_irqchip(kvm);
- bool ret;
+ return kvm->arch.irqchip_mode == KVM_IRQCHIP_KERNEL;
+}
- ret = (vpic != NULL);
- ret |= irqchip_split(kvm);
+static inline int irqchip_in_kernel(struct kvm *kvm)
+{
+ bool ret = kvm->arch.irqchip_mode != KVM_IRQCHIP_NONE;
- /* Read vpic before kvm->irq_routing. */
+ /* Matches with wmb after initializing kvm->irq_routing. */
smp_rmb();
return ret;
}