diff options
author | Venki Pallipadi <venkatesh.pallipadi@intel.com> | 2008-03-24 17:39:55 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-17 11:41:20 -0400 |
commit | dee7cbb210fdd266ad81af4689bcbac3649f38ff (patch) | |
tree | 2103ffc28bba2516003609026c649aa1e7592ad2 /arch | |
parent | 9307cacad0dfe3749f00303125c6f7f0523e5616 (diff) |
x86: PAT bug fix for attribute type check after reserve_memtype
Bug fixes for reserve_memtype() call in __ioremap and pci_mmap_page_range().
If reserve_memtype returns non-zero, then it is an error and subsequent free is
not required. Requested and returned prot value check should be done when
reserve_memtype returns success.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/mm/ioremap.c | 11 | ||||
-rw-r--r-- | arch/x86/pci/i386.c | 7 |
2 files changed, 15 insertions, 3 deletions
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index 6cd3418afe71..3f7f05e2c434 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c | |||
@@ -124,6 +124,7 @@ static void __iomem *__ioremap(resource_size_t phys_addr, unsigned long size, | |||
124 | struct vm_struct *area; | 124 | struct vm_struct *area; |
125 | unsigned long new_prot_val; | 125 | unsigned long new_prot_val; |
126 | pgprot_t prot; | 126 | pgprot_t prot; |
127 | int retval; | ||
127 | 128 | ||
128 | /* Don't allow wraparound or zero size */ | 129 | /* Don't allow wraparound or zero size */ |
129 | last_addr = phys_addr + size - 1; | 130 | last_addr = phys_addr + size - 1; |
@@ -163,8 +164,14 @@ static void __iomem *__ioremap(resource_size_t phys_addr, unsigned long size, | |||
163 | phys_addr &= PAGE_MASK; | 164 | phys_addr &= PAGE_MASK; |
164 | size = PAGE_ALIGN(last_addr+1) - phys_addr; | 165 | size = PAGE_ALIGN(last_addr+1) - phys_addr; |
165 | 166 | ||
166 | if (reserve_memtype(phys_addr, phys_addr + size, | 167 | retval = reserve_memtype(phys_addr, phys_addr + size, |
167 | prot_val, &new_prot_val)) { | 168 | prot_val, &new_prot_val); |
169 | if (retval) { | ||
170 | printk("reserve_memtype returned %d\n", retval); | ||
171 | return NULL; | ||
172 | } | ||
173 | |||
174 | if (prot_val != new_prot_val) { | ||
168 | /* | 175 | /* |
169 | * Do not fallback to certain memory types with certain | 176 | * Do not fallback to certain memory types with certain |
170 | * requested type: | 177 | * requested type: |
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c index 4ebf52f6b1fd..2ead72363077 100644 --- a/arch/x86/pci/i386.c +++ b/arch/x86/pci/i386.c | |||
@@ -328,6 +328,7 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | |||
328 | unsigned long len = vma->vm_end - vma->vm_start; | 328 | unsigned long len = vma->vm_end - vma->vm_start; |
329 | unsigned long flags; | 329 | unsigned long flags; |
330 | unsigned long new_flags; | 330 | unsigned long new_flags; |
331 | int retval; | ||
331 | 332 | ||
332 | /* I/O space cannot be accessed via normal processor loads and | 333 | /* I/O space cannot be accessed via normal processor loads and |
333 | * stores on this platform. | 334 | * stores on this platform. |
@@ -344,7 +345,11 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | |||
344 | vma->vm_page_prot = __pgprot(prot); | 345 | vma->vm_page_prot = __pgprot(prot); |
345 | 346 | ||
346 | flags = pgprot_val(vma->vm_page_prot) & _PAGE_CACHE_MASK; | 347 | flags = pgprot_val(vma->vm_page_prot) & _PAGE_CACHE_MASK; |
347 | if (reserve_memtype(addr, addr + len, flags, &new_flags)) { | 348 | retval = reserve_memtype(addr, addr + len, flags, &new_flags); |
349 | if (retval) | ||
350 | return retval; | ||
351 | |||
352 | if (flags != new_flags) { | ||
348 | /* | 353 | /* |
349 | * Do not fallback to certain memory types with certain | 354 | * Do not fallback to certain memory types with certain |
350 | * requested type: | 355 | * requested type: |