~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno
  • Date: 2011-06-07 12:14:05 UTC
  • mfrom: (43.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20110607121405-i3h1rd7nrnd2b73h
Tags: 2.6.39-2
[ Ben Hutchings ]
* [x86] Enable BACKLIGHT_APPLE, replacing BACKLIGHT_MBP_NVIDIA
  (Closes: #627492)
* cgroups: Disable memory resource controller by default. Allow it
  to be enabled using kernel parameter 'cgroup_enable=memory'.
* rt2800usb: Enable support for more USB devices including
  Linksys WUSB600N (Closes: #596626) (this change was accidentally
  omitted from 2.6.39-1)
* [x86] Remove Celeron from list of processors supporting PAE. Most
  'Celeron M' models do not.
* Update debconf template translations:
  - Swedish (Martin Bagge) (Closes: #628932)
  - French (David Prévot) (Closes: #628191)
* aufs: Update for 2.6.39 (Closes: #627837)
* Add stable 2.6.39.1, including:
  - ext4: dont set PageUptodate in ext4_end_bio()
  - pata_cmd64x: fix boot crash on parisc (Closes: #622997, #622745)
  - ext3: Fix fs corruption when make_indexed_dir() fails
  - netfilter: nf_ct_sip: validate Content-Length in TCP SIP messages
  - sctp: fix race between sctp_bind_addr_free() and
    sctp_bind_addr_conflict()
  - sctp: fix memory leak of the ASCONF queue when free asoc
  - md/bitmap: fix saving of events_cleared and other state
  - cdc_acm: Fix oops when Droids MuIn LCD is connected
  - cx88: Fix conversion from BKL to fine-grained locks (Closes: #619827)
  - keys: Set cred->user_ns in key_replace_session_keyring (CVE-2011-2184)
  - tmpfs: fix race between truncate and writepage
  - nfs41: Correct offset for LAYOUTCOMMIT
  - xen/mmu: fix a race window causing leave_mm BUG()
  - ext4: fix possible use-after-free in ext4_remove_li_request()
  For the complete list of changes, see:
   http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.39.1
* Bump ABI to 2
* netfilter: Enable IP_SET, IP_SET_BITMAP_IP, IP_SET_BITMAP_IPMAC,
  IP_SET_BITMAP_PORT, IP_SET_HASH_IP, IP_SET_HASH_IPPORT,
  IP_SET_HASH_IPPORTIP, IP_SET_HASH_IPPORTNET, IP_SET_HASH_NET,
  IP_SET_HASH_NETPORT, IP_SET_LIST_SET, NETFILTER_XT_SET as modules
  (Closes: #629401)

[ Aurelien Jarno ]
* [mipsel/loongson-2f] Disable_SCSI_LPFC to workaround GCC ICE.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
#include <linux/kernel.h>
14
14
#include <linux/types.h>
15
15
#include <linux/init.h>
16
 
#include <linux/bootmem.h>
 
16
#include <linux/memblock.h>
17
17
#include <linux/mmzone.h>
18
18
#include <linux/pci_ids.h>
19
19
#include <linux/pci.h>
57
57
static u32 __init allocate_aperture(void)
58
58
{
59
59
        u32 aper_size;
60
 
        void *p;
 
60
        unsigned long addr;
61
61
 
62
62
        /* aper_size should <= 1G */
63
63
        if (fallback_aper_order > 5)
73
73
        /*
74
74
         * using 512M as goal, in case kexec will load kernel_big
75
75
         * that will do the on position decompress, and  could overlap with
76
 
         * that positon with gart that is used.
 
76
         * that position with gart that is used.
77
77
         * sequende:
78
78
         * kernel_small
79
79
         * ==> kexec (with kdump trigger path or previous doesn't shutdown gart)
83
83
         * so don't use 512M below as gart iommu, leave the space for kernel
84
84
         * code for safe
85
85
         */
86
 
        p = __alloc_bootmem_nopanic(aper_size, aper_size, 512ULL<<20);
 
86
        addr = memblock_find_in_range(0, 1ULL<<32, aper_size, 512ULL<<20);
 
87
        if (addr == MEMBLOCK_ERROR || addr + aper_size > 0xffffffff) {
 
88
                printk(KERN_ERR
 
89
                        "Cannot allocate aperture memory hole (%lx,%uK)\n",
 
90
                                addr, aper_size>>10);
 
91
                return 0;
 
92
        }
 
93
        memblock_x86_reserve_range(addr, addr + aper_size, "aperture64");
87
94
        /*
88
95
         * Kmemleak should not scan this block as it may not be mapped via the
89
96
         * kernel direct mapping.
90
97
         */
91
 
        kmemleak_ignore(p);
92
 
        if (!p || __pa(p)+aper_size > 0xffffffff) {
93
 
                printk(KERN_ERR
94
 
                        "Cannot allocate aperture memory hole (%p,%uK)\n",
95
 
                                p, aper_size>>10);
96
 
                if (p)
97
 
                        free_bootmem(__pa(p), aper_size);
98
 
                return 0;
99
 
        }
 
98
        kmemleak_ignore(phys_to_virt(addr));
100
99
        printk(KERN_INFO "Mapping aperture over %d KB of RAM @ %lx\n",
101
 
                        aper_size >> 10, __pa(p));
102
 
        insert_aperture_resource((u32)__pa(p), aper_size);
103
 
        register_nosave_region((u32)__pa(p) >> PAGE_SHIFT,
104
 
                                (u32)__pa(p+aper_size) >> PAGE_SHIFT);
 
100
                        aper_size >> 10, addr);
 
101
        insert_aperture_resource((u32)addr, aper_size);
 
102
        register_nosave_region(addr >> PAGE_SHIFT,
 
103
                               (addr+aper_size) >> PAGE_SHIFT);
105
104
 
106
 
        return (u32)__pa(p);
 
105
        return (u32)addr;
107
106
}
108
107
 
109
108
 
500
499
                 * Don't enable translation yet but enable GART IO and CPU
501
500
                 * accesses and set DISTLBWALKPRB since GART table memory is UC.
502
501
                 */
503
 
                u32 ctl = DISTLBWALKPRB | aper_order << 1;
 
502
                u32 ctl = aper_order << 1;
504
503
 
505
504
                bus = amd_nb_bus_dev_ranges[i].bus;
506
505
                dev_base = amd_nb_bus_dev_ranges[i].dev_base;