From: Jason Gunthorpe <jgg@nvidia.com>
To: Nicolin Chen <nicolinc@nvidia.com>
Cc: kevin.tian@intel.com, yi.l.liu@intel.com, iommu@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iommufd: Enforce IOMMU_RESV_SW_MSI upon hwpt_paging allocation
Date: Mon, 29 Jul 2024 15:24:46 -0300 [thread overview]
Message-ID: <20240729182446.GH3371438@nvidia.com> (raw)
In-Reply-To: <20240728235106.2435208-1-nicolinc@nvidia.com>
On Sun, Jul 28, 2024 at 04:51:06PM -0700, Nicolin Chen wrote:
> IOMMU_RESV_SW_MSI is a unique region defined by an IOMMU driver. Though it
> is eventually used by a device for address translation to an MSI location
> (including nested cases), practically it is a universal region across all
> domains allocated for the IOMMU that defines it.
>
> Currently IOMMUFD core fetches and reserves the region during an attach to
> an hwpt_paging. It works with a hwpt_paging-only case, but might not work
> with a nested case where a device could directly attach to a hwpt_nested,
> bypassing the hwpt_paging attachment.
Well, it does this because the attach is the only place where we have
*all* the devices available.
Doing it doing allocation means you get only one device.
So, I'd imagine more like we allocate the MSI region during allocation
for the device specific during allocation
But continue to enforce that every attached device also has its MSI
region allocated.. Which probably just means checking that the
driver's reported MSI address is the same as the address during
allocation?
> @@ -364,7 +305,8 @@ int iommufd_hw_pagetable_attach(struct iommufd_hw_pagetable *hwpt,
> }
>
> if (hwpt_is_paging(hwpt)) {
> - rc = iommufd_hwpt_paging_attach(to_hwpt_paging(hwpt), idev);
> + rc = iopt_table_enforce_dev_resv_regions(
> + &to_hwpt_paging(hwpt)->ioas->iopt, idev->dev);
> if (rc)
> goto err_unlock;
And this seems kind of weird, shouldn't any change the ioas regions
happen when the domain is joined to the ioas with the MSI mapping, not
during attach?? Like we don't want any change of the IOAS to blow away
the MSI region.
This should probably get selftest coverage as well, it seems easy
enough to add to the mock iommu driver?
Jason
next prev parent reply other threads:[~2024-07-29 18:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-28 23:51 [PATCH] iommufd: Enforce IOMMU_RESV_SW_MSI upon hwpt_paging allocation Nicolin Chen
2024-07-29 18:24 ` Jason Gunthorpe [this message]
2024-07-29 20:05 ` Nicolin Chen
2024-07-31 7:50 ` Tian, Kevin
2024-07-31 18:23 ` Nicolin Chen
2024-08-01 13:28 ` Jason Gunthorpe
2024-08-01 17:39 ` Nicolin Chen
2024-07-31 7:45 ` Tian, Kevin
2024-07-31 18:13 ` Nicolin Chen
2024-07-31 21:21 ` Nicolin Chen
2024-08-01 8:10 ` Tian, Kevin
2024-08-01 17:40 ` Nicolin Chen
2024-08-01 14:10 ` Jason Gunthorpe
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=20240729182446.GH3371438@nvidia.com \
--to=jgg@nvidia.com \
--cc=iommu@lists.linux.dev \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nicolinc@nvidia.com \
--cc=yi.l.liu@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox