2012-11-12 16:19:44

by Hartley Sweeten

[permalink] [raw]
Subject: Q: Kconfig option VIRT_TO_BUS

Hello all,

Does anyone know what the Kconfig option VIRT_TO_BUS does?
There are a number of "depends on" that option but it does not
seem to directly enable any code in the kernel.

Thanks for any reply.

Regards,
Hartley


2012-11-12 18:41:13

by Bjorn Helgaas

[permalink] [raw]
Subject: Re: Q: Kconfig option VIRT_TO_BUS

On Mon, Nov 12, 2012 at 9:18 AM, H Hartley Sweeten
<[email protected]> wrote:
> Hello all,
>
> Does anyone know what the Kconfig option VIRT_TO_BUS does?
> There are a number of "depends on" that option but it does not
> seem to directly enable any code in the kernel.

virt_to_bus() is a deprecated interface for converting a kernel
virtual address to a bus address. It's deprecated because it's
impossible to implement correctly when there are multiple bus address
spaces, because you don't know which bus address space the caller has
in mind.

See Documentation/DMA-API-HOWTO.txt and
Documentation/bus-virt-phys-mapping.txt for more details about
virt_to_bus() and its replacements (dma_map_*()).

It looks like f057eac0d7ad967138390a9dd7fd8267e1e39d19 added
CONFIG_VIRT_TO_BUS as a way to prevent drivers that use virt_to_bus()
from being built on architectures that can't support virt_to_bus().

Architectures that can't implement virt_to_bus() set
CONFIG_ARCH_NO_VIRT_TO_BUS. It looks like powerpc, sh, and sparc
currently set it, but ia64, x86, and probably other arches should also
set it.

Bjorn

2012-11-12 21:26:31

by Stephen Rothwell

[permalink] [raw]
Subject: [PATCH] Centralise CONFIG_ARCH_NO_VIRT_TO_BUS

Make if easier for more architectures to select it and thus disable
drivers that use virt_to_bus().

Signed-off-by: Stephen Rothwell <[email protected]>
---
arch/Kconfig | 7 +++++++
arch/powerpc/Kconfig | 4 +---
arch/sh/Kconfig | 4 +---
arch/sparc/Kconfig | 4 +---
4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index 366ec06..9bc00e7 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -271,6 +271,13 @@ config ARCH_WANT_OLD_COMPAT_IPC
select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
bool

+config ARCH_NO_VIRT_TO_BUS
+ bool
+ help
+ An architecture should select this if it cannot (or will not)
+ implement virt_to_bus(). All new architectures should probably
+ select this.
+
config GENERIC_KERNEL_THREAD
bool

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index a902a5c..8c8fcba 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -87,9 +87,6 @@ config GENERIC_GPIO
help
Generic GPIO API support

-config ARCH_NO_VIRT_TO_BUS
- def_bool PPC64
-
config PPC
bool
default y
@@ -101,6 +98,7 @@ config PPC
select HAVE_FUNCTION_GRAPH_TRACER
select SYSCTL_EXCEPTION_TRACE
select ARCH_WANT_OPTIONAL_GPIOLIB
+ select ARCH_NO_VIRT_TO_BUS if PPC64
select HAVE_IDE
select HAVE_IOREMAP_PROT
select HAVE_EFFICIENT_UNALIGNED_ACCESS
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index babc2b8..9b28793 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -16,6 +16,7 @@ config SUPERH
select HAVE_DEBUG_BUGVERBOSE
select ARCH_HAVE_CUSTOM_GPIO_H
select ARCH_HAVE_NMI_SAFE_CMPXCHG if (GUSA_RB || CPU_SH4A)
+ select ARCH_NO_VIRT_TO_BUS
select PERF_USE_VMALLOC
select HAVE_DEBUG_KMEMLEAK
select HAVE_KERNEL_GZIP
@@ -150,9 +151,6 @@ config ARCH_HAS_ILOG2_U32
config ARCH_HAS_ILOG2_U64
def_bool n

-config ARCH_NO_VIRT_TO_BUS
- def_bool y
-
config ARCH_HAS_DEFAULT_IDLE
def_bool y

diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 9f2edb5..594d9bc 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -21,6 +21,7 @@ config SPARC
select SYSCTL_EXCEPTION_TRACE
select ARCH_WANT_OPTIONAL_GPIOLIB
select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
+ select ARCH_NO_VIRT_TO_BUS
select RTC_CLASS
select RTC_DRV_M48T59
select HAVE_IRQ_WORK
@@ -143,9 +144,6 @@ config GENERIC_GPIO
help
Generic GPIO API support

-config ARCH_NO_VIRT_TO_BUS
- def_bool y
-
config ARCH_SUPPORTS_DEBUG_PAGEALLOC
def_bool y if SPARC64

--
1.7.10.280.gaa39

--
Cheers,
Stephen Rothwell [email protected]


Attachments:
(No filename) (2.50 kB)
(No filename) (836.00 B)
Download all attachments

2012-11-12 21:27:31

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] Centralise CONFIG_ARCH_NO_VIRT_TO_BUS

From: Stephen Rothwell <[email protected]>
Date: Tue, 13 Nov 2012 08:26:15 +1100

> Make if easier for more architectures to select it and thus disable
> drivers that use virt_to_bus().
>
> Signed-off-by: Stephen Rothwell <[email protected]>

Acked-by: David S. Miller <[email protected]>

2012-11-12 23:13:57

by Hartley Sweeten

[permalink] [raw]
Subject: RE: Q: Kconfig option VIRT_TO_BUS

On Monday, November 12, 2012 11:41 AM, Bjorn Helgaas wrote:
> On Mon, Nov 12, 2012 at 9:18 AM, H Hartley Sweeten wrote:
>> Does anyone know what the Kconfig option VIRT_TO_BUS does?
>> There are a number of "depends on" that option but it does not
>> seem to directly enable any code in the kernel.
>
> virt_to_bus() is a deprecated interface for converting a kernel
> virtual address to a bus address. It's deprecated because it's
> impossible to implement correctly when there are multiple bus address
> spaces, because you don't know which bus address space the caller has
> in mind.

Thanks for the info.

So if a driver does not use virt_to_bus() then the "depends on VIRT_TO_BUS"
is not necessary. Correct?

Thanks,
Hartley

2012-11-12 23:16:29

by Bjorn Helgaas

[permalink] [raw]
Subject: Re: Q: Kconfig option VIRT_TO_BUS

On Mon, Nov 12, 2012 at 4:13 PM, H Hartley Sweeten
<[email protected]> wrote:
> On Monday, November 12, 2012 11:41 AM, Bjorn Helgaas wrote:
>> On Mon, Nov 12, 2012 at 9:18 AM, H Hartley Sweeten wrote:
>>> Does anyone know what the Kconfig option VIRT_TO_BUS does?
>>> There are a number of "depends on" that option but it does not
>>> seem to directly enable any code in the kernel.
>>
>> virt_to_bus() is a deprecated interface for converting a kernel
>> virtual address to a bus address. It's deprecated because it's
>> impossible to implement correctly when there are multiple bus address
>> spaces, because you don't know which bus address space the caller has
>> in mind.
>
> Thanks for the info.
>
> So if a driver does not use virt_to_bus() then the "depends on VIRT_TO_BUS"
> is not necessary. Correct?

Yes, that's my understanding.

2012-11-13 09:21:19

by James Hogan

[permalink] [raw]
Subject: Re: [PATCH] Centralise CONFIG_ARCH_NO_VIRT_TO_BUS

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/11/12 21:26, Stephen Rothwell wrote:
> Make if easier for more architectures to select it and thus
> disable drivers that use virt_to_bus().
>
> Signed-off-by: Stephen Rothwell <[email protected]>

Reviewed-by: James Hogan <[email protected]>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQIcBAEBAgAGBQJQohD8AAoJEKHZs+irPybf82gP/Az9f+Q5Vn/fGkQwOOpfsxsl
hpZGzIc7P6/ZU6IFWxN8hAKdJjOBH/ko0r+LMoczlQzlhlFd+qpDU+i2tZBqbp/G
S+4w56J/PC5MtZFlUEh68e0H313Mgt9kK8vy4yVnzBTvIgGsJuXjeK4qQSKBm3LP
LguU2AONT8GCfT8DRm9sbdS+WcXnBjRWeUkm8pZ+UX8kEe7ryaccidwvR16aP9l1
zx4HwFW0nCLYxwSOVQg2hi2pQyHD5sqFeLEYNbvEPlGleRKNJtz3bnYWbRdPkO2D
CoRjiSw5/iCd/SghvwEKdkJFkOw4zdONElrBvsYXqn3QsFFpyYal43gyKIgPkSb6
s5OdTJ1ScS3IgtxFpQ1nfj020rS1ieM8eY/bXyuGPEZzwbe0moe+g64Qye9nEutn
7oWKoue1H8uRaJ46WoD22bjG7SezLycDnAlG6ujo75qyxeBcVJ9ZB6DxHPnEU02M
P0sA8FLTFmzigRV2TBKBZbh3NrFGEi/riMA8U9f9XfLkxt7zdXGTvJ45C91U8HjT
3uQffRL/WBOQOILXtEFzf22DSPeoRklvyZmlHBsmNC6AYhSDnOvpUfOThaetQaFe
voiFdDZhtxdk20l0DpReeAUBVUFOjBjh6NzWLZbVdrfgHrpndw7s7jjfy/e5vhDU
wI2jW7slxuwARtv3Q1CV
=XvmD
-----END PGP SIGNATURE-----

2012-11-13 10:32:42

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH] Centralise CONFIG_ARCH_NO_VIRT_TO_BUS

On Mon, Nov 12, 2012 at 10:26 PM, Stephen Rothwell <[email protected]> wrote:
> diff --git a/arch/Kconfig b/arch/Kconfig
> index 366ec06..9bc00e7 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -271,6 +271,13 @@ config ARCH_WANT_OLD_COMPAT_IPC
> select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
> bool
>
> +config ARCH_NO_VIRT_TO_BUS
> + bool
> + help
> + An architecture should select this if it cannot (or will not)
> + implement virt_to_bus(). All new architectures should probably
> + select this.

Don't we typically put the burden of selecting Kconfig flags for deprecated
features on the existing architectures that provide the deprecated features?

I.e. shouldn't it be ARCH_HAS_VIRT_TO_BUS, selected by the architectures
that need it, instead?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2012-11-14 12:23:50

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH] Centralise CONFIG_ARCH_NO_VIRT_TO_BUS

On Monday 12 November 2012, Stephen Rothwell wrote:
> Show Details
> Make if easier for more architectures to select it and thus disable
> drivers that use virt_to_bus().
>
> Signed-off-by: Stephen Rothwell <[email protected]>

Very nice, I was recently looking into enabling this for ARM
as well, at least for the platforms that are known to not
need virt_to_bus.

Acked-by: Arnd Bergmann <[email protected]>

2012-11-14 14:53:56

by Bjorn Helgaas

[permalink] [raw]
Subject: Re: [PATCH] Centralise CONFIG_ARCH_NO_VIRT_TO_BUS

On Tue, Nov 13, 2012 at 3:32 AM, Geert Uytterhoeven
<[email protected]> wrote:
> On Mon, Nov 12, 2012 at 10:26 PM, Stephen Rothwell <[email protected]> wrote:
>> diff --git a/arch/Kconfig b/arch/Kconfig
>> index 366ec06..9bc00e7 100644
>> --- a/arch/Kconfig
>> +++ b/arch/Kconfig
>> @@ -271,6 +271,13 @@ config ARCH_WANT_OLD_COMPAT_IPC
>> select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
>> bool
>>
>> +config ARCH_NO_VIRT_TO_BUS
>> + bool
>> + help
>> + An architecture should select this if it cannot (or will not)
>> + implement virt_to_bus(). All new architectures should probably
>> + select this.
>
> Don't we typically put the burden of selecting Kconfig flags for deprecated
> features on the existing architectures that provide the deprecated features?
>
> I.e. shouldn't it be ARCH_HAS_VIRT_TO_BUS, selected by the architectures
> that need it, instead?

I like this idea.