[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH rfcv2 18/18] intel_iommu: Block migration if cap is updated
From: |
Joao Martins |
Subject: |
Re: [PATCH rfcv2 18/18] intel_iommu: Block migration if cap is updated |
Date: |
Tue, 13 Feb 2024 10:55:35 +0000 |
On 01/02/2024 07:28, Zhenzhong Duan wrote:
> When there is VFIO device and vIOMMU cap/ecap is updated based on host
> IOMMU cap/ecap, migration should be blocked.
>
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Is this really needed considering migration with vIOMMU is already blocked
anyways?
> ---
> hw/i386/intel_iommu.c | 16 ++++++++++++++--
> 1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
> index 72cc8b2c71..7f9ff653b2 100644
> --- a/hw/i386/intel_iommu.c
> +++ b/hw/i386/intel_iommu.c
> @@ -39,6 +39,7 @@
> #include "hw/i386/apic_internal.h"
> #include "kvm/kvm_i386.h"
> #include "migration/vmstate.h"
> +#include "migration/blocker.h"
> #include "trace.h"
>
> #define S_AW_BITS (VTD_MGAW_FROM_CAP(s->cap) + 1)
> @@ -3829,6 +3830,8 @@ static int vtd_check_legacy_hdev(IntelIOMMUState *s,
> return 0;
> }
>
> +static Error *vtd_mig_blocker;
> +
> static int vtd_check_iommufd_hdev(IntelIOMMUState *s,
> IOMMUFDDevice *idev,
> Error **errp)
> @@ -3860,8 +3863,17 @@ static int vtd_check_iommufd_hdev(IntelIOMMUState *s,
> tmp_cap |= VTD_CAP_MGAW(host_mgaw + 1);
> }
>
> - s->cap = tmp_cap;
> - return 0;
> + if (s->cap != tmp_cap) {
> + if (vtd_mig_blocker == NULL) {
> + error_setg(&vtd_mig_blocker,
> + "cap/ecap update from host IOMMU block migration");
> + ret = migrate_add_blocker(&vtd_mig_blocker, errp);
> + }
> + if (!ret) {
> + s->cap = tmp_cap;
> + }
> + }
> + return ret;
> }
>
> static int vtd_check_hdev(IntelIOMMUState *s, VTDHostIOMMUDevice *vtd_hdev,
- [PATCH rfcv2 12/18] vfio: Initialize host IOMMU device and pass to vIOMMU, (continued)
- [PATCH rfcv2 12/18] vfio: Initialize host IOMMU device and pass to vIOMMU, Zhenzhong Duan, 2024/02/01
- [PATCH rfcv2 11/18] intel_iommu: Add set/unset_iommu_device callback, Zhenzhong Duan, 2024/02/01
- [PATCH rfcv2 13/18] intel_iommu: Extract out vtd_cap_init to initialize cap/ecap, Zhenzhong Duan, 2024/02/01
- [PATCH rfcv2 14/18] intel_iommu: Add a framework to check and sync host IOMMU cap/ecap, Zhenzhong Duan, 2024/02/01
- [PATCH rfcv2 18/18] intel_iommu: Block migration if cap is updated, Zhenzhong Duan, 2024/02/01
- Re: [PATCH rfcv2 18/18] intel_iommu: Block migration if cap is updated,
Joao Martins <=
- [PATCH rfcv2 15/18] backends/iommufd: Introduce helper function iommufd_device_get_info(), Zhenzhong Duan, 2024/02/01
- [PATCH rfcv2 17/18] intel_iommu: Use mgaw instead of s->aw_bits, Zhenzhong Duan, 2024/02/01
- [PATCH rfcv2 16/18] intel_iommu: Implement check and sync mechanism in iommufd mode, Zhenzhong Duan, 2024/02/01