[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v5 5/5] hw/arm/virt: Let the virtio-iommu bypass MSIs
From: |
Peter Maydell |
Subject: |
Re: [PATCH v5 5/5] hw/arm/virt: Let the virtio-iommu bypass MSIs |
Date: |
Thu, 25 Jun 2020 11:01:06 +0100 |
On Wed, 24 Jun 2020 at 14:27, Eric Auger <eric.auger@redhat.com> wrote:
>
> At the moment the virtio-iommu translates MSI transactions.
> This behavior is inherited from ARM SMMU. The virt machine
> code knows where the guest MSI doorbells are so we can easily
> declare those regions as VIRTIO_IOMMU_RESV_MEM_T_MSI. With that
> setting the guest will not map MSIs through the IOMMU and those
> transactions will be simply bypassed.
>
> Depending on which MSI controller is in use (ITS or GICV2M),
> we declare either:
> - the ITS interrupt translation space (ITS_base + 0x10000),
> containing the GITS_TRANSLATOR or
> - The GICV2M single frame, containing the MSI_SETSP_NS register.
>
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
> Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
>
> static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev,
> DeviceState *dev, Error **errp)
> {
> + VirtMachineState *vms = VIRT_MACHINE(hotplug_dev);
> +
> if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
> virt_memory_pre_plug(hotplug_dev, dev, errp);
> + } else if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) {
> + /* we declare a VIRTIO_IOMMU_RESV_MEM_T_MSI region */
> +
> + if (vms->msi_controller == VIRT_MSI_CTRL_ITS) {
> + /* GITS_TRANSLATER page */
> + qdev_prop_set_uint32(dev, "len-reserved-regions", 1);
> + qdev_prop_set_string(dev, "reserved-regions[0]",
> + "0x8090000:0x809FFFF:1");
> + } else if (vms->msi_controller == VIRT_MSI_CTRL_GICV2M) {
> + /* MSI_SETSPI_NS page */
> + qdev_prop_set_uint32(dev, "len-reserved-regions", 1);
> + qdev_prop_set_string(dev, "reserved-regions[0]",
> + "0x8020000:0x8020FFF:1");
This hardcodes addresses and lengths that are in the
base_memmap[] array for VIRT_GIC_ITS and VIRT_GIC_V2M,
so it's setting up a bear trap if we ever decide to
move those. Could we construct the string from the
base_memmap[] array entry values instead, please ?
thanks
-- PMM
[PATCH v5 3/5] virtio-iommu: Handle reserved regions in the translation process, Eric Auger, 2020/06/24
Re: [PATCH v5 0/5] VIRTIO-IOMMU probe request support and MSI bypass on ARM, Michael S. Tsirkin, 2020/06/24