[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen staging] x86/msr: Compile out unused logic/objects
commit fd0ec12c3a41065faab70153b8037c9263571dc0 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Wed Feb 26 12:26:14 2020 +0000 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Thu Feb 27 18:54:58 2020 +0000 x86/msr: Compile out unused logic/objects Arrange to compile out the PV or HVM logic and objects as applicable. This involves a bit of complexity in init_domain_msr_policy() as is_pv_domain() can't be evaulated at compile time. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/arch/x86/msr.c | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c index e39bb6dce4..738d7123f9 100644 --- a/xen/arch/x86/msr.c +++ b/xen/arch/x86/msr.c @@ -31,9 +31,13 @@ DEFINE_PER_CPU(uint32_t, tsc_aux); struct msr_policy __read_mostly raw_msr_policy, - __read_mostly host_msr_policy, - __read_mostly hvm_max_msr_policy, - __read_mostly pv_max_msr_policy; + __read_mostly host_msr_policy; +#ifdef CONFIG_PV +struct msr_policy __read_mostly pv_max_msr_policy; +#endif +#ifdef CONFIG_HVM +struct msr_policy __read_mostly hvm_max_msr_policy; +#endif static void __init calculate_raw_policy(void) { @@ -56,9 +60,6 @@ static void __init calculate_hvm_max_policy(void) { struct msr_policy *mp = &hvm_max_msr_policy; - if ( !hvm_enabled ) - return; - *mp = host_msr_policy; /* It's always possible to emulate CPUID faulting for HVM guests */ @@ -76,16 +77,27 @@ void __init init_guest_msr_policy(void) { calculate_raw_policy(); calculate_host_policy(); - calculate_hvm_max_policy(); - calculate_pv_max_policy(); + + if ( IS_ENABLED(CONFIG_PV) ) + calculate_pv_max_policy(); + + if ( hvm_enabled ) + calculate_hvm_max_policy(); } int init_domain_msr_policy(struct domain *d) { - struct msr_policy *mp = - xmemdup(is_pv_domain(d) ? &pv_max_msr_policy - : &hvm_max_msr_policy); + 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); + + if ( !mp ) + { + ASSERT_UNREACHABLE(); + return -EOPNOTSUPP; + } + mp = xmemdup(mp); if ( !mp ) return -ENOMEM; -- generated by git-patchbot for /home/xen/git/xen.git#staging _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |