From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH RFC 10/31] xen/x86: Calculate HVM featureset Date: Tue, 22 Dec 2015 17:21:06 +0000 Message-ID: <56798682.1010906@citrix.com> References: <1450301073-28191-1-git-send-email-andrew.cooper3@citrix.com> <1450301073-28191-11-git-send-email-andrew.cooper3@citrix.com> <5679926702000078000C265C@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <5679926702000078000C265C@prv-mh.provo.novell.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: Jan Beulich Cc: Tim Deegan , Ian Campbell , Xen-devel List-Id: xen-devel@lists.xenproject.org On 22/12/15 17:11, Jan Beulich wrote: >>>> On 16.12.15 at 22:24, wrote: >> @@ -22,6 +24,27 @@ void __init calculate_featuresets(void) >> >> /* Unconditionally claim to be able to set the hypervisor bit. */ >> __set_bit(X86_FEATURE_HYPERVISOR, pv_featureset); >> + >> + /* HVM featureset. */ >> + if ( hvm_enabled ) >> + { >> + const uint32_t *hvm_featuremask = hvm_funcs.hap_supported >> + ? hvm_hap_featuremask : hvm_shadow_featuremask; >> + >> + for ( i = 0; i < ARRAY_SIZE(hvm_featureset); ++i ) >> + hvm_featureset[i] = host_featureset[i] & hvm_featuremask[i]; >> + >> + /* Unconditionally claim to be able to set the hypervisor bit. */ >> + __set_bit(X86_FEATURE_HYPERVISOR, hvm_featureset); >> + >> + /* >> + * On AMD, PV guests are entirely unable to use 'sysenter' as Xen runs >> + * in long mode, but HVM guests are able if running in protected mode. >> + */ >> + if ( (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) && >> + !test_bit(X86_FEATURE_SEP, boot_cpu_data.x86_capability) ) > Is the ! correct here? Yes - init_amd() deliberately clobbers the feature. > And please use cpu_has_sep. Actually, thinking about it, the check isn't quite correct. We need to only advertise the feature if it was available before init_amd() clobbered it. ~Andrew