Linux Documentation
 help / color / mirror / Atom feed
From: "Paluri, PavanKumar" <papaluri@amd.com>
To: Borislav Petkov <bp@alien8.de>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"VanTassell, Eric" <Eric.VanTassell@amd.com>,
	"Lendacky, Thomas" <Thomas.Lendacky@amd.com>,
	"Kalra, Ashish" <Ashish.Kalra@amd.com>,
	"Roth, Michael" <Michael.Roth@amd.com>,
	"H . Peter Anvin" <hpa@zytor.com>,
	Peter Zijlstra <peterz@infradead.org>,
	"Paluri, PavanKumar (Pavan Kumar)" <PavanKumar.Paluri@amd.com>
Subject: Re: [PATCH 1/2] x86, KVM:SVM: Move sev specific parsing into arch/x86/virt/svm
Date: Thu, 29 Aug 2024 10:29:16 -0500	[thread overview]
Message-ID: <385ef968-4b13-9124-1f13-e521992ac0c7@amd.com> (raw)
In-Reply-To: <20240829132438.GCZtB2lqeYpleYk9c4@fat_crate.local>

Hi Boris,

On 8/29/2024 8:24 AM, Borislav Petkov wrote:
> On Thu, Aug 01, 2024 at 03:56:37PM -0500, Pavan Kumar Paluri wrote:
>> +#include <linux/memblock.h>
> 
> What's the idea of adding some random include here?
> 
> Does this file use memblock?
> 
> I don't think so.
> 
> You need to resolve include visibility by including the headers where you need
> them:
> 

Understood, will include *only* those headers that provide me with the
facilities as you mentioned.

> diff --git a/arch/x86/include/asm/sev-common.h b/arch/x86/include/asm/sev-common.h
> index dd302fe49f04..d3e7f97e2a4a 100644
> --- a/arch/x86/include/asm/sev-common.h
> +++ b/arch/x86/include/asm/sev-common.h
> @@ -8,6 +8,9 @@
>  #ifndef __ASM_X86_SEV_COMMON_H
>  #define __ASM_X86_SEV_COMMON_H
>  
> +#include <asm/cache.h>
> +#include <asm/pgtable_types.h>
> +
>  #define GHCB_MSR_INFO_POS		0
>  #define GHCB_DATA_LOW			12
>  #define GHCB_MSR_INFO_MASK		(BIT_ULL(GHCB_DATA_LOW) - 1)
> diff --git a/arch/x86/virt/svm/cmdline.c b/arch/x86/virt/svm/cmdline.c
> index 507549a9c793..f0a532108f49 100644
> --- a/arch/x86/virt/svm/cmdline.c
> +++ b/arch/x86/virt/svm/cmdline.c
> @@ -5,11 +5,8 @@
>   * Copyright (C) 2023 - 2024 Advanced Micro Devices, Inc.
>   *
>   * Author: Michael Roth <michael.roth@amd.com>
> - *
>   */
>  
> -#include <linux/memblock.h>
> -
>  #include <asm/sev.h>
>  
>  struct sev_config sev_cfg;
> 

With the above diff applied, I was observing the following compilation
errors relating to string header:

arch/x86/virt/svm/cmdline.c: In function ‘init_sev_config’:
arch/x86/virt/svm/cmdline.c:20:21: error: implicit declaration of
function ‘strsep’ [-Werror=implicit-function-declaration]
   20 |         while ((s = strsep(&str, ","))) {
      |                     ^~~~~~
arch/x86/virt/svm/cmdline.c:20:19: warning: assignment to ‘char *’ from
‘int’ makes pointer from integer without a cast [-Wint-conversion]
   20 |         while ((s = strsep(&str, ","))) {
      |                   ^
arch/x86/virt/svm/cmdline.c:21:22: error: implicit declaration of
function ‘strcmp’ [-Werror=implicit-function-declaration]
   21 |                 if (!strcmp(s, "debug")) {
      |                      ^~~~~~
arch/x86/virt/svm/cmdline.c:13:1: note: include ‘<string.h>’ or provide
a declaration of ‘strcmp’
   12 | #include <asm/sev.h>
  +++ |+#include <string.h>
   13 |
arch/x86/virt/svm/cmdline.c:26:17: error: implicit declaration of
function ‘pr_info’ [-Werror=implicit-function-declaration]
   26 |                 pr_info("SEV command-line option '%s' was not
recognized\n", s);
      |                 ^~~~~~~

So here's the updated diff (for patch #1) that is compile-tested:

diff --git a/arch/x86/include/asm/sev-common.h
b/arch/x86/include/asm/sev-common.h
index dd302fe49f04..d3e7f97e2a4a 100644
--- a/arch/x86/include/asm/sev-common.h
+++ b/arch/x86/include/asm/sev-common.h
@@ -8,6 +8,9 @@
 #ifndef __ASM_X86_SEV_COMMON_H
 #define __ASM_X86_SEV_COMMON_H

+#include <asm/cache.h>
+#include <asm/pgtable_types.h>
+
 #define GHCB_MSR_INFO_POS              0
 #define GHCB_DATA_LOW                  12
 #define GHCB_MSR_INFO_MASK             (BIT_ULL(GHCB_DATA_LOW) - 1)
diff --git a/arch/x86/virt/svm/cmdline.c b/arch/x86/virt/svm/cmdline.c
index 507549a9c793..be3504a601c0 100644
--- a/arch/x86/virt/svm/cmdline.c
+++ b/arch/x86/virt/svm/cmdline.c
@@ -5,10 +5,9 @@
  * Copyright (C) 2023 - 2024 Advanced Micro Devices, Inc.
  *
  * Author: Michael Roth <michael.roth@amd.com>
- *
  */

-#include <linux/memblock.h>
+#include <linux/string.h>

 #include <asm/sev.h>


And for Patch #2, here's the diff:

diff --git a/arch/x86/virt/svm/cmdline.c b/arch/x86/virt/svm/cmdline.c
index 9cec2c2fb67c..5880df8027e6 100644
--- a/arch/x86/virt/svm/cmdline.c
+++ b/arch/x86/virt/svm/cmdline.c
@@ -8,6 +8,7 @@
  */

 #include <linux/string.h>
+#include <asm/cpufeature.h>

 #include <asm/sev.h>

If these changes look good to you, I will send a v2 incorporating the
changes.

Thanks for the review,
Pavan



  parent reply	other threads:[~2024-08-29 15:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-01 20:56 [PATCH 0/2] "nosnp" sev command line support Pavan Kumar Paluri
2024-08-01 20:56 ` [PATCH 1/2] x86, KVM:SVM: Move sev specific parsing into arch/x86/virt/svm Pavan Kumar Paluri
2024-08-02 14:18   ` Tom Lendacky
2024-08-29 13:24   ` Borislav Petkov
2024-08-29 14:22     ` Borislav Petkov
2024-08-29 15:29     ` Paluri, PavanKumar [this message]
2024-08-29 15:41       ` Borislav Petkov
2024-08-29 15:53         ` Paluri, PavanKumar
2024-08-01 20:56 ` [PATCH 2/2] x86 KVM:SVM: Provide "nosnp" boot option for sev kernel command line Pavan Kumar Paluri
2024-08-02 14:19   ` Tom Lendacky
2024-08-01 20:58 ` [PATCH 0/2] "nosnp" sev command line support Matthew Wilcox
2024-08-01 22:23   ` Paluri, PavanKumar
2024-08-01 22:39     ` Matthew Wilcox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=385ef968-4b13-9124-1f13-e521992ac0c7@amd.com \
    --to=papaluri@amd.com \
    --cc=Ashish.Kalra@amd.com \
    --cc=Eric.VanTassell@amd.com \
    --cc=Michael.Roth@amd.com \
    --cc=PavanKumar.Paluri@amd.com \
    --cc=Thomas.Lendacky@amd.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox