Set the MSI doorbell GPA property for accelerated SMMUv3 devices for use by KVM MSI setup. Also, since any meaningful use of vfio-pci devices with an accelerated SMMUv3 requires both KVM and a kernel irqchip, ensure those are specified when accel=on is selected.
Reviewed-by: Nicolin Chen <[email protected]> Signed-off-by: Shameer Kolothum <[email protected]> --- hw/arm/virt.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 9d0568a7d5..08feadf0a8 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -3052,6 +3052,26 @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev, /* The new SMMUv3 device is specific to the PCI bus */ object_property_set_bool(OBJECT(dev), "smmu_per_bus", true, NULL); } + if (object_property_find(OBJECT(dev), "accel") && + object_property_get_bool(OBJECT(dev), "accel", &error_abort)) { + hwaddr db_start; + + if (!kvm_enabled() || !kvm_irqchip_in_kernel()) { + error_setg(errp, "SMMUv3 accel=on requires KVM with " + "kernel-irqchip=on support"); + return; + } + + if (vms->msi_controller == VIRT_MSI_CTRL_ITS) { + /* GITS_TRANSLATER page + offset */ + db_start = base_memmap[VIRT_GIC_ITS].base + 0x10000 + 0x40; + } else { + /* MSI_SETSPI_NS page + offset */ + db_start = base_memmap[VIRT_GIC_V2M].base + 0x40; + } + object_property_set_uint(OBJECT(dev), "msi-gpa", db_start, + &error_abort); + } } } -- 2.43.0
