mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-17 01:04:19 +08:00
x86/iommu: use __GFP_ZERO instead of memset for GART
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
3610f2116e
commit
0114267be1
@ -674,13 +674,13 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
|
|||||||
info->aper_size = aper_size >> 20;
|
info->aper_size = aper_size >> 20;
|
||||||
|
|
||||||
gatt_size = (aper_size >> PAGE_SHIFT) * sizeof(u32);
|
gatt_size = (aper_size >> PAGE_SHIFT) * sizeof(u32);
|
||||||
gatt = (void *)__get_free_pages(GFP_KERNEL, get_order(gatt_size));
|
gatt = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO,
|
||||||
|
get_order(gatt_size));
|
||||||
if (!gatt)
|
if (!gatt)
|
||||||
panic("Cannot allocate GATT table");
|
panic("Cannot allocate GATT table");
|
||||||
if (set_memory_uc((unsigned long)gatt, gatt_size >> PAGE_SHIFT))
|
if (set_memory_uc((unsigned long)gatt, gatt_size >> PAGE_SHIFT))
|
||||||
panic("Could not set GART PTEs to uncacheable pages");
|
panic("Could not set GART PTEs to uncacheable pages");
|
||||||
|
|
||||||
memset(gatt, 0, gatt_size);
|
|
||||||
agp_gatt_table = gatt;
|
agp_gatt_table = gatt;
|
||||||
|
|
||||||
enable_gart_translations();
|
enable_gart_translations();
|
||||||
@ -788,19 +788,16 @@ void __init gart_iommu_init(void)
|
|||||||
iommu_size = check_iommu_size(info.aper_base, aper_size);
|
iommu_size = check_iommu_size(info.aper_base, aper_size);
|
||||||
iommu_pages = iommu_size >> PAGE_SHIFT;
|
iommu_pages = iommu_size >> PAGE_SHIFT;
|
||||||
|
|
||||||
iommu_gart_bitmap = (void *) __get_free_pages(GFP_KERNEL,
|
iommu_gart_bitmap = (void *) __get_free_pages(GFP_KERNEL | __GFP_ZERO,
|
||||||
get_order(iommu_pages/8));
|
get_order(iommu_pages/8));
|
||||||
if (!iommu_gart_bitmap)
|
if (!iommu_gart_bitmap)
|
||||||
panic("Cannot allocate iommu bitmap\n");
|
panic("Cannot allocate iommu bitmap\n");
|
||||||
memset(iommu_gart_bitmap, 0, iommu_pages/8);
|
|
||||||
|
|
||||||
#ifdef CONFIG_IOMMU_LEAK
|
#ifdef CONFIG_IOMMU_LEAK
|
||||||
if (leak_trace) {
|
if (leak_trace) {
|
||||||
iommu_leak_tab = (void *)__get_free_pages(GFP_KERNEL,
|
iommu_leak_tab = (void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO,
|
||||||
get_order(iommu_pages*sizeof(void *)));
|
get_order(iommu_pages*sizeof(void *)));
|
||||||
if (iommu_leak_tab)
|
if (!iommu_leak_tab)
|
||||||
memset(iommu_leak_tab, 0, iommu_pages * 8);
|
|
||||||
else
|
|
||||||
printk(KERN_DEBUG
|
printk(KERN_DEBUG
|
||||||
"PCI-DMA: Cannot allocate leak trace area\n");
|
"PCI-DMA: Cannot allocate leak trace area\n");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user