Skip to content

Commit

Permalink
x86: Gart: fix breakage due to IOMMU initialization cleanup
Browse files Browse the repository at this point in the history
This fixes the following breakage of the commit
75f1cdf:

- GART systems that don't AGP with broken BIOS and more than 4GB
  memory are forced to use swiotlb. They can allocate aperture by
  hand and use GART.

- GART systems without GAP must disable GART on shutdown.

- swiotlb usage is forced by the boot option,
  gart_iommu_hole_init() is not called, so we disable GART
  early_gart_iommu_check().

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
LKML-Reference: <1260759135-6450-3-git-send-email-fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Yinghai Lu authored and Ingo Molnar committed Dec 14, 2009
1 parent f4780ca commit f3eee54
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 6 additions & 5 deletions arch/x86/kernel/aperture_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@ void __init early_gart_iommu_check(void)
* or BIOS forget to put that in reserved.
* try to update e820 to make that region as reserved.
*/
int i, fix, slot;
u32 agp_aper_base = 0, agp_aper_order = 0;
int i, fix, slot, valid_agp = 0;
u32 ctl;
u32 aper_size = 0, aper_order = 0, last_aper_order = 0;
u64 aper_base = 0, last_aper_base = 0;
Expand All @@ -290,6 +291,8 @@ void __init early_gart_iommu_check(void)
return;

/* This is mostly duplicate of iommu_hole_init */
agp_aper_base = search_agp_bridge(&agp_aper_order, &valid_agp);

fix = 0;
for (i = 0; i < ARRAY_SIZE(bus_dev_ranges); i++) {
int bus;
Expand Down Expand Up @@ -342,10 +345,10 @@ void __init early_gart_iommu_check(void)
}
}

if (!fix)
if (valid_agp)
return;

/* different nodes have different setting, disable them all at first*/
/* disable them all at first */
for (i = 0; i < ARRAY_SIZE(bus_dev_ranges); i++) {
int bus;
int dev_base, dev_limit;
Expand Down Expand Up @@ -458,8 +461,6 @@ void __init gart_iommu_hole_init(void)

if (aper_alloc) {
/* Got the aperture from the AGP bridge */
} else if (!valid_agp) {
/* Do nothing */
} else if ((!no_iommu && max_pfn > MAX_DMA32_PFN) ||
force_iommu ||
valid_agp ||
Expand Down
3 changes: 2 additions & 1 deletion arch/x86/kernel/pci-gart_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,8 @@ static void gart_iommu_shutdown(void)
struct pci_dev *dev;
int i;

if (no_agp)
/* don't shutdown it if there is AGP installed */
if (!no_agp)
return;

for (i = 0; i < num_k8_northbridges; i++) {
Expand Down

0 comments on commit f3eee54

Please sign in to comment.