* [PATCH 1/3] iommu/vt-d: Allow replacing no_pasid iommu_domain
2026-01-07 20:17 [PATCH 0/3] iommu/vt-d: Add support to hitless replace IOMMU domain Samiullah Khawaja
@ 2026-01-07 20:17 ` Samiullah Khawaja
2026-01-07 20:17 ` [PATCH 2/3] vfio: selftests: Add support of creating iommus from iommufd Samiullah Khawaja
` (2 subsequent siblings)
3 siblings, 0 replies; 12+ messages in thread
From: Samiullah Khawaja @ 2026-01-07 20:17 UTC (permalink / raw)
To: David Woodhouse, Lu Baolu, Joerg Roedel, Will Deacon,
Pasha Tatashin, Jason Gunthorpe, David Matlack
Cc: Samiullah Khawaja, Robin Murphy, Pratyush Yadav, Kevin Tian,
Alex Williamson, Shuah Khan, iommu, linux-kernel, kvm,
Saeed Mahameed, Adithya Jayachandran, Parav Pandit,
Leon Romanovsky, William Tu
Intel IOMMU driver already supports replacing IOMMU domains attachments
with PASIDs. Add support for replacing a domain attached with no_pasid.
This includes replacing domains in legacy mode.
Signed-off-by: Samiullah Khawaja <skhawaja@google.com>
---
drivers/iommu/intel/iommu.c | 107 ++++++++++++++++++++++++++----------
1 file changed, 77 insertions(+), 30 deletions(-)
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 134302fbcd92..c0e359fd3ee1 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -1140,6 +1140,7 @@ static void context_present_cache_flush(struct intel_iommu *iommu, u16 did,
}
static int domain_context_mapping_one(struct dmar_domain *domain,
+ struct dmar_domain *old_domain,
struct intel_iommu *iommu,
u8 bus, u8 devfn)
{
@@ -1148,7 +1149,8 @@ static int domain_context_mapping_one(struct dmar_domain *domain,
u16 did = domain_id_iommu(domain, iommu);
int translation = CONTEXT_TT_MULTI_LEVEL;
struct pt_iommu_vtdss_hw_info pt_info;
- struct context_entry *context;
+ struct context_entry *context, new_context;
+ u16 did_old;
int ret;
if (WARN_ON(!intel_domain_is_ss_paging(domain)))
@@ -1166,26 +1168,44 @@ static int domain_context_mapping_one(struct dmar_domain *domain,
goto out_unlock;
ret = 0;
- if (context_present(context) && !context_copied(iommu, bus, devfn))
+ if (!old_domain && (context_present(context) && !context_copied(iommu, bus, devfn)))
goto out_unlock;
+ if (old_domain) {
+ did_old = context_domain_id(context);
+ WARN_ON(did_old != domain_id_iommu(old_domain, iommu));
+ }
+
copied_context_tear_down(iommu, context, bus, devfn);
- context_clear_entry(context);
- context_set_domain_id(context, did);
+ context_set_domain_id(&new_context, did);
if (info && info->ats_supported)
translation = CONTEXT_TT_DEV_IOTLB;
else
translation = CONTEXT_TT_MULTI_LEVEL;
- context_set_address_root(context, pt_info.ssptptr);
- context_set_address_width(context, pt_info.aw);
- context_set_translation_type(context, translation);
- context_set_fault_enable(context);
- context_set_present(context);
+ context_set_address_root(&new_context, pt_info.ssptptr);
+ context_set_address_width(&new_context, pt_info.aw);
+ context_set_translation_type(&new_context, translation);
+ context_set_fault_enable(&new_context);
+ context_set_present(&new_context);
+
+ *context = new_context;
if (!ecap_coherent(iommu->ecap))
clflush_cache_range(context, sizeof(*context));
- context_present_cache_flush(iommu, did, bus, devfn);
+
+ /*
+ * Spec 6.5.3.3, changing a present context entry requires,
+ * - IOTLB invalidation for each effected Domain.
+ * - Issue Device IOTLB invalidation for function.
+ */
+ if (old_domain) {
+ intel_context_flush_no_pasid(info, context, did);
+ intel_context_flush_no_pasid(info, context, did_old);
+ } else {
+ context_present_cache_flush(iommu, did, bus, devfn);
+ }
+
ret = 0;
out_unlock:
@@ -1194,30 +1214,39 @@ static int domain_context_mapping_one(struct dmar_domain *domain,
return ret;
}
+struct domain_context_mapping_data {
+ struct dmar_domain *domain;
+ struct dmar_domain *old_domain;
+};
+
static int domain_context_mapping_cb(struct pci_dev *pdev,
u16 alias, void *opaque)
{
struct device_domain_info *info = dev_iommu_priv_get(&pdev->dev);
struct intel_iommu *iommu = info->iommu;
- struct dmar_domain *domain = opaque;
+ struct domain_context_mapping_data *data = opaque;
- return domain_context_mapping_one(domain, iommu,
+ return domain_context_mapping_one(data->domain, data->old_domain, iommu,
PCI_BUS_NUM(alias), alias & 0xff);
}
static int
-domain_context_mapping(struct dmar_domain *domain, struct device *dev)
+domain_context_mapping(struct dmar_domain *domain,
+ struct dmar_domain *old_domain, struct device *dev)
{
struct device_domain_info *info = dev_iommu_priv_get(dev);
struct intel_iommu *iommu = info->iommu;
u8 bus = info->bus, devfn = info->devfn;
+ struct domain_context_mapping_data data;
int ret;
if (!dev_is_pci(dev))
- return domain_context_mapping_one(domain, iommu, bus, devfn);
+ return domain_context_mapping_one(domain, old_domain, iommu, bus, devfn);
+ data.domain = domain;
+ data.old_domain = old_domain;
ret = pci_for_each_dma_alias(to_pci_dev(dev),
- domain_context_mapping_cb, domain);
+ domain_context_mapping_cb, &data);
if (ret)
return ret;
@@ -1309,18 +1338,28 @@ static int domain_setup_first_level(struct intel_iommu *iommu,
pt_info.gcr3_pt, flags, old);
}
-static int dmar_domain_attach_device(struct dmar_domain *domain,
- struct device *dev)
+static int device_replace_dmar_domain(struct dmar_domain *domain,
+ struct dmar_domain *old_domain,
+ struct device *dev)
{
struct device_domain_info *info = dev_iommu_priv_get(dev);
struct intel_iommu *iommu = info->iommu;
unsigned long flags;
int ret;
+ if (old_domain && dev_is_real_dma_subdevice(dev))
+ return -EOPNOTSUPP;
+
ret = domain_attach_iommu(domain, iommu);
if (ret)
return ret;
+ if (old_domain) {
+ spin_lock_irqsave(&info->domain->lock, flags);
+ list_del(&info->link);
+ spin_unlock_irqrestore(&info->domain->lock, flags);
+ }
+
info->domain = domain;
info->domain_attached = true;
spin_lock_irqsave(&domain->lock, flags);
@@ -1331,27 +1370,27 @@ static int dmar_domain_attach_device(struct dmar_domain *domain,
return 0;
if (!sm_supported(iommu))
- ret = domain_context_mapping(domain, dev);
+ ret = domain_context_mapping(domain, old_domain, dev);
else if (intel_domain_is_fs_paging(domain))
ret = domain_setup_first_level(iommu, domain, dev,
- IOMMU_NO_PASID, NULL);
+ IOMMU_NO_PASID, &old_domain->domain);
else if (intel_domain_is_ss_paging(domain))
ret = domain_setup_second_level(iommu, domain, dev,
- IOMMU_NO_PASID, NULL);
+ IOMMU_NO_PASID, &old_domain->domain);
else if (WARN_ON(true))
ret = -EINVAL;
- if (ret)
- goto out_block_translation;
+ if (!ret)
+ ret = cache_tag_assign_domain(domain, dev, IOMMU_NO_PASID);
- ret = cache_tag_assign_domain(domain, dev, IOMMU_NO_PASID);
if (ret)
- goto out_block_translation;
+ device_block_translation(dev);
- return 0;
+ if (old_domain) {
+ cache_tag_unassign_domain(old_domain, dev, IOMMU_NO_PASID);
+ domain_detach_iommu(old_domain, iommu);
+ }
-out_block_translation:
- device_block_translation(dev);
return ret;
}
@@ -3127,19 +3166,27 @@ static int intel_iommu_attach_device(struct iommu_domain *domain,
struct device *dev,
struct iommu_domain *old)
{
+ struct device_domain_info *info = dev_iommu_priv_get(dev);
int ret;
- device_block_translation(dev);
+ if (dev_is_real_dma_subdevice(dev) ||
+ domain->type != __IOMMU_DOMAIN_PAGING ||
+ !info->domain || &info->domain->domain != old)
+ old = NULL;
+
+ if (!old)
+ device_block_translation(dev);
ret = paging_domain_compatible(domain, dev);
if (ret)
return ret;
- ret = iopf_for_domain_set(domain, dev);
+ ret = iopf_for_domain_replace(domain, old, dev);
if (ret)
return ret;
- ret = dmar_domain_attach_device(to_dmar_domain(domain), dev);
+ ret = device_replace_dmar_domain(to_dmar_domain(domain),
+ old ? to_dmar_domain(old) : NULL, dev);
if (ret)
iopf_for_domain_remove(domain, dev);
--
2.52.0.351.gbe84eed79e-goog
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH 2/3] vfio: selftests: Add support of creating iommus from iommufd
2026-01-07 20:17 [PATCH 0/3] iommu/vt-d: Add support to hitless replace IOMMU domain Samiullah Khawaja
2026-01-07 20:17 ` [PATCH 1/3] iommu/vt-d: Allow replacing no_pasid iommu_domain Samiullah Khawaja
@ 2026-01-07 20:17 ` Samiullah Khawaja
2026-01-08 0:29 ` David Matlack
2026-01-07 20:18 ` [PATCH 3/3] vfio: selftests: Add iommufd hwpt replace test Samiullah Khawaja
2026-01-07 20:28 ` [PATCH 0/3] iommu/vt-d: Add support to hitless replace IOMMU domain Jason Gunthorpe
3 siblings, 1 reply; 12+ messages in thread
From: Samiullah Khawaja @ 2026-01-07 20:17 UTC (permalink / raw)
To: David Woodhouse, Lu Baolu, Joerg Roedel, Will Deacon,
Pasha Tatashin, Jason Gunthorpe, David Matlack
Cc: Samiullah Khawaja, Robin Murphy, Pratyush Yadav, Kevin Tian,
Alex Williamson, Shuah Khan, iommu, linux-kernel, kvm,
Saeed Mahameed, Adithya Jayachandran, Parav Pandit,
Leon Romanovsky, William Tu
Add API to init a struct iommu using an already opened iommufd instance
and attach devices to it.
Signed-off-by: Samiullah Khawaja <skhawaja@google.com>
---
.../vfio/lib/include/libvfio/iommu.h | 2 +
.../lib/include/libvfio/vfio_pci_device.h | 2 +
tools/testing/selftests/vfio/lib/iommu.c | 60 +++++++++++++++++--
.../selftests/vfio/lib/vfio_pci_device.c | 16 ++++-
4 files changed, 74 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/vfio/lib/include/libvfio/iommu.h b/tools/testing/selftests/vfio/lib/include/libvfio/iommu.h
index 5c9b9dc6d993..9e96da1e6fd3 100644
--- a/tools/testing/selftests/vfio/lib/include/libvfio/iommu.h
+++ b/tools/testing/selftests/vfio/lib/include/libvfio/iommu.h
@@ -29,10 +29,12 @@ struct iommu {
int container_fd;
int iommufd;
u32 ioas_id;
+ u32 hwpt_id;
struct list_head dma_regions;
};
struct iommu *iommu_init(const char *iommu_mode);
+struct iommu *iommufd_iommu_init(int iommufd, u32 dev_id);
void iommu_cleanup(struct iommu *iommu);
int __iommu_map(struct iommu *iommu, struct dma_region *region);
diff --git a/tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h b/tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h
index 2858885a89bb..1143ceb6a9b8 100644
--- a/tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h
+++ b/tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h
@@ -19,6 +19,7 @@ struct vfio_pci_device {
const char *bdf;
int fd;
int group_fd;
+ u32 dev_id;
struct iommu *iommu;
@@ -65,6 +66,7 @@ void vfio_pci_config_access(struct vfio_pci_device *device, bool write,
#define vfio_pci_config_writew(_d, _o, _v) vfio_pci_config_write(_d, _o, _v, u16)
#define vfio_pci_config_writel(_d, _o, _v) vfio_pci_config_write(_d, _o, _v, u32)
+void vfio_pci_device_attach_iommu(struct vfio_pci_device *device, struct iommu *iommu);
void vfio_pci_irq_enable(struct vfio_pci_device *device, u32 index,
u32 vector, int count);
void vfio_pci_irq_disable(struct vfio_pci_device *device, u32 index);
diff --git a/tools/testing/selftests/vfio/lib/iommu.c b/tools/testing/selftests/vfio/lib/iommu.c
index 58b7fb7430d4..2c67d7e24d0c 100644
--- a/tools/testing/selftests/vfio/lib/iommu.c
+++ b/tools/testing/selftests/vfio/lib/iommu.c
@@ -408,6 +408,18 @@ struct iommu_iova_range *iommu_iova_ranges(struct iommu *iommu, u32 *nranges)
return ranges;
}
+static u32 iommufd_hwpt_alloc(struct iommu *iommu, u32 dev_id)
+{
+ struct iommu_hwpt_alloc args = {
+ .size = sizeof(args),
+ .pt_id = iommu->ioas_id,
+ .dev_id = dev_id,
+ };
+
+ ioctl_assert(iommu->iommufd, IOMMU_HWPT_ALLOC, &args);
+ return args.out_hwpt_id;
+}
+
static u32 iommufd_ioas_alloc(int iommufd)
{
struct iommu_ioas_alloc args = {
@@ -418,11 +430,9 @@ static u32 iommufd_ioas_alloc(int iommufd)
return args.out_ioas_id;
}
-struct iommu *iommu_init(const char *iommu_mode)
+static struct iommu *iommu_alloc(const char *iommu_mode)
{
- const char *container_path;
struct iommu *iommu;
- int version;
iommu = calloc(1, sizeof(*iommu));
VFIO_ASSERT_NOT_NULL(iommu);
@@ -430,6 +440,16 @@ struct iommu *iommu_init(const char *iommu_mode)
INIT_LIST_HEAD(&iommu->dma_regions);
iommu->mode = lookup_iommu_mode(iommu_mode);
+ return iommu;
+}
+
+struct iommu *iommu_init(const char *iommu_mode)
+{
+ const char *container_path;
+ struct iommu *iommu;
+ int version;
+
+ iommu = iommu_alloc(iommu_mode);
container_path = iommu->mode->container_path;
if (container_path) {
@@ -453,10 +473,42 @@ struct iommu *iommu_init(const char *iommu_mode)
return iommu;
}
+struct iommu *iommufd_iommu_init(int iommufd, u32 dev_id)
+{
+ struct iommu *iommu;
+
+ iommu = iommu_alloc("iommufd");
+
+ iommu->iommufd = dup(iommufd);
+ VFIO_ASSERT_GT(iommu->iommufd, 0);
+
+ iommu->ioas_id = iommufd_ioas_alloc(iommu->iommufd);
+ iommu->hwpt_id = iommufd_hwpt_alloc(iommu, dev_id);
+
+ return iommu;
+}
+
+static void iommufd_iommu_cleanup(struct iommu *iommu)
+{
+ struct iommu_destroy args = {
+ .size = sizeof(args),
+ };
+
+ if (iommu->hwpt_id) {
+ args.id = iommu->hwpt_id;
+ ioctl_assert(iommu->iommufd, IOMMU_DESTROY, &args);
+ }
+
+ args.id = iommu->ioas_id;
+ ioctl_assert(iommu->iommufd, IOMMU_DESTROY, &args);
+
+ VFIO_ASSERT_EQ(close(iommu->iommufd), 0);
+}
+
void iommu_cleanup(struct iommu *iommu)
{
if (iommu->iommufd)
- VFIO_ASSERT_EQ(close(iommu->iommufd), 0);
+ iommufd_iommu_cleanup(iommu);
else
VFIO_ASSERT_EQ(close(iommu->container_fd), 0);
diff --git a/tools/testing/selftests/vfio/lib/vfio_pci_device.c b/tools/testing/selftests/vfio/lib/vfio_pci_device.c
index fac4c0ecadef..9bc1f5ade5c4 100644
--- a/tools/testing/selftests/vfio/lib/vfio_pci_device.c
+++ b/tools/testing/selftests/vfio/lib/vfio_pci_device.c
@@ -298,7 +298,7 @@ const char *vfio_pci_get_cdev_path(const char *bdf)
return cdev_path;
}
-static void vfio_device_bind_iommufd(int device_fd, int iommufd)
+static int vfio_device_bind_iommufd(int device_fd, int iommufd)
{
struct vfio_device_bind_iommufd args = {
.argsz = sizeof(args),
@@ -306,6 +306,7 @@ static void vfio_device_bind_iommufd(int device_fd, int iommufd)
};
ioctl_assert(device_fd, VFIO_DEVICE_BIND_IOMMUFD, &args);
+ return args.out_devid;
}
static void vfio_device_attach_iommufd_pt(int device_fd, u32 pt_id)
@@ -326,10 +327,21 @@ static void vfio_pci_iommufd_setup(struct vfio_pci_device *device, const char *b
VFIO_ASSERT_GE(device->fd, 0);
free((void *)cdev_path);
- vfio_device_bind_iommufd(device->fd, device->iommu->iommufd);
+ device->dev_id = vfio_device_bind_iommufd(device->fd, device->iommu->iommufd);
vfio_device_attach_iommufd_pt(device->fd, device->iommu->ioas_id);
}
+void vfio_pci_device_attach_iommu(struct vfio_pci_device *device, struct iommu *iommu)
+{
+ u32 pt_id = iommu->ioas_id;
+
+ if (iommu->hwpt_id)
+ pt_id = iommu->hwpt_id;
+
+ VFIO_ASSERT_NE(pt_id, 0);
+ vfio_device_attach_iommufd_pt(device->fd, pt_id);
+}
+
struct vfio_pci_device *vfio_pci_device_init(const char *bdf, struct iommu *iommu)
{
struct vfio_pci_device *device;
--
2.52.0.351.gbe84eed79e-goog
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH 2/3] vfio: selftests: Add support of creating iommus from iommufd
2026-01-07 20:17 ` [PATCH 2/3] vfio: selftests: Add support of creating iommus from iommufd Samiullah Khawaja
@ 2026-01-08 0:29 ` David Matlack
2026-01-09 21:39 ` Samiullah Khawaja
0 siblings, 1 reply; 12+ messages in thread
From: David Matlack @ 2026-01-08 0:29 UTC (permalink / raw)
To: Samiullah Khawaja
Cc: David Woodhouse, Lu Baolu, Joerg Roedel, Will Deacon,
Pasha Tatashin, Jason Gunthorpe, Robin Murphy, Pratyush Yadav,
Kevin Tian, Alex Williamson, Shuah Khan, iommu, linux-kernel, kvm,
Saeed Mahameed, Adithya Jayachandran, Parav Pandit,
Leon Romanovsky, William Tu
On 2026-01-07 08:17 PM, Samiullah Khawaja wrote:
> Add API to init a struct iommu using an already opened iommufd instance
> and attach devices to it.
>
> Signed-off-by: Samiullah Khawaja <skhawaja@google.com>
> ---
> .../vfio/lib/include/libvfio/iommu.h | 2 +
> .../lib/include/libvfio/vfio_pci_device.h | 2 +
> tools/testing/selftests/vfio/lib/iommu.c | 60 +++++++++++++++++--
> .../selftests/vfio/lib/vfio_pci_device.c | 16 ++++-
> 4 files changed, 74 insertions(+), 6 deletions(-)
>
> diff --git a/tools/testing/selftests/vfio/lib/include/libvfio/iommu.h b/tools/testing/selftests/vfio/lib/include/libvfio/iommu.h
> index 5c9b9dc6d993..9e96da1e6fd3 100644
> --- a/tools/testing/selftests/vfio/lib/include/libvfio/iommu.h
> +++ b/tools/testing/selftests/vfio/lib/include/libvfio/iommu.h
> @@ -29,10 +29,12 @@ struct iommu {
> int container_fd;
> int iommufd;
> u32 ioas_id;
> + u32 hwpt_id;
> struct list_head dma_regions;
> };
>
> struct iommu *iommu_init(const char *iommu_mode);
> +struct iommu *iommufd_iommu_init(int iommufd, u32 dev_id);
> void iommu_cleanup(struct iommu *iommu);
>
> int __iommu_map(struct iommu *iommu, struct dma_region *region);
> diff --git a/tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h b/tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h
> index 2858885a89bb..1143ceb6a9b8 100644
> --- a/tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h
> +++ b/tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h
> @@ -19,6 +19,7 @@ struct vfio_pci_device {
> const char *bdf;
> int fd;
> int group_fd;
> + u32 dev_id;
>
> struct iommu *iommu;
>
> @@ -65,6 +66,7 @@ void vfio_pci_config_access(struct vfio_pci_device *device, bool write,
> #define vfio_pci_config_writew(_d, _o, _v) vfio_pci_config_write(_d, _o, _v, u16)
> #define vfio_pci_config_writel(_d, _o, _v) vfio_pci_config_write(_d, _o, _v, u32)
>
> +void vfio_pci_device_attach_iommu(struct vfio_pci_device *device, struct iommu *iommu);
> void vfio_pci_irq_enable(struct vfio_pci_device *device, u32 index,
> u32 vector, int count);
> void vfio_pci_irq_disable(struct vfio_pci_device *device, u32 index);
> diff --git a/tools/testing/selftests/vfio/lib/iommu.c b/tools/testing/selftests/vfio/lib/iommu.c
> index 58b7fb7430d4..2c67d7e24d0c 100644
> --- a/tools/testing/selftests/vfio/lib/iommu.c
> +++ b/tools/testing/selftests/vfio/lib/iommu.c
> @@ -408,6 +408,18 @@ struct iommu_iova_range *iommu_iova_ranges(struct iommu *iommu, u32 *nranges)
> return ranges;
> }
>
> +static u32 iommufd_hwpt_alloc(struct iommu *iommu, u32 dev_id)
> +{
> + struct iommu_hwpt_alloc args = {
> + .size = sizeof(args),
> + .pt_id = iommu->ioas_id,
> + .dev_id = dev_id,
> + };
> +
> + ioctl_assert(iommu->iommufd, IOMMU_HWPT_ALLOC, &args);
> + return args.out_hwpt_id;
> +}
> +
> static u32 iommufd_ioas_alloc(int iommufd)
> {
> struct iommu_ioas_alloc args = {
> @@ -418,11 +430,9 @@ static u32 iommufd_ioas_alloc(int iommufd)
> return args.out_ioas_id;
> }
>
> -struct iommu *iommu_init(const char *iommu_mode)
> +static struct iommu *iommu_alloc(const char *iommu_mode)
> {
> - const char *container_path;
> struct iommu *iommu;
> - int version;
>
> iommu = calloc(1, sizeof(*iommu));
> VFIO_ASSERT_NOT_NULL(iommu);
> @@ -430,6 +440,16 @@ struct iommu *iommu_init(const char *iommu_mode)
> INIT_LIST_HEAD(&iommu->dma_regions);
>
> iommu->mode = lookup_iommu_mode(iommu_mode);
> + return iommu;
> +}
> +
> +struct iommu *iommu_init(const char *iommu_mode)
> +{
> + const char *container_path;
> + struct iommu *iommu;
> + int version;
> +
> + iommu = iommu_alloc(iommu_mode);
>
> container_path = iommu->mode->container_path;
> if (container_path) {
> @@ -453,10 +473,42 @@ struct iommu *iommu_init(const char *iommu_mode)
> return iommu;
> }
>
> +struct iommu *iommufd_iommu_init(int iommufd, u32 dev_id)
I don't think the name really captures what this routine is doing. How
about iommufd_dup()?
> +{
> + struct iommu *iommu;
> +
> + iommu = iommu_alloc("iommufd");
> +
> + iommu->iommufd = dup(iommufd);
> + VFIO_ASSERT_GT(iommu->iommufd, 0);
> +
> + iommu->ioas_id = iommufd_ioas_alloc(iommu->iommufd);
> + iommu->hwpt_id = iommufd_hwpt_alloc(iommu, dev_id);
> +
> + return iommu;
> +}
> +
> +static void iommufd_iommu_cleanup(struct iommu *iommu)
nit: iommufd_cleanup()
> +{
> + struct iommu_destroy args = {
> + .size = sizeof(args),
> + };
> +
> + if (iommu->hwpt_id) {
> + args.id = iommu->hwpt_id;
> + ioctl_assert(iommu->iommufd, IOMMU_DESTROY, &args);
> + }
> +
> + args.id = iommu->ioas_id;
> + ioctl_assert(iommu->iommufd, IOMMU_DESTROY, &args);
> +
> + VFIO_ASSERT_EQ(close(iommu->iommufd), 0);
> +}
> +
> void iommu_cleanup(struct iommu *iommu)
> {
> if (iommu->iommufd)
> - VFIO_ASSERT_EQ(close(iommu->iommufd), 0);
> + iommufd_iommu_cleanup(iommu);
> else
> VFIO_ASSERT_EQ(close(iommu->container_fd), 0);
>
> diff --git a/tools/testing/selftests/vfio/lib/vfio_pci_device.c b/tools/testing/selftests/vfio/lib/vfio_pci_device.c
> index fac4c0ecadef..9bc1f5ade5c4 100644
> --- a/tools/testing/selftests/vfio/lib/vfio_pci_device.c
> +++ b/tools/testing/selftests/vfio/lib/vfio_pci_device.c
> @@ -298,7 +298,7 @@ const char *vfio_pci_get_cdev_path(const char *bdf)
> return cdev_path;
> }
>
> -static void vfio_device_bind_iommufd(int device_fd, int iommufd)
> +static int vfio_device_bind_iommufd(int device_fd, int iommufd)
> {
> struct vfio_device_bind_iommufd args = {
> .argsz = sizeof(args),
> @@ -306,6 +306,7 @@ static void vfio_device_bind_iommufd(int device_fd, int iommufd)
> };
>
> ioctl_assert(device_fd, VFIO_DEVICE_BIND_IOMMUFD, &args);
> + return args.out_devid;
> }
>
> static void vfio_device_attach_iommufd_pt(int device_fd, u32 pt_id)
> @@ -326,10 +327,21 @@ static void vfio_pci_iommufd_setup(struct vfio_pci_device *device, const char *b
> VFIO_ASSERT_GE(device->fd, 0);
> free((void *)cdev_path);
>
> - vfio_device_bind_iommufd(device->fd, device->iommu->iommufd);
> + device->dev_id = vfio_device_bind_iommufd(device->fd, device->iommu->iommufd);
> vfio_device_attach_iommufd_pt(device->fd, device->iommu->ioas_id);
> }
>
> +void vfio_pci_device_attach_iommu(struct vfio_pci_device *device, struct iommu *iommu)
> +{
> + u32 pt_id = iommu->ioas_id;
/* Only iommufd supports changing struct iommu attachments */
VFIO_ASSERT_TRUE(iommu->iommufd);
> +
> + if (iommu->hwpt_id)
> + pt_id = iommu->hwpt_id;
> +
> + VFIO_ASSERT_NE(pt_id, 0);
> + vfio_device_attach_iommufd_pt(device->fd, pt_id);
device->iommu = iommu;
> +}
> +
> struct vfio_pci_device *vfio_pci_device_init(const char *bdf, struct iommu *iommu)
> {
> struct vfio_pci_device *device;
> --
> 2.52.0.351.gbe84eed79e-goog
>
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH 2/3] vfio: selftests: Add support of creating iommus from iommufd
2026-01-08 0:29 ` David Matlack
@ 2026-01-09 21:39 ` Samiullah Khawaja
0 siblings, 0 replies; 12+ messages in thread
From: Samiullah Khawaja @ 2026-01-09 21:39 UTC (permalink / raw)
To: David Matlack
Cc: David Woodhouse, Lu Baolu, Joerg Roedel, Will Deacon,
Pasha Tatashin, Jason Gunthorpe, Robin Murphy, Pratyush Yadav,
Kevin Tian, Alex Williamson, Shuah Khan, iommu, linux-kernel, kvm,
Saeed Mahameed, Adithya Jayachandran, Parav Pandit,
Leon Romanovsky, William Tu
On Wed, Jan 7, 2026 at 4:29 PM David Matlack <dmatlack@google.com> wrote:
>
> On 2026-01-07 08:17 PM, Samiullah Khawaja wrote:
> > Add API to init a struct iommu using an already opened iommufd instance
> > and attach devices to it.
> >
> > Signed-off-by: Samiullah Khawaja <skhawaja@google.com>
> > ---
> > .../vfio/lib/include/libvfio/iommu.h | 2 +
> > .../lib/include/libvfio/vfio_pci_device.h | 2 +
> > tools/testing/selftests/vfio/lib/iommu.c | 60 +++++++++++++++++--
> > .../selftests/vfio/lib/vfio_pci_device.c | 16 ++++-
> > 4 files changed, 74 insertions(+), 6 deletions(-)
> >
> > diff --git a/tools/testing/selftests/vfio/lib/include/libvfio/iommu.h b/tools/testing/selftests/vfio/lib/include/libvfio/iommu.h
> > index 5c9b9dc6d993..9e96da1e6fd3 100644
> > --- a/tools/testing/selftests/vfio/lib/include/libvfio/iommu.h
> > +++ b/tools/testing/selftests/vfio/lib/include/libvfio/iommu.h
> > @@ -29,10 +29,12 @@ struct iommu {
> > int container_fd;
> > int iommufd;
> > u32 ioas_id;
> > + u32 hwpt_id;
> > struct list_head dma_regions;
> > };
> >
> > struct iommu *iommu_init(const char *iommu_mode);
> > +struct iommu *iommufd_iommu_init(int iommufd, u32 dev_id);
> > void iommu_cleanup(struct iommu *iommu);
> >
> > int __iommu_map(struct iommu *iommu, struct dma_region *region);
> > diff --git a/tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h b/tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h
> > index 2858885a89bb..1143ceb6a9b8 100644
> > --- a/tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h
> > +++ b/tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h
> > @@ -19,6 +19,7 @@ struct vfio_pci_device {
> > const char *bdf;
> > int fd;
> > int group_fd;
> > + u32 dev_id;
> >
> > struct iommu *iommu;
> >
> > @@ -65,6 +66,7 @@ void vfio_pci_config_access(struct vfio_pci_device *device, bool write,
> > #define vfio_pci_config_writew(_d, _o, _v) vfio_pci_config_write(_d, _o, _v, u16)
> > #define vfio_pci_config_writel(_d, _o, _v) vfio_pci_config_write(_d, _o, _v, u32)
> >
> > +void vfio_pci_device_attach_iommu(struct vfio_pci_device *device, struct iommu *iommu);
> > void vfio_pci_irq_enable(struct vfio_pci_device *device, u32 index,
> > u32 vector, int count);
> > void vfio_pci_irq_disable(struct vfio_pci_device *device, u32 index);
> > diff --git a/tools/testing/selftests/vfio/lib/iommu.c b/tools/testing/selftests/vfio/lib/iommu.c
> > index 58b7fb7430d4..2c67d7e24d0c 100644
> > --- a/tools/testing/selftests/vfio/lib/iommu.c
> > +++ b/tools/testing/selftests/vfio/lib/iommu.c
> > @@ -408,6 +408,18 @@ struct iommu_iova_range *iommu_iova_ranges(struct iommu *iommu, u32 *nranges)
> > return ranges;
> > }
> >
> > +static u32 iommufd_hwpt_alloc(struct iommu *iommu, u32 dev_id)
> > +{
> > + struct iommu_hwpt_alloc args = {
> > + .size = sizeof(args),
> > + .pt_id = iommu->ioas_id,
> > + .dev_id = dev_id,
> > + };
> > +
> > + ioctl_assert(iommu->iommufd, IOMMU_HWPT_ALLOC, &args);
> > + return args.out_hwpt_id;
> > +}
> > +
> > static u32 iommufd_ioas_alloc(int iommufd)
> > {
> > struct iommu_ioas_alloc args = {
> > @@ -418,11 +430,9 @@ static u32 iommufd_ioas_alloc(int iommufd)
> > return args.out_ioas_id;
> > }
> >
> > -struct iommu *iommu_init(const char *iommu_mode)
> > +static struct iommu *iommu_alloc(const char *iommu_mode)
> > {
> > - const char *container_path;
> > struct iommu *iommu;
> > - int version;
> >
> > iommu = calloc(1, sizeof(*iommu));
> > VFIO_ASSERT_NOT_NULL(iommu);
> > @@ -430,6 +440,16 @@ struct iommu *iommu_init(const char *iommu_mode)
> > INIT_LIST_HEAD(&iommu->dma_regions);
> >
> > iommu->mode = lookup_iommu_mode(iommu_mode);
> > + return iommu;
> > +}
> > +
> > +struct iommu *iommu_init(const char *iommu_mode)
> > +{
> > + const char *container_path;
> > + struct iommu *iommu;
> > + int version;
> > +
> > + iommu = iommu_alloc(iommu_mode);
> >
> > container_path = iommu->mode->container_path;
> > if (container_path) {
> > @@ -453,10 +473,42 @@ struct iommu *iommu_init(const char *iommu_mode)
> > return iommu;
> > }
> >
> > +struct iommu *iommufd_iommu_init(int iommufd, u32 dev_id)
>
> I don't think the name really captures what this routine is doing. How
> about iommufd_dup()?
The reason I used _iommu_init because it creates a new hwpt and ioas
also, and it represents a separate "struct iommu". dup might indicate
that it is pointing to the same IOAS? Do you think maybe dup is an
implementation detail that doesn't need to be conveyed?
Do you think maybe I should rename it to iommufd_device_iommu_init as
it is creating an hwpt compatible with the device "dev_id"? Or
iommufd_iommu_init_for_device?
>
> > +{
> > + struct iommu *iommu;
> > +
> > + iommu = iommu_alloc("iommufd");
> > +
> > + iommu->iommufd = dup(iommufd);
> > + VFIO_ASSERT_GT(iommu->iommufd, 0);
> > +
> > + iommu->ioas_id = iommufd_ioas_alloc(iommu->iommufd);
> > + iommu->hwpt_id = iommufd_hwpt_alloc(iommu, dev_id);
> > +
> > + return iommu;
> > +}
> > +
> > +static void iommufd_iommu_cleanup(struct iommu *iommu)
>
> nit: iommufd_cleanup()
Agreed.
>
> > +{
> > + struct iommu_destroy args = {
> > + .size = sizeof(args),
> > + };
> > +
> > + if (iommu->hwpt_id) {
> > + args.id = iommu->hwpt_id;
> > + ioctl_assert(iommu->iommufd, IOMMU_DESTROY, &args);
> > + }
> > +
> > + args.id = iommu->ioas_id;
> > + ioctl_assert(iommu->iommufd, IOMMU_DESTROY, &args);
> > +
> > + VFIO_ASSERT_EQ(close(iommu->iommufd), 0);
> > +}
> > +
> > void iommu_cleanup(struct iommu *iommu)
> > {
> > if (iommu->iommufd)
> > - VFIO_ASSERT_EQ(close(iommu->iommufd), 0);
> > + iommufd_iommu_cleanup(iommu);
> > else
> > VFIO_ASSERT_EQ(close(iommu->container_fd), 0);
> >
> > diff --git a/tools/testing/selftests/vfio/lib/vfio_pci_device.c b/tools/testing/selftests/vfio/lib/vfio_pci_device.c
> > index fac4c0ecadef..9bc1f5ade5c4 100644
> > --- a/tools/testing/selftests/vfio/lib/vfio_pci_device.c
> > +++ b/tools/testing/selftests/vfio/lib/vfio_pci_device.c
> > @@ -298,7 +298,7 @@ const char *vfio_pci_get_cdev_path(const char *bdf)
> > return cdev_path;
> > }
> >
> > -static void vfio_device_bind_iommufd(int device_fd, int iommufd)
> > +static int vfio_device_bind_iommufd(int device_fd, int iommufd)
> > {
> > struct vfio_device_bind_iommufd args = {
> > .argsz = sizeof(args),
> > @@ -306,6 +306,7 @@ static void vfio_device_bind_iommufd(int device_fd, int iommufd)
> > };
> >
> > ioctl_assert(device_fd, VFIO_DEVICE_BIND_IOMMUFD, &args);
> > + return args.out_devid;
> > }
> >
> > static void vfio_device_attach_iommufd_pt(int device_fd, u32 pt_id)
> > @@ -326,10 +327,21 @@ static void vfio_pci_iommufd_setup(struct vfio_pci_device *device, const char *b
> > VFIO_ASSERT_GE(device->fd, 0);
> > free((void *)cdev_path);
> >
> > - vfio_device_bind_iommufd(device->fd, device->iommu->iommufd);
> > + device->dev_id = vfio_device_bind_iommufd(device->fd, device->iommu->iommufd);
> > vfio_device_attach_iommufd_pt(device->fd, device->iommu->ioas_id);
> > }
> >
> > +void vfio_pci_device_attach_iommu(struct vfio_pci_device *device, struct iommu *iommu)
> > +{
> > + u32 pt_id = iommu->ioas_id;
>
> /* Only iommufd supports changing struct iommu attachments */
> VFIO_ASSERT_TRUE(iommu->iommufd);
Agreed
>
> > +
> > + if (iommu->hwpt_id)
> > + pt_id = iommu->hwpt_id;
> > +
> > + VFIO_ASSERT_NE(pt_id, 0);
> > + vfio_device_attach_iommufd_pt(device->fd, pt_id);
>
> device->iommu = iommu;
>
> > +}
> > +
> > struct vfio_pci_device *vfio_pci_device_init(const char *bdf, struct iommu *iommu)
> > {
> > struct vfio_pci_device *device;
> > --
> > 2.52.0.351.gbe84eed79e-goog
> >
Thank you for the feedback.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 3/3] vfio: selftests: Add iommufd hwpt replace test
2026-01-07 20:17 [PATCH 0/3] iommu/vt-d: Add support to hitless replace IOMMU domain Samiullah Khawaja
2026-01-07 20:17 ` [PATCH 1/3] iommu/vt-d: Allow replacing no_pasid iommu_domain Samiullah Khawaja
2026-01-07 20:17 ` [PATCH 2/3] vfio: selftests: Add support of creating iommus from iommufd Samiullah Khawaja
@ 2026-01-07 20:18 ` Samiullah Khawaja
2026-01-09 0:42 ` kernel test robot
2026-01-07 20:28 ` [PATCH 0/3] iommu/vt-d: Add support to hitless replace IOMMU domain Jason Gunthorpe
3 siblings, 1 reply; 12+ messages in thread
From: Samiullah Khawaja @ 2026-01-07 20:18 UTC (permalink / raw)
To: David Woodhouse, Lu Baolu, Joerg Roedel, Will Deacon,
Pasha Tatashin, Jason Gunthorpe, David Matlack
Cc: Samiullah Khawaja, Robin Murphy, Pratyush Yadav, Kevin Tian,
Alex Williamson, Shuah Khan, iommu, linux-kernel, kvm,
Saeed Mahameed, Adithya Jayachandran, Parav Pandit,
Leon Romanovsky, William Tu
Add a test that does iommufd hwpt replace while a DMA is ongoing. This
verifies the hitless replace of IOMMU domain without disrupting the DMA.
Note that the new domain is attached after mapping the required DMA
memory at the same IOVA in the new domain.
Signed-off-by: Samiullah Khawaja <skhawaja@google.com>
---
tools/testing/selftests/vfio/Makefile | 1 +
.../vfio/vfio_iommufd_hwpt_replace_test.c | 151 ++++++++++++++++++
2 files changed, 152 insertions(+)
create mode 100644 tools/testing/selftests/vfio/vfio_iommufd_hwpt_replace_test.c
diff --git a/tools/testing/selftests/vfio/Makefile b/tools/testing/selftests/vfio/Makefile
index 3c796ca99a50..09a1e57cc77d 100644
--- a/tools/testing/selftests/vfio/Makefile
+++ b/tools/testing/selftests/vfio/Makefile
@@ -1,5 +1,6 @@
CFLAGS = $(KHDR_INCLUDES)
TEST_GEN_PROGS += vfio_dma_mapping_test
+TEST_GEN_PROGS += vfio_iommufd_hwpt_replace_test
TEST_GEN_PROGS += vfio_iommufd_setup_test
TEST_GEN_PROGS += vfio_pci_device_test
TEST_GEN_PROGS += vfio_pci_device_init_perf_test
diff --git a/tools/testing/selftests/vfio/vfio_iommufd_hwpt_replace_test.c b/tools/testing/selftests/vfio/vfio_iommufd_hwpt_replace_test.c
new file mode 100644
index 000000000000..efef3233494f
--- /dev/null
+++ b/tools/testing/selftests/vfio/vfio_iommufd_hwpt_replace_test.c
@@ -0,0 +1,151 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+
+#include <linux/sizes.h>
+#include <linux/vfio.h>
+
+#include <libvfio.h>
+
+#include "kselftest_harness.h"
+
+static const char *device_bdf;
+
+static void region_setup(struct iommu *iommu,
+ struct iova_allocator *iova_allocator,
+ struct dma_region *region, u64 size)
+{
+ const int flags = MAP_SHARED | MAP_ANONYMOUS;
+ const int prot = PROT_READ | PROT_WRITE;
+ void *vaddr;
+
+ vaddr = mmap(NULL, size, prot, flags, -1, 0);
+ VFIO_ASSERT_NE(vaddr, MAP_FAILED);
+
+ region->vaddr = vaddr;
+ region->iova = iova_allocator_alloc(iova_allocator, size);
+ region->size = size;
+
+ iommu_map(iommu, region);
+}
+
+static void region_teardown(struct iommu *iommu, struct dma_region *region)
+{
+ iommu_unmap(iommu, region);
+ VFIO_ASSERT_EQ(munmap(region->vaddr, region->size), 0);
+}
+
+FIXTURE(vfio_iommufd_replace_hwpt_test) {
+ struct iommu *iommu;
+ struct vfio_pci_device *device;
+ struct iova_allocator *iova_allocator;
+ struct dma_region memcpy_region;
+ void *vaddr;
+
+ u64 size;
+ void *src;
+ void *dst;
+ iova_t src_iova;
+ iova_t dst_iova;
+};
+
+FIXTURE_SETUP(vfio_iommufd_replace_hwpt_test)
+{
+ struct vfio_pci_driver *driver;
+
+ self->iommu = iommu_init("iommufd");
+ self->device = vfio_pci_device_init(device_bdf, self->iommu);
+ self->iova_allocator = iova_allocator_init(self->iommu);
+
+ driver = &self->device->driver;
+
+ region_setup(self->iommu, self->iova_allocator, &self->memcpy_region, SZ_1G);
+ region_setup(self->iommu, self->iova_allocator, &driver->region, SZ_2M);
+
+ if (driver->ops)
+ vfio_pci_driver_init(self->device);
+
+ self->size = self->memcpy_region.size / 2;
+ self->src = self->memcpy_region.vaddr;
+ self->dst = self->src + self->size;
+
+ self->src_iova = to_iova(self->device, self->src);
+ self->dst_iova = to_iova(self->device, self->dst);
+}
+
+FIXTURE_TEARDOWN(vfio_iommufd_replace_hwpt_test)
+{
+ struct vfio_pci_driver *driver = &self->device->driver;
+
+ if (driver->ops)
+ vfio_pci_driver_remove(self->device);
+
+ region_teardown(self->iommu, &self->memcpy_region);
+ region_teardown(self->iommu, &driver->region);
+
+ iova_allocator_cleanup(self->iova_allocator);
+ vfio_pci_device_cleanup(self->device);
+ iommu_cleanup(self->iommu);
+}
+
+FIXTURE_VARIANT(vfio_iommufd_replace_hwpt_test) {
+ bool replace_hwpt;
+};
+
+FIXTURE_VARIANT_ADD(vfio_iommufd_replace_hwpt_test, domain_replace) {
+ .replace_hwpt = true,
+};
+
+FIXTURE_VARIANT_ADD(vfio_iommufd_replace_hwpt_test, noreplace) {
+ .replace_hwpt = false,
+};
+
+TEST_F(vfio_iommufd_replace_hwpt_test, memcpy)
+{
+ struct dma_region memcpy_region, driver_region;
+ struct iommu *iommu2;
+
+ if (self->device->driver.ops) {
+ memset(self->src, 'x', self->size);
+ memset(self->dst, 'y', self->size);
+
+ vfio_pci_driver_memcpy_start(self->device,
+ self->src_iova,
+ self->dst_iova,
+ self->size,
+ 100);
+ }
+
+ if (variant->replace_hwpt) {
+ iommu2 = iommufd_iommu_init(self->iommu->iommufd,
+ self->device->dev_id);
+
+ memcpy_region = self->memcpy_region;
+ driver_region = self->device->driver.region;
+
+ iommu_map(iommu2, &memcpy_region);
+ iommu_map(iommu2, &driver_region);
+
+ vfio_pci_device_attach_iommu(self->device, iommu2);
+ }
+
+ if (self->device->driver.ops) {
+ ASSERT_EQ(0, vfio_pci_driver_memcpy_wait(self->device));
+ ASSERT_EQ(0, memcmp(self->src, self->dst, self->size));
+ }
+
+ if (variant->replace_hwpt) {
+ vfio_pci_device_attach_iommu(self->device, self->iommu);
+
+ iommu_unmap(iommu2, &memcpy_region);
+ iommu_unmap(iommu2, &driver_region);
+ iommu_cleanup(iommu2);
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ device_bdf = vfio_selftests_get_bdf(&argc, argv);
+
+ return test_harness_run(argc, argv);
+}
--
2.52.0.351.gbe84eed79e-goog
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH 3/3] vfio: selftests: Add iommufd hwpt replace test
2026-01-07 20:18 ` [PATCH 3/3] vfio: selftests: Add iommufd hwpt replace test Samiullah Khawaja
@ 2026-01-09 0:42 ` kernel test robot
0 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2026-01-09 0:42 UTC (permalink / raw)
To: Samiullah Khawaja, David Woodhouse, Lu Baolu, Joerg Roedel,
Will Deacon, Pasha Tatashin, Jason Gunthorpe, David Matlack
Cc: oe-kbuild-all, Samiullah Khawaja, Robin Murphy, Pratyush Yadav,
Kevin Tian, Alex Williamson, Shuah Khan, iommu, linux-kernel, kvm,
Saeed Mahameed, Adithya Jayachandran, Parav Pandit,
Leon Romanovsky, William Tu
Hi Samiullah,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 6cd6c12031130a349a098dbeb19d8c3070d2dfbe]
url: https://github.com/intel-lab-lkp/linux/commits/Samiullah-Khawaja/iommu-vt-d-Allow-replacing-no_pasid-iommu_domain/20260108-041955
base: 6cd6c12031130a349a098dbeb19d8c3070d2dfbe
patch link: https://lore.kernel.org/r/20260107201800.2486137-4-skhawaja%40google.com
patch subject: [PATCH 3/3] vfio: selftests: Add iommufd hwpt replace test
config: i386-allnoconfig-bpf (https://download.01.org/0day-ci/archive/20260109/202601090106.YNZaDPcd-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260109/202601090106.YNZaDPcd-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202601090106.YNZaDPcd-lkp@intel.com/
All warnings (new ones prefixed by >>):
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/testing/selftests/vfio/lib/include/libvfio/assert.h:32:37: note: expanded from macro 'VFIO_ASSERT_EQ'
32 | #define VFIO_ASSERT_EQ(_a, _b, ...) VFIO_ASSERT_OP(_a, _b, ==, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/testing/selftests/vfio/lib/include/libvfio/assert.h:27:4: note: expanded from macro 'VFIO_ASSERT_OP'
26 | fprintf(stderr, " Observed: %#lx %s %#lx\n", \
| ~~~~
27 | (u64)__lhs, #_op, (u64)__rhs); \
| ^~~~~~~~~~
In file included from tools/testing/selftests/vfio/vfio_iommufd_hwpt_replace_test.c:8:
In file included from tools/testing/selftests/vfio/lib/include/libvfio.h:6:
tools/testing/selftests/vfio/lib/include/libvfio/iommu.h:51:2: warning: format specifies type 'unsigned long' but the argument has type 'u64' (aka 'unsigned long long') [-Wformat]
51 | VFIO_ASSERT_EQ(__iommu_unmap(iommu, region, NULL), 0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/testing/selftests/vfio/lib/include/libvfio/assert.h:32:37: note: expanded from macro 'VFIO_ASSERT_EQ'
32 | #define VFIO_ASSERT_EQ(_a, _b, ...) VFIO_ASSERT_OP(_a, _b, ==, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/testing/selftests/vfio/lib/include/libvfio/assert.h:27:22: note: expanded from macro 'VFIO_ASSERT_OP'
26 | fprintf(stderr, " Observed: %#lx %s %#lx\n", \
| ~~~~
27 | (u64)__lhs, #_op, (u64)__rhs); \
| ^~~~~~~~~~
In file included from tools/testing/selftests/vfio/vfio_iommufd_hwpt_replace_test.c:8:
In file included from tools/testing/selftests/vfio/lib/include/libvfio.h:6:
tools/testing/selftests/vfio/lib/include/libvfio/iommu.h:58:2: warning: format specifies type 'unsigned long' but the argument has type 'u64' (aka 'unsigned long long') [-Wformat]
58 | VFIO_ASSERT_EQ(__iommu_unmap_all(iommu, NULL), 0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/testing/selftests/vfio/lib/include/libvfio/assert.h:32:37: note: expanded from macro 'VFIO_ASSERT_EQ'
32 | #define VFIO_ASSERT_EQ(_a, _b, ...) VFIO_ASSERT_OP(_a, _b, ==, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/testing/selftests/vfio/lib/include/libvfio/assert.h:27:4: note: expanded from macro 'VFIO_ASSERT_OP'
26 | fprintf(stderr, " Observed: %#lx %s %#lx\n", \
| ~~~~
27 | (u64)__lhs, #_op, (u64)__rhs); \
| ^~~~~~~~~~
In file included from tools/testing/selftests/vfio/vfio_iommufd_hwpt_replace_test.c:8:
In file included from tools/testing/selftests/vfio/lib/include/libvfio.h:6:
tools/testing/selftests/vfio/lib/include/libvfio/iommu.h:58:2: warning: format specifies type 'unsigned long' but the argument has type 'u64' (aka 'unsigned long long') [-Wformat]
58 | VFIO_ASSERT_EQ(__iommu_unmap_all(iommu, NULL), 0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/testing/selftests/vfio/lib/include/libvfio/assert.h:32:37: note: expanded from macro 'VFIO_ASSERT_EQ'
32 | #define VFIO_ASSERT_EQ(_a, _b, ...) VFIO_ASSERT_OP(_a, _b, ==, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/testing/selftests/vfio/lib/include/libvfio/assert.h:27:22: note: expanded from macro 'VFIO_ASSERT_OP'
26 | fprintf(stderr, " Observed: %#lx %s %#lx\n", \
| ~~~~
27 | (u64)__lhs, #_op, (u64)__rhs); \
| ^~~~~~~~~~
In file included from tools/testing/selftests/vfio/vfio_iommufd_hwpt_replace_test.c:8:
In file included from tools/testing/selftests/vfio/lib/include/libvfio.h:8:
tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h:80:2: warning: format specifies type 'unsigned long' but the argument has type 'u64' (aka 'unsigned long long') [-Wformat]
80 | VFIO_ASSERT_NE(r, -1, "F_GETFL failed for fd %d\n", fd);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/testing/selftests/vfio/lib/include/libvfio/assert.h:33:37: note: expanded from macro 'VFIO_ASSERT_NE'
33 | #define VFIO_ASSERT_NE(_a, _b, ...) VFIO_ASSERT_OP(_a, _b, !=, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/testing/selftests/vfio/lib/include/libvfio/assert.h:27:4: note: expanded from macro 'VFIO_ASSERT_OP'
26 | fprintf(stderr, " Observed: %#lx %s %#lx\n", \
| ~~~~
27 | (u64)__lhs, #_op, (u64)__rhs); \
| ^~~~~~~~~~
In file included from tools/testing/selftests/vfio/vfio_iommufd_hwpt_replace_test.c:8:
In file included from tools/testing/selftests/vfio/lib/include/libvfio.h:8:
tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h:80:2: warning: format specifies type 'unsigned long' but the argument has type 'u64' (aka 'unsigned long long') [-Wformat]
80 | VFIO_ASSERT_NE(r, -1, "F_GETFL failed for fd %d\n", fd);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/testing/selftests/vfio/lib/include/libvfio/assert.h:33:37: note: expanded from macro 'VFIO_ASSERT_NE'
33 | #define VFIO_ASSERT_NE(_a, _b, ...) VFIO_ASSERT_OP(_a, _b, !=, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/testing/selftests/vfio/lib/include/libvfio/assert.h:27:22: note: expanded from macro 'VFIO_ASSERT_OP'
26 | fprintf(stderr, " Observed: %#lx %s %#lx\n", \
| ~~~~
27 | (u64)__lhs, #_op, (u64)__rhs); \
| ^~~~~~~~~~
In file included from tools/testing/selftests/vfio/vfio_iommufd_hwpt_replace_test.c:8:
In file included from tools/testing/selftests/vfio/lib/include/libvfio.h:8:
tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h:83:2: warning: format specifies type 'unsigned long' but the argument has type 'u64' (aka 'unsigned long long') [-Wformat]
83 | VFIO_ASSERT_NE(r, -1, "F_SETFL O_NONBLOCK failed for fd %d\n", fd);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/testing/selftests/vfio/lib/include/libvfio/assert.h:33:37: note: expanded from macro 'VFIO_ASSERT_NE'
33 | #define VFIO_ASSERT_NE(_a, _b, ...) VFIO_ASSERT_OP(_a, _b, !=, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/testing/selftests/vfio/lib/include/libvfio/assert.h:27:4: note: expanded from macro 'VFIO_ASSERT_OP'
26 | fprintf(stderr, " Observed: %#lx %s %#lx\n", \
| ~~~~
27 | (u64)__lhs, #_op, (u64)__rhs); \
| ^~~~~~~~~~
In file included from tools/testing/selftests/vfio/vfio_iommufd_hwpt_replace_test.c:8:
In file included from tools/testing/selftests/vfio/lib/include/libvfio.h:8:
tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h:83:2: warning: format specifies type 'unsigned long' but the argument has type 'u64' (aka 'unsigned long long') [-Wformat]
83 | VFIO_ASSERT_NE(r, -1, "F_SETFL O_NONBLOCK failed for fd %d\n", fd);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/testing/selftests/vfio/lib/include/libvfio/assert.h:33:37: note: expanded from macro 'VFIO_ASSERT_NE'
33 | #define VFIO_ASSERT_NE(_a, _b, ...) VFIO_ASSERT_OP(_a, _b, !=, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/testing/selftests/vfio/lib/include/libvfio/assert.h:27:22: note: expanded from macro 'VFIO_ASSERT_OP'
26 | fprintf(stderr, " Observed: %#lx %s %#lx\n", \
| ~~~~
27 | (u64)__lhs, #_op, (u64)__rhs); \
| ^~~~~~~~~~
>> tools/testing/selftests/vfio/vfio_iommufd_hwpt_replace_test.c:23:2: warning: format specifies type 'unsigned long' but the argument has type 'u64' (aka 'unsigned long long') [-Wformat]
23 | VFIO_ASSERT_NE(vaddr, MAP_FAILED);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/testing/selftests/vfio/lib/include/libvfio/assert.h:33:37: note: expanded from macro 'VFIO_ASSERT_NE'
33 | #define VFIO_ASSERT_NE(_a, _b, ...) VFIO_ASSERT_OP(_a, _b, !=, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/testing/selftests/vfio/lib/include/libvfio/assert.h:27:4: note: expanded from macro 'VFIO_ASSERT_OP'
26 | fprintf(stderr, " Observed: %#lx %s %#lx\n", \
| ~~~~
27 | (u64)__lhs, #_op, (u64)__rhs); \
| ^~~~~~~~~~
>> tools/testing/selftests/vfio/vfio_iommufd_hwpt_replace_test.c:23:2: warning: format specifies type 'unsigned long' but the argument has type 'u64' (aka 'unsigned long long') [-Wformat]
23 | VFIO_ASSERT_NE(vaddr, MAP_FAILED);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/testing/selftests/vfio/lib/include/libvfio/assert.h:33:37: note: expanded from macro 'VFIO_ASSERT_NE'
33 | #define VFIO_ASSERT_NE(_a, _b, ...) VFIO_ASSERT_OP(_a, _b, !=, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/testing/selftests/vfio/lib/include/libvfio/assert.h:27:22: note: expanded from macro 'VFIO_ASSERT_OP'
26 | fprintf(stderr, " Observed: %#lx %s %#lx\n", \
| ~~~~
27 | (u64)__lhs, #_op, (u64)__rhs); \
| ^~~~~~~~~~
tools/testing/selftests/vfio/vfio_iommufd_hwpt_replace_test.c:35:2: warning: format specifies type 'unsigned long' but the argument has type 'u64' (aka 'unsigned long long') [-Wformat]
35 | VFIO_ASSERT_EQ(munmap(region->vaddr, region->size), 0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/testing/selftests/vfio/lib/include/libvfio/assert.h:32:37: note: expanded from macro 'VFIO_ASSERT_EQ'
32 | #define VFIO_ASSERT_EQ(_a, _b, ...) VFIO_ASSERT_OP(_a, _b, ==, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/testing/selftests/vfio/lib/include/libvfio/assert.h:27:4: note: expanded from macro 'VFIO_ASSERT_OP'
26 | fprintf(stderr, " Observed: %#lx %s %#lx\n", \
| ~~~~
27 | (u64)__lhs, #_op, (u64)__rhs); \
| ^~~~~~~~~~
tools/testing/selftests/vfio/vfio_iommufd_hwpt_replace_test.c:35:2: warning: format specifies type 'unsigned long' but the argument has type 'u64' (aka 'unsigned long long') [-Wformat]
35 | VFIO_ASSERT_EQ(munmap(region->vaddr, region->size), 0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/testing/selftests/vfio/lib/include/libvfio/assert.h:32:37: note: expanded from macro 'VFIO_ASSERT_EQ'
32 | #define VFIO_ASSERT_EQ(_a, _b, ...) VFIO_ASSERT_OP(_a, _b, ==, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/testing/selftests/vfio/lib/include/libvfio/assert.h:27:22: note: expanded from macro 'VFIO_ASSERT_OP'
26 | fprintf(stderr, " Observed: %#lx %s %#lx\n", \
| ~~~~
27 | (u64)__lhs, #_op, (u64)__rhs); \
| ^~~~~~~~~~
14 warnings generated.
vim +23 tools/testing/selftests/vfio/vfio_iommufd_hwpt_replace_test.c
13
14 static void region_setup(struct iommu *iommu,
15 struct iova_allocator *iova_allocator,
16 struct dma_region *region, u64 size)
17 {
18 const int flags = MAP_SHARED | MAP_ANONYMOUS;
19 const int prot = PROT_READ | PROT_WRITE;
20 void *vaddr;
21
22 vaddr = mmap(NULL, size, prot, flags, -1, 0);
> 23 VFIO_ASSERT_NE(vaddr, MAP_FAILED);
24
25 region->vaddr = vaddr;
26 region->iova = iova_allocator_alloc(iova_allocator, size);
27 region->size = size;
28
29 iommu_map(iommu, region);
30 }
31
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/3] iommu/vt-d: Add support to hitless replace IOMMU domain
2026-01-07 20:17 [PATCH 0/3] iommu/vt-d: Add support to hitless replace IOMMU domain Samiullah Khawaja
` (2 preceding siblings ...)
2026-01-07 20:18 ` [PATCH 3/3] vfio: selftests: Add iommufd hwpt replace test Samiullah Khawaja
@ 2026-01-07 20:28 ` Jason Gunthorpe
2026-01-07 20:46 ` Jason Gunthorpe
3 siblings, 1 reply; 12+ messages in thread
From: Jason Gunthorpe @ 2026-01-07 20:28 UTC (permalink / raw)
To: Samiullah Khawaja
Cc: David Woodhouse, Lu Baolu, Joerg Roedel, Will Deacon,
Pasha Tatashin, David Matlack, Robin Murphy, Pratyush Yadav,
Kevin Tian, Alex Williamson, Shuah Khan, iommu, linux-kernel, kvm,
Saeed Mahameed, Adithya Jayachandran, Parav Pandit,
Leon Romanovsky, William Tu
On Wed, Jan 07, 2026 at 08:17:57PM +0000, Samiullah Khawaja wrote:
> Intel IOMMU Driver already supports replacing IOMMU domain hitlessly in
> scalable mode.
It does? We were just talking about how it doesn't work because it
makes the PASID entry non-present while loading the new domain.
Jason
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH 0/3] iommu/vt-d: Add support to hitless replace IOMMU domain
2026-01-07 20:28 ` [PATCH 0/3] iommu/vt-d: Add support to hitless replace IOMMU domain Jason Gunthorpe
@ 2026-01-07 20:46 ` Jason Gunthorpe
2026-01-09 20:06 ` Samiullah Khawaja
0 siblings, 1 reply; 12+ messages in thread
From: Jason Gunthorpe @ 2026-01-07 20:46 UTC (permalink / raw)
To: Samiullah Khawaja
Cc: David Woodhouse, Lu Baolu, Joerg Roedel, Will Deacon,
Pasha Tatashin, David Matlack, Robin Murphy, Pratyush Yadav,
Kevin Tian, Alex Williamson, Shuah Khan, iommu, linux-kernel, kvm,
Saeed Mahameed, Adithya Jayachandran, Parav Pandit,
Leon Romanovsky, William Tu
On Wed, Jan 07, 2026 at 04:28:12PM -0400, Jason Gunthorpe wrote:
> On Wed, Jan 07, 2026 at 08:17:57PM +0000, Samiullah Khawaja wrote:
> > Intel IOMMU Driver already supports replacing IOMMU domain hitlessly in
> > scalable mode.
>
> It does? We were just talking about how it doesn't work because it
> makes the PASID entry non-present while loading the new domain.
If you tried your tests in scalable mode they are probably only
working because the HW is holding the entry in cache while the CPU is
completely mangling it:
int intel_pasid_replace_first_level(struct intel_iommu *iommu,
struct device *dev, phys_addr_t fsptptr,
u32 pasid, u16 did, u16 old_did,
int flags)
{
[..]
*pte = new_pte;
That just doesn't work for "replace", it isn't hitless unless the
entry stays in the cache. Since your test effectively will hold the
context entry in the cache while testing for "hitless" it doesn't
really test if it is really working without races..
All of this needs to be reworked to always use the stack to build the
entry, like the replace path does, and have a ARM-like algorithm to
update the live memory in just the right order to guarentee the HW
does not see a corrupted entry.
It is a little bit tricky, but it should start with reworking
everything to consistently use the stack to create the new entry and
calling a centralized function to set the new entry to the live
memory. This replace/not replace split should be purged completely.
Some discussion is here
https://lore.kernel.org/all/20260106142301.GS125261@ziepe.ca/
It also needs to be very careful that the invalidation is doing both
the old and new context entry concurrently while it is being replaced.
For instance the placement of cache_tag_assign_domain() looks wrong to
me, it can't be *after* the HW has been programmed to use the new tags
:\
I also didn't note where the currently active cache_tag is removed
from the linked list during attach, is that another bug?
In short, this needs alot of work to actually properly implement
hitless replace the way ARM can. Fortunately I think it is mostly
mechanical and should be fairly straightfoward. Refer to the ARM
driver and try to structure vtd to have the same essential flow..
Jason
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH 0/3] iommu/vt-d: Add support to hitless replace IOMMU domain
2026-01-07 20:46 ` Jason Gunthorpe
@ 2026-01-09 20:06 ` Samiullah Khawaja
2026-01-11 22:14 ` Jason Gunthorpe
0 siblings, 1 reply; 12+ messages in thread
From: Samiullah Khawaja @ 2026-01-09 20:06 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: David Woodhouse, Lu Baolu, Joerg Roedel, Will Deacon,
Pasha Tatashin, David Matlack, Robin Murphy, Pratyush Yadav,
Kevin Tian, Alex Williamson, Shuah Khan, iommu, linux-kernel, kvm,
Saeed Mahameed, Adithya Jayachandran, Parav Pandit,
Leon Romanovsky, William Tu
On Wed, Jan 7, 2026 at 12:46 PM Jason Gunthorpe <jgg@ziepe.ca> wrote:
>
> On Wed, Jan 07, 2026 at 04:28:12PM -0400, Jason Gunthorpe wrote:
> > On Wed, Jan 07, 2026 at 08:17:57PM +0000, Samiullah Khawaja wrote:
> > > Intel IOMMU Driver already supports replacing IOMMU domain hitlessly in
> > > scalable mode.
> >
> > It does? We were just talking about how it doesn't work because it
> > makes the PASID entry non-present while loading the new domain.
>
> If you tried your tests in scalable mode they are probably only
> working because the HW is holding the entry in cache while the CPU is
> completely mangling it:
>
> int intel_pasid_replace_first_level(struct intel_iommu *iommu,
> struct device *dev, phys_addr_t fsptptr,
> u32 pasid, u16 did, u16 old_did,
> int flags)
> {
> [..]
> *pte = new_pte;
>
> That just doesn't work for "replace", it isn't hitless unless the
> entry stays in the cache. Since your test effectively will hold the
> context entry in the cache while testing for "hitless" it doesn't
> really test if it is really working without races..
Ah.. you are absolutely correct. This will not work if the entries are
not cached.
>
> All of this needs to be reworked to always use the stack to build the
> entry, like the replace path does, and have a ARM-like algorithm to
> update the live memory in just the right order to guarentee the HW
> does not see a corrupted entry.
Agreed. I will go through the VTD specs and also the ARM driver to
determine the right order to set this up.
>
> It is a little bit tricky, but it should start with reworking
> everything to consistently use the stack to create the new entry and
> calling a centralized function to set the new entry to the live
> memory. This replace/not replace split should be purged completely.
>
> Some discussion is here
>
> https://lore.kernel.org/all/20260106142301.GS125261@ziepe.ca/
>
> It also needs to be very careful that the invalidation is doing both
> the old and new context entry concurrently while it is being replaced.
Yes, let me follow the discussion over there closely.
>
> For instance the placement of cache_tag_assign_domain() looks wrong to
> me, it can't be *after* the HW has been programmed to use the new tags
> :\
>
> I also didn't note where the currently active cache_tag is removed
> from the linked list during attach, is that another bug?
You are correct, the placement of cache_tag_assign_domain is wrong.
The removal of the currently active cache tag is done in
dmar_domain_attach_device, but I will re-evaluate the placement of
both in the v2.
>
> In short, this needs alot of work to actually properly implement
> hitless replace the way ARM can. Fortunately I think it is mostly
> mechanical and should be fairly straightfoward. Refer to the ARM
> driver and try to structure vtd to have the same essential flow..
Thank you for the feedback. I will prepare a v2 series addressing these points.
>
> Jason
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH 0/3] iommu/vt-d: Add support to hitless replace IOMMU domain
2026-01-09 20:06 ` Samiullah Khawaja
@ 2026-01-11 22:14 ` Jason Gunthorpe
2026-01-12 6:57 ` Baolu Lu
0 siblings, 1 reply; 12+ messages in thread
From: Jason Gunthorpe @ 2026-01-11 22:14 UTC (permalink / raw)
To: Samiullah Khawaja
Cc: David Woodhouse, Lu Baolu, Joerg Roedel, Will Deacon,
Pasha Tatashin, David Matlack, Robin Murphy, Pratyush Yadav,
Kevin Tian, Alex Williamson, Shuah Khan, iommu, linux-kernel, kvm,
Saeed Mahameed, Adithya Jayachandran, Parav Pandit,
Leon Romanovsky, William Tu
> Thank you for the feedback. I will prepare a v2 series addressing these points.
I think there are so many problems here you should talk to Kevin and
Baolu to come up with some plan. A single series is not going to be
able to do all of this.
Jason
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/3] iommu/vt-d: Add support to hitless replace IOMMU domain
2026-01-11 22:14 ` Jason Gunthorpe
@ 2026-01-12 6:57 ` Baolu Lu
0 siblings, 0 replies; 12+ messages in thread
From: Baolu Lu @ 2026-01-12 6:57 UTC (permalink / raw)
To: Jason Gunthorpe, Samiullah Khawaja
Cc: David Woodhouse, Joerg Roedel, Will Deacon, Pasha Tatashin,
David Matlack, Robin Murphy, Pratyush Yadav, Kevin Tian,
Alex Williamson, Shuah Khan, iommu, linux-kernel, kvm,
Saeed Mahameed, Adithya Jayachandran, Parav Pandit,
Leon Romanovsky, William Tu
On 1/12/26 06:14, Jason Gunthorpe wrote:
>> Thank you for the feedback. I will prepare a v2 series addressing these points.
> I think there are so many problems here you should talk to Kevin and
> Baolu to come up with some plan. A single series is not going to be
> able to do all of this.
Yes, absolutely. I am working on a patch series to address the
fundamental atomicity issue. I hope to post it for discussion soon. Once
that is addressed, we can discuss any additional problems.
Thanks,
baolu
^ permalink raw reply [flat|nested] 12+ messages in thread