Cleanup some mis-operation of full 64 bits VMCS fields in 32 bits VMM. Signed-off-by: Eddie Dong <eddie.dong@intel.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2006-Jul-05 14:44 UTC
Re: [Xen-devel] [PATCh] Full 64 bits VMCS field operation
On 5 Jul 2006, at 15:04, Dong, Eddie wrote:> Cleanup some mis-operation of full 64 bits VMCS fields in 32 bits VMM.From VMWRITE description in Intel Reference Manual Volume 2: "If the VMCS field specified by the secondary source operand is shorter than this effective operand size, the high bits of the primary source operand are ignored. If the VMCS field is longer, then the high bits of the field are cleared to 0." Also from 20.10.1 of Volume 3: "64-bit fields and natural-width fields using the full access type outside IA-32e mode.—A VMWRITE writes the value of its source operand to bits31:0 of the field and clears bits63:32 of the field. " So your patch should be entirely unnecessary. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Dong, Eddie
2006-Jul-06 02:21 UTC
RE: [Xen-devel] [PATCh] Full 64 bits VMCS field operation
Keir Fraser wrote:> On 5 Jul 2006, at 15:04, Dong, Eddie wrote: > >> Cleanup some mis-operation of full 64 bits VMCS fields in 32 bits >> VMM. > > From VMWRITE description in Intel Reference Manual Volume 2: > "If the VMCS field specified by the secondary source operand is > shorter than this effective operand size, the high bits of the > primary source operand are ignored. If the VMCS field is longer, then > the high bits of the field are cleared to 0." >OK, for those always "0" bits, it is safe. For virt_to_maddr(io_bitmap_a), it is within low 32 bits today, but it may exceed 4G in PAE case when Xen in future is moved to high end memory for some usage model. How about following one? Anyway, it is really a minor one. Eddie diff -r c5088f03390f xen/arch/x86/hvm/vmx/vmcs.c --- a/xen/arch/x86/hvm/vmx/vmcs.c Wed Jul 05 15:47:01 2006 +0800 +++ b/xen/arch/x86/hvm/vmx/vmcs.c Thu Jul 06 10:20:23 2006 +0800 @@ -151,7 +151,11 @@ static inline int construct_vmcs_control error |= __vmwrite(IO_BITMAP_A, (u64) virt_to_maddr(io_bitmap_a)); error |= __vmwrite(IO_BITMAP_B, (u64) virt_to_maddr(io_bitmap_b)); - +#if defined (__i386__) + error |= __vmwrite(IO_BITMAP_A_HIGH, virt_to_maddr(io_bitmap_a)>>32); + error |= __vmwrite(IO_BITMAP_B_HIGH, virt_to_maddr(io_bitmap_b)>>32); +#endif + arch_vmx->io_bitmap_a = io_bitmap_a; arch_vmx->io_bitmap_b = io_bitmap_b; @@ -376,8 +380,10 @@ static inline int construct_init_vmcs_gu error |= __vmwrite(GUEST_INTERRUPTIBILITY_INFO, 0); __asm__ __volatile__ ("mov %%dr7, %0\n" : "=r" (dr7)); error |= __vmwrite(GUEST_DR7, dr7); - error |= __vmwrite(VMCS_LINK_POINTER, 0xffffffff); - error |= __vmwrite(VMCS_LINK_POINTER_HIGH, 0xffffffff); + error |= __vmwrite(VMCS_LINK_POINTER, -1UL); +#if defined (__i386__) + error |= __vmwrite(VMCS_LINK_POINTER_HIGH, -1UL); +#endif return error; } _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel