All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peng Hao <flyingpenghao@gmail.com>
To: jgg@ziepe.ca, kevin.tian@intel.com
Cc: iommu@lists.linux.dev
Subject: [PATCH 2/2] iommufd/selftest: Select IOMMU_IOPF
Date: Mon, 30 Nov 2026 19:32:32 +0800	[thread overview]
Message-ID: <20261130113232.10091-2-flyingpeng@tencent.com> (raw)
In-Reply-To: <20261130113232.10091-1-flyingpeng@tencent.com>

The mock device supports I/O page faults, and the selftests attach it
to hw_pagetables allocated with IOMMU_HWPT_FAULT_ID_VALID. That needs a
mock iopf queue, which iommufd_test_init() gets from iopf_queue_alloc().

IOMMU_IOPF is a hidden symbol that only real IOMMU drivers select, so
IOMMUFD_TEST can be enabled without it, e.g. on arm64 without
ARM_SMMU_V3_SVA. Then iopf_queue_alloc() is the stub that returns NULL,
mock_dev_enable_iopf() fails with -ENODEV, and every test that attaches
the mock device to a fault-capable hwpt fails:

  iommufd.c:697:alloc_hwpt_nested:Expected 0 (0) == _test_cmd_mock_domain_replace(self->fd, self->stdev_id, iopf_hwpt_id, NULL) (-1)
  iommufd.c:2946:viommu_alloc_nested_iopf:Expected 0 (0) == _test_cmd_mock_domain_replace(self->fd, self->stdev_id, iopf_hwpt_id, NULL) (-1)
  iommufd.c:3589:pasid_attach:Expected 0 (0) == _test_cmd_pasid_attach(self->fd, self->stdev_id, pasid, iopf_hwpt_id) (-1)

Select IOMMU_IOPF, like DMA_SHARED_BUFFER is selected for the dmabuf
tests.

Fixes: ddee19971081 ("iommufd/selftest: Add IOPF support for mock device")
Signed-off-by: Peng Hao <flyingpeng@tencent.com>
---
 drivers/iommu/iommufd/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iommu/iommufd/Kconfig b/drivers/iommu/iommufd/Kconfig
index 6c3bea83631b..29273d696dbb 100644
--- a/drivers/iommu/iommufd/Kconfig
+++ b/drivers/iommu/iommufd/Kconfig
@@ -56,6 +56,7 @@ config IOMMUFD_TEST
 	depends on IOMMU_PT_AMDV1=y || IOMMUFD=IOMMU_PT_AMDV1
 	select DMA_SHARED_BUFFER
 	select IOMMUFD_DRIVER
+	select IOMMU_IOPF
 	default n
 	help
 	  This is dangerous, do not enable unless running
-- 
2.43.7


      reply	other threads:[~2026-11-30 11:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 11:32 [PATCH 1/2] iommufd: Move pinned_vm with the pages in IOMMU_IOAS_CHANGE_PROCESS Peng Hao
2026-11-30 11:32 ` Peng Hao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261130113232.10091-2-flyingpeng@tencent.com \
    --to=flyingpenghao@gmail.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=kevin.tian@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.