Commit fc619013 authored by David Woodhouse's avatar David Woodhouse Committed by Eric Anholt

agp/intel-agp: Clear entire GTT on startup

Some BIOSes fail to initialise the GTT, which will cause DMA faults when
the IOMMU is enabled. We need to clear the whole thing to point at the
scratch page, not just the part that Linux is going to use.
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
[anholt: Note that this may also help with stability in the presence of
driver bugs, by not drawing to memory we don't own]
Signed-off-by: default avatarEric Anholt <eric@anholt.net>
parent f2b115e6
...@@ -176,6 +176,7 @@ static struct _intel_private { ...@@ -176,6 +176,7 @@ static struct _intel_private {
* popup and for the GTT. * popup and for the GTT.
*/ */
int gtt_entries; /* i830+ */ int gtt_entries; /* i830+ */
int gtt_total_size;
union { union {
void __iomem *i9xx_flush_page; void __iomem *i9xx_flush_page;
void *i8xx_flush_page; void *i8xx_flush_page;
...@@ -1151,7 +1152,7 @@ static int intel_i915_configure(void) ...@@ -1151,7 +1152,7 @@ static int intel_i915_configure(void)
readl(intel_private.registers+I810_PGETBL_CTL); /* PCI Posting. */ readl(intel_private.registers+I810_PGETBL_CTL); /* PCI Posting. */
if (agp_bridge->driver->needs_scratch_page) { if (agp_bridge->driver->needs_scratch_page) {
for (i = intel_private.gtt_entries; i < current_size->num_entries; i++) { for (i = intel_private.gtt_entries; i < intel_private.gtt_total_size; i++) {
writel(agp_bridge->scratch_page, intel_private.gtt+i); writel(agp_bridge->scratch_page, intel_private.gtt+i);
} }
readl(intel_private.gtt+i-1); /* PCI Posting. */ readl(intel_private.gtt+i-1); /* PCI Posting. */
...@@ -1312,6 +1313,8 @@ static int intel_i915_create_gatt_table(struct agp_bridge_data *bridge) ...@@ -1312,6 +1313,8 @@ static int intel_i915_create_gatt_table(struct agp_bridge_data *bridge)
if (!intel_private.gtt) if (!intel_private.gtt)
return -ENOMEM; return -ENOMEM;
intel_private.gtt_total_size = gtt_map_size / 4;
temp &= 0xfff80000; temp &= 0xfff80000;
intel_private.registers = ioremap(temp, 128 * 4096); intel_private.registers = ioremap(temp, 128 * 4096);
...@@ -1398,6 +1401,8 @@ static int intel_i965_create_gatt_table(struct agp_bridge_data *bridge) ...@@ -1398,6 +1401,8 @@ static int intel_i965_create_gatt_table(struct agp_bridge_data *bridge)
if (!intel_private.gtt) if (!intel_private.gtt)
return -ENOMEM; return -ENOMEM;
intel_private.gtt_total_size = gtt_size / 4;
intel_private.registers = ioremap(temp, 128 * 4096); intel_private.registers = ioremap(temp, 128 * 4096);
if (!intel_private.registers) { if (!intel_private.registers) {
iounmap(intel_private.gtt); iounmap(intel_private.gtt);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment