public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] KVM: irqfd generalization prepare patch set
@ 2013-04-16 17:26 Alexander Graf
  2013-04-16 17:26 ` [PATCH 1/7] KVM: Add KVM_IRQCHIP_NUM_PINS in addition to KVM_IOAPIC_NUM_PINS Alexander Graf
                   ` (8 more replies)
  0 siblings, 9 replies; 27+ messages in thread
From: Alexander Graf @ 2013-04-16 17:26 UTC (permalink / raw)
  To: kvm-ppc
  Cc: kvm@vger.kernel.org mailing list, Scott Wood, Marcelo Tosatti,
	Gleb Natapov

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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 1/7] KVM: Add KVM_IRQCHIP_NUM_PINS in addition to KVM_IOAPIC_NUM_PINS
  2013-04-16 17:26 [PATCH 0/7] KVM: irqfd generalization prepare patch set Alexander Graf
@ 2013-04-16 17:26 ` Alexander Graf
  2013-04-17 11:51   ` Paolo Bonzini
  2013-04-16 17:26 ` [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP Alexander Graf
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 27+ messages in thread
From: Alexander Graf @ 2013-04-16 17:26 UTC (permalink / raw)
  To: kvm-ppc
  Cc: kvm@vger.kernel.org mailing list, Scott Wood, Marcelo Tosatti,
	Gleb Natapov

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 <agraf@suse.de>
---
 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(-)

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 82f1dc6..6a1871b 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -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 \
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 4a76aca..303d05b 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -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;
 	/*
diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
index 8efb580..f02659b 100644
--- a/virt/kvm/irq_comm.c
+++ b/virt/kvm/irq_comm.c
@@ -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) {
-- 
1.6.0.2

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP
  2013-04-16 17:26 [PATCH 0/7] KVM: irqfd generalization prepare patch set Alexander Graf
  2013-04-16 17:26 ` [PATCH 1/7] KVM: Add KVM_IRQCHIP_NUM_PINS in addition to KVM_IOAPIC_NUM_PINS Alexander Graf
@ 2013-04-16 17:26 ` Alexander Graf
  2013-04-17 11:49   ` Paolo Bonzini
  2013-04-16 17:26 ` [PATCH 3/7] KVM: Remove kvm_get_intr_delivery_bitmask Alexander Graf
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 27+ messages in thread
From: Alexander Graf @ 2013-04-16 17:26 UTC (permalink / raw)
  To: kvm-ppc
  Cc: kvm@vger.kernel.org mailing list, Scott Wood, Marcelo Tosatti,
	Gleb Natapov

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.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 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(-)

diff --git a/arch/x86/include/uapi/asm/kvm.h b/arch/x86/include/uapi/asm/kvm.h
index a65ec29..923478e 100644
--- a/arch/x86/include/uapi/asm/kvm.h
+++ b/arch/x86/include/uapi/asm/kvm.h
@@ -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
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 303d05b..4b30906 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -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_IRQCHIP
 int kvm_irqfd_init(void);
 void kvm_irqfd_exit(void);
 #else
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index 74d0ff3..c38d269 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -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
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index c5d43ff..0797571 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -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_IRQCHIP
 	spin_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
  */
-- 
1.6.0.2

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 3/7] KVM: Remove kvm_get_intr_delivery_bitmask
  2013-04-16 17:26 [PATCH 0/7] KVM: irqfd generalization prepare patch set Alexander Graf
  2013-04-16 17:26 ` [PATCH 1/7] KVM: Add KVM_IRQCHIP_NUM_PINS in addition to KVM_IOAPIC_NUM_PINS Alexander Graf
  2013-04-16 17:26 ` [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP Alexander Graf
@ 2013-04-16 17:26 ` Alexander Graf
  2013-04-16 17:26 ` [PATCH 4/7] KVM: Move irq routing to generic code Alexander Graf
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 27+ messages in thread
From: Alexander Graf @ 2013-04-16 17:26 UTC (permalink / raw)
  To: kvm-ppc
  Cc: kvm@vger.kernel.org mailing list, Scott Wood, Marcelo Tosatti,
	Gleb Natapov

The prototype has been stale for a while, I can't spot any real function
define behind it. Let's just remove it.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 include/linux/kvm_host.h |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 4b30906..48af62a 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -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);
-- 
1.6.0.2

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 4/7] KVM: Move irq routing to generic code
  2013-04-16 17:26 [PATCH 0/7] KVM: irqfd generalization prepare patch set Alexander Graf
                   ` (2 preceding siblings ...)
  2013-04-16 17:26 ` [PATCH 3/7] KVM: Remove kvm_get_intr_delivery_bitmask Alexander Graf
@ 2013-04-16 17:26 ` Alexander Graf
  2013-04-16 17:26 ` [PATCH 5/7] KVM: Extract generic irqchip logic into irqchip.c Alexander Graf
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 27+ messages in thread
From: Alexander Graf @ 2013-04-16 17:26 UTC (permalink / raw)
  To: kvm-ppc
  Cc: kvm@vger.kernel.org mailing list, Scott Wood, Marcelo Tosatti,
	Gleb Natapov

The 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.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 virt/kvm/assigned-dev.c |   30 ------------------------------
 virt/kvm/kvm_main.c     |   30 ++++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c
index f4c7f59..8db4370 100644
--- a/virt/kvm/assigned-dev.c
+++ b/virt/kvm/assigned-dev.c
@@ -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_MSIX
 	case KVM_ASSIGN_SET_MSIX_NR: {
 		struct kvm_assigned_msix_nr entry_nr;
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index ac3182e..6a71ee3 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -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)
-- 
1.6.0.2


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 5/7] KVM: Extract generic irqchip logic into irqchip.c
  2013-04-16 17:26 [PATCH 0/7] KVM: irqfd generalization prepare patch set Alexander Graf
                   ` (3 preceding siblings ...)
  2013-04-16 17:26 ` [PATCH 4/7] KVM: Move irq routing to generic code Alexander Graf
@ 2013-04-16 17:26 ` Alexander Graf
  2013-04-17 11:50   ` Paolo Bonzini
  2013-04-17 12:05   ` Paolo Bonzini
  2013-04-16 17:26 ` [PATCH 6/7] KVM: Move irq routing setup to irqchip.c Alexander Graf
                   ` (3 subsequent siblings)
  8 siblings, 2 replies; 27+ messages in thread
From: Alexander Graf @ 2013-04-16 17:26 UTC (permalink / raw)
  To: kvm-ppc
  Cc: kvm@vger.kernel.org mailing list, Scott Wood, Marcelo Tosatti,
	Gleb Natapov

The 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.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 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

diff --git a/arch/x86/kvm/Makefile b/arch/x86/kvm/Makefile
index 04d3040..a797b8e 100644
--- a/arch/x86/kvm/Makefile
+++ b/arch/x86/kvm/Makefile
@@ -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)
 
diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h
index 19911dd..2fe2d53 100644
--- a/include/trace/events/kvm.h
+++ b/include/trace/events/kvm.h
@@ -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_irqchip
 	TP_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
diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
index f02659b..3d900ba 100644
--- a/virt/kvm/irq_comm.c
+++ b/virt/kvm/irq_comm.c
@@ -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,
diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c
new file mode 100644
index 0000000..d8b06ed
--- /dev/null
+++ b/virt/kvm/irqchip.c
@@ -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 <agraf@suse.de>
+ *
+ * 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 <Eddie.dong@intel.com>
+ *   Alexander Graf <agraf@suse.de>
+ */
+
+#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);
+}
-- 
1.6.0.2


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 6/7] KVM: Move irq routing setup to irqchip.c
  2013-04-16 17:26 [PATCH 0/7] KVM: irqfd generalization prepare patch set Alexander Graf
                   ` (4 preceding siblings ...)
  2013-04-16 17:26 ` [PATCH 5/7] KVM: Extract generic irqchip logic into irqchip.c Alexander Graf
@ 2013-04-16 17:26 ` Alexander Graf
  2013-04-16 17:26 ` [PATCH 7/7] KVM: Move irqfd resample cap handling to generic code Alexander Graf
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 27+ messages in thread
From: Alexander Graf @ 2013-04-16 17:26 UTC (permalink / raw)
  To: kvm-ppc
  Cc: kvm@vger.kernel.org mailing list, Scott Wood, Marcelo Tosatti,
	Gleb Natapov

Setting 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.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 include/linux/kvm_host.h |    3 ++
 virt/kvm/irq_comm.c      |   76 ++---------------------------------------
 virt/kvm/irqchip.c       |   85 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 91 insertions(+), 73 deletions(-)

diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 48af62a..8b25ea2 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -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);
diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
index 3d900ba..c4dbb94 100644
--- a/virt/kvm/irq_comm.c
+++ b/virt/kvm/irq_comm.c
@@ -272,27 +272,14 @@ void kvm_fire_mask_notifiers(struct kvm *kvm, unsigned irqchip, unsigned pin,
 	rcu_read_unlock();
 }
 
-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)
+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)
 {
 	int r = -EINVAL;
 	int delta;
 	unsigned max_pin;
-	struct kvm_kernel_irq_routing_entry *ei;
 
-	/*
-	 * Do not allow GSI to be mapped to the same irqchip more than once.
-	 * Allow only one to one mapping between GSI and MSI.
-	 */
-	hlist_for_each_entry(ei, &rt->map[ue->gsi], link)
-		if (ei->type == KVM_IRQ_ROUTING_MSI ||
-		    ue->type == KVM_IRQ_ROUTING_MSI ||
-		    ue->u.irqchip.irqchip == ei->irqchip.irqchip)
-			return r;
-
-	e->gsi = ue->gsi;
-	e->type = ue->type;
 	switch (ue->type) {
 	case KVM_IRQ_ROUTING_IRQCHIP:
 		delta = 0;
@@ -329,68 +316,11 @@ static int setup_routing_entry(struct kvm_irq_routing_table *rt,
 		goto out;
 	}
 
-	hlist_add_head(&e->link, &rt->map[e->gsi]);
 	r = 0;
 out:
 	return r;
 }
 
-int kvm_set_irq_routing(struct kvm *kvm,
-			const struct kvm_irq_routing_entry *ue,
-			unsigned nr,
-			unsigned flags)
-{
-	struct kvm_irq_routing_table *new, *old;
-	u32 i, j, nr_rt_entries = 0;
-	int r;
-
-	for (i = 0; i < nr; ++i) {
-		if (ue[i].gsi >= KVM_MAX_IRQ_ROUTES)
-			return -EINVAL;
-		nr_rt_entries = max(nr_rt_entries, ue[i].gsi);
-	}
-
-	nr_rt_entries += 1;
-
-	new = kzalloc(sizeof(*new) + (nr_rt_entries * sizeof(struct hlist_head))
-		      + (nr * sizeof(struct kvm_kernel_irq_routing_entry)),
-		      GFP_KERNEL);
-
-	if (!new)
-		return -ENOMEM;
-
-	new->rt_entries = (void *)&new->map[nr_rt_entries];
-
-	new->nr_rt_entries = nr_rt_entries;
-	for (i = 0; i < 3; i++)
-		for (j = 0; j < KVM_IRQCHIP_NUM_PINS; j++)
-			new->chip[i][j] = -1;
-
-	for (i = 0; i < nr; ++i) {
-		r = -EINVAL;
-		if (ue->flags)
-			goto out;
-		r = setup_routing_entry(new, &new->rt_entries[i], ue);
-		if (r)
-			goto out;
-		++ue;
-	}
-
-	mutex_lock(&kvm->irq_lock);
-	old = kvm->irq_routing;
-	kvm_irq_routing_update(kvm, new);
-	mutex_unlock(&kvm->irq_lock);
-
-	synchronize_rcu();
-
-	new = old;
-	r = 0;
-
-out:
-	kfree(new);
-	return r;
-}
-
 #define IOAPIC_ROUTING_ENTRY(irq) \
 	{ .gsi = irq, .type = KVM_IRQ_ROUTING_IRQCHIP,	\
 	  .u.irqchip.irqchip = KVM_IRQCHIP_IOAPIC, .u.irqchip.pin = (irq) }
diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c
index d8b06ed..f3a875b 100644
--- a/virt/kvm/irqchip.c
+++ b/virt/kvm/irqchip.c
@@ -150,3 +150,88 @@ void kvm_free_irq_routing(struct kvm *kvm)
 	   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)
+{
+	int r = -EINVAL;
+	struct kvm_kernel_irq_routing_entry *ei;
+
+	/*
+	 * Do not allow GSI to be mapped to the same irqchip more than once.
+	 * Allow only one to one mapping between GSI and MSI.
+	 */
+	hlist_for_each_entry(ei, &rt->map[ue->gsi], link)
+		if (ei->type == KVM_IRQ_ROUTING_MSI ||
+		    ue->type == KVM_IRQ_ROUTING_MSI ||
+		    ue->u.irqchip.irqchip == ei->irqchip.irqchip)
+			return r;
+
+	e->gsi = ue->gsi;
+	e->type = ue->type;
+	r = kvm_set_routing_entry(rt, e, ue);
+	if (r)
+		goto out;
+
+	hlist_add_head(&e->link, &rt->map[e->gsi]);
+	r = 0;
+out:
+	return r;
+}
+
+int kvm_set_irq_routing(struct kvm *kvm,
+			const struct kvm_irq_routing_entry *ue,
+			unsigned nr,
+			unsigned flags)
+{
+	struct kvm_irq_routing_table *new, *old;
+	u32 i, j, nr_rt_entries = 0;
+	int r;
+
+	for (i = 0; i < nr; ++i) {
+		if (ue[i].gsi >= KVM_MAX_IRQ_ROUTES)
+			return -EINVAL;
+		nr_rt_entries = max(nr_rt_entries, ue[i].gsi);
+	}
+
+	nr_rt_entries += 1;
+
+	new = kzalloc(sizeof(*new) + (nr_rt_entries * sizeof(struct hlist_head))
+		      + (nr * sizeof(struct kvm_kernel_irq_routing_entry)),
+		      GFP_KERNEL);
+
+	if (!new)
+		return -ENOMEM;
+
+	new->rt_entries = (void *)&new->map[nr_rt_entries];
+
+	new->nr_rt_entries = nr_rt_entries;
+	for (i = 0; i < KVM_NR_IRQCHIPS; i++)
+		for (j = 0; j < KVM_IRQCHIP_NUM_PINS; j++)
+			new->chip[i][j] = -1;
+
+	for (i = 0; i < nr; ++i) {
+		r = -EINVAL;
+		if (ue->flags)
+			goto out;
+		r = setup_routing_entry(new, &new->rt_entries[i], ue);
+		if (r)
+			goto out;
+		++ue;
+	}
+
+	mutex_lock(&kvm->irq_lock);
+	old = kvm->irq_routing;
+	kvm_irq_routing_update(kvm, new);
+	mutex_unlock(&kvm->irq_lock);
+
+	synchronize_rcu();
+
+	new = old;
+	r = 0;
+
+out:
+	kfree(new);
+	return r;
+}
-- 
1.6.0.2

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 7/7] KVM: Move irqfd resample cap handling to generic code
  2013-04-16 17:26 [PATCH 0/7] KVM: irqfd generalization prepare patch set Alexander Graf
                   ` (5 preceding siblings ...)
  2013-04-16 17:26 ` [PATCH 6/7] KVM: Move irq routing setup to irqchip.c Alexander Graf
@ 2013-04-16 17:26 ` Alexander Graf
  2013-04-21 10:51 ` [PATCH 0/7] KVM: irqfd generalization prepare patch set Michael S. Tsirkin
  2013-04-24 10:20 ` Gleb Natapov
  8 siblings, 0 replies; 27+ messages in thread
From: Alexander Graf @ 2013-04-16 17:26 UTC (permalink / raw)
  To: kvm-ppc
  Cc: kvm@vger.kernel.org mailing list, Scott Wood, Marcelo Tosatti,
	Gleb Natapov

Now that we have most irqfd code completely platform agnostic, let's move
irqfd's resample capability return to generic code as well.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/x86/kvm/x86.c  |    1 -
 virt/kvm/kvm_main.c |    3 +++
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index ae9744d..9d9904f 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -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:
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 6a71ee3..6b44ad7 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -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:
-- 
1.6.0.2

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* Re: [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP
  2013-04-16 17:26 ` [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP Alexander Graf
@ 2013-04-17 11:49   ` Paolo Bonzini
  2013-04-17 11:53     ` Alexander Graf
  0 siblings, 1 reply; 27+ messages in thread
From: Paolo Bonzini @ 2013-04-17 11:49 UTC (permalink / raw)
  To: Alexander Graf
  Cc: kvm-ppc, kvm@vger.kernel.org mailing list, Scott Wood,
	Marcelo Tosatti, Gleb Natapov

Il 16/04/2013 19:26, Alexander Graf ha scritto:
> 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.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>  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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 5/7] KVM: Extract generic irqchip logic into irqchip.c
  2013-04-16 17:26 ` [PATCH 5/7] KVM: Extract generic irqchip logic into irqchip.c Alexander Graf
@ 2013-04-17 11:50   ` Paolo Bonzini
  2013-04-17 11:54     ` Alexander Graf
  2013-04-17 12:05   ` Paolo Bonzini
  1 sibling, 1 reply; 27+ messages in thread
From: Paolo Bonzini @ 2013-04-17 11:50 UTC (permalink / raw)
  To: Alexander Graf
  Cc: kvm-ppc, kvm@vger.kernel.org mailing list, Scott Wood,
	Marcelo Tosatti, Gleb Natapov

Il 16/04/2013 19:26, Alexander Graf ha scritto:
> The 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.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>  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
> 
> diff --git a/arch/x86/kvm/Makefile b/arch/x86/kvm/Makefile
> index 04d3040..a797b8e 100644
> --- a/arch/x86/kvm/Makefile
> +++ b/arch/x86/kvm/Makefile
> @@ -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)
>  
> diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h
> index 19911dd..2fe2d53 100644
> --- a/include/trace/events/kvm.h
> +++ b/include/trace/events/kvm.h
> @@ -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

>  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_irqchip
>  	TP_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
> diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
> index f02659b..3d900ba 100644
> --- a/virt/kvm/irq_comm.c
> +++ b/virt/kvm/irq_comm.c
> @@ -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,
> diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c
> new file mode 100644
> index 0000000..d8b06ed
> --- /dev/null
> +++ b/virt/kvm/irqchip.c
> @@ -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 <agraf@suse.de>
> + *
> + * 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 <Eddie.dong@intel.com>
> + *   Alexander Graf <agraf@suse.de>
> + */
> +
> +#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);
> +}
> 

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 1/7] KVM: Add KVM_IRQCHIP_NUM_PINS in addition to KVM_IOAPIC_NUM_PINS
  2013-04-16 17:26 ` [PATCH 1/7] KVM: Add KVM_IRQCHIP_NUM_PINS in addition to KVM_IOAPIC_NUM_PINS Alexander Graf
@ 2013-04-17 11:51   ` Paolo Bonzini
  0 siblings, 0 replies; 27+ messages in thread
From: Paolo Bonzini @ 2013-04-17 11:51 UTC (permalink / raw)
  To: Alexander Graf
  Cc: kvm-ppc, kvm@vger.kernel.org mailing list, Scott Wood,
	Marcelo Tosatti, Gleb Natapov

Il 16/04/2013 19:26, Alexander Graf ha scritto:
> 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 <agraf@suse.de>
> ---
>  arch/x86/include/asm/kvm_host.h |    2 ++

ia64 missing too.

Paolo

>  include/linux/kvm_host.h        |    2 +-
>  virt/kvm/irq_comm.c             |    2 +-
>  3 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index 82f1dc6..6a1871b 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -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 \
> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> index 4a76aca..303d05b 100644
> --- a/include/linux/kvm_host.h
> +++ b/include/linux/kvm_host.h
> @@ -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;
>  	/*
> diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
> index 8efb580..f02659b 100644
> --- a/virt/kvm/irq_comm.c
> +++ b/virt/kvm/irq_comm.c
> @@ -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) {
> 

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP
  2013-04-17 11:49   ` Paolo Bonzini
@ 2013-04-17 11:53     ` Alexander Graf
  2013-04-17 11:54       ` Paolo Bonzini
  0 siblings, 1 reply; 27+ messages in thread
From: Alexander Graf @ 2013-04-17 11:53 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: kvm-ppc, kvm@vger.kernel.org mailing list, Scott Wood,
	Marcelo Tosatti, Gleb Natapov


On 17.04.2013, at 13:49, Paolo Bonzini wrote:

> Il 16/04/2013 19:26, Alexander Graf ha scritto:
>> 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.
>> 
>> Signed-off-by: Alexander Graf <agraf@suse.de>
>> ---
>> 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. :)

It depends on CONFIG_BROKEN, so I'd rather not touch it.


Alex

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 5/7] KVM: Extract generic irqchip logic into irqchip.c
  2013-04-17 11:50   ` Paolo Bonzini
@ 2013-04-17 11:54     ` Alexander Graf
  0 siblings, 0 replies; 27+ messages in thread
From: Alexander Graf @ 2013-04-17 11:54 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: kvm-ppc, kvm@vger.kernel.org mailing list, Scott Wood,
	Marcelo Tosatti, Gleb Natapov


On 17.04.2013, at 13:50, Paolo Bonzini wrote:

> Il 16/04/2013 19:26, Alexander Graf ha scritto:
>> The 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.
>> 
>> Signed-off-by: Alexander Graf <agraf@suse.de>
>> ---
>> 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
>> 
>> diff --git a/arch/x86/kvm/Makefile b/arch/x86/kvm/Makefile
>> index 04d3040..a797b8e 100644
>> --- a/arch/x86/kvm/Makefile
>> +++ b/arch/x86/kvm/Makefile
>> @@ -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)
>> 
>> diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h
>> index 19911dd..2fe2d53 100644
>> --- a/include/trace/events/kvm.h
>> +++ b/include/trace/events/kvm.h
>> @@ -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.

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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP
  2013-04-17 11:53     ` Alexander Graf
@ 2013-04-17 11:54       ` Paolo Bonzini
  2013-04-17 11:59         ` Alexander Graf
  0 siblings, 1 reply; 27+ messages in thread
From: Paolo Bonzini @ 2013-04-17 11:54 UTC (permalink / raw)
  To: Alexander Graf
  Cc: kvm-ppc, kvm@vger.kernel.org mailing list, Scott Wood,
	Marcelo Tosatti, Gleb Natapov

Il 17/04/2013 13:53, Alexander Graf ha scritto:
>>> >> 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. :)
> 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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP
  2013-04-17 11:54       ` Paolo Bonzini
@ 2013-04-17 11:59         ` Alexander Graf
  2013-04-17 12:06           ` Paolo Bonzini
  0 siblings, 1 reply; 27+ messages in thread
From: Alexander Graf @ 2013-04-17 11:59 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: kvm-ppc, kvm@vger.kernel.org mailing list, Scott Wood,
	Marcelo Tosatti, Gleb Natapov


On 17.04.2013, at 13:54, Paolo Bonzini wrote:

> Il 17/04/2013 13:53, Alexander Graf ha scritto:
>>>>>> 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. :)
>> 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 <avi@redhat.com>
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.

    Signed-off-by: Avi Kivity <avi@redhat.com>
    Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
    Signed-off-by: Avi Kivity <avi@redhat.com>


The only patch I could see myself doing in arch/ia64 is an rm -rf arch/ia64/kvm.

Alex

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 5/7] KVM: Extract generic irqchip logic into irqchip.c
  2013-04-16 17:26 ` [PATCH 5/7] KVM: Extract generic irqchip logic into irqchip.c Alexander Graf
  2013-04-17 11:50   ` Paolo Bonzini
@ 2013-04-17 12:05   ` Paolo Bonzini
  2013-04-17 12:06     ` Alexander Graf
  1 sibling, 1 reply; 27+ messages in thread
From: Paolo Bonzini @ 2013-04-17 12:05 UTC (permalink / raw)
  To: Alexander Graf
  Cc: kvm-ppc, kvm@vger.kernel.org mailing list, Scott Wood,
	Marcelo Tosatti, Gleb Natapov

Il 16/04/2013 19:26, Alexander Graf ha scritto:
> +#ifdef kvm_irqchip
>  	TP_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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP
  2013-04-17 11:59         ` Alexander Graf
@ 2013-04-17 12:06           ` Paolo Bonzini
  2013-04-17 12:10             ` Alexander Graf
  0 siblings, 1 reply; 27+ messages in thread
From: Paolo Bonzini @ 2013-04-17 12:06 UTC (permalink / raw)
  To: Alexander Graf
  Cc: kvm-ppc, kvm@vger.kernel.org mailing list, Scott Wood,
	Marcelo Tosatti, Gleb Natapov

Il 17/04/2013 13:59, Alexander Graf ha scritto:
>> > 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

> commit a6bb7929677aacfce3f864c3cdacaa7d527945d5
> Author: Avi Kivity <avi@redhat.com>
> 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.
> 
>     Signed-off-by: Avi Kivity <avi@redhat.com>
>     Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
>     Signed-off-by: Avi Kivity <avi@redhat.com>

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 5/7] KVM: Extract generic irqchip logic into irqchip.c
  2013-04-17 12:05   ` Paolo Bonzini
@ 2013-04-17 12:06     ` Alexander Graf
  0 siblings, 0 replies; 27+ messages in thread
From: Alexander Graf @ 2013-04-17 12:06 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: kvm-ppc, kvm@vger.kernel.org mailing list, Scott Wood,
	Marcelo Tosatti, Gleb Natapov


On 17.04.2013, at 14:05, Paolo Bonzini wrote:

> Il 16/04/2013 19:26, Alexander Graf ha scritto:
>> +#ifdef kvm_irqchip
>> 	TP_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.

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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP
  2013-04-17 12:06           ` Paolo Bonzini
@ 2013-04-17 12:10             ` Alexander Graf
  2013-04-17 12:15               ` Paolo Bonzini
  0 siblings, 1 reply; 27+ messages in thread
From: Alexander Graf @ 2013-04-17 12:10 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: kvm-ppc, kvm@vger.kernel.org mailing list, Scott Wood,
	Marcelo Tosatti, Gleb Natapov


On 17.04.2013, at 14:06, Paolo Bonzini wrote:

> Il 17/04/2013 13:59, Alexander Graf ha scritto:
>>>> 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.

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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP
  2013-04-17 12:10             ` Alexander Graf
@ 2013-04-17 12:15               ` Paolo Bonzini
  2013-04-17 12:16                 ` Alexander Graf
  0 siblings, 1 reply; 27+ messages in thread
From: Paolo Bonzini @ 2013-04-17 12:15 UTC (permalink / raw)
  To: Alexander Graf
  Cc: kvm-ppc, kvm@vger.kernel.org mailing list, Scott Wood,
	Marcelo Tosatti, Gleb Natapov

Il 17/04/2013 14:10, Alexander Graf ha scritto:
>>> 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.
> 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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP
  2013-04-17 12:15               ` Paolo Bonzini
@ 2013-04-17 12:16                 ` Alexander Graf
  2013-04-24  9:55                   ` Gleb Natapov
  0 siblings, 1 reply; 27+ messages in thread
From: Alexander Graf @ 2013-04-17 12:16 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: kvm-ppc, kvm@vger.kernel.org mailing list, Scott Wood,
	Marcelo Tosatti, Gleb Natapov


On 17.04.2013, at 14:15, Paolo Bonzini wrote:

> Il 17/04/2013 14:10, Alexander Graf ha scritto:
>>>> 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.
>> 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).

Gleb, Marcelo, any objections to me removing ia64?


Alex

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 0/7] KVM: irqfd generalization prepare patch set
  2013-04-16 17:26 [PATCH 0/7] KVM: irqfd generalization prepare patch set Alexander Graf
                   ` (6 preceding siblings ...)
  2013-04-16 17:26 ` [PATCH 7/7] KVM: Move irqfd resample cap handling to generic code Alexander Graf
@ 2013-04-21 10:51 ` Michael S. Tsirkin
  2013-04-25  9:39   ` Alexander Graf
  2013-04-24 10:20 ` Gleb Natapov
  8 siblings, 1 reply; 27+ messages in thread
From: Michael S. Tsirkin @ 2013-04-21 10:51 UTC (permalink / raw)
  To: Alexander Graf
  Cc: kvm-ppc, kvm@vger.kernel.org mailing list, Scott Wood,
	Marcelo Tosatti, Gleb Natapov

On Tue, Apr 16, 2013 at 07:26:08PM +0200, Alexander Graf wrote:
> 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

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:

Acked-by: Michael S. Tsirkin <mst@redhat.com>

> 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
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP
  2013-04-17 12:16                 ` Alexander Graf
@ 2013-04-24  9:55                   ` Gleb Natapov
  0 siblings, 0 replies; 27+ messages in thread
From: Gleb Natapov @ 2013-04-24  9:55 UTC (permalink / raw)
  To: Alexander Graf
  Cc: Paolo Bonzini, kvm-ppc, kvm@vger.kernel.org mailing list,
	Scott Wood, Marcelo Tosatti

On Wed, Apr 17, 2013 at 02:16:59PM +0200, Alexander Graf wrote:
> 
> On 17.04.2013, at 14:15, Paolo Bonzini wrote:
> 
> > Il 17/04/2013 14:10, Alexander Graf ha scritto:
> >>>> 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.
> >> 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).
> 
> 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.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 0/7] KVM: irqfd generalization prepare patch set
  2013-04-16 17:26 [PATCH 0/7] KVM: irqfd generalization prepare patch set Alexander Graf
                   ` (7 preceding siblings ...)
  2013-04-21 10:51 ` [PATCH 0/7] KVM: irqfd generalization prepare patch set Michael S. Tsirkin
@ 2013-04-24 10:20 ` Gleb Natapov
  2013-04-25  7:28   ` Gleb Natapov
  8 siblings, 1 reply; 27+ messages in thread
From: Gleb Natapov @ 2013-04-24 10:20 UTC (permalink / raw)
  To: Alexander Graf
  Cc: kvm-ppc, kvm@vger.kernel.org mailing list, Scott Wood,
	Marcelo Tosatti

On Tue, Apr 16, 2013 at 07:26:08PM +0200, Alexander Graf wrote:
> 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
> 
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.

> 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

--
			Gleb.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 0/7] KVM: irqfd generalization prepare patch set
  2013-04-24 10:20 ` Gleb Natapov
@ 2013-04-25  7:28   ` Gleb Natapov
  2013-04-25  9:35     ` Alexander Graf
  0 siblings, 1 reply; 27+ messages in thread
From: Gleb Natapov @ 2013-04-25  7:28 UTC (permalink / raw)
  To: Alexander Graf
  Cc: kvm-ppc, kvm@vger.kernel.org mailing list, Scott Wood,
	Marcelo Tosatti

On Wed, Apr 24, 2013 at 01:20:31PM +0300, Gleb Natapov wrote:
> On Tue, Apr 16, 2013 at 07:26:08PM +0200, Alexander Graf wrote:
> > 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
> > 
> 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.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 0/7] KVM: irqfd generalization prepare patch set
  2013-04-25  7:28   ` Gleb Natapov
@ 2013-04-25  9:35     ` Alexander Graf
  0 siblings, 0 replies; 27+ messages in thread
From: Alexander Graf @ 2013-04-25  9:35 UTC (permalink / raw)
  To: Gleb Natapov
  Cc: kvm-ppc, kvm@vger.kernel.org mailing list, Scott Wood,
	Marcelo Tosatti


On 25.04.2013, at 09:28, Gleb Natapov wrote:

> On Wed, Apr 24, 2013 at 01:20:31PM +0300, Gleb Natapov wrote:
>> On Tue, Apr 16, 2013 at 07:26:08PM +0200, Alexander Graf wrote:
>>> 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
>>> 
>> 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/kvm-ppc@vger.kernel.org/msg06214.html


Alex

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 0/7] KVM: irqfd generalization prepare patch set
  2013-04-21 10:51 ` [PATCH 0/7] KVM: irqfd generalization prepare patch set Michael S. Tsirkin
@ 2013-04-25  9:39   ` Alexander Graf
  0 siblings, 0 replies; 27+ messages in thread
From: Alexander Graf @ 2013-04-25  9:39 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: kvm-ppc, kvm@vger.kernel.org mailing list, Scott Wood,
	Marcelo Tosatti, Gleb Natapov


On 21.04.2013, at 12:51, Michael S. Tsirkin wrote:

> On Tue, Apr 16, 2013 at 07:26:08PM +0200, Alexander Graf wrote:
>> 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
> 
> 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:
> 
> Acked-by: Michael S. Tsirkin <mst@redhat.com>

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/kvm-ppc@vger.kernel.org/msg06214.html


Alex

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2013-04-25  9:39 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-16 17:26 [PATCH 0/7] KVM: irqfd generalization prepare patch set Alexander Graf
2013-04-16 17:26 ` [PATCH 1/7] KVM: Add KVM_IRQCHIP_NUM_PINS in addition to KVM_IOAPIC_NUM_PINS Alexander Graf
2013-04-17 11:51   ` Paolo Bonzini
2013-04-16 17:26 ` [PATCH 2/7] KVM: Introduce __KVM_HAVE_IRQCHIP Alexander Graf
2013-04-17 11:49   ` Paolo Bonzini
2013-04-17 11:53     ` Alexander Graf
2013-04-17 11:54       ` Paolo Bonzini
2013-04-17 11:59         ` Alexander Graf
2013-04-17 12:06           ` Paolo Bonzini
2013-04-17 12:10             ` Alexander Graf
2013-04-17 12:15               ` Paolo Bonzini
2013-04-17 12:16                 ` Alexander Graf
2013-04-24  9:55                   ` Gleb Natapov
2013-04-16 17:26 ` [PATCH 3/7] KVM: Remove kvm_get_intr_delivery_bitmask Alexander Graf
2013-04-16 17:26 ` [PATCH 4/7] KVM: Move irq routing to generic code Alexander Graf
2013-04-16 17:26 ` [PATCH 5/7] KVM: Extract generic irqchip logic into irqchip.c Alexander Graf
2013-04-17 11:50   ` Paolo Bonzini
2013-04-17 11:54     ` Alexander Graf
2013-04-17 12:05   ` Paolo Bonzini
2013-04-17 12:06     ` Alexander Graf
2013-04-16 17:26 ` [PATCH 6/7] KVM: Move irq routing setup to irqchip.c Alexander Graf
2013-04-16 17:26 ` [PATCH 7/7] KVM: Move irqfd resample cap handling to generic code Alexander Graf
2013-04-21 10:51 ` [PATCH 0/7] KVM: irqfd generalization prepare patch set Michael S. Tsirkin
2013-04-25  9:39   ` Alexander Graf
2013-04-24 10:20 ` Gleb Natapov
2013-04-25  7:28   ` Gleb Natapov
2013-04-25  9:35     ` Alexander Graf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox