RE: [PATCH v5 08/14] iommufd/viommu: Add iommufd_viommu_report_event helper

2025-01-22 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Wednesday, January 22, 2025 3:16 PM > > On Tue, Jan 21, 2025 at 08:21:28PM -0400, Jason Gunthorpe wrote: > > On Tue, Jan 21, 2025 at 01:40:05PM -0800, Nicolin Chen wrote: > > > > There is also the minor detail of what happens if the hypervisor HW > > > > queue overflo

RE: [PATCH v5 06/14] iommufd: Add IOMMUFD_OBJ_VEVENTQ and IOMMUFD_CMD_VEVENTQ_ALLOC

2025-01-13 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Monday, January 13, 2025 12:51 PM > > On Mon, Jan 13, 2025 at 02:52:32AM +, Tian, Kevin wrote: > > > From: Nicolin Chen > > > Sent: Saturday, January 11, 2025 5:29 AM > > > > > > On Fri, Jan 10, 2025 at 07:

RE: [PATCH v5 06/14] iommufd: Add IOMMUFD_OBJ_VEVENTQ and IOMMUFD_CMD_VEVENTQ_ALLOC

2025-01-12 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Saturday, January 11, 2025 5:29 AM > > On Fri, Jan 10, 2025 at 07:06:49AM +, Tian, Kevin wrote: > > > From: Nicolin Chen > > > Sent: Wednesday, January 8, 2025 1:10 AM > > > + > > > +int iommufd_veventq_alloc(st

RE: [PATCH v5 12/14] Documentation: userspace-api: iommufd: Update FAULT and VEVENTQ

2025-01-09 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Wednesday, January 8, 2025 1:10 AM > > With the introduction of the new objects, update the doc to reflect that. > > Reviewed-by: Lu Baolu > Signed-off-by: Nicolin Chen Reviewed-by: Kevin Tian

RE: [PATCH v5 08/14] iommufd/viommu: Add iommufd_viommu_report_event helper

2025-01-09 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Wednesday, January 8, 2025 1:10 AM > > +/* > + * Typically called in driver's threaded IRQ handler. > + * The @type and @event_data must be defined in > include/uapi/linux/iommufd.h > + */ > +int iommufd_viommu_report_event(struct iommufd_viommu *viommu, > +

RE: [PATCH v5 07/14] iommufd/viommu: Add iommufd_viommu_get_vdev_id helper

2025-01-09 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Wednesday, January 8, 2025 1:10 AM > + > + xa_lock(&viommu->vdevs); > + xa_for_each(&viommu->vdevs, index, vdev) { > + if (vdev && vdev->dev == dev) { > + vdev_id = (unsigned long)vdev->id; > + break; > +

RE: [PATCH v5 06/14] iommufd: Add IOMMUFD_OBJ_VEVENTQ and IOMMUFD_CMD_VEVENTQ_ALLOC

2025-01-09 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Wednesday, January 8, 2025 1:10 AM > + > +int iommufd_veventq_alloc(struct iommufd_ucmd *ucmd) > +{ > + struct iommu_veventq_alloc *cmd = ucmd->cmd; > + struct iommufd_veventq *veventq; > + struct iommufd_viommu *viommu; > + int fdno; > + int rc; >

RE: [PATCH v5 04/14] iommufd: Abstract an iommufd_eventq from iommufd_fault

2025-01-09 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Wednesday, January 8, 2025 1:10 AM > > The fault object was designed exclusively for hwpt's IO page faults (PRI). > But its queue implementation can be reused for other purposes too, such as > hardware IRQ and event injections to user space. > > Meanwhile, a fault ob

RE: [PATCH v5 01/14] iommufd: Keep OBJ/IOCTL lists in an alphabetical order

2025-01-09 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Wednesday, January 8, 2025 1:10 AM > > Reorder the existing OBJ/IOCTL lists. > > Also run clang-format for the same coding style at line wrappings. > > No functional change. > > Reviewed-by: Lu Baolu > Signed-off-by: Nicolin Chen Reviewed-by: Kevin Tian

RE: [PATCH v2 13/13] iommu/arm-smmu-v3: Report IRQs that belong to devices attached to vIOMMU

2024-12-11 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Wednesday, December 4, 2024 6:10 AM > > + > +/** > + * struct iommu_virq_arm_smmuv3 - ARM SMMUv3 Virtual IRQ > + *(IOMMU_VIRQ_TYPE_ARM_SMMUV3) > + * @evt: 256-bit ARM SMMUv3 Event record, little-endian. > + * > + * StreamID field report

RE: [PATCH v2 12/13] iommu/arm-smmu-v3: Introduce struct arm_smmu_vmaster

2024-12-11 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Wednesday, December 4, 2024 6:10 AM > > Use it to store all vSMMU-related data. The vsid (Virtual Stream ID) will > be the first use case. Then, add a rw_semaphore to protect it. > > Also add a pair of arm_smmu_attach_prepare/commit_vmaster helpers and > put > them i

RE: [PATCH v2 11/13] Documentation: userspace-api: iommufd: Update EVENTQ_IOPF and EVENTQ_VIRQ

2024-12-11 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Wednesday, December 4, 2024 6:10 AM > > With the introduction of the new objects, update the doc to reflect that. > > Signed-off-by: Nicolin Chen > --- > Documentation/userspace-api/iommufd.rst | 19 +++ > 1 file changed, 19 insertions(+) > > diff

RE: [PATCH v2 07/13] iommufd/viommu: Add iommufd_viommu_report_irq helper

2024-12-11 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Wednesday, December 4, 2024 6:10 AM > > +/* Typically called in driver's threaded IRQ handler */ > +int iommufd_viommu_report_irq(struct iommufd_viommu *viommu, > unsigned int type, > + void *irq_ptr, size_t irq_len) > +{ > + struct iommu

RE: [PATCH v2 06/13] iommufd/viommu: Add iommufd_viommu_get_vdev_id helper

2024-12-11 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Wednesday, December 4, 2024 6:10 AM > > +/* Return 0 if device is not associated to the vIOMMU */ > +unsigned long iommufd_viommu_get_vdev_id(struct iommufd_viommu > *viommu, > + struct device *dev) > +{ > + struct iommufd_vdev

RE: [PATCH v2 05/13] iommufd: Add IOMMUFD_OBJ_EVENTQ_VIRQ and IOMMUFD_CMD_VIRQ_ALLOC

2024-12-10 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Wednesday, December 4, 2024 6:10 AM > + > +/* An iommufd_virq represents a vIOMMU interrupt in an eventq_virq > queue */ > +struct iommufd_virq { > + struct iommufd_eventq_virq *eventq_virq; > + struct list_head node; > + ssize_t irq_len; > + void *irq_

RE: [PATCH v2 04/13] iommufd: Rename fault.c to eventq.c

2024-12-10 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Wednesday, December 4, 2024 6:10 AM > > Rename the file, aligning with the new eventq object. > > Signed-off-by: Nicolin Chen Reviewed-by: Kevin Tian

RE: [PATCH v2 03/13] iommufd: Rename IOMMUFD_OBJ_FAULT to IOMMUFD_OBJ_EVENTQ_IOPF

2024-12-10 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Wednesday, December 4, 2024 6:10 AM > > The fault object was designed exclusively for hwpt's IO page faults (PRI). > But its implementation can actually be reused for other purposes too, such > as hardware IRQ and event injections to user space. > > Meanwhile, a faul

RE: [PATCH v2 02/13] iommufd/fault: Move iommufd_fault_iopf_handler() to header

2024-12-10 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Wednesday, December 4, 2024 6:10 AM > > The new vIRQ object will need a similar function for drivers to report the > vIOMMU related interrupts. Split the common part out to a smaller helper, > and place it in the header so that CONFIG_IOMMUFD_DRIVER_CORE can > include

RE: [PATCH v2 01/13] iommufd/fault: Add an iommufd_fault_init() helper

2024-12-10 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Wednesday, December 4, 2024 6:10 AM > > +static int iommufd_fault_init(struct iommufd_fault *fault, char *name, > + struct iommufd_ctx *ictx) > +{ > + struct file *filep; > + int fdno; > + > + fault->ictx = ictx; while at it coul

RE: [PATCH] vfio-pci: Allow to mmap sub-page MMIO BARs if the mmio page is exclusive

2016-05-02 Thread Tian, Kevin
> From: Yongji Xie [mailto:xyj...@linux.vnet.ibm.com] > Sent: Tuesday, May 03, 2016 1:52 PM > > >> + > >> + if (!(res->start & ~PAGE_MASK)) { > >> + /* > >> + * Add shadow resource for sub-page bar whose mmio > >> + * page is exclusive

RE: [PATCH] vfio-pci: Allow to mmap sub-page MMIO BARs if the mmio page is exclusive

2016-05-02 Thread Tian, Kevin
> From: Yongji Xie > Sent: Wednesday, April 27, 2016 8:22 PM > > Current vfio-pci implementation disallows to mmap > sub-page(size < PAGE_SIZE) MMIO BARs because these BARs' mmio > page may be shared with other BARs. This will cause some > performance issues when we passthrough a PCI device with >