2008-10-27 08:18:25

by Mikael Pettersson

[permalink] [raw]
Subject: [PATCH 2.6.28-rc2] i386: fix forbid_dac linkage error when CONFIG_PCI=n

Fix 2.6.28-rc2 build failure on i386 with CONFIG_PCI=n:

ld -m elf_i386 -o .tmp_vmlinux1 -T arch/x86/kernel/vmlinux.lds arch/x86/kernel/head_32.o arch/x86/kernel/head32.o arch/x86/kernel/head.o arch/x86/kernel/init_task.o init/built-in.o --start-group usr/built-in.o arch/x86/kernel/built-in.o arch/x86/mm/built-in.o arch/x86/mach-default/built-in.o arch/x86/crypto/built-in.o arch/x86/vdso/built-in.o kernel/built-in.o mm/built-in.o fs/built-in.o ipc/built-in.o security/built-in.o crypto/built-in.o block/built-in.o lib/lib.a arch/x86/lib/lib.a lib/built-in.o arch/x86/lib/built-in.o drivers/built-in.o sound/built-in.o firmware/built-in.o net/built-in.o --end-group
arch/x86/kernel/built-in.o: In function `iommu_setup':
pci-dma.c:(.init.text+0x3120): undefined reference to `forbid_dac'
pci-dma.c:(.init.text+0x313f): undefined reference to `forbid_dac'
pci-dma.c:(.init.text+0x3187): undefined reference to `forbid_dac'
make: *** [.tmp_vmlinux1] Error 1

The variable forbid_dac was moved from arch/x86/kernel/pci-dma.c
to drivers/pci/quirks.c. When CONFIG_PCI=n pci-dma.c now refers to
a variable that's never defined, causing a linkage error.

Fixed by bracketing the forbid_dac accesses (command-line options
parsing) with #ifdef CONFIG_PCI ... #endif.

Signed-off-by: Mikael Pettersson <[email protected]>
---
arch/x86/kernel/pci-dma.c | 2 ++
1 file changed, 2 insertions(+)

diff -rupN linux-2.6.28-rc2/arch/x86/kernel/pci-dma.c linux-2.6.28-rc2.x86-forbid_dac-is-pci-only/arch/x86/kernel/pci-dma.c
--- linux-2.6.28-rc2/arch/x86/kernel/pci-dma.c 2008-10-26 21:35:33.000000000 +0100
+++ linux-2.6.28-rc2.x86-forbid_dac-is-pci-only/arch/x86/kernel/pci-dma.c 2008-10-27 08:55:10.000000000 +0100
@@ -202,6 +202,7 @@ static __init int iommu_setup(char *p)
iommu_merge = 0;
if (!strncmp(p, "forcesac", 8))
iommu_sac_force = 1;
+#ifdef CONFIG_PCI
if (!strncmp(p, "allowdac", 8))
forbid_dac = 0;
if (!strncmp(p, "nodac", 5))
@@ -210,6 +211,7 @@ static __init int iommu_setup(char *p)
forbid_dac = -1;
return 1;
}
+#endif /* CONFIG_PCI */
#ifdef CONFIG_SWIOTLB
if (!strncmp(p, "soft", 4))
swiotlb = 1;


2008-10-27 09:42:26

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH 2.6.28-rc2] i386: fix forbid_dac linkage error when CONFIG_PCI=n


* Mikael Pettersson <[email protected]> wrote:

> Fix 2.6.28-rc2 build failure on i386 with CONFIG_PCI=n:

> +#ifdef CONFIG_PCI
> if (!strncmp(p, "allowdac", 8))
> forbid_dac = 0;
> if (!strncmp(p, "nodac", 5))
> @@ -210,6 +211,7 @@ static __init int iommu_setup(char *p)
> forbid_dac = -1;
> return 1;
> }
> +#endif /* CONFIG_PCI */

there's a better fix for this queued up in the PCI tree, see:

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

Ingo

2008-10-27 10:07:30

by Mikael Pettersson

[permalink] [raw]
Subject: Re: [PATCH 2.6.28-rc2] i386: fix forbid_dac linkage error when CONFIG_PCI=n

Ingo Molnar writes:
>
> * Mikael Pettersson <[email protected]> wrote:
>
> > Fix 2.6.28-rc2 build failure on i386 with CONFIG_PCI=n:
>
> > +#ifdef CONFIG_PCI
> > if (!strncmp(p, "allowdac", 8))
> > forbid_dac = 0;
> > if (!strncmp(p, "nodac", 5))
> > @@ -210,6 +211,7 @@ static __init int iommu_setup(char *p)
> > forbid_dac = -1;
> > return 1;
> > }
> > +#endif /* CONFIG_PCI */
>
> there's a better fix for this queued up in the PCI tree, see:
>
> http://marc.info/?l=linux-kernel&m=122480590627590&w=2

Got it. Thanks.

/Mikael