Commit f405d2c0 authored by FUJITA Tomonori's avatar FUJITA Tomonori Committed by Ingo Molnar

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 75f1cdf1 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: default avatarMarin Mitov <mitov@issp.bas.bg>
Tested-by: default avatarMarin Mitov <mitov@issp.bas.bg>
Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: davej@redhat.com
LKML-Reference: <20091228181118C.fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 39d30770
...@@ -725,9 +725,14 @@ static struct pci_driver agp_amd64_pci_driver = { ...@@ -725,9 +725,14 @@ static struct pci_driver agp_amd64_pci_driver = {
int __init agp_amd64_init(void) int __init agp_amd64_init(void)
{ {
int err = 0; int err = 0;
static int done = 0;
if (agp_off) if (agp_off)
return -EINVAL; return -EINVAL;
if (done++)
return agp_bridges_found ? 0 : -ENODEV;
err = pci_register_driver(&agp_amd64_pci_driver); err = pci_register_driver(&agp_amd64_pci_driver);
if (err < 0) if (err < 0)
return err; return err;
...@@ -771,12 +776,8 @@ static void __exit agp_amd64_cleanup(void) ...@@ -771,12 +776,8 @@ static void __exit agp_amd64_cleanup(void)
pci_unregister_driver(&agp_amd64_pci_driver); pci_unregister_driver(&agp_amd64_pci_driver);
} }
/* On AMD64 the PCI driver needs to initialize this driver early
for the IOMMU, so it has to be called via a backdoor. */
#ifndef CONFIG_GART_IOMMU
module_init(agp_amd64_init); module_init(agp_amd64_init);
module_exit(agp_amd64_cleanup); module_exit(agp_amd64_cleanup);
#endif
MODULE_AUTHOR("Dave Jones <davej@redhat.com>, Andi Kleen"); MODULE_AUTHOR("Dave Jones <davej@redhat.com>, Andi Kleen");
module_param(agp_try_unsupported, bool, 0); module_param(agp_try_unsupported, bool, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment