Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp872398pxb; Sat, 10 Apr 2021 23:43:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaf/lx8+2ibEKTsW9MYqtefeZY4yogyFg9irjQ9AWc755lR56tTQGukkN86175bISfmctM X-Received: by 2002:a63:e044:: with SMTP id n4mr10191347pgj.47.1618123399735; Sat, 10 Apr 2021 23:43:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618123399; cv=none; d=google.com; s=arc-20160816; b=RBofMxN9nhuAEQ07pYxy3VSjaNyjDYncBWpkxs9S0IUc3rcb2JMzwHeX8Zixc6cAGT mx6vVz85kLVRhUUaHwnau2naJ4alxVosxvqfRbz6xQk9UVNc+LQWnujtLTFEZK5f2n3C CB8DTIkyFPh7whrb+ecCpk2bjeCYDie9jNR6zIVWK/H6BMk4IlGHxItqs04GHAXZoC3m QCyunXvnlAduMeP3VrC0owxq6cTZ95tM/0ASRkFC4wvYImHsZZyna8Ssj+aZw+bZiP3x ouyDFo7trqC9t0u7iyxuhzBDRdyBFWzCx1G/daaXGAwl/lu99JI1OWx+HPpOk5MTd3BE vUgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=acFKTT6j+VIJs5Iv9WmiwQ+Ih1xaWJpjPGlz3k/Bpuc=; b=NRnHg5f1VyudcyWeVydA3DXSLEXW267dStkLchj6rgn0u5VmZxkMZFAPetEt6TFBOK Nv6HbOcgbLPIYWPui89xxMh26QJ0rEujZLLjMP1Z3aA2RmxNfl8QsvKstZgHZZQ3PsAp 5T1Ar/A+4fSvb+TRu0x3py46Au4GXiwU60lqUU6hf0KwSmdyOAHP1IMAq7QOIiPrvVhF PRl7Zo0ShxYPkmb1nXb24APvI3MRmmQ+wF1NX7/UwKpLiYAJiR6j6JZ8MlLcvmRDb9B2 TaFUdd4DMlMd9uCBDffuuk/CA8Kylp3VVkREfUXZ9qfPGIyBmKm4deFH56Fii/OeGQMT JACQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=WCUkIBI9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y14si4668839plh.112.2021.04.10.23.43.07; Sat, 10 Apr 2021 23:43:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=WCUkIBI9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235012AbhDKGlW (ORCPT + 99 others); Sun, 11 Apr 2021 02:41:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229452AbhDKGlT (ORCPT ); Sun, 11 Apr 2021 02:41:19 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 023DFC061574 for ; Sat, 10 Apr 2021 23:41:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description; bh=acFKTT6j+VIJs5Iv9WmiwQ+Ih1xaWJpjPGlz3k/Bpuc=; b=WCUkIBI9Ib2tmGjLv1koAFK6xW wnmntCyQWuznBzTiEY5H18tqoRToqfsAJefuz3l+tVWdmuLf1GCa4oDJenwVYdx9GIklbM2naDP0v YmG1/hObiuIByileOSBUu2aj1+pUyjtIE2eUgLiOr+9ltXjjyFgcuHO3DCoG6dI+MceYy3rwP2dGM HfwmeYA9xZW6xWZD0W4qgqTdWq2z+GG58iU6mH0OKY5pzIq8HdxVpI1VA3ZsS5u09MNFz8X2OgYQm bc4lFqMX11kJ9A3RqZ/YD0qPhlyYnte5Xw1xKb6VpzNlk32C4ic7VaG/IQGCHnzCT9Zp8DkPEvw19 S4RDhfgg==; Received: from [2601:1c0:6280:3f0::e0e1] by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lVTm4-002ets-4l; Sun, 11 Apr 2021 06:40:49 +0000 Subject: Re: [PATCH 1/1] iommu/vt-d: Fix build error of pasid_enable_wpe() with !X86 To: Lu Baolu , Joerg Roedel , Will Deacon Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Sanjay Kumar , Jacob Pan , kernel test robot References: <20210411062312.3057579-1-baolu.lu@linux.intel.com> From: Randy Dunlap Message-ID: <6a36c635-5f88-6264-e9c8-62ea6c5d771e@infradead.org> Date: Sat, 10 Apr 2021 23:40:45 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <20210411062312.3057579-1-baolu.lu@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/10/21 11:23 PM, Lu Baolu wrote: > Commit f68c7f539b6e9 ("iommu/vt-d: Enable write protect for supervisor > SVM") added pasid_enable_wpe() which hit below compile error with !X86. > > ../drivers/iommu/intel/pasid.c: In function 'pasid_enable_wpe': > ../drivers/iommu/intel/pasid.c:554:22: error: implicit declaration of function 'read_cr0' [-Werror=implicit-function-declaration] > 554 | unsigned long cr0 = read_cr0(); > | ^~~~~~~~ > In file included from ../include/linux/build_bug.h:5, > from ../include/linux/bits.h:22, > from ../include/linux/bitops.h:6, > from ../drivers/iommu/intel/pasid.c:12: > ../drivers/iommu/intel/pasid.c:557:23: error: 'X86_CR0_WP' undeclared (first use in this function) > 557 | if (unlikely(!(cr0 & X86_CR0_WP))) { > | ^~~~~~~~~~ > ../include/linux/compiler.h:78:42: note: in definition of macro 'unlikely' > 78 | # define unlikely(x) __builtin_expect(!!(x), 0) > | ^ > ../drivers/iommu/intel/pasid.c:557:23: note: each undeclared identifier is reported only once for each function it appears in > 557 | if (unlikely(!(cr0 & X86_CR0_WP))) { > | ^~~~~~~~~~ > ../include/linux/compiler.h:78:42: note: in definition of macro 'unlikely' > 78 | # define unlikely(x) __builtin_expect(!!(x), 0) > | > > Add the missing dependency. > > Cc: Sanjay Kumar > Cc: Jacob Pan > Cc: Randy Dunlap > Reported-by: kernel test robot > Reported-by: Randy Dunlap > Fixes: f68c7f539b6e9 ("iommu/vt-d: Enable write protect for supervisor SVM") > Signed-off-by: Lu Baolu Acked-by: Randy Dunlap # build-tested Thanks. > --- > drivers/iommu/intel/pasid.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/iommu/intel/pasid.c b/drivers/iommu/intel/pasid.c > index 477b2e1d303c..72646bafc52f 100644 > --- a/drivers/iommu/intel/pasid.c > +++ b/drivers/iommu/intel/pasid.c > @@ -551,6 +551,7 @@ static void pasid_flush_caches(struct intel_iommu *iommu, > > static inline int pasid_enable_wpe(struct pasid_entry *pte) > { > +#ifdef CONFIG_X86 > unsigned long cr0 = read_cr0(); > > /* CR0.WP is normally set but just to be sure */ > @@ -558,6 +559,7 @@ static inline int pasid_enable_wpe(struct pasid_entry *pte) > pr_err_ratelimited("No CPU write protect!\n"); > return -EINVAL; > } > +#endif > pasid_set_wpe(pte); > > return 0; > -- ~Randy