Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp151569lqh; Thu, 30 May 2024 18:01:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVp8aWlJCOi6AfmaEAX4omEfjzs3Dssk6jruLkw5s3TZI3DerzQCcbmE8MxzHLo2HuN7L0uhuUnTxyF4UK/pZiHzWceOYdtdN2JxYQxVw== X-Google-Smtp-Source: AGHT+IFmRZJ2WBK8cFYxpQdeM85HjPjNnxcTXOkzDrax3RfB36V0vqLha0XTRdoXGlDt+m9DUvus X-Received: by 2002:a37:de06:0:b0:792:9559:8df5 with SMTP id af79cd13be357-794f5ebe4f6mr36090785a.47.1717117292166; Thu, 30 May 2024 18:01:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717117292; cv=pass; d=google.com; s=arc-20160816; b=pO2uz7K6dQSt2W2Fee8U+i/+yudnXNZDc7Fp+UYl2273kNGkBDShabZWsQ9no4V42y 7j6ghZ91Q+CKRAutBskIeJesfLOq/5Vt9UZEvBMVgzObfJ4cQWL0aNQ3fHuyxzHKnoCo V6COy0Ighv6p8KxheD4M91+YUZkmN+TfkOYGj2mdyk6x+3qfEy8+r5v91ui+RQa/gwGf zlUZbUXFy2yKXXt1sm3wJag1DxpfRZWVEt9BlaSy214IDKrmyy0BM8+SwB0BfKzwJUmw y8TtFfrWuV6WM9GSynPXv1K3wJR+4C3O5oO8hBFaj0qQ6x5B1On44o5qRkO1a16cX/Jn wOug== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:cc:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=DEwrc+/nS2ZWvmInKyvjThK4173V4CKu5Axp0TwVzU0=; fh=yBL+swnv1Fe7SCls0Cxsw2axFnNJWf7CBT0VATDRt6g=; b=eymayn2gxXf1dLJP0/zq9Q0ZXpnXvuTFNhhT3+Ts0k483D2yB7qcMtV+i8PJczsBwv u/wC+x8TxBRFmRWuYk6TgtCFixmYR6pD9irKUjYPIGrXqr9s3XWLxAwjalS9HeMkrXva /Wt14FRRsDtj3IC2nNB26YBxhQDc54+DgGGk5e5oHPLe0fDABv9suUvbexueRcMbnAVP 1XXD/p98J4aqoqbn/UCTlghTqGgIhPx3/KEx3dk9sf8ZjGpGHNB4binC9D44kuPqGc1l 4WYRPU6W6H8yr7qcCyEdgUwC9VN2etDNHYV5YXQA4QuN2KDB9dCODhqHwVlowpWpVRXi jUpA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SbrIggOf; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-196110-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196110-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-794f3062f6dsi100130485a.287.2024.05.30.18.01.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 18:01:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-196110-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SbrIggOf; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-196110-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196110-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D1B1E1C2291F for ; Fri, 31 May 2024 01:01:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BE3D85C89; Fri, 31 May 2024 01:01:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="SbrIggOf" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (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 99E3C211C for ; Fri, 31 May 2024 01:01:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717117285; cv=none; b=X5E7WXGNc4c5YcyPUyNH9Ndw2WrGEchMeN+1DIIjKVkgzShTEgZK3VclHvkCh4D29vSKo3jOsshb0m7bYQKJbeRQP/2IE8iHoHy/iJSBmCtx0dHYc1ympoosBPGM7PT6y6HyW9bBnPmzVwumS4fTu4G+saVZ2HYMrAuDOwdVcws= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717117285; c=relaxed/simple; bh=Ok5WtKpA99niKOAeQZIUoy/NxG0jU4SaVokvbGP0n+4=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=G1O3yAiFWFd8oCZH2dBj/yJaGu6y3C85/afamy42dMfj6KQtlAjYHW1IvYUYxRojwFi/9uzynqcFpiH1mTYi+mUZpCmx+zzDU4VRWto24M07x6/8tNic31YonUTcoNbAkAJOD8C4Y5e+YZtnlo8ms0P0q89ZttFpr9RFiDN2Qvk= 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=SbrIggOf; arc=none smtp.client-ip=198.175.65.11 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717117284; x=1748653284; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=Ok5WtKpA99niKOAeQZIUoy/NxG0jU4SaVokvbGP0n+4=; b=SbrIggOf5Fy0NTfZxzZy6BAHjdqom4h0Wi26dxqO6XYwhDuUJDZoFexZ HqXwunGH6HmycVECy07RQLIOJ0qCOcmZsjhtNFCk3Mm0/VzTtL97y+kSb d11RUwREoJDGw32pafk/xUxCvlvBRsHBmDxnVrZUturnMkcxbvjEfASLe 7YEn/s1/BRJ/NI5FydJpRjf3shK55jnPC1nZyWB9aFLVvlRkcmFrSYLJy 6ehbcMmTNZA/GRgSd0BTf+3nGI/NvAEjSfvzULa8GKOA3ovQKH/C/Sltj lr93MSiLkwzWKKoDDStU0LoqFJeCW60DjDJGqTxK2ttaf2CQk6IyALOSl Q==; X-CSE-ConnectionGUID: rB8hxUGiSAOSNrrnr4P5Yw== X-CSE-MsgGUID: mcgcXVcrQrWHp2qJkkvvSA== X-IronPort-AV: E=McAfee;i="6600,9927,11088"; a="24207081" X-IronPort-AV: E=Sophos;i="6.08,202,1712646000"; d="scan'208";a="24207081" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2024 18:01:23 -0700 X-CSE-ConnectionGUID: ek2BmyUbTJy0FItK1wPepw== X-CSE-MsgGUID: 9pojCTkBREqGRr18kKBuyg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,202,1712646000"; d="scan'208";a="36103816" Received: from unknown (HELO [10.239.159.127]) ([10.239.159.127]) by fmviesa009.fm.intel.com with ESMTP; 30 May 2024 18:01:20 -0700 Message-ID: Date: Fri, 31 May 2024 08:59:13 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: baolu.lu@linux.intel.com, iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] iommu: Make iommu_sva_domain_alloc() static To: Vasant Hegde , Joerg Roedel , Will Deacon , Robin Murphy , Jason Gunthorpe , Kevin Tian , Jean-Philippe Brucker References: <20240528045458.81458-1-baolu.lu@linux.intel.com> Content-Language: en-US From: Baolu Lu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 5/30/24 4:52 PM, Vasant Hegde wrote: > On 5/28/2024 10:24 AM, Lu Baolu wrote: >> iommu_sva_domain_alloc() is only called in iommu-sva.c, hence make it >> static. >> >> On the other hand, iommu_sva_domain_alloc() should not return NULL anymore >> after commit <80af5a452024> ("iommu: Add ops->domain_alloc_sva()"), the >> removal of inline code avoids potential confusion. >> >> Fixes: 80af5a452024 ("iommu: Add ops->domain_alloc_sva()") >> Signed-off-by: Lu Baolu >> --- >> include/linux/iommu.h | 8 -------- >> drivers/iommu/iommu-sva.c | 6 ++++-- >> 2 files changed, 4 insertions(+), 10 deletions(-) >> >> diff --git a/include/linux/iommu.h b/include/linux/iommu.h >> index 7bc8dff7cf6d..5cdd3d41b87b 100644 >> --- a/include/linux/iommu.h >> +++ b/include/linux/iommu.h >> @@ -1527,8 +1527,6 @@ struct iommu_sva *iommu_sva_bind_device(struct device *dev, >> struct mm_struct *mm); >> void iommu_sva_unbind_device(struct iommu_sva *handle); >> u32 iommu_sva_get_pasid(struct iommu_sva *handle); >> -struct iommu_domain *iommu_sva_domain_alloc(struct device *dev, >> - struct mm_struct *mm); >> #else >> static inline struct iommu_sva * >> iommu_sva_bind_device(struct device *dev, struct mm_struct *mm) >> @@ -1553,12 +1551,6 @@ static inline u32 mm_get_enqcmd_pasid(struct mm_struct *mm) >> } >> >> static inline void mm_pasid_drop(struct mm_struct *mm) {} >> - >> -static inline struct iommu_domain * >> -iommu_sva_domain_alloc(struct device *dev, struct mm_struct *mm) >> -{ >> - return NULL; >> -} >> #endif /* CONFIG_IOMMU_SVA */ >> >> #ifdef CONFIG_IOMMU_IOPF >> diff --git a/drivers/iommu/iommu-sva.c b/drivers/iommu/iommu-sva.c >> index 18a35e798b72..25e581299226 100644 >> --- a/drivers/iommu/iommu-sva.c >> +++ b/drivers/iommu/iommu-sva.c >> @@ -10,6 +10,8 @@ >> #include "iommu-priv.h" >> >> static DEFINE_MUTEX(iommu_sva_lock); >> +static struct iommu_domain *iommu_sva_domain_alloc(struct device *dev, >> + struct mm_struct *mm); > If we move move iommu_sva_domain_alloc() before iommu_sva_bind_device() then we > can avoid this forward declaration. Yeah, but that means moving 144 lines of code. That's why I went with this approach Best regards, baolu