From: "Jan Beulich" Subject: [PATCH 4/4, optional] x86-64: EFI MPS support Date: Mon, 27 Jun 2011 11:43:39 +0100 Message-ID: <4E087AFB0200007800049E77@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartBB94F0CB.0__=" Return-path: 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 This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__PartBB94F0CB.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline It's not clear this is needed - Linux doesn't use the MPS table even if available, and no system having one was seen so far. Signed-off-by: Jan Beulich --- a/xen/arch/x86/efi/boot.c +++ b/xen/arch/x86/efi/boot.c @@ -897,12 +897,15 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY { static EFI_GUID __initdata acpi2_guid =3D ACPI_20_TABLE_GUID; static EFI_GUID __initdata acpi_guid =3D ACPI_TABLE_GUID; + static EFI_GUID __initdata mps_guid =3D MPS_TABLE_GUID; static EFI_GUID __initdata smbios_guid =3D SMBIOS_TABLE_GUID; =20 if ( match_guid(&acpi2_guid, &efi_ct[i].VendorGuid) ) efi.acpi20 =3D (long)efi_ct[i].VendorTable; if ( match_guid(&acpi_guid, &efi_ct[i].VendorGuid) ) efi.acpi =3D (long)efi_ct[i].VendorTable; + if ( match_guid(&mps_guid, &efi_ct[i].VendorGuid) ) + efi.mps =3D (long)efi_ct[i].VendorTable; if ( match_guid(&smbios_guid, &efi_ct[i].VendorGuid) ) efi.smbios =3D (long)efi_ct[i].VendorTable; } --- a/xen/arch/x86/efi/runtime.c +++ b/xen/arch/x86/efi/runtime.c @@ -29,6 +29,7 @@ void *__read_mostly efi_memmap; struct efi __read_mostly efi =3D { .acpi =3D EFI_INVALID_TABLE_ADDR, .acpi20 =3D EFI_INVALID_TABLE_ADDR, + .mps =3D EFI_INVALID_TABLE_ADDR, .smbios =3D EFI_INVALID_TABLE_ADDR, }; =20 --- a/xen/arch/x86/mpparse.c +++ b/xen/arch/x86/mpparse.c @@ -19,6 +19,7 @@ #include #include #include +#include #include =20 #include @@ -514,6 +515,14 @@ static inline void __init construct_defa } } =20 +#define FIX_EFI_MPF FIX_KEXEC_BASE_0 + +static __init void efi_unmap_mpf(void) +{ + if (efi_enabled) + __set_fixmap(FIX_EFI_MPF, 0, 0); +} + static struct intel_mp_floating *__initdata mpf_found; =20 /* @@ -528,6 +537,7 @@ void __init get_smp_config (void) * processors, where MPS only supports physical. */ if (acpi_lapic && acpi_ioapic) { + efi_unmap_mpf(); printk(KERN_INFO "Using ACPI (MADT) for SMP configuration = information\n"); return; } @@ -558,6 +568,7 @@ void __init get_smp_config (void) * override the defaults. */ if (!smp_read_mpc((void *)(unsigned long)mpf->mpf_physptr))= { + efi_unmap_mpf(); smp_found_config =3D 0; printk(KERN_ERR "BIOS bug, MP table errors = detected!...\n"); printk(KERN_ERR "... disabling SMP support. (tell = your hw vendor)\n"); @@ -584,6 +595,8 @@ void __init get_smp_config (void) } else BUG(); =20 + efi_unmap_mpf(); + printk(KERN_INFO "Processors: %d\n", num_processors); /* * Only use the first configuration found. @@ -638,10 +651,37 @@ static int __init smp_scan_config (unsig return 0; } =20 +static void __init efi_check_config(void) +{ + struct intel_mp_floating *mpf; + + if (efi.mps =3D=3D EFI_INVALID_TABLE_ADDR) + return; + + __set_fixmap(FIX_EFI_MPF, PFN_DOWN(efi.mps), __PAGE_HYPERVISOR); + mpf =3D (void *)fix_to_virt(FIX_EFI_MPF) + ((long)efi.mps & = (PAGE_SIZE-1)); + + if (memcmp(mpf->mpf_signature, "_MP_", 4) =3D=3D 0 && + mpf->mpf_length =3D=3D 1 && + mpf_checksum((void *)mpf, 16) && + (mpf->mpf_specification =3D=3D 1 || mpf->mpf_specification = =3D=3D 4)) { + smp_found_config =3D 1; + printk(KERN_INFO "SMP MP-table at %08"PRIx64"\n", = efi.mps); + mpf_found =3D mpf; + } + else + efi_unmap_mpf(); +} + void __init find_smp_config (void) { unsigned int address; =20 + if (efi_enabled) { + efi_check_config(); + return; + } + /* * FIXME: Linux assumes you have 640K of base ram.. * this continues the error... --- a/xen/include/xen/efi.h +++ b/xen/include/xen/efi.h @@ -17,6 +17,7 @@ extern const bool_t efi_enabled; =20 /* Add fields here only if they need to be referenced from non-EFI code. = */ struct efi { + unsigned long mps; /* MPS table */ unsigned long acpi; /* ACPI table (IA64 ext 0.71) */ unsigned long acpi20; /* ACPI table (ACPI 2.0) */ unsigned long smbios; /* SM BIOS table */ --=__PartBB94F0CB.0__= Content-Type: text/plain; name="x86-EFI-MPS.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-EFI-MPS.patch" It's not clear this is needed - Linux doesn't use the MPS table even = if=0Aavailable, and no system having one was seen so far.=0A=0ASigned-off-b= y: Jan Beulich =0A=0A--- a/xen/arch/x86/efi/boot.c=0A+= ++ b/xen/arch/x86/efi/boot.c=0A@@ -897,12 +897,15 @@ efi_start(EFI_HANDLE = ImageHandle, EFI_SY=0A {=0A static EFI_GUID __initdata = acpi2_guid =3D ACPI_20_TABLE_GUID;=0A static EFI_GUID __initdata = acpi_guid =3D ACPI_TABLE_GUID;=0A+ static EFI_GUID __initdata = mps_guid =3D MPS_TABLE_GUID;=0A static EFI_GUID __initdata = smbios_guid =3D SMBIOS_TABLE_GUID;=0A =0A if ( match_guid(&acpi2_gu= id, &efi_ct[i].VendorGuid) )=0A efi.acpi20 =3D (long)efi_ct[= i].VendorTable;=0A if ( match_guid(&acpi_guid, &efi_ct[i].VendorGui= d) )=0A efi.acpi =3D (long)efi_ct[i].VendorTable;=0A+ = if ( match_guid(&mps_guid, &efi_ct[i].VendorGuid) )=0A+ = efi.mps =3D (long)efi_ct[i].VendorTable;=0A if ( match_guid(&smbios= _guid, &efi_ct[i].VendorGuid) )=0A efi.smbios =3D (long)efi_ct[= i].VendorTable;=0A }=0A--- a/xen/arch/x86/efi/runtime.c=0A+++ = b/xen/arch/x86/efi/runtime.c=0A@@ -29,6 +29,7 @@ void *__read_mostly = efi_memmap;=0A struct efi __read_mostly efi =3D {=0A .acpi =3D = EFI_INVALID_TABLE_ADDR,=0A .acpi20 =3D EFI_INVALID_TABLE_ADDR,=0A+ = .mps =3D EFI_INVALID_TABLE_ADDR,=0A .smbios =3D EFI_INVALID_TABLE_ADDR,= =0A };=0A =0A--- a/xen/arch/x86/mpparse.c=0A+++ b/xen/arch/x86/mpparse.c=0A= @@ -19,6 +19,7 @@=0A #include =0A #include =0A = #include =0A+#include =0A #include =0A= =0A #include =0A@@ -514,6 +515,14 @@ static inline void = __init construct_defa=0A }=0A }=0A =0A+#define FIX_EFI_MPF = FIX_KEXEC_BASE_0=0A+=0A+static __init void efi_unmap_mpf(void)=0A+{=0A+ if = (efi_enabled)=0A+ __set_fixmap(FIX_EFI_MPF, 0, 0);=0A+}=0A+= =0A static struct intel_mp_floating *__initdata mpf_found;=0A =0A /*=0A@@ = -528,6 +537,7 @@ void __init get_smp_config (void)=0A * processors, = where MPS only supports physical.=0A */=0A if (acpi_lapic && = acpi_ioapic) {=0A+ efi_unmap_mpf();=0A printk(KERN= _INFO "Using ACPI (MADT) for SMP configuration information\n");=0A = return;=0A }=0A@@ -558,6 +568,7 @@ void __init get_smp_config = (void)=0A * override the defaults.=0A */=0A = if (!smp_read_mpc((void *)(unsigned long)mpf->mpf_physptr)) {=0A+ = efi_unmap_mpf();=0A smp_found_config =3D 0;=0A = printk(KERN_ERR "BIOS bug, MP table errors = detected!...\n");=0A printk(KERN_ERR "... disabling SMP = support. (tell your hw vendor)\n");=0A@@ -584,6 +595,8 @@ void __init = get_smp_config (void)=0A } else=0A BUG();=0A =0A+ = efi_unmap_mpf();=0A+=0A printk(KERN_INFO "Processors: %d\n", = num_processors);=0A /*=0A * Only use the first configuration = found.=0A@@ -638,10 +651,37 @@ static int __init smp_scan_config (unsig=0A = return 0;=0A }=0A =0A+static void __init efi_check_config(void)=0A+= {=0A+ struct intel_mp_floating *mpf;=0A+=0A+ if (efi.mps =3D=3D = EFI_INVALID_TABLE_ADDR)=0A+ return;=0A+=0A+ __set_fixmap(FIX_EF= I_MPF, PFN_DOWN(efi.mps), __PAGE_HYPERVISOR);=0A+ mpf =3D (void = *)fix_to_virt(FIX_EFI_MPF) + ((long)efi.mps & (PAGE_SIZE-1));=0A+=0A+ if = (memcmp(mpf->mpf_signature, "_MP_", 4) =3D=3D 0 &&=0A+ mpf->mpf_length= =3D=3D 1 &&=0A+ mpf_checksum((void *)mpf, 16) &&=0A+ = (mpf->mpf_specification =3D=3D 1 || mpf->mpf_specification =3D=3D 4)) = {=0A+ smp_found_config =3D 1;=0A+ printk(KERN_INFO = "SMP MP-table at %08"PRIx64"\n", efi.mps);=0A+ mpf_found =3D = mpf;=0A+ }=0A+ else=0A+ efi_unmap_mpf();=0A+}=0A+= =0A void __init find_smp_config (void)=0A {=0A unsigned int address;=0A = =0A+ if (efi_enabled) {=0A+ efi_check_config();=0A+ = return;=0A+ }=0A+=0A /*=0A * FIXME: Linux assumes you have = 640K of base ram..=0A * this continues the error...=0A--- a/xen/include/= xen/efi.h=0A+++ b/xen/include/xen/efi.h=0A@@ -17,6 +17,7 @@ extern const = bool_t efi_enabled;=0A =0A /* Add fields here only if they need to be = referenced from non-EFI code. */=0A struct efi {=0A+ unsigned long mps; = /* MPS table */=0A unsigned long acpi; /* ACPI table = (IA64 ext 0.71) */=0A unsigned long acpi20; /* ACPI table (ACPI = 2.0) */=0A unsigned long smbios; /* SM BIOS table */=0A --=__PartBB94F0CB.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__PartBB94F0CB.0__=--