On Wed, Dec 11, 2024 at 08:11:03AM +, Tian, Kevin wrote:
> > 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
>
On Wed, Dec 11, 2024 at 08:15:35AM +, Tian, Kevin wrote:
> > 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
On Wed, Dec 11, 2024 at 08:21:42AM +, Tian, Kevin wrote:
> > From: Nicolin Chen
> > Sent: Wednesday, December 4, 2024 6:10 AM
> >
> > +
> > +/**
> > + * struct iommu_virq_arm_smmuv3 - ARM SMMUv3 Virtual IRQ
> > + *(IOM
On Wed, Dec 11, 2024 at 07:40:52AM +, Tian, Kevin wrote:
> > 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
On Wed, Dec 11, 2024 at 07:27:40AM +, Tian, Kevin wrote:
> > 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 *ic
On Wed, Dec 11, 2024 at 07:55:53AM +, Tian, Kevin wrote:
> > 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 {
> > +
On Wed, Dec 11, 2024 at 08:02:48AM +, Tian, Kevin wrote:
> > 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(str
On Wed, Dec 11, 2024 at 08:05:45AM +, Tian, Kevin wrote:
> > 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_vi
On Thu, Dec 19, 2024 at 10:05:53AM +0800, Baolu Lu wrote:
> On 12/18/24 13:00, Nicolin Chen wrote:
> > This is a reverse search v.s. iommufd_viommu_find_dev, as drivers may want
> > to convert a struct device pointer (physical) to its virtual device ID for
> > an event inject
On Tue, Dec 17, 2024 at 09:00:14PM -0800, Nicolin Chen wrote:
> Move VDEVICE upward to keep the order. Also run clang-format keep the same
> coding style at line wrappings. No functional change.
It should fix the order in ucmd_buffer too. Will include in v4.
Nicolin
On Tue, Dec 17, 2024 at 09:00:19PM -0800, Nicolin Chen wrote:
> diff --git a/drivers/iommu/iommufd/main.c b/drivers/iommu/iommufd/main.c
> index cfbdf7b0e3c1..9d15978ef882 100644
> --- a/drivers/iommu/iommufd/main.c
> +++ b/drivers/iommu/iommufd/main.c
> @@ -367,6 +367,8 @@ stat
ain driver
v1
https://lore.kernel.org/all/cover.1724777091.git.nicol...@nvidia.com/
Thanks!
Nicolin
Nicolin Chen (13):
iommufd/fault: Add an iommufd_fault_init() helper
iommufd/fault: Move iommufd_fault_iopf_handler() to header
iommufd: Rename IOMMUFD_OBJ_FAULT to IOMMUFD_OBJ_EVENTQ_IOPF
iom
need "response", leave the xa_init_flags
in its original location.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/fault.c | 48 ---
1 file changed, 28 insertions(+), 20 deletions(-)
diff --git a/drivers/iommu/iommufd/fault.c b/drivers/iommu/
On Fri, Jan 10, 2025 at 03:49:50PM -0400, Jason Gunthorpe wrote:
> On Fri, Jan 10, 2025 at 11:27:53AM -0800, Nicolin Chen wrote:
> > On Fri, Jan 10, 2025 at 01:48:42PM -0400, Jason Gunthorpe wrote:
> > > On Tue, Jan 07, 2025 at 09:10:09AM -0800, Nicolin Chen wrote:
> > &g
On Wed, Jan 22, 2025 at 09:33:35AM +, Tian, Kevin wrote:
> > 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 Ch
On Wed, Jan 22, 2025 at 12:05:27AM -0800, Nicolin Chen wrote:
> On Tue, Jan 21, 2025 at 01:40:13PM -0800, Nicolin Chen wrote:
> > On Tue, Jan 21, 2025 at 05:14:04PM -0400, Jason Gunthorpe wrote:
> > > Since we don't hold the spinlock the whole time there is a race where
On Tue, Jan 21, 2025 at 04:09:24PM -0400, Jason Gunthorpe wrote:
> On Tue, Jan 21, 2025 at 11:55:16AM -0800, Nicolin Chen wrote:
> > > > > IOMMU_VEVENTQ_STATE_OVERFLOW with a 0 length event is seen if events
> > > > > have been lost and no subsequent
On Tue, Jan 21, 2025 at 02:36:11PM -0400, Jason Gunthorpe wrote:
> On Mon, Jan 20, 2025 at 12:52:09PM -0800, Nicolin Chen wrote:
> > The counter of the number of events in the vEVENTQ could decrease
> > when userspace reads the queue. But you were saying "the number of
>
On Wed, Jan 22, 2025 at 10:02:49AM -0800, Nicolin Chen wrote:
> On Wed, Jan 22, 2025 at 12:05:27AM -0800, Nicolin Chen wrote:
> > On Tue, Jan 21, 2025 at 01:40:13PM -0800, Nicolin Chen wrote:
> > > On Tue, Jan 21, 2025 at 05:14:04PM -0400, Jason Gunthorpe wrote:
> > >
There is no need to keep them in the header. The vEVENTQ version of these
two functions will turn out to be a different implementation and will not
share with this fault version. Thus, move them out of the header.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 25
3-iommufd file
to simplify the routine in arm_smmu_handle_evt() of the main driver
v1
https://lore.kernel.org/all/cover.1724777091.git.nicol...@nvidia.com/
Thanks!
Nicolin
Nicolin Chen (14):
iommufd/fault: Move two fault functions out of the header
iommufd/fault: Add an iom
iommufd_veventq_ops for the new ioctl.
Reviewed-by: Lu Baolu
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 88 ++
include/linux/iommufd.h | 3 +
include/uapi/linux/iommufd.h| 85 ++
drivers/iommu/iommufd/eventq.c | 206
Similar to iommu_report_device_fault, this allows IOMMU drivers to report
vIOMMU events from threaded IRQ handlers to user space hypervisors.
Reviewed-by: Lu Baolu
Signed-off-by: Nicolin Chen
---
include/linux/iommufd.h| 11 +
drivers/iommu/iommufd/driver.c | 45
iommufd_fault_fops_release().
Since the new vEVENTQ doesn't need "response" and its "mutex", so keep
the xa_init_flags and mutex_init in their original locations.
Reviewed-by: Kevin Tian
Reviewed-by: Lu Baolu
Reviewed-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
---
drivers/i
Rename the file, aligning with the new eventq object.
Reviewed-by: Kevin Tian
Reviewed-by: Lu Baolu
Reviewed-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/Makefile | 2 +-
drivers/iommu/iommufd/{fault.c => eventq.c} | 0
2 files changed, 1 insert
Trigger vEVENTs by feeding an idev ID and validating the returned output
virt_ids whether they equal to the value that was set to the vDEVICE.
Signed-off-by: Nicolin Chen
---
tools/testing/selftests/iommu/iommufd_utils.h | 115 ++
tools/testing/selftests/iommu/iommufd.c
.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/selftest.c| 24
tools/testing/selftests/iommu/iommufd.c | 5 +
2 files changed, 29 insertions(+)
diff --git a/drivers/iommu/iommufd/selftest.c b/drivers/iommu/iommufd/selftest.c
index a0de6d6d4e68
With the introduction of the new objects, update the doc to reflect that.
Reviewed-by: Lu Baolu
Reviewed-by: Kevin Tian
Signed-off-by: Nicolin Chen
---
Documentation/userspace-api/iommufd.rst | 17 +
1 file changed, 17 insertions(+)
diff --git a/Documentation/userspace-api
llows to configure the SMMU HW to merge similar
event records, though there is no guarantee. Set it in a nested STE for
DoS mitigations.
Signed-off-by: Nicolin Chen
---
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 1 +
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c | 2 ++
drivers/
The handler will get vDEVICE object from the given mdev and convert it to
its per-vIOMMU virtual ID to mimic a real IOMMU driver.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_test.h | 10 ++
drivers/iommu/iommufd/selftest.c | 30
2 files
-by: Lu Baolu
Reviewed-by: Kevin Tian
Signed-off-by: Nicolin Chen
---
include/linux/iommufd.h| 9 +
drivers/iommu/iommufd/driver.c | 24
2 files changed, 33 insertions(+)
diff --git a/include/linux/iommufd.h b/include/linux/iommufd.h
index 8948b1836940
gned-off-by: Nicolin Chen
---
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 23 ++
.../arm/arm-smmu-v3/arm-smmu-v3-iommufd.c | 45 +++
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 32 -
3 files changed, 99 insertions(+), 1 deletion(-)
diff --git a/driver
Aside from the IOPF framework, iommufd provides an additional pathway to
report hardware events, via the vEVENTQ of vIOMMU infrastructure.
Define an iommu_vevent_arm_smmuv3 uAPI structure, and report stage-1 events
in the threaded IRQ handler.
Signed-off-by: Nicolin Chen
---
drivers/iommu/arm
Queue).
Reviewed-by: Lu Baolu
Reviewed-by: Kevin Tian
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 28 --
drivers/iommu/iommufd/fault.c | 111 +---
drivers/iommu/iommufd/hw_pagetable.c| 6 +-
3 files changed, 82 inserti
On Tue, Jan 14, 2025 at 09:41:58AM -0400, Jason Gunthorpe wrote:
> On Mon, Jan 13, 2025 at 12:44:37PM -0800, Nicolin Chen wrote:
> > IOMMU_VEVENT_HEADER_FLAGS_OVERFLOW = (1 << 0),
> > };
> >
> > struct iommufd_vevent_header_v1 {
> > __u64 flags;
On Mon, Jan 20, 2025 at 02:18:54PM -0400, Jason Gunthorpe wrote:
> On Fri, Jan 17, 2025 at 02:11:15PM -0800, Nicolin Chen wrote:
> > +/**
> > + * struct iommufd_vevent_header - Virtual Event Header for a vEVENTQ Status
> > + * @state: One of enum iommu_veventq_state
>
On Tue, Jan 21, 2025 at 05:14:04PM -0400, Jason Gunthorpe wrote:
> On Tue, Jan 21, 2025 at 01:02:16PM -0800, Nicolin Chen wrote:
> > On Tue, Jan 21, 2025 at 04:09:24PM -0400, Jason Gunthorpe wrote:
> > > On Tue, Jan 21, 2025 at 11:55:16AM -0800,
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 overflows - I don't know the answer here. It is security
On Tue, Jan 21, 2025 at 01:40:13PM -0800, Nicolin Chen wrote:
> On Tue, Jan 21, 2025 at 05:14:04PM -0400, Jason Gunthorpe wrote:
> > Since we don't hold the spinlock the whole time there is a race where
> > we could pull the overflow off and then another entry could be pushed
On Fri, Jan 10, 2025 at 03:51:14PM -0400, Jason Gunthorpe wrote:
> On Fri, Jan 10, 2025 at 10:38:42AM -0800, Nicolin Chen wrote:
> > > The virtual event queue should behave the same as if the physical
> > > event queue overflows, and that logic should be in the smmu drive
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:06:49AM +, Tian, Kevin wrote:
> > > > From: Nicolin Chen
> > &g
On Mon, Jan 13, 2025 at 03:29:27PM -0400, Jason Gunthorpe wrote:
> On Tue, Jan 07, 2025 at 09:10:16AM -0800, Nicolin Chen wrote:
>
> > +int arm_smmu_attach_prepare_vmaster(struct arm_smmu_attach_state *state,
> > + struct iommu_domain *domain)
>
On Mon, Jan 13, 2025 at 03:21:44PM -0400, Jason Gunthorpe wrote:
> On Sun, Jan 12, 2025 at 09:37:41PM -0800, Nicolin Chen wrote:
>
> > > > > I supposed we will need a way to indicate lost events to userspace on
> > > > > top of this?
> > &g
On Thu, Jan 09, 2025 at 07:04:10PM +0800, kernel test robot wrote:
> sparse warnings: (new ones prefixed by >>)
> >> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:461:21: sparse:
> >> sparse: invalid assignment: &=
>drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:461:21: sparse:
On Mon, Jan 13, 2025 at 03:06:41PM -0400, Jason Gunthorpe wrote:
> On Mon, Jan 13, 2025 at 11:01:10AM -0800, Nicolin Chen wrote:
>
> > +/* This is basically iommu_vevent_arm_smmuv3 in u64 for conversion */
> > +struct arm_vsmmu_evt {
> > + union {
> > +
On Mon, Jan 13, 2025 at 03:12:25PM -0400, Jason Gunthorpe wrote:
> On Fri, Jan 10, 2025 at 01:58:21PM -0800, Nicolin Chen wrote:
> > Hmm, it seems that I haven't got your first narrative straight..
> >
> > Would you mind elaborate "copy_to_user() can block while wai
On Mon, Jan 13, 2025 at 03:54:33PM -0400, Jason Gunthorpe wrote:
> On Mon, Jan 13, 2025 at 11:47:52AM -0800, Nicolin Chen wrote:
> > > The other approach would be to add a sequence number to each event and
> > > let userspace detect the non-montonicity. It would require add
On Thu, Jan 02, 2025 at 04:52:46PM -0400, Jason Gunthorpe wrote:
> On Tue, Dec 17, 2024 at 09:00:19PM -0800, Nicolin Chen wrote:
> > +/* An iommufd_virq_header packs a vIOMMU interrupt in an iommufd_virq
> > queue */
> > +struct iommufd_virq_header {
> > + struct list
On Mon, Dec 23, 2024 at 10:28:32AM +0800, Baolu Lu wrote:
> On 12/19/24 13:06, Nicolin Chen wrote:
> > On Thu, Dec 19, 2024 at 10:05:53AM +0800, Baolu Lu wrote:
> > > On 12/18/24 13:00, Nicolin Chen wrote:
> > > > This is a reverse search v.s. iommufd_viommu_find_dev
On Fri, Jan 10, 2025 at 03:51:14PM -0400, Jason Gunthorpe wrote:
> On Fri, Jan 10, 2025 at 10:38:42AM -0800, Nicolin Chen wrote:
> > > The virtual event queue should behave the same as if the physical
> > > event queue overflows, and that logic should be in the smmu drive
On Fri, Jan 10, 2025 at 01:41:32PM -0400, Jason Gunthorpe wrote:
> On Tue, Jan 07, 2025 at 09:10:11AM -0800, Nicolin Chen wrote:
> > +/*
> > + * Typically called in driver's threaded IRQ handler.
> > + * The @type and @event_data must be defined in
> &
On Fri, Jan 10, 2025 at 10:51:49AM -0400, Jason Gunthorpe wrote:
> On Fri, Jan 10, 2025 at 07:12:46AM +, Tian, Kevin wrote:
>
> > > + if (!viommu)
> > > + return -ENODEV;
> > > + if (WARN_ON_ONCE(!viommu->ops || !viommu->ops-
> > > >supports_veventq ||
> > > + !viommu-
On Fri, Jan 10, 2025 at 01:48:42PM -0400, Jason Gunthorpe wrote:
> On Tue, Jan 07, 2025 at 09:10:09AM -0800, Nicolin Chen wrote:
>
> > +static ssize_t iommufd_veventq_fops_read(struct iommufd_eventq *eventq,
> > +char __user
On Fri, Jan 10, 2025 at 01:26:37PM -0400, Jason Gunthorpe wrote:
> +#define INIT_EVENTQ_FOPS(read_op, write_op) \
> + (struct file_operations){ \
> + .owner = THIS_MODULE, \
> + .open = nonseekab
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(struct iommufd_ucmd *ucmd)
> > +{
> > + struct iommu_veventq_alloc *cmd = ucmd->cmd;
On Fri, Jan 10, 2025 at 07:07:36AM +, Tian, Kevin wrote:
> > From: Nicolin Chen
> > Sent: Wednesday, January 8, 2025 1:10 AM
> > +
> > + xa_lock(&viommu->vdevs);
> > + xa_for_each(&viommu->vdevs, index, vdev) {
On Mon, Apr 07, 2025 at 08:08:57PM +0800, Zhangfei Gao wrote:
> Hi, Nico
>
> On Wed, 26 Feb 2025 at 01:35, Nicolin Chen wrote:
> >
> > Use it to store all vSMMU-related data. The vsid (Virtual Stream ID) will
> > be the first use case. Since the vsid reader will be
On Mon, Mar 17, 2025 at 12:44:23PM -0300, Jason Gunthorpe wrote:
> On Tue, Mar 11, 2025 at 10:43:08AM -0700, Nicolin Chen wrote:
> > > > +int arm_smmu_attach_prepare_vmaster(struct arm_smmu_attach_state
> > > > *state,
> > > > +
On Sun, Apr 27, 2025 at 02:55:40PM +0800, Baolu Lu wrote:
> On 4/26/25 13:58, Nicolin Chen wrote:
> > An IOMMU driver that allocated a vIOMMU may want to revert the allocation,
> > if it encounters an internal error after the allocation. So, there needs a
> > destroy help
On Sun, Apr 27, 2025 at 03:22:13PM +0800, Baolu Lu wrote:
> On 4/26/25 13:58, Nicolin Chen wrote:
> > The new vCMDQ object will be added for HW to access the guest memory for a
> > HW-accelerated virtualization feature. It needs to ensure the guest memory
> > pages are pinned
On Sun, Apr 27, 2025 at 02:31:54PM +0800, Baolu Lu wrote:
> On 4/26/25 13:57, Nicolin Chen wrote:
> > The new type of vIOMMU for tegra241-cmdqv needs to pass in a driver-level
> > data structure from user space via iommufd, so add a user_data to the op.
> >
> > R
On Mon, Apr 28, 2025 at 03:12:33PM -0700, Nicolin Chen wrote:
> On Mon, Apr 28, 2025 at 08:14:19PM +, Pranjal Shrivastava wrote:
> > On Fri, Apr 25, 2025 at 10:58:03PM -0700, Nicolin Chen wrote:
> > > + iopt_for_each_contig_area(&iter, area, iopt, iova, last_iova) {
&g
On Mon, Apr 28, 2025 at 08:14:19PM +, Pranjal Shrivastava wrote:
> On Fri, Apr 25, 2025 at 10:58:03PM -0700, Nicolin Chen wrote:
> > + iopt_for_each_contig_area(&iter, area, iopt, iova, last_iova) {
> > + unsigned long last = min(last_iova, iopt_
On Mon, Apr 28, 2025 at 09:34:05PM +, Pranjal Shrivastava wrote:
> On Fri, Apr 25, 2025 at 10:58:05PM -0700, Nicolin Chen wrote:
> > @@ -501,6 +504,9 @@ static const struct iommufd_object_ops
> > iommufd_object_ops[] = {
> > [IOMMUFD_OBJ_IOAS] = {
>
On Wed, Apr 23, 2025 at 08:55:51AM -0300, Jason Gunthorpe wrote:
> On Wed, Apr 23, 2025 at 08:05:49AM +, Tian, Kevin wrote:
>
> > It's not a good idea having the kernel trust the VMM.
>
> It certainly shouldn't trust it, but it can validate the VMM's choice
> and generate a failure if it isn
On Wed, Apr 23, 2025 at 12:58:19PM +0530, Vasant Hegde wrote:
> On 4/11/2025 12:07 PM, Nicolin Chen wrote:
> > The vIOMMU object is designed to represent a slice of an IOMMU HW for its
> > virtualization features shared with or passed to user space (a VM mostly)
> > in a w
Extend the existing test_cmd/err_viommu_alloc helpers to accept optional
user data. And add a TEST_F for a loopback test.
Signed-off-by: Nicolin Chen
---
tools/testing/selftests/iommu/iommufd_utils.h | 21 +-
tools/testing/selftests/iommu/iommufd.c | 29
Gunthorpe
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 8 --
include/linux/iommufd.h | 34 +
drivers/iommu/iommufd/viommu.c | 9 ++-
3 files changed, 42 insertions(+), 9 deletions(-)
diff --git a/drivers/iommu
lftest coverage for IOMMUFD_CMD_VCMDQ_ALLOC
* [iommufd] Add iopt_pin_pages() to prevent queue memory from unmapping
v1
https://lore.kernel.org/all/cover.1744353300.git.nicol...@nvidia.com/
Thanks
Nicolin
Nicolin Chen (22):
iommufd/viommu: Add driver-allocated vDEVICE support
iommu: Pass i
iommufd_struct_destroy() helper that will abort all kinds
of driver structures, not confined to iommufd_viommu but also the new ones
being added in the future.
Reviewed-by: Jason Gunthorpe
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 1 -
include/linux/iommufd.h | 15
Some simple tests for IOMMUFD_CMD_VCMDQ_ALLOC infrastructure covering the
new iommufd_vcmdq_depend/undepend() helpers.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_test.h | 3 +
tools/testing/selftests/iommu/iommufd_utils.h | 30 +
drivers/iommu/iommufd
An impl driver might support its own vIOMMU object, as tegra241-cmdqv will
add IOMMU_VIOMMU_TYPE_TEGRA241_CMDQV.
Add a vsmmu_alloc op to give impl a try, upon failure fallback to standard
vsmmu allocation for IOMMU_VIOMMU_TYPE_ARM_SMMUV3.
Signed-off-by: Nicolin Chen
---
drivers/iommu/arm/arm
On Wed, Apr 30, 2025 at 09:52:09AM +0530, Vasant Hegde wrote:
> >>> Will the hardware replace the physical device ID in the event with
> >>> the virtual device ID when injecting the event to a guest event/PPR
> >>> queue?
> >>> If so, yea, I think you can define them separately using the> vCMDQ
>
On Tue, Apr 29, 2025 at 09:35:07PM +, Pranjal Shrivastava wrote:
> On Tue, Apr 29, 2025 at 02:05:12PM -0700, Nicolin Chen wrote:
> > On Tue, Apr 29, 2025 at 08:55:47PM +, Pranjal Shrivastava wrote:
> > > On Tue, Apr 29, 2025 at 01:39:09PM -0700, Nicolin Chen wrote:
>
On Tue, Apr 29, 2025 at 10:32:19PM +, Pranjal Shrivastava wrote:
> On Fri, Apr 25, 2025 at 10:58:15PM -0700, Nicolin Chen wrote:
> > To simplify the mappings from global VCMDQs to VINTFs' LVCMDQs, the design
> > chose to do static allocations and mappings in the g
The new type of vIOMMU for tegra241-cmdqv driver needs a driver-specific
user data. So, add data_len/uptr to the iommu_viommu_alloc uAPI and pass
it in via the viommu_alloc iommu op.
Signed-off-by: Nicolin Chen
---
include/uapi/linux/iommufd.h | 6 ++
drivers/iommu/iommufd/viommu.c | 8
eue
- AMD vIOMMU's command buffer
Inroduce a struct iommufd_vcmdq and its allocator iommufd_vcmdq_alloc().
Also, add a pair of viommu ops for iommufd to forward user space ioctls to
IOMMU drivers.
Signed-off-by: Nicolin Chen
---
include/linux/iommufd.h | 31 +++
1 f
. And give IOMMU drivers a
pair of helpers to add and delete mmap regions onto the mt_mmap.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 9 ++
include/linux/iommufd.h | 15 ++
drivers/iommu/iommufd/driver.c | 40
Add a simple user_data for an input-to-output loopback test.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_test.h | 13 +
drivers/iommu/iommufd/selftest.c | 19 +++
2 files changed, 32 insertions(+)
diff --git a/drivers/iommu/iommufd
nc/iommufd/commits/iommufd_vcmdq-v1
Paring QEMU branch for testing:
https://github.com/nicolinc/qemu/commits/wip/for_iommufd_vcmdq-v1
Thanks
Nicolin
Nicolin Chen (16):
iommu: Pass in a driver-level user data structure to viommu_alloc op
iommufd/viommu: Allow driver-specific user data for a vIO
The new type of vIOMMU for tegra241-cmdqv needs to pass in a driver-level
data structure from user space via iommufd, so add a user_data to the op.
Signed-off-by: Nicolin Chen
---
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 3 ++-
include/linux/iommu.h
Similar to the iommu_copy_struct_from_user helper receiving data from the
user space, add an iommu_copy_struct_to_user helper to report output data
back to the user space data pointer.
Signed-off-by: Nicolin Chen
---
include/linux/iommu.h | 40
1 file
To allow IOMMU drivers to allocate own vDEVICE structures, move the struct
iommufd_vdevice to the public header and provide a pair of viommu ops.
The iommufd_vdevice_alloc_ioctl will prioritize the callback function from
the viommu ops, i.e. a driver-allocated vDEVICE.
Signed-off-by: Nicolin
iommufd_struct_destroy() helper that will abort all kinds
of driver structures, not confined to iommufd_viommu but also the new ones
being added by the following patches.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 1 -
include/linux/iommufd.h | 15
With the introduction of the new object and its infrastructure, update the
doc to reflect that.
Signed-off-by: Nicolin Chen
---
Documentation/userspace-api/iommufd.rst | 11 +++
1 file changed, 11 insertions(+)
diff --git a/Documentation/userspace-api/iommufd.rst
b/Documentation
Introduce a new IOMMUFD_CMD_VCMDQ_ALLOC ioctl for user space to allocate
a vCMDQ for a vIOMMU object. Simply increase the refcount of the vIOMMU.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_private.h | 2 +
include/uapi/linux/iommufd.h| 32 +
drivers
hypercall.
As an initial version, the number of VCMDQs per VINTF is fixed to two.
Signed-off-by: Nicolin Chen
---
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 15 +
include/uapi/linux/iommufd.h | 34 ++
.../arm/arm-smmu-v3/arm-smmu-v3-iommufd.c | 6 +-
.../iommu/arm/a
Add a new vEVENTQ type for VINTFs that are assigned to the user space.
Simply report the two 64-bit LVCMDQ_ERR_MAPs register values.
Signed-off-by: Nicolin Chen
---
include/uapi/linux/iommufd.h | 15 +
.../iommu/arm/arm-smmu-v3/tegra241-cmdqv.c| 22
An impl driver might support its own vIOMMU object, as the following patch
will add IOMMU_VIOMMU_TYPE_TEGRA241_CMDQV.
Add a vsmmu_alloc op to give impl a try, upon failure fallback to standard
vsmmu allocation for IOMMU_VIOMMU_TYPE_ARM_SMMUV3.
Signed-off-by: Nicolin Chen
---
drivers/iommu/arm
Extend the loopback test to a new mmap page.
Signed-off-by: Nicolin Chen
---
drivers/iommu/iommufd/iommufd_test.h| 4 +++
drivers/iommu/iommufd/selftest.c| 47 -
tools/testing/selftests/iommu/iommufd.c | 5 +++
3 files changed, 48 insertions(+), 8 deletions
A vIRQ can be reported only from a threaded IRQ context. Change to use
to request_threaded_irq to support that.
Signed-off-by: Nicolin Chen
---
drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/iommu/arm/arm-smmu-v3
Extend the existing test_cmd/err_viommu_alloc helpers to accept optional
user data. And add a TEST_F for a loopback test.
Signed-off-by: Nicolin Chen
---
tools/testing/selftests/iommu/iommufd_utils.h | 21 +-
tools/testing/selftests/iommu/iommufd.c | 29
On Mon, Apr 14, 2025 at 08:25:40AM -0700, Matt Ochs wrote:
> > On Apr 11, 2025, at 1:37 AM, Nicolin Chen wrote:
> > +__iommu_copy_struct_to_user(const struct iommu_user_data *dst_data,
> > +void *src_data, unsigned int data_type,
> > +size_t data_len, size_t
On Fri, Apr 11, 2025 at 06:05:30PM +0530, ALOK TIWARI wrote:
> On 11-04-2025 12:07, Nicolin Chen wrote:
> > + * iommu_copy_struct_to_user - Report iommu driver specific user space data
> > + * @user_data: Pointer to a struct iommu_user_data for user space data
> > location
&
On Mon, May 05, 2025 at 12:01:09PM -0300, Jason Gunthorpe wrote:
> On Mon, Apr 28, 2025 at 10:41:45AM -0700, Nicolin Chen wrote:
> > > I'm uncertain, but perhaps pr_warn_ratelimited() would be a better
> > > alternative to WARN_ON() here? WARN_ON_ONCE() generates warning
On Mon, May 05, 2025 at 12:02:14PM -0300, Jason Gunthorpe wrote:
> On Mon, Apr 28, 2025 at 11:10:40AM -0700, Nicolin Chen wrote:
> > > > +struct iommufd_vcmdq {
> > > > + struct iommufd_object obj;
> > > > + struct iommufd_ctx *ictx;
> &
On Mon, May 05, 2025 at 12:55:05PM -0300, Jason Gunthorpe wrote:
> On Mon, May 05, 2025 at 08:44:22AM -0700, Nicolin Chen wrote:
> > On Mon, May 05, 2025 at 12:01:09PM -0300, Jason Gunthorpe wrote:
> > > On Mon, Apr 28, 2025 at 10:41:45AM -0700, Nicolin Chen wrote:
> >
On Mon, May 05, 2025 at 01:05:54PM -0300, Jason Gunthorpe wrote:
> On Mon, May 05, 2025 at 09:03:28AM -0700, Nicolin Chen wrote:
> > On Mon, May 05, 2025 at 12:55:05PM -0300, Jason Gunthorpe wrote:
> > > On Mon, May 05, 2025 at 08:44:22AM -0700, Nicolin Chen wrote:
> > >
On Wed, Apr 30, 2025 at 09:59:13PM +, Pranjal Shrivastava wrote:
> On Fri, Apr 25, 2025 at 10:58:16PM -0700, Nicolin Chen wrote:
> > The CMDQV HW supports a user-space use for virtualization cases. It allows
> > the VM to issue guest-level TLBI or ATC_INV commands directly to th
On Wed, Apr 30, 2025 at 03:39:22PM -0700, Nicolin Chen wrote:
> On Wed, Apr 30, 2025 at 09:59:13PM +, Pranjal Shrivastava wrote:
> > > enum iommu_viommu_type {
> > > IOMMU_VIOMMU_TYPE_DEFAULT = 0,
> > > IOMMU_VIOMMU_TYPE_ARM_SMMUV3 = 1,
> > >
201 - 300 of 702 matches
Mail list logo