linux-stable/drivers/staging/vc04_services/Kconfig
Geert Uytterhoeven f3e93e3e25 staging: vc04_services: Re-add dependency on HAS_DMA to BCM2835_VCHIQ
Thanks to stubs for the NO_DMA=y case, drivers that use the DMA API can
be compile-tested on systems that do not support DMA.  Hence the
dependency of BCM2835_VCHIQ on HAS_DMA was dropped to increase compile
coverage.

Unfortunately compilers became smarter, leading to new failures.
E.g. for a CONFIG_SUN3=y allmodconfig kernel with gcc 9.4.0:

    drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c: In function ‘free_pagelist’:
    arch/m68k/include/asm/string.h:72:25: warning: argument 2 null where non-null expected [-Wnonnull]
       72 | #define memcpy(d, s, n) __builtin_memcpy(d, s, n)
	  |                         ^~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c:614:4: note: in expansion of macro ‘memcpy’
      614 |    memcpy((char *)kmap(pages[0]) +
	  |    ^~~~~~
    arch/m68k/include/asm/string.h:72:25: note: in a call to built-in function ‘__builtin_memcpy’
       72 | #define memcpy(d, s, n) __builtin_memcpy(d, s, n)
	  |                         ^~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c:614:4: note: in expansion of macro ‘memcpy’
      614 |    memcpy((char *)kmap(pages[0]) +
	  |    ^~~~~~

This happens because the compiler can trace back the source pointer to a
allocation by dma_alloc_attrs(), which always returns NULL if NO_DMA=y.

Avoid this reinstating the dependency of the BCM2835_VCHIQ symbol on
HAS_DMA, and by restricting the selection of BCM2835_VCHIQ.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://lore.kernel.org/r/da55bd87eebf1a969dc8ccd807843319833f6c40.1650888813.git.geert@linux-m68k.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-26 11:29:59 +02:00

50 lines
1.6 KiB
Text

# SPDX-License-Identifier: GPL-2.0
menuconfig BCM_VIDEOCORE
tristate "Broadcom VideoCore support"
depends on OF
depends on RASPBERRYPI_FIRMWARE || (COMPILE_TEST && !RASPBERRYPI_FIRMWARE)
default y
help
Support for Broadcom VideoCore services including
the BCM2835 family of products which is used
by the Raspberry PI.
if BCM_VIDEOCORE
config BCM2835_VCHIQ
tristate "BCM2835 VCHIQ"
depends on HAS_DMA
imply VCHIQ_CDEV
help
Broadcom BCM2835 and similar SoCs have a VPU called VideoCore. This config
enables the VCHIQ driver, which implements a messaging interface between
the kernel and the firmware running on VideoCore. Other drivers use this
interface to communicate to the VPU. More specifically, the VCHIQ driver is
used by audio/video and camera drivers as well as for implementing MMAL
API, which is in turn used by several multimedia services on the BCM2835
family of SoCs.
Defaults to Y when the Broadcom Videocore services are included in
the build, N otherwise.
if BCM2835_VCHIQ
config VCHIQ_CDEV
bool "VCHIQ Character Driver"
help
Enable the creation of VCHIQ character driver. The cdev exposes ioctls used
by userspace libraries and testing tools to interact with VideoCore, via
the VCHIQ core driver (Check BCM2835_VCHIQ for more info).
This can be set to 'N' if the VideoCore communication is not needed by
userspace but only by other kernel modules (like bcm2835-audio). If not
sure, set this to 'Y'.
endif
source "drivers/staging/vc04_services/bcm2835-audio/Kconfig"
source "drivers/staging/vc04_services/bcm2835-camera/Kconfig"
source "drivers/staging/vc04_services/vchiq-mmal/Kconfig"
endif