From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: jbeulich@suse.com, andrew.cooper3@citrix.com, keir@xen.org
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
roger.pau@citrix.com, david.vrabel@citrix.com,
xen-devel@lists.xen.org
Subject: [PATCH] x86/hvm: Provide list of emulated features in HVM CPUID leaf
Date: Tue, 2 Feb 2016 18:17:21 -0500 [thread overview]
Message-ID: <1454455041-4647-1-git-send-email-boris.ostrovsky@oracle.com> (raw)
Hypervisor may choose which features to emulate for HVMlite guests.
Guest will query the HVM CPUID leaf to find out what is available.
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---
Another option to expose this is via features interface. The advantage of using cpuid
is that we don't need to setup hypercall page to make the query (although at least for
Linux and at least for now this does not buy us anything)
I also don't particularly like the fact that we reference another file (even if it is
a public header) for bits definition. Should we move those definitions here?
xen/arch/x86/hvm/hvm.c | 4 ++++
xen/include/public/arch-x86/cpuid.h | 6 ++++++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index dfeecca..8d63724 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -4585,6 +4585,10 @@ void hvm_hypervisor_cpuid_leaf(uint32_t sub_idx,
/* Indicate presence of vcpu id and set it in ebx */
*eax |= XEN_HVM_CPUID_VCPU_ID_PRESENT;
*ebx = current->vcpu_id;
+
+ /* Indicate which features are emulated */
+ *eax |= XEN_HVM_CPUID_EMU_FEATURES;
+ *ecx = current->domain->arch.emulation_flags;
}
}
diff --git a/xen/include/public/arch-x86/cpuid.h b/xen/include/public/arch-x86/cpuid.h
index d709340..a4f60c1 100644
--- a/xen/include/public/arch-x86/cpuid.h
+++ b/xen/include/public/arch-x86/cpuid.h
@@ -78,12 +78,18 @@
* HVM-specific features
* EAX: Features
* EBX: vcpu id (iff EAX has XEN_HVM_CPUID_VCPU_ID_PRESENT flag)
+ * ECX: Emulated features (iff EAX has XEN_HVM_CPUID_EMU_FEATURES flag)
*/
#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 id is present in EBX */
+/*
+ * Emulated features (enumerated in include/public/arch-x86/xen.h as
+ * XEN_X86_EMU_*) are present in ECX.
+ */
+#define XEN_HVM_CPUID_EMU_FEATURES (1u << 4)
#define XEN_CPUID_MAX_NUM_LEAVES 4
--
1.7.1
next reply other threads:[~2016-02-02 23:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-02 23:17 Boris Ostrovsky [this message]
2016-02-02 23:22 ` [PATCH] x86/hvm: Provide list of emulated features in HVM CPUID leaf Andrew Cooper
2016-02-02 23:30 ` Boris Ostrovsky
2016-02-03 0:17 ` Andrew Cooper
2016-02-03 8:43 ` Roger Pau Monné
2016-02-03 14:30 ` Boris Ostrovsky
2016-02-03 14:37 ` Andrew Cooper
2016-02-03 14:46 ` Boris Ostrovsky
2016-02-03 15:05 ` Roger Pau Monné
2016-02-03 15:27 ` Boris Ostrovsky
2016-02-03 3:51 ` Tian, Kevin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1454455041-4647-1-git-send-email-boris.ostrovsky@oracle.com \
--to=boris.ostrovsky@oracle.com \
--cc=andrew.cooper3@citrix.com \
--cc=david.vrabel@citrix.com \
--cc=jbeulich@suse.com \
--cc=keir@xen.org \
--cc=roger.pau@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).