From: Baolu Lu <baolu.lu@linux.intel.com>
To: Nicolin Chen <nicolinc@nvidia.com>, jgg@nvidia.com, kevin.tian@intel.com
Cc: baolu.lu@linux.intel.com, robin.murphy@arm.com,
eric.auger@redhat.com, yi.l.liu@intel.com, will@kernel.org,
joro@8bytes.org, shameerali.kolothum.thodi@huawei.com,
jean-philippe@linaro.org, linux-arm-kernel@lists.infradead.org,
iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC v3 2/4] iommufd: Add IOMMUFD_CMD_DEVICE_SET_DATA and IOMMUFD_CMD_DEVICE_UNSET_DATA
Date: Mon, 24 Apr 2023 10:44:08 +0800 [thread overview]
Message-ID: <17342260-0795-9636-8408-0ca0d6c50403@linux.intel.com> (raw)
In-Reply-To: <08604f9f4835d5a6b0d2d75de69722194abf7747.1682234302.git.nicolinc@nvidia.com>
On 4/23/23 3:40 PM, Nicolin Chen wrote:
> Add a new pair of ioctls to allow user space to set and unset its iommu-
> specific device data for a passthrough device that's behind the iommu.
>
> On platforms with SMMUv3, this new uAPIs will be used to forward a user
> space virtual Stream ID of a passthrough device to link to its physical
> Stream ID and log into a lookup table, in order for the host kernel to
> later run sanity on ATC invalidation requests from the user space, with
> ATC_INV commands that have SID fields (virtual Stream IDs).
>
> Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
> ---
> drivers/iommu/iommufd/device.c | 81 +++++++++++++++++++++++++
> drivers/iommu/iommufd/iommufd_private.h | 3 +
> drivers/iommu/iommufd/main.c | 4 ++
> include/uapi/linux/iommufd.h | 32 ++++++++++
> 4 files changed, 120 insertions(+)
>
> diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c
> index c649a3403797..9480cd36a8bd 100644
> --- a/drivers/iommu/iommufd/device.c
> +++ b/drivers/iommu/iommufd/device.c
> @@ -136,6 +136,8 @@ void iommufd_device_destroy(struct iommufd_object *obj)
> struct iommufd_device *idev =
> container_of(obj, struct iommufd_device, obj);
>
> + if (WARN_ON(idev->has_user_data))
> + dev_iommu_ops(idev->dev)->unset_dev_user_data(idev->dev);
Do you really need this WARN_ON()? The user space application can easily
trigger this kernel WARN() by setting the user data and forgetting to
unset it.
Best regards,
baolu
next prev parent reply other threads:[~2023-04-24 2:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-23 7:40 [PATCH RFC v3 0/4] Add set_dev_data and unset_dev_data support Nicolin Chen
2023-04-23 7:40 ` [PATCH RFC v3 1/4] iommu: Add set/unset_dev_user_data ops Nicolin Chen
2023-04-23 7:40 ` [PATCH RFC v3 2/4] iommufd: Add IOMMUFD_CMD_DEVICE_SET_DATA and IOMMUFD_CMD_DEVICE_UNSET_DATA Nicolin Chen
2023-04-24 2:44 ` Baolu Lu [this message]
2023-04-24 18:50 ` Nicolin Chen
2023-04-23 7:40 ` [PATCH RFC v3 3/4] iommufd/selftest: Add IOMMU_TEST_OP_DEV_CHECK_DATA Nicolin Chen
2023-04-23 7:40 ` [PATCH RFC v3 4/4] iommufd/selftests: Add coverage for IOMMU_DEVICE_SET/UNSET_DATA Nicolin Chen
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=17342260-0795-9636-8408-0ca0d6c50403@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=eric.auger@redhat.com \
--cc=iommu@lists.linux.dev \
--cc=jean-philippe@linaro.org \
--cc=jgg@nvidia.com \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nicolinc@nvidia.com \
--cc=robin.murphy@arm.com \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=will@kernel.org \
--cc=yi.l.liu@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox