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 8CD5BD1713E for ; Tue, 22 Oct 2024 03:42:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type: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=MttiQpJDjcBJR0DNOdGWmpA5ChMe9JAV3a4wwvM7vYk=; b=eZut4H+2mL+TATqm5vni/XaMbl WLLXSCCV5b0gA+8SwnkwZeTkDAP5N50fOe0uJ4yl+U25flrUxAQjvit//f9yv99//B7l+PCtR7t+j NU7UIoLSV09AfgqVL7j6VZYdzjGRvYQYqV4x1yS99xRZyojN5F2eBKqM7N8wWM+z9yvfWkLpc45KB 4LDWqJt/wg6FEYouWEHhmsl8V/UPgEqpafYtKHim5cWwhObrVWGh7YuAIHj0v/1jErQgKE/EpS2AT jlpuU2xCM9Do3QS+VW6+0huJLG9B0PVqYbIt8OpKmFJctmUMCkAnEBzj4B/Z/NeebhyAzLXeiI7oN fneMTI/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t35n2-00000009UY0-0iD3; Tue, 22 Oct 2024 03:42:36 +0000 Received: from mgamail.intel.com ([192.198.163.7]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t35lW-00000009UK2-0rUD for linux-arm-kernel@lists.infradead.org; Tue, 22 Oct 2024 03:41:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729568462; x=1761104462; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=oZ/sHu2Aj21HZjujmiwtCdiSKjniswQaqv0Y3l/OwzA=; b=DxGOx+oLCbBsK1FR7i0I3Dkm5g8+4h7b10ht9EZXXmtMbAgndCL+Ux6Z EOHgWDiS2lZD8fx1JzbdvQq2HAHx+msaydofJNB62TpmYknzg0C4myTkC ArbpXmdiIgjc+PW/T2Axsr8+qige+ajm6ZNJATJ6zJa5t8pQIbNrq75BI /3x2fJAouHgtbd4hJOeT9iXAL9JCfeEeQEcq9D7qcySZ1eul6YZBsJJAr NY21A3+5/+sx5/P/zNBUYrA/FvRVzmrISNA6trj5PS1+SKKEG46N6kjZC Bi+YXOsnlP4WuaUg0EKPsXOe6/anfekXDc7CmERs1/VM7wveSEIwKg5rc A==; X-CSE-ConnectionGUID: kiahMhBoS4i3sLNE3Ogpjg== X-CSE-MsgGUID: +OU3s0KoQ+WMeB8qNp35Tw== X-IronPort-AV: E=McAfee;i="6700,10204,11232"; a="54486096" X-IronPort-AV: E=Sophos;i="6.11,222,1725346800"; d="scan'208";a="54486096" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2024 20:40:19 -0700 X-CSE-ConnectionGUID: 47iCjRLnQHCXnCoWQay3Jw== X-CSE-MsgGUID: Qxh8VIPkRp+3Cb9ZbOBmLw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,222,1725346800"; d="scan'208";a="84802562" Received: from unknown (HELO [10.238.0.51]) ([10.238.0.51]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2024 20:40:14 -0700 Message-ID: <1886d618-5539-4108-96c7-afebb65b2c80@linux.intel.com> Date: Tue, 22 Oct 2024 11:40:11 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: baolu.lu@linux.intel.com, joro@8bytes.org, suravee.suthikulpanit@amd.com, robin.murphy@arm.com, dwmw2@infradead.org, shuah@kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, eric.auger@redhat.com, jean-philippe@linaro.org, mdf@kernel.org, mshavit@google.com, shameerali.kolothum.thodi@huawei.com, smostafa@google.com, yi.l.liu@intel.com, aik@amd.com, zhangfei.gao@linaro.org, patches@lists.linux.dev Subject: Re: [PATCH v4 02/14] iommufd/viommu: Add IOMMU_VDEVICE_ALLOC ioctl To: Nicolin Chen , jgg@nvidia.com, kevin.tian@intel.com, will@kernel.org References: <2404ee8d2bd97e7b8c4c45b24cf52b157fb0b635.1729555967.git.nicolinc@nvidia.com> Content-Language: en-US From: Baolu Lu In-Reply-To: <2404ee8d2bd97e7b8c4c45b24cf52b157fb0b635.1729555967.git.nicolinc@nvidia.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241021_204102_297108_53E28B10 X-CRM114-Status: GOOD ( 10.68 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2024/10/22 8:20, Nicolin Chen wrote: > Introduce a new ioctl to allocate a vDEVICE object. Since a vDEVICE object > is a connection of an iommufd_iommufd object and an iommufd_viommu object, nit: :s/iommufd_iommufd/iommufd_device/g or not? > require both as the ioctl inputs and take refcounts in the ioctl handler. > > Add to the vIOMMU object a "vdevs" xarray, indexed by a per-vIOMMU virtual > device ID, which can be: > - Virtual StreamID on a nested ARM SMMUv3, an index to a Stream Table > - Virtual DeviceID on a nested AMD IOMMU, an index to a Device Table > - Virtual ID on a nested Intel VT-D IOMMU, an index to a Context Table > > Then, let the idev structure hold the allocated vdev pointer with a proper > locking protection. > > Signed-off-by: Nicolin Chen > --- > drivers/iommu/iommufd/iommufd_private.h | 12 +++ > include/linux/iommufd.h | 2 + > include/uapi/linux/iommufd.h | 26 ++++++ > drivers/iommu/iommufd/device.c | 11 +++ > drivers/iommu/iommufd/main.c | 7 ++ > drivers/iommu/iommufd/viommu.c | 108 ++++++++++++++++++++++++ > 6 files changed, 166 insertions(+) Thanks, baolu