From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: [PATCH v2 13/30] xen/x86: Clear dependent features when clearing a cpu cap Date: Fri, 5 Feb 2016 13:42:06 +0000 Message-ID: <1454679743-18133-14-git-send-email-andrew.cooper3@citrix.com> References: <1454679743-18133-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1454679743-18133-1-git-send-email-andrew.cooper3@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Xen-devel Cc: Andrew Cooper , Jan Beulich List-Id: xen-devel@lists.xenproject.org When clearing a cpu cap, clear all dependent features. This avoids having a featureset with intermediate features disabled, but leaf features enabled. Signed-off-by: Andrew Cooper --- CC: Jan Beulich --- xen/arch/x86/cpu/common.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c index 39c340b..e205565 100644 --- a/xen/arch/x86/cpu/common.c +++ b/xen/arch/x86/cpu/common.c @@ -53,8 +53,24 @@ static unsigned int cleared_caps[NCAPINTS]; void __init setup_clear_cpu_cap(unsigned int cap) { + const uint32_t *dfs; + unsigned int i; + + if ( test_bit(cap, cleared_caps) ) + return; + __clear_bit(cap, boot_cpu_data.x86_capability); __set_bit(cap, cleared_caps); + + dfs = lookup_deep_deps(cap); + + if ( !dfs ) + return; + + for ( i = 0; i < FSCAPINTS; ++i ) { + cleared_caps[i] |= dfs[i]; + boot_cpu_data.x86_capability[i] &= ~dfs[i]; + } } static void default_init(struct cpuinfo_x86 * c) -- 2.1.4