From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH for-xen-4.5 v4 16/18] x86: move HDD data to boot_info Date: Fri, 17 Oct 2014 23:57:48 +0100 Message-ID: <54419EEC.9060006@citrix.com> References: <1413555132-22138-1-git-send-email-daniel.kiper@oracle.com> <1413555132-22138-17-git-send-email-daniel.kiper@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XfGT2-0000Tr-K7 for xen-devel@lists.xenproject.org; Fri, 17 Oct 2014 22:57:52 +0000 In-Reply-To: <1413555132-22138-17-git-send-email-daniel.kiper@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Daniel Kiper , xen-devel@lists.xenproject.org Cc: jgross@suse.com, keir@xen.org, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, roy.franz@linaro.org, ning.sun@intel.com, jbeulich@suse.com, ross.philipson@citrix.com, qiaowei.ren@intel.com, richard.l.maliszewski@intel.com, gang.wei@intel.com, fu.wei@linaro.org List-Id: xen-devel@lists.xenproject.org On 17/10/2014 15:12, Daniel Kiper wrote: > Signed-off-by: Daniel Kiper After adjusting for previously-expressed issues, Reviewed-by: Andrew Cooper > --- > xen/arch/x86/boot_info.c | 16 ++++++++++++++++ > xen/arch/x86/efi/efi-boot.h | 28 ++++++++++++++-------------- > xen/arch/x86/platform_hypercall.c | 8 ++++---- > xen/arch/x86/setup.c | 6 ++---- > xen/common/efi/runtime.c | 7 +++++++ > xen/include/asm-x86/boot_info.h | 13 +++++++++++++ > xen/include/asm-x86/edd.h | 6 ------ > 7 files changed, 56 insertions(+), 28 deletions(-) > > diff --git a/xen/arch/x86/boot_info.c b/xen/arch/x86/boot_info.c > index 5f990e1..65f9379 100644 > --- a/xen/arch/x86/boot_info.c > +++ b/xen/arch/x86/boot_info.c > @@ -73,6 +73,12 @@ extern struct boot_video_info boot_vid_info; > extern unsigned short boot_edid_caps; > extern unsigned char boot_edid_info[128]; > > +extern struct edd_info boot_edd_info[]; > +extern u8 boot_edd_info_nr; > + > +extern struct mbr_signature boot_mbr_signature[]; > +extern u8 boot_mbr_signature_nr; > + > static boot_info_t __read_mostly boot_info_mb = { > .boot_loader_name = "UNKNOWN", > .cmdline = NULL, > @@ -90,6 +96,10 @@ static boot_info_t __read_mostly boot_info_mb = { > .vga_console_info = {}, > .edid_caps = 0, > .edid_info = NULL, > + .edd_info_nr = 0, > + .edd_info = NULL, > + .mbr_signature_nr = 0, > + .mbr_signature = NULL, > .mods_nr = 0, > .mods = NULL, > .warn_msg = NULL, > @@ -233,6 +243,12 @@ boot_info_t __init *__init_boot_info(u32 mbd_pa) > > init_video_info(&boot_info_mb); > > + boot_info_mb.edd_info_nr = bootsym(boot_edd_info_nr); > + boot_info_mb.edd_info = bootsym(boot_edd_info); > + > + boot_info_mb.mbr_signature_nr = bootsym(boot_mbr_signature_nr); > + boot_info_mb.mbr_signature = bootsym(boot_mbr_signature); > + > boot_info_mb.mods_nr = mbd->mods_nr; > boot_info_mb.mods = __va(mbd->mods); > > diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h > index 8ee3e93..3311e77 100644 > --- a/xen/arch/x86/efi/efi-boot.h > +++ b/xen/arch/x86/efi/efi-boot.h > @@ -325,7 +325,7 @@ static void __init efi_arch_edd(void) > { > EFI_BLOCK_IO *bio; > EFI_DEV_PATH_PTR devp; > - struct edd_info *info = boot_edd_info + boot_edd_info_nr; > + struct edd_info *info = boot_info_efi.edd_info + boot_info_efi.edd_info_nr; > struct edd_device_params *params = &info->edd_device_params; > enum { root, acpi, pci, ctrlr } state = root; > > @@ -334,16 +334,16 @@ static void __init efi_arch_edd(void) > bio->Media->RemovableMedia || > bio->Media->LogicalPartition ) > continue; > - if ( boot_edd_info_nr < EDD_INFO_MAX ) > + if ( boot_info_efi.edd_info_nr < EDD_INFO_MAX ) > { > - info->device = 0x80 + boot_edd_info_nr; /* fake */ > + info->device = 0x80 + boot_info_efi.edd_info_nr; /* fake */ > info->version = 0x11; > params->length = offsetof(struct edd_device_params, dpte_ptr); > params->number_of_sectors = bio->Media->LastBlock + 1; > params->bytes_per_sector = bio->Media->BlockSize; > params->dpte_ptr = ~0; > } > - ++boot_edd_info_nr; > + ++boot_info_efi.edd_info_nr; > status = efi_bs->HandleProtocol(handles[i], &devp_guid, > (void **)&devp); > if ( EFI_ERROR(status) ) > @@ -356,7 +356,7 @@ static void __init efi_arch_edd(void) > const u8 *p; > > case ACPI_DEVICE_PATH: > - if ( state != root || boot_edd_info_nr > EDD_INFO_MAX ) > + if ( state != root || boot_info_efi.edd_info_nr > EDD_INFO_MAX ) > break; > switch ( DevicePathSubType(devp.DevPath) ) > { > @@ -375,7 +375,7 @@ static void __init efi_arch_edd(void) > case HARDWARE_DEVICE_PATH: > if ( state != acpi || > DevicePathSubType(devp.DevPath) != HW_PCI_DP || > - boot_edd_info_nr > EDD_INFO_MAX ) > + boot_info_efi.edd_info_nr > EDD_INFO_MAX ) > break; > state = pci; > edd_put_string(params->host_bus_type, "PCI"); > @@ -383,7 +383,7 @@ static void __init efi_arch_edd(void) > params->interface_path.pci.function = devp.Pci->Function; > break; > case MESSAGING_DEVICE_PATH: > - if ( state != pci || boot_edd_info_nr > EDD_INFO_MAX ) > + if ( state != pci || boot_info_efi.edd_info_nr > EDD_INFO_MAX ) > break; > state = ctrlr; > switch ( DevicePathSubType(devp.DevPath) ) > @@ -432,15 +432,15 @@ static void __init efi_arch_edd(void) > case MEDIA_DEVICE_PATH: > if ( DevicePathSubType(devp.DevPath) == MEDIA_HARDDRIVE_DP && > devp.HardDrive->MBRType == MBR_TYPE_PCAT && > - boot_mbr_signature_nr < EDD_MBR_SIG_MAX ) > + boot_info_efi.mbr_signature_nr < EDD_MBR_SIG_MAX ) > { > - struct mbr_signature *sig = boot_mbr_signature + > - boot_mbr_signature_nr; > + struct mbr_signature *sig = boot_info_efi.mbr_signature + > + boot_info_efi.mbr_signature_nr; > > - sig->device = 0x80 + boot_edd_info_nr; /* fake */ > + sig->device = 0x80 + boot_info_efi.edd_info_nr; /* fake */ > memcpy(&sig->signature, devp.HardDrive->Signature, > sizeof(sig->signature)); > - ++boot_mbr_signature_nr; > + ++boot_info_efi.mbr_signature_nr; > } > break; > } > @@ -448,8 +448,8 @@ static void __init efi_arch_edd(void) > } > if ( handles ) > efi_bs->FreePool(handles); > - if ( boot_edd_info_nr > EDD_INFO_MAX ) > - boot_edd_info_nr = EDD_INFO_MAX; > + if ( boot_info_efi.edd_info_nr > EDD_INFO_MAX ) > + boot_info_efi.edd_info_nr = EDD_INFO_MAX; > } > > static void __init efi_arch_console_init(UINTN cols, UINTN rows) > diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hypercall.c > index 7687dd1..2bcee57 100644 > --- a/xen/arch/x86/platform_hypercall.c > +++ b/xen/arch/x86/platform_hypercall.c > @@ -301,10 +301,10 @@ ret_t do_platform_op(XEN_GUEST_HANDLE_PARAM(xen_platform_op_t) u_xenpf_op) > u16 length; > > ret = -ESRCH; > - if ( op->u.firmware_info.index >= bootsym(boot_edd_info_nr) ) > + if ( op->u.firmware_info.index >= boot_info->edd_info_nr ) > break; > > - info = bootsym(boot_edd_info) + op->u.firmware_info.index; > + info = boot_info->edd_info + op->u.firmware_info.index; > > /* Transfer the EDD info block. */ > ret = -EFAULT; > @@ -340,10 +340,10 @@ ret_t do_platform_op(XEN_GUEST_HANDLE_PARAM(xen_platform_op_t) u_xenpf_op) > const struct mbr_signature *sig; > > ret = -ESRCH; > - if ( op->u.firmware_info.index >= bootsym(boot_mbr_signature_nr) ) > + if ( op->u.firmware_info.index >= boot_info->mbr_signature_nr ) > break; > > - sig = bootsym(boot_mbr_signature) + op->u.firmware_info.index; > + sig = boot_info->mbr_signature + op->u.firmware_info.index; > > op->u.firmware_info.u.disk_mbr_signature.device = sig->device; > op->u.firmware_info.u.disk_mbr_signature.mbr_signature = > diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c > index 05f9e93..6abb61a 100644 > --- a/xen/arch/x86/setup.c > +++ b/xen/arch/x86/setup.c > @@ -591,10 +591,8 @@ void __init noreturn __start_xen(boot_info_t *boot_info_ptr) > } > > printk("Disc information:\n"); > - printk(" Found %d MBR signatures\n", > - bootsym(boot_mbr_signature_nr)); > - printk(" Found %d EDD information structures\n", > - bootsym(boot_edd_info_nr)); > + printk(" Found %d MBR signatures\n", boot_info->mbr_signature_nr); > + printk(" Found %d EDD information structures\n", boot_info->edd_info_nr); > > /* Check that we have at least one Multiboot module. */ > if ( !boot_info->mods_nr ) > diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c > index 6212bed..b67c731 100644 > --- a/xen/common/efi/runtime.c > +++ b/xen/common/efi/runtime.c > @@ -48,6 +48,9 @@ extern struct e820entry e820map[]; > > extern unsigned char boot_edid_info[128]; > > +extern struct edd_info boot_edd_info[]; > +extern struct mbr_signature boot_mbr_signature[]; > + > static boot_module_t __read_mostly boot_info_mods[3] = {}; > > boot_info_t __read_mostly boot_info_efi = { > @@ -67,6 +70,10 @@ boot_info_t __read_mostly boot_info_efi = { > .vga_console_info = {}, > .edid_caps = 0, > .edid_info = boot_edid_info, > + .edd_info_nr = 0, > + .edd_info = boot_edd_info, > + .mbr_signature_nr = 0, > + .mbr_signature = boot_mbr_signature, > .mods_nr = 0, > .mods = boot_info_mods, > .warn_msg = NULL, > diff --git a/xen/include/asm-x86/boot_info.h b/xen/include/asm-x86/boot_info.h > index 97f8a3b..a495522 100644 > --- a/xen/include/asm-x86/boot_info.h > +++ b/xen/include/asm-x86/boot_info.h > @@ -23,6 +23,7 @@ > #include > > #include > +#include > #include > > /* > @@ -88,6 +89,18 @@ typedef struct { > unsigned short edid_caps; > unsigned char *edid_info; > > + /* Number of EDD entries provided by Xen preloader. */ > + u8 edd_info_nr; > + > + /* Pointer to EDD info. */ > + struct edd_info *edd_info; > + > + /* Number of MBR entries provided by Xen preloader. */ > + u8 mbr_signature_nr; > + > + /* Pointer to MBR info. */ > + struct mbr_signature *mbr_signature; > + > /* Number of modules. */ > unsigned int mods_nr; > > diff --git a/xen/include/asm-x86/edd.h b/xen/include/asm-x86/edd.h > index afaa237..e8361a5 100644 > --- a/xen/include/asm-x86/edd.h > +++ b/xen/include/asm-x86/edd.h > @@ -143,12 +143,6 @@ struct __packed mbr_signature { > u32 signature; > }; > > -/* These all reside in the boot trampoline. Access via bootsym(). */ > -extern struct mbr_signature boot_mbr_signature[]; > -extern u8 boot_mbr_signature_nr; > -extern struct edd_info boot_edd_info[]; > -extern u8 boot_edd_info_nr; > - > #endif /* __ASSEMBLY__ */ > > /* Maximum number of EDD information structures at boot_edd_info. */