On 5/20/24 11:39 AM, Tian, Kevin wrote:
From: Baolu Lu <baolu...@linux.intel.com>
Sent: Monday, May 20, 2024 10:19 AM

On 5/15/24 4:50 PM, Tian, Kevin wrote:
From: Lu Baolu <baolu...@linux.intel.com>
Sent: Tuesday, April 30, 2024 10:57 PM

@@ -308,6 +314,19 @@ int iommufd_hwpt_alloc(struct iommufd_ucmd
*ucmd)
                goto out_put_pt;
        }

+       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;
+       }

this is nesting specific. why not moving it to the nested_alloc()?

Nesting is currently a use case for userspace I/O page faults, but this
design should be general enough to support other scenarios as well.


Do we allow user page table w/o nesting?

What would be a scenario in which the user doesn't manage the
page table but still want to handle the I/O page fault? The fault
should always be delivered to the owner managing the page table...

I am not sure. But if nesting is the only case for user page table, it's
fine to move above code to the nested_alloc helper.

Best regards,
baolu

Reply via email to