Skip to content

Commit 0d3518d

Browse files
mzhang3579sean-jc
authored andcommitted
KVM: SVM: Remove TSS reloading code after VMEXIT
Remove the dedicated post-VMEXIT TSS reloading code now that KVM uses VMLOAD to load host segment state, which includes TSS state. Fixes: e79b91b ("KVM: SVM: use vmsave/vmload for saving/restoring additional host state") Reported-by: Venkatesh Srinivas <venkateshs@google.com> Suggested-by: Jim Mattson <jmattson@google.com> Signed-off-by: Mingwei Zhang <mizhang@google.com> Link: https://lore.kernel.org/r/20230523165635.4002711-1-mizhang@google.com [sean: massage changelog] Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent b9846a6 commit 0d3518d

File tree

2 files changed

+0
-25
lines changed

2 files changed

+0
-25
lines changed

arch/x86/kvm/svm/svm.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,6 @@ static u8 rsm_ins_bytes[] = "\x0f\xaa";
244244

245245
static unsigned long iopm_base;
246246

247-
struct kvm_ldttss_desc {
248-
u16 limit0;
249-
u16 base0;
250-
unsigned base1:8, type:5, dpl:2, p:1;
251-
unsigned limit1:4, zero0:3, g:1, base2:8;
252-
u32 base3;
253-
u32 zero1;
254-
} __attribute__((packed));
255-
256247
DEFINE_PER_CPU(struct svm_cpu_data, svm_data);
257248

258249
/*
@@ -588,7 +579,6 @@ static int svm_hardware_enable(void)
588579

589580
struct svm_cpu_data *sd;
590581
uint64_t efer;
591-
struct desc_struct *gdt;
592582
int me = raw_smp_processor_id();
593583

594584
rdmsrl(MSR_EFER, efer);
@@ -601,9 +591,6 @@ static int svm_hardware_enable(void)
601591
sd->next_asid = sd->max_asid + 1;
602592
sd->min_asid = max_sev_asid + 1;
603593

604-
gdt = get_current_gdt_rw();
605-
sd->tss_desc = (struct kvm_ldttss_desc *)(gdt + GDT_ENTRY_TSS);
606-
607594
wrmsrl(MSR_EFER, efer | EFER_SVME);
608595

609596
wrmsrl(MSR_VM_HSAVE_PA, sd->save_area_pa);
@@ -3457,14 +3444,6 @@ static int svm_handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath)
34573444
return svm_invoke_exit_handler(vcpu, exit_code);
34583445
}
34593446

3460-
static void reload_tss(struct kvm_vcpu *vcpu)
3461-
{
3462-
struct svm_cpu_data *sd = per_cpu_ptr(&svm_data, vcpu->cpu);
3463-
3464-
sd->tss_desc->type = 9; /* available 32/64-bit TSS */
3465-
load_TR_desc();
3466-
}
3467-
34683447
static void pre_svm_run(struct kvm_vcpu *vcpu)
34693448
{
34703449
struct svm_cpu_data *sd = per_cpu_ptr(&svm_data, vcpu->cpu);
@@ -4099,9 +4078,6 @@ static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu)
40994078

41004079
svm_vcpu_enter_exit(vcpu, spec_ctrl_intercepted);
41014080

4102-
if (!sev_es_guest(vcpu->kvm))
4103-
reload_tss(vcpu);
4104-
41054081
if (!static_cpu_has(X86_FEATURE_V_SPEC_CTRL))
41064082
x86_spec_ctrl_restore_host(svm->virt_spec_ctrl);
41074083

arch/x86/kvm/svm/svm.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@ struct svm_cpu_data {
303303
u32 max_asid;
304304
u32 next_asid;
305305
u32 min_asid;
306-
struct kvm_ldttss_desc *tss_desc;
307306

308307
struct page *save_area;
309308
unsigned long save_area_pa;

0 commit comments

Comments
 (0)