Skip to content

Commit d357253

Browse files
committed
agp/intel: Use CPU physical address, not bus address, for ioremap()
In i810_setup(), i830_setup(), and i9xx_setup(), we use the result of pci_bus_address() as an argument to ioremap() and to compute gtt_phys_addr. These should use pci_resource_start() instead because we want the CPU physical address, not the bus address. If there were an AGP device behind a host bridge that translated addresses, e.g., a PNP0A08 device with _TRA != 0, this would fix a bug. I'm not aware of any of those, but they are possible. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
1 parent b5e350f commit d357253

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/char/agp/intel-gtt.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ static void i8xx_destroy_pages(struct page *page)
172172
#define I810_GTT_ORDER 4
173173
static int i810_setup(void)
174174
{
175-
u32 reg_addr;
175+
phys_addr_t reg_addr;
176176
char *gtt_table;
177177

178178
/* i81x does not preallocate the gtt. It's always 64kb in size. */
@@ -181,7 +181,7 @@ static int i810_setup(void)
181181
return -ENOMEM;
182182
intel_private.i81x_gtt_table = gtt_table;
183183

184-
reg_addr = pci_bus_address(intel_private.pcidev, I810_MMADR_BAR);
184+
reg_addr = pci_resource_start(intel_private.pcidev, I810_MMADR_BAR);
185185

186186
intel_private.registers = ioremap(reg_addr, KB(64));
187187
if (!intel_private.registers)
@@ -782,9 +782,9 @@ EXPORT_SYMBOL(intel_enable_gtt);
782782

783783
static int i830_setup(void)
784784
{
785-
u32 reg_addr;
785+
phys_addr_t reg_addr;
786786

787-
reg_addr = pci_bus_address(intel_private.pcidev, I810_MMADR_BAR);
787+
reg_addr = pci_resource_start(intel_private.pcidev, I810_MMADR_BAR);
788788

789789
intel_private.registers = ioremap(reg_addr, KB(64));
790790
if (!intel_private.registers)
@@ -1102,10 +1102,10 @@ static void i965_write_entry(dma_addr_t addr,
11021102

11031103
static int i9xx_setup(void)
11041104
{
1105-
u32 reg_addr;
1105+
phys_addr_t reg_addr;
11061106
int size = KB(512);
11071107

1108-
reg_addr = pci_bus_address(intel_private.pcidev, I915_MMADR_BAR);
1108+
reg_addr = pci_resource_start(intel_private.pcidev, I915_MMADR_BAR);
11091109

11101110
intel_private.registers = ioremap(reg_addr, size);
11111111
if (!intel_private.registers)
@@ -1114,7 +1114,7 @@ static int i9xx_setup(void)
11141114
switch (INTEL_GTT_GEN) {
11151115
case 3:
11161116
intel_private.gtt_phys_addr =
1117-
pci_bus_address(intel_private.pcidev, I915_PTE_BAR);
1117+
pci_resource_start(intel_private.pcidev, I915_PTE_BAR);
11181118
break;
11191119
case 5:
11201120
intel_private.gtt_phys_addr = reg_addr + MB(2);

0 commit comments

Comments
 (0)