Skip to contentSkip to conversation

Limit MTRR virtualization for VMX guests to 8 registers

PATCH In review Nitin A Kamble 2 participants 3 messages Apr 16, 2009 – Apr 17, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Limit MTRR virtualization for VMX guests to 8 registers

Hi Keir,
Bellow is the patch for xen-unstable tree which limits MTRR
virtualization for VMX guests to 8 registers. Please comment/Apply.

Thanks & Regards,
Nitin

# HG changeset patch
# User Nitin A Kamble <[email protected]> # Date 1239916751 25200
# Branch mtrrcap_fix_for_guest
# Node ID 276c1008200895845f47fe61dd9e42e47dbbc772 # Parent 120d3c67951bac0f4c31b0b828500ee6ac23b0b4 Limit MTRR virtualization to 8 registers for VMX guests.

xen/arch/x86/cpu/mtrr/generic.c +5 -0
diff -r 120d3c67951b -r 276c10082008 xen/arch/x86/cpu/mtrr/generic.c
@@ -55,6 +55,7 @@ void mtrr_save_fixed_ranges(void *info)
 }
 
 /*  Grab all of the MTRR state for this CPU into *state  */
+/* This function is called only for Intel processors */
 void __init get_mtrr_state(void)
 {
 	unsigned int i;
@@ -83,6 +84,10 @@ void __init get_mtrr_state(void)
 
 	/* Store mtrr_cap for HVM MTRR virtualisation. */
 	rdmsrl(MTRRcap_MSR, mtrr_state.mtrr_cap);
+
+	/* Virtualization of max 8 MTRRs is supported */
+	if ((mtrr_state.mtrr_cap & 0xff) > 8)
+		mtrr_state.mtrr_cap = (mtrr_state.mtrr_cap & ~0xff) | 0x8;
 }
 
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 3 lines · Nitin A Kamble

Hi Keir,
Bellow is the patch for xen-unstable tree which limits MTRR virtualization
for VMX guests to 8 registers. Please comment/Apply.

mtrr_state.mtrr_cap isn't directly plumbed to guests. Guests get their own hardcoded virtualised value for mtrr_cap, set up in arch/x86/hvm/mtrr.c. The physical mtrr_state.mtrr_cap is only used for interpreting physical MTRR info as part of PAT/MTRR virtualisation. So all looks correct to me as is.

-- Keir

#2 lore raw

Keir,
You are right. The problem I was trying to fix was observed on RHEL5.3 Xen, and I don't see that issue with the xen-unstable tree.

Thanks & Regards,
Nitin
Linux Open Source Technology Center, Intel Corporation
----------------------------------------------------------------------------
The Mind is like a parachute; it works much better when it's open.

Quoted 22 lines

-----Original Message-----
From: Keir Fraser [mailto:[email protected]]
Sent: Friday, April 17, 2009 1:05 AM
To: Kamble, Nitin A; [email protected]
Subject: Re: [Patch] [HVM] Limit MTRR virtualization for VMX guests to 8 registers

Quoted 2 lines · Nitin A Kamble

Hi Keir,
Bellow is the patch for xen-unstable tree which limits MTRR

virtualization

Quoted 1 line

for VMX guests to 8 registers. Please comment/Apply.

mtrr_state.mtrr_cap isn't directly plumbed to guests. Guests get their own hardcoded virtualised value for mtrr_cap, set up in arch/x86/hvm/mtrr.c. The
physical mtrr_state.mtrr_cap is only used for interpreting physical MTRR info as part of PAT/MTRR virtualisation. So all looks correct to me as is.

-- Keir