diff options
| author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2010-01-04 02:16:23 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2010-01-13 05:15:37 -0500 |
| commit | 42590a75019a50012f25a962246498dead428433 (patch) | |
| tree | f248821c7f38d988e2d03ddaaa7c63c59e0e3206 | |
| parent | fcfbb2b5facd65efa7284cc315225bfe3d1856c2 (diff) | |
x86/agp: Fix agp_amd64_init and agp_amd64_cleanup
This fixes the regression introduced by the commit
f405d2c02395a74d3883bd03ded36457aa3697ad.
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>
| -rw-r--r-- | arch/x86/kernel/aperture_64.c | 1 | ||||
| -rw-r--r-- | drivers/char/agp/amd64-agp.c | 5 |
2 files changed, 4 insertions, 2 deletions
diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c index 3704997e8b25..f147a95fd84a 100644 --- a/arch/x86/kernel/aperture_64.c +++ b/arch/x86/kernel/aperture_64.c | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | #include <asm/x86_init.h> | 31 | #include <asm/x86_init.h> |
| 32 | 32 | ||
| 33 | int gart_iommu_aperture; | 33 | int gart_iommu_aperture; |
| 34 | EXPORT_SYMBOL_GPL(gart_iommu_aperture); | ||
| 34 | int gart_iommu_aperture_disabled __initdata; | 35 | int gart_iommu_aperture_disabled __initdata; |
| 35 | int gart_iommu_aperture_allowed __initdata; | 36 | int gart_iommu_aperture_allowed __initdata; |
| 36 | 37 | ||
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c index 5aa7a586a7ff..1afb8968a342 100644 --- a/drivers/char/agp/amd64-agp.c +++ b/drivers/char/agp/amd64-agp.c | |||
| @@ -725,12 +725,11 @@ static struct pci_driver agp_amd64_pci_driver = { | |||
| 725 | int __init agp_amd64_init(void) | 725 | int __init agp_amd64_init(void) |
| 726 | { | 726 | { |
| 727 | int err = 0; | 727 | int err = 0; |
| 728 | static int done = 0; | ||
| 729 | 728 | ||
| 730 | if (agp_off) | 729 | if (agp_off) |
| 731 | return -EINVAL; | 730 | return -EINVAL; |
| 732 | 731 | ||
| 733 | if (done++) | 732 | if (gart_iommu_aperture) |
| 734 | return agp_bridges_found ? 0 : -ENODEV; | 733 | return agp_bridges_found ? 0 : -ENODEV; |
| 735 | 734 | ||
| 736 | err = pci_register_driver(&agp_amd64_pci_driver); | 735 | err = pci_register_driver(&agp_amd64_pci_driver); |
| @@ -771,6 +770,8 @@ int __init agp_amd64_init(void) | |||
| 771 | 770 | ||
| 772 | static void __exit agp_amd64_cleanup(void) | 771 | static void __exit agp_amd64_cleanup(void) |
| 773 | { | 772 | { |
| 773 | if (gart_iommu_aperture) | ||
| 774 | return; | ||
| 774 | if (aperture_resource) | 775 | if (aperture_resource) |
| 775 | release_resource(aperture_resource); | 776 | release_resource(aperture_resource); |
| 776 | pci_unregister_driver(&agp_amd64_pci_driver); | 777 | pci_unregister_driver(&agp_amd64_pci_driver); |
