linux-stable/arch/x86/kvm
Ashish Kalra 4af6d5b4d9 KVM: SVM: Add support for allowing zero SEV ASIDs
[ Upstream commit 0aa6b90ef9 ]

Some BIOSes allow the end user to set the minimum SEV ASID value
(CPUID 0x8000001F_EDX) to be greater than the maximum number of
encrypted guests, or maximum SEV ASID value (CPUID 0x8000001F_ECX)
in order to dedicate all the SEV ASIDs to SEV-ES or SEV-SNP.

The SEV support, as coded, does not handle the case where the minimum
SEV ASID value can be greater than the maximum SEV ASID value.
As a result, the following confusing message is issued:

[   30.715724] kvm_amd: SEV enabled (ASIDs 1007 - 1006)

Fix the support to properly handle this case.

Fixes: 916391a2d1 ("KVM: SVM: Add support for SEV-ES capability in KVM")
Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>
Cc: stable@vger.kernel.org
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
Link: https://lore.kernel.org/r/20240104190520.62510-1-Ashish.Kalra@amd.com
Link: https://lore.kernel.org/r/20240131235609.4161407-4-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-04-10 16:28:30 +02:00
..
mmu KVM: x86/mmu: Stop zapping invalidated TDP MMU roots asynchronously 2023-10-25 12:03:14 +02:00
svm KVM: SVM: Add support for allowing zero SEV ASIDs 2024-04-10 16:28:30 +02:00
vmx KVM/VMX: Move VERW closer to VMentry for MDS mitigation 2024-03-06 14:45:20 +00:00
.gitignore KVM: x86: use a separate asm-offsets.c file 2022-11-09 12:10:17 -05:00
Kconfig KVM: x86: Select CONFIG_HAVE_KVM_DIRTY_RING_ACQ_REL 2022-09-29 10:23:08 +01:00
Makefile KVM: SVM: replace regs argument of __svm_vcpu_run() with vcpu_svm 2022-11-09 12:16:34 -05:00
cpuid.c KVM: x86: Advertise CPUID.(EAX=7,ECX=2):EDX[5:0] to userspace 2024-04-03 15:19:23 +02:00
cpuid.h KVM: x86: Add dedicated helper to get CPUID entry with significant index 2022-07-14 11:38:32 -04:00
debugfs.c KVM: x86: Reduce refcount if single_open() fails in kvm_mmu_rmaps_stat_open() 2022-10-27 04:41:54 -04:00
emulate.c KVM: x86: smm: number of GPRs in the SMRAM image depends on the image format 2022-10-28 06:10:30 -04:00
fpu.h
hyperv.c KVM: x86: hyper-v: Don't auto-enable stimer on write from user-space 2023-11-28 17:07:08 +00:00
hyperv.h KVM: x86: Report error when setting CPUID if Hyper-V allocation fails 2022-09-26 12:02:39 -04:00
i8254.c KVM: x86: PIT: Preserve state of speaker port data bit 2022-06-08 13:06:20 -04:00
i8254.h KVM: x86: PIT: Preserve state of speaker port data bit 2022-06-08 13:06:20 -04:00
i8259.c KVM: x86/i8259: Remove a dead store of irq in a conditional block 2022-04-02 05:41:19 -04:00
ioapic.c KVM: x86/ioapic: Remove unused "addr" and "length" of ioapic_read_indirect() 2022-02-10 13:47:13 -05:00
ioapic.h
irq.c KVM: x86/xen: handle PV timers oneshot mode 2022-04-02 05:41:16 -04:00
irq.h
irq_comm.c KVM: x86/xen: Make kvm_xen_set_evtchn() reusable from other places 2022-04-02 05:41:14 -04:00
kvm-asm-offsets.c KVM: SVM: move MSR_IA32_SPEC_CTRL save/restore to assembly 2022-11-09 12:25:53 -05:00
kvm_cache_regs.h KVM: VMX: Make CR0.WP a guest owned bit 2023-05-17 11:53:29 +02:00
kvm_emulate.h KVM: x86: Bug the VM if the emulator accesses a non-existent GPR 2022-06-10 10:01:33 -04:00
kvm_onhyperv.c KVM: x86: Uninline and export hv_track_root_tdp() 2022-02-10 13:47:19 -05:00
kvm_onhyperv.h KVM: SVM: Flush Hyper-V TLB when required 2023-04-20 12:35:12 +02:00
lapic.c KVM: x86/xen: inject vCPU upcall vector when local APIC is enabled 2024-04-03 15:19:30 +02:00
lapic.h KVM: x86: Rename kvm_apic_has_events() to make it INIT/SIPI specific 2022-09-26 12:37:18 -04:00
mmu.h KVM: x86/mmu: Refresh CR0.WP prior to checking for emulated permission faults 2023-05-17 11:53:30 +02:00
mtrr.c
pmu.c KVM: x86: Make use of kvm_read_cr*_bits() when testing bits 2023-05-17 11:53:29 +02:00
pmu.h KVM: x86/pmu: Truncate counter value to allowed width on write 2023-11-02 09:35:21 +01:00
reverse_cpuid.h x86/cpufeatures: Add CPUID_LNX_5 to track recently added Linux-defined word 2024-04-10 16:28:24 +02:00
trace.h KVM: SVM: Use unsigned integers when dealing with ASIDs 2024-04-10 16:28:30 +02:00
tss.h
x86.c KVM: x86: Mark target gfn of emulated atomic instruction as dirty 2024-04-03 15:19:40 +02:00
x86.h KVM: x86: Track supported PERF_CAPABILITIES in kvm_caps 2023-05-17 11:53:27 +02:00
xen.c KVM: x86/xen: inject vCPU upcall vector when local APIC is enabled 2024-04-03 15:19:30 +02:00
xen.h KVM: x86/xen: inject vCPU upcall vector when local APIC is enabled 2024-04-03 15:19:30 +02:00