From: Mark Johnson Subject: Re: [Xen-changelog] [xen-unstable] tboot: fix tboot memory mapping for 32b Date: Tue, 22 Sep 2009 07:34:38 -0400 Message-ID: <521a4d120909220434wb727c71u69299561202c8f26@mail.gmail.com> References: <200909220825.n8M8PX4R018629@xenbits.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <200909220825.n8M8PX4R018629@xenbits.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On Tue, Sep 22, 2009 at 4:25 AM, Xen patchbot-unstable wrote: > # HG changeset patch > # User Keir Fraser > # Date 1253605000 -3600 > # Node ID bcb6b95b30b13efa9635f8b8e1b7ff57c50dae3d > # Parent =A0be747c582738035889d5f3f9d40051818e1af50e > tboot: fix tboot memory mapping for 32b > > This patch used fixmap to get TXT heap base/size and SINIT base/size > from TXT pub config registers (whose address starts from 0xfed20000), > and get DMAR table copy from TXT heap (whose address may start from > 0x7d520000) for tboot, instead of using map_pages_to_xen(), which will > cause panic on x86_32. > > Signed-off-by: Shane Wang > --- > =A0xen/arch/x86/tboot.c =A0 =A0 =A0 =A0 | =A0 94 ++++++++++++++++++++++++= ------------------- > =A0xen/include/asm-x86/fixmap.h | =A0 =A01 > =A02 files changed, 54 insertions(+), 41 deletions(-) > > diff -r be747c582738 -r bcb6b95b30b1 xen/arch/x86/tboot.c > --- a/xen/arch/x86/tboot.c =A0 =A0 =A0Tue Sep 22 08:28:26 2009 +0100 > +++ b/xen/arch/x86/tboot.c =A0 =A0 =A0Tue Sep 22 08:36:40 2009 +0100 > @@ -69,12 +69,29 @@ typedef struct __packed { > =A0 =A0 uint32_t =A0 =A0 vtd_dmars_off; > =A0} sinit_mle_data_t; > > +static void tboot_copy_memory(unsigned char *va, uint32_t size, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0unsigned lon= g pa) > +{ > + =A0 =A0uint32_t map_base; > + =A0 =A0unsigned long map_addr; > + =A0 =A0int i; > + > + =A0 =A0map_base =3D 0; > + =A0 =A0for (i =3D 0; i < size; i++) { > + =A0 =A0 =A0 =A0if ( map_base !=3D PFN_DOWN(pa + i) ) { > + =A0 =A0 =A0 =A0 =A0 =A0map_base =3D PFN_DOWN(pa + i); > + =A0 =A0 =A0 =A0 =A0 =A0set_fixmap(FIX_TBOOT_MAP_ADDRESS, map_base << PA= GE_SHIFT); > + =A0 =A0 =A0 =A0 =A0 =A0map_addr =3D (unsigned long)fix_to_virt(FIX_TBOO= T_MAP_ADDRESS); > + =A0 =A0 =A0 =A0} > + =A0 =A0 =A0 =A0*(va + i) =3D *(unsigned char *)(map_addr + pa + i > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 - (map_base << PAGE_SHIFT)); > + =A0 =A0} > +} > + I see the following error with this change.. tboot.c: In function `tboot_copy_memory': tboot.c:76: warning: 'map_addr' might be used uninitialized in this functio= n gmake[5]: *** [tboot.o] Error 1 MRJ