All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolin Chen <nicolinc@nvidia.com>
To: Richard Gemego <richardgemego@gmail.com>
Cc: Pranjal Shrivastava <praan@google.com>,
	<baolu.lu@linux.intel.com>, <kevin.tian@intel.com>,
	<jgg@ziepe.ca>, <iommu@lists.linux.dev>,
	Quan Zhou <zhouquan@iscas.ac.cn>
Subject: Re: [PATCH] iommufd: fix returns ENOENT in iommufd_viommu_get_vdev_id()
Date: Mon, 4 Aug 2025 20:33:09 -0700	[thread overview]
Message-ID: <aJF7dbWXV8E6ReNY@Asurada-Nvidia> (raw)
In-Reply-To: <c603856a-44ae-4ff9-8fe7-7cb48d78617e@gmail.com>

On Tue, Aug 05, 2025 at 10:46:20AM +0800, Richard Gemego wrote:
> The motivation of this fix is when iommufd in selftests tested on RISC-V,
> 
> I found that `alloc_hwpt_nested` items are failed

That TEST_F is a non-viommu case, using the hwpt model, i.e.
mock_domain_alloc_nested() that does not set mock_viommu pointer,
leaving it a NULL value. Any vIOMMU/vdev specific thing should not
be invoked in this TEST_F.

> then I followed the
> function calling chains and found that in iommufd_viommu_get_vdev_id(),
> there is always not any vdev in viommu.

Then mock_domain_nop_attach() won't call iommufd_viommu_get_vdev_id
at all since the "new_viommu" there should be kept as NULL.

If you see this function is called for alloc_hwpt_nested TEST_F,
there must be something else going wrong. I would start to check
the mock_viommu pointer to see if it is set (and then by what).

> I wonder if it is because RISC-V
> does not support vIOMMU well, so that there isn't any any vdev in
> viommu, then iommufd_viommu_get_vdev_id() will always return
> -ENOENT. Have you ever tested it on RISC-V? Will viommu always have
> at least one vdev on ARM (since you have mentioned ARM in ea94b211c548
> patch series), so iommufd_viommu_get_vdev_id() can return 0 in iommufd
> selftest?

No. The underlying architecture should be independent, although the
kernel config file or compiler can be a factor.

Nicolin

      reply	other threads:[~2025-08-05  3:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-04 10:08 [PATCH] iommufd: fix returns ENOENT in iommufd_viommu_get_vdev_id() Richard Gemego
2025-08-04 11:25 ` Pranjal Shrivastava
2025-08-04 17:44   ` Nicolin Chen
2025-08-05  2:46     ` Richard Gemego
2025-08-05  3:33       ` Nicolin Chen [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=aJF7dbWXV8E6ReNY@Asurada-Nvidia \
    --to=nicolinc@nvidia.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=kevin.tian@intel.com \
    --cc=praan@google.com \
    --cc=richardgemego@gmail.com \
    --cc=zhouquan@iscas.ac.cn \
    /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.