[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7a6ac83b-3165-4abe-91be-a58f69656f8a@linux.intel.com>
Date: Fri, 15 Mar 2024 09:16:43 +0800
From: Baolu Lu <baolu.lu@...ux.intel.com>
To: Jason Gunthorpe <jgg@...pe.ca>
Cc: baolu.lu@...ux.intel.com, Kevin Tian <kevin.tian@...el.com>,
Joerg Roedel <joro@...tes.org>, Will Deacon <will@...nel.org>,
Robin Murphy <robin.murphy@....com>,
Jean-Philippe Brucker <jean-philippe@...aro.org>,
Nicolin Chen <nicolinc@...dia.com>, Yi Liu <yi.l.liu@...el.com>,
Jacob Pan <jacob.jun.pan@...ux.intel.com>,
Joel Granados <j.granados@...sung.com>, iommu@...ts.linux.dev,
virtualization@...ts.linux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 5/8] iommufd: Associate fault object with
iommufd_hw_pgtable
On 3/9/24 3:05 AM, Jason Gunthorpe wrote:
> On Mon, Jan 22, 2024 at 03:39:00PM +0800, Lu Baolu wrote:
>
>> @@ -411,6 +414,8 @@ enum iommu_hwpt_data_type {
>> * @__reserved: Must be 0
>> * @data_type: One of enum iommu_hwpt_data_type
>> * @data_len: Length of the type specific data
>> + * @fault_id: The ID of IOMMUFD_FAULT object. Valid only if flags field of
>> + * IOMMU_HWPT_FAULT_ID_VALID is set.
>> * @data_uptr: User pointer to the type specific data
>> *
>> * Explicitly allocate a hardware page table object. This is the same object
>> @@ -441,6 +446,7 @@ struct iommu_hwpt_alloc {
>> __u32 __reserved;
>> __u32 data_type;
>> __u32 data_len;
>> + __u32 fault_id;
>> __aligned_u64 data_uptr;
>> };
>
> ?? We can't add fault_id in the middle of the struct??
Yes. I should add the new field at the end.
By the way, with a __u32 added, this data structure is not 64-byte-
aligned anymore. Do we need to add another unused u32 entry, or just let
the compiler handle it?
>
>> + if (cmd->flags & IOMMU_HWPT_FAULT_ID_VALID) {
>> + struct iommufd_fault *fault;
>> +
>> + fault = iommufd_get_fault(ucmd, cmd->fault_id);
>> + if (IS_ERR(fault)) {
>> + rc = PTR_ERR(fault);
>> + goto out_hwpt;
>> + }
>> + hwpt->fault = fault;
>> + hwpt->domain->iopf_handler = iommufd_fault_iopf_handler;
>> + hwpt->domain->fault_data = hwpt;
>> + hwpt->fault_capable = true;
>
> I wonder if there should be an iommu API to make a domain fault
> capable?
The iommu core identifies a fault-capable domain by checking its
domain->iopf_handler. Anyway, what's the difference between a fault or
non-fault capable domain from iommu core's point of view?
Best regards,
baolu
Powered by blists - more mailing lists