|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v3 6/6] x86/msr: handle VMX MSRs with guest_rd/wrmsr()
On 13/10/17 13:35, Sergey Dyasli wrote:
> diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
> index a22e3dfaf2..2527fdd1d1 100644
> --- a/xen/arch/x86/msr.c
> +++ b/xen/arch/x86/msr.c
> @@ -426,6 +426,13 @@ int init_vcpu_msr_policy(struct vcpu *v)
> return 0;
> }
>
> +#define vmx_guest_rdmsr(dp, name, msr) \
> + case name: \
> + if ( !dp->msr.available ) \
> + goto gp_fault; \
> + *val = dp->msr.u.raw; \
> + break;
Eww :(
For blocks of MSRs, it would be far better to go with the same structure
as the cpuid policy. Something like:
struct {
union {
uint64_t raw[NR_VMX_MSRS];
struct {
struct {
...
} basic;
struct {
...
} pinbased_ctls;
};
};
} vmx;
This way, the guest_rdmsr() will be far more efficient.
case MSR_IA32_VMX_BASIC ... xxx:
if ( !cpuid->basic.vmx )
goto gp_fault;
*val = dp->vmx.raw[msr - MSR_IA32_VMX_BASIC];
break;
It would probably be worth splitting into a couple of different blocks
based on the different availability checks.
~Andrew
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |