From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 49CDEC77B60 for ; Mon, 24 Apr 2023 02:45:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:To:Subject:Cc: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=A6+5yyEh83ttMBdZqm6niLskdRRIE4IPzEPpqrQqEb0=; b=FuXIcF1AtLmaF4 CDPRgbCEaNChCD5wOayelgJ94jvTOuQH0IgiIuohNnSTFAd7LyubV39+nVx7dn7Cxd3BvizVXIKcm XqOnHeYTnxkXvRjK0kqBGr0al/FOVUQICr9XGIwAyS8tdAWcVZuRM3KRrU+zj5w6nEtOkGdRlT+8a NAPkxZW71Gbl2kr7LlvqHIp3d0ynZ+GMfAtsQ79an52URlo2ykwsru2y0Adz+TqJ9rUERPYITatvz 7kZ/bDk3SZSZuHSldYtUE2D/Re/sMfVGCPVZ03QJK2qAuhdMobOMIxiLiTbtDSYfjmswICF47z55Y uvQNRAYQxau9NzQ4IUtA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pqmBp-00F8w9-0i; Mon, 24 Apr 2023 02:44:29 +0000 Received: from mga12.intel.com ([192.55.52.136]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pqmBl-00F8v6-3D for linux-arm-kernel@lists.infradead.org; Mon, 24 Apr 2023 02:44:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1682304265; x=1713840265; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=k27B1ipAQkQd60Tjqvyx1KKy9XwjNqmqc36Yae9K9/s=; b=CxFSXA1IZ610+mKFwDwFxNLl6qCq+w0SQMy4gapCQLUU4YXNsdy5Hmjp IqBCRt8TE5g2jdIayT3Oy8jCrfnzpEHO0H/SDWOWbim4o2oNDGWCs1W7i 89QgYl/HN8Xxn0dWz/8yJ87T6kNJb8CbYLyUiKP6EXkqyS8reXtWppaIi w5uaKfA4YsaM1d4rOWJ8hHmJgwxhBLfXaU8AMUj7X17W7MmUtHDlZxUBC xWl+RQu7amgW7Hd81WUBxc4N7kZAAv2iccRAa/oNf+KFCX7co3nHYJ+tO 0rQf1relydQ/UdWqgHNQLFhu194PDSJcsFCt1t5OMFLQWQ0RJwaSmvdks g==; X-IronPort-AV: E=McAfee;i="6600,9927,10689"; a="325947968" X-IronPort-AV: E=Sophos;i="5.99,221,1677571200"; d="scan'208";a="325947968" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Apr 2023 19:44:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10689"; a="686615186" X-IronPort-AV: E=Sophos;i="5.99,221,1677571200"; d="scan'208";a="686615186" Received: from allen-box.sh.intel.com (HELO [10.239.159.127]) ([10.239.159.127]) by orsmga007.jf.intel.com with ESMTP; 23 Apr 2023 19:44:16 -0700 Message-ID: <17342260-0795-9636-8408-0ca0d6c50403@linux.intel.com> Date: Mon, 24 Apr 2023 10:44:08 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 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 To: Nicolin Chen , jgg@nvidia.com, kevin.tian@intel.com References: <08604f9f4835d5a6b0d2d75de69722194abf7747.1682234302.git.nicolinc@nvidia.com> Content-Language: en-US From: Baolu Lu In-Reply-To: <08604f9f4835d5a6b0d2d75de69722194abf7747.1682234302.git.nicolinc@nvidia.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230423_194426_072318_35253B51 X-CRM114-Status: GOOD ( 18.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 > --- > 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel