From: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
To: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Cc: "Shan, Haitao" <haitao.shan@intel.com>
Subject: [PATCH 1 of 2] vpmu: Add a cpuid function
Date: Mon, 13 Feb 2012 14:01:34 +0100 [thread overview]
Message-ID: <6490841.m6xpzEUAzL@amur> (raw)
Add a new function - do_cpuid - to the vpmu struct arch_vpmu_ops.
This permits the vpmu to set specific bits in the cpuid for the hvm guest.
Signed-off-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
xen/arch/x86/hvm/vmx/vmx.c | 2 ++
xen/arch/x86/hvm/vmx/vpmu_core2.c | 7 +++++++
xen/arch/x86/hvm/vpmu.c | 10 ++++++++++
xen/include/asm-x86/hvm/vpmu.h | 5 +++++
4 files changed, 24 insertions(+), 0 deletions(-)
diff -r 9ad1e42c341b xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c Fri Feb 10 17:24:50 2012 +0000
+++ b/xen/arch/x86/hvm/vmx/vmx.c Mon Feb 13 12:36:09 2012 +0100
@@ -1603,6 +1603,8 @@ static void vmx_cpuid_intercept(
break;
}
+ vpmu_do_cpuid(input, eax, ebx, ecx, edx);
+
HVMTRACE_5D (CPUID, input, *eax, *ebx, *ecx, *edx);
}
diff -r 9ad1e42c341b xen/arch/x86/hvm/vmx/vpmu_core2.c
--- a/xen/arch/x86/hvm/vmx/vpmu_core2.c Fri Feb 10 17:24:50 2012 +0000
+++ b/xen/arch/x86/hvm/vmx/vpmu_core2.c Mon Feb 13 12:36:09 2012 +0100
@@ -578,6 +578,12 @@ static int core2_vpmu_do_interrupt(struc
return 1;
}
+static void core2_vpmu_do_cpuid(unsigned int input,
+ unsigned int *eax, unsigned int *ebx,
+ unsigned int *ecx, unsigned int *edx)
+{
+}
+
static void core2_vpmu_initialise(struct vcpu *v)
{
check_pmc_quirk();
@@ -602,6 +608,7 @@ struct arch_vpmu_ops core2_vpmu_ops = {
.do_wrmsr = core2_vpmu_do_wrmsr,
.do_rdmsr = core2_vpmu_do_rdmsr,
.do_interrupt = core2_vpmu_do_interrupt,
+ .do_cpuid = core2_vpmu_do_cpuid,
.arch_vpmu_initialise = core2_vpmu_initialise,
.arch_vpmu_destroy = core2_vpmu_destroy,
.arch_vpmu_save = core2_vpmu_save,
diff -r 9ad1e42c341b xen/arch/x86/hvm/vpmu.c
--- a/xen/arch/x86/hvm/vpmu.c Fri Feb 10 17:24:50 2012 +0000
+++ b/xen/arch/x86/hvm/vpmu.c Mon Feb 13 12:36:09 2012 +0100
@@ -62,6 +62,16 @@ int vpmu_do_interrupt(struct cpu_user_re
return 0;
}
+void vpmu_do_cpuid(unsigned int input,
+ unsigned int *eax, unsigned int *ebx,
+ unsigned int *ecx, unsigned int *edx)
+{
+ struct vpmu_struct *vpmu = vcpu_vpmu(current);
+
+ if ( vpmu->arch_vpmu_ops && vpmu->arch_vpmu_ops->do_cpuid)
+ vpmu->arch_vpmu_ops->do_cpuid(input, eax, ebx, ecx, edx);
+}
+
void vpmu_save(struct vcpu *v)
{
struct vpmu_struct *vpmu = vcpu_vpmu(v);
diff -r 9ad1e42c341b xen/include/asm-x86/hvm/vpmu.h
--- a/xen/include/asm-x86/hvm/vpmu.h Fri Feb 10 17:24:50 2012 +0000
+++ b/xen/include/asm-x86/hvm/vpmu.h Mon Feb 13 12:36:09 2012 +0100
@@ -50,6 +50,9 @@ struct arch_vpmu_ops {
int (*do_wrmsr)(unsigned int msr, uint64_t msr_content);
int (*do_rdmsr)(unsigned int msr, uint64_t *msr_content);
int (*do_interrupt)(struct cpu_user_regs *regs);
+ void (*do_cpuid)(unsigned int input,
+ unsigned int *eax, unsigned int *ebx,
+ unsigned int *ecx, unsigned int *edx);
void (*arch_vpmu_initialise)(struct vcpu *v);
void (*arch_vpmu_destroy)(struct vcpu *v);
void (*arch_vpmu_save)(struct vcpu *v);
@@ -78,6 +81,8 @@ struct vpmu_struct {
int vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content);
int vpmu_do_rdmsr(unsigned int msr, uint64_t *msr_content);
int vpmu_do_interrupt(struct cpu_user_regs *regs);
+void vpmu_do_cpuid(unsigned int input, unsigned int *eax, unsigned int *ebx,
+ unsigned int *ecx, unsigned int *edx);
void vpmu_initialise(struct vcpu *v);
void vpmu_destroy(struct vcpu *v);
void vpmu_save(struct vcpu *v);
--
Company details: http://ts.fujitsu.com/imprint.html
reply other threads:[~2012-02-13 13:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=6490841.m6xpzEUAzL@amur \
--to=dietmar.hahn@ts.fujitsu.com \
--cc=haitao.shan@intel.com \
--cc=xen-devel@lists.xensource.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.