Skip to content

Commit

Permalink
x86/agp: Fix agp_amd64_init and agp_amd64_cleanup
Browse files Browse the repository at this point in the history
This fixes the regression introduced by the commit
f405d2c.

The above commit fixes the following issue:

  http://marc.info/?l=linux-kernel&m=126192729110083&w=2

However, it doesn't work properly when you remove and insert the
agp_amd64 module again.

agp_amd64_init() and agp_amd64_cleanup should be called only
when gart_iommu is not called earlier (that is, the GART IOMMU
is not enabled). We need to use 'gart_iommu_aperture' to see if
GART IOMMU is enabled or not.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: mitov@issp.bas.bg
Cc: davej@redhat.com
LKML-Reference: <20100104161603L.fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
FUJITA Tomonori authored and Ingo Molnar committed Jan 13, 2010
1 parent fcfbb2b commit 42590a7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions arch/x86/kernel/aperture_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <asm/x86_init.h>

int gart_iommu_aperture;
EXPORT_SYMBOL_GPL(gart_iommu_aperture);
int gart_iommu_aperture_disabled __initdata;
int gart_iommu_aperture_allowed __initdata;

Expand Down
5 changes: 3 additions & 2 deletions drivers/char/agp/amd64-agp.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,12 +725,11 @@ static struct pci_driver agp_amd64_pci_driver = {
int __init agp_amd64_init(void)
{
int err = 0;
static int done = 0;

if (agp_off)
return -EINVAL;

if (done++)
if (gart_iommu_aperture)
return agp_bridges_found ? 0 : -ENODEV;

err = pci_register_driver(&agp_amd64_pci_driver);
Expand Down Expand Up @@ -771,6 +770,8 @@ int __init agp_amd64_init(void)

static void __exit agp_amd64_cleanup(void)
{
if (gart_iommu_aperture)
return;
if (aperture_resource)
release_resource(aperture_resource);
pci_unregister_driver(&agp_amd64_pci_driver);
Expand Down

0 comments on commit 42590a7

Please sign in to comment.