Skip to contentSkip to conversation

Undefined '.bus_to_virt', '.virt_to_bus' causes compile error on Powerpc 64-bit

PATCH In review Judith Lebzelter 9 participants 19 messages Oct 2, 2006 – Oct 3, 2006

lore
Share & tools
lore
#0 lore raw

Hello:

For the automated cross-compile builds at OSDL, powerpc 64-bit 'allmodconfig' is failing. The warnings/errors below appear in the 'modpost' stage of kernel compiles for 2.6.18 and -mm2 kernels.

Thanks;
Judith Lebzelter
OSDL

-----------

Building modules, stage 2.
MODPOST 1658 modules
WARNING: Can't handle masks in drivers/ata/ahci:FFFF05
WARNING: ".virt_to_bus" [sound/oss/sscape.ko] undefined!
WARNING: ".virt_to_bus" [sound/oss/sound.ko] undefined!
WARNING: ".bus_to_virt" [sound/oss/cs46xx.ko] undefined!
WARNING: ".virt_to_bus" [sound/oss/cs46xx.ko] undefined!
WARNING: ".bus_to_virt" [drivers/scsi/tmscsim.ko] undefined!
WARNING: ".bus_to_virt" [drivers/scsi/BusLogic.ko] undefined!
WARNING: ".virt_to_bus" [drivers/net/wan/lmc/lmc.ko] undefined!
WARNING: ".virt_to_bus" [drivers/message/i2o/i2o_config.ko] undefined!
WARNING: ".bus_to_virt" [drivers/block/cpqarray.ko] undefined!
WARNING: ".bus_to_virt" [drivers/atm/zatm.ko] undefined!
WARNING: ".virt_to_bus" [drivers/atm/zatm.ko] undefined!
WARNING: ".bus_to_virt" [drivers/atm/horizon.ko] undefined!
WARNING: ".virt_to_bus" [drivers/atm/firestream.ko] undefined!
WARNING: ".bus_to_virt" [drivers/atm/firestream.ko] undefined!
WARNING: ".bus_to_virt" [drivers/atm/ambassador.ko] undefined!
WARNING: ".virt_to_bus" [drivers/atm/ambassador.ko] undefined! make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2

#1 lore raw
Quoted 1 line · Judith Lebzelter

Hello:

Hi Judith,

Quoted 3 lines

For the automated cross-compile builds at OSDL, powerpc 64-bit 'allmodconfig' is failing. The warnings/errors below appear in the 'modpost' stage of kernel compiles for 2.6.18 and -mm2 kernels.

known for ages - the drivers need fixing.

You might want to convince Andrew accepting my patch to make virt_to_bus/bus_to_virt give compile warnings on i386 for making people more aware of this problem...

Quoted 19 lines

Thanks;
Judith Lebzelter
OSDL

-----------

Building modules, stage 2.
MODPOST 1658 modules
WARNING: Can't handle masks in drivers/ata/ahci:FFFF05
WARNING: ".virt_to_bus" [sound/oss/sscape.ko] undefined!
WARNING: ".virt_to_bus" [sound/oss/sound.ko] undefined!
WARNING: ".bus_to_virt" [sound/oss/cs46xx.ko] undefined!
WARNING: ".virt_to_bus" [sound/oss/cs46xx.ko] undefined!
WARNING: ".bus_to_virt" [drivers/scsi/tmscsim.ko] undefined!
WARNING: ".bus_to_virt" [drivers/scsi/BusLogic.ko] undefined!
WARNING: ".virt_to_bus" [drivers/net/wan/lmc/lmc.ko] undefined!
WARNING: ".virt_to_bus" [drivers/message/i2o/i2o_config.ko] undefined!
WARNING: ".bus_to_virt" [drivers/block/cpqarray.ko] undefined!
WARNING: ".bus_to_virt" [drivers/atm/zatm.ko] undefined!

Quoted 9 lines

WARNING: ".virt_to_bus" [drivers/atm/zatm.ko] undefined!
WARNING: ".bus_to_virt" [drivers/atm/horizon.ko] undefined!
WARNING: ".virt_to_bus" [drivers/atm/firestream.ko] undefined!
WARNING: ".bus_to_virt" [drivers/atm/firestream.ko] undefined!
WARNING: ".bus_to_virt" [drivers/atm/ambassador.ko] undefined!
WARNING: ".virt_to_bus" [drivers/atm/ambassador.ko] undefined! make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#16 lore raw
In reply to Judith Lebzelter
Quoted 5 lines · Judith Lebzelter

Hello:

For the automated cross-compile builds at OSDL, powerpc 64-bit 'allmodconfig' is failing. The warnings/errors below appear in the 'modpost' stage of kernel compiles for 2.6.18 and -mm2 kernels.

All those drivers are bogus and need to be updated. They should be marked CONFIG_BROKEN

Ben.

Quoted 32 lines

Thanks;
Judith Lebzelter
OSDL

-----------

Building modules, stage 2.
MODPOST 1658 modules
WARNING: Can't handle masks in drivers/ata/ahci:FFFF05
WARNING: ".virt_to_bus" [sound/oss/sscape.ko] undefined!
WARNING: ".virt_to_bus" [sound/oss/sound.ko] undefined!
WARNING: ".bus_to_virt" [sound/oss/cs46xx.ko] undefined!
WARNING: ".virt_to_bus" [sound/oss/cs46xx.ko] undefined!
WARNING: ".bus_to_virt" [drivers/scsi/tmscsim.ko] undefined!
WARNING: ".bus_to_virt" [drivers/scsi/BusLogic.ko] undefined!
WARNING: ".virt_to_bus" [drivers/net/wan/lmc/lmc.ko] undefined!
WARNING: ".virt_to_bus" [drivers/message/i2o/i2o_config.ko] undefined!
WARNING: ".bus_to_virt" [drivers/block/cpqarray.ko] undefined!
WARNING: ".bus_to_virt" [drivers/atm/zatm.ko] undefined!
WARNING: ".virt_to_bus" [drivers/atm/zatm.ko] undefined!
WARNING: ".bus_to_virt" [drivers/atm/horizon.ko] undefined!
WARNING: ".virt_to_bus" [drivers/atm/firestream.ko] undefined!
WARNING: ".bus_to_virt" [drivers/atm/firestream.ko] undefined!
WARNING: ".bus_to_virt" [drivers/atm/ambassador.ko] undefined!
WARNING: ".virt_to_bus" [drivers/atm/ambassador.ko] undefined! make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev

#18 lore raw
In reply to Judith Lebzelter

Judith,

Quoted 3 lines

For the automated cross-compile builds at OSDL, powerpc 64-bit 'allmodconfig' is failing. The warnings/errors below appear in the 'modpost' stage of kernel compiles for 2.6.18 and -mm2 kernels.

virt_to_bus and bus_to_virt are old interfaces that have been deprecated for, oh, at least 5 years now, and can't be implemented sanely on machines with an IOMMU - which includes all 64-bit powerpc machines.

Unless someone pops up and volunteers to fix those old drivers, which is unlikely, the only solution is to fix the Kconfig files to prevent them from being selected on platforms that don't have virt_to_bus and bus_to_virt.

Paul.

#2 lore raw

PATCH 1/1 mark virt_to_bus/bus_to_virt as __deprecated on i386

In reply to Adrian Bunk
Quoted 10 lines · Adrian Bunk
Quoted 1 line · Judith Lebzelter

Hello:

Hi Judith,

Quoted 3 lines

For the automated cross-compile builds at OSDL, powerpc 64-bit 'allmodconfig' is failing. The warnings/errors below appear in the 'modpost' stage of kernel compiles for 2.6.18 and -mm2 kernels.

Quoted 6 lines

known for ages - the drivers need fixing.

You might want to convince Andrew accepting my patch to make virt_to_bus/bus_to_virt give compile warnings on i386 for making people more aware of this problem...
...

In case anyone is interested, the patch is below.

cu
Adrian

<-- snip -->

virt_to_bus/bus_to_virt are long deprecated, mark them as __deprecated on i386.

Without such warnings people will never update their code and fix the errors in PPC64 builds.

And yes, some of the drivers affected are maintained.

This also catches accidential additions of users for these functions like a usage of bus_to_virt() in the infiniband code that was added in 2.6.17-rc1 (already removed).

This patch increases the number of warnings shown during builds, but it seems worth including it at least in -mm for making people aware of this issue.

---

This patch was already sent on:
- 7 Jul 2006
- 26 Jun 2006
- 27 Apr 2006
- 19 Apr 2006
- 6 Jan 2006
- 13 Dec 2005
- 23 Nov 2005
- 18 Nov 2005
- 12 Nov 2005

include/asm-i386/io.h renamed from include/asm-i386/io.h.old +8 -2
@@ -144,8 +144,14 @@
  *
  * Allow them on x86 for legacy drivers, though.
  */
-#define virt_to_bus virt_to_phys
-#define bus_to_virt phys_to_virt
+static inline unsigned long __deprecated virt_to_bus(volatile void * address)
+{
+	return __pa(address);
+}
+static inline void * __deprecated bus_to_virt(unsigned long address)
+{
+	return __va(address);
+}
 
 /*
  * readX/writeX() are used to access memory mapped devices. On some
#3 lore raw

Re: [2.6 patch] mark virt_to_bus/bus_to_virt as __deprecated on i386

Quoted 18 lines · Adrian Bunk
Quoted 10 lines · Adrian Bunk
Quoted 1 line · Judith Lebzelter

Hello:

Hi Judith,

Quoted 3 lines

For the automated cross-compile builds at OSDL, powerpc 64-bit 'allmodconfig' is failing. The warnings/errors below appear in the 'modpost' stage of kernel compiles for 2.6.18 and -mm2 kernels.

Quoted 6 lines

known for ages - the drivers need fixing.

You might want to convince Andrew accepting my patch to make virt_to_bus/bus_to_virt give compile warnings on i386 for making people more aware of this problem...
...

Quoted 5 lines

In case anyone is interested, the patch is below.

cu
Adrian

Won't this also cause warnings for valid arch-specific usage (i.e. in linux/arch/{i386,x86_64})?

Signature · 1 line
Nicholas Miell <[email protected]>
#4 lore raw

Re: [2.6 patch] mark virt_to_bus/bus_to_virt as __deprecated on i386

Quoted 19 lines · Nicholas Miell
Quoted 18 lines · Adrian Bunk
Quoted 16 lines · Adrian Bunk
Quoted 1 line · Judith Lebzelter

Hello:

Hi Judith,

Quoted 3 lines

For the automated cross-compile builds at OSDL, powerpc 64-bit 'allmodconfig' is failing. The warnings/errors below appear in the 'modpost' stage of kernel compiles for 2.6.18 and -mm2 kernels.

known for ages - the drivers need fixing.

You might want to convince Andrew accepting my patch to make virt_to_bus/bus_to_virt give compile warnings on i386 for making people more aware of this problem...
...

Quoted 8 lines
Quoted 5 lines

In case anyone is interested, the patch is below.

cu
Adrian

Won't this also cause warnings for valid arch-specific usage (i.e. in linux/arch/{i386,x86_64})?

They aren't used under linux/arch/i386/ and my patch doesn't change x86_64.

Quoted 1 line

Nicholas Miell <[email protected]>

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#5 lore raw

Re: [2.6 patch] mark virt_to_bus/bus_to_virt as __deprecated on i386

Quoted 22 lines · Adrian Bunk
Quoted 21 lines · Nicholas Miell
Quoted 20 lines · Adrian Bunk
Quoted 10 lines · Adrian Bunk
Quoted 1 line · Judith Lebzelter

Hello:

Hi Judith,

Quoted 3 lines

For the automated cross-compile builds at OSDL, powerpc 64-bit 'allmodconfig' is failing. The warnings/errors below appear in the 'modpost' stage of kernel compiles for 2.6.18 and -mm2 kernels.

Quoted 6 lines

known for ages - the drivers need fixing.

You might want to convince Andrew accepting my patch to make virt_to_bus/bus_to_virt give compile warnings on i386 for making people more aware of this problem...
...

In case anyone is interested, the patch is below.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

cu
Adrian

Won't this also cause warnings for valid arch-specific usage (i.e. in linux/arch/{i386,x86_64})?

They aren't used under linux/arch/i386/ and my patch doesn't change x86_64.

Sorry, for some reason I thought isa_bus_to_virt and isa_virt_to_bus were defined in terms of virt_to_bus/bus_to_virt instead of virt_to_phys/phys_to_virt.

Signature · 1 line
Nicholas Miell <[email protected]>
#8 lore raw

Re: [2.6 patch] mark virt_to_bus/bus_to_virt as __deprecated on i386

In reply to Adrian Bunk
Quoted 4 lines
Quoted 4 lines

You might want to convince Andrew accepting my patch to make virt_to_bus/bus_to_virt give compile warnings on i386 for making people more aware of this problem...
...

Andrew, is there any reason not to take that patch ?

Quoted 58 lines

<-- snip -->

virt_to_bus/bus_to_virt are long deprecated, mark them as __deprecated on i386.

Without such warnings people will never update their code and fix the errors in PPC64 builds.

And yes, some of the drivers affected are maintained.

This also catches accidential additions of users for these functions like a usage of bus_to_virt() in the infiniband code that was added in 2.6.17-rc1 (already removed).

This patch increases the number of warnings shown during builds, but it seems worth including it at least in -mm for making people aware of this issue.

---

This patch was already sent on:
- 7 Jul 2006
- 26 Jun 2006
- 27 Apr 2006
- 19 Apr 2006
- 6 Jan 2006
- 13 Dec 2005
- 23 Nov 2005
- 18 Nov 2005
- 12 Nov 2005

include/asm-i386/io.h renamed from include/asm-i386/io.h.old +8 -2
@@ -144,8 +144,14 @@
  *
  * Allow them on x86 for legacy drivers, though.
  */
-#define virt_to_bus virt_to_phys
-#define bus_to_virt phys_to_virt
+static inline unsigned long __deprecated virt_to_bus(volatile void * address)
+{
+	return __pa(address);
+}
+static inline void * __deprecated bus_to_virt(unsigned long address)
+{
+	return __va(address);
+}
 
 /*
  * readX/writeX() are used to access memory mapped devices. On some

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev

#6 lore raw

Re: [2.6 patch] mark virt_to_bus/bus_to_virt as __deprecated on i386

In reply to Nicholas Miell
Quoted 3 lines

Won't this also cause warnings for valid arch-specific usage (i.e. in linux/arch/{i386,x86_64})?

I wouldn't cause that usage valid :)

Ben.

#9 lore raw

Re: [2.6 patch] mark virt_to_bus/bus_to_virt as __deprecated on i386

In reply to Benjamin Herrenschmidt
Quoted 6 lines · On Tue, 03 Oct 2006 14:37:25 +1000 Benjamin Herrenschmidt…
Quoted 4 lines
Quoted 4 lines

You might want to convince Andrew accepting my patch to make virt_to_bus/bus_to_virt give compile warnings on i386 for making people more aware of this problem...
...

Andrew, is there any reason not to take that patch ?

It generates lots of warnings from drivers which nobody does any work on.

Net result: lots of new warnings, no fixed bugs.

#10 lore raw

Re: [2.6 patch] mark virt_to_bus/bus_to_virt as __deprecated on i386

Quoted 8 lines · Andrew Morton
Quoted 5 lines · On Tue, 03 Oct 2006 14:37:25 +1000 Benjamin Herrenschmidt…
Quoted 4 lines
Quoted 4 lines

You might want to convince Andrew accepting my patch to make virt_to_bus/bus_to_virt give compile warnings on i386 for making people more aware of this problem...
...

Quoted 5 lines
Quoted 1 line

Andrew, is there any reason not to take that patch ?

It generates lots of warnings from drivers which nobody does any work on.

Net result: lots of new warnings, no fixed bugs.

Are you sure the warnings won't cause somebody like Al to go through them all and fix them ?

At least they should be marked either CONFIG_BROKEN or X86 only (or whatever arch they are supposed to be used on).

Ben.

#11 lore raw

Re: [2.6 patch] mark virt_to_bus/bus_to_virt as __deprecated on i386

Quoted 9 lines · On Tue, 03 Oct 2006 14:49:39 +1000 Benjamin Herrenschmidt…
Quoted 8 lines · Andrew Morton
Quoted 5 lines · On Tue, 03 Oct 2006 14:37:25 +1000 Benjamin Herrenschmidt…
Quoted 4 lines
Quoted 4 lines

You might want to convince Andrew accepting my patch to make virt_to_bus/bus_to_virt give compile warnings on i386 for making people more aware of this problem...
...

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Andrew, is there any reason not to take that patch ?

It generates lots of warnings from drivers which nobody does any work on.

Net result: lots of new warnings, no fixed bugs.

Are you sure the warnings won't cause somebody like Al to go through them all and fix them ?

The drivers simply don't link on some architectures, due to missing
virt_to_bus/bus_to_virt. They aren't hard to find.

Quoted 3 lines

At least they should be marked either CONFIG_BROKEN or X86 only (or whatever arch they are supposed to be used on).

Something like that would make sense. I guess a new config option.

#12 lore raw

Re: [2.6 patch] mark virt_to_bus/bus_to_virt as __deprecated on i386

Quoted 16 lines · Andrew Morton
Quoted 13 lines · On Tue, 03 Oct 2006 14:49:39 +1000 Benjamin Herrenschmidt…
Quoted 12 lines · Andrew Morton
Quoted 6 lines · On Tue, 03 Oct 2006 14:37:25 +1000 Benjamin Herrenschmidt…
Quoted 4 lines
Quoted 4 lines

You might want to convince Andrew accepting my patch to make virt_to_bus/bus_to_virt give compile warnings on i386 for making people more aware of this problem...
...

Andrew, is there any reason not to take that patch ?

It generates lots of warnings from drivers which nobody does any work on.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Net result: lots of new warnings, no fixed bugs.

Are you sure the warnings won't cause somebody like Al to go through them all and fix them ?

The drivers simply don't link on some architectures, due to missing
virt_to_bus/bus_to_virt. They aren't hard to find.
...

As my patch description says, there had even been one bus_to_virt() accidentally added in 2.6.17-rc1.

Shouldn't people become aware of it as early and as often as possible?

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#13 lore raw

Re: [2.6 patch] mark virt_to_bus/bus_to_virt as __deprecated on i386

In reply to Benjamin Herrenschmidt
Quoted 5 lines · Benjamin Herrenschmidt
Quoted 1 line · Andrew Morton

Net result: lots of new warnings, no fixed bugs.

Are you sure the warnings won't cause somebody like Al to go through them all and fix them ?

If you mean by "fix" to actually convert to generic DMA mapping, then this task may turn out to require in-depth knowledge of the driver and its field of application in some or many of these cases.

Signature · 3 lines
Stefan Richter
-=====-=-==- =-=- ---==
http://arcgraph.de/sr/
#17 lore raw
In reply to Benjamin Herrenschmidt

Ar Maw, 2006-10-03 am 11:05 +1000, ysgrifennodd Benjamin Herrenschmidt:

Quoted 9 lines · Judith Lebzelter
Quoted 5 lines

Hello:

For the automated cross-compile builds at OSDL, powerpc 64-bit 'allmodconfig' is failing. The warnings/errors below appear in the 'modpost' stage of kernel compiles for 2.6.18 and -mm2 kernels.

All those drivers are bogus and need to be updated. They should be marked CONFIG_BROKEN

Several of them are only really meaningful on PC so marking them BROKEN is the wrong answer. Some of them definitely do need updating but stuff like the remaining OSS drivers are just waiting to die out quietly.

#14 lore raw

Re: [2.6 patch] mark virt_to_bus/bus_to_virt as __deprecated on i386

In reply to Adrian Bunk

Ar Maw, 2006-10-03 am 03:22 +0200, ysgrifennodd Adrian Bunk:

Quoted 10 lines

This patch was already sent on:
- 7 Jul 2006
- 26 Jun 2006
- 27 Apr 2006
- 19 Apr 2006
- 6 Jan 2006
- 13 Dec 2005
- 23 Nov 2005
- 18 Nov 2005
- 12 Nov 2005

This patch was already NAKed on
...

These functions are used internally in the x86 core code correctly and validly. It's just as easy to find the offenders with grep or building a PPC tree.

Acked-by
#7 lore raw

Re: [2.6 patch] mark virt_to_bus/bus_to_virt as __deprecated on i386

In reply to Benjamin Herrenschmidt

Ar Maw, 2006-10-03 am 14:37 +1000, ysgrifennodd Benjamin Herrenschmidt:

Quoted 4 lines
Quoted 2 lines

Won't this also cause warnings for valid arch-specific usage (i.e. in linux/arch/{i386,x86_64})?

I wouldn't cause that usage valid :)

Actually a lot of the older legitimate users (DRM/AGP) have been cleaned up so it might be worth doing now after all.

Ok I take back the NAK having looked deeper. We appear to have made sufficient progress along the way.

#15 lore raw
In reply to Adrian Bunk
Quoted 7 lines · Adrian Bunk
Quoted 3 lines · Judith Lebzelter

For the automated cross-compile builds at OSDL, powerpc 64-bit 'allmodconfig' is failing. The warnings/errors below appear in the 'modpost' stage of kernel compiles for 2.6.18 and -mm2 kernels.

known for ages - the drivers need fixing.

...

Quoted 1 line
Quoted 1 line

WARNING: ".bus_to_virt" [drivers/scsi/tmscsim.ko] undefined!

The problem with this one is that the code path, where bus_to_virt is used, is only executed under some very exotic circumstances, i.e., is practically untestable. I'll try to cook something up for that...

Thanks
Guennadi
---
Guennadi Liakhovetski