mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tom Lendacky <thomas.lendacky@amd.com>
To: Sean Christopherson <seanjc@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Andy Lutomirski <luto@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Borislav Petkov <bp@suse.de>,
	Brijesh Singh <brijesh.singh@amd.com>
Subject: Re: [PATCH 06/13] x86/sev: Rename global "sev_enabled" flag to "sev_guest"
Date: Mon, 11 Jan 2021 10:47:23 -0600	[thread overview]
Message-ID: <5b3a5d5e-befe-8be2-bbc4-7e7a8ebbe316@amd.com> (raw)
In-Reply-To: <f6ed8566-6521-92f0-927e-1764d8074ce6@amd.com>

On 1/11/21 10:02 AM, Tom Lendacky wrote:
> On 1/8/21 6:47 PM, Sean Christopherson wrote:
>> Use "guest" instead of "enabled" for the global "running as an SEV guest"
>> flag to avoid confusion over whether "sev_enabled" refers to the guest or
>> the host.  This will also allow KVM to usurp "sev_enabled" for its own
>> purposes.
>>
>> No functional change intended.
>>
>> Signed-off-by: Sean Christopherson <seanjc@google.com>
> 
> Acked-by: Tom Lendacky <thomas.lendacky@amd.com>

Ah, I tried building with CONFIG_KVM=y and CONFIG_KVM_AMD=y and got a 
build error:

In file included from arch/x86/kvm/svm/svm.c:43:
arch/x86/kvm/svm/svm.h:222:20: error: ‘sev_guest’ redeclared as different 
kind of symbol
   222 | static inline bool sev_guest(struct kvm *kvm)
       |                    ^~~~~~~~~
In file included from ./include/linux/mem_encrypt.h:17,
                  from ./arch/x86/include/asm/page_types.h:7,
                  from ./arch/x86/include/asm/page.h:9,
                  from ./arch/x86/include/asm/thread_info.h:12,
                  from ./include/linux/thread_info.h:38,
                  from ./arch/x86/include/asm/preempt.h:7,
                  from ./include/linux/preempt.h:78,
                  from ./include/linux/percpu.h:6,
                  from ./include/linux/context_tracking_state.h:5,
                  from ./include/linux/hardirq.h:5,
                  from ./include/linux/kvm_host.h:7,
                  from arch/x86/kvm/svm/svm.c:3:
./arch/x86/include/asm/mem_encrypt.h:23:13: note: previous declaration of 
‘sev_guest’ was here
    23 | extern bool sev_guest;
       |             ^~~~~~~~~

Thanks,
Tom

> 
>> ---
>>   arch/x86/include/asm/mem_encrypt.h | 2 +-
>>   arch/x86/mm/mem_encrypt.c          | 4 ++--
>>   arch/x86/mm/mem_encrypt_identity.c | 2 +-
>>   3 files changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/x86/include/asm/mem_encrypt.h 
>> b/arch/x86/include/asm/mem_encrypt.h
>> index 2f62bbdd9d12..9b3990928674 100644
>> --- a/arch/x86/include/asm/mem_encrypt.h
>> +++ b/arch/x86/include/asm/mem_encrypt.h
>> @@ -20,7 +20,7 @@
>>   extern u64 sme_me_mask;
>>   extern u64 sev_status;
>> -extern bool sev_enabled;
>> +extern bool sev_guest;
>>   void sme_encrypt_execute(unsigned long encrypted_kernel_vaddr,
>>                unsigned long decrypted_kernel_vaddr,
>> diff --git a/arch/x86/mm/mem_encrypt.c b/arch/x86/mm/mem_encrypt.c
>> index bc0833713be9..0f798355de03 100644
>> --- a/arch/x86/mm/mem_encrypt.c
>> +++ b/arch/x86/mm/mem_encrypt.c
>> @@ -44,7 +44,7 @@ EXPORT_SYMBOL(sme_me_mask);
>>   DEFINE_STATIC_KEY_FALSE(sev_enable_key);
>>   EXPORT_SYMBOL_GPL(sev_enable_key);
>> -bool sev_enabled __section(".data");
>> +bool sev_guest __section(".data");
>>   /* Buffer used for early in-place encryption by BSP, no locking needed */
>>   static char sme_early_buffer[PAGE_SIZE] __initdata __aligned(PAGE_SIZE);
>> @@ -344,7 +344,7 @@ int __init early_set_memory_encrypted(unsigned long 
>> vaddr, unsigned long size)
>>    */
>>   bool sme_active(void)
>>   {
>> -    return sme_me_mask && !sev_enabled;
>> +    return sme_me_mask && !sev_guest;
>>   }
>>   bool sev_active(void)
>> diff --git a/arch/x86/mm/mem_encrypt_identity.c 
>> b/arch/x86/mm/mem_encrypt_identity.c
>> index 6c5eb6f3f14f..91b6b899c02b 100644
>> --- a/arch/x86/mm/mem_encrypt_identity.c
>> +++ b/arch/x86/mm/mem_encrypt_identity.c
>> @@ -545,7 +545,7 @@ void __init sme_enable(struct boot_params *bp)
>>           /* SEV state cannot be controlled by a command line option */
>>           sme_me_mask = me_mask;
>> -        sev_enabled = true;
>> +        sev_guest = true;
>>           physical_mask &= ~sme_me_mask;
>>           return;
>>       }
>>

  reply	other threads:[~2021-01-11 16:48 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-09  0:47 [PATCH 00/13] KVM: SVM: Misc SEV cleanups Sean Christopherson
2021-01-09  0:47 ` [PATCH 01/13] KVM: SVM: Free sev_asid_bitmap during init if SEV setup fails Sean Christopherson
2021-01-11 14:42   ` Tom Lendacky
2021-01-11 18:07     ` Sean Christopherson
2021-01-09  0:47 ` [PATCH 02/13] KVM: SVM: Zero out the VMCB array used to track SEV ASID association Sean Christopherson
2021-01-09  0:47 ` [PATCH 03/13] KVM: SVM: Move SEV module params/variables to sev.c Sean Christopherson
2021-01-11 10:42   ` Vitaly Kuznetsov
2021-01-11 15:36     ` Tom Lendacky
2021-01-11 16:58       ` Vitaly Kuznetsov
2021-01-12 22:18         ` Sean Christopherson
2021-01-11 15:30   ` Tom Lendacky
2021-01-09  0:47 ` [PATCH 04/13] x86/cpufeatures: Assign dedicated feature word for AMD mem encryption Sean Christopherson
2021-01-09  0:47 ` [PATCH 05/13] KVM: x86: Override reported SME/SEV feature flags with host mask Sean Christopherson
2021-01-09  0:47 ` [PATCH 06/13] x86/sev: Rename global "sev_enabled" flag to "sev_guest" Sean Christopherson
2021-01-11 16:02   ` Tom Lendacky
2021-01-11 16:47     ` Tom Lendacky [this message]
2021-01-11 17:58       ` Sean Christopherson
2021-01-11 20:28         ` Sean Christopherson
2021-01-09  0:47 ` [PATCH 07/13] KVM: SVM: Append "_enabled" to module-scoped SEV/SEV-ES control variables Sean Christopherson
2021-01-11 16:03   ` Tom Lendacky
2021-01-09  0:47 ` [PATCH 08/13] KVM: SVM: Unconditionally invoke sev_hardware_teardown() Sean Christopherson
2021-01-09  0:47 ` [PATCH 09/13] KVM: SVM: Explicitly check max SEV ASID during sev_hardware_setup() Sean Christopherson
2021-01-09  0:47 ` [PATCH 10/13] KVM: SVM: Move SEV VMCB tracking allocation to sev.c Sean Christopherson
2021-01-09  0:47 ` [PATCH 11/13] KVM: SVM: Drop redundant svm_sev_enabled() helper Sean Christopherson
2021-01-11 17:57   ` Tom Lendacky
2021-01-11 20:59     ` Sean Christopherson
2021-01-09  0:47 ` [PATCH 12/13] KVM: SVM: Remove an unnecessary prototype declaration of sev_flush_asids() Sean Christopherson
2021-01-09  0:47 ` [PATCH 13/13] KVM: SVM: Skip SEV cache flush if no ASIDs have been used Sean Christopherson

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=5b3a5d5e-befe-8be2-bbc4-7e7a8ebbe316@amd.com \
    --to=thomas.lendacky@amd.com \
    --cc=bp@suse.de \
    --cc=brijesh.singh@amd.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=seanjc@google.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    /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

all inboxes | Powered by JetHome®