From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH] x86/hvm: Extend HVM cpuid leaf with vcpu id Date: Thu, 6 Nov 2014 15:14:07 +0000 Message-ID: <545B903F.1090503@citrix.com> References: <1415286430-11155-1-git-send-email-paul.durrant@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1415286430-11155-1-git-send-email-paul.durrant@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: Paul Durrant , xen-devel@lists.xen.org Cc: Keir Fraser , Jan Beulich List-Id: xen-devel@lists.xenproject.org On 06/11/14 15:07, Paul Durrant wrote: > To perform certain hypercalls HVM guests need to use Xen's idea of > vcpu id, which may well not match the guest OS idea of CPU id. > This patch adds vcpu id to the HVM cpuid leaf allowing the guest > to build a mapping. > > Signed-off-by: Paul Durrant > Cc: Keir Fraser > Cc: Jan Beulich > --- > xen/arch/x86/hvm/hvm.c | 4 ++++ > xen/include/public/arch-x86/cpuid.h | 5 +++-- > 2 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c > index 78f519d..d9a5706 100644 > --- a/xen/arch/x86/hvm/hvm.c > +++ b/xen/arch/x86/hvm/hvm.c > @@ -4189,6 +4189,10 @@ void hvm_hypervisor_cpuid_leaf(uint32_t sub_idx, > * foreign pages) has valid IOMMU entries. > */ > *eax |= XEN_HVM_CPUID_IOMMU_MAPPINGS; > + > + /* Indicate presence of vcpu id and set it in ebx */ > + *eax |= XEN_HVM_CPUID_VCPU_ID_PRESENT; > + *ebx = current->vcpu_id; > } > } > > diff --git a/xen/include/public/arch-x86/cpuid.h b/xen/include/public/arch-x86/cpuid.h > index 6005dfe..8ccb6e1 100644 > --- a/xen/include/public/arch-x86/cpuid.h > +++ b/xen/include/public/arch-x86/cpuid.h > @@ -76,13 +76,14 @@ > /* > * Leaf 5 (0x40000x04) > * HVM-specific features > + * EAX: Features > + * EBX: VCPU ID Probably want "iff EAX & VCPU_ID_PRESENT" in this comment. > */ > - > -/* EAX Features */ Spurious delete? > #define XEN_HVM_CPUID_APIC_ACCESS_VIRT (1u << 0) /* Virtualized APIC registers */ > #define XEN_HVM_CPUID_X2APIC_VIRT (1u << 1) /* Virtualized x2APIC accesses */ > /* Memory mapped from other domains has valid IOMMU entries */ > #define XEN_HVM_CPUID_IOMMU_MAPPINGS (1u << 2) > +#define XEN_HVM_CPUID_VCPU_ID_PRESENT (1u << 3) /* vcpu is present in EBX */ vcpu id? ~Andrew > > #define XEN_CPUID_MAX_NUM_LEAVES 4 >