* [PATCH -v3] KVM: MCE: Add MCE support to KVM
@ 2009-05-11 8:48 Huang Ying
2009-05-11 9:05 ` Jaswinder Singh Rajput
2009-05-17 18:56 ` [PATCH -v3] KVM: MCE: Add MCE support to KVM Avi Kivity
0 siblings, 2 replies; 17+ messages in thread
From: Huang Ying @ 2009-05-11 8:48 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm, linux-kernel, Andi Kleen
[-- Attachment #1: Type: text/plain, Size: 10884 bytes --]
The related MSRs are emulated. MCE capability is exported via
extension KVM_CAP_MCE and ioctl KVM_X86_GET_MCE_CAP_SUPPORTED. A new
vcpu ioctl command KVM_X86_SETUP_MCE is used to setup MCE emulation
such as the mcg_cap. MCE is injected via vcpu ioctl command
KVM_X86_SET_MCE. Extended machine-check state (MCG_EXT_P) and CMCI are
not implemented.
ChangeLog:
v3:
- Fix KVM_CAP_MCE declaration
v2:
- Add MCE capability exportation support.
- Allocate MCE banks registers simulation backing memory during VCPU
initialization.
Signed-off-by: Huang Ying <ying.huang@intel.com>
---
arch/x86/include/asm/kvm.h | 1
arch/x86/include/asm/kvm_host.h | 5
arch/x86/kvm/x86.c | 220 +++++++++++++++++++++++++++++++++++-----
include/linux/kvm.h | 21 +++
4 files changed, 223 insertions(+), 24 deletions(-)
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -42,6 +42,7 @@
#include <asm/msr.h>
#include <asm/desc.h>
#include <asm/mtrr.h>
+#include <asm/mce.h>
#define MAX_IO_MSRS 256
#define CR0_RESERVED_BITS \
@@ -55,6 +56,10 @@
| X86_CR4_OSXMMEXCPT | X86_CR4_VMXE))
#define CR8_RESERVED_BITS (~(unsigned long)X86_CR8_TPR)
+
+#define KVM_MAX_MCE_BANKS 32
+#define KVM_MCE_CAP_SUPPORTED MCG_CTL_P
+
/* EFER defaults:
* - enable syscall per default because its emulated by KVM
* - enable LME and LMA per default on 64 bit KVM
@@ -737,23 +742,43 @@ static int set_msr_mtrr(struct kvm_vcpu
return 0;
}
-int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data)
+static int set_msr_mce(struct kvm_vcpu *vcpu, u32 msr, u64 data)
{
+ u64 mcg_cap = vcpu->arch.mcg_cap;
+ unsigned bank_num = mcg_cap & 0xff;
+
switch (msr) {
- case MSR_EFER:
- set_efer(vcpu, data);
- break;
- case MSR_IA32_MC0_STATUS:
- pr_unimpl(vcpu, "%s: MSR_IA32_MC0_STATUS 0x%llx, nop\n",
- __func__, data);
- break;
case MSR_IA32_MCG_STATUS:
- pr_unimpl(vcpu, "%s: MSR_IA32_MCG_STATUS 0x%llx, nop\n",
- __func__, data);
+ vcpu->arch.mcg_status = data;
break;
case MSR_IA32_MCG_CTL:
- pr_unimpl(vcpu, "%s: MSR_IA32_MCG_CTL 0x%llx, nop\n",
- __func__, data);
+ if (!(mcg_cap & MCG_CTL_P))
+ return 1;
+ if (data != 0 && data != ~(u64)0)
+ return -1;
+ vcpu->arch.mcg_ctl = data;
+ break;
+ default:
+ if (msr >= MSR_IA32_MC0_CTL &&
+ msr < MSR_IA32_MC0_CTL + 4 * bank_num) {
+ u32 offset = msr - MSR_IA32_MC0_CTL;
+ /* only 0 or all 1s can be written to IA32_MCi_CTL */
+ if ((offset & 0x3) == 0 &&
+ data != 0 && data != ~(u64)0)
+ return -1;
+ vcpu->arch.mce_banks[offset] = data;
+ break;
+ }
+ return 1;
+ }
+ return 0;
+}
+
+int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data)
+{
+ switch (msr) {
+ case MSR_EFER:
+ set_efer(vcpu, data);
break;
case MSR_IA32_DEBUGCTLMSR:
if (!data) {
@@ -809,6 +834,10 @@ int kvm_set_msr_common(struct kvm_vcpu *
kvm_request_guest_time_update(vcpu);
break;
}
+ case MSR_IA32_MCG_CTL:
+ case MSR_IA32_MCG_STATUS:
+ case MSR_IA32_MC0_CTL ... MSR_IA32_MC0_CTL + 4 * KVM_MAX_MCE_BANKS - 1:
+ return set_msr_mce(vcpu, msr, data);
default:
pr_unimpl(vcpu, "unhandled wrmsr: 0x%x data %llx\n", msr, data);
return 1;
@@ -864,26 +893,49 @@ static int get_msr_mtrr(struct kvm_vcpu
return 0;
}
-int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
+static int get_msr_mce(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
{
u64 data;
+ u64 mcg_cap = vcpu->arch.mcg_cap;
+ unsigned bank_num = mcg_cap & 0xff;
switch (msr) {
- case 0xc0010010: /* SYSCFG */
- case 0xc0010015: /* HWCR */
- case MSR_IA32_PLATFORM_ID:
case MSR_IA32_P5_MC_ADDR:
case MSR_IA32_P5_MC_TYPE:
- case MSR_IA32_MC0_CTL:
- case MSR_IA32_MCG_STATUS:
+ data = 0;
+ break;
case MSR_IA32_MCG_CAP:
+ data = vcpu->arch.mcg_cap;
+ break;
case MSR_IA32_MCG_CTL:
- case MSR_IA32_MC0_MISC:
- case MSR_IA32_MC0_MISC+4:
- case MSR_IA32_MC0_MISC+8:
- case MSR_IA32_MC0_MISC+12:
- case MSR_IA32_MC0_MISC+16:
- case MSR_IA32_MC0_MISC+20:
+ if (!(mcg_cap & MCG_CTL_P))
+ return 1;
+ data = vcpu->arch.mcg_ctl;
+ break;
+ case MSR_IA32_MCG_STATUS:
+ data = vcpu->arch.mcg_status;
+ break;
+ default:
+ if (msr >= MSR_IA32_MC0_CTL &&
+ msr < MSR_IA32_MC0_CTL + 4 * bank_num) {
+ u32 offset = msr - MSR_IA32_MC0_CTL;
+ data = vcpu->arch.mce_banks[offset];
+ break;
+ }
+ return 1;
+ }
+ *pdata = data;
+ return 0;
+}
+
+int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
+{
+ u64 data;
+
+ switch (msr) {
+ case 0xc0010010: /* SYSCFG */
+ case 0xc0010015: /* HWCR */
+ case MSR_IA32_PLATFORM_ID:
case MSR_IA32_UCODE_REV:
case MSR_IA32_EBL_CR_POWERON:
case MSR_IA32_DEBUGCTLMSR:
@@ -925,6 +977,13 @@ int kvm_get_msr_common(struct kvm_vcpu *
case MSR_KVM_SYSTEM_TIME:
data = vcpu->arch.time;
break;
+ case MSR_IA32_P5_MC_ADDR:
+ case MSR_IA32_P5_MC_TYPE:
+ case MSR_IA32_MCG_CAP:
+ case MSR_IA32_MCG_CTL:
+ case MSR_IA32_MCG_STATUS:
+ case MSR_IA32_MC0_CTL ... MSR_IA32_MC0_CTL + 4 * KVM_MAX_MCE_BANKS - 1:
+ return get_msr_mce(vcpu, msr, pdata);
default:
pr_unimpl(vcpu, "unhandled rdmsr: 0x%x\n", msr);
return 1;
@@ -1046,6 +1105,9 @@ int kvm_dev_ioctl_check_extension(long e
case KVM_CAP_IOMMU:
r = iommu_found();
break;
+ case KVM_CAP_MCE:
+ r = KVM_MAX_MCE_BANKS;
+ break;
default:
r = 0;
break;
@@ -1106,6 +1168,16 @@ long kvm_arch_dev_ioctl(struct file *fil
r = 0;
break;
}
+ case KVM_X86_GET_MCE_CAP_SUPPORTED: {
+ u64 mce_cap;
+
+ mce_cap = KVM_MCE_CAP_SUPPORTED;
+ r = -EFAULT;
+ if (copy_to_user(argp, &mce_cap, sizeof mce_cap))
+ goto out;
+ r = 0;
+ break;
+ }
default:
r = -EINVAL;
}
@@ -1463,6 +1535,80 @@ static int vcpu_ioctl_tpr_access_reporti
return 0;
}
+static int kvm_vcpu_ioctl_x86_setup_mce(struct kvm_vcpu *vcpu,
+ u64 mcg_cap)
+{
+ int r;
+ unsigned bank_num = mcg_cap & 0xff, bank;
+
+ r = -EINVAL;
+ if (!bank_num)
+ goto out;
+ if (mcg_cap & ~(KVM_MCE_CAP_SUPPORTED | 0xff | 0xff0000))
+ goto out;
+ r = 0;
+ vcpu->arch.mcg_cap = mcg_cap;
+ /* Init IA32_MCG_CTL to all 1s */
+ if (mcg_cap & MCG_CTL_P)
+ vcpu->arch.mcg_ctl = ~(u64)0;
+ /* Init IA32_MCi_CTL to all 1s */
+ for (bank = 0; bank < bank_num; bank++)
+ vcpu->arch.mce_banks[bank*4] = ~(u64)0;
+out:
+ return r;
+}
+
+static int kvm_vcpu_ioctl_x86_set_mce(struct kvm_vcpu *vcpu,
+ struct kvm_x86_mce *mce)
+{
+ u64 mcg_cap = vcpu->arch.mcg_cap;
+ unsigned bank_num = mcg_cap & 0xff;
+ u64 *banks = vcpu->arch.mce_banks;
+
+ if (mce->bank >= bank_num || !(mce->status & MCI_STATUS_VAL))
+ return -EINVAL;
+ /*
+ * if IA32_MCG_CTL is not all 1s, the uncorrected error
+ * reporting is disabled
+ */
+ if ((mce->status & MCI_STATUS_UC) && (mcg_cap & MCG_CTL_P) &&
+ vcpu->arch.mcg_ctl != ~(u64)0)
+ return 0;
+ banks += 4 * mce->bank;
+ /*
+ * if IA32_MCi_CTL is not all 1s, the uncorrected error
+ * reporting is disabled for the bank
+ */
+ if ((mce->status & MCI_STATUS_UC) && banks[0] != ~(u64)0)
+ return 0;
+ if (mce->status & MCI_STATUS_UC) {
+ if ((vcpu->arch.mcg_status & MCG_STATUS_MCIP) ||
+ !(vcpu->arch.cr4 & X86_CR4_MCE)) {
+ printk(KERN_DEBUG "kvm: set_mce: "
+ "injects mce exception while "
+ "previous one is in progress!\n");
+ set_bit(KVM_REQ_TRIPLE_FAULT, &vcpu->requests);
+ return 0;
+ }
+ if (banks[1] & MCI_STATUS_VAL)
+ mce->status |= MCI_STATUS_OVER;
+ banks[2] = mce->addr;
+ banks[3] = mce->misc;
+ vcpu->arch.mcg_status = mce->mcg_status;
+ banks[1] = mce->status;
+ kvm_queue_exception(vcpu, MC_VECTOR);
+ } else if (!(banks[1] & MCI_STATUS_VAL)
+ || !(banks[1] & MCI_STATUS_UC)) {
+ if (banks[1] & MCI_STATUS_VAL)
+ mce->status |= MCI_STATUS_OVER;
+ banks[2] = mce->addr;
+ banks[3] = mce->misc;
+ banks[1] = mce->status;
+ } else
+ banks[1] |= MCI_STATUS_OVER;
+ return 0;
+}
+
long kvm_arch_vcpu_ioctl(struct file *filp,
unsigned int ioctl, unsigned long arg)
{
@@ -1596,6 +1742,24 @@ long kvm_arch_vcpu_ioctl(struct file *fi
kvm_lapic_set_vapic_addr(vcpu, va.vapic_addr);
break;
}
+ case KVM_X86_SETUP_MCE: {
+ u64 mcg_cap;
+
+ r = -EFAULT;
+ if (copy_from_user(&mcg_cap, argp, sizeof mcg_cap))
+ goto out;
+ r = kvm_vcpu_ioctl_x86_setup_mce(vcpu, mcg_cap);
+ break;
+ }
+ case KVM_X86_SET_MCE: {
+ struct kvm_x86_mce mce;
+
+ r = -EFAULT;
+ if (copy_from_user(&mce, argp, sizeof mce))
+ goto out;
+ r = kvm_vcpu_ioctl_x86_set_mce(vcpu, &mce);
+ break;
+ }
default:
r = -EINVAL;
}
@@ -4411,6 +4575,14 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *
goto fail_mmu_destroy;
}
+ vcpu->arch.mce_banks = kzalloc(KVM_MAX_MCE_BANKS * sizeof(u64) * 4,
+ GFP_KERNEL);
+ if (!vcpu->arch.mce_banks) {
+ r = -ENOMEM;
+ goto fail_mmu_destroy;
+ }
+ vcpu->arch.mcg_cap = KVM_MAX_MCE_BANKS;
+
return 0;
fail_mmu_destroy:
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -371,6 +371,11 @@ struct kvm_vcpu_arch {
unsigned long dr6;
unsigned long dr7;
unsigned long eff_db[KVM_NR_DB_REGS];
+
+ u64 mcg_cap;
+ u64 mcg_status;
+ u64 mcg_ctl;
+ u64 *mce_banks;
};
struct kvm_mem_alias {
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -415,6 +415,9 @@ struct kvm_trace_rec {
#define KVM_CAP_ASSIGN_DEV_IRQ 29
/* Another bug in KVM_SET_USER_MEMORY_REGION fixed: */
#define KVM_CAP_JOIN_MEMORY_REGIONS_WORKS 30
+#ifdef __KVM_HAVE_MCE
+#define KVM_CAP_MCE 31
+#endif
#ifdef KVM_CAP_IRQ_ROUTING
@@ -454,6 +457,20 @@ struct kvm_irq_routing {
#endif
+#ifdef KVM_CAP_MCE
+/* x86 MCE */
+struct kvm_x86_mce {
+ __u64 status;
+ __u64 addr;
+ __u64 misc;
+ __u64 mcg_status;
+ __u8 bank;
+ __u8 pad1;
+ __u16 pad2;
+ __u32 pad3;
+};
+#endif
+
/*
* ioctls for VM fds
*/
@@ -541,6 +558,10 @@ struct kvm_irq_routing {
#define KVM_NMI _IO(KVMIO, 0x9a)
/* Available with KVM_CAP_SET_GUEST_DEBUG */
#define KVM_SET_GUEST_DEBUG _IOW(KVMIO, 0x9b, struct kvm_guest_debug)
+/* MCE for x86 */
+#define KVM_X86_SETUP_MCE _IOW(KVMIO, 0x9c, __u64)
+#define KVM_X86_GET_MCE_CAP_SUPPORTED _IOR(KVMIO, 0x9d, __u64)
+#define KVM_X86_SET_MCE _IOW(KVMIO, 0x9e, struct kvm_x86_mce)
/*
* Deprecated interfaces
--- a/arch/x86/include/asm/kvm.h
+++ b/arch/x86/include/asm/kvm.h
@@ -17,6 +17,7 @@
#define __KVM_HAVE_USER_NMI
#define __KVM_HAVE_GUEST_DEBUG
#define __KVM_HAVE_MSIX
+#define __KVM_HAVE_MCE
/* Architectural interrupt line count. */
#define KVM_NR_INTERRUPTS 256
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH -v3] KVM: MCE: Add MCE support to KVM
2009-05-11 8:48 [PATCH -v3] KVM: MCE: Add MCE support to KVM Huang Ying
@ 2009-05-11 9:05 ` Jaswinder Singh Rajput
2009-05-11 9:08 ` Huang Ying
2009-05-17 18:56 ` [PATCH -v3] KVM: MCE: Add MCE support to KVM Avi Kivity
1 sibling, 1 reply; 17+ messages in thread
From: Jaswinder Singh Rajput @ 2009-05-11 9:05 UTC (permalink / raw)
To: Huang Ying; +Cc: Avi Kivity, kvm, linux-kernel, Andi Kleen
On Mon, 2009-05-11 at 16:48 +0800, Huang Ying wrote:
> +int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
> +{
> + u64 data;
> +
> + switch (msr) {
> + case 0xc0010010: /* SYSCFG */
> + case 0xc0010015: /* HWCR */
You can replace this with :
+ case MSR_K8_SYSCFG:
+ case MSR_K8_HWCR:
--
JSR
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH -v3] KVM: MCE: Add MCE support to KVM
2009-05-11 9:05 ` Jaswinder Singh Rajput
@ 2009-05-11 9:08 ` Huang Ying
2009-05-14 5:30 ` [PATCH -tip] x86: kvm/x86.c use MSR names in place of address Jaswinder Singh Rajput
0 siblings, 1 reply; 17+ messages in thread
From: Huang Ying @ 2009-05-11 9:08 UTC (permalink / raw)
To: Jaswinder Singh Rajput; +Cc: Avi Kivity, kvm, linux-kernel, Andi Kleen
[-- Attachment #1: Type: text/plain, Size: 526 bytes --]
On Mon, 2009-05-11 at 17:05 +0800, Jaswinder Singh Rajput wrote:
> On Mon, 2009-05-11 at 16:48 +0800, Huang Ying wrote:
> > +int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
> > +{
> > + u64 data;
> > +
> > + switch (msr) {
> > + case 0xc0010010: /* SYSCFG */
> > + case 0xc0010015: /* HWCR */
>
> You can replace this with :
>
> + case MSR_K8_SYSCFG:
> + case MSR_K8_HWCR:
>
I do not change this actually. So I think it should be changed in
another patch.
Best Regards,
Huang Ying
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH -tip] x86: kvm/x86.c use MSR names in place of address
2009-05-11 9:08 ` Huang Ying
@ 2009-05-14 5:30 ` Jaswinder Singh Rajput
2009-05-14 6:27 ` [PATCH -tip] x86: kvm replace MSR_IA32_TIME_STAMP_COUNTER with MSR_IA32_TSC of msr-index.h Jaswinder Singh Rajput
` (2 more replies)
0 siblings, 3 replies; 17+ messages in thread
From: Jaswinder Singh Rajput @ 2009-05-14 5:30 UTC (permalink / raw)
To: Huang Ying, Ingo Molnar, x86 maintainers
Cc: Avi Kivity, kvm, linux-kernel, Andi Kleen
On Mon, 2009-05-11 at 17:08 +0800, Huang Ying wrote:
> On Mon, 2009-05-11 at 17:05 +0800, Jaswinder Singh Rajput wrote:
> > On Mon, 2009-05-11 at 16:48 +0800, Huang Ying wrote:
> > > +int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
> > > +{
> > > + u64 data;
> > > +
> > > + switch (msr) {
> > > + case 0xc0010010: /* SYSCFG */
> > > + case 0xc0010015: /* HWCR */
> >
> > You can replace this with :
> >
> > + case MSR_K8_SYSCFG:
> > + case MSR_K8_HWCR:
> >
>
> I do not change this actually. So I think it should be changed in
> another patch.
>
Here is the patch:
[PATCH -tip] x86: kvm/x86.c use MSR names in place of address
Replace 0xc0010010 with MSR_K8_SYSCFG and 0xc0010015 with MSR_K7_HWCR.
Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
---
arch/x86/kvm/x86.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 7c1ce5a..8e4a0ef 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -866,8 +866,6 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
u64 data;
switch (msr) {
- case 0xc0010010: /* SYSCFG */
- case 0xc0010015: /* HWCR */
case MSR_IA32_PLATFORM_ID:
case MSR_IA32_P5_MC_ADDR:
case MSR_IA32_P5_MC_TYPE:
@@ -888,6 +886,8 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
case MSR_IA32_LASTBRANCHTOIP:
case MSR_IA32_LASTINTFROMIP:
case MSR_IA32_LASTINTTOIP:
+ case MSR_K8_SYSCFG:
+ case MSR_K7_HWCR:
case MSR_VM_HSAVE_PA:
data = 0;
break;
--
1.6.0.6
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH -tip] x86: kvm replace MSR_IA32_TIME_STAMP_COUNTER with MSR_IA32_TSC of msr-index.h
2009-05-14 5:30 ` [PATCH -tip] x86: kvm/x86.c use MSR names in place of address Jaswinder Singh Rajput
@ 2009-05-14 6:27 ` Jaswinder Singh Rajput
2009-05-15 13:12 ` Jaswinder Singh Rajput
2009-05-15 13:13 ` [PATCH -tip] x86: kvm/x86.c use MSR names in place of address Jaswinder Singh Rajput
2009-05-17 18:57 ` Avi Kivity
2 siblings, 1 reply; 17+ messages in thread
From: Jaswinder Singh Rajput @ 2009-05-14 6:27 UTC (permalink / raw)
To: Ingo Molnar, x86 maintainers, Avi Kivity, kvm, linux-kernel, Andi Kleen
Use standard msr-index.h's MSR declaration.
MSR_IA32_TSC is better than MSR_IA32_TIME_STAMP_COUNTER as it also solves
80 column issue.
Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
---
arch/x86/include/asm/kvm_host.h | 2 --
arch/x86/kvm/svm.c | 4 ++--
arch/x86/kvm/vmx.c | 4 ++--
arch/x86/kvm/x86.c | 5 ++---
4 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index f0faf58..824f5e6 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -750,8 +750,6 @@ static inline void kvm_inject_gp(struct kvm_vcpu *vcpu, u32 error_code)
kvm_queue_exception_e(vcpu, GP_VECTOR, error_code);
}
-#define MSR_IA32_TIME_STAMP_COUNTER 0x010
-
#define TSS_IOPB_BASE_OFFSET 0x66
#define TSS_BASE_SIZE 0x68
#define TSS_IOPB_SIZE (65536 / 8)
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 1821c20..f149d17 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1889,7 +1889,7 @@ static int svm_get_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 *data)
struct vcpu_svm *svm = to_svm(vcpu);
switch (ecx) {
- case MSR_IA32_TIME_STAMP_COUNTER: {
+ case MSR_IA32_TSC: {
u64 tsc;
rdtscll(tsc);
@@ -1979,7 +1979,7 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 data)
struct vcpu_svm *svm = to_svm(vcpu);
switch (ecx) {
- case MSR_IA32_TIME_STAMP_COUNTER: {
+ case MSR_IA32_TSC: {
u64 tsc;
rdtscll(tsc);
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index bb48133..c8d3234 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -897,7 +897,7 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata)
case MSR_EFER:
return kvm_get_msr_common(vcpu, msr_index, pdata);
#endif
- case MSR_IA32_TIME_STAMP_COUNTER:
+ case MSR_IA32_TSC:
data = guest_read_tsc();
break;
case MSR_IA32_SYSENTER_CS:
@@ -957,7 +957,7 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data)
case MSR_IA32_SYSENTER_ESP:
vmcs_writel(GUEST_SYSENTER_ESP, data);
break;
- case MSR_IA32_TIME_STAMP_COUNTER:
+ case MSR_IA32_TSC:
rdtscll(host_tsc);
guest_write_tsc(data, host_tsc);
break;
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 8e4a0ef..db0fd7d 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -465,7 +465,7 @@ static u32 msrs_to_save[] = {
#ifdef CONFIG_X86_64
MSR_CSTAR, MSR_KERNEL_GS_BASE, MSR_SYSCALL_MASK, MSR_LSTAR,
#endif
- MSR_IA32_TIME_STAMP_COUNTER, MSR_KVM_SYSTEM_TIME, MSR_KVM_WALL_CLOCK,
+ MSR_IA32_TSC, MSR_KVM_SYSTEM_TIME, MSR_KVM_WALL_CLOCK,
MSR_IA32_PERF_STATUS, MSR_IA32_CR_PAT, MSR_VM_HSAVE_PA
};
@@ -637,8 +637,7 @@ static void kvm_write_guest_time(struct kvm_vcpu *v)
/* Keep irq disabled to prevent changes to the clock */
local_irq_save(flags);
- kvm_get_msr(v, MSR_IA32_TIME_STAMP_COUNTER,
- &vcpu->hv_clock.tsc_timestamp);
+ kvm_get_msr(v, MSR_IA32_TSC, &vcpu->hv_clock.tsc_timestamp);
ktime_get_ts(&ts);
local_irq_restore(flags);
--
1.6.0.6
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH -tip] x86: kvm replace MSR_IA32_TIME_STAMP_COUNTER with MSR_IA32_TSC of msr-index.h
2009-05-14 6:27 ` [PATCH -tip] x86: kvm replace MSR_IA32_TIME_STAMP_COUNTER with MSR_IA32_TSC of msr-index.h Jaswinder Singh Rajput
@ 2009-05-15 13:12 ` Jaswinder Singh Rajput
2009-05-17 18:48 ` Avi Kivity
0 siblings, 1 reply; 17+ messages in thread
From: Jaswinder Singh Rajput @ 2009-05-15 13:12 UTC (permalink / raw)
To: Avi Kivity, Ingo Molnar; +Cc: x86 maintainers, kvm, linux-kernel, Andi Kleen
Hello Avi,
On Thu, 2009-05-14 at 11:57 +0530, Jaswinder Singh Rajput wrote:
> Use standard msr-index.h's MSR declaration.
>
> MSR_IA32_TSC is better than MSR_IA32_TIME_STAMP_COUNTER as it also solves
> 80 column issue.
>
> Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
> ---
If this patch looks sane to you can apply in kvm tree.
Here is the updated patch based on kvm tree:
[PATCH] x86: kvm replace MSR_IA32_TIME_STAMP_COUNTER with MSR_IA32_TSC of msr-index.h
Use standard msr-index.h's MSR declaration.
MSR_IA32_TSC is better than MSR_IA32_TIME_STAMP_COUNTER as it also solves
80 column issue.
Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
---
arch/x86/include/asm/kvm_host.h | 2 --
arch/x86/kvm/svm.c | 4 ++--
arch/x86/kvm/vmx.c | 4 ++--
arch/x86/kvm/x86.c | 5 ++---
4 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 716a4ec..5c72897 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -753,8 +753,6 @@ static inline void kvm_inject_gp(struct kvm_vcpu *vcpu, u32 error_code)
kvm_queue_exception_e(vcpu, GP_VECTOR, error_code);
}
-#define MSR_IA32_TIME_STAMP_COUNTER 0x010
-
#define TSS_IOPB_BASE_OFFSET 0x66
#define TSS_BASE_SIZE 0x68
#define TSS_IOPB_SIZE (65536 / 8)
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 71510e0..dd667dd 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1953,7 +1953,7 @@ static int svm_get_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 *data)
struct vcpu_svm *svm = to_svm(vcpu);
switch (ecx) {
- case MSR_IA32_TIME_STAMP_COUNTER: {
+ case MSR_IA32_TSC: {
u64 tsc;
rdtscll(tsc);
@@ -2043,7 +2043,7 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 data)
struct vcpu_svm *svm = to_svm(vcpu);
switch (ecx) {
- case MSR_IA32_TIME_STAMP_COUNTER: {
+ case MSR_IA32_TSC: {
u64 tsc;
rdtscll(tsc);
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index fe2ce2b..98e6915 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -931,7 +931,7 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata)
case MSR_EFER:
return kvm_get_msr_common(vcpu, msr_index, pdata);
#endif
- case MSR_IA32_TIME_STAMP_COUNTER:
+ case MSR_IA32_TSC:
data = guest_read_tsc();
break;
case MSR_IA32_SYSENTER_CS:
@@ -991,7 +991,7 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data)
case MSR_IA32_SYSENTER_ESP:
vmcs_writel(GUEST_SYSENTER_ESP, data);
break;
- case MSR_IA32_TIME_STAMP_COUNTER:
+ case MSR_IA32_TSC:
rdtscll(host_tsc);
guest_write_tsc(data, host_tsc);
break;
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 44e87a5..4150edb 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -462,7 +462,7 @@ static u32 msrs_to_save[] = {
#ifdef CONFIG_X86_64
MSR_CSTAR, MSR_KERNEL_GS_BASE, MSR_SYSCALL_MASK, MSR_LSTAR,
#endif
- MSR_IA32_TIME_STAMP_COUNTER, MSR_KVM_SYSTEM_TIME, MSR_KVM_WALL_CLOCK,
+ MSR_IA32_TSC, MSR_KVM_SYSTEM_TIME, MSR_KVM_WALL_CLOCK,
MSR_IA32_PERF_STATUS, MSR_IA32_CR_PAT, MSR_VM_HSAVE_PA
};
@@ -640,8 +640,7 @@ static void kvm_write_guest_time(struct kvm_vcpu *v)
/* Keep irq disabled to prevent changes to the clock */
local_irq_save(flags);
- kvm_get_msr(v, MSR_IA32_TIME_STAMP_COUNTER,
- &vcpu->hv_clock.tsc_timestamp);
+ kvm_get_msr(v, MSR_IA32_TSC, &vcpu->hv_clock.tsc_timestamp);
ktime_get_ts(&ts);
local_irq_restore(flags);
--
1.6.1.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH -tip] x86: kvm/x86.c use MSR names in place of address
2009-05-14 5:30 ` [PATCH -tip] x86: kvm/x86.c use MSR names in place of address Jaswinder Singh Rajput
2009-05-14 6:27 ` [PATCH -tip] x86: kvm replace MSR_IA32_TIME_STAMP_COUNTER with MSR_IA32_TSC of msr-index.h Jaswinder Singh Rajput
@ 2009-05-15 13:13 ` Jaswinder Singh Rajput
2009-05-17 18:57 ` Avi Kivity
2 siblings, 0 replies; 17+ messages in thread
From: Jaswinder Singh Rajput @ 2009-05-15 13:13 UTC (permalink / raw)
To: Avi Kivity; +Cc: Ingo Molnar, x86 maintainers, kvm, linux-kernel, Andi Kleen
On Thu, 2009-05-14 at 11:00 +0530, Jaswinder Singh Rajput wrote:
> Here is the patch:
>
> [PATCH -tip] x86: kvm/x86.c use MSR names in place of address
>
> Replace 0xc0010010 with MSR_K8_SYSCFG and 0xc0010015 with MSR_K7_HWCR.
>
> Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
> ---
This patch can also apply to kvm tree without any changes.
Thanks,
--
JSR
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH -tip] x86: kvm replace MSR_IA32_TIME_STAMP_COUNTER with MSR_IA32_TSC of msr-index.h
2009-05-15 13:12 ` Jaswinder Singh Rajput
@ 2009-05-17 18:48 ` Avi Kivity
2009-05-20 8:12 ` Jaswinder Singh Rajput
0 siblings, 1 reply; 17+ messages in thread
From: Avi Kivity @ 2009-05-17 18:48 UTC (permalink / raw)
To: Jaswinder Singh Rajput
Cc: Ingo Molnar, x86 maintainers, kvm, linux-kernel, Andi Kleen
Jaswinder Singh Rajput wrote:
> If this patch looks sane to you can apply in kvm tree.
>
> Here is the updated patch based on kvm tree:
>
> [PATCH] x86: kvm replace MSR_IA32_TIME_STAMP_COUNTER with MSR_IA32_TSC of msr-index.h
>
> Use standard msr-index.h's MSR declaration.
>
> MSR_IA32_TSC is better than MSR_IA32_TIME_STAMP_COUNTER as it also solves
> 80 column issue.
>
Applied, thanks.
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH -v3] KVM: MCE: Add MCE support to KVM
2009-05-11 8:48 [PATCH -v3] KVM: MCE: Add MCE support to KVM Huang Ying
2009-05-11 9:05 ` Jaswinder Singh Rajput
@ 2009-05-17 18:56 ` Avi Kivity
2009-05-25 17:40 ` Jan Kiszka
1 sibling, 1 reply; 17+ messages in thread
From: Avi Kivity @ 2009-05-17 18:56 UTC (permalink / raw)
To: Huang Ying; +Cc: kvm, linux-kernel, Andi Kleen
Huang Ying wrote:
> The related MSRs are emulated. MCE capability is exported via
> extension KVM_CAP_MCE and ioctl KVM_X86_GET_MCE_CAP_SUPPORTED. A new
> vcpu ioctl command KVM_X86_SETUP_MCE is used to setup MCE emulation
> such as the mcg_cap. MCE is injected via vcpu ioctl command
> KVM_X86_SET_MCE. Extended machine-check state (MCG_EXT_P) and CMCI are
> not implemented.
>
>
Applied, thanks.
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH -tip] x86: kvm/x86.c use MSR names in place of address
2009-05-14 5:30 ` [PATCH -tip] x86: kvm/x86.c use MSR names in place of address Jaswinder Singh Rajput
2009-05-14 6:27 ` [PATCH -tip] x86: kvm replace MSR_IA32_TIME_STAMP_COUNTER with MSR_IA32_TSC of msr-index.h Jaswinder Singh Rajput
2009-05-15 13:13 ` [PATCH -tip] x86: kvm/x86.c use MSR names in place of address Jaswinder Singh Rajput
@ 2009-05-17 18:57 ` Avi Kivity
2 siblings, 0 replies; 17+ messages in thread
From: Avi Kivity @ 2009-05-17 18:57 UTC (permalink / raw)
To: Jaswinder Singh Rajput
Cc: Huang Ying, Ingo Molnar, x86 maintainers, kvm, linux-kernel, Andi Kleen
Jaswinder Singh Rajput wrote:
> [PATCH -tip] x86: kvm/x86.c use MSR names in place of address
>
> Replace 0xc0010010 with MSR_K8_SYSCFG and 0xc0010015 with MSR_K7_HWCR.
>
>
Applied, thanks.
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH -tip] x86: kvm replace MSR_IA32_TIME_STAMP_COUNTER with MSR_IA32_TSC of msr-index.h
2009-05-17 18:48 ` Avi Kivity
@ 2009-05-20 8:12 ` Jaswinder Singh Rajput
2009-05-20 11:47 ` Avi Kivity
0 siblings, 1 reply; 17+ messages in thread
From: Jaswinder Singh Rajput @ 2009-05-20 8:12 UTC (permalink / raw)
To: Avi Kivity; +Cc: Ingo Molnar, x86 maintainers, kvm, linux-kernel, Andi Kleen
Hello Avi,
On Sun, 2009-05-17 at 21:48 +0300, Avi Kivity wrote:
> Jaswinder Singh Rajput wrote:
> > If this patch looks sane to you can apply in kvm tree.
> >
> > Here is the updated patch based on kvm tree:
> >
> > [PATCH] x86: kvm replace MSR_IA32_TIME_STAMP_COUNTER with MSR_IA32_TSC of msr-index.h
> >
> > Use standard msr-index.h's MSR declaration.
> >
> > MSR_IA32_TSC is better than MSR_IA32_TIME_STAMP_COUNTER as it also solves
> > 80 column issue.
> >
>
> Applied, thanks.
>
BTW, where you applied this patch.
git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm.git is still
showing old data.
Thanks,
--
JSR
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH -tip] x86: kvm replace MSR_IA32_TIME_STAMP_COUNTER with MSR_IA32_TSC of msr-index.h
2009-05-20 8:12 ` Jaswinder Singh Rajput
@ 2009-05-20 11:47 ` Avi Kivity
0 siblings, 0 replies; 17+ messages in thread
From: Avi Kivity @ 2009-05-20 11:47 UTC (permalink / raw)
To: Jaswinder Singh Rajput
Cc: Ingo Molnar, x86 maintainers, kvm, linux-kernel, Andi Kleen
Jaswinder Singh Rajput wrote:
> BTW, where you applied this patch.
>
> git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm.git is still
> showing old data.
>
>
Sometimes things find their way into the queue branch.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH -v3] KVM: MCE: Add MCE support to KVM
2009-05-17 18:56 ` [PATCH -v3] KVM: MCE: Add MCE support to KVM Avi Kivity
@ 2009-05-25 17:40 ` Jan Kiszka
2009-05-25 18:09 ` Avi Kivity
0 siblings, 1 reply; 17+ messages in thread
From: Jan Kiszka @ 2009-05-25 17:40 UTC (permalink / raw)
To: Avi Kivity; +Cc: Huang Ying, kvm, linux-kernel, Andi Kleen
Avi Kivity wrote:
> Huang Ying wrote:
>> The related MSRs are emulated. MCE capability is exported via
>> extension KVM_CAP_MCE and ioctl KVM_X86_GET_MCE_CAP_SUPPORTED. A new
>> vcpu ioctl command KVM_X86_SETUP_MCE is used to setup MCE emulation
>> such as the mcg_cap. MCE is injected via vcpu ioctl command
>> KVM_X86_SET_MCE. Extended machine-check state (MCG_EXT_P) and CMCI are
>> not implemented.
>>
>>
>
> Applied, thanks.
>
This patch breaks kvm build for 32-bit hosts.
Is the KVM MCE interface completely or only partially limited to x86-64,
ie. can I completely #ifdef it away on 32-bit hosts (including
KVM_CAP_MCE) or is this more complicated?
Jan
--
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH -v3] KVM: MCE: Add MCE support to KVM
2009-05-25 17:40 ` Jan Kiszka
@ 2009-05-25 18:09 ` Avi Kivity
2009-05-25 18:15 ` Jan Kiszka
0 siblings, 1 reply; 17+ messages in thread
From: Avi Kivity @ 2009-05-25 18:09 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Huang Ying, kvm, linux-kernel, Andi Kleen
Jan Kiszka wrote:
> Avi Kivity wrote:
>
>> Huang Ying wrote:
>>
>>> The related MSRs are emulated. MCE capability is exported via
>>> extension KVM_CAP_MCE and ioctl KVM_X86_GET_MCE_CAP_SUPPORTED. A new
>>> vcpu ioctl command KVM_X86_SETUP_MCE is used to setup MCE emulation
>>> such as the mcg_cap. MCE is injected via vcpu ioctl command
>>> KVM_X86_SET_MCE. Extended machine-check state (MCG_EXT_P) and CMCI are
>>> not implemented.
>>>
>>>
>>>
>> Applied, thanks.
>>
>>
>
> This patch breaks kvm build for 32-bit hosts.
>
Strange, I build-test on i386. What's your failure?
> Is the KVM MCE interface completely or only partially limited to x86-64,
> ie. can I completely #ifdef it away on 32-bit hosts (including
> KVM_CAP_MCE) or is this more complicated?
>
I don't see any reason to limit it to x86_64?
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH -v3] KVM: MCE: Add MCE support to KVM
2009-05-25 18:09 ` Avi Kivity
@ 2009-05-25 18:15 ` Jan Kiszka
2009-05-25 18:20 ` Jan Kiszka
0 siblings, 1 reply; 17+ messages in thread
From: Jan Kiszka @ 2009-05-25 18:15 UTC (permalink / raw)
To: Avi Kivity; +Cc: Huang Ying, kvm, linux-kernel, Andi Kleen
Avi Kivity wrote:
> Jan Kiszka wrote:
>> Avi Kivity wrote:
>>
>>> Huang Ying wrote:
>>>
>>>> The related MSRs are emulated. MCE capability is exported via
>>>> extension KVM_CAP_MCE and ioctl KVM_X86_GET_MCE_CAP_SUPPORTED. A new
>>>> vcpu ioctl command KVM_X86_SETUP_MCE is used to setup MCE emulation
>>>> such as the mcg_cap. MCE is injected via vcpu ioctl command
>>>> KVM_X86_SET_MCE. Extended machine-check state (MCG_EXT_P) and CMCI are
>>>> not implemented.
>>>>
>>>>
>>> Applied, thanks.
>>>
>>>
>>
>> This patch breaks kvm build for 32-bit hosts.
>>
>
> Strange, I build-test on i386. What's your failure?
This is against some 2.6.28 kernel:
CC [M] /data/kvm-kmod/x86/x86.o
/data/kvm-kmod/x86/x86.c: In function ‘set_msr_mce’:
/data/kvm-kmod/x86/x86.c:794: error: ‘MCG_CTL_P’ undeclared (first use in this function)
/data/kvm-kmod/x86/x86.c:794: error: (Each undeclared identifier is reported only once
/data/kvm-kmod/x86/x86.c:794: error: for each function it appears in.)
/data/kvm-kmod/x86/x86.c: In function ‘get_msr_mce’:
/data/kvm-kmod/x86/x86.c:950: error: ‘MCG_CTL_P’ undeclared (first use in this function)
/data/kvm-kmod/x86/x86.c: In function ‘kvm_arch_dev_ioctl’:
/data/kvm-kmod/x86/x86.c:1216: error: ‘MCG_CTL_P’ undeclared (first use in this function)
/data/kvm-kmod/x86/x86.c: In function ‘kvm_vcpu_ioctl_x86_setup_mce’:
/data/kvm-kmod/x86/x86.c:1592: error: ‘MCG_CTL_P’ undeclared (first use in this function)
/data/kvm-kmod/x86/x86.c: In function ‘kvm_vcpu_ioctl_x86_set_mce’:
/data/kvm-kmod/x86/x86.c:1613: error: ‘MCI_STATUS_VAL’ undeclared (first use in this function)
/data/kvm-kmod/x86/x86.c:1619: error: ‘MCI_STATUS_UC’ undeclared (first use in this function)
/data/kvm-kmod/x86/x86.c:1619: error: ‘MCG_CTL_P’ undeclared (first use in this function)
/data/kvm-kmod/x86/x86.c:1630: error: ‘MCG_STATUS_MCIP’ undeclared (first use in this function)
/data/kvm-kmod/x86/x86.c:1639: error: ‘MCI_STATUS_OVER’ undeclared (first use in this function)
>
>> Is the KVM MCE interface completely or only partially limited to x86-64,
>> ie. can I completely #ifdef it away on 32-bit hosts (including
>> KVM_CAP_MCE) or is this more complicated?
>>
>
> I don't see any reason to limit it to x86_64?
>
Well, if I look at the definition of MCI_STATUS_VAL as (1UL<<63),
something tells me: "Hey, only use me on 64-bit hosts!" But I have no
clue about details of this stuff, and from a second glance at it is
seems to include at least some parts that are valid on 32-bit as well.
Jan
--
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH -v3] KVM: MCE: Add MCE support to KVM
2009-05-25 18:15 ` Jan Kiszka
@ 2009-05-25 18:20 ` Jan Kiszka
2009-05-26 8:11 ` Avi Kivity
0 siblings, 1 reply; 17+ messages in thread
From: Jan Kiszka @ 2009-05-25 18:20 UTC (permalink / raw)
To: Avi Kivity; +Cc: Huang Ying, kvm, linux-kernel, Andi Kleen
Jan Kiszka wrote:
> Avi Kivity wrote:
>> Jan Kiszka wrote:
>>> Avi Kivity wrote:
>>>
>>>> Huang Ying wrote:
>>>>
>>>>> The related MSRs are emulated. MCE capability is exported via
>>>>> extension KVM_CAP_MCE and ioctl KVM_X86_GET_MCE_CAP_SUPPORTED. A new
>>>>> vcpu ioctl command KVM_X86_SETUP_MCE is used to setup MCE emulation
>>>>> such as the mcg_cap. MCE is injected via vcpu ioctl command
>>>>> KVM_X86_SET_MCE. Extended machine-check state (MCG_EXT_P) and CMCI are
>>>>> not implemented.
>>>>>
>>>>>
>>>> Applied, thanks.
>>>>
>>>>
>>> This patch breaks kvm build for 32-bit hosts.
>>>
>> Strange, I build-test on i386. What's your failure?
>
> This is against some 2.6.28 kernel:
>
> CC [M] /data/kvm-kmod/x86/x86.o
> /data/kvm-kmod/x86/x86.c: In function ‘set_msr_mce’:
> /data/kvm-kmod/x86/x86.c:794: error: ‘MCG_CTL_P’ undeclared (first use in this function)
> /data/kvm-kmod/x86/x86.c:794: error: (Each undeclared identifier is reported only once
> /data/kvm-kmod/x86/x86.c:794: error: for each function it appears in.)
> /data/kvm-kmod/x86/x86.c: In function ‘get_msr_mce’:
> /data/kvm-kmod/x86/x86.c:950: error: ‘MCG_CTL_P’ undeclared (first use in this function)
> /data/kvm-kmod/x86/x86.c: In function ‘kvm_arch_dev_ioctl’:
> /data/kvm-kmod/x86/x86.c:1216: error: ‘MCG_CTL_P’ undeclared (first use in this function)
> /data/kvm-kmod/x86/x86.c: In function ‘kvm_vcpu_ioctl_x86_setup_mce’:
> /data/kvm-kmod/x86/x86.c:1592: error: ‘MCG_CTL_P’ undeclared (first use in this function)
> /data/kvm-kmod/x86/x86.c: In function ‘kvm_vcpu_ioctl_x86_set_mce’:
> /data/kvm-kmod/x86/x86.c:1613: error: ‘MCI_STATUS_VAL’ undeclared (first use in this function)
> /data/kvm-kmod/x86/x86.c:1619: error: ‘MCI_STATUS_UC’ undeclared (first use in this function)
> /data/kvm-kmod/x86/x86.c:1619: error: ‘MCG_CTL_P’ undeclared (first use in this function)
> /data/kvm-kmod/x86/x86.c:1630: error: ‘MCG_STATUS_MCIP’ undeclared (first use in this function)
> /data/kvm-kmod/x86/x86.c:1639: error: ‘MCI_STATUS_OVER’ undeclared (first use in this function)
>
>>> Is the KVM MCE interface completely or only partially limited to x86-64,
>>> ie. can I completely #ifdef it away on 32-bit hosts (including
>>> KVM_CAP_MCE) or is this more complicated?
>>>
>> I don't see any reason to limit it to x86_64?
>>
>
> Well, if I look at the definition of MCI_STATUS_VAL as (1UL<<63),
> something tells me: "Hey, only use me on 64-bit hosts!" But I have no
> clue about details of this stuff, and from a second glance at it is
> seems to include at least some parts that are valid on 32-bit as well.
Ah, interesting: /someone/ removed the #ifdef __x86_64__ from
arch/x86/include/asm/mce.h, but that's not mainline yet...
Jan
--
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH -v3] KVM: MCE: Add MCE support to KVM
2009-05-25 18:20 ` Jan Kiszka
@ 2009-05-26 8:11 ` Avi Kivity
0 siblings, 0 replies; 17+ messages in thread
From: Avi Kivity @ 2009-05-26 8:11 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Huang Ying, kvm, linux-kernel, Andi Kleen
Jan Kiszka wrote:
>> Well, if I look at the definition of MCI_STATUS_VAL as (1UL<<63),
>> something tells me: "Hey, only use me on 64-bit hosts!" But I have no
>> clue about details of this stuff, and from a second glance at it is
>> seems to include at least some parts that are valid on 32-bit as well.
>>
>
> Ah, interesting: /someone/ removed the #ifdef __x86_64__ from
> arch/x86/include/asm/mce.h, but that's not mainline yet...
>
Well that someone missed the MCI_STATUS_VAL bit. Do you see anything
else fishy in there?
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2009-05-26 8:12 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-11 8:48 [PATCH -v3] KVM: MCE: Add MCE support to KVM Huang Ying
2009-05-11 9:05 ` Jaswinder Singh Rajput
2009-05-11 9:08 ` Huang Ying
2009-05-14 5:30 ` [PATCH -tip] x86: kvm/x86.c use MSR names in place of address Jaswinder Singh Rajput
2009-05-14 6:27 ` [PATCH -tip] x86: kvm replace MSR_IA32_TIME_STAMP_COUNTER with MSR_IA32_TSC of msr-index.h Jaswinder Singh Rajput
2009-05-15 13:12 ` Jaswinder Singh Rajput
2009-05-17 18:48 ` Avi Kivity
2009-05-20 8:12 ` Jaswinder Singh Rajput
2009-05-20 11:47 ` Avi Kivity
2009-05-15 13:13 ` [PATCH -tip] x86: kvm/x86.c use MSR names in place of address Jaswinder Singh Rajput
2009-05-17 18:57 ` Avi Kivity
2009-05-17 18:56 ` [PATCH -v3] KVM: MCE: Add MCE support to KVM Avi Kivity
2009-05-25 17:40 ` Jan Kiszka
2009-05-25 18:09 ` Avi Kivity
2009-05-25 18:15 ` Jan Kiszka
2009-05-25 18:20 ` Jan Kiszka
2009-05-26 8:11 ` Avi Kivity
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).