From: Yi Liu <yi.l.liu@intel.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: <joro@8bytes.org>, <kevin.tian@intel.com>,
<baolu.lu@linux.intel.com>, <eric.auger@redhat.com>,
<nicolinc@nvidia.com>, <chao.p.peng@linux.intel.com>,
<iommu@lists.linux.dev>, <vasant.hegde@amd.com>,
<will@kernel.org>
Subject: Re: [PATCH] iommufd: Deal with IOMMU_HWPT_FAULT_ID_VALID in iommufd core
Date: Thu, 12 Dec 2024 10:22:37 +0800 [thread overview]
Message-ID: <7938131d-a9a7-4e80-9e3a-644b81be71ec@intel.com> (raw)
In-Reply-To: <20241211200231.GQ2347147@nvidia.com>
On 2024/12/12 04:02, Jason Gunthorpe wrote:
> On Sat, Dec 07, 2024 at 04:01:08AM -0800, Yi Liu wrote:
>> IOMMU_HWPT_FAULT_ID_VALID is used to mark if the fault_id field of
>> iommu_hwp_alloc is valid or not. As the fault_id field is handled in
>> the iommufd core, so it makes sense to sanitize the
>> IOMMU_HWPT_FAULT_ID_VALID flag in the iommufd core, and mask it out
>> before passing the user flags to the iommu drivers.
>>
>> Signed-off-by: Yi Liu <yi.l.liu@intel.com>
>> ---
>> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c | 8 +-------
>> drivers/iommu/intel/iommu.c | 3 +--
>> drivers/iommu/iommufd/hw_pagetable.c | 10 +++++++---
>> drivers/iommu/iommufd/selftest.c | 2 +-
>> 4 files changed, 10 insertions(+), 13 deletions(-)
>
> I'm going to take this, but there is still something missing - drivers
> do not check domain->iopf_handler during attach and will happily
> install these domains without any HW support for fault reporting.
Apologize about it, per Kevin's remark[1] attach fault-capable domain to
non-PRI capable device shall fail when trying to enable PRI on the
devices that do not support it. So the current code does not have the
gap I mentioned in prior email [2].
[1]
https://lore.kernel.org/linux-iommu/BN9PR11MB5276FE72F52332E1BD40AE288C3E2@BN9PR11MB5276.namprd11.prod.outlook.com/
[2]
https://lore.kernel.org/linux-iommu/95a85b9b-a17b-4df5-a1ac-7a0880950960@intel.com/
> Not sure this is so great.. I suggest adding a flag to the iommu_ops
> 'supports_fault_reporting', as just a global flag if the driver could
> *possibly* support this. Core code will fail attach (and maybe alloc?)
> if it is not set. If it is set driver must check domain->iopf_handler
> during attach against HW capability.
>
This flag should be per device I guess. But as above remark, it's not
urgent to add this for now. :)
--
Regards,
Yi Liu
prev parent reply other threads:[~2024-12-12 2:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-07 12:01 [PATCH] iommufd: Deal with IOMMU_HWPT_FAULT_ID_VALID in iommufd core Yi Liu
2024-12-09 1:08 ` Baolu Lu
2024-12-09 2:51 ` Yi Liu
2024-12-09 15:05 ` Jason Gunthorpe
2024-12-10 5:52 ` Yi Liu
2024-12-10 13:57 ` Jason Gunthorpe
2024-12-11 8:58 ` Tian, Kevin
2024-12-11 9:16 ` Yi Liu
2024-12-11 8:59 ` Tian, Kevin
2024-12-11 20:02 ` Jason Gunthorpe
2024-12-12 2:22 ` Yi Liu [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=7938131d-a9a7-4e80-9e3a-644b81be71ec@intel.com \
--to=yi.l.liu@intel.com \
--cc=baolu.lu@linux.intel.com \
--cc=chao.p.peng@linux.intel.com \
--cc=eric.auger@redhat.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@nvidia.com \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=nicolinc@nvidia.com \
--cc=vasant.hegde@amd.com \
--cc=will@kernel.org \
/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