From: Borislav Petkov <bp@alien8.de>
To: Alexey Kardashevskiy <aik@amd.com>
Cc: Sean Christopherson <seanjc@google.com>,
kvm@vger.kernel.org, x86@kernel.org,
linux-kernel@vger.kernel.org,
Venu Busireddy <venu.busireddy@oracle.com>,
Tony Luck <tony.luck@intel.com>,
Tom Lendacky <thomas.lendacky@amd.com>,
Thomas Gleixner <tglx@linutronix.de>,
Peter Zijlstra <peterz@infradead.org>,
Paolo Bonzini <pbonzini@redhat.com>,
Michael Sterritt <sterritt@google.com>,
Michael Roth <michael.roth@amd.com>,
Mario Limonciello <mario.limonciello@amd.com>,
Ingo Molnar <mingo@redhat.com>,
Heiko Carstens <hca@linux.ibm.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Dave Hansen <dave.hansen@linux.intel.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
"Jason A. Donenfeld" <Jason@zx2c4.com>,
"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH kernel 3/3] x86/sev: Do not handle #VC for DR7 read/write
Date: Thu, 8 Dec 2022 12:01:21 +0100 [thread overview]
Message-ID: <Y5HEAYjUorpZJGl+@zn.tnic> (raw)
In-Reply-To: <ac5d066e-5c61-7afe-b496-8254633c24d1@amd.com>
On Thu, Dec 08, 2022 at 06:14:01PM +1100, Alexey Kardashevskiy wrote:
> Sorry, I am not following. How is moving the bit makes
> SEV_STATUS_TO_FEATURES() not needed?
>
> When I am setting it in VMSA SEV_FEATURES - it is a bit 5.
>
> Inside a SEV VM, it is SEV_STATUS MSR and there it is bit 7. Mentioned
> MSR_AMD64_SEV* are SEV_STATUS MSR bits.
>
> Since the current patch is bad, I'd rather define the bit twice then:
Yes.
> arch/x86/include/asm/msr-index.h:
> #define MSR_AMD64_SEV_FEAT_DEBUG_SWAP BIT_ULL(7)
>
> arch/x86/include/asm/svm.h
> #define SVM_SEV_FEAT_DEBUG_SWAP BIT(5)
>
> as nothing really says that SEV_FEATURES is always going to be
> SEV_STATUS>>2, even though it is now.
>
> Soooo what is acceptable solution here? Thanks,
Right, so since you're testing against sev_status which is a copy of
MSR_AMD64_SEV, then you use bit definitions which are for that MSR as
documented in the respective PPR section for "MSRC001_0131 [SEV Status]
(Core::X86::Msr::SEV_Status)"
When you're setting the VMSA's SEV_FEATURES field, then you need a
different define, ofc.
This also automatically takes care of SEV_FEATURES not being tied to
SEV_STATUS >> 2 forever, as you say.
So yes, do the twice thing.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
prev parent reply other threads:[~2022-12-08 11:04 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-01 2:19 [PATCH kernel 0/3] KVM: SEV: Enable AMD SEV-ES DebugSwap Alexey Kardashevskiy
2022-12-01 2:19 ` [PATCH kernel 1/3] x86/amd/dr_addr_mask: Cache values in percpu variables Alexey Kardashevskiy
2022-12-01 16:58 ` Sean Christopherson
2022-12-01 19:45 ` Andrew Cooper
2022-12-06 7:14 ` Alexey Kardashevskiy
2022-12-06 17:07 ` Sean Christopherson
2022-12-07 0:50 ` Alexey Kardashevskiy
2022-12-07 18:55 ` Borislav Petkov
2022-12-08 6:11 ` Alexey Kardashevskiy
2022-12-08 10:35 ` Borislav Petkov
2022-12-01 2:19 ` [PATCH kernel 2/3] KVM: SEV: Enable DebugSwap Alexey Kardashevskiy
2022-12-01 17:37 ` Sean Christopherson
2022-12-09 2:28 ` Alexey Kardashevskiy
2022-12-01 2:19 ` [PATCH kernel 3/3] x86/sev: Do not handle #VC for DR7 read/write Alexey Kardashevskiy
2022-12-01 17:38 ` Sean Christopherson
2022-12-07 19:01 ` Borislav Petkov
2022-12-07 19:07 ` Sean Christopherson
2022-12-08 7:14 ` Alexey Kardashevskiy
2022-12-08 11:01 ` Borislav Petkov [this message]
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=Y5HEAYjUorpZJGl+@zn.tnic \
--to=bp@alien8.de \
--cc=Jason@zx2c4.com \
--cc=aik@amd.com \
--cc=andrew.cooper3@citrix.com \
--cc=dave.hansen@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=hca@linux.ibm.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=michael.roth@amd.com \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=seanjc@google.com \
--cc=sterritt@google.com \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=tony.luck@intel.com \
--cc=venu.busireddy@oracle.com \
--cc=x86@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).