From mboxrd@z Thu Jan 1 00:00:00 1970 From: Don Slutz Subject: Re: [RFC PATCH 03/10] Add cpuid_vmware_leaves Date: Fri, 13 Dec 2013 13:55:10 -0500 Message-ID: <52AB580E.9060504@terremark.com> References: <1386875718-28166-1-git-send-email-dslutz@terremark.com> <1386875718-28166-4-git-send-email-dslutz@terremark.com> <52AA383B.8000105@citrix.com> <52AAF59C020000780010CEC9@nat28.tlf.novell.com> <52AB0DDF.9050008@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VrXtw-0001E3-Ae for xen-devel@lists.xenproject.org; Fri, 13 Dec 2013 18:55:52 +0000 In-Reply-To: <52AB0DDF.9050008@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: Andrew Cooper , Jan Beulich , Don Slutz Cc: Keir Fraser , Ian Campbell , Stefano Stabellini , Ian Jackson , Eddie Dong , Jun Nakajima , xen-devel , Boris Ostrovsky , Suravee Suthikulpanit List-Id: xen-devel@lists.xenproject.org On 12/13/13 08:38, Andrew Cooper wrote: > On 13/12/2013 10:55, Jan Beulich wrote: >>>>> On 12.12.13 at 23:27, Andrew Cooper wrote: >>> On 12/12/2013 19:15, Don Slutz wrote: >>>> int cpuid_hypervisor_leaves( uint32_t idx, uint32_t sub_idx, >>>> uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx) >>>> { >>>> struct domain *d = current->domain; >>>> /* Optionally shift out of the way of Viridian architectural leaves. */ >>>> - uint32_t base = is_viridian_domain(d) ? 0x40000100 : 0x40000000; >>>> + uint32_t base = 0x40000000; >>>> uint32_t limit; >>>> >>>> + if ( is_viridian_domain(d) ) >>>> + base += 0x100; >>>> + if ( is_vmware_domain(d) ) >>>> + base += 0x100; >>>> + As a related question: Should I reply to each e-mail, or is the reply at the thread place (like here) ok? >>> These bases need a far more scalable solution, especially as the result >>> of each of these clauses can be changed at runtime with a cunning >>> hvm_param_set hypercall. I see. Did not think about HVM_PARAM_VIRIDIAN changing and the effect it has on all the related code. I just saw what was there for viridian and tried to add vmware support the same way. I will look into a patch that will make the bases more scalable, not run time changeable. I see that right now you can get the code to do strange (and maybe bad) things by changing HVM_PARAM_VIRIDIAN. So this patch (or patches) would make is_viridian_domain() an unchangable result. Same for is_vmware_domain() when I add it. >>> I think that both "is pretending to be HyperV" and "is pretending to be >>> VMware" need to be domain creation flags which are strictly static for >>> the lifetime of the domain. I agree with this. >> And it seems highly questionable to me whether having both at the >> same time makes much sense. >> >> Plus the new function doesn't belong in xen/arch/x86/traps.c ... I read this as "Change to some sort of data structure to get the answer instead of a function". This is because I do not see how to return the correct data from a function if it is not in xen/arch/x86/traps.c (like cpuid_hypervisor_leaves is) or called from there, which I would see as more confusing. >> Jan >> > I would certainly agree on the sentiment of it not making much sense. > > However, as Xen needs viridian to run windows, I would be astounded if > vmware VMs didn't have viridian as well, in which case it is probably > quite likely that a vmware windows vm with vmware tools would expect to > find viridian and vmware extensions. I also find it strange, but could not see a reason not to try and support it. This could be related to VMware stating that using CPUID is not 100% the way to find out you are running on VMware. -Don Slutz > ~Andrew