Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 07613ba2 authored by Dave Airlie's avatar Dave Airlie
Browse files

agp: switch AGP to use page array instead of unsigned long array



This switches AGP to use an array of pages for tracking the
pages allocated to the GART. This should enable GEM on PAE to work
a lot better as we can pass highmem pages to the PAT code and it will
do the right thing with them.

Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 2908826d
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@ struct agp_bridge_driver {
	void (*agp_enable)(struct agp_bridge_data *, u32);
	void (*cleanup)(void);
	void (*tlb_flush)(struct agp_memory *);
	unsigned long (*mask_memory)(struct agp_bridge_data *, unsigned long, int);
	unsigned long (*mask_memory)(struct agp_bridge_data *, struct page *, int);
	void (*cache_flush)(void);
	int (*create_gatt_table)(struct agp_bridge_data *);
	int (*free_gatt_table)(struct agp_bridge_data *);
@@ -115,9 +115,9 @@ struct agp_bridge_driver {
	int (*remove_memory)(struct agp_memory *, off_t, int);
	struct agp_memory *(*alloc_by_type) (size_t, int);
	void (*free_by_type)(struct agp_memory *);
	void *(*agp_alloc_page)(struct agp_bridge_data *);
	struct page *(*agp_alloc_page)(struct agp_bridge_data *);
	int (*agp_alloc_pages)(struct agp_bridge_data *, struct agp_memory *, size_t);
	void (*agp_destroy_page)(void *, int flags);
	void (*agp_destroy_page)(struct page *, int flags);
	void (*agp_destroy_pages)(struct agp_memory *);
	int (*agp_type_to_mask_type) (struct agp_bridge_data *, int);
	void (*chipset_flush)(struct agp_bridge_data *);
@@ -278,10 +278,10 @@ int agp_generic_insert_memory(struct agp_memory *mem, off_t pg_start, int type);
int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type);
struct agp_memory *agp_generic_alloc_by_type(size_t page_count, int type);
void agp_generic_free_by_type(struct agp_memory *curr);
void *agp_generic_alloc_page(struct agp_bridge_data *bridge);
struct page *agp_generic_alloc_page(struct agp_bridge_data *bridge);
int agp_generic_alloc_pages(struct agp_bridge_data *agp_bridge,
			    struct agp_memory *memory, size_t page_count);
void agp_generic_destroy_page(void *addr, int flags);
void agp_generic_destroy_page(struct page *page, int flags);
void agp_generic_destroy_pages(struct agp_memory *memory);
void agp_free_key(int key);
int agp_num_entries(void);
@@ -291,7 +291,7 @@ int agp_3_5_enable(struct agp_bridge_data *bridge);
void global_cache_flush(void);
void get_agp_version(struct agp_bridge_data *bridge);
unsigned long agp_generic_mask_memory(struct agp_bridge_data *bridge,
	unsigned long addr, int type);
				      struct page *page, int type);
int agp_generic_type_to_mask_type(struct agp_bridge_data *bridge,
				  int type);
struct agp_bridge_data *agp_generic_find_bridge(struct pci_dev *pdev);
+13 −13
Original line number Diff line number Diff line
@@ -141,37 +141,37 @@ static void m1541_cache_flush(void)
	}
}

static void *m1541_alloc_page(struct agp_bridge_data *bridge)
static struct page *m1541_alloc_page(struct agp_bridge_data *bridge)
{
	void *addr = agp_generic_alloc_page(agp_bridge);
	struct page *page = agp_generic_alloc_page(agp_bridge);
	u32 temp;

	if (!addr)
	if (!page)
		return NULL;

	pci_read_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, &temp);
	pci_write_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL,
			(((temp & ALI_CACHE_FLUSH_ADDR_MASK) |
			  virt_to_gart(addr)) | ALI_CACHE_FLUSH_EN ));
	return addr;
			  phys_to_gart(page_to_phys(page))) | ALI_CACHE_FLUSH_EN ));
	return page;
}

static void ali_destroy_page(void * addr, int flags)
static void ali_destroy_page(struct page *page, int flags)
{
	if (addr) {
	if (page) {
		if (flags & AGP_PAGE_DESTROY_UNMAP) {
			global_cache_flush();	/* is this really needed?  --hch */
			agp_generic_destroy_page(addr, flags);
			agp_generic_destroy_page(page, flags);
		} else
			agp_generic_destroy_page(addr, flags);
			agp_generic_destroy_page(page, flags);
	}
}

static void m1541_destroy_page(void * addr, int flags)
static void m1541_destroy_page(struct page *page, int flags)
{
	u32 temp;

	if (addr == NULL)
	if (page == NULL)
		return;

	if (flags & AGP_PAGE_DESTROY_UNMAP) {
@@ -180,9 +180,9 @@ static void m1541_destroy_page(void * addr, int flags)
		pci_read_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, &temp);
		pci_write_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL,
				       (((temp & ALI_CACHE_FLUSH_ADDR_MASK) |
					 virt_to_gart(addr)) | ALI_CACHE_FLUSH_EN));
					 phys_to_gart(page_to_phys(page))) | ALI_CACHE_FLUSH_EN));
	}
	agp_generic_destroy_page(addr, flags);
	agp_generic_destroy_page(page, flags);
}


+1 −1
Original line number Diff line number Diff line
@@ -325,7 +325,7 @@ static int amd_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
		addr = (j * PAGE_SIZE) + agp_bridge->gart_bus_addr;
		cur_gatt = GET_GATT(addr);
		writel(agp_generic_mask_memory(agp_bridge,
			mem->memory[i], mem->type), cur_gatt+GET_GATT_OFF(addr));
			mem->pages[i], mem->type), cur_gatt+GET_GATT_OFF(addr));
		readl(cur_gatt+GET_GATT_OFF(addr));	/* PCI Posting. */
	}
	amd_irongate_tlbflush(mem);
+1 −1
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ static int amd64_insert_memory(struct agp_memory *mem, off_t pg_start, int type)

	for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
		tmp = agp_bridge->driver->mask_memory(agp_bridge,
			mem->memory[i], mask_type);
			mem->pages[i], mask_type);

		BUG_ON(tmp & 0xffffff0000000ffcULL);
		pte = (tmp & 0x000000ff00000000ULL) >> 28;
+3 −2
Original line number Diff line number Diff line
@@ -297,7 +297,8 @@ static int ati_insert_memory(struct agp_memory * mem,
		addr = (j * PAGE_SIZE) + agp_bridge->gart_bus_addr;
		cur_gatt = GET_GATT(addr);
		writel(agp_bridge->driver->mask_memory(agp_bridge,	
			mem->memory[i], mem->type), cur_gatt+GET_GATT_OFF(addr));
						       mem->pages[i], mem->type),
		       cur_gatt+GET_GATT_OFF(addr));
		readl(cur_gatt+GET_GATT_OFF(addr));	/* PCI Posting. */
	}
	agp_bridge->driver->tlb_flush(mem);
Loading