KVM: SVM: Reserve ASID range for SEV guest

"Linux Kernel Mailing List" <[email protected]> Sat, 10 Feb 2018 22:00:20 +0000 (UTC)
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/ed3cd233f8074015e164547abfcdd4678fd10bb4
Commit:     ed3cd233f8074015e164547abfcdd4678fd10bb4
Parent:     5dd0a57cf38eeb8b6be1d9c3df9add2f5756d974
Refname:    refs/heads/master
Author:     Brijesh Singh <[email protected]>
AuthorDate: Mon Dec 4 10:57:32 2017 -0600
Committer:  Brijesh Singh <[email protected]>
CommitDate: Mon Dec 4 10:57:32 2017 -0600

    KVM: SVM: Reserve ASID range for SEV guest
    
    A SEV-enabled guest must use ASIDs from the defined subset, while non-SEV
    guests can use the remaining ASID range. The range of allowed SEV guest
    ASIDs is [1 - CPUID_8000_001F[ECX][31:0]].
    
    Cc: Thomas Gleixner <[email protected]>
    Cc: Ingo Molnar <[email protected]>
    Cc: "H. Peter Anvin" <[email protected]>
    Cc: Paolo Bonzini <[email protected]>
    Cc: "Radim Krčmář" <[email protected]>
    Cc: Joerg Roedel <[email protected]>
    Cc: Borislav Petkov <[email protected]>
    Cc: Tom Lendacky <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Cc: [email protected]
    Improvements-by: Borislav Petkov <[email protected]>
    Signed-off-by: Brijesh Singh <[email protected]>
    Reviewed-by: Borislav Petkov <[email protected]>
---
 arch/x86/kvm/svm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 7e302a25bc45..bff7ce727a78 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -319,6 +319,8 @@ enum {
 
 #define VMCB_AVIC_APIC_BAR_MASK		0xFFFFFFFFFF000ULL
 
+static unsigned int max_sev_asid;
+
 static inline void mark_all_dirty(struct vmcb *vmcb)
 {
 	vmcb->control.clean = 0;
@@ -783,7 +785,7 @@ static int svm_hardware_enable(void)
 	sd->asid_generation = 1;
 	sd->max_asid = cpuid_ebx(SVM_CPUID_FUNC) - 1;
 	sd->next_asid = sd->max_asid + 1;
-	sd->min_asid = 1;
+	sd->min_asid = max_sev_asid + 1;
 
 	gdt = get_current_gdt_rw();
 	sd->tss_desc = (struct kvm_ldttss_desc *)(gdt + GDT_ENTRY_TSS);
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html