[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 45/46] target/i386: Add support for save/load IA32_PKRS MSR
From: |
Paolo Bonzini |
Subject: |
[PULL 45/46] target/i386: Add support for save/load IA32_PKRS MSR |
Date: |
Mon, 8 Feb 2021 19:23:30 +0100 |
From: Chenyi Qiang <chenyi.qiang@intel.com>
PKS introduces MSR IA32_PKRS(0x6e1) to manage the supervisor protection
key rights. Page access and writes can be managed via the MSR update
without TLB flushes when permissions change.
Add the support to save/load IA32_PKRS MSR in guest.
Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
Message-Id: <20210205083325.13880-2-chenyi.qiang@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/kvm/kvm.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index 4788139128..e97f841757 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -113,6 +113,7 @@ static bool has_msr_vmx_vmfunc;
static bool has_msr_ucode_rev;
static bool has_msr_vmx_procbased_ctls2;
static bool has_msr_perf_capabs;
+static bool has_msr_pkrs;
static uint32_t has_architectural_pmu_version;
static uint32_t num_architectural_pmu_gp_counters;
@@ -2087,6 +2088,9 @@ static int kvm_get_supported_msrs(KVMState *s)
case MSR_IA32_VMX_PROCBASED_CTLS2:
has_msr_vmx_procbased_ctls2 = true;
break;
+ case MSR_IA32_PKRS:
+ has_msr_pkrs = true;
+ break;
}
}
}
@@ -2814,6 +2818,9 @@ static int kvm_put_msrs(X86CPU *cpu, int level)
if (has_msr_smi_count) {
kvm_msr_entry_add(cpu, MSR_SMI_COUNT, env->msr_smi_count);
}
+ if (has_msr_pkrs) {
+ kvm_msr_entry_add(cpu, MSR_IA32_PKRS, env->pkrs);
+ }
if (has_msr_bndcfgs) {
kvm_msr_entry_add(cpu, MSR_IA32_BNDCFGS, env->msr_bndcfgs);
}
@@ -3205,6 +3212,9 @@ static int kvm_get_msrs(X86CPU *cpu)
if (has_msr_feature_control) {
kvm_msr_entry_add(cpu, MSR_IA32_FEATURE_CONTROL, 0);
}
+ if (has_msr_pkrs) {
+ kvm_msr_entry_add(cpu, MSR_IA32_PKRS, 0);
+ }
if (has_msr_bndcfgs) {
kvm_msr_entry_add(cpu, MSR_IA32_BNDCFGS, 0);
}
@@ -3475,6 +3485,9 @@ static int kvm_get_msrs(X86CPU *cpu)
case MSR_IA32_UMWAIT_CONTROL:
env->umwait = msrs[i].data;
break;
+ case MSR_IA32_PKRS:
+ env->pkrs = msrs[i].data;
+ break;
default:
if (msrs[i].index >= MSR_MC0_CTL &&
msrs[i].index < MSR_MC0_CTL + (env->mcg_cap & 0xff) * 4) {
--
2.29.2
- [PULL 32/46] accel/kvm/kvm-all: Fix wrong return code handling in dirty log code, (continued)
- [PULL 32/46] accel/kvm/kvm-all: Fix wrong return code handling in dirty log code, Paolo Bonzini, 2021/02/08
- [PULL 33/46] replay: fix replay of the interrupts, Paolo Bonzini, 2021/02/08
- [PULL 36/46] cpu-throttle: Remove timer_mod() from cpu_throttle_set(), Paolo Bonzini, 2021/02/08
- [PULL 34/46] pc-bios/descriptors: fix paths in json files, Paolo Bonzini, 2021/02/08
- [PULL 38/46] pci-host: designware: add pcie-msi read method, Paolo Bonzini, 2021/02/08
- [PULL 39/46] vfio: add quirk device write method, Paolo Bonzini, 2021/02/08
- [PULL 41/46] nvram: add nrf51_soc flash read method, Paolo Bonzini, 2021/02/08
- [PULL 44/46] imx7-ccm: add digprog mmio write method, Paolo Bonzini, 2021/02/08
- [PULL 40/46] prep: add ppc-parity write method, Paolo Bonzini, 2021/02/08
- [PULL 46/46] target/i386: Expose VMX entry/exit load pkrs control bits, Paolo Bonzini, 2021/02/08
- [PULL 45/46] target/i386: Add support for save/load IA32_PKRS MSR,
Paolo Bonzini <=
- Re: [PULL 00/46] Misc patches for 2021-02-08, Peter Maydell, 2021/02/09