From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F158215DBC1; Mon, 16 Jun 2025 06:27:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750055234; cv=none; b=T2AAAUChRSTY9ykXYhUZxXWHj0aE6cpP5B7C7WbF/R7a23Mfqi/Tk0mlZgT7Byfxto5VR2isiQuiPC90q8Inqj0cZxxQy4L5Dh/O7ZDHKVAq+5LOm44CRjvmIiG3Gb6JSP77XEqcFSv3yUofgYkolnRDq/asO03lgk9lk3StwUc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750055234; c=relaxed/simple; bh=guthJV8X5Sn3QS48dFxzVUYchT/ptlQNDvr7/P3ystE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jiMPzmfZOgoOzpGNWwC4eJjJk7zXgL8lO5yc5gqoko4WF74APMyg7LsnBKqdCU5tEKtR7tteqXiA+LgoUia/jWAWNlBTexgD8EMMo8LbDoi0+/ZyJqLG9/6ZllEe1zjZ98h2HHB5PklEox9FMfeMOb5TP0OES+8NAIzoWY0omOM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=gviuadVo; arc=none smtp.client-ip=198.175.65.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gviuadVo" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1750055232; x=1781591232; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=guthJV8X5Sn3QS48dFxzVUYchT/ptlQNDvr7/P3ystE=; b=gviuadVoelIR0Q5XQYw08IgTEBxcvL+X4u64q/hj+DF0WiLlBNxdUlB9 RLMzH11vLoMU1UXvNVINkFIOL5Bqxxjyq48RlwAO6qzw763ZblQ8/HPoo bAbAjPes+8sW1CnYhe1RvLAhjqnh5mMrc9OlTn/rrzI8d6v3t1ZBHPQSr nj8fOXwop3QoH61P6uFbLnDvJ19ecxnrRvwGLuDQXC4+GRhP+XiJ6m70R EKDZuMIfjB7NAfkTDfQFtDXc59H5xFUjp/FJmwGDJATpMMU7dNa5jd4wx ku65Kh33GnEuiE94DIZMaKGLQ3XOaXDDByK1Ilpgub9XM3iEe0Zr5wayF w==; X-CSE-ConnectionGUID: zKXXLzjwSGSLGsLLvfWm+w== X-CSE-MsgGUID: uCwgUqAKQxy6slILmKd47g== X-IronPort-AV: E=McAfee;i="6800,10657,11465"; a="69632509" X-IronPort-AV: E=Sophos;i="6.16,240,1744095600"; d="scan'208";a="69632509" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2025 23:27:10 -0700 X-CSE-ConnectionGUID: ZURGS4SzT3Cu91PvtlrvWg== X-CSE-MsgGUID: ZI6oSjeARV23YgzKHmA7PQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.16,240,1744095600"; d="scan'208";a="148841810" Received: from allen-sbox.sh.intel.com (HELO [10.239.159.30]) ([10.239.159.30]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2025 23:27:03 -0700 Message-ID: Date: Mon, 16 Jun 2025 14:26:04 +0800 Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 08/25] iommufd/viommu: Add driver-defined vDEVICE support To: Nicolin Chen , jgg@nvidia.com, kevin.tian@intel.com, corbet@lwn.net, will@kernel.org Cc: bagasdotme@gmail.com, robin.murphy@arm.com, joro@8bytes.org, thierry.reding@gmail.com, vdumpa@nvidia.com, jonathanh@nvidia.com, shuah@kernel.org, jsnitsel@redhat.com, nathan@kernel.org, peterz@infradead.org, yi.l.liu@intel.com, mshavit@google.com, praan@google.com, zhangzekun11@huawei.com, iommu@lists.linux.dev, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, linux-kselftest@vger.kernel.org, patches@lists.linux.dev, mochs@nvidia.com, alok.a.tiwari@oracle.com, vasant.hegde@amd.com, dwmw2@infradead.org References: <937d515032be07af36c06a4adb662ee2f7693c75.1749884998.git.nicolinc@nvidia.com> Content-Language: en-US From: Baolu Lu In-Reply-To: <937d515032be07af36c06a4adb662ee2f7693c75.1749884998.git.nicolinc@nvidia.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 6/14/25 15:14, Nicolin Chen wrote: > NVIDIA VCMDQ driver will have a driver-defined vDEVICE structure and do > some HW configurations with that. > > To allow IOMMU drivers to define their own vDEVICE structures, move the > struct iommufd_vdevice to the public header and provide a pair of viommu > ops, similar to get_viommu_size and viommu_init. > > Doing this, however, creates a new window between the vDEVICE allocation > and its driver-level initialization, during which an abort could happen > but it can't invoke a driver destroy function from the struct viommu_ops > since the driver structure isn't initialized yet. vIOMMU object doesn't > have this problem, since its destroy op is set via the viommu_ops by the > driver viommu_init function. Thus, vDEVICE should do something similar: > add a destroy function pointer inside the struct iommufd_vdevice instead > of the struct iommufd_viommu_ops. > > Note that there is unlikely a use case for a type dependent vDEVICE, so > a static vdevice_size is probably enough for the near term instead of a > get_vdevice_size function op. > > Reviewed-by: Jason Gunthorpe > Reviewed-by: Kevin Tian > Signed-off-by: Nicolin Chen Reviewed-by: Lu Baolu