[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 08/15] vfio/common: Relax vIOMMU detection when DMA transl
|
From: |
Joao Martins |
|
Subject: |
Re: [PATCH v3 08/15] vfio/common: Relax vIOMMU detection when DMA translation is off |
|
Date: |
Wed, 31 May 2023 10:39:52 +0100 |
On 30/05/2023 22:39, Philippe Mathieu-Daudé wrote:
> On 30/5/23 19:59, Joao Martins wrote:
>> Relax the vIOMMU migration blocker when the underlying IOMMU reports that
>> DMA translation disabled. When it is disabled there will be no DMA mappings
>> via the vIOMMU and the guest only uses it for Interrupt Remapping.
>>
>> The latter is done via the vfio_viommu_preset() return value whereby in
>> addition to validating that the address space is memory, we also check
>> whether the IOMMU MR has DMA translation on.
>
>> Assume it is enabled if
>> there's no IOMMU MR or if no dma-translation property is supported.
>
> This comment ^ ...
>
>> Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
>> ---
>> hw/vfio/common.c | 22 +++++++++++++++++++++-
>> 1 file changed, 21 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/vfio/common.c b/hw/vfio/common.c
>> index fa8fd949b1cf..060acccb3443 100644
>> --- a/hw/vfio/common.c
>> +++ b/hw/vfio/common.c
>> @@ -414,12 +414,32 @@ void vfio_unblock_multiple_devices_migration(void)
>> multiple_devices_migration_blocker = NULL;
>> }
>> +static bool vfio_viommu_dma_translation_enabled(VFIOAddressSpace *space)
>> +{
>> + bool enabled = false;
>> + int ret;
>> +
>> + if (!space->iommu_mr) {
>> + return true;
>> + }
>> +
>> + ret = memory_region_iommu_get_attr(space->iommu_mr,
>> + IOMMU_ATTR_DMA_TRANSLATION,
>> + &enabled);
>> + if (ret || enabled) {
>
> ... could be helpful if duplicated here.
>
I'll add it.
>> + return true;
>> + }
>> +
>> + return false;
>> +}
>
- [PATCH v3 01/15] hw/pci: Refactor pci_device_iommu_address_space(), (continued)
- [PATCH v3 01/15] hw/pci: Refactor pci_device_iommu_address_space(), Joao Martins, 2023/05/30
- [PATCH v3 03/15] hw/pci: Add a pci_device_iommu_memory_region() helper, Joao Martins, 2023/05/30
- [PATCH v3 04/15] intel-iommu: Switch to pci_setup_iommu_info(), Joao Martins, 2023/05/30
- [PATCH v3 05/15] vfio/common: Track the IOMMU MR behind the device in addition to the AS, Joao Martins, 2023/05/30
- [PATCH v3 06/15] memory/iommu: Add IOMMU_ATTR_DMA_TRANSLATION attribute, Joao Martins, 2023/05/30
- [PATCH v3 07/15] intel-iommu: Implement get_attr() method, Joao Martins, 2023/05/30
- [PATCH v3 08/15] vfio/common: Relax vIOMMU detection when DMA translation is off, Joao Martins, 2023/05/30
- [PATCH v3 09/15] memory/iommu: Add IOMMU_ATTR_MAX_IOVA attribute, Joao Martins, 2023/05/30
- [PATCH v3 10/15] intel-iommu: Implement IOMMU_ATTR_MAX_IOVA get_attr() attribute, Joao Martins, 2023/05/30
- [PATCH v3 11/15] vfio/common: Move dirty tracking ranges update to helper, Joao Martins, 2023/05/30
- [PATCH v3 12/15] vfio/common: Support device dirty page tracking with vIOMMU, Joao Martins, 2023/05/30
- [PATCH v3 13/15] vfio/common: Extract vIOMMU code from vfio_sync_dirty_bitmap(), Joao Martins, 2023/05/30
- [PATCH v3 14/15] vfio/common: Optimize device dirty page tracking with vIOMMU, Joao Martins, 2023/05/30
- [PATCH v3 15/15] vfio/common: Block migration with vIOMMUs without address width limits, Joao Martins, 2023/05/30