vITS support
PATCH v7 1/8 hw/intc/arm_gic(v3)_kvm: Initialize gsi routing
In reply to Eric AugerAdvertise gsi routing and set up irqchip routing entries for GIC SPIs.
This is not mandated as long as MSI routing is not used (because the kernel sets a default irqchip routing table). However once MSI routing gets used (for VIRTIO-PCI vhost for example), the first call to KVM_SET_GSI_ROUTING overrides the kernel default irqchip table.
If no routing entry exists for the GSI, any IRQFD signaling for this GSI will fail.
---
v6 -> v7:
- added Peter's R-b
RFC -> PATCH:
- KVM gsi/MSI routing for ARM now supported in 4.8
- use kvm_has_gsi_routing()
--- hw/intc/arm_gic_kvm.c | 12 ++++++++++++ hw/intc/arm_gicv3_kvm.c | 13 +++++++++++++ 2 files changed, 25 insertions(+)
hw/intc/arm_gic_kvm.c +12 -0
@@ -577,6 +577,18 @@ static void kvm_arm_gic_realize(DeviceState *dev, Error **errp) "not support vGICv2 migration");migrate_add_blocker (s->migration_blocker); } + +if (kvm_has_gsi_routing ()) { +/* set up irq routing */ +kvm_init_irq_routing (kvm_state); +for (i =0 ; i < s->num_irq -GIC_INTERNAL ; ++i) { +kvm_irqchip_add_irq_route (kvm_state, i,0 , i); + } + + kvm_gsi_routing_allowed = true; + +kvm_irqchip_commit_routes (kvm_state); + } }static void kvm_arm_gic_class_init (ObjectClass *klass,void *data)
hw/intc/arm_gicv3_kvm.c +13 -0
@@ -85,6 +85,7 @@ static void kvm_arm_gicv3_realize(DeviceState *dev, Error **errp)GICv3State *s =KVM_ARM_GICV3 (dev);KVMARMGICv3Class *kgc =KVM_ARM_GICV3_GET_CLASS (s);Error *local_err =NULL ; +int i;DPRINTF ("kvm_arm_gicv3_realize\n" );
@@ -127,6 +128,18 @@ static void kvm_arm_gicv3_realize(DeviceState *dev, Error **errp)*/ error_setg (&s->migration_blocker,"vGICv3 migration is not implemented" );migrate_add_blocker (s->migration_blocker); + +if (kvm_has_gsi_routing ()) { +/* set up irq routing */ +kvm_init_irq_routing (kvm_state); +for (i =0 ; i < s->num_irq -GIC_INTERNAL ; ++i) { +kvm_irqchip_add_irq_route (kvm_state, i,0 , i); + } + + kvm_gsi_routing_allowed = true; + +kvm_irqchip_commit_routes (kvm_state); + } }static void kvm_arm_gicv3_class_init (ObjectClass *klass,void *data)
Signature · 1 line
2.5.5
v7 cover vITS support
This series introduces support for in-kernel GICv3 ITS emulation.
On dt guest the functionality is complete and was tested on Cavium ThunderX with virtio-net-pci and vhost-net.
On ACPI guest the series was tested with virtio-net-pci only. For vhost-net, using MSIX we currently miss the ACPI IORT table generation linking the PCIe host controller with the ITS. The work is ongoing and will be submitted separately. Anyway the kernel ACPI IORT ITS node support is not upstreamed yet.
The first patch is not really related to virtual ITS but advertises the KVM GSI routing support which goes along with MSI injection.
For ACPI ITS and PCIe support, use in-flight Tomasz' series:
- [PATCH V10 0/8] Introduce ACPI world to ITS,
https://lkml.org/lkml/2016/9/6/153
- Support for ARM64 ACPI based PCI host controller,
https://lwn.net/Articles/690995/
Git Information:
v7: https://github.com/eauger/qemu/tree/v2.7.0-vITS-v7
v6: https://github.com/eauger/qemu/tree/v2.7.0-vITS-v6
History:
V6 => v7:
- add my Signed-off-by on patches 7 and 8
- add Peter's R-b on 1, 2
- add/use kvm_msi_devid_required macro
- add translater_gpa_known
- in arm_gicv3_its_kvm.c, remove the notifier and directly compute the ITS translater GPA in first kvm_its_send_msi() call as suggested by Peter. Fix the memory region reference leak. fix the comment typo.
v5 => v6:
- moved from RFC to PATCH since all the host kernel dependencies now are fixed
- use Shannon's MADT patches I was not aware of
- smoother integration since the kernet ITS init sequence has now been updated in 4.8
- kvm_msi_use_devid flag handled in non archutecture specific code
- vmstate_its fields removed and migration_blocker added
v4 => v5:
- fix compilation issue with arm-softmmu target
- rebase on target-arm: Fix unreachable code in gicv3_class_name()
- add ACPI support
- kernel ITS init sequence is not yet similar to GICv2/V3 ones. This will be addressed in a subsequent respin.
v3 => v4:
- Took into account Peter's comments (at the exception of sub-class operation changes)
- rebase on Andre's kernel ITS emulation series v8
- rework KVM init sequence and KVM device creation/settings overall. I do not use kvm_arm_register_device due to the way the kernel API is devises (see discussion on the kernel ML)
- change the computation of the GITS_TRANSLATER base address
- fix compilation issues
- new "arget-arm: move gicv3_class_name from machine to kvm_arm.h"
v2 => v3:
- Really added unmigratable flag, was overlooked in v2
- Fixed checkpatch issue with initializing static variable to zero
v1 => v2:
- Added registers and reset method
- Added unmigratable flag
- Rebased on top of current master, use kvm_arch_fixup_msi_route() now
Eric Auger (2):
hw/intc/arm_gic(v3)_kvm: Initialize gsi routing
target-arm: move gicv3_class_name from machine to kvm_arm.h
Pavel Fedin (4):
hw/intc/arm_gicv3_its: Implement ITS base class
kvm-all: Pass requester ID to MSI routing functions hw/intc/arm_gicv3_its: Implement support for in-kernel ITS emulation arm/virt: Add ITS to the virt board
Shannon Zhao (2):
ACPI: Add GIC Interrupt Translation Service Structure definition
ARM: Virt: ACPI: Add GIC ITS description in ACPI MADT table
hw/arm/virt-acpi-build.c | 12 +++ hw/arm/virt.c | 47 +++++++++-- hw/intc/Makefile.objs | 2 + hw/intc/arm_gic_kvm.c | 12 +++ hw/intc/arm_gicv3_its_common.c | 148 +++++++++++++++++++++++++++++++++ hw/intc/arm_gicv3_its_kvm.c | 121 +++++++++++++++++++++++++++ hw/intc/arm_gicv3_kvm.c | 13 +++ include/hw/acpi/acpi-defs.h | 13 ++- include/hw/intc/arm_gicv3_its_common.h | 78 +++++++++++++++++ include/sysemu/kvm.h | 9 ++ kvm-all.c | 9 ++ kvm-stub.c | 1 + target-arm/kvm_arm.h | 35 +++++++- target-arm/machine.c | 15 ---- 14 files changed, 492 insertions(+), 23 deletions(-) create mode 100644 hw/intc/arm_gicv3_its_common.c create mode 100644 hw/intc/arm_gicv3_its_kvm.c create mode 100644 include/hw/intc/arm_gicv3_its_common.h
Signature · 1 line
2.5.5
PATCH v7 2/8 hw/intc/arm_gicv3_its: Implement ITS base class
From: Pavel Fedin <[email protected]>
This is the basic skeleton for both KVM and software-emulated ITS. Since we already prepare status structure, we also introduce complete VMState description. But, because we currently have no migratable implementations, we also set unmigratable flag.
---
v6 -> v7:
- added Peter's R-b
- added translater_gpa_known field
v5 -> v6:
- rename iomem_its into iomem_its_translation
- remove vmstate_its fields since the device is not yet migratable
- fix gicv3_its_trans_write print format
- add migration_blocker
v4 -> v5:
- send_msi can return 0 meaning the MSI was rejected by guest. Handle this value as an error
v3 -> v4:
- fix compilation error
- msi_supported -> msi_nonbroken
- streamid -> requester_id
- use PRIx64
- read ops uses _with_attrs form
- 16/32b write access allowed to GITS_TRANSLATER
- move its_class_name in kvm_arm.h and remove #ifdef TARGET_AARCH64
- add new kvm device dev_fd field
- add new gits_translater_gpa field in GICv3ITSState
--- hw/intc/Makefile.objs | 1 + hw/intc/arm_gicv3_its_common.c | 148 +++++++++++++++++++++++++++++++++ include/hw/intc/arm_gicv3_its_common.h | 78 +++++++++++++++++ target-arm/kvm_arm.h | 19 +++++ 4 files changed, 246 insertions(+) create mode 100644 hw/intc/arm_gicv3_its_common.c create mode 100644 include/hw/intc/arm_gicv3_its_common.h
hw/intc/Makefile.objs +1 -0
@@ -16,6 +16,7 @@ common-obj-$(CONFIG_ARM_GIC) += arm_gicv3_common.o common-obj-$(CONFIG_ARM_GIC) += arm_gicv3.o common-obj-$(CONFIG_ARM_GIC) += arm_gicv3_dist.o common-obj-$(CONFIG_ARM_GIC) += arm_gicv3_redist.o +common-obj-$(CONFIG_ARM_GIC) += arm_gicv3_its_common.o common-obj-$(CONFIG_OPENPIC) += openpic.o obj-$(CONFIG_APIC) += apic.o apic_common.o
hw/intc/arm_gicv3_its_common.c new file +148 -0
148 lines not on this page · raw message
include/hw/intc/arm_gicv3_its_common.h new file +78 -0
78 lines not on this page · raw message
target-arm/kvm_arm.h +19 -0
@@ -255,4 +255,23 @@ struct kvm_guest_debug_arch;void kvm_arm_copy_hw_debug_data (struct kvm_guest_debug_arch *ptr); +/** +* its_class_name +* +* Return the ITS class name to use depending on whether KVM acceleration +* and KVM CAP_SIGNAL_MSI are supported +* +* Returns: class name to use or NULL +*/ +static inline const char *its_class_name (void ) +{ +if (kvm_irqchip_in_kernel ()) { +/* KVM implementation requires this capability */ +return kvm_direct_msi_enabled () ?"arm-its-kvm" :NULL ; + }else { +/* Software emulation is not implemented yet */ +return NULL ; + } +} +#endif
Signature · 1 line
2.5.5
PATCH v7 3/8 target-arm: move gicv3_class_name from machine to kvm_arm.h
In reply to Eric AugerMachine.c contains code related to migration. Let's move gicv3_class_name to kvm_arm.h instead.
---
v5 -> v6:
- add Peter's R-b
v4 -> v5:
- add #include "qemu/error-report.h"
- rebased on target-arm: Fix unreachable code in gicv3_class_name()
v4: creation
Conflicts:
target-arm/machine.c
--- target-arm/kvm_arm.h | 16 +++++++++++++++- target-arm/machine.c | 15 --------------- 2 files changed, 15 insertions(+), 16 deletions(-)
target-arm/kvm_arm.h +15 -1
@@ -13,6 +13,7 @@#include "sysemu/kvm.h" #include "exec/memory.h" +#include "qemu/error-report.h" /** * kvm_arm_vcpu_init:
@@ -223,7 +224,20 @@ static inline const char *gic_class_name(void)* * Returns: class name to use */ -const char *gicv3_class_name (void ); +static inline const char *gicv3_class_name (void ) +{ +if (kvm_irqchip_in_kernel ()) { +#ifdef TARGET_AARCH64 +return "kvm-arm-gicv3" ; +#else +error_report ("KVM GICv3 acceleration is not supported on this " +"platform" ); +exit (1 ); +#endif + }else { +return "arm-gicv3" ; + } +}/** * kvm_arm_handle_debug:
target-arm/machine.c +0 -15
@@ -331,18 +331,3 @@ const VMStateDescription vmstate_arm_cpu = { NULL } }; - -const char *gicv3_class_name (void ) -{ -if (kvm_irqchip_in_kernel ()) { -#ifdef TARGET_AARCH64 -return "kvm-arm-gicv3" ; -#else -error_report ("KVM GICv3 acceleration is not supported on this " -"platform" ); -exit (1 ); -#endif - }else { -return "arm-gicv3" ; - } -}
Signature · 1 line
2.5.5
PATCH v7 4/8 kvm-all: Pass requester ID to MSI routing functions
In reply to Eric AugerFrom: Pavel Fedin <[email protected]>
Introduce global kvm_msi_use_devid flag plus associated kvm_msi_devid_required() macro. Passes the device ID, if needed, while building the MSI route entry. Device IDs are required by the ARM GICv3 ITS (IRQ remapping function is based on this information).
---
v6 -> v7:
- add/use kvm_msi_devid_required() macro
v5 -> v6:
- move the flag in include/sysemu/kvm.h and populate the devid information in kvm-all.c
v3 -> v4:
- OR route->flags with KVM_MSI_VALID_DEVID
--- include/sysemu/kvm.h | 9 +++++++++ kvm-all.c | 9 +++++++++ kvm-stub.c | 1 + 3 files changed, 19 insertions(+)
include/sysemu/kvm.h +9 -0
@@ -53,6 +53,7 @@ extern bool kvm_gsi_direct_mapping;extern bool kvm_readonly_mem_allowed;extern bool kvm_direct_msi_allowed;extern bool kvm_ioeventfd_any_length_allowed; +extern bool kvm_msi_use_devid;#if definedCONFIG_KVM || !definedNEED_CPU_H #define kvm_enabled () (kvm_allowed)
@@ -169,6 +170,13 @@ extern bool kvm_ioeventfd_any_length_allowed;*/ #define kvm_ioeventfd_any_length_enabled () (kvm_ioeventfd_any_length_allowed) +/** +* kvm_msi_devid_required: +* Returns: true if KVM requires a device id to be provided while +* defining an MSI routing entry. +*/ +#define kvm_msi_devid_required () (kvm_msi_use_devid) +#else #define kvm_enabled () (0)#define kvm_irqchip_in_kernel () (false)
@@ -184,6 +192,7 @@ extern bool kvm_ioeventfd_any_length_allowed;#define kvm_readonly_mem_enabled () (false)#define kvm_direct_msi_enabled () (false)#define kvm_ioeventfd_any_length_enabled () (false) +#define kvm_msi_devid_required () (false)#endif struct kvm_run ;
kvm-all.c +9 -0
@@ -119,6 +119,7 @@ bool kvm_readonly_mem_allowed;bool kvm_vm_attributes_allowed;bool kvm_direct_msi_allowed;bool kvm_ioeventfd_any_length_allowed; +bool kvm_msi_use_devid;static const KVMCapabilityInfo kvm_required_capabilites[] = {KVM_CAP_INFO (USER_MEMORY ),
@@ -1275,6 +1276,10 @@ int kvm_irqchip_add_msi_route(KVMState *s, int vector, PCIDevice *dev) kroute.u.msi.address_lo = (uint32_t )msg.address; kroute.u.msi.address_hi = msg.address >>32 ; kroute.u.msi.data =le32_to_cpu (msg.data); +if (kvm_msi_devid_required ()) { + kroute.flags =KVM_MSI_VALID_DEVID ; + kroute.u.msi.devid =pci_requester_id (dev); + }if (kvm_arch_fixup_msi_route (&kroute, msg.address, msg.data, dev)) {kvm_irqchip_release_virq (s, virq);return -EINVAL ;
@@ -1308,6 +1313,10 @@ int kvm_irqchip_update_msi_route(KVMState *s, int virq, MSIMessage msg, kroute.u.msi.address_lo = (uint32_t )msg.address; kroute.u.msi.address_hi = msg.address >>32 ; kroute.u.msi.data =le32_to_cpu (msg.data); +if (kvm_msi_devid_required ()) { + kroute.flags =KVM_MSI_VALID_DEVID ; + kroute.u.msi.devid =pci_requester_id (dev); + }if (kvm_arch_fixup_msi_route (&kroute, msg.address, msg.data, dev)) {return -EINVAL ; }
kvm-stub.c +1 -0
@@ -31,6 +31,7 @@ bool kvm_gsi_direct_mapping;bool kvm_allowed;bool kvm_readonly_mem_allowed;bool kvm_ioeventfd_any_length_allowed; +bool kvm_msi_use_devid;int kvm_destroy_vcpu (CPUState *cpu) {
Signature · 1 line
2.5.5
PATCH v7 5/8 hw/intc/arm_gicv3_its: Implement support for in-kernel ITS emulation
In reply to Eric AugerFrom: Pavel Fedin <[email protected]>
The ITS control frame is in-kernel emulated while accesses to the GITS_TRANSLATER are mediated through the KVM_SIGNAL_MSI ioctl (MSI direct MSI injection advertised by the CAP_SIGNAL_MSI capability)
the kvm_gsi_direct_mapping is explicitly set to false to emphasize the difference with GICv2M. Direct mapping cannot work with ITS since the content of the MSI data is not the target interrupt ID but an eventd id.
GSI routing is advertised (kvm_gsi_routing_allowed) as well as msi/irqfd signaling (kvm_msi_via_irqfd_allowed).
The MSI frame (GITS_TRANSLATER) absolute GPA is computed on first kvm_its_send_msi() call. It is then passed through KVM_SIGNAL_MSI ioctl.
---
v6 -> v7:
- remove the notifier and compute the translater GPA on first kvm_its_send_msi(), as suggested by Peter
- fix the memory region reference leak
- fix a comment typo
v5 -> v6:
- now the kernel ITS init sequence has changed let's use the kvm_arm_register_device to set the CTRL frame base address
- use extract64()
- add migration blocker
- remove kvm_gsi_routing_allowed setting which is set in GICv3 KVM device realize
- add migration_blocker
v3 -> v4:
- include "qemu/osdep.h" and "qapi/error.h"
- rename KVM_VGIC_V3_ADDR_TYPE_ITS into KVM_VGIC_ITS_ADDR_TYPE
- reword commit message
- change kvm_msi_via_irqfd_allowed definition (attached to irqfd dynamic availability + MSI controller availability)
- create the ITS KVM device (previously abstracted by the GICv3 KVM device)
- init sequence changed
- absolute GITS_TRANSLATER GPA stored
--- hw/intc/Makefile.objs | 1 + hw/intc/arm_gicv3_its_kvm.c | 121 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 hw/intc/arm_gicv3_its_kvm.c
hw/intc/Makefile.objs +1 -0
@@ -22,6 +22,7 @@ common-obj-$(CONFIG_OPENPIC) += openpic.o obj-$(CONFIG_APIC) += apic.o apic_common.o obj-$(CONFIG_ARM_GIC_KVM) += arm_gic_kvm.o obj-$(call land,$(CONFIG_ARM_GIC_KVM),$(TARGET_AARCH64)) += arm_gicv3_kvm.o +obj-$(call land,$(CONFIG_ARM_GIC_KVM),$(TARGET_AARCH64)) += arm_gicv3_its_kvm.o obj-$(CONFIG_STELLARIS) += armv7m_nvic.o obj-$(CONFIG_EXYNOS4) += exynos4210_gic.o exynos4210_combiner.o obj-$(CONFIG_GRLIB) += grlib_irqmp.o
hw/intc/arm_gicv3_its_kvm.c new file +121 -0
121 lines not on this page · raw message
Signature · 1 line
2.5.5
PATCH v7 6/8 arm/virt: Add ITS to the virt board
In reply to Eric AugerFrom: Pavel Fedin <[email protected]>
If supported by the configuration, ITS will be added automatically.
This patch also renames v2m_phandle to msi_phandle because it's now used by both MSI implementations.
--
v3 -> v4:
- added Peter's R-b
--- hw/arm/virt.c | 47 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 6 deletions(-)
hw/arm/virt.c +41 -6
@@ -76,7 +76,7 @@ typedef struct VirtBoardInfo {int fdt_size;uint32_t clock_phandle;uint32_t gic_phandle; -uint32_t v2m_phandle; +uint32_t msi_phandle;bool using_psci; } VirtBoardInfo;
@@ -423,9 +423,22 @@ static void fdt_add_cpu_nodes(const VirtBoardInfo *vbi) } } +static void fdt_add_its_gic_node (VirtBoardInfo *vbi) +{ + vbi->msi_phandle =qemu_fdt_alloc_phandle (vbi->fdt); +qemu_fdt_add_subnode (vbi->fdt,"/intc/its" ); +qemu_fdt_setprop_string (vbi->fdt,"/intc/its" ,"compatible" , +"arm,gic-v3-its" ); +qemu_fdt_setprop (vbi->fdt,"/intc/its" ,"msi-controller" ,NULL ,0 ); +qemu_fdt_setprop_sized_cells (vbi->fdt,"/intc/its" ,"reg" , +2 , vbi->memmap[VIRT_GIC_ITS ].base, +2 , vbi->memmap[VIRT_GIC_ITS ].size); +qemu_fdt_setprop_cell (vbi->fdt,"/intc/its" ,"phandle" , vbi->msi_phandle); +} +static void fdt_add_v2m_gic_node (VirtBoardInfo *vbi) { - vbi->v2m_phandle =qemu_fdt_alloc_phandle (vbi->fdt); + vbi->msi_phandle =qemu_fdt_alloc_phandle (vbi->fdt);qemu_fdt_add_subnode (vbi->fdt,"/intc/v2m" );qemu_fdt_setprop_string (vbi->fdt,"/intc/v2m" ,"compatible" ,"arm,gic-v2m-frame" );
@@ -433,7 +446,7 @@ static void fdt_add_v2m_gic_node(VirtBoardInfo *vbi)qemu_fdt_setprop_sized_cells (vbi->fdt,"/intc/v2m" ,"reg" ,2 , vbi->memmap[VIRT_GIC_V2M ].base,2 , vbi->memmap[VIRT_GIC_V2M ].size); -qemu_fdt_setprop_cell (vbi->fdt,"/intc/v2m" ,"phandle" , vbi->v2m_phandle); +qemu_fdt_setprop_cell (vbi->fdt,"/intc/v2m" ,"phandle" , vbi->msi_phandle); }static void fdt_add_gic_node (VirtBoardInfo *vbi,int type)
@@ -500,6 +513,26 @@ static void fdt_add_pmu_nodes(const VirtBoardInfo *vbi, int gictype) } } +static void create_its (VirtBoardInfo *vbi,DeviceState *gicdev) +{ +const char *itsclass =its_class_name (); +DeviceState *dev; + +if (!itsclass) { +/* Do nothing if not supported */ +return ; + } + + dev =qdev_create (NULL , itsclass); + +object_property_set_link (OBJECT (dev),OBJECT (gicdev),"parent-gicv3" , + &error_abort); +qdev_init_nofail (dev); +sysbus_mmio_map (SYS_BUS_DEVICE (dev),0 , vbi->memmap[VIRT_GIC_ITS ].base); + +fdt_add_its_gic_node (vbi); +} +static void create_v2m (VirtBoardInfo *vbi,qemu_irq *pic) {int i;
@@ -583,7 +616,9 @@ static void create_gic(VirtBoardInfo *vbi, qemu_irq *pic, int type, bool secure)fdt_add_gic_node (vbi, type); -if (type ==2 ) { +if (type ==3 ) { +create_its (vbi, gicdev); + }else {create_v2m (vbi, pic); } }
@@ -1025,9 +1060,9 @@ static void create_pcie(const VirtBoardInfo *vbi, qemu_irq *pic, nr_pcie_buses - 1);qemu_fdt_setprop (vbi->fdt, nodename,"dma-coherent" ,NULL ,0 ); -if (vbi->v2m_phandle) { +if (vbi->msi_phandle) {qemu_fdt_setprop_cells (vbi->fdt, nodename,"msi-parent" , - vbi->v2m_phandle); + vbi->msi_phandle); } qemu_fdt_setprop_sized_cells(vbi->fdt, nodename, "reg",
Signature · 1 line
2.5.5
PATCH v7 7/8 ACPI: Add GIC Interrupt Translation Service Structure definition
In reply to Eric AugerFrom: Shannon Zhao <[email protected]>
ACPI Spec 6.0 introduces GIC Interrupt Translation Service Structure. Here we add the definition of the Structure.
---
v6 -> v7:
- added my Sob
--- include/hw/acpi/acpi-defs.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
include/hw/acpi/acpi-defs.h +12 -1
@@ -294,7 +294,8 @@ typedef struct AcpiMultipleApicTable AcpiMultipleApicTable;#define ACPI_APIC_GENERIC_DISTRIBUTOR 12#define ACPI_APIC_GENERIC_MSI_FRAME 13#define ACPI_APIC_GENERIC_REDISTRIBUTOR 14 -#define ACPI_APIC_RESERVED 15/* 15 and greater are reserved */ +#define ACPI_APIC_GENERIC_TRANSLATOR 15 +#define ACPI_APIC_RESERVED 16/* 16 and greater are reserved */ /* * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE)
@@ -395,6 +396,16 @@ struct AcpiMadtGenericRedistributor {typedef struct AcpiMadtGenericRedistributor AcpiMadtGenericRedistributor ; +struct AcpiMadtGenericTranslator { +ACPI_SUB_HEADER_DEF + uint16_t reserved; +uint32_t translation_id; +uint64_t base_address; +uint32_t reserved2; +}QEMU_PACKED ; + +typedef struct AcpiMadtGenericTranslator AcpiMadtGenericTranslator ; +/* * Generic Timer Description Table (GTDT) */
Signature · 1 line
2.5.5
PATCH v7 8/8 ARM: Virt: ACPI: Add GIC ITS description in ACPI MADT table
In reply to Eric AugerFrom: Shannon Zhao <[email protected]>
If GIC ITS is supported, add description in ACPI MADT table, then guest could use ITS when booting with ACPI.
---
v6 -> v7:
- added my Sob
--- hw/arm/virt-acpi-build.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
hw/arm/virt-acpi-build.c +12 -0
@@ -44,6 +44,7 @@#include "hw/pci/pcie_host.h" #include "hw/pci/pci.h" #include "sysemu/numa.h" +#include "kvm_arm.h" #define ARM_SPI_BASE 32#define ACPI_POWER_BUTTON_DEVICE "PWRB"
@@ -546,6 +547,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info) }if (guest_info->gic_version ==3 ) { +AcpiMadtGenericTranslator *gic_its;AcpiMadtGenericRedistributor *gicr =acpi_data_push (table_data,sizeof *gicr);
@@ -553,6 +555,16 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info) gicr->length =sizeof (*gicr); gicr->base_address =cpu_to_le64 (memmap[VIRT_GIC_REDIST ].base); gicr->range_length =cpu_to_le32 (memmap[VIRT_GIC_REDIST ].size); + +if (!its_class_name ()) { +return ; + } + + gic_its =acpi_data_push (table_data,sizeof *gic_its); + gic_its->type =ACPI_APIC_GENERIC_TRANSLATOR ; + gic_its->length =sizeof (*gic_its); + gic_its->translation_id =0 ; + gic_its->base_address =cpu_to_le64 (memmap[VIRT_GIC_ITS ].base); }else { gic_msi =acpi_data_push (table_data,sizeof *gic_msi); gic_msi->type =ACPI_APIC_GENERIC_MSI_FRAME ;
Signature · 1 line
2.5.5
Re: [Qemu-arm] [PATCH v7 4/8] kvm-all: Pass requester ID to MSI routing functions
In reply to Eric AugerQuoted 11 lines · Eric Auger
From: Pavel Fedin <[email protected]>
Introduce global
kvm_msi_use_devidflag plus associatedkvm_msi_devid_required()macro. Passes the device ID, if needed, while building the MSI route entry. Device IDs are required by the ARM GICv3 ITS (IRQ remapping function is based on this information).Signed-off-by Pavel Fedin <[email protected]>Signed-off-by Eric Auger <[email protected]>
thanks
-- PMM
Peter Maydell
AppliedRe: [Qemu-arm] [PATCH v7 5/8] hw/intc/arm_gicv3_its: Implement support for in-kernel ITS emulation
In reply to Eric AugerQuoted 14 lines · Eric Auger
From: Pavel Fedin <[email protected]>
The ITS control frame is in-kernel emulated while accesses to the
GITS_TRANSLATERare mediated through theKVM_SIGNAL_MSIioctl (MSI direct MSI injection advertised by theCAP_SIGNAL_MSIcapability)the
kvm_gsi_direct_mappingis explicitly set to false to emphasize the difference with GICv2M. Direct mapping cannot work with ITS since the content of the MSI data is not the target interrupt ID but an eventd id.GSI routing is advertised (
kvm_gsi_routing_allowed) as well as msi/irqfd signaling (kvm_msi_via_irqfd_allowed).
Quoted 6 lines
The MSI frame (
GITS_TRANSLATER) absolute GPA is computed on firstkvm_its_send_msi()call. It is then passed throughKVM_SIGNAL_MSIioctl.Signed-off-by Pavel Fedin <[email protected]>Signed-off-by Eric Auger <[email protected]>
Applied to target-arm.next, thanks.
-- PMM
Re: [Qemu-arm] [PATCH v7 5/8] hw/intc/arm_gicv3_its: Implement support for in-kernel ITS emulation
Quoted 19 lines · Peter Maydell
Quoted 18 lines · Eric Auger
From: Pavel Fedin <[email protected]>
The ITS control frame is in-kernel emulated while accesses to the
GITS_TRANSLATERare mediated through theKVM_SIGNAL_MSIioctl (MSI direct MSI injection advertised by theCAP_SIGNAL_MSIcapability)the
kvm_gsi_direct_mappingis explicitly set to false to emphasize the difference with GICv2M. Direct mapping cannot work with ITS since the content of the MSI data is not the target interrupt ID but an eventd id.GSI routing is advertised (
kvm_gsi_routing_allowed) as well as msi/irqfd signaling (kvm_msi_via_irqfd_allowed).The MSI frame (
GITS_TRANSLATER) absolute GPA is computed on firstkvm_its_send_msi()call. It is then passed throughKVM_SIGNAL_MSIioctl.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Pavel Fedin <[email protected]>Signed-off-by Eric Auger <[email protected]>Applied to target-arm.next, thanks.
Oops, meant to send that as a followup to the cover letter!
thanks
-- PMM
Peter Maydell
AppliedQuoted 20 lines · Eric Auger
This series introduces support for in-kernel GICv3 ITS emulation.
On dt guest the functionality is complete and was tested on Cavium ThunderX with virtio-net-pci and vhost-net.
On ACPI guest the series was tested with virtio-net-pci only. For vhost-net, using MSIX we currently miss the ACPI IORT table generation linking the PCIe host controller with the ITS. The work is ongoing and will be submitted separately. Anyway the kernel ACPI IORT ITS node support is not upstreamed yet.
The first patch is not really related to virtual ITS but advertises the KVM GSI routing support which goes along with MSI injection.
For ACPI ITS and PCIe support, use in-flight Tomasz' series:
- [PATCH V10 0/8] Introduce ACPI world to ITS,
https://lkml.org/lkml/2016/9/6/153
- Support for ARM64 ACPI based PCI host controller,
https://lwn.net/Articles/690995/
Quoted 3 lines
Git Information:
v7: https://github.com/eauger/qemu/tree/v2.7.0-vITS-v7
v6: https://github.com/eauger/qemu/tree/v2.7.0-vITS-v6
Applied to target-arm.next, thanks.
-- PMM