summaryrefslogtreecommitdiff
path: root/xen/arch/x86/msr.c
diff options
context:
space:
mode:
authorAndrew Cooper <andrew.cooper3@citrix.com>2020-02-21 15:23:31 +0000
committerAndrew Cooper <andrew.cooper3@citrix.com>2020-02-27 18:54:58 +0000
commit1df81d8caf1edab42b7e0e8d5fbf2e232b31b051 (patch)
treee8e32e043fa7e73c50e9d25e5bc81c60eee69bf9 /xen/arch/x86/msr.c
parentfd0ec12c3a41065faab70153b8037c9263571dc0 (diff)
x86/msr: Introduce and use default MSR policies
For now, the default and max policies remain identical, but this will change in the future. Update XEN_SYSCTL_get_cpu_policy and init_domain_msr_policy() to use the default policies. Take the opportunity sort PV ahead of HVM, as is the prevailing style elsewhere. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com>
Diffstat (limited to 'xen/arch/x86/msr.c')
-rw-r--r--xen/arch/x86/msr.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 738d7123f9..519222a2b8 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -34,9 +34,11 @@ struct msr_policy __read_mostly raw_msr_policy,
__read_mostly host_msr_policy;
#ifdef CONFIG_PV
struct msr_policy __read_mostly pv_max_msr_policy;
+struct msr_policy __read_mostly pv_def_msr_policy;
#endif
#ifdef CONFIG_HVM
struct msr_policy __read_mostly hvm_max_msr_policy;
+struct msr_policy __read_mostly hvm_def_msr_policy;
#endif
static void __init calculate_raw_policy(void)
@@ -56,6 +58,20 @@ static void __init calculate_host_policy(void)
mp->platform_info.cpuid_faulting = cpu_has_cpuid_faulting;
}
+static void __init calculate_pv_max_policy(void)
+{
+ struct msr_policy *mp = &pv_max_msr_policy;
+
+ *mp = host_msr_policy;
+}
+
+static void __init calculate_pv_def_policy(void)
+{
+ struct msr_policy *mp = &pv_def_msr_policy;
+
+ *mp = pv_max_msr_policy;
+}
+
static void __init calculate_hvm_max_policy(void)
{
struct msr_policy *mp = &hvm_max_msr_policy;
@@ -66,11 +82,11 @@ static void __init calculate_hvm_max_policy(void)
mp->platform_info.cpuid_faulting = true;
}
-static void __init calculate_pv_max_policy(void)
+static void __init calculate_hvm_def_policy(void)
{
- struct msr_policy *mp = &pv_max_msr_policy;
+ struct msr_policy *mp = &hvm_def_msr_policy;
- *mp = host_msr_policy;
+ *mp = hvm_max_msr_policy;
}
void __init init_guest_msr_policy(void)
@@ -79,17 +95,23 @@ void __init init_guest_msr_policy(void)
calculate_host_policy();
if ( IS_ENABLED(CONFIG_PV) )
+ {
calculate_pv_max_policy();
+ calculate_pv_def_policy();
+ }
if ( hvm_enabled )
+ {
calculate_hvm_max_policy();
+ calculate_hvm_def_policy();
+ }
}
int init_domain_msr_policy(struct domain *d)
{
struct msr_policy *mp = is_pv_domain(d)
- ? (IS_ENABLED(CONFIG_PV) ? &pv_max_msr_policy : NULL)
- : (IS_ENABLED(CONFIG_HVM) ? &hvm_max_msr_policy : NULL);
+ ? (IS_ENABLED(CONFIG_PV) ? &pv_def_msr_policy : NULL)
+ : (IS_ENABLED(CONFIG_HVM) ? &hvm_def_msr_policy : NULL);
if ( !mp )
{