update submodule and patches to Proxmox-5.15.102-1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
4ca240afd7
commit
3917b25d81
1
debian/rules
vendored
1
debian/rules
vendored
@ -85,6 +85,7 @@ PVE_CONFIG_OPTS= \
|
||||
-d CONFIG_SECURITY_LOCKDOWN_LSM \
|
||||
-d CONFIG_SECURITY_LOCKDOWN_LSM_EARLY \
|
||||
--set-str CONFIG_LSM yama,integrity,apparmor \
|
||||
-d MICROCODE_LATE_LOADING \
|
||||
-e CONFIG_PAGE_TABLE_ISOLATION
|
||||
|
||||
debian/control: $(wildcard debian/*.in)
|
||||
|
@ -75,7 +75,7 @@ index b5272568a8f3..f1ef6820d39e 100644
|
||||
Safety option to keep boot IRQs enabled. This
|
||||
should never be necessary.
|
||||
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
|
||||
index 153bce71e35b..d573392879f8 100644
|
||||
index 07a187a67982..d0ab14a33378 100644
|
||||
--- a/drivers/pci/quirks.c
|
||||
+++ b/drivers/pci/quirks.c
|
||||
@@ -193,6 +193,106 @@ static int __init pci_apply_final_quirks(void)
|
||||
@ -185,7 +185,7 @@ index 153bce71e35b..d573392879f8 100644
|
||||
/*
|
||||
* Decoding should be disabled for a PCI device during BAR sizing to avoid
|
||||
* conflict. But doing so may cause problems on host bridge and perhaps other
|
||||
@@ -4927,6 +5027,8 @@ static const struct pci_dev_acs_enabled {
|
||||
@@ -4947,6 +5047,8 @@ static const struct pci_dev_acs_enabled {
|
||||
{ PCI_VENDOR_ID_CAVIUM, 0xA060, pci_quirk_mf_endpoint_acs },
|
||||
/* APM X-Gene */
|
||||
{ PCI_VENDOR_ID_AMCC, 0xE004, pci_quirk_xgene_acs },
|
||||
|
@ -10,10 +10,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/net/core/dev.c b/net/core/dev.c
|
||||
index 33d6b691e15e..63b7014ec88a 100644
|
||||
index 7fc8ae7f3cd5..27cd902b6fbb 100644
|
||||
--- a/net/core/dev.c
|
||||
+++ b/net/core/dev.c
|
||||
@@ -10530,7 +10530,7 @@ static void netdev_wait_allrefs(struct net_device *dev)
|
||||
@@ -10532,7 +10532,7 @@ static void netdev_wait_allrefs(struct net_device *dev)
|
||||
if (refcnt != 1 &&
|
||||
time_after(jiffies, warning_time +
|
||||
netdev_unregister_timeout_secs * HZ)) {
|
||||
|
@ -22,7 +22,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||
4 files changed, 8 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
|
||||
index ce5858dadca5..aa43ed94deb6 100644
|
||||
index 3ee4c1217b63..0e15a9345966 100644
|
||||
--- a/block/blk-cgroup.c
|
||||
+++ b/block/blk-cgroup.c
|
||||
@@ -887,7 +887,6 @@ static void blkcg_print_one_stat(struct blkcg_gq *blkg, struct seq_file *s)
|
||||
@ -64,10 +64,10 @@ index ce5858dadca5..aa43ed94deb6 100644
|
||||
|
||||
static int blkcg_print_stat(struct seq_file *sf, void *v)
|
||||
diff --git a/block/blk-iocost.c b/block/blk-iocost.c
|
||||
index 069193dee95b..352c43ab95e5 100644
|
||||
index bd7e9ffa5d40..66d68390e882 100644
|
||||
--- a/block/blk-iocost.c
|
||||
+++ b/block/blk-iocost.c
|
||||
@@ -3011,13 +3011,13 @@ static void ioc_pd_free(struct blkg_policy_data *pd)
|
||||
@@ -3016,13 +3016,13 @@ static void ioc_pd_free(struct blkg_policy_data *pd)
|
||||
kfree(iocg);
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ index 069193dee95b..352c43ab95e5 100644
|
||||
|
||||
if (iocg->level == 0) {
|
||||
unsigned vp10k = DIV64_U64_ROUND_CLOSEST(
|
||||
@@ -3033,7 +3033,6 @@ static bool ioc_pd_stat(struct blkg_policy_data *pd, struct seq_file *s)
|
||||
@@ -3038,7 +3038,6 @@ static bool ioc_pd_stat(struct blkg_policy_data *pd, struct seq_file *s)
|
||||
iocg->last_stat.wait_us,
|
||||
iocg->last_stat.indebt_us,
|
||||
iocg->last_stat.indelay_us);
|
||||
|
@ -267,14 +267,14 @@ index fb09cd22cb7f..0b2bbcce321a 100644
|
||||
#if defined(CONFIG_X86_32)
|
||||
#define X86EMUL_MODE_HOST X86EMUL_MODE_PROT32
|
||||
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
|
||||
index a6c96f6f9257..6b3c5e4df3e8 100644
|
||||
index 2380f44b9658..aba497add3d3 100644
|
||||
--- a/arch/x86/kvm/x86.c
|
||||
+++ b/arch/x86/kvm/x86.c
|
||||
@@ -12600,6 +12600,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_vmgexit_msr_protocol_exit);
|
||||
@@ -12621,6 +12621,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_vmgexit_msr_protocol_exit);
|
||||
static int __init kvm_x86_init(void)
|
||||
{
|
||||
kvm_mmu_x86_module_init();
|
||||
+ kvm_emulator_init();
|
||||
mitigate_smt_rsb &= boot_cpu_has_bug(X86_BUG_SMT_RSB) && cpu_smt_possible();
|
||||
return 0;
|
||||
}
|
||||
module_init(kvm_x86_init);
|
||||
|
@ -105,10 +105,10 @@ index 0b2bbcce321a..3b37b3e17379 100644
|
||||
int (*set_xcr)(struct x86_emulate_ctxt *ctxt, u32 index, u64 xcr);
|
||||
};
|
||||
diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
|
||||
index 6deb0553ff01..703d63ea1398 100644
|
||||
index b0b87c36be3d..545e321998d3 100644
|
||||
--- a/arch/x86/kvm/svm/svm.c
|
||||
+++ b/arch/x86/kvm/svm/svm.c
|
||||
@@ -4299,12 +4299,14 @@ static int svm_smi_allowed(struct kvm_vcpu *vcpu, bool for_injection)
|
||||
@@ -4317,12 +4317,14 @@ static int svm_smi_allowed(struct kvm_vcpu *vcpu, bool for_injection)
|
||||
return !svm_smi_blocked(vcpu);
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ index 6deb0553ff01..703d63ea1398 100644
|
||||
if (!is_guest_mode(vcpu))
|
||||
return 0;
|
||||
|
||||
@@ -4346,7 +4348,7 @@ static int svm_enter_smm(struct kvm_vcpu *vcpu, char *smstate)
|
||||
@@ -4364,7 +4366,7 @@ static int svm_enter_smm(struct kvm_vcpu *vcpu, char *smstate)
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ index 6deb0553ff01..703d63ea1398 100644
|
||||
{
|
||||
struct vcpu_svm *svm = to_svm(vcpu);
|
||||
struct kvm_host_map map, map_save;
|
||||
@@ -4354,6 +4356,8 @@ static int svm_leave_smm(struct kvm_vcpu *vcpu, const char *smstate)
|
||||
@@ -4372,6 +4374,8 @@ static int svm_leave_smm(struct kvm_vcpu *vcpu, const char *smstate)
|
||||
struct vmcb *vmcb12;
|
||||
int ret;
|
||||
|
||||
@ -143,10 +143,10 @@ index 6deb0553ff01..703d63ea1398 100644
|
||||
return 0;
|
||||
|
||||
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
|
||||
index f22a8c24de83..6e858effb3e4 100644
|
||||
index 61da2d9fa01f..4faac9fea269 100644
|
||||
--- a/arch/x86/kvm/vmx/vmx.c
|
||||
+++ b/arch/x86/kvm/vmx/vmx.c
|
||||
@@ -7606,7 +7606,7 @@ static int vmx_smi_allowed(struct kvm_vcpu *vcpu, bool for_injection)
|
||||
@@ -7603,7 +7603,7 @@ static int vmx_smi_allowed(struct kvm_vcpu *vcpu, bool for_injection)
|
||||
return !is_smm(vcpu);
|
||||
}
|
||||
|
||||
@ -155,7 +155,7 @@ index f22a8c24de83..6e858effb3e4 100644
|
||||
{
|
||||
struct vcpu_vmx *vmx = to_vmx(vcpu);
|
||||
|
||||
@@ -7620,7 +7620,7 @@ static int vmx_enter_smm(struct kvm_vcpu *vcpu, char *smstate)
|
||||
@@ -7617,7 +7617,7 @@ static int vmx_enter_smm(struct kvm_vcpu *vcpu, char *smstate)
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -165,10 +165,10 @@ index f22a8c24de83..6e858effb3e4 100644
|
||||
struct vcpu_vmx *vmx = to_vmx(vcpu);
|
||||
int ret;
|
||||
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
|
||||
index 6b3c5e4df3e8..dd496c99d984 100644
|
||||
index aba497add3d3..714ebf2c3125 100644
|
||||
--- a/arch/x86/kvm/x86.c
|
||||
+++ b/arch/x86/kvm/x86.c
|
||||
@@ -7421,9 +7421,9 @@ static void emulator_exiting_smm(struct x86_emulate_ctxt *ctxt)
|
||||
@@ -7440,9 +7440,9 @@ static void emulator_exiting_smm(struct x86_emulate_ctxt *ctxt)
|
||||
}
|
||||
|
||||
static int emulator_leave_smm(struct x86_emulate_ctxt *ctxt,
|
||||
@ -180,7 +180,7 @@ index 6b3c5e4df3e8..dd496c99d984 100644
|
||||
}
|
||||
|
||||
static void emulator_triple_fault(struct x86_emulate_ctxt *ctxt)
|
||||
@@ -9300,25 +9300,25 @@ static void enter_smm(struct kvm_vcpu *vcpu)
|
||||
@@ -9321,25 +9321,25 @@ static void enter_smm(struct kvm_vcpu *vcpu)
|
||||
struct kvm_segment cs, ds;
|
||||
struct desc_ptr dt;
|
||||
unsigned long cr0;
|
||||
|
@ -145,10 +145,10 @@ index d3cc1b8e2ea6..0dd18d66f3b7 100644
|
||||
if (ret != X86EMUL_CONTINUE)
|
||||
goto emulate_shutdown;
|
||||
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
|
||||
index dd496c99d984..23f83e92e6b8 100644
|
||||
index 714ebf2c3125..13530fd436d2 100644
|
||||
--- a/arch/x86/kvm/x86.c
|
||||
+++ b/arch/x86/kvm/x86.c
|
||||
@@ -9154,22 +9154,18 @@ static u32 enter_smm_get_segment_flags(struct kvm_segment *seg)
|
||||
@@ -9175,22 +9175,18 @@ static u32 enter_smm_get_segment_flags(struct kvm_segment *seg)
|
||||
return flags;
|
||||
}
|
||||
|
||||
@ -179,7 +179,7 @@ index dd496c99d984..23f83e92e6b8 100644
|
||||
}
|
||||
|
||||
#ifdef CONFIG_X86_64
|
||||
@@ -9190,54 +9186,47 @@ static void enter_smm_save_seg_64(struct kvm_vcpu *vcpu, char *buf, int n)
|
||||
@@ -9211,54 +9207,47 @@ static void enter_smm_save_seg_64(struct kvm_vcpu *vcpu, char *buf, int n)
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -257,7 +257,7 @@ index dd496c99d984..23f83e92e6b8 100644
|
||||
}
|
||||
|
||||
#ifdef CONFIG_X86_64
|
||||
@@ -9308,7 +9297,7 @@ static void enter_smm(struct kvm_vcpu *vcpu)
|
||||
@@ -9329,7 +9318,7 @@ static void enter_smm(struct kvm_vcpu *vcpu)
|
||||
enter_smm_save_state_64(vcpu, (char *)&smram);
|
||||
else
|
||||
#endif
|
||||
|
@ -154,10 +154,10 @@ index 0dd18d66f3b7..37c1662b5508 100644
|
||||
#endif
|
||||
ret = rsm_load_state_32(ctxt, &smram.smram32);
|
||||
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
|
||||
index 23f83e92e6b8..9c95bd0423ab 100644
|
||||
index 13530fd436d2..d59a78f6b607 100644
|
||||
--- a/arch/x86/kvm/x86.c
|
||||
+++ b/arch/x86/kvm/x86.c
|
||||
@@ -9169,20 +9169,17 @@ static void enter_smm_save_seg_32(struct kvm_vcpu *vcpu,
|
||||
@@ -9190,20 +9190,17 @@ static void enter_smm_save_seg_32(struct kvm_vcpu *vcpu,
|
||||
}
|
||||
|
||||
#ifdef CONFIG_X86_64
|
||||
@ -185,7 +185,7 @@ index 23f83e92e6b8..9c95bd0423ab 100644
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -9230,57 +9227,51 @@ static void enter_smm_save_state_32(struct kvm_vcpu *vcpu, struct kvm_smram_stat
|
||||
@@ -9251,57 +9248,51 @@ static void enter_smm_save_state_32(struct kvm_vcpu *vcpu, struct kvm_smram_stat
|
||||
}
|
||||
|
||||
#ifdef CONFIG_X86_64
|
||||
@ -268,7 +268,7 @@ index 23f83e92e6b8..9c95bd0423ab 100644
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -9294,7 +9285,7 @@ static void enter_smm(struct kvm_vcpu *vcpu)
|
||||
@@ -9315,7 +9306,7 @@ static void enter_smm(struct kvm_vcpu *vcpu)
|
||||
memset(smram.bytes, 0, sizeof(smram.bytes));
|
||||
#ifdef CONFIG_X86_64
|
||||
if (guest_cpuid_has(vcpu, X86_FEATURE_LM))
|
||||
|
@ -34,10 +34,10 @@ index c4e382af1853..932c0f659468 100644
|
||||
|
||||
int alloc_all_memslots_rmaps(struct kvm *kvm);
|
||||
diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
|
||||
index 703d63ea1398..8742bb38b40f 100644
|
||||
index 545e321998d3..fe340de913b2 100644
|
||||
--- a/arch/x86/kvm/svm/svm.c
|
||||
+++ b/arch/x86/kvm/svm/svm.c
|
||||
@@ -4305,15 +4305,11 @@ static int svm_enter_smm(struct kvm_vcpu *vcpu, union kvm_smram *smram)
|
||||
@@ -4323,15 +4323,11 @@ static int svm_enter_smm(struct kvm_vcpu *vcpu, union kvm_smram *smram)
|
||||
struct kvm_host_map map_save;
|
||||
int ret;
|
||||
|
||||
@ -55,7 +55,7 @@ index 703d63ea1398..8742bb38b40f 100644
|
||||
|
||||
svm->vmcb->save.rax = vcpu->arch.regs[VCPU_REGS_RAX];
|
||||
svm->vmcb->save.rsp = vcpu->arch.regs[VCPU_REGS_RSP];
|
||||
@@ -4352,28 +4348,23 @@ static int svm_leave_smm(struct kvm_vcpu *vcpu, const union kvm_smram *smram)
|
||||
@@ -4370,28 +4366,23 @@ static int svm_leave_smm(struct kvm_vcpu *vcpu, const union kvm_smram *smram)
|
||||
{
|
||||
struct vcpu_svm *svm = to_svm(vcpu);
|
||||
struct kvm_host_map map, map_save;
|
||||
@ -87,7 +87,7 @@ index 703d63ea1398..8742bb38b40f 100644
|
||||
return 1;
|
||||
|
||||
ret = 1;
|
||||
@@ -4398,7 +4389,7 @@ static int svm_leave_smm(struct kvm_vcpu *vcpu, const union kvm_smram *smram)
|
||||
@@ -4416,7 +4407,7 @@ static int svm_leave_smm(struct kvm_vcpu *vcpu, const union kvm_smram *smram)
|
||||
|
||||
vmcb12 = map.hva;
|
||||
nested_load_control_from_vmcb12(svm, &vmcb12->control);
|
||||
|
@ -19,10 +19,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
|
||||
index 8742bb38b40f..b11f03673d07 100644
|
||||
index fe340de913b2..9d65aaa6dd76 100644
|
||||
--- a/arch/x86/kvm/svm/svm.c
|
||||
+++ b/arch/x86/kvm/svm/svm.c
|
||||
@@ -4308,6 +4308,15 @@ static int svm_enter_smm(struct kvm_vcpu *vcpu, union kvm_smram *smram)
|
||||
@@ -4326,6 +4326,15 @@ static int svm_enter_smm(struct kvm_vcpu *vcpu, union kvm_smram *smram)
|
||||
if (!is_guest_mode(vcpu))
|
||||
return 0;
|
||||
|
||||
|
@ -128,10 +128,10 @@ index 3b37b3e17379..a64c190abf28 100644
|
||||
__CHECK_SMRAM64_OFFSET(auto_hlt_restart, 0xFEC9);
|
||||
__CHECK_SMRAM64_OFFSET(reserved2, 0xFECA);
|
||||
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
|
||||
index 9c95bd0423ab..210a310ee96c 100644
|
||||
index d59a78f6b607..5a38e73a80de 100644
|
||||
--- a/arch/x86/kvm/x86.c
|
||||
+++ b/arch/x86/kvm/x86.c
|
||||
@@ -7408,6 +7408,11 @@ static void emulator_set_nmi_mask(struct x86_emulate_ctxt *ctxt, bool masked)
|
||||
@@ -7427,6 +7427,11 @@ static void emulator_set_nmi_mask(struct x86_emulate_ctxt *ctxt, bool masked)
|
||||
static_call(kvm_x86_set_nmi_mask)(emul_to_vcpu(ctxt), masked);
|
||||
}
|
||||
|
||||
@ -143,7 +143,7 @@ index 9c95bd0423ab..210a310ee96c 100644
|
||||
static unsigned emulator_get_hflags(struct x86_emulate_ctxt *ctxt)
|
||||
{
|
||||
return emul_to_vcpu(ctxt)->arch.hflags;
|
||||
@@ -7477,6 +7482,7 @@ static const struct x86_emulate_ops emulate_ops = {
|
||||
@@ -7496,6 +7501,7 @@ static const struct x86_emulate_ops emulate_ops = {
|
||||
.guest_has_fxsr = emulator_guest_has_fxsr,
|
||||
.guest_has_rdpid = emulator_guest_has_rdpid,
|
||||
.set_nmi_mask = emulator_set_nmi_mask,
|
||||
@ -151,7 +151,7 @@ index 9c95bd0423ab..210a310ee96c 100644
|
||||
.get_hflags = emulator_get_hflags,
|
||||
.exiting_smm = emulator_exiting_smm,
|
||||
.leave_smm = emulator_leave_smm,
|
||||
@@ -9224,6 +9230,8 @@ static void enter_smm_save_state_32(struct kvm_vcpu *vcpu, struct kvm_smram_stat
|
||||
@@ -9245,6 +9251,8 @@ static void enter_smm_save_state_32(struct kvm_vcpu *vcpu, struct kvm_smram_stat
|
||||
smram->cr4 = kvm_read_cr4(vcpu);
|
||||
smram->smm_revision = 0x00020000;
|
||||
smram->smbase = vcpu->arch.smbase;
|
||||
@ -160,7 +160,7 @@ index 9c95bd0423ab..210a310ee96c 100644
|
||||
}
|
||||
|
||||
#ifdef CONFIG_X86_64
|
||||
@@ -9272,6 +9280,8 @@ static void enter_smm_save_state_64(struct kvm_vcpu *vcpu, struct kvm_smram_stat
|
||||
@@ -9293,6 +9301,8 @@ static void enter_smm_save_state_64(struct kvm_vcpu *vcpu, struct kvm_smram_stat
|
||||
enter_smm_save_seg_64(vcpu, &smram->ds, VCPU_SREG_DS);
|
||||
enter_smm_save_seg_64(vcpu, &smram->fs, VCPU_SREG_FS);
|
||||
enter_smm_save_seg_64(vcpu, &smram->gs, VCPU_SREG_GS);
|
||||
@ -169,7 +169,7 @@ index 9c95bd0423ab..210a310ee96c 100644
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -9308,6 +9318,8 @@ static void enter_smm(struct kvm_vcpu *vcpu)
|
||||
@@ -9329,6 +9339,8 @@ static void enter_smm(struct kvm_vcpu *vcpu)
|
||||
kvm_set_rflags(vcpu, X86_EFLAGS_FIXED);
|
||||
kvm_rip_write(vcpu, 0x8000);
|
||||
|
||||
|
@ -1,111 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Date: Mon, 6 Jun 2022 21:11:49 +0300
|
||||
Subject: [PATCH] KVM: SVM: fix tsc scaling cache logic
|
||||
|
||||
SVM uses a per-cpu variable to cache the current value of the
|
||||
tsc scaling multiplier msr on each cpu.
|
||||
|
||||
Commit 1ab9287add5e2
|
||||
("KVM: X86: Add vendor callbacks for writing the TSC multiplier")
|
||||
broke this caching logic.
|
||||
|
||||
Refactor the code so that all TSC scaling multiplier writes go through
|
||||
a single function which checks and updates the cache.
|
||||
|
||||
This fixes the following scenario:
|
||||
|
||||
1. A CPU runs a guest with some tsc scaling ratio.
|
||||
|
||||
2. New guest with different tsc scaling ratio starts on this CPU
|
||||
and terminates almost immediately.
|
||||
|
||||
This ensures that the short running guest had set the tsc scaling ratio just
|
||||
once when it was set via KVM_SET_TSC_KHZ. Due to the bug,
|
||||
the per-cpu cache is not updated.
|
||||
|
||||
3. The original guest continues to run, it doesn't restore the msr
|
||||
value back to its own value, because the cache matches,
|
||||
and thus continues to run with a wrong tsc scaling ratio.
|
||||
|
||||
Fixes: 1ab9287add5e2 ("KVM: X86: Add vendor callbacks for writing the TSC multiplier")
|
||||
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
|
||||
Message-Id: <20220606181149.103072-1-mlevitsk@redhat.com>
|
||||
Cc: stable@vger.kernel.org
|
||||
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
[FE: backport, mainly dropped parts for the not yet present
|
||||
5228eb96a487 ("KVM: x86: nSVM: implement nested TSC scaling")]
|
||||
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
|
||||
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||
---
|
||||
arch/x86/kvm/svm/svm.c | 30 +++++++++++++++++++-----------
|
||||
1 file changed, 19 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
|
||||
index b11f03673d07..11a9d3aef354 100644
|
||||
--- a/arch/x86/kvm/svm/svm.c
|
||||
+++ b/arch/x86/kvm/svm/svm.c
|
||||
@@ -466,11 +466,24 @@ static int has_svm(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
+void __svm_write_tsc_multiplier(u64 multiplier)
|
||||
+{
|
||||
+ preempt_disable();
|
||||
+
|
||||
+ if (multiplier == __this_cpu_read(current_tsc_ratio))
|
||||
+ goto out;
|
||||
+
|
||||
+ wrmsrl(MSR_AMD64_TSC_RATIO, multiplier);
|
||||
+ __this_cpu_write(current_tsc_ratio, multiplier);
|
||||
+out:
|
||||
+ preempt_enable();
|
||||
+}
|
||||
+
|
||||
static void svm_hardware_disable(void)
|
||||
{
|
||||
/* Make sure we clean up behind us */
|
||||
if (static_cpu_has(X86_FEATURE_TSCRATEMSR))
|
||||
- wrmsrl(MSR_AMD64_TSC_RATIO, TSC_RATIO_DEFAULT);
|
||||
+ __svm_write_tsc_multiplier(TSC_RATIO_DEFAULT);
|
||||
|
||||
cpu_svm_disable();
|
||||
|
||||
@@ -512,8 +525,7 @@ static int svm_hardware_enable(void)
|
||||
wrmsrl(MSR_VM_HSAVE_PA, __sme_page_pa(sd->save_area));
|
||||
|
||||
if (static_cpu_has(X86_FEATURE_TSCRATEMSR)) {
|
||||
- wrmsrl(MSR_AMD64_TSC_RATIO, TSC_RATIO_DEFAULT);
|
||||
- __this_cpu_write(current_tsc_ratio, TSC_RATIO_DEFAULT);
|
||||
+ __svm_write_tsc_multiplier(TSC_RATIO_DEFAULT);
|
||||
}
|
||||
|
||||
|
||||
@@ -1126,9 +1138,10 @@ static void svm_write_tsc_offset(struct kvm_vcpu *vcpu, u64 offset)
|
||||
|
||||
static void svm_write_tsc_multiplier(struct kvm_vcpu *vcpu, u64 multiplier)
|
||||
{
|
||||
- wrmsrl(MSR_AMD64_TSC_RATIO, multiplier);
|
||||
+ __svm_write_tsc_multiplier(multiplier);
|
||||
}
|
||||
|
||||
+
|
||||
/* Evaluate instruction intercepts that depend on guest CPUID features. */
|
||||
static void svm_recalc_instruction_intercepts(struct kvm_vcpu *vcpu,
|
||||
struct vcpu_svm *svm)
|
||||
@@ -1452,13 +1465,8 @@ static void svm_prepare_guest_switch(struct kvm_vcpu *vcpu)
|
||||
vmsave(__sme_page_pa(sd->save_area));
|
||||
}
|
||||
|
||||
- if (static_cpu_has(X86_FEATURE_TSCRATEMSR)) {
|
||||
- u64 tsc_ratio = vcpu->arch.tsc_scaling_ratio;
|
||||
- if (tsc_ratio != __this_cpu_read(current_tsc_ratio)) {
|
||||
- __this_cpu_write(current_tsc_ratio, tsc_ratio);
|
||||
- wrmsrl(MSR_AMD64_TSC_RATIO, tsc_ratio);
|
||||
- }
|
||||
- }
|
||||
+ if (static_cpu_has(X86_FEATURE_TSCRATEMSR))
|
||||
+ __svm_write_tsc_multiplier(vcpu->arch.tsc_scaling_ratio);
|
||||
|
||||
if (likely(tsc_aux_uret_slot >= 0))
|
||||
kvm_set_user_return_msr(tsc_aux_uret_slot, svm->tsc_aux, -1ull);
|
@ -1 +1 @@
|
||||
Subproject commit 49bd24e466cad16c880c304061a110641ddf09fe
|
||||
Subproject commit d3e9720dbcc643931a98403c58f3184caf028d4e
|
Loading…
Reference in New Issue
Block a user