From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keir Fraser Subject: Re: Re: [PATCH] Replace bios_relocate hook with bios_load hook in hvmloader Date: Wed, 27 Jul 2011 08:10:34 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Bei Guan , Keir Fraser Cc: Xen Devel , Jordan Justen , Tim Deegan , Andrei Warkentin List-Id: xen-devel@lists.xenproject.org On 27/07/2011 03:02, "Bei Guan" wrote: >=20 >=20 > 2011/7/25 Keir Fraser >> On 23/07/2011 20:02, "Bei Guan" wrote: >>=20 >>> Hi, >>>=20 >>> These set of patches are affected by replacing bios_relocate hook with >>> bios_load hook in hvmloader. The patches for code files config.h and >>> hvmloader.c also contains part of the contents of Enabling UEFI BIOS(OV= MF) >>> support in Xen-unstable HVM. Is there any problem with these patches? T= hank >>> you very much. >>=20 >> As of xen-unstable:23745 I've made some improvements to hvmloader which >> include your new bios_load hook. You can rebase your remaining patches o= n >> top of that. > Thank you very much.=A0 > I am looking forward to the new xen-unstable version:=A023745. http://xenbits.xen.org/staging/xen-unstable.hg > Best Regards,=A0 > Bei Guan >=20 >>=20 >> =A0-- Keir >>=20 >>>=20 >>>=20 >>> # HG changeset patch >>> # User gbtju85@gmail.com >>> # >>>=20 >>> Replace bios_relocate hook with bios_load hook in hvmloader. >>> This patch also contains part of the contents of Enabling UEFI BIOS(OVM= F) >>> support in Xen-unstable HVM >>>=20 >>> Sign-off-by: Bei Guan >>>=20 >>> diff -r 42edf1481c57 tools/firmware/hvmloader/config.h >>> --- a/tools/firmware/hvmloader/config.h Fri Jul 22 08:55:19 2011 +0100 >>> +++ b/tools/firmware/hvmloader/config.h Sun Jul 24 02:22:42 2011 +0800 >>> @@ -3,7 +3,7 @@ >>> =A0 >>> =A0#include >>> =A0 >>> -enum virtual_vga { VGA_none, VGA_std, VGA_cirrus, VGA_pt }; >>> +enum virtual_vga { VGA_none, VGA_std, VGA_cirrus, VGA_pt, VGA_custom }= ; >>> =A0extern enum virtual_vga virtual_vga; >>> =A0 >>> =A0struct bios_config { >>> @@ -16,6 +16,9 @@ >>> =A0 =A0 =A0/* Physical address to load at */ >>> =A0 =A0 =A0unsigned int bios_address; >>> =A0 >>> + =A0 =A0/* Custom load function. */ >>> + =A0 =A0void (*load)(const struct bios_config *config); >>> + >>> =A0 =A0 =A0/* ROMS */ >>> =A0 =A0 =A0int load_roms; >>> =A0 =A0 =A0unsigned int optionrom_start, optionrom_end; >>> @@ -23,8 +26,6 @@ >>> =A0 =A0 =A0void (*bios_info_setup)(void); >>> =A0 =A0 =A0void (*bios_info_finish)(void); >>> =A0 >>> - =A0 =A0void (*bios_relocate)(void); >>> - >>> =A0 =A0 =A0void (*vm86_setup)(void); >>> =A0 =A0 =A0void (*e820_setup)(void); >>> =A0 >>> @@ -36,6 +37,8 @@ >>> =A0 >>> =A0extern struct bios_config rombios_config; >>> =A0extern struct bios_config seabios_config; >>> +extern struct bios_config ovmf32_config; >>> +extern struct bios_config ovmf64_config; >>> =A0 >>> =A0#define PAGE_SHIFT 12 >>> =A0#define PAGE_SIZE =A0(1ul << PAGE_SHIFT) >>> diff -r 42edf1481c57 tools/firmware/hvmloader/hvmloader.c >>> --- a/tools/firmware/hvmloader/hvmloader.c Fri Jul 22 08:55:19 2011 +01= 00 >>> +++ b/tools/firmware/hvmloader/hvmloader.c Sun Jul 24 02:22:42 2011 +08= 00 >>> @@ -360,6 +360,8 @@ >>> =A0#ifdef ENABLE_SEABIOS >>> =A0 =A0 =A0{ "seabios", &seabios_config, }, >>> =A0#endif >>> + =A0 =A0{ "ovmf-ia32", &ovmf32_config, }, >>> + =A0 =A0{ "ovmf-x64", &ovmf64_config, }, >>> =A0 =A0 =A0{ NULL, NULL } >>> =A0}; >>> =A0 >>> @@ -416,12 +418,13 @@ >>> =A0 =A0 =A0 =A0 =A0bios->create_smbios_tables(); >>> =A0 =A0 =A0} >>> =A0 >>> - =A0 =A0printf("Loading %s ...\n", bios->name); >>> - =A0 =A0memcpy((void *)bios->bios_address, bios->image, >>> - =A0 =A0 =A0 =A0 =A0 bios->image_size); >>> - >>> - =A0 =A0if (bios->bios_relocate) >>> - =A0 =A0 =A0 =A0bios->bios_relocate(); >>> + =A0 =A0if (bios->load) { >>> + =A0 =A0 =A0 =A0bios->load(bios); >>> + =A0 =A0} else { >>> + =A0 =A0 =A0 =A0printf("Loading %s ...\n", bios->name); >>> + =A0 =A0 =A0 =A0memcpy((void *)bios->bios_address, bios->image, >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 bios->image_size); >>> + =A0 =A0} >>> =A0 >>> =A0 =A0 =A0if ( (hvm_info->nr_vcpus > 1) || hvm_info->apic_mode ) { >>> =A0 =A0 =A0 =A0 =A0if ( bios->create_mp_tables ) >>> @@ -451,6 +454,8 @@ >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0vgabios_sz =3D round_option_rom( >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(*(uint8_t *)(VGABIOS_PHYSICAL_ADDRESS+2)) * 512); >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0break; >>> + =A0 =A0 =A0 =A0case VGA_custom: >>> + =A0 =A0 =A0 =A0 =A0 =A0break; >>> =A0 =A0 =A0 =A0 =A0default: >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0printf("No emulated VGA adaptor ...\n"); >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0break; >>> diff -r 42edf1481c57 tools/firmware/hvmloader/rombios.c >>> --- a/tools/firmware/hvmloader/rombios.c Fri Jul 22 08:55:19 2011 +0100 >>> +++ b/tools/firmware/hvmloader/rombios.c Sun Jul 24 02:22:42 2011 +0800 >>> @@ -81,11 +81,15 @@ >>> =A0 =A0 =A0memset(info, 0, sizeof(*info)); >>> =A0} >>> =A0 >>> -static void rombios_relocate(void) >>> +static void rombios_load(const struct bios_config *config) >>> =A0{ >>> =A0 =A0 =A0uint32_t bioshigh; >>> =A0 =A0 =A0struct rombios_info *info; >>> =A0 >>> + =A0 =A0printf("Loading %s ...\n", config->name); >>> + =A0 =A0memcpy((void *)config->bios_address, config->image, >>> + =A0 =A0 =A0 =A0 =A0 config->image_size); >>> + >>> =A0 =A0 =A0bioshigh =3D rombios_highbios_setup(); >>> =A0 >>> =A0 =A0 =A0info =3D (struct rombios_info *)BIOS_INFO_PHYSICAL_ADDRESS; >>> @@ -163,6 +167,7 @@ >>> =A0 =A0 =A0.image_size =3D sizeof(rombios), >>> =A0 >>> =A0 =A0 =A0.bios_address =3D ROMBIOS_PHYSICAL_ADDRESS, >>> + =A0 =A0.load =3D rombios_load, >>> =A0 >>> =A0 =A0 =A0.load_roms =3D 1, >>> =A0 >>> @@ -172,8 +177,6 @@ >>> =A0 =A0 =A0.bios_info_setup =3D rombios_setup_bios_info, >>> =A0 =A0 =A0.bios_info_finish =3D NULL, >>> =A0 >>> - =A0 =A0.bios_relocate =3D rombios_relocate, >>> - >>> =A0 =A0 =A0.vm86_setup =3D rombios_init_vm86_tss, >>> =A0 =A0 =A0.e820_setup =3D rombios_setup_e820, >>> =A0 >>> diff -r 42edf1481c57 tools/firmware/hvmloader/seabios.c >>> --- a/tools/firmware/hvmloader/seabios.c Fri Jul 22 08:55:19 2011 +0100 >>> +++ b/tools/firmware/hvmloader/seabios.c Sun Jul 24 02:22:42 2011 +0800 >>> @@ -132,6 +132,7 @@ >>> =A0 =A0 =A0.image_size =3D sizeof(seabios), >>> =A0 >>> =A0 =A0 =A0.bios_address =3D SEABIOS_PHYSICAL_ADDRESS, >>> + =A0 =A0.load =3D NULL, >>> =A0 >>> =A0 =A0 =A0.load_roms =3D 0, >>> =A0 >>> @@ -141,8 +142,6 @@ >>> =A0 =A0 =A0.bios_info_setup =3D seabios_setup_bios_info, >>> =A0 =A0 =A0.bios_info_finish =3D seabios_finish_bios_info, >>> =A0 >>> - =A0 =A0.bios_relocate =3D NULL, >>> - >>> =A0 =A0 =A0.vm86_setup =3D NULL, >>> =A0 =A0 =A0.e820_setup =3D seabios_setup_e820, >>> =A0 >>>=20 >>>=20 >>>=20 >>>=20 >>> Best Regards, >>> Bei Guan >>>=20 >>>=20 >>>=20 >>>=20 >>> 2011/7/24 Keir Fraser >>>> On 23/07/2011 16:18, "Bei Guan" wrote: >>>>=20 >>>>> Do you mean that put the bios_relocate hook in the "else" statement? = Just >>>>> like >>>>> this: >>>>>=20 >>>>> =A0 =A0 if (bios->load) { >>>>> =A0 =A0 =A0 =A0 bios->load(bios); >>>>> =A0 =A0 } else { >>>>> =A0 =A0 =A0 =A0 printf("Loading %s ...\n", bios->name); >>>>> =A0 =A0 =A0 =A0 memcpy((void *)bios->bios_address, bios->image, >>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0bios->image_size); >>>>>=20 >>>>> =A0 =A0 =A0 =A0 if (bios->bios_relocate) >>>>> =A0 =A0 =A0 =A0 =A0 =A0 bios->bios_relocate();=A0 >>>>> =A0=A0 } >>>>=20 >>>> No I mean remove the bios_relocate hook entirely, and modify the rombi= os >>>> handler to use your new hook instead. It should be quite easy. >>>>=20 >>>> =A0-- Keir >>>>=20 >>>>=20 >>>=20 >>>=20 >>=20 >>=20 >>=20 >> _______________________________________________ >> Xen-devel mailing list >> Xen-devel@lists.xensource.com >> http://lists.xensource.com/xen-devel >=20 >=20