All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aneesh Kumar K.V <aneesh.kumar@kernel.org>
To: "Tian, Kevin" <kevin.tian@intel.com>,
	"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Cc: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	Bjorn Helgaas <helgaas@kernel.org>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	"Williams, Dan J" <dan.j.williams@intel.com>,
	Alexey Kardashevskiy <aik@amd.com>,
	Samuel Ortiz <sameo@rivosinc.com>,
	Xu Yilun <yilun.xu@linux.intel.com>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	Suzuki K Poulose <Suzuki.Poulose@arm.com>,
	Steven Price <steven.price@arm.com>
Subject: RE: [PATCH v2 2/3] iommufd/tsm: add vdevice TSM bind/unbind ioctl
Date: Mon, 16 Mar 2026 14:15:06 +0530	[thread overview]
Message-ID: <yq5ay0js6u3x.fsf@kernel.org> (raw)
In-Reply-To: <BN9PR11MB5276585EAEC4C80D4D45DD8A8C40A@BN9PR11MB5276.namprd11.prod.outlook.com>

"Tian, Kevin" <kevin.tian@intel.com> writes:

>> From: Aneesh Kumar K.V (Arm) <aneesh.kumar@kernel.org>
>> Sent: Monday, March 9, 2026 7:17 PM
>> 
>> Introduce IOMMU_VDEVICE_TSM_OP to allow userspace to issue TSM
>> bind/unbind
>> operations for an iommufd vdevice.
>
> How many ops are planned? If just a few I'd prefer to openly defining
> it:
>
> 	IOMMU_VDEVICE_ALLOC,
> 	IOMMU_VDEVICE_TSM_BIND,
> 	IOMMU_VDEVICE_TSM_UNBIND,
>
> just like how we did for IOAS.
>

Right now only TSM_BIND and TSM_UNBIND. This was done based on earlier
review feedback.

https://lore.kernel.org/all/20250530181842.GU233377@nvidia.com/

>
>> @@ -432,6 +432,7 @@ union ucmd_buffer {
>>  	struct iommu_veventq_alloc veventq;
>>  	struct iommu_vfio_ioas vfio_ioas;
>>  	struct iommu_viommu_alloc viommu;
>> +	struct iommu_vdevice_tsm_op tsm_op;
>
> please follow the alphabetical order
>
>> @@ -493,6 +494,8 @@ static const struct iommufd_ioctl_op
>> iommufd_ioctl_ops[] = {
>>  		 __reserved),
>>  	IOCTL_OP(IOMMU_VIOMMU_ALLOC, iommufd_viommu_alloc_ioctl,
>>  		 struct iommu_viommu_alloc, out_viommu_id),
>> +	IOCTL_OP(IOMMU_VDEVICE_TSM_OP,
>> iommufd_vdevice_tsm_op_ioctl,
>> +		 struct iommu_vdevice_tsm_op, vdevice_id),
>
> ditto
>
>> +int iommufd_vdevice_tsm_op_ioctl(struct iommufd_ucmd *ucmd)
>> +{
>> +	int rc;
>> +	struct kvm *kvm;
>> +	struct iommufd_vdevice *vdev;
>> +	struct iommu_vdevice_tsm_op *cmd = ucmd->cmd;
>> +
>> +	if (cmd->flags)
>> +		return -EOPNOTSUPP;
>> +
>> +	vdev = container_of(iommufd_get_object(ucmd->ictx, cmd-
>> >vdevice_id,
>> +					       IOMMUFD_OBJ_VDEVICE),
>> +			    struct iommufd_vdevice, obj);
>> +	if (IS_ERR(vdev))
>> +		return PTR_ERR(vdev);
>> +
>> +	if (!vdev->viommu->kvm_filp) {
>> +		rc = -ENODEV;
>> +		goto out_put_vdev;
>> +	}
>> +
>> +	kvm = vdev->viommu->kvm_filp->private_data;
>> +	if (!kvm) {
>> +		rc = -ENODEV;
>> +		goto out_put_vdev;
>> +	}
>
> 	if (!vdev->viommu->kvm_filp ||
> 	    !vdev->viommu->kvm_filp->private_data) {
> 		rc = -ENODEV;
> 		goto out_put_vdev;
> 	}
>
> 	kvm = vdev->viommu->kvm_filp->private_data;

-aneesh

  reply	other threads:[~2026-03-16  8:45 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-09 11:17 [PATCH v2 0/3] Add iommufd ioctls to support TSM operations Aneesh Kumar K.V (Arm)
2026-03-09 11:17 ` [PATCH v2 1/3] iommufd/viommu: Allow associating a KVM VM fd with a vIOMMU Aneesh Kumar K.V (Arm)
2026-03-11 21:18   ` Jonathan Cameron
2026-03-13 18:27     ` Jason Gunthorpe
2026-03-13  6:15   ` Nicolin Chen
2026-03-13 18:34     ` Jason Gunthorpe
2026-03-16  5:49     ` Aneesh Kumar K.V
2026-03-13 18:31   ` Jason Gunthorpe
2026-03-09 11:17 ` [PATCH v2 2/3] iommufd/tsm: add vdevice TSM bind/unbind ioctl Aneesh Kumar K.V (Arm)
2026-03-11 21:35   ` Jonathan Cameron
2026-03-13 18:42     ` Jason Gunthorpe
2026-03-13 18:48   ` Jason Gunthorpe
2026-03-16  7:12   ` Tian, Kevin
2026-03-16  8:45     ` Aneesh Kumar K.V [this message]
2026-03-09 11:17 ` [PATCH v2 3/3] iommufd/vdevice: add TSM guest request ioctl Aneesh Kumar K.V (Arm)
2026-03-11 21:43   ` Jonathan Cameron
2026-03-13 18:46     ` Jason Gunthorpe
2026-03-13 18:49   ` Jason Gunthorpe
2026-03-13 22:17     ` Dan Williams
2026-03-16  7:25       ` Tian, Kevin
2026-03-16  5:47     ` Aneesh Kumar K.V
2026-03-16  7:28       ` Tian, Kevin
2026-03-16  7:31   ` Tian, Kevin

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=yq5ay0js6u3x.fsf@kernel.org \
    --to=aneesh.kumar@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=Suzuki.Poulose@arm.com \
    --cc=aik@amd.com \
    --cc=dan.j.williams@intel.com \
    --cc=helgaas@kernel.org \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sameo@rivosinc.com \
    --cc=steven.price@arm.com \
    --cc=will@kernel.org \
    --cc=yilun.xu@linux.intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.