Merge commit 'v2.6.31-rc8' into x86/txt
authorIngo Molnar <mingo@elte.hu>
Wed, 2 Sep 2009 06:17:56 +0000 (08:17 +0200)
committerIngo Molnar <mingo@elte.hu>
Wed, 2 Sep 2009 06:17:56 +0000 (08:17 +0200)
Conflicts:
arch/x86/kernel/reboot.c
security/Kconfig

Merge reason: resolve the conflicts, bump up from rc3 to rc8.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
1  2 
arch/x86/Kconfig
arch/x86/kernel/reboot.c
arch/x86/kernel/setup.c
drivers/pci/intel-iommu.c
security/Kconfig

diff --combined arch/x86/Kconfig
index b66f2102c35d9dd039512c696457d49ecdb7c2b0,13ffa5df37d75120e6a3965102b24a05d3ee0fb7..1401d4f0ed4834e055e3c080253bda047aa23b10
@@@ -24,6 -24,7 +24,7 @@@ config X8
        select HAVE_UNSTABLE_SCHED_CLOCK
        select HAVE_IDE
        select HAVE_OPROFILE
+       select HAVE_PERF_COUNTERS if (!M386 && !M486)
        select HAVE_IOREMAP_PROT
        select HAVE_KPROBES
        select ARCH_WANT_OPTIONAL_GPIOLIB
@@@ -178,10 -179,6 +179,10 @@@ config ARCH_SUPPORTS_OPTIMIZED_INLININ
  config ARCH_SUPPORTS_DEBUG_PAGEALLOC
        def_bool y
  
 +config HAVE_INTEL_TXT
 +      def_bool y
 +      depends on EXPERIMENTAL && DMAR && ACPI
 +
  # Use the generic interrupt handling code in kernel/irq/:
  config GENERIC_HARDIRQS
        bool
@@@ -746,7 -743,6 +747,6 @@@ config X86_UP_IOAPI
  config X86_LOCAL_APIC
        def_bool y
        depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_APIC
-       select HAVE_PERF_COUNTERS if (!M386 && !M486)
  
  config X86_IO_APIC
        def_bool y
diff --combined arch/x86/kernel/reboot.c
index 18ce5c04242ab9d3cba4a2cdfbbddaa8784a1562,a06e8d1018449dd70e4aac4b1098b6b06c4b9bd1..27349f92a6d79078bca5bce37cfcf23f490ab84a
@@@ -3,7 -3,7 +3,8 @@@
  #include <linux/init.h>
  #include <linux/pm.h>
  #include <linux/efi.h>
+ #include <linux/dmi.h>
 +#include <linux/tboot.h>
  #include <acpi/reboot.h>
  #include <asm/io.h>
  #include <asm/apic.h>
@@@ -18,7 -18,6 +19,6 @@@
  #include <asm/cpu.h>
  
  #ifdef CONFIG_X86_32
- # include <linux/dmi.h>
  # include <linux/ctype.h>
  # include <linux/mc146818rtc.h>
  #else
@@@ -250,6 -249,14 +250,14 @@@ static struct dmi_system_id __initdata 
                        DMI_MATCH(DMI_PRODUCT_NAME, "VGN-Z540N"),
                },
        },
+       {       /* Handle problems with rebooting on CompuLab SBC-FITPC2 */
+               .callback = set_bios_reboot,
+               .ident = "CompuLab SBC-FITPC2",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "CompuLab"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "SBC-FITPC2"),
+               },
+       },
        { }
  };
  
@@@ -397,6 -404,46 +405,46 @@@ EXPORT_SYMBOL(machine_real_restart)
  
  #endif /* CONFIG_X86_32 */
  
+ /*
+  * Some Apple MacBook and MacBookPro's needs reboot=p to be able to reboot
+  */
+ static int __init set_pci_reboot(const struct dmi_system_id *d)
+ {
+       if (reboot_type != BOOT_CF9) {
+               reboot_type = BOOT_CF9;
+               printk(KERN_INFO "%s series board detected. "
+                      "Selecting PCI-method for reboots.\n", d->ident);
+       }
+       return 0;
+ }
+ static struct dmi_system_id __initdata pci_reboot_dmi_table[] = {
+       {       /* Handle problems with rebooting on Apple MacBook5 */
+               .callback = set_pci_reboot,
+               .ident = "Apple MacBook5",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "MacBook5"),
+               },
+       },
+       {       /* Handle problems with rebooting on Apple MacBookPro5 */
+               .callback = set_pci_reboot,
+               .ident = "Apple MacBookPro5",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro5"),
+               },
+       },
+       { }
+ };
+ static int __init pci_reboot_init(void)
+ {
+       dmi_check_system(pci_reboot_dmi_table);
+       return 0;
+ }
+ core_initcall(pci_reboot_init);
  static inline void kb_wait(void)
  {
        int i;
@@@ -461,8 -508,6 +509,8 @@@ static void native_machine_emergency_re
        if (reboot_emergency)
                emergency_vmx_disable_all();
  
 +      tboot_shutdown(TB_SHUTDOWN_REBOOT);
 +
        /* Tell the BIOS if we want cold or warm reboot */
        *((unsigned short *)__va(0x472)) = reboot_mode;
  
@@@ -589,8 -634,6 +637,8 @@@ static void native_machine_halt(void
        /* stop other cpus and apics */
        machine_shutdown();
  
 +      tboot_shutdown(TB_SHUTDOWN_HALT);
 +
        /* stop this cpu */
        stop_this_cpu(NULL);
  }
@@@ -602,8 -645,6 +650,8 @@@ static void native_machine_power_off(vo
                        machine_shutdown();
                pm_power_off();
        }
 +      /* a fallback in case there is no PM info available */
 +      tboot_shutdown(TB_SHUTDOWN_HALT);
  }
  
  struct machine_ops machine_ops = {
diff --combined arch/x86/kernel/setup.c
index 6ce0d6f38f7f06da69689b7d96027bce47b74ffb,63f32d220ef22e2d681078ec556698e15ff7645f..61f86f24142068146377c797edc6cf260ea4c217
@@@ -66,7 -66,6 +66,7 @@@
  
  #include <linux/percpu.h>
  #include <linux/crash_dump.h>
 +#include <linux/tboot.h>
  
  #include <video/edid.h>
  
@@@ -673,6 -672,19 +673,19 @@@ static struct dmi_system_id __initdata 
                        DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies"),
                },
        },
+       {
+       /*
+        * AMI BIOS with low memory corruption was found on Intel DG45ID board.
+        * It hase different DMI_BIOS_VENDOR = "Intel Corp.", for now we will
+        * match only DMI_BOARD_NAME and see if there is more bad products
+        * with this vendor.
+        */
+               .callback = dmi_low_memory_corruption,
+               .ident = "AMI BIOS",
+               .matches = {
+                       DMI_MATCH(DMI_BOARD_NAME, "DG45ID"),
+               },
+       },
  #endif
        {}
  };
@@@ -965,8 -977,6 +978,8 @@@ void __init setup_arch(char **cmdline_p
        paravirt_pagetable_setup_done(swapper_pg_dir);
        paravirt_post_allocator_init();
  
 +      tboot_probe();
 +
  #ifdef CONFIG_X86_64
        map_vsyscall();
  #endif
index 833509b53527c6bb638152f6e5ca179d198c8705,2314ad7ee5fef4544ab2159cd7e253ed6e1d3889..562221e119172ffe19655b5ff6b5792098d89e48
@@@ -37,7 -37,6 +37,7 @@@
  #include <linux/iommu.h>
  #include <linux/intel-iommu.h>
  #include <linux/sysdev.h>
 +#include <linux/tboot.h>
  #include <asm/cacheflush.h>
  #include <asm/iommu.h>
  #include "pci.h"
@@@ -1506,7 -1505,6 +1506,6 @@@ static int domain_context_mapping_one(s
                        }
  
                        set_bit(num, iommu->domain_ids);
-                       set_bit(iommu->seq_id, &domain->iommu_bmp);
                        iommu->domains[num] = domain;
                        id = num;
                }
@@@ -1649,6 -1647,14 +1648,14 @@@ static int domain_context_mapped(struc
                                             tmp->devfn);
  }
  
+ /* Returns a number of VTD pages, but aligned to MM page size */
+ static inline unsigned long aligned_nrpages(unsigned long host_addr,
+                                           size_t size)
+ {
+       host_addr &= ~PAGE_MASK;
+       return PAGE_ALIGN(host_addr + size) >> VTD_PAGE_SHIFT;
+ }
  static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn,
                            struct scatterlist *sg, unsigned long phys_pfn,
                            unsigned long nr_pages, int prot)
                uint64_t tmp;
  
                if (!sg_res) {
-                       sg_res = (sg->offset + sg->length + VTD_PAGE_SIZE - 1) >> VTD_PAGE_SHIFT;
+                       sg_res = aligned_nrpages(sg->offset, sg->length);
                        sg->dma_address = ((dma_addr_t)iov_pfn << VTD_PAGE_SHIFT) + sg->offset;
                        sg->dma_length = sg->length;
                        pteval = page_to_phys(sg_page(sg)) | prot;
@@@ -2416,14 -2422,6 +2423,6 @@@ error
        return ret;
  }
  
- /* Returns a number of VTD pages, but aligned to MM page size */
- static inline unsigned long aligned_nrpages(unsigned long host_addr,
-                                           size_t size)
- {
-       host_addr &= ~PAGE_MASK;
-       return PAGE_ALIGN(host_addr + size) >> VTD_PAGE_SHIFT;
- }
  /* This takes a number of _MM_ pages, not VTD pages */
  static struct iova *intel_alloc_iova(struct device *dev,
                                     struct dmar_domain *domain,
@@@ -2552,6 -2550,7 +2551,7 @@@ static dma_addr_t __intel_map_single(st
        int prot = 0;
        int ret;
        struct intel_iommu *iommu;
+       unsigned long paddr_pfn = paddr >> PAGE_SHIFT;
  
        BUG_ON(dir == DMA_NONE);
  
         * is not a big problem
         */
        ret = domain_pfn_mapping(domain, mm_to_dma_pfn(iova->pfn_lo),
-                                paddr >> VTD_PAGE_SHIFT, size, prot);
+                                mm_to_dma_pfn(paddr_pfn), size, prot);
        if (ret)
                goto error;
  
@@@ -2876,7 -2875,7 +2876,7 @@@ static int intel_map_sg(struct device *
  
        start_vpfn = mm_to_dma_pfn(iova->pfn_lo);
  
-       ret = domain_sg_mapping(domain, start_vpfn, sglist, mm_to_dma_pfn(size), prot);
+       ret = domain_sg_mapping(domain, start_vpfn, sglist, size, prot);
        if (unlikely(ret)) {
                /*  clear the page */
                dma_pte_clear_range(domain, start_vpfn,
@@@ -3184,22 -3183,12 +3184,22 @@@ static int __init init_iommu_sysfs(void
  int __init intel_iommu_init(void)
  {
        int ret = 0;
 +      int force_on = 0;
  
 -      if (dmar_table_init())
 +      /* VT-d is required for a TXT/tboot launch, so enforce that */
 +      force_on = tboot_force_iommu();
 +
 +      if (dmar_table_init()) {
 +              if (force_on)
 +                      panic("tboot: Failed to initialize DMAR table\n");
                return  -ENODEV;
 +      }
  
 -      if (dmar_dev_scope_init())
 +      if (dmar_dev_scope_init()) {
 +              if (force_on)
 +                      panic("tboot: Failed to initialize DMAR device scope\n");
                return  -ENODEV;
 +      }
  
        /*
         * Check the need for DMA-remapping initialization now.
  
        ret = init_dmars();
        if (ret) {
 +              if (force_on)
 +                      panic("tboot: Failed to initialize DMARs\n");
                printk(KERN_ERR "IOMMU: dmar init failed\n");
                put_iova_domain(&reserved_iova_list);
                iommu_exit_mempool();
@@@ -3421,6 -3408,7 +3421,7 @@@ static int md_domain_init(struct dmar_d
  
        domain->iommu_count = 0;
        domain->iommu_coherency = 0;
+       domain->iommu_snooping = 0;
        domain->max_addr = 0;
  
        /* always allocate the top pgd */
diff --combined security/Kconfig
index 5721847a7a62f46715347596fcd7989e476567b8,4c865345caa01700451dd5aa7f8e290a2389690a..fb363cd81cf6db10753c69a3726c31143c3823b2
@@@ -113,36 -113,22 +113,52 @@@ config SECURITY_ROOTPLU
  
          If you are unsure how to answer this question, answer N.
  
 +config INTEL_TXT
 +      bool "Enable Intel(R) Trusted Execution Technology (Intel(R) TXT)"
 +      depends on HAVE_INTEL_TXT
 +      help
 +        This option enables support for booting the kernel with the
 +        Trusted Boot (tboot) module. This will utilize
 +        Intel(R) Trusted Execution Technology to perform a measured launch
 +        of the kernel. If the system does not support Intel(R) TXT, this
 +        will have no effect.
 +
 +        Intel TXT will provide higher assurance of system configuration and
 +        initial state as well as data reset protection.  This is used to
 +        create a robust initial kernel measurement and verification, which
 +        helps to ensure that kernel security mechanisms are functioning
 +        correctly. This level of protection requires a root of trust outside
 +        of the kernel itself.
 +
 +        Intel TXT also helps solve real end user concerns about having
 +        confidence that their hardware is running the VMM or kernel that
 +        it was configured with, especially since they may be responsible for
 +        providing such assurances to VMs and services running on it.
 +
 +        See <http://www.intel.com/technology/security/> for more information
 +        about Intel(R) TXT.
 +        See <http://tboot.sourceforge.net> for more information about tboot.
 +        See Documentation/intel_txt.txt for a description of how to enable
 +        Intel TXT support in a kernel boot.
 +
 +        If you are unsure as to whether this is required, answer N.
 +
+ config LSM_MMAP_MIN_ADDR
+       int "Low address space for LSM to protect from user allocation"
+       depends on SECURITY && SECURITY_SELINUX
+       default 65536
+       help
+         This is the portion of low virtual memory which should be protected
+         from userspace allocation.  Keeping a user from writing to low pages
+         can help reduce the impact of kernel NULL pointer bugs.
+         For most ia64, ppc64 and x86 users with lots of address space
+         a value of 65536 is reasonable and should cause no problems.
+         On arm and other archs it should not be higher than 32768.
+         Programs which use vm86 functionality or have some need to map
+         this low address space will need the permission specific to the
+         systems running LSM.
  source security/selinux/Kconfig
  source security/smack/Kconfig
  source security/tomoyo/Kconfig