diff mbox

[2/4] Implement Hyper-V MSRs v2

Message ID 1242730443-15656-3-git-send-email-agraf@suse.de (mailing list archive)
State New, archived
Headers show

Commit Message

Alexander Graf May 19, 2009, 10:54 a.m. UTC
Hyper-V uses some MSRs, some of which are actually reserved for BIOS usage.

But let's be nice today and have it its way, because otherwise it fails
terribly.

v2 changes:
  - remove the 0x40000081 MSR definition
  - add pr_unimpl() on unimplemented writes

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/x86/kvm/svm.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Comments

Avi Kivity May 19, 2009, 12:52 p.m. UTC | #1
Alexander Graf wrote:
> Hyper-V uses some MSRs, some of which are actually reserved for BIOS usage.
>
> But let's be nice today and have it its way, because otherwise it fails
> terribly.
>
> v2 changes:
>   - remove the 0x40000081 MSR definition
>   - add pr_unimpl() on unimplemented writes
>
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>  arch/x86/kvm/svm.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index ef43a18..4b4eadd 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -2034,6 +2034,11 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 data)
>  	case MSR_VM_HSAVE_PA:
>  		svm->hsave_msr = data;
>  		break;
> +	case MSR_VM_CR:
> +	case MSR_VM_IGNNE:
> +	case MSR_K8_HWCR:
> +		pr_unimpl(vcpu, "unimplemented wrmsr: 0x%x data 0x%llx\n", ecx, data);
> +		break;
>   

We can be nicer, if the write doesn't set bits which we don't implement, 
we can let it proceed silently.  See for example MSR_IA32_DEBUGCTLMSR.  
Most likely the values written are already correctly implemented (by 
doing nothing).
Alexander Graf June 15, 2009, 11:45 a.m. UTC | #2
On 19.05.2009, at 14:52, Avi Kivity wrote:

> Alexander Graf wrote:
>> Hyper-V uses some MSRs, some of which are actually reserved for  
>> BIOS usage.
>>
>> But let's be nice today and have it its way, because otherwise it  
>> fails
>> terribly.
>>
>> v2 changes:
>>  - remove the 0x40000081 MSR definition
>>  - add pr_unimpl() on unimplemented writes
>>
>> Signed-off-by: Alexander Graf <agraf@suse.de>
>> ---
>> arch/x86/kvm/svm.c |    5 +++++
>> 1 files changed, 5 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
>> index ef43a18..4b4eadd 100644
>> --- a/arch/x86/kvm/svm.c
>> +++ b/arch/x86/kvm/svm.c
>> @@ -2034,6 +2034,11 @@ static int svm_set_msr(struct kvm_vcpu  
>> *vcpu, unsigned ecx, u64 data)
>> 	case MSR_VM_HSAVE_PA:
>> 		svm->hsave_msr = data;
>> 		break;
>> +	case MSR_VM_CR:
>> +	case MSR_VM_IGNNE:
>> +	case MSR_K8_HWCR:
>> +		pr_unimpl(vcpu, "unimplemented wrmsr: 0x%x data 0x%llx\n", ecx,  
>> data);
>> +		break;
>>
>
> We can be nicer, if the write doesn't set bits which we don't  
> implement, we can let it proceed silently.  See for example  
> MSR_IA32_DEBUGCTLMSR.  Most likely the values written are already  
> correctly implemented (by doing nothing).

Actually we implement very little of the bits. See http://support.amd.com/us/Processor_TechDocs/31116-Public-GH-BKDG_3-28_5-28-09.pdf 
  for what we're missing ;-).

So it might make sense to always warn for now, see what OSs use and  
only filter out those bits they actually try to access (and maybe  
implement them).

Alex

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index ef43a18..4b4eadd 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -2034,6 +2034,11 @@  static int svm_set_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 data)
 	case MSR_VM_HSAVE_PA:
 		svm->hsave_msr = data;
 		break;
+	case MSR_VM_CR:
+	case MSR_VM_IGNNE:
+	case MSR_K8_HWCR:
+		pr_unimpl(vcpu, "unimplemented wrmsr: 0x%x data 0x%llx\n", ecx, data);
+		break;
 	default:
 		return kvm_set_msr_common(vcpu, ecx, data);
 	}