diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2009-12-28 04:11:56 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-12-30 05:52:04 -0500 |
commit | f405d2c02395a74d3883bd03ded36457aa3697ad (patch) | |
tree | fb99279e64191fb9276a1f8b5c0ad90b65913d39 /drivers/char/agp/amd64-agp.c | |
parent | 39d30770992895d55789de64bad2349510af68d0 (diff) |
x86/agp: Fix agp_amd64_init() initialization with CONFIG_GART_IOMMU enabled
with CONFIG_GART_IOMMU enabled drivers/char/agp/amd64-agp.c has:
#ifndef CONFIG_GART_IOMMU
module_init(agp_amd64_init);
module_exit(agp_amd64_cleanup);
#endif
agp_amd64_init() was called via gart_iommu_init with
CONFIG_GART_IOMMU=y agp_amd64_init() was called via module_init
with CONFIG_GART_IOMMU=n
The commit 75f1cdf1dda92cae037ec848ae63690d91913eac changes the
x86 dma initialization routine: gart_iommu_init() is called only
when GART IOMMU is detected. So when GART IOMMU isn't detected,
agp_amd64_init isn't called.
Marin Mitov reported this issue:
http://marc.info/?l=linux-kernel&m=126192729110083&w=2
With this patch, agp_amd64_init() is always called via
module_init (the above ifndef is removed). If agp_amd64_init()
is called via gart_iommu_init() earlier, agp_amd64_init()
finishes without doing anything (when it is called via
module_init).
Reported-by: Marin Mitov <mitov@issp.bas.bg>
Tested-by: Marin Mitov <mitov@issp.bas.bg>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: davej@redhat.com
LKML-Reference: <20091228181118C.fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'drivers/char/agp/amd64-agp.c')
-rw-r--r-- | drivers/char/agp/amd64-agp.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c index 2fb2e6cc322a..5aa7a586a7ff 100644 --- a/drivers/char/agp/amd64-agp.c +++ b/drivers/char/agp/amd64-agp.c | |||
@@ -725,9 +725,14 @@ 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; | ||
728 | 729 | ||
729 | if (agp_off) | 730 | if (agp_off) |
730 | return -EINVAL; | 731 | return -EINVAL; |
732 | |||
733 | if (done++) | ||
734 | return agp_bridges_found ? 0 : -ENODEV; | ||
735 | |||
731 | err = pci_register_driver(&agp_amd64_pci_driver); | 736 | err = pci_register_driver(&agp_amd64_pci_driver); |
732 | if (err < 0) | 737 | if (err < 0) |
733 | return err; | 738 | return err; |
@@ -771,12 +776,8 @@ static void __exit agp_amd64_cleanup(void) | |||
771 | pci_unregister_driver(&agp_amd64_pci_driver); | 776 | pci_unregister_driver(&agp_amd64_pci_driver); |
772 | } | 777 | } |
773 | 778 | ||
774 | /* On AMD64 the PCI driver needs to initialize this driver early | ||
775 | for the IOMMU, so it has to be called via a backdoor. */ | ||
776 | #ifndef CONFIG_GART_IOMMU | ||
777 | module_init(agp_amd64_init); | 779 | module_init(agp_amd64_init); |
778 | module_exit(agp_amd64_cleanup); | 780 | module_exit(agp_amd64_cleanup); |
779 | #endif | ||
780 | 781 | ||
781 | MODULE_AUTHOR("Dave Jones <davej@redhat.com>, Andi Kleen"); | 782 | MODULE_AUTHOR("Dave Jones <davej@redhat.com>, Andi Kleen"); |
782 | module_param(agp_try_unsupported, bool, 0); | 783 | module_param(agp_try_unsupported, bool, 0); |