Merge branches 'x86/alternatives', 'x86/cleanups', 'x86/commandline', 'x86/crashdump', 'x86/debug', 'x86/defconfig', 'x86/doc', 'x86/exports', 'x86/fpu', 'x86/gart', 'x86/idle', 'x86/mm', 'x86/mtrr', 'x86/nmi-watchdog', 'x86/oprofile', 'x86/paravirt', 'x86/reboot', 'x86/sparse-fixes', 'x86/tsc', 'x86/urgent' and 'x86/vmalloc' into x86-v28-for-linus-phase1
This commit is contained in:
@@ -82,7 +82,8 @@ AGPEXTERN __u32 *agp_gatt_table;
|
||||
static unsigned long next_bit; /* protected by iommu_bitmap_lock */
|
||||
static int need_flush; /* global flush state. set for each gart wrap */
|
||||
|
||||
static unsigned long alloc_iommu(struct device *dev, int size)
|
||||
static unsigned long alloc_iommu(struct device *dev, int size,
|
||||
unsigned long align_mask)
|
||||
{
|
||||
unsigned long offset, flags;
|
||||
unsigned long boundary_size;
|
||||
@@ -90,16 +91,17 @@ static unsigned long alloc_iommu(struct device *dev, int size)
|
||||
|
||||
base_index = ALIGN(iommu_bus_base & dma_get_seg_boundary(dev),
|
||||
PAGE_SIZE) >> PAGE_SHIFT;
|
||||
boundary_size = ALIGN(dma_get_seg_boundary(dev) + 1,
|
||||
boundary_size = ALIGN((unsigned long long)dma_get_seg_boundary(dev) + 1,
|
||||
PAGE_SIZE) >> PAGE_SHIFT;
|
||||
|
||||
spin_lock_irqsave(&iommu_bitmap_lock, flags);
|
||||
offset = iommu_area_alloc(iommu_gart_bitmap, iommu_pages, next_bit,
|
||||
size, base_index, boundary_size, 0);
|
||||
size, base_index, boundary_size, align_mask);
|
||||
if (offset == -1) {
|
||||
need_flush = 1;
|
||||
offset = iommu_area_alloc(iommu_gart_bitmap, iommu_pages, 0,
|
||||
size, base_index, boundary_size, 0);
|
||||
size, base_index, boundary_size,
|
||||
align_mask);
|
||||
}
|
||||
if (offset != -1) {
|
||||
next_bit = offset+size;
|
||||
@@ -236,10 +238,10 @@ nonforced_iommu(struct device *dev, unsigned long addr, size_t size)
|
||||
* Caller needs to check if the iommu is needed and flush.
|
||||
*/
|
||||
static dma_addr_t dma_map_area(struct device *dev, dma_addr_t phys_mem,
|
||||
size_t size, int dir)
|
||||
size_t size, int dir, unsigned long align_mask)
|
||||
{
|
||||
unsigned long npages = iommu_num_pages(phys_mem, size);
|
||||
unsigned long iommu_page = alloc_iommu(dev, npages);
|
||||
unsigned long iommu_page = alloc_iommu(dev, npages, align_mask);
|
||||
int i;
|
||||
|
||||
if (iommu_page == -1) {
|
||||
@@ -262,7 +264,11 @@ static dma_addr_t dma_map_area(struct device *dev, dma_addr_t phys_mem,
|
||||
static dma_addr_t
|
||||
gart_map_simple(struct device *dev, phys_addr_t paddr, size_t size, int dir)
|
||||
{
|
||||
dma_addr_t map = dma_map_area(dev, paddr, size, dir);
|
||||
dma_addr_t map;
|
||||
unsigned long align_mask;
|
||||
|
||||
align_mask = (1UL << get_order(size)) - 1;
|
||||
map = dma_map_area(dev, paddr, size, dir, align_mask);
|
||||
|
||||
flush_gart();
|
||||
|
||||
@@ -281,7 +287,8 @@ gart_map_single(struct device *dev, phys_addr_t paddr, size_t size, int dir)
|
||||
if (!need_iommu(dev, paddr, size))
|
||||
return paddr;
|
||||
|
||||
bus = gart_map_simple(dev, paddr, size, dir);
|
||||
bus = dma_map_area(dev, paddr, size, dir, 0);
|
||||
flush_gart();
|
||||
|
||||
return bus;
|
||||
}
|
||||
@@ -340,7 +347,7 @@ static int dma_map_sg_nonforce(struct device *dev, struct scatterlist *sg,
|
||||
unsigned long addr = sg_phys(s);
|
||||
|
||||
if (nonforced_iommu(dev, addr, s->length)) {
|
||||
addr = dma_map_area(dev, addr, s->length, dir);
|
||||
addr = dma_map_area(dev, addr, s->length, dir, 0);
|
||||
if (addr == bad_dma_address) {
|
||||
if (i > 0)
|
||||
gart_unmap_sg(dev, sg, i, dir);
|
||||
@@ -362,7 +369,7 @@ static int __dma_map_cont(struct device *dev, struct scatterlist *start,
|
||||
int nelems, struct scatterlist *sout,
|
||||
unsigned long pages)
|
||||
{
|
||||
unsigned long iommu_start = alloc_iommu(dev, pages);
|
||||
unsigned long iommu_start = alloc_iommu(dev, pages, 0);
|
||||
unsigned long iommu_page = iommu_start;
|
||||
struct scatterlist *s;
|
||||
int i;
|
||||
@@ -626,7 +633,6 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
|
||||
struct pci_dev *dev;
|
||||
void *gatt;
|
||||
int i, error;
|
||||
unsigned long start_pfn, end_pfn;
|
||||
|
||||
printk(KERN_INFO "PCI-DMA: Disabling AGP.\n");
|
||||
aper_size = aper_base = info->aper_size = 0;
|
||||
@@ -672,12 +678,6 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
|
||||
printk(KERN_INFO "PCI-DMA: aperture base @ %x size %u KB\n",
|
||||
aper_base, aper_size>>10);
|
||||
|
||||
/* need to map that range */
|
||||
end_pfn = (aper_base>>PAGE_SHIFT) + (aper_size>>PAGE_SHIFT);
|
||||
if (end_pfn > max_low_pfn_mapped) {
|
||||
start_pfn = (aper_base>>PAGE_SHIFT);
|
||||
init_memory_mapping(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT);
|
||||
}
|
||||
return 0;
|
||||
|
||||
nommu:
|
||||
@@ -727,7 +727,8 @@ void __init gart_iommu_init(void)
|
||||
{
|
||||
struct agp_kern_info info;
|
||||
unsigned long iommu_start;
|
||||
unsigned long aper_size;
|
||||
unsigned long aper_base, aper_size;
|
||||
unsigned long start_pfn, end_pfn;
|
||||
unsigned long scratch;
|
||||
long i;
|
||||
|
||||
@@ -765,8 +766,16 @@ void __init gart_iommu_init(void)
|
||||
return;
|
||||
}
|
||||
|
||||
/* need to map that range */
|
||||
aper_size = info.aper_size << 20;
|
||||
aper_base = info.aper_base;
|
||||
end_pfn = (aper_base>>PAGE_SHIFT) + (aper_size>>PAGE_SHIFT);
|
||||
if (end_pfn > max_low_pfn_mapped) {
|
||||
start_pfn = (aper_base>>PAGE_SHIFT);
|
||||
init_memory_mapping(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT);
|
||||
}
|
||||
|
||||
printk(KERN_INFO "PCI-DMA: using GART IOMMU.\n");
|
||||
aper_size = info.aper_size * 1024 * 1024;
|
||||
iommu_size = check_iommu_size(info.aper_base, aper_size);
|
||||
iommu_pages = iommu_size >> PAGE_SHIFT;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user