KVM: irqfd generalization prepare patch set
cover KVM: irqfd generalization prepare patch set
The concept of an irqfd and interrupt routing are nothing particularly tied into the IOAPIC implementation. In fact, most of the code already is perfectly generic.
This patch set decouples most bits of the existing irqchip and irqfd implementation to make it reusable for non-IOAPIC platforms, like the PPC MPIC.
I also have a patch that implements working irqfd support on top of these, but that requires the in-kernel MPIC implementation to go upstream first, so I'm holding off on it until we settled everything there, so the concept certainly does work.
Alex
Alexander Graf (7):
KVM: Add KVM_IRQCHIP_NUM_PINS in addition to KVM_IOAPIC_NUM_PINS
KVM: Introduce __KVM_HAVE_IRQCHIP
KVM: Remove kvm_get_intr_delivery_bitmask
KVM: Move irq routing to generic code
KVM: Extract generic irqchip logic into irqchip.c
KVM: Move irq routing setup to irqchip.c
KVM: Move irqfd resample cap handling to generic code
arch/x86/include/asm/kvm_host.h | 2 + arch/x86/include/uapi/asm/kvm.h | 1 + arch/x86/kvm/Makefile | 2 +- arch/x86/kvm/x86.c | 1 - include/linux/kvm_host.h | 14 +-- include/trace/events/kvm.h | 12 ++- include/uapi/linux/kvm.h | 2 +- virt/kvm/assigned-dev.c | 30 ----- virt/kvm/eventfd.c | 6 +- virt/kvm/irq_comm.c | 193 +------------------------------- virt/kvm/irqchip.c | 237 +++++++++++++++++++++++++++++++++++++++ virt/kvm/kvm_main.c | 33 ++++++ 12 files changed, 297 insertions(+), 236 deletions(-) create mode 100644 virt/kvm/irqchip.c
PATCH 1/7 KVM: Add KVM_IRQCHIP_NUM_PINS in addition to KVM_IOAPIC_NUM_PINS
The concept of routing interrupt lines to an irqchip is nothing that is IOAPIC specific. Every irqchip has a maximum number of pins that can be linked to irq lines.
So let's add a new define that allows us to reuse generic code for non-IOAPIC platforms.
--- arch/x86/include/asm/kvm_host.h | 2 ++ include/linux/kvm_host.h | 2 +- virt/kvm/irq_comm.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-)
arch/x86/include/asm/kvm_host.h +2 -0
@@ -43,6 +43,8 @@#define KVM_PIO_PAGE_OFFSET 1#define KVM_COALESCED_MMIO_PAGE_OFFSET 2 +#define KVM_IRQCHIP_NUM_PINS KVM_IOAPIC_NUM_PINS +#define CR0_RESERVED_BITS \ (~(unsigned long)(X86_CR0_PE | X86_CR0_MP | X86_CR0_EM | X86_CR0_TS \ | X86_CR0_ET | X86_CR0_NE | X86_CR0_WP | X86_CR0_AM \
include/linux/kvm_host.h +1 -1
@@ -307,7 +307,7 @@ struct kvm_kernel_irq_routing_entry { #ifdef __KVM_HAVE_IOAPIC struct kvm_irq_routing_table { - int chip[KVM_NR_IRQCHIPS][KVM_IOAPIC_NUM_PINS]; + int chip[KVM_NR_IRQCHIPS][KVM_IRQCHIP_NUM_PINS]; struct kvm_kernel_irq_routing_entry *rt_entries; u32 nr_rt_entries; /*
virt/kvm/irq_comm.c +1 -1
@@ -480,7 +480,7 @@ int kvm_set_irq_routing(struct kvm *kvm, new->nr_rt_entries = nr_rt_entries;for (i =0 ; i <3 ; i++) -for (j =0 ; j <KVM_IOAPIC_NUM_PINS ; j++) +for (j =0 ; j <KVM_IRQCHIP_NUM_PINS ; j++) new->chip[i][j] =-1 ;for (i =0 ; i < nr; ++i) {
Signature · 1 line
1.6.0.2
Paolo Bonzini
maintainerRe: [PATCH 1/7] KVM: Add KVM_IRQCHIP_NUM_PINS in addition to KVM_IOAPIC_NUM_PINS
Il 16/04/2013 19:26, Alexander Graf ha scritto:
Quoted 10 lines
The concept of routing interrupt lines to an irqchip is nothing that is IOAPIC specific. Every irqchip has a maximum number of pins that can be linked to irq lines.
So let's add a new define that allows us to reuse generic code for non-IOAPIC platforms.
Signed-off-by Alexander Graf <[email protected]>--- arch/x86/include/asm/kvm_host.h | 2 ++
ia64 missing too.
Paolo
Quoted 44 lines
include/linux/kvm_host.h | 2 +- virt/kvm/irq_comm.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-)arch/x86/include/asm/kvm_host.h +2
-0@@ -43,6 +43,8 @@#define KVM_PIO_PAGE_OFFSET 1#define KVM_COALESCED_MMIO_PAGE_OFFSET 2 +#define KVM_IRQCHIP_NUM_PINS KVM_IOAPIC_NUM_PINS +#define CR0_RESERVED_BITS \ (~(unsigned long)(X86_CR0_PE | X86_CR0_MP | X86_CR0_EM | X86_CR0_TS \ | X86_CR0_ET | X86_CR0_NE | X86_CR0_WP | X86_CR0_AM \include/linux/kvm_host.h +1
-1@@ -307,7 +307,7 @@ struct kvm_kernel_irq_routing_entry { #ifdef __KVM_HAVE_IOAPIC struct kvm_irq_routing_table { - int chip[KVM_NR_IRQCHIPS][KVM_IOAPIC_NUM_PINS]; + int chip[KVM_NR_IRQCHIPS][KVM_IRQCHIP_NUM_PINS]; struct kvm_kernel_irq_routing_entry *rt_entries; u32 nr_rt_entries; /*virt/kvm/irq_comm.c +1
-1@@ -480,7 +480,7 @@ int kvm_set_irq_routing(struct kvm *kvm, new->nr_rt_entries = nr_rt_entries;for (i =0 ; i <3 ; i++) -for (j =0 ; j <KVM_IOAPIC_NUM_PINS ; j++) +for (j =0 ; j <KVM_IRQCHIP_NUM_PINS ; j++) new->chip[i][j] =-1 ;for (i =0 ; i < nr; ++i) {
PATCH 2/7 KVM: Introduce __KVM_HAVE_IRQCHIP
In reply to Alexander GrafQuite a bit of code in KVM has been conditionalized on availability of IOAPIC emulation. However, most of it is generically applicable to platforms that don't have an IOPIC, but a different type of irq chip.
Introduce a new define to distinguish between generic code and IOAPIC specific code.
--- arch/x86/include/uapi/asm/kvm.h | 1 + include/linux/kvm_host.h | 4 ++-- include/uapi/linux/kvm.h | 2 +- virt/kvm/eventfd.c | 6 +++--- 4 files changed, 7 insertions(+), 6 deletions(-)
arch/x86/include/uapi/asm/kvm.h +1 -0
@@ -28,6 +28,7 @@/* Select x86 specific features in <linux/kvm.h> */ #define __KVM_HAVE_PIT#define __KVM_HAVE_IOAPIC +#define __KVM_HAVE_IRQCHIP#define __KVM_HAVE_IRQ_LINE#define __KVM_HAVE_DEVICE_ASSIGNMENT#define __KVM_HAVE_MSI
include/linux/kvm_host.h +2 -2
@@ -304,7 +304,7 @@ struct kvm_kernel_irq_routing_entry {struct hlist_node link; }; -#ifdef __KVM_HAVE_IOAPIC +#ifdef __KVM_HAVE_IRQCHIP struct kvm_irq_routing_table { int chip[KVM_NR_IRQCHIPS][KVM_IRQCHIP_NUM_PINS];
@@ -432,7 +432,7 @@ void kvm_vcpu_uninit(struct kvm_vcpu *vcpu);int __must_check vcpu_load (struct kvm_vcpu *vcpu);void vcpu_put (struct kvm_vcpu *vcpu); -#ifdef __KVM_HAVE_IOAPIC +#ifdef __KVM_HAVE_IRQCHIPint kvm_irqfd_init (void );void kvm_irqfd_exit (void );#else
include/uapi/linux/kvm.h +1 -1
@@ -579,7 +579,7 @@ struct kvm_ppc_smmu_info {#ifdef __KVM_HAVE_PIT#define KVM_CAP_REINJECT_CONTROL 24#endif -#ifdef __KVM_HAVE_IOAPIC +#ifdef __KVM_HAVE_IRQCHIP#define KVM_CAP_IRQ_ROUTING 25#endif #define KVM_CAP_IRQ_INJECT_STATUS 26
virt/kvm/eventfd.c +3 -3
@@ -35,7 +35,7 @@#include "iodev.h" -#ifdef __KVM_HAVE_IOAPIC +#ifdef __KVM_HAVE_IRQCHIP/* * -------------------------------------------------------------------- * irqfd: Allows an fd to be used to inject an interrupt to the guest
@@ -433,7 +433,7 @@ fail:void kvm_eventfd_init (struct kvm *kvm) { -#ifdef __KVM_HAVE_IOAPIC +#ifdef __KVM_HAVE_IRQCHIPspin_lock_init (&kvm->irqfds.lock);INIT_LIST_HEAD (&kvm->irqfds.items);INIT_LIST_HEAD (&kvm->irqfds.resampler_list);
@@ -442,7 +442,7 @@ kvm_eventfd_init(struct kvm *kvm)INIT_LIST_HEAD (&kvm->ioeventfds); } -#ifdef __KVM_HAVE_IOAPIC +#ifdef __KVM_HAVE_IRQCHIP/* * shutdown any irqfd's that match fd+gsi */
Signature · 1 line
1.6.0.2
Paolo Bonzini
maintainerRe: [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP
Il 16/04/2013 19:26, Alexander Graf ha scritto:
Quoted 7 lines
Quite a bit of code in KVM has been conditionalized on availability of IOAPIC emulation. However, most of it is generically applicable to platforms that don't have an IOPIC, but a different type of irq chip.
Introduce a new define to distinguish between generic code and IOAPIC specific code.
Quoted 7 lines
Signed-off-by Alexander Graf <[email protected]>--- arch/x86/include/uapi/asm/kvm.h | 1 + include/linux/kvm_host.h | 4 ++-- include/uapi/linux/kvm.h | 2 +- virt/kvm/eventfd.c | 6 +++--- 4 files changed, 7 insertions(+), 6 deletions(-)
You need to touch arch/ia64 too. Yeah, it's likely broken but let's not break it on purpose. :)
Paolo
Re: [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP
Quoted 16 lines · Paolo Bonzini
Il 16/04/2013 19:26, Alexander Graf ha scritto:
Quoted 7 lines
Quite a bit of code in KVM has been conditionalized on availability of IOAPIC emulation. However, most of it is generically applicable to platforms that don't have an IOPIC, but a different type of irq chip.
Introduce a new define to distinguish between generic code and IOAPIC specific code.
Quoted 7 lines
Signed-off-by Alexander Graf <[email protected]>---
arch/x86/include/uapi/asm/kvm.h | 1 + include/linux/kvm_host.h | 4 ++-- include/uapi/linux/kvm.h | 2 +- virt/kvm/eventfd.c | 6 +++--- 4 files changed, 7 insertions(+), 6 deletions(-)
Quoted 2 lines
You need to touch
arch/ia64too. Yeah, it's likely broken but let's not break it on purpose. :)
It depends on CONFIG_BROKEN, so I'd rather not touch it.
Alex
Paolo Bonzini
maintainerRe: [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP
Il 17/04/2013 13:53, Alexander Graf ha scritto:
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
arch/x86/include/uapi/asm/kvm.h | 1 + include/linux/kvm_host.h | 4 ++-- include/uapi/linux/kvm.h | 2 +- virt/kvm/eventfd.c | 6 +++--- 4 files changed, 7 insertions(+), 6 deletions(-)You need to touch
arch/ia64too. Yeah, it's likely broken but let's not break it on purpose. :)It depends on
CONFIG_BROKEN, so I'd rather not touch it.
Well, we just got a patch to make it at least compile, and it enables a small further cleanup (see review in patch 5), so I think it's worthwhile to add a single #define...
Paolo
Re: [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP
Quoted 7 lines · Paolo Bonzini
Il 17/04/2013 13:53, Alexander Graf ha scritto:
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
arch/x86/include/uapi/asm/kvm.h | 1 + include/linux/kvm_host.h | 4 ++-- include/uapi/linux/kvm.h | 2 +- virt/kvm/eventfd.c | 6 +++--- 4 files changed, 7 insertions(+), 6 deletions(-)
Quoted 5 lines
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
You need to touch
arch/ia64too. Yeah, it's likely broken but let's not break it on purpose. :)It depends on
CONFIG_BROKEN, so I'd rather not touch it.Well, we just got a patch to make it at least compile,
That was really just Yang (blindly?) fixing an issue I pointed out on ARM. There is no kvm user space support for IA64. The kernel side has been KConfig depending on BROKEN for a year already:
commit a6bb7929677aacfce3f864c3cdacaa7d527945d5
Author: Avi Kivity <[email protected]> Date: Thu May 17 13:14:08 2012 +0300
KVM: ia64: Mark ia64 KVM as BROKEN
Practically all patches to ia64 KVM are build fixes; numerous warnings remain; the last patch from the maintainer was committed more than three years ago. It is clear that no one is using this thing.
Mark as BROKEN to ensure people don't get hit by pointless build problems.
The only patch I could see myself doing in arch/ia64 is an rm -rf arch/ia64/kvm.
Alex
Paolo Bonzini
maintainerRe: [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP
Il 17/04/2013 13:59, Alexander Graf ha scritto:
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Well, we just got a patch to make it at least compile,
That was really just Yang (blindly?) fixing an issue I pointed out on ARM. There is no kvm user space support for IA64. The kernel side has been KConfig depending on BROKEN for a year already:
Yes, I know.
Still, __KVM_HAVE_IRQCHIP is clearly a subset of __KVM_HAVE_IOAPIC; defining one without the other makes no sense and will cause compilation or link errors for trace_kvm_ack_irq.
Either we drop it altogether, or we should not break compilation consciously---especially if the problem is so trivial and obvious that you had to think of leaving it out.
Paolo
Quoted 15 lines
commit
a6bb7929677aacfce3f864c3cdacaa7d527945d5Author: Avi Kivity <[email protected]> Date: Thu May 17 13:14:08 2012 +0300KVM: ia64: Mark ia64 KVM as BROKEN
Practically all patches to ia64 KVM are build fixes; numerous warnings remain; the last patch from the maintainer was committed more than three years ago. It is clear that no one is using this thing.
Mark as BROKEN to ensure people don't get hit by pointless build problems.
Signed-off-by Avi Kivity <[email protected]>Signed-off-by Marcelo Tosatti <[email protected]>Signed-off-by Avi Kivity <[email protected]>
Re: [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP
Quoted 8 lines · Paolo Bonzini
Il 17/04/2013 13:59, Alexander Graf ha scritto:
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Well, we just got a patch to make it at least compile,
That was really just Yang (blindly?) fixing an issue I pointed out on ARM. There is no kvm user space support for IA64. The kernel side has been KConfig depending on BROKEN for a year already:
Yes, I know.
Quoted 7 lines
Still,
__KVM_HAVE_IRQCHIPis clearly a subset of__KVM_HAVE_IOAPIC; defining one without the other makes no sense and will cause compilation or link errors fortrace_kvm_ack_irq.Either we drop it altogether, or we should not break compilation consciously---especially if the problem is so trivial and obvious that you had to think of leaving it out.
I disagree. I actually _want_ to break it on purpose, so we have even more reason to remove all that useless code if nobody complains.
Alex
Paolo Bonzini
maintainerRe: [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP
Il 17/04/2013 14:10, Alexander Graf ha scritto:
Quoted 9 lines
Quoted 7 lines
Quoted 7 lines
Still,
__KVM_HAVE_IRQCHIPis clearly a subset of__KVM_HAVE_IOAPIC; defining one without the other makes no sense and will cause compilation or link errors fortrace_kvm_ack_irq.Either we drop it altogether, or we should not break compilation consciously---especially if the problem is so trivial and obvious that you had to think of leaving it out.
I disagree. I actually _want_ to break it on purpose, so we have even more reason to remove all that useless code if nobody complains.
Then remove it in patch 1, and move all the remaining IOAPIC code back to arch/x86 at the end. As things are, you're just leaving someone else to do the work (no matter if it is to fix it, or to zap it).
Paolo
Re: [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP
Quoted 8 lines · Paolo Bonzini
Il 17/04/2013 14:10, Alexander Graf ha scritto:
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Still,
__KVM_HAVE_IRQCHIPis clearly a subset of__KVM_HAVE_IOAPIC; defining one without the other makes no sense and will cause compilation or link errors fortrace_kvm_ack_irq.Either we drop it altogether, or we should not break compilation consciously---especially if the problem is so trivial and obvious that you had to think of leaving it out.
Quoted 6 lines
Quoted 2 lines
I disagree. I actually _want_ to break it on purpose, so we have even more reason to remove all that useless code if nobody complains.
Then remove it in patch 1, and move all the remaining IOAPIC code back to
arch/x86at the end. As things are, you're just leaving someone else to do the work (no matter if it is to fix it, or to zap it).
Gleb, Marcelo, any objections to me removing ia64?
Alex
Re: [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP
Quoted 11 lines · Alexander Graf
Quoted 8 lines · Paolo Bonzini
Il 17/04/2013 14:10, Alexander Graf ha scritto:
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Still,
__KVM_HAVE_IRQCHIPis clearly a subset of__KVM_HAVE_IOAPIC; defining one without the other makes no sense and will cause compilation or link errors fortrace_kvm_ack_irq.Either we drop it altogether, or we should not break compilation consciously---especially if the problem is so trivial and obvious that you had to think of leaving it out.
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines
I disagree. I actually _want_ to break it on purpose, so we have even more reason to remove all that useless code if nobody complains.
Then remove it in patch 1, and move all the remaining IOAPIC code back to
arch/x86at the end. As things are, you're just leaving someone else to do the work (no matter if it is to fix it, or to zap it).Gleb, Marcelo, any objections to me removing ia64?
It was marked BROKEN less then year ago. I would give it one more year as a last chance. We can reconsider this during 3.11 development cycle, but if you want this code to make 3.10 can you please fix ia64 compilation. The patch on top of the series is OK.
--
Gleb.
PATCH 3/7 KVM: Remove kvm_get_intr_delivery_bitmask
In reply to Alexander GrafThe prototype has been stale for a while, I can't spot any real function define behind it. Let's just remove it.
--- include/linux/kvm_host.h | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-)
include/linux/kvm_host.h +0 -5
@@ -719,11 +719,6 @@ void kvm_unregister_irq_mask_notifier(struct kvm *kvm, int irq,void kvm_fire_mask_notifiers (struct kvm *kvm,unsigned irqchip,unsigned pin,bool mask); -#ifdef __KVM_HAVE_IOAPIC -void kvm_get_intr_delivery_bitmask (struct kvm_ioapic *ioapic, -union kvm_ioapic_redirect_entry *entry, -unsigned long *deliver_bitmask); -#endif int kvm_set_irq (struct kvm *kvm,int irq_source_id,u32 irq,int level,bool line_status);int kvm_set_irq_inatomic (struct kvm *kvm,int irq_source_id,u32 irq,int level);
Signature · 1 line
1.6.0.2
PATCH 4/7 KVM: Move irq routing to generic code
In reply to Alexander GrafThe IRQ routing set ioctl lives in the hacky device assignment code inside of KVM today. This is definitely the wrong place for it. Move it to the much more natural kvm_main.c.
--- virt/kvm/assigned-dev.c | 30 ------------------------------ virt/kvm/kvm_main.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 30 deletions(-)
virt/kvm/assigned-dev.c +0 -30
@@ -983,36 +983,6 @@ long kvm_vm_ioctl_assigned_device(struct kvm *kvm, unsigned ioctl, goto out;break ; } -#ifdef KVM_CAP_IRQ_ROUTING -case KVM_SET_GSI_ROUTING : { -struct kvm_irq_routing routing; -struct kvm_irq_routing __user *urouting; -struct kvm_irq_routing_entry *entries; - - r = -EFAULT ; -if (copy_from_user (&routing, argp,sizeof (routing))) - goto out; - r = -EINVAL ; -if (routing.nr >=KVM_MAX_IRQ_ROUTES ) - goto out; -if (routing.flags) - goto out; - r = -ENOMEM ; - entries =vmalloc (routing.nr *sizeof (*entries)); -if (!entries) - goto out; - r = -EFAULT ; - urouting = argp; -if (copy_from_user (entries, urouting->entries, - routing.nr *sizeof (*entries))) - goto out_free_irq_routing; - r =kvm_set_irq_routing (kvm, entries, routing.nr, - routing.flags); - out_free_irq_routing: -vfree (entries); -break ; - } -#endif /* KVM_CAP_IRQ_ROUTING */ #ifdef __KVM_HAVE_MSIXcase KVM_ASSIGN_SET_MSIX_NR : {struct kvm_assigned_msix_nr entry_nr;
virt/kvm/kvm_main.c +30 -0
@@ -2273,6 +2273,36 @@ static long kvm_vm_ioctl(struct file *filp,break ; }#endif +#ifdef KVM_CAP_IRQ_ROUTING +case KVM_SET_GSI_ROUTING : { +struct kvm_irq_routing routing; +struct kvm_irq_routing __user *urouting; +struct kvm_irq_routing_entry *entries; + + r = -EFAULT ; +if (copy_from_user (&routing, argp,sizeof (routing))) + goto out; + r = -EINVAL ; +if (routing.nr >=KVM_MAX_IRQ_ROUTES ) + goto out; +if (routing.flags) + goto out; + r = -ENOMEM ; + entries =vmalloc (routing.nr *sizeof (*entries)); +if (!entries) + goto out; + r = -EFAULT ; + urouting = argp; +if (copy_from_user (entries, urouting->entries, + routing.nr *sizeof (*entries))) + goto out_free_irq_routing; + r =kvm_set_irq_routing (kvm, entries, routing.nr, + routing.flags); + out_free_irq_routing: +vfree (entries); +break ; + } +#endif /* KVM_CAP_IRQ_ROUTING */ default : r =kvm_arch_vm_ioctl (filp, ioctl, arg);if (r = -ENOTTY )
Signature · 1 line
1.6.0.2
PATCH 5/7 KVM: Extract generic irqchip logic into irqchip.c
In reply to Alexander GrafThe current irq_comm.c file contains pieces of code that are generic across different irqchip implementations, as well as code that is fully IOAPIC specific.
Split the generic bits out into irqchip.c.
--- arch/x86/kvm/Makefile | 2 +- include/trace/events/kvm.h | 12 +++- virt/kvm/irq_comm.c | 117 ---------------------------------- virt/kvm/irqchip.c | 152 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 163 insertions(+), 120 deletions(-) create mode 100644 virt/kvm/irqchip.c
arch/x86/kvm/Makefile +1 -1
@@ -7,7 +7,7 @@ CFLAGS_vmx.o := -I. kvm-y += $(addprefix ../../../virt/kvm/, kvm_main.o ioapic.o \ coalesced_mmio.o irq_comm.o eventfd.o \ - assigned-dev.o) + assigned-dev.o irqchip.o) kvm-$(CONFIG_IOMMU_API) += $(addprefix ../../../virt/kvm/, iommu.o) kvm-$(CONFIG_KVM_ASYNC_PF) += $(addprefix ../../../virt/kvm/, async_pf.o)
include/trace/events/kvm.h +10 -2
@@ -37,7 +37,7 @@ TRACE_EVENT(kvm_userspace_exit, __entry->errno < 0 ? -__entry->errno : __entry->reason) ); -#if defined(__KVM_HAVE_IRQ_LINE) +#if defined(__KVM_HAVE_IRQ_LINE) || defined(__KVM_HAVE_IRQCHIP) TRACE_EVENT(kvm_set_irq, TP_PROTO(unsigned int gsi, int level, int irq_source_id), TP_ARGS(gsi, level, irq_source_id),
@@ -122,6 +122,10 @@ TRACE_EVENT(kvm_msi_set_irq, {KVM_IRQCHIP_PIC_SLAVE, "PIC slave"}, \ {KVM_IRQCHIP_IOAPIC, "IOAPIC"} +#endif /* defined(__KVM_HAVE_IOAPIC) */ + +#if defined(__KVM_HAVE_IRQCHIP) + TRACE_EVENT(kvm_ack_irq, TP_PROTO(unsigned int irqchip, unsigned int pin), TP_ARGS(irqchip, pin),
@@ -136,14 +140,18 @@ TRACE_EVENT(kvm_ack_irq, __entry->pin = pin; ), +#ifdef kvm_irqchipTP_printk ("irqchip %s pin %u" ,__print_symbolic (__entry->irqchip, kvm_irqchips), __entry->pin) +#else +TP_printk ("irqchip %d pin %u" , __entry->irqchip, __entry->pin) +#endif ); +#endif /* defined(__KVM_HAVE_IRQCHIP) */ -#endif /* defined(__KVM_HAVE_IOAPIC) */ #define KVM_TRACE_MMIO_READ_UNSATISFIED 0#define KVM_TRACE_MMIO_READ 1
virt/kvm/irq_comm.c +0 -117
141 lines not on this page · raw message
virt/kvm/irqchip.c new file +152 -0
152 lines not on this page · raw message
Signature · 1 line
1.6.0.2
Paolo Bonzini
maintainerRe: [PATCH 5/7] KVM: Extract generic irqchip logic into irqchip.c
Il 16/04/2013 19:26, Alexander Graf ha scritto:
Quoted 33 lines
The current
irq_comm.cfile contains pieces of code that are generic across different irqchip implementations, as well as code that is fully IOAPIC specific.Split the generic bits out into
irqchip.c.Signed-off-by Alexander Graf <[email protected]>--- arch/x86/kvm/Makefile | 2 +- include/trace/events/kvm.h | 12 +++- virt/kvm/irq_comm.c | 117 ---------------------------------- virt/kvm/irqchip.c | 152 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 163 insertions(+), 120 deletions(-) create mode 100644 virt/kvm/irqchip.carch/x86/kvm/Makefile +1
-1@@ -7,7 +7,7 @@ CFLAGS_vmx.o := -I. kvm-y += $(addprefix ../../../virt/kvm/, kvm_main.o ioapic.o \ coalesced_mmio.o irq_comm.o eventfd.o \ - assigned-dev.o) + assigned-dev.o irqchip.o) kvm-$(CONFIG_IOMMU_API) += $(addprefix ../../../virt/kvm/, iommu.o) kvm-$(CONFIG_KVM_ASYNC_PF) += $(addprefix ../../../virt/kvm/, async_pf.o)include/trace/events/kvm.h +0
-0
include/trace/events/kvm.h TRACE_EVENT(kvm_userspace_exit, · line 40
Quoted 5 lines
include/trace/events/kvm.h +1
-1@@ -37,7 +37,7 @@ TRACE_EVENT(kvm_userspace_exit, __entry->errno < 0 ? -__entry->errno : __entry->reason) ); -#if defined(__KVM_HAVE_IRQ_LINE) +#if defined(__KVM_HAVE_IRQ_LINE) || defined(__KVM_HAVE_IRQCHIP)
I think it makes more sense to replace the #if altogether with __KVM_HAVE_IRQCHIP. The only arches that have __KVM_HAVE_IRQ_LINE already have __KVM_HAVE_IOAPIC, so it is ok to do that.
Paolo
Quoted 342 lines
include/trace/events/kvm.h +9
-1TRACE_EVENT(kvm_set_irq, TP_PROTO(unsigned int gsi, int level, int irq_source_id), TP_ARGS(gsi, level, irq_source_id),@@ -122,6 +122,10 @@ TRACE_EVENT(kvm_msi_set_irq, {KVM_IRQCHIP_PIC_SLAVE, "PIC slave"}, \ {KVM_IRQCHIP_IOAPIC, "IOAPIC"} +#endif /* defined(__KVM_HAVE_IOAPIC) */ + +#if defined(__KVM_HAVE_IRQCHIP) + TRACE_EVENT(kvm_ack_irq, TP_PROTO(unsigned int irqchip, unsigned int pin), TP_ARGS(irqchip, pin),@@ -136,14 +140,18 @@ TRACE_EVENT(kvm_ack_irq, __entry->pin = pin; ), +#ifdef kvm_irqchipTP_printk ("irqchip %s pin %u" ,__print_symbolic (__entry->irqchip, kvm_irqchips), __entry->pin) +#else +TP_printk ("irqchip %d pin %u" , __entry->irqchip, __entry->pin) +#endif ); +#endif /* defined(__KVM_HAVE_IRQCHIP) */ -#endif /* defined(__KVM_HAVE_IOAPIC) */ #define KVM_TRACE_MMIO_READ_UNSATISFIED 0#define KVM_TRACE_MMIO_READ 1virt/kvm/irq_comm.c +0
-117@@ -151,59 +151,6 @@ static int kvm_set_msi_inatomic(struct kvm_kernel_irq_routing_entry *e,return -EWOULDBLOCK ; } -int kvm_send_userspace_msi (struct kvm *kvm,struct kvm_msi *msi) -{ -struct kvm_kernel_irq_routing_entry route; - -if (!irqchip_in_kernel (kvm) || msi->flags !=0 ) -return -EINVAL ; - - route.msi.address_lo = msi->address_lo; - route.msi.address_hi = msi->address_hi; - route.msi.data = msi->data; - -return kvm_set_msi (&route, kvm,KVM_USERSPACE_IRQ_SOURCE_ID ,1 , false); -} - -/* -* Return value: -* < 0 Interrupt was ignored (masked or not delivered for other reasons) -* = 0 Interrupt was coalesced (previous irq is still pending) -* > 0 Number of CPUs interrupt was delivered to -*/ -int kvm_set_irq (struct kvm *kvm,int irq_source_id,u32 irq,int level, -bool line_status) -{ -struct kvm_kernel_irq_routing_entry *e, irq_set[KVM_NR_IRQCHIPS ]; -int ret =-1 , i =0 ; -struct kvm_irq_routing_table *irq_rt; - -trace_kvm_set_irq (irq, level, irq_source_id); - -/* Not possible to detect if the guest uses the PIC or the -* IOAPIC. So set the bit in both. The guest will ignore -* writes to the unused one. -*/ -rcu_read_lock (); - irq_rt =rcu_dereference (kvm->irq_routing); -if (irq < irq_rt->nr_rt_entries) -hlist_for_each_entry (e, &irq_rt->map[irq], link) - irq_set[i++] = *e; -rcu_read_unlock (); - -while (i--) { -int r; - r = irq_set[i].set (&irq_set[i], kvm, irq_source_id, level, - line_status); -if (r <0 ) -continue ; - - ret = r + ((ret <0 ) ?0 : ret); - } - -return ret; -} -/* * Deliver an IRQ in an atomic context if we can, or return a failure, * user can retry in a process context. @@ -241,62 +188,6 @@ int kvm_set_irq_inatomic(struct kvm *kvm, int irq_source_id, u32 irq, int level)return ret; } -bool kvm_irq_has_notifier (struct kvm *kvm,unsigned irqchip,unsigned pin) -{ -struct kvm_irq_ack_notifier *kian; -int gsi; - -rcu_read_lock (); - gsi =rcu_dereference (kvm->irq_routing)->chip[irqchip][pin]; -if (gsi !=-1 ) -hlist_for_each_entry_rcu (kian, &kvm->irq_ack_notifier_list, - link) -if (kian->gsi == gsi) { -rcu_read_unlock (); -return true; - } - -rcu_read_unlock (); - -return false; -} -EXPORT_SYMBOL_GPL (kvm_irq_has_notifier); - -void kvm_notify_acked_irq (struct kvm *kvm,unsigned irqchip,unsigned pin) -{ -struct kvm_irq_ack_notifier *kian; -int gsi; - -trace_kvm_ack_irq (irqchip, pin); - -rcu_read_lock (); - gsi =rcu_dereference (kvm->irq_routing)->chip[irqchip][pin]; -if (gsi !=-1 ) -hlist_for_each_entry_rcu (kian, &kvm->irq_ack_notifier_list, - link) -if (kian->gsi == gsi) - kian->irq_acked (kian); -rcu_read_unlock (); -} - -void kvm_register_irq_ack_notifier (struct kvm *kvm, -struct kvm_irq_ack_notifier *kian) -{ -mutex_lock (&kvm->irq_lock); -hlist_add_head_rcu (&kian->link, &kvm->irq_ack_notifier_list); -mutex_unlock (&kvm->irq_lock); -kvm_ioapic_make_eoibitmap_request (kvm); -} - -void kvm_unregister_irq_ack_notifier (struct kvm *kvm, -struct kvm_irq_ack_notifier *kian) -{ -mutex_lock (&kvm->irq_lock); -hlist_del_init_rcu (&kian->link); -mutex_unlock (&kvm->irq_lock); -synchronize_rcu (); -kvm_ioapic_make_eoibitmap_request (kvm); -}int kvm_request_irq_source_id (struct kvm *kvm) {@@ -381,13 +272,6 @@ void kvm_fire_mask_notifiers(struct kvm *kvm, unsigned irqchip, unsigned pin,rcu_read_unlock (); } -void kvm_free_irq_routing (struct kvm *kvm) -{ -/* Called only during vm destruction. Nobody can use the pointer -at this stage */ -kfree (kvm->irq_routing); -} -static int setup_routing_entry (struct kvm_irq_routing_table *rt,struct kvm_kernel_irq_routing_entry *e,const struct kvm_irq_routing_entry *ue)@@ -451,7 +335,6 @@ out:return r; } - int kvm_set_irq_routing(struct kvm *kvm, const struct kvm_irq_routing_entry *ue, unsigned nr,virt/kvm/irqchip.c new file +152
-0@@ -0,0 +1,152 @@ +/* +* irqchip.c: Common API for in kernel interrupt controllers +* Copyright (c) 2007, Intel Corporation. +* Copyright 2010 Red Hat, Inc. and/or its affiliates. +* Copyright (c) 2013, Alexander Graf <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along with +* this program; if not, write to the Free Software Foundation, Inc., 59 Temple +* Place - Suite 330, Boston, MA 02111-1307 USA. +* +* This file is derived from virt/kvm/irq_comm.c. +* +* Authors: +* Yaozu (Eddie) Dong <[email protected]> +* Alexander Graf <[email protected]> +*/ + +#include <linux/kvm_host.h> +#include <linux/slab.h> +#include <linux/export.h> +#include <trace/events/kvm.h> +#include "irq.h" + +bool kvm_irq_has_notifier (struct kvm *kvm,unsigned irqchip,unsigned pin) +{ +struct kvm_irq_ack_notifier *kian; +int gsi; + +rcu_read_lock (); + gsi =rcu_dereference (kvm->irq_routing)->chip[irqchip][pin]; +if (gsi !=-1 ) +hlist_for_each_entry_rcu (kian, &kvm->irq_ack_notifier_list, + link) +if (kian->gsi == gsi) { +rcu_read_unlock (); +return true; + } + +rcu_read_unlock (); + +return false; +} +EXPORT_SYMBOL_GPL (kvm_irq_has_notifier); + +void kvm_notify_acked_irq (struct kvm *kvm,unsigned irqchip,unsigned pin) +{ +struct kvm_irq_ack_notifier *kian; +int gsi; + +trace_kvm_ack_irq (irqchip, pin); + +rcu_read_lock (); + gsi =rcu_dereference (kvm->irq_routing)->chip[irqchip][pin]; +if (gsi !=-1 ) +hlist_for_each_entry_rcu (kian, &kvm->irq_ack_notifier_list, + link) +if (kian->gsi == gsi) + kian->irq_acked (kian); +rcu_read_unlock (); +} + +void kvm_register_irq_ack_notifier (struct kvm *kvm, +struct kvm_irq_ack_notifier *kian) +{ +mutex_lock (&kvm->irq_lock); +hlist_add_head_rcu (&kian->link, &kvm->irq_ack_notifier_list); +mutex_unlock (&kvm->irq_lock); +#ifdef __KVM_HAVE_IOAPIC +kvm_ioapic_make_eoibitmap_request (kvm); +#endif +} + +void kvm_unregister_irq_ack_notifier (struct kvm *kvm, +struct kvm_irq_ack_notifier *kian) +{ +mutex_lock (&kvm->irq_lock); +hlist_del_init_rcu (&kian->link); +mutex_unlock (&kvm->irq_lock); +synchronize_rcu (); +#ifdef __KVM_HAVE_IOAPIC +kvm_ioapic_make_eoibitmap_request (kvm); +#endif +} + +int kvm_send_userspace_msi (struct kvm *kvm,struct kvm_msi *msi) +{ +struct kvm_kernel_irq_routing_entry route; + +if (!irqchip_in_kernel (kvm) || msi->flags !=0 ) +return -EINVAL ; + + route.msi.address_lo = msi->address_lo; + route.msi.address_hi = msi->address_hi; + route.msi.data = msi->data; + +return kvm_set_msi (&route, kvm,KVM_USERSPACE_IRQ_SOURCE_ID ,1 , false); +} + +/* +* Return value: +* < 0 Interrupt was ignored (masked or not delivered for other reasons) +* = 0 Interrupt was coalesced (previous irq is still pending) +* > 0 Number of CPUs interrupt was delivered to +*/ +int kvm_set_irq (struct kvm *kvm,int irq_source_id,u32 irq,int level, +bool line_status) +{ +struct kvm_kernel_irq_routing_entry *e, irq_set[KVM_NR_IRQCHIPS ]; +int ret =-1 , i =0 ; +struct kvm_irq_routing_table *irq_rt; + +trace_kvm_set_irq (irq, level, irq_source_id); + +/* Not possible to detect if the guest uses the PIC or the +* IOAPIC. So set the bit in both. The guest will ignore +* writes to the unused one. +*/ +rcu_read_lock (); + irq_rt =rcu_dereference (kvm->irq_routing); +if (irq < irq_rt->nr_rt_entries) +hlist_for_each_entry (e, &irq_rt->map[irq], link) + irq_set[i++] = *e; +rcu_read_unlock (); + +while (i--) { +int r; + r = irq_set[i].set (&irq_set[i], kvm, irq_source_id, level, + line_status); +if (r <0 ) +continue ; + + ret = r + ((ret <0 ) ?0 : ret); + } + +return ret; +} + +void kvm_free_irq_routing (struct kvm *kvm) +{ +/* Called only during vm destruction. Nobody can use the pointer +at this stage */ +kfree (kvm->irq_routing); +}
Re: [PATCH 5/7] KVM: Extract generic irqchip logic into irqchip.c
Quoted 37 lines · Paolo Bonzini
Il 16/04/2013 19:26, Alexander Graf ha scritto:
Quoted 36 lines
The current
irq_comm.cfile contains pieces of code that are generic across different irqchip implementations, as well as code that is fully IOAPIC specific.Split the generic bits out into
irqchip.c.Signed-off-by Alexander Graf <[email protected]>---
arch/x86/kvm/Makefile | 2 +- include/trace/events/kvm.h | 12 +++- virt/kvm/irq_comm.c | 117 ---------------------------------- virt/kvm/irqchip.c | 152 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 163 insertions(+), 120 deletions(-)create mode 100644
virt/kvm/irqchip.carch/x86/kvm/Makefile +1
-1@@ -7,7 +7,7 @@ CFLAGS_vmx.o := -I. kvm-y += $(addprefix ../../../virt/kvm/, kvm_main.o ioapic.o \ coalesced_mmio.o irq_comm.o eventfd.o \ - assigned-dev.o) + assigned-dev.o irqchip.o) kvm-$(CONFIG_IOMMU_API) += $(addprefix ../../../virt/kvm/, iommu.o) kvm-$(CONFIG_KVM_ASYNC_PF) += $(addprefix ../../../virt/kvm/, async_pf.o)include/trace/events/kvm.h +0
-0@@ -37,7 +37,7 @@ TRACE_EVENT(kvm_userspace_exit, __entry->errno < 0 ? -__entry->errno : __entry->reason) );
Quoted 6 lines
include/trace/events/kvm.h TRACE_EVENT(kvm_userspace_exit, · line 40
Quoted 2 lines
include/trace/events/kvm.h +1
-1-#if defined(__KVM_HAVE_IRQ_LINE) +#if defined(__KVM_HAVE_IRQ_LINE) || defined(__KVM_HAVE_IRQCHIP)I think it makes more sense to replace the #if altogether with
__KVM_HAVE_IRQCHIP. The only arches that have__KVM_HAVE_IRQ_LINEalready have__KVM_HAVE_IOAPIC, so it is ok to do that.
I'm actually reworking this bit right now. Every time we use __KVM in non-uapi headers or C files we're basically doing something seriously wrong. KVM code should only depend on CONFIG_HAVE_KVM_....
Alex
Paolo Bonzini
maintainerRe: [PATCH 5/7] KVM: Extract generic irqchip logic into irqchip.c
In reply to Alexander GrafIl 16/04/2013 19:26, Alexander Graf ha scritto:
include/trace/events/kvm.h TRACE_EVENT(kvm_ack_irq, · line 149
Quoted 7 lines
include/trace/events/kvm.h +4
-0+#ifdef kvm_irqchipTP_printk ("irqchip %s pin %u" ,__print_symbolic (__entry->irqchip, kvm_irqchips), __entry->pin) +#else + TP_printk("irqchip %d pin %u", __entry->irqchip, __entry->pin) +#endif
Ah, spotted this too. Must be "#ifdef kvm_irqchips", but perhaps you can just use #ifdef __KVM_HAVE_IOAPIC.
Paolo
Re: [PATCH 5/7] KVM: Extract generic irqchip logic into irqchip.c
Quoted 11 lines · Paolo Bonzini
Il 16/04/2013 19:26, Alexander Graf ha scritto:
include/trace/events/kvm.h TRACE_EVENT(kvm_ack_irq, · line 149
Quoted 7 lines
+#ifdef
kvm_irqchipTP_printk("irqchip %s pin %u", __print_symbolic(__entry->irqchip, kvm_irqchips), __entry->pin)include/trace/events/kvm.h +3
-0+#else + TP_printk("irqchip %d pin %u", __entry->irqchip, __entry->pin) +#endif Ah, spotted this too. Must be "#ifdef
kvm_irqchips", but perhaps you can just use #ifdef__KVM_HAVE_IOAPIC.
Oops, nice catch!
I mostly wanted to #ifdef on kvm_irqchip so that another arch could add its own strings if it wants to :).
Alex
PATCH 6/7 KVM: Move irq routing setup to irqchip.c
In reply to Alexander GrafSetting up IRQ routes is nothing IOAPIC specific. Extract everything that really is generic code into irqchip.c and only leave the ioapic specific bits to irq_comm.c.
--- include/linux/kvm_host.h | 3 ++ virt/kvm/irq_comm.c | 76 ++--------------------------------------- virt/kvm/irqchip.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+), 73 deletions(-)
include/linux/kvm_host.h +3 -0
@@ -961,6 +961,9 @@ int kvm_set_irq_routing(struct kvm *kvm,const struct kvm_irq_routing_entry *entries, unsigned nr, unsigned flags); +int kvm_set_routing_entry (struct kvm_irq_routing_table *rt, +struct kvm_kernel_irq_routing_entry *e, +const struct kvm_irq_routing_entry *ue);void kvm_free_irq_routing (struct kvm *kvm);int kvm_send_userspace_msi (struct kvm *kvm,struct kvm_msi *msi);
virt/kvm/irq_comm.c +3 -73
98 lines not on this page · raw message
virt/kvm/irqchip.c +85 -0
88 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH 7/7 KVM: Move irqfd resample cap handling to generic code
In reply to Alexander GrafNow that we have most irqfd code completely platform agnostic, let's move irqfd's resample capability return to generic code as well.
--- arch/x86/kvm/x86.c | 1 - virt/kvm/kvm_main.c | 3 +++ 2 files changed, 3 insertions(+), 1 deletions(-)
arch/x86/kvm/x86.c +0 -1
@@ -2513,7 +2513,6 @@ int kvm_dev_ioctl_check_extension(long ext)case KVM_CAP_PCI_2_3 :case KVM_CAP_KVMCLOCK_CTRL :case KVM_CAP_READONLY_MEM : -case KVM_CAP_IRQFD_RESAMPLE : r =1 ;break ;case KVM_CAP_COALESCED_MMIO :
virt/kvm/kvm_main.c +3 -0
@@ -2432,6 +2432,9 @@ static long kvm_dev_ioctl_check_extension_generic(long arg)#ifdef CONFIG_HAVE_KVM_MSI case KVM_CAP_SIGNAL_MSI :#endif +#ifdef CONFIG_HAVE_KVM_IRQCHIP +case KVM_CAP_IRQFD_RESAMPLE : +#endif return 1 ;#ifdef KVM_CAP_IRQ_ROUTING case KVM_CAP_IRQ_ROUTING :
Signature · 1 line
1.6.0.2
Quoted 7 lines · Alexander Graf
The concept of an irqfd and interrupt routing are nothing particularly tied into the IOAPIC implementation. In fact, most of the code already is perfectly generic.
This patch set decouples most bits of the existing irqchip and irqfd implementation to make it reusable for non-IOAPIC platforms, like the PPC MPIC.
Quoted 6 lines
I also have a patch that implements working irqfd support on top of these, but that requires the in-kernel MPIC implementation to go upstream first, so I'm holding off on it until we settled everything there, so the concept certainly does work.
Alex
Nothing to object to here really, this is just moving code around.
And patches 3 and 4 are definitely cleanups. Assuming this helps PPC gain in-kernel irqchip support:
Quoted 28 lines
Alexander Graf (7):
KVM: AddKVM_IRQCHIP_NUM_PINSin addition toKVM_IOAPIC_NUM_PINS
KVM: Introduce__KVM_HAVE_IRQCHIP
KVM: Removekvm_get_intr_delivery_bitmask
KVM: Move irq routing to generic code
KVM: Extract generic irqchip logic intoirqchip.c
KVM: Move irq routing setup toirqchip.c
KVM: Move irqfd resample cap handling to generic codearch/x86/include/asm/kvm_host.h | 2 + arch/x86/include/uapi/asm/kvm.h | 1 + arch/x86/kvm/Makefile | 2 +- arch/x86/kvm/x86.c | 1 - include/linux/kvm_host.h | 14 +-- include/trace/events/kvm.h | 12 ++- include/uapi/linux/kvm.h | 2 +- virt/kvm/assigned-dev.c | 30 ----- virt/kvm/eventfd.c | 6 +- virt/kvm/irq_comm.c | 193 +------------------------------- virt/kvm/irqchip.c | 237 +++++++++++++++++++++++++++++++++++++++ virt/kvm/kvm_main.c | 33 ++++++ 12 files changed, 297 insertions(+), 236 deletions(-) create mode 100644 virt/kvm/irqchip.c--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 13 lines · Michael S. Tsirkin
Quoted 12 lines · Alexander Graf
The concept of an irqfd and interrupt routing are nothing particularly tied into the IOAPIC implementation. In fact, most of the code already is perfectly generic.
This patch set decouples most bits of the existing irqchip and irqfd implementation to make it reusable for non-IOAPIC platforms, like the PPC MPIC.
I also have a patch that implements working irqfd support on top of these, but that requires the in-kernel MPIC implementation to go upstream first, so I'm holding off on it until we settled everything there, so the concept certainly does work.
Quoted 8 lines
Quoted 1 line
Alex
Nothing to object to here really, this is just moving code around.
And patches 3 and 4 are definitely cleanups. Assuming this helps PPC gain in-kernel irqchip support:
Could you please check the newer version of this patch set again and give your ack if it still holds?
http://www.mail-archive.com/[email protected]/msg06214.html
Alex
Quoted 7 lines · Alexander Graf
The concept of an irqfd and interrupt routing are nothing particularly tied into the IOAPIC implementation. In fact, most of the code already is perfectly generic.
This patch set decouples most bits of the existing irqchip and irqfd implementation to make it reusable for non-IOAPIC platforms, like the PPC MPIC.
Quoted 7 lines
I also have a patch that implements working irqfd support on top of these, but that requires the in-kernel MPIC implementation to go upstream first, so I'm holding off on it until we settled everything there, so the concept certainly does work.
Alex
Nice cleanup, thanks! Should expect a new series with "ifdef kvm_irqchip" and ia64 compilation fixed. The fixes are minor enough for me to fix them while applying.
Quoted 9 lines
Alexander Graf (7):
KVM: AddKVM_IRQCHIP_NUM_PINSin addition toKVM_IOAPIC_NUM_PINS
KVM: Introduce__KVM_HAVE_IRQCHIP
KVM: Removekvm_get_intr_delivery_bitmask
KVM: Move irq routing to generic code
KVM: Extract generic irqchip logic intoirqchip.c
KVM: Move irq routing setup toirqchip.c
KVM: Move irqfd resample cap handling to generic code
Quoted 14 lines
arch/x86/include/asm/kvm_host.h | 2 + arch/x86/include/uapi/asm/kvm.h | 1 + arch/x86/kvm/Makefile | 2 +- arch/x86/kvm/x86.c | 1 - include/linux/kvm_host.h | 14 +-- include/trace/events/kvm.h | 12 ++- include/uapi/linux/kvm.h | 2 +- virt/kvm/assigned-dev.c | 30 ----- virt/kvm/eventfd.c | 6 +- virt/kvm/irq_comm.c | 193 +------------------------------- virt/kvm/irqchip.c | 237 +++++++++++++++++++++++++++++++++++++++ virt/kvm/kvm_main.c | 33 ++++++ 12 files changed, 297 insertions(+), 236 deletions(-) create mode 100644 virt/kvm/irqchip.c
--
Gleb.
Quoted 13 lines · Gleb Natapov
Quoted 12 lines · Alexander Graf
The concept of an irqfd and interrupt routing are nothing particularly tied into the IOAPIC implementation. In fact, most of the code already is perfectly generic.
This patch set decouples most bits of the existing irqchip and irqfd implementation to make it reusable for non-IOAPIC platforms, like the PPC MPIC.
I also have a patch that implements working irqfd support on top of these, but that requires the in-kernel MPIC implementation to go upstream first, so I'm holding off on it until we settled everything there, so the concept certainly does work.
Quoted 6 lines
Quoted 2 lines
Alex
Nice cleanup, thanks! Should expect a new series with "ifdef
kvm_irqchip" and ia64 compilation fixed. The fixes are minor enough for me to fix them while applying.
Actually the series does not apply any more and has to be rebased on top of the current queue.
--
Gleb.
Quoted 14 lines · Gleb Natapov
Quoted 13 lines · Gleb Natapov
Quoted 12 lines · Alexander Graf
The concept of an irqfd and interrupt routing are nothing particularly tied into the IOAPIC implementation. In fact, most of the code already is perfectly generic.
This patch set decouples most bits of the existing irqchip and irqfd implementation to make it reusable for non-IOAPIC platforms, like the PPC MPIC.
I also have a patch that implements working irqfd support on top of these, but that requires the in-kernel MPIC implementation to go upstream first, so I'm holding off on it until we settled everything there, so the concept certainly does work.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Alex
Nice cleanup, thanks! Should expect a new series with "ifdef
kvm_irqchip" and ia64 compilation fixed. The fixes are minor enough for me to fix them while applying.Actually the series does not apply any more and has to be rebased on top of the current queue.
Heh, we're already at v3:
http://www.mail-archive.com/[email protected]/msg06214.html
Alex