intel_txt: fix section warning messages from tboot (v2)
Subsystems (2)
PATCH RESEND 1/1 intel_txt: fix section warning messages from tboot (v2)
This patch is to fix the warning messages related to tboot when "allyesconfig" is set on i386.
Signed-off-by Shane Wang <[email protected]>
Acked-by Joseph Cihula <[email protected]>
--- arch/x86/kernel/tboot.c | 108 +++++++++++++++++--------------------- 1 file changed, 49 insertions(+), 59 deletions(-)
arch/x86/kernel/tboot.c +49 -59
@@ -54,51 +54,6 @@ struct tboot *tboot __read_mostly;#define pr_fmt (fmt) "tboot: " fmtstatic u8 tboot_uuid[16 ]__initdata =TBOOT_UUID ; - -void __init tboot_probe (void ) -{ -/* Look for valid page-aligned address for shared page. */ -if (!boot_params.tboot_addr) -return ; -/* -* also verify that it is mapped as we expect it before calling -* set_fixmap(), to reduce chance of garbage value causing crash -*/ -if (!e820_any_mapped (boot_params.tboot_addr, - boot_params.tboot_addr,E820_RESERVED )) { -pr_warning ("non-0 tboot_addr but it is not of type E820_RESERVED\n" ); -return ; - } - -/* only a natively booted kernel should be using TXT */ -if (paravirt_enabled ()) { -pr_warning ("non-0 tboot_addr but pv_ops is enabled\n" ); -return ; - } - -/* Map and check for tboot UUID. */ -set_fixmap (FIX_TBOOT_BASE , boot_params.tboot_addr); - tboot = (struct tboot *)fix_to_virt (FIX_TBOOT_BASE ); -if (memcmp (&tboot_uuid, &tboot->uuid,sizeof (tboot->uuid))) { -pr_warning ("tboot at 0x%llx is invalid\n" , - boot_params.tboot_addr); - tboot =NULL ; -return ; - } -if (tboot->version <5 ) { -pr_warning ("tboot version is invalid: %u\n" , tboot->version); - tboot =NULL ; -return ; - } - -pr_info ("found shared page at phys addr 0x%llx:\n" , - boot_params.tboot_addr); -pr_debug ("version: %d\n" , tboot->version); -pr_debug ("log_addr: 0x%08x\n" , tboot->log_addr); -pr_debug ("shutdown_entry: 0x%x\n" , tboot->shutdown_entry); -pr_debug ("tboot_base: 0x%08x\n" , tboot->tboot_base); -pr_debug ("tboot_size: 0x%x\n" , tboot->tboot_size); -}static pgd_t *tboot_pg_dir;static struct mm_struct tboot_mm = {
@@ -182,7 +137,7 @@ static void add_mac_region(phys_addr_t s } } -static int tboot_setup_sleep (void ) +static void __init tboot_setup_sleep (void ) { tboot->num_mac_regions =0 ;
@@ -198,20 +153,60 @@ static int tboot_setup_sleep(void)add_mac_region (virt_to_phys (_text), _end - _text); tboot->acpi_sinfo.kernel_s3_resume_vector = acpi_wakeup_address; - - return 0; }#else /* no CONFIG_ACPI_SLEEP */ -static int tboot_setup_sleep (void ) -{ -/* S3 shutdown requested, but S3 not supported by the kernel... */ -BUG (); -return -1 ; -} +static void tboot_setup_sleep (void ) {}#endif + +void __init tboot_probe (void ) +{ +/* Look for valid page-aligned address for shared page. */ +if (!boot_params.tboot_addr) +return ; +/* +* also verify that it is mapped as we expect it before calling +* set_fixmap(), to reduce chance of garbage value causing crash +*/ +if (!e820_any_mapped (boot_params.tboot_addr, + boot_params.tboot_addr,E820_RESERVED )) { +pr_warning ("non-0 tboot_addr but it is not of type E820_RESERVED\n" ); +return ; + } + +/* only a natively booted kernel should be using TXT */ +if (paravirt_enabled ()) { +pr_warning ("non-0 tboot_addr but pv_ops is enabled\n" ); +return ; + } + +/* Map and check for tboot UUID. */ +set_fixmap (FIX_TBOOT_BASE , boot_params.tboot_addr); + tboot = (struct tboot *)fix_to_virt (FIX_TBOOT_BASE ); +if (memcmp (&tboot_uuid, &tboot->uuid,sizeof (tboot->uuid))) { +pr_warning ("tboot at 0x%llx is invalid\n" , + boot_params.tboot_addr); + tboot =NULL ; +return ; + } +if (tboot->version <5 ) { +pr_warning ("tboot version is invalid: %u\n" , tboot->version); + tboot =NULL ; +return ; + } + +pr_info ("found shared page at phys addr 0x%llx:\n" , + boot_params.tboot_addr); +pr_debug ("version: %d\n" , tboot->version); +pr_debug ("log_addr: 0x%08x\n" , tboot->log_addr); +pr_debug ("shutdown_entry: 0x%x\n" , tboot->shutdown_entry); +pr_debug ("tboot_base: 0x%08x\n" , tboot->tboot_base); +pr_debug ("tboot_size: 0x%x\n" , tboot->tboot_size); + +tboot_setup_sleep (); +}void tboot_shutdown (u32 shutdown_type) {
@@ -227,11 +222,6 @@ void tboot_shutdown(u32 shutdown_type)*/ if (!tboot_pg_dir)return ; - -/* if this is S3 then set regions to MAC */ -if (shutdown_type ==TB_SHUTDOWN_S3 ) -if (tboot_setup_sleep ()) -return ; tboot->shutdown_type = shutdown_type;