qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3 0/2] explicit VGIC initialization in finalize function
@ 2015-02-13  3:37 Eric Auger
  2015-02-13  3:37 ` [Qemu-devel] [PATCH v3 1/2] linux-headers: update KVM headers from KVM_DEV_ARM_VGIC_GRP_CTRL Eric Auger
  2015-02-13  3:37 ` [Qemu-devel] [PATCH v3 2/2] hw/intc/arm_gic: Initialize the vgic in the realize function Eric Auger
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Auger @ 2015-02-13  3:37 UTC (permalink / raw)
  To: eric.auger, eric.auger, christoffer.dall, qemu-devel,
	peter.maydell
  Cc: kvmarm, patches

With current implementation the vgic is initialized implicitly,
on-demand. This patch forces the init in the vgic finalize function.
At that point all the dimensioning parameters are known.

A new group/attribute in VGIC KVM device is used for that:
KVM_DEV_ARM_VGIC_GRP_CTRL/KVM_DEV_ARM_VGIC_CTRL_INIT.

Among other things, this earlier VGIC initialization allows to
have a simpler handling of VFIO. VFIO platform signaling can be
setup on reset handler, making sure the VGIC is ready, at that time,
to accept injected virtual IRQs.

Tested on Calxeda Midway with VFIO platform use case

Can be found on
http://git.linaro.org/people/eric.auger/qemu.git,
branch vfio_integ_v10

v2 -> v3: changed to a patch since the kernel dependency was integrated
in 3.19

v1 -> v2:
- The init is not mandated to be done in a machine init done notifier
  anymore since only the number of vcpus and number of IRQs must be known
  at init time.

Eric Auger (2):
  linux-headers: update KVM headers from KVM_DEV_ARM_VGIC_GRP_CTRL
  hw/intc/arm_gic: Initialize the vgic in the realize function

 hw/intc/arm_gic_kvm.c         | 6 ++++++
 linux-headers/asm-arm/kvm.h   | 5 +++++
 linux-headers/asm-arm64/kvm.h | 5 +++++
 3 files changed, 16 insertions(+)

-- 
1.8.3.2

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

* [Qemu-devel] [PATCH v3 1/2] linux-headers: update KVM headers from KVM_DEV_ARM_VGIC_GRP_CTRL
  2015-02-13  3:37 [Qemu-devel] [PATCH v3 0/2] explicit VGIC initialization in finalize function Eric Auger
@ 2015-02-13  3:37 ` Eric Auger
  2015-02-13  3:42   ` Peter Maydell
  2015-02-13  3:37 ` [Qemu-devel] [PATCH v3 2/2] hw/intc/arm_gic: Initialize the vgic in the realize function Eric Auger
  1 sibling, 1 reply; 5+ messages in thread
From: Eric Auger @ 2015-02-13  3:37 UTC (permalink / raw)
  To: eric.auger, eric.auger, christoffer.dall, qemu-devel,
	peter.maydell
  Cc: kvmarm, patches

Add a new group/attribute in VGIC KVM device enabling to force
vgic init: KVM_DEV_ARM_VGIC_GRP_CTRL/KVM_DEV_ARM_VGIC_CTRL_INIT

Update according to 3.19 headers.

Signed-off-by: Eric Auger <eric.auger@linaro.org>
---
 linux-headers/asm-arm/kvm.h   | 5 +++++
 linux-headers/asm-arm64/kvm.h | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/linux-headers/asm-arm/kvm.h b/linux-headers/asm-arm/kvm.h
index 09ee408..2499867 100644
--- a/linux-headers/asm-arm/kvm.h
+++ b/linux-headers/asm-arm/kvm.h
@@ -175,6 +175,8 @@ struct kvm_arch_memory_slot {
 #define   KVM_DEV_ARM_VGIC_OFFSET_SHIFT	0
 #define   KVM_DEV_ARM_VGIC_OFFSET_MASK	(0xffffffffULL << KVM_DEV_ARM_VGIC_OFFSET_SHIFT)
 #define KVM_DEV_ARM_VGIC_GRP_NR_IRQS	3
+#define KVM_DEV_ARM_VGIC_GRP_CTRL       4
+#define   KVM_DEV_ARM_VGIC_CTRL_INIT    0
 
 /* KVM_IRQ_LINE irq field index values */
 #define KVM_ARM_IRQ_TYPE_SHIFT		24
@@ -196,6 +198,9 @@ struct kvm_arch_memory_slot {
 /* Highest supported SPI, from VGIC_NR_IRQS */
 #define KVM_ARM_IRQ_GIC_MAX		127
 
+/* One single KVM irqchip, ie. the VGIC */
+#define KVM_NR_IRQCHIPS          1
+
 /* PSCI interface */
 #define KVM_PSCI_FN_BASE		0x95c1ba5e
 #define KVM_PSCI_FN(n)			(KVM_PSCI_FN_BASE + (n))
diff --git a/linux-headers/asm-arm64/kvm.h b/linux-headers/asm-arm64/kvm.h
index 8e38878..b35c95a 100644
--- a/linux-headers/asm-arm64/kvm.h
+++ b/linux-headers/asm-arm64/kvm.h
@@ -161,6 +161,8 @@ struct kvm_arch_memory_slot {
 #define   KVM_DEV_ARM_VGIC_OFFSET_SHIFT	0
 #define   KVM_DEV_ARM_VGIC_OFFSET_MASK	(0xffffffffULL << KVM_DEV_ARM_VGIC_OFFSET_SHIFT)
 #define KVM_DEV_ARM_VGIC_GRP_NR_IRQS	3
+#define KVM_DEV_ARM_VGIC_GRP_CTRL	4
+#define   KVM_DEV_ARM_VGIC_CTRL_INIT	0
 
 /* KVM_IRQ_LINE irq field index values */
 #define KVM_ARM_IRQ_TYPE_SHIFT		24
@@ -182,6 +184,9 @@ struct kvm_arch_memory_slot {
 /* Highest supported SPI, from VGIC_NR_IRQS */
 #define KVM_ARM_IRQ_GIC_MAX		127
 
+/* One single KVM irqchip, ie. the VGIC */
+#define KVM_NR_IRQCHIPS          1
+
 /* PSCI interface */
 #define KVM_PSCI_FN_BASE		0x95c1ba5e
 #define KVM_PSCI_FN(n)			(KVM_PSCI_FN_BASE + (n))
-- 
1.8.3.2

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

* [Qemu-devel] [PATCH v3 2/2] hw/intc/arm_gic: Initialize the vgic in the realize function
  2015-02-13  3:37 [Qemu-devel] [PATCH v3 0/2] explicit VGIC initialization in finalize function Eric Auger
  2015-02-13  3:37 ` [Qemu-devel] [PATCH v3 1/2] linux-headers: update KVM headers from KVM_DEV_ARM_VGIC_GRP_CTRL Eric Auger
@ 2015-02-13  3:37 ` Eric Auger
  1 sibling, 0 replies; 5+ messages in thread
From: Eric Auger @ 2015-02-13  3:37 UTC (permalink / raw)
  To: eric.auger, eric.auger, christoffer.dall, qemu-devel,
	peter.maydell
  Cc: kvmarm, patches

This patch forces vgic initialization in the vgic realize function.
It uses a new group/attribute that allows such operation.

This earlier initialization allows, for example, to setup VFIO
signaling and irqfd after vgic initialization, on a reset notifier.

Signed-off-by: Eric Auger <eric.auger@linaro.org>
---
 hw/intc/arm_gic_kvm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/intc/arm_gic_kvm.c b/hw/intc/arm_gic_kvm.c
index 1ad3eb0..1395c9e 100644
--- a/hw/intc/arm_gic_kvm.c
+++ b/hw/intc/arm_gic_kvm.c
@@ -573,6 +573,12 @@ static void kvm_arm_gic_realize(DeviceState *dev, Error **errp)
         kvm_gic_access(s, KVM_DEV_ARM_VGIC_GRP_NR_IRQS, 0, 0, &numirqs, 1);
     }
 
+    if (kvm_gic_supports_attr(s, KVM_DEV_ARM_VGIC_GRP_CTRL,
+                              KVM_DEV_ARM_VGIC_CTRL_INIT)) {
+        kvm_gic_access(s, KVM_DEV_ARM_VGIC_GRP_CTRL,
+                          KVM_DEV_ARM_VGIC_CTRL_INIT, 0, 0, 1);
+    }
+
     /* Distributor */
     memory_region_init_reservation(&s->iomem, OBJECT(s),
                                    "kvm-gic_dist", 0x1000);
-- 
1.8.3.2

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

* Re: [Qemu-devel] [PATCH v3 1/2] linux-headers: update KVM headers from KVM_DEV_ARM_VGIC_GRP_CTRL
  2015-02-13  3:37 ` [Qemu-devel] [PATCH v3 1/2] linux-headers: update KVM headers from KVM_DEV_ARM_VGIC_GRP_CTRL Eric Auger
@ 2015-02-13  3:42   ` Peter Maydell
  2015-02-13  3:54     ` Eric Auger
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Maydell @ 2015-02-13  3:42 UTC (permalink / raw)
  To: Eric Auger
  Cc: Patch Tracking, eric.auger, QEMU Developers, Christoffer Dall,
	kvmarm@lists.cs.columbia.edu

On 13 February 2015 at 03:37, Eric Auger <eric.auger@linaro.org> wrote:
> Add a new group/attribute in VGIC KVM device enabling to force
> vgic init: KVM_DEV_ARM_VGIC_GRP_CTRL/KVM_DEV_ARM_VGIC_CTRL_INIT
>
> Update according to 3.19 headers.

Is this really a full header sync? I'd have expected it to
have non-ARM changes in it too...

-- PMM

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

* Re: [Qemu-devel] [PATCH v3 1/2] linux-headers: update KVM headers from KVM_DEV_ARM_VGIC_GRP_CTRL
  2015-02-13  3:42   ` Peter Maydell
@ 2015-02-13  3:54     ` Eric Auger
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Auger @ 2015-02-13  3:54 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Patch Tracking, eric.auger, QEMU Developers, Christoffer Dall,
	kvmarm@lists.cs.columbia.edu

On 02/13/2015 04:42 AM, Peter Maydell wrote:
> On 13 February 2015 at 03:37, Eric Auger <eric.auger@linaro.org> wrote:
>> Add a new group/attribute in VGIC KVM device enabling to force
>> vgic init: KVM_DEV_ARM_VGIC_GRP_CTRL/KVM_DEV_ARM_VGIC_CTRL_INIT
>>
>> Update according to 3.19 headers.
> 
> Is this really a full header sync? I'd have expected it to
> have non-ARM changes in it too...

Hi Peter,

This is indeed a partial update. I will resend doing the full update.

Thanks for the hint

-Eric
> 
> -- PMM
> 

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

end of thread, other threads:[~2015-02-13  3:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-13  3:37 [Qemu-devel] [PATCH v3 0/2] explicit VGIC initialization in finalize function Eric Auger
2015-02-13  3:37 ` [Qemu-devel] [PATCH v3 1/2] linux-headers: update KVM headers from KVM_DEV_ARM_VGIC_GRP_CTRL Eric Auger
2015-02-13  3:42   ` Peter Maydell
2015-02-13  3:54     ` Eric Auger
2015-02-13  3:37 ` [Qemu-devel] [PATCH v3 2/2] hw/intc/arm_gic: Initialize the vgic in the realize function Eric Auger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).