~ubuntu-branches/ubuntu/wily/linux-ti-omap4/wily

« back to all changes in this revision

Viewing changes to arch/x86/kernel/setup.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati, Ubuntu: 3.5.0-25.38
  • Date: 2013-02-20 22:03:31 UTC
  • mfrom: (74.1.1 quantal-proposed)
  • Revision ID: package-import@ubuntu.com-20130220220331-0ea4l33x3cr61nch
Tags: 3.5.0-220.28
* Release Tracking Bug
  - LP: #1130311

[ Paolo Pisati ]

* rebased on Ubuntu-3.5.0-25.38

[ Ubuntu: 3.5.0-25.38 ]

* Release Tracking Bug
  - LP: #1129472
* ptrace: introduce signal_wake_up_state() and ptrace_signal_wake_up()
  - LP: #1119885, #1129192
  - CVE-2013-0871
* ptrace: ensure arch_ptrace/ptrace_request can never race with SIGKILL
  - LP: #1119885, #1129192
  - CVE-2013-0871
* wake_up_process() should be never used to wakeup a TASK_STOPPED/TRACED
  task
  - LP: #1119885, #1129192
  - CVE-2013-0871

Show diffs side-by-side

added added

removed removed

Lines of Context:
613
613
 
614
614
static unsigned reserve_low = CONFIG_X86_RESERVE_LOW << 10;
615
615
 
 
616
static bool __init snb_gfx_workaround_needed(void)
 
617
{
 
618
        int i;
 
619
        u16 vendor, devid;
 
620
        static const u16 snb_ids[] = {
 
621
                0x0102,
 
622
                0x0112,
 
623
                0x0122,
 
624
                0x0106,
 
625
                0x0116,
 
626
                0x0126,
 
627
                0x010a,
 
628
        };
 
629
 
 
630
        /* Assume no if something weird is going on with PCI */
 
631
        if (!early_pci_allowed())
 
632
                return false;
 
633
 
 
634
        vendor = read_pci_config_16(0, 2, 0, PCI_VENDOR_ID);
 
635
        if (vendor != 0x8086)
 
636
                return false;
 
637
 
 
638
        devid = read_pci_config_16(0, 2, 0, PCI_DEVICE_ID);
 
639
        for (i = 0; i < ARRAY_SIZE(snb_ids); i++)
 
640
                if (devid == snb_ids[i])
 
641
                        return true;
 
642
 
 
643
        return false;
 
644
}
 
645
 
 
646
/*
 
647
 * Sandy Bridge graphics has trouble with certain ranges, exclude
 
648
 * them from allocation.
 
649
 */
 
650
static void __init trim_snb_memory(void)
 
651
{
 
652
        static const unsigned long bad_pages[] = {
 
653
                0x20050000,
 
654
                0x20110000,
 
655
                0x20130000,
 
656
                0x20138000,
 
657
                0x40004000,
 
658
        };
 
659
        int i;
 
660
 
 
661
        if (!snb_gfx_workaround_needed())
 
662
                return;
 
663
 
 
664
        printk(KERN_DEBUG "reserving inaccessible SNB gfx pages\n");
 
665
 
 
666
        /*
 
667
         * Reserve all memory below the 1 MB mark that has not
 
668
         * already been reserved.
 
669
         */
 
670
        memblock_reserve(0, 1<<20);
 
671
        
 
672
        for (i = 0; i < ARRAY_SIZE(bad_pages); i++) {
 
673
                if (memblock_reserve(bad_pages[i], PAGE_SIZE))
 
674
                        printk(KERN_WARNING "failed to reserve 0x%08lx\n",
 
675
                               bad_pages[i]);
 
676
        }
 
677
}
 
678
 
 
679
/*
 
680
 * Here we put platform-specific memory range workarounds, i.e.
 
681
 * memory known to be corrupt or otherwise in need to be reserved on
 
682
 * specific platforms.
 
683
 *
 
684
 * If this gets used more widely it could use a real dispatch mechanism.
 
685
 */
 
686
static void __init trim_platform_memory_ranges(void)
 
687
{
 
688
        trim_snb_memory();
 
689
}
 
690
 
616
691
static void __init trim_bios_range(void)
617
692
{
618
693
        /*
633
708
         * take them out.
634
709
         */
635
710
        e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1);
 
711
 
636
712
        sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
637
713
}
638
714
 
732
808
#ifdef CONFIG_EFI
733
809
        if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
734
810
                     "EL32", 4)) {
735
 
                efi_enabled = 1;
736
 
                efi_64bit = false;
 
811
                set_bit(EFI_BOOT, &x86_efi_facility);
737
812
        } else if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
738
813
                     "EL64", 4)) {
739
 
                efi_enabled = 1;
740
 
                efi_64bit = true;
 
814
                set_bit(EFI_BOOT, &x86_efi_facility);
 
815
                set_bit(EFI_64BIT, &x86_efi_facility);
741
816
        }
742
 
        if (efi_enabled && efi_memblock_x86_reserve_range())
743
 
                efi_enabled = 0;
 
817
 
 
818
        if (efi_enabled(EFI_BOOT))
 
819
                efi_memblock_x86_reserve_range();
744
820
#endif
745
821
 
746
822
        x86_init.oem.arch_setup();
813
889
 
814
890
        finish_e820_parsing();
815
891
 
816
 
        if (efi_enabled)
 
892
        if (efi_enabled(EFI_BOOT))
817
893
                efi_init();
818
894
 
819
895
        dmi_scan_machine();
896
972
         * The EFI specification says that boot service code won't be called
897
973
         * after ExitBootServices(). This is, in fact, a lie.
898
974
         */
899
 
        if (efi_enabled)
 
975
        if (efi_enabled(EFI_MEMMAP))
900
976
                efi_reserve_boot_services();
901
977
 
902
978
        /* preallocate 4k for mptable mpc */
911
987
 
912
988
        setup_real_mode();
913
989
 
 
990
        trim_platform_memory_ranges();
 
991
 
914
992
        init_gbpages();
915
993
 
916
994
        /* max_pfn_mapped is updated here */
1035
1113
 
1036
1114
#ifdef CONFIG_VT
1037
1115
#if defined(CONFIG_VGA_CONSOLE)
1038
 
        if (!efi_enabled || (efi_mem_type(0xa0000) != EFI_CONVENTIONAL_MEMORY))
 
1116
        if (!efi_enabled(EFI_BOOT) || (efi_mem_type(0xa0000) != EFI_CONVENTIONAL_MEMORY))
1039
1117
                conswitchp = &vga_con;
1040
1118
#elif defined(CONFIG_DUMMY_CONSOLE)
1041
1119
        conswitchp = &dummy_con;
1052
1130
        arch_init_ideal_nops();
1053
1131
 
1054
1132
#ifdef CONFIG_EFI
1055
 
        /* Once setup is done above, disable efi_enabled on mismatched
1056
 
         * firmware/kernel archtectures since there is no support for
1057
 
         * runtime services.
 
1133
        /* Once setup is done above, unmap the EFI memory map on
 
1134
         * mismatched firmware/kernel archtectures since there is no
 
1135
         * support for runtime services.
1058
1136
         */
1059
 
        if (efi_enabled && IS_ENABLED(CONFIG_X86_64) != efi_64bit) {
 
1137
        if (efi_enabled(EFI_BOOT) &&
 
1138
            IS_ENABLED(CONFIG_X86_64) != efi_enabled(EFI_64BIT)) {
1060
1139
                pr_info("efi: Setup done, disabling due to 32/64-bit mismatch\n");
1061
1140
                efi_unmap_memmap();
1062
 
                efi_enabled = 0;
1063
1141
        }
1064
1142
#endif
1065
1143
}