firmware: include drivers/firmware/Kconfig unconditionally
Subsystems (21)
PATCH 1/2 firmware: include drivers/firmware/Kconfig unconditionally
From: Arnd Bergmann <[email protected]>
Compile-testing drivers that require access to a firmware layer fails when that firmware symbol is unavailable. This happened twice this week:
- My proposed to change to rework the QCOM_SCM firmware symbol broke on ppc64 and others.
- The cs_dsp firmware patch added device specific firmware loader into drivers/firmware, which broke on the same set of architectures.
We should probably do the same thing for other subsystems as well, but fix this one first as this is a dependency for other patches getting merged.
---
Not sure how we'd want to merge this patch, if two other things need it. I'd prefer to merge it along with the QCOM_SCM change through the soc tree, but that leaves the cirrus firmware broken unless we also merge it the same way (rather than through ASoC as it is now).
Alternatively, we can try to find a different home for the Cirrus firmware to decouple the two problems. I'd argue that it's actually misplaced here, as drivers/firmware is meant for kernel code that interfaces with system firmware, not for device drivers to load their own firmware blobs from user space.
--- arch/arm/Kconfig | 2 -- arch/arm64/Kconfig | 2 -- arch/ia64/Kconfig | 2 -- arch/mips/Kconfig | 2 -- arch/parisc/Kconfig | 2 -- arch/riscv/Kconfig | 2 -- arch/x86/Kconfig | 2 -- drivers/Kconfig | 2 ++ 8 files changed, 2 insertions(+), 14 deletions(-)
arch/arm/Kconfig +0 -2
@@ -1993,8 +1993,6 @@ config ARCH_HIBERNATION_POSSIBLE endmenu -source "drivers/firmware/Kconfig" - if CRYPTO source "arch/arm/crypto/Kconfig" endif
arch/arm64/Kconfig +0 -2
@@ -1931,8 +1931,6 @@ source "drivers/cpufreq/Kconfig" endmenu -source "drivers/firmware/Kconfig" - source "drivers/acpi/Kconfig" source "arch/arm64/kvm/Kconfig"
arch/ia64/Kconfig +0 -2
@@ -388,8 +388,6 @@ config CRASH_DUMP help Generate crash dump after being started by kexec. -source "drivers/firmware/Kconfig" - endmenu menu "Power management and ACPI options"
arch/mips/Kconfig +0 -2
@@ -3316,8 +3316,6 @@ source "drivers/cpuidle/Kconfig" endmenu -source "drivers/firmware/Kconfig" - source "arch/mips/kvm/Kconfig" source "arch/mips/vdso/Kconfig"
arch/parisc/Kconfig +0 -2
@@ -384,6 +384,4 @@ config KEXEC_FILE endmenu -source "drivers/firmware/Kconfig" - source "drivers/parisc/Kconfig"
arch/riscv/Kconfig +0 -2
@@ -561,5 +561,3 @@ menu "Power management options" source "kernel/power/Kconfig" endmenu - -source "drivers/firmware/Kconfig"
arch/x86/Kconfig +0 -2
@@ -2834,8 +2834,6 @@ config HAVE_ATOMIC_IOMAP def_bool y depends on X86_32 -source "drivers/firmware/Kconfig" - source "arch/x86/kvm/Kconfig" source "arch/x86/Kconfig.assembler"
drivers/Kconfig +2 -0
@@ -17,6 +17,8 @@ source "drivers/bus/Kconfig" source "drivers/connector/Kconfig" +source "drivers/firmware/Kconfig" + source "drivers/gnss/Kconfig" source "drivers/mtd/Kconfig"
Signature · 1 line
2.29.2
PATCH v2 2/2 qcom_scm: hide Kconfig symbol
From: Arnd Bergmann <[email protected]>
Now that SCM can be a loadable module, we have to add another dependency to avoid link failures when ipa or adreno-gpu are built-in:
aarch64-linux-ld: drivers/net/ipa/ipa_main.o: in function `ipa_probe':
ipa_main.c:(.text+0xfc4): undefined reference to `qcom_scm_is_available'
ld.lld: error: undefined symbol: qcom_scm_is_available
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
referenced by
adreno_gpu.c
gpu/drm/msm/adreno/adreno_gpu.o:(adreno_zap_shader_load) in archivedrivers/built-in.a
This can happen when CONFIG_ARCH_QCOM is disabled and we don't select QCOM_MDT_LOADER, but some other module selects QCOM_SCM. Ideally we'd use a similar dependency here to what we have for QCOM_RPROC_COMMON, but that causes dependency loops from other things selecting QCOM_SCM.
This appears to be an endless problem, so try something different this time:
- CONFIG_QCOM_SCM becomes a hidden symbol that nothing 'depends on' but that is simply selected by all of its users
- All the stubs in include/linux/qcom_scm.h can go away
- arm-smccc.h needs to provide a stub for __arm_smccc_smc() to allow compile-testing QCOM_SCM on all architectures.
- To avoid a circular dependency chain involving RESET_CONTROLLER and PINCTRL_SUNXI, drop the 'select RESET_CONTROLLER' statement. According to my testing this still builds fine, and the QCOM platform selects this symbol already.
---
Changes in v2:
- drop the 'select RESET_CONTROLLER' line, rather than adding more of the same
--- drivers/firmware/Kconfig | 5 +- drivers/gpu/drm/msm/Kconfig | 4 +- drivers/iommu/Kconfig | 2 +- drivers/media/platform/Kconfig | 2 +- drivers/mmc/host/Kconfig | 2 +- drivers/net/ipa/Kconfig | 1 + drivers/net/wireless/ath/ath10k/Kconfig | 2 +- drivers/pinctrl/qcom/Kconfig | 3 +- include/linux/arm-smccc.h | 10 ++++ include/linux/qcom_scm.h | 71 ------------------------- 10 files changed, 20 insertions(+), 82 deletions(-)
drivers/firmware/Kconfig +1 -4
@@ -203,10 +203,7 @@ config INTEL_STRATIX10_RSU Say Y here if you want Intel RSU support. config QCOM_SCM - tristate "Qcom SCM driver" - depends on ARM || ARM64 - depends on HAVE_ARM_SMCCC - select RESET_CONTROLLER + tristate config QCOM_SCM_DOWNLOAD_MODE_DEFAULT bool "Qualcomm download mode enabled by default"
drivers/gpu/drm/msm/Kconfig +2 -2
@@ -17,7 +17,7 @@ config DRM_MSM select DRM_SCHED select SHMEM select TMPFS - select QCOM_SCM if ARCH_QCOM + select QCOM_SCM select WANT_DEV_COREDUMP select SND_SOC_HDMI_CODEC if SND_SOC select SYNC_FILE
@@ -55,7 +55,7 @@ config DRM_MSM_GPU_SUDO config DRM_MSM_HDMI_HDCP bool "Enable HDMI HDCP support in MSM DRM driver" - depends on DRM_MSM && QCOM_SCM + depends on DRM_MSM default y help Choose this option to enable HDCP state machine
drivers/iommu/Kconfig +1 -1
@@ -308,7 +308,7 @@ config APPLE_DART config ARM_SMMU tristate "ARM Ltd. System MMU (SMMU) Support" depends on ARM64 || ARM || (COMPILE_TEST && !GENERIC_ATOMIC64) - depends on QCOM_SCM || !QCOM_SCM #if QCOM_SCM=m this can't be =y + select QCOM_SCM select IOMMU_API select IOMMU_IO_PGTABLE_LPAE select ARM_DMA_USE_IOMMU if ARM
drivers/media/platform/Kconfig +1 -1
@@ -565,7 +565,7 @@ config VIDEO_QCOM_VENUS depends on VIDEO_DEV && VIDEO_V4L2 && QCOM_SMEM depends on (ARCH_QCOM && IOMMU_DMA) || COMPILE_TEST select QCOM_MDT_LOADER if ARCH_QCOM - select QCOM_SCM if ARCH_QCOM + select QCOM_SCM select VIDEOBUF2_DMA_CONTIG select V4L2_MEM2MEM_DEV help
drivers/mmc/host/Kconfig +1 -1
@@ -547,7 +547,7 @@ config MMC_SDHCI_MSM depends on MMC_SDHCI_PLTFM select MMC_SDHCI_IO_ACCESSORS select MMC_CQHCI - select QCOM_SCM if MMC_CRYPTO && ARCH_QCOM + select QCOM_SCM if MMC_CRYPTO help This selects the Secure Digital Host Controller Interface (SDHCI) support present in Qualcomm SOCs. The controller supports
drivers/net/ipa/Kconfig +1 -0
@@ -4,6 +4,7 @@ config QCOM_IPA depends on ARCH_QCOM || COMPILE_TEST depends on QCOM_RPROC_COMMON || (QCOM_RPROC_COMMON=n && COMPILE_TEST) select QCOM_MDT_LOADER if ARCH_QCOM + select QCOM_SCM select QCOM_QMI_HELPERS help Choose Y or M here to include support for the Qualcomm
drivers/net/wireless/ath/ath10k/Kconfig +1 -1
@@ -44,7 +44,7 @@ config ATH10K_SNOC tristate "Qualcomm ath10k SNOC support" depends on ATH10K depends on ARCH_QCOM || COMPILE_TEST - depends on QCOM_SCM || !QCOM_SCM #if QCOM_SCM=m this can't be =y + select QCOM_SCM select QCOM_QMI_HELPERS help This module adds support for integrated WCN3990 chip connected
drivers/pinctrl/qcom/Kconfig +2 -1
@@ -3,7 +3,8 @@ if (ARCH_QCOM || COMPILE_TEST) config PINCTRL_MSM tristate "Qualcomm core pin controller driver" - depends on GPIOLIB && (QCOM_SCM || !QCOM_SCM) #if QCOM_SCM=m this can't be =y + depends on GPIOLIB + select QCOM_SCM select PINMUX select PINCONF select GENERIC_PINCONF
include/linux/arm-smccc.h +10 -0
@@ -321,10 +321,20 @@ asmlinkage unsigned long __arm_smccc_sve_check(unsigned long x0);* from register 0 to 3 on return from the SMC instruction. An optional * quirk structure provides vendor specific behavior. */ +#ifdef CONFIG_HAVE_ARM_SMCCC asmlinkage void __arm_smccc_smc(unsigned long a0, unsigned long a1,unsigned long a2,unsigned long a3,unsigned long a4,unsigned long a5,unsigned long a6,unsigned long a7,struct arm_smccc_res *res,struct arm_smccc_quirk *quirk); +#else +static inline void __arm_smccc_smc (unsigned long a0,unsigned long a1, +unsigned long a2,unsigned long a3,unsigned long a4, +unsigned long a5,unsigned long a6,unsigned long a7, +struct arm_smccc_res *res,struct arm_smccc_quirk *quirk) +{ + *res = (struct arm_smccc_res ){}; +} +#endif /** * __arm_smccc_hvc() - make HVC calls
include/linux/qcom_scm.h +0 -71
81 lines not on this page · raw message
Signature · 1 line
2.29.2
Re: [PATCH 2/2] [v2] qcom_scm: hide Kconfig symbol
Quoted 40 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Now that SCM can be a loadable module, we have to add another dependency to avoid link failures when ipa or adreno-gpu are built-in:
aarch64-linux-ld:
drivers/net/ipa/ipa_main.o: in function `ipa_probe':
ipa_main.c:(.text+0xfc4): undefined reference to `qcom_scm_is_available'ld.lld: error: undefined symbol:
qcom_scm_is_availableQuoted 2 lines
Quoted 2 lines
Quoted 2 lines
referenced by
adreno_gpu.c
gpu/drm/msm/adreno/adreno_gpu.o:(adreno_zap_shader_load) in archivedrivers/built-in.aThis can happen when
CONFIG_ARCH_QCOMis disabled and we don't selectQCOM_MDT_LOADER, but some other module selectsQCOM_SCM. Ideally we'd use a similar dependency here to what we have forQCOM_RPROC_COMMON, but that causes dependency loops from other things selectingQCOM_SCM.This appears to be an endless problem, so try something different this time:
-
CONFIG_QCOM_SCMbecomes a hidden symbol that nothing 'depends on' but that is simply selected by all of its users- All the stubs in
include/linux/qcom_scm.hcan go away-
arm-smccc.hneeds to provide a stub for__arm_smccc_smc()to allow compile-testingQCOM_SCMon all architectures.- To avoid a circular dependency chain involving
RESET_CONTROLLERandPINCTRL_SUNXI, drop the 'selectRESET_CONTROLLER' statement. According to my testing this still builds fine, and the QCOM platform selects this symbol already.Acked-by Kalle Valo <[email protected]>Signed-off-by Arnd Bergmann <[email protected]>---
Changes in v2:
- drop the 'selectRESET_CONTROLLER' line, rather than adding more of the same
Quoted 7 lines
--- drivers/firmware/Kconfig | 5 +- drivers/gpu/drm/msm/Kconfig | 4 +- drivers/iommu/Kconfig | 2 +- drivers/media/platform/Kconfig | 2 +- drivers/mmc/host/Kconfig | 2 +- drivers/net/ipa/Kconfig | 1 +
For drivers/net/ipa/Kconfig, looks good to me.
Nice simplification.
Quoted 6 lines
drivers/net/wireless/ath/ath10k/Kconfig | 2 +- drivers/pinctrl/qcom/Kconfig | 3 +- include/linux/arm-smccc.h | 10 ++++ include/linux/qcom_scm.h | 71 ------------------------- 10 files changed, 20 insertions(+), 82 deletions(-)
. . .
Re: [PATCH 2/2] [v2] qcom_scm: hide Kconfig symbol
In reply to Arnd BergmannQuoted 96 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Now that SCM can be a loadable module, we have to add another dependency to avoid link failures when ipa or adreno-gpu are built-in:
aarch64-linux-ld:
drivers/net/ipa/ipa_main.o: in function `ipa_probe':
ipa_main.c:(.text+0xfc4): undefined reference to `qcom_scm_is_available'ld.lld: error: undefined symbol:
qcom_scm_is_availableQuoted 2 lines
Quoted 2 lines
Quoted 2 lines
referenced by
adreno_gpu.c
gpu/drm/msm/adreno/adreno_gpu.o:(adreno_zap_shader_load) in archivedrivers/built-in.aThis can happen when
CONFIG_ARCH_QCOMis disabled and we don't selectQCOM_MDT_LOADER, but some other module selectsQCOM_SCM. Ideally we'd use a similar dependency here to what we have forQCOM_RPROC_COMMON, but that causes dependency loops from other things selectingQCOM_SCM.This appears to be an endless problem, so try something different this time:
-
CONFIG_QCOM_SCMbecomes a hidden symbol that nothing 'depends on' but that is simply selected by all of its users- All the stubs in
include/linux/qcom_scm.hcan go away-
arm-smccc.hneeds to provide a stub for__arm_smccc_smc()to allow compile-testingQCOM_SCMon all architectures.- To avoid a circular dependency chain involving
RESET_CONTROLLERandPINCTRL_SUNXI, drop the 'selectRESET_CONTROLLER' statement. According to my testing this still builds fine, and the QCOM platform selects this symbol already.Acked-by Kalle Valo <[email protected]>Signed-off-by Arnd Bergmann <[email protected]>---
Changes in v2:
- drop the 'selectRESET_CONTROLLER' line, rather than adding more of the same--- drivers/firmware/Kconfig | 5 +- drivers/gpu/drm/msm/Kconfig | 4 +- drivers/iommu/Kconfig | 2 +- drivers/media/platform/Kconfig | 2 +- drivers/mmc/host/Kconfig | 2 +- drivers/net/ipa/Kconfig | 1 + drivers/net/wireless/ath/ath10k/Kconfig | 2 +- drivers/pinctrl/qcom/Kconfig | 3 +- include/linux/arm-smccc.h | 10 ++++ include/linux/qcom_scm.h | 71 ------------------------- 10 files changed, 20 insertions(+), 82 deletions(-)drivers/firmware/Kconfig +1
-4@@ -203,10 +203,7 @@ config INTEL_STRATIX10_RSU Say Y here if you want Intel RSU support. config QCOM_SCM - tristate "Qcom SCM driver" - depends on ARM || ARM64 - depends on HAVE_ARM_SMCCC - select RESET_CONTROLLER + tristate config QCOM_SCM_DOWNLOAD_MODE_DEFAULT bool "Qualcomm download mode enabled by default"drivers/gpu/drm/msm/Kconfig +2
-2@@ -17,7 +17,7 @@ config DRM_MSM select DRM_SCHED select SHMEM select TMPFS - select QCOM_SCM if ARCH_QCOM + select QCOM_SCM select WANT_DEV_COREDUMP select SND_SOC_HDMI_CODEC if SND_SOC select SYNC_FILE@@ -55,7 +55,7 @@ config DRM_MSM_GPU_SUDO config DRM_MSM_HDMI_HDCP bool "Enable HDMI HDCP support in MSM DRM driver" - depends on DRM_MSM && QCOM_SCM + depends on DRM_MSM default y help Choose this option to enable HDCP state machinedrivers/iommu/Kconfig +0
-0
drivers/iommu/Kconfig config APPLE_DART · line 314
Quoted 8 lines
drivers/iommu/Kconfig +1
-1@@ -308,7 +308,7 @@ config APPLE_DART config ARM_SMMU tristate "ARM Ltd. System MMU (SMMU) Support" depends on ARM64 || ARM || (COMPILE_TEST && !GENERIC_ATOMIC64) - depends on QCOM_SCM || !QCOM_SCM #if QCOM_SCM=m this can't be =y + select QCOM_SCM select IOMMU_API select IOMMU_IO_PGTABLE_LPAE select ARM_DMA_USE_IOMMU if ARM
As noted in the RFC, I think you also need to fix QCOM_IOMMU.
In particular (iirc) since all the users of the iommu might be modules, which would prevent QCOM_IOMMU from being selected.
The rest looks good.
Regards,
Bjorn
Quoted 180 lines
drivers/media/platform/Kconfig +1
-1@@ -565,7 +565,7 @@ config VIDEO_QCOM_VENUS depends on VIDEO_DEV && VIDEO_V4L2 && QCOM_SMEM depends on (ARCH_QCOM && IOMMU_DMA) || COMPILE_TEST select QCOM_MDT_LOADER if ARCH_QCOM - select QCOM_SCM if ARCH_QCOM + select QCOM_SCM select VIDEOBUF2_DMA_CONTIG select V4L2_MEM2MEM_DEV helpdrivers/mmc/host/Kconfig +1
-1@@ -547,7 +547,7 @@ config MMC_SDHCI_MSM depends on MMC_SDHCI_PLTFM select MMC_SDHCI_IO_ACCESSORS select MMC_CQHCI - select QCOM_SCM if MMC_CRYPTO && ARCH_QCOM + select QCOM_SCM if MMC_CRYPTO help This selects the Secure Digital Host Controller Interface (SDHCI) support present in Qualcomm SOCs. The controller supportsdrivers/net/ipa/Kconfig +1
-0@@ -4,6 +4,7 @@ config QCOM_IPA depends on ARCH_QCOM || COMPILE_TEST depends on QCOM_RPROC_COMMON || (QCOM_RPROC_COMMON=n && COMPILE_TEST) select QCOM_MDT_LOADER if ARCH_QCOM + select QCOM_SCM select QCOM_QMI_HELPERS help Choose Y or M here to include support for the Qualcommdrivers/net/wireless/ath/ath10k/Kconfig +1
-1@@ -44,7 +44,7 @@ config ATH10K_SNOC tristate "Qualcomm ath10k SNOC support" depends on ATH10K depends on ARCH_QCOM || COMPILE_TEST - depends on QCOM_SCM || !QCOM_SCM #if QCOM_SCM=m this can't be =y + select QCOM_SCM select QCOM_QMI_HELPERS help This module adds support for integrated WCN3990 chip connecteddrivers/pinctrl/qcom/Kconfig +2
-1@@ -3,7 +3,8 @@ if (ARCH_QCOM || COMPILE_TEST) config PINCTRL_MSM tristate "Qualcomm core pin controller driver" - depends on GPIOLIB && (QCOM_SCM || !QCOM_SCM) #if QCOM_SCM=m this can't be =y + depends on GPIOLIB + select QCOM_SCM select PINMUX select PINCONF select GENERIC_PINCONFinclude/linux/arm-smccc.h +10
-0@@ -321,10 +321,20 @@ asmlinkage unsigned long __arm_smccc_sve_check(unsigned long x0);* from register 0 to 3 on return from the SMC instruction. An optional * quirk structure provides vendor specific behavior. */ +#ifdef CONFIG_HAVE_ARM_SMCCC asmlinkage void __arm_smccc_smc(unsigned long a0, unsigned long a1,unsigned long a2,unsigned long a3,unsigned long a4,unsigned long a5,unsigned long a6,unsigned long a7,struct arm_smccc_res *res,struct arm_smccc_quirk *quirk); +#else +static inline void __arm_smccc_smc (unsigned long a0,unsigned long a1, +unsigned long a2,unsigned long a3,unsigned long a4, +unsigned long a5,unsigned long a6,unsigned long a7, +struct arm_smccc_res *res,struct arm_smccc_quirk *quirk) +{ + *res = (struct arm_smccc_res ){}; +} +#endif /** * __arm_smccc_hvc() - make HVC calls include/linux/qcom_scm.h +0
-71@@ -61,7 +61,6 @@ enum qcom_scm_ice_cipher {#define QCOM_SCM_PERM_RW (QCOM_SCM_PERM_READ | QCOM_SCM_PERM_WRITE)#define QCOM_SCM_PERM_RWX (QCOM_SCM_PERM_RW | QCOM_SCM_PERM_EXEC) -#if IS_ENABLED (CONFIG_QCOM_SCM )extern bool qcom_scm_is_available (void );extern int qcom_scm_set_cold_boot_addr (void *entry,const cpumask_t *cpus);@@ -115,74 +114,4 @@ extern int qcom_scm_lmh_dcvsh(u32 payload_fn, u32 payload_reg, u32 payload_val,extern int qcom_scm_lmh_profile_change (u32 profile_id);extern bool qcom_scm_lmh_dcvsh_available (void ); -#else - -#include <linux/errno.h> - -static inline bool qcom_scm_is_available (void ) {return false; } - -static inline int qcom_scm_set_cold_boot_addr (void *entry, -const cpumask_t *cpus) {return -ENODEV ; } -static inline int qcom_scm_set_warm_boot_addr (void *entry, -const cpumask_t *cpus) {return -ENODEV ; } -static inline void qcom_scm_cpu_power_down (u32 flags) {} -static inline u32 qcom_scm_set_remote_state (u32 state,u32 id) - {return -ENODEV ; } - -static inline int qcom_scm_pas_init_image (u32 peripheral,const void *metadata, -size_t size) {return -ENODEV ; } -static inline int qcom_scm_pas_mem_setup (u32 peripheral,phys_addr_t addr, -phys_addr_t size) {return -ENODEV ; } -static inline int qcom_scm_pas_auth_and_reset (u32 peripheral) - {return -ENODEV ; } -static inline int qcom_scm_pas_shutdown (u32 peripheral) {return -ENODEV ; } -static inline bool qcom_scm_pas_supported (u32 peripheral) {return false; } - -static inline int qcom_scm_io_readl (phys_addr_t addr,unsigned int *val) - {return -ENODEV ; } -static inline int qcom_scm_io_writel (phys_addr_t addr,unsigned int val) - {return -ENODEV ; } - -static inline bool qcom_scm_restore_sec_cfg_available (void ) {return false; } -static inline int qcom_scm_restore_sec_cfg (u32 device_id,u32 spare) - {return -ENODEV ; } -static inline int qcom_scm_iommu_secure_ptbl_size (u32 spare,size_t *size) - {return -ENODEV ; } -static inline int qcom_scm_iommu_secure_ptbl_init (u64 addr,u32 size,u32 spare) - {return -ENODEV ; } -extern inline int qcom_scm_mem_protect_video_var (u32 cp_start,u32 cp_size, -u32 cp_nonpixel_start, -u32 cp_nonpixel_size) - {return -ENODEV ; } -static inline int qcom_scm_assign_mem (phys_addr_t mem_addr,size_t mem_sz, -unsigned int *src,const struct qcom_scm_vmperm *newvm, -unsigned int dest_cnt) {return -ENODEV ; } - -static inline bool qcom_scm_ocmem_lock_available (void ) {return false; } -static inline int qcom_scm_ocmem_lock (enum qcom_scm_ocmem_client id,u32 offset, -u32 size,u32 mode) {return -ENODEV ; } -static inline int qcom_scm_ocmem_unlock (enum qcom_scm_ocmem_client id, -u32 offset,u32 size) {return -ENODEV ; } - -static inline bool qcom_scm_ice_available (void ) {return false; } -static inline int qcom_scm_ice_invalidate_key (u32 index) {return -ENODEV ; } -static inline int qcom_scm_ice_set_key (u32 index,const u8 *key,u32 key_size, -enum qcom_scm_ice_cipher cipher, -u32 data_unit_size) {return -ENODEV ; } - -static inline bool qcom_scm_hdcp_available (void ) {return false; } -static inline int qcom_scm_hdcp_req (struct qcom_scm_hdcp_req *req,u32 req_cnt, -u32 *resp) {return -ENODEV ; } - -static inline int qcom_scm_qsmmu500_wait_safe_toggle (bool en) - {return -ENODEV ; } - -static inline int qcom_scm_lmh_dcvsh (u32 payload_fn,u32 payload_reg,u32 payload_val, -u64 limit_node,u32 node_id,u64 version) - {return -ENODEV ; } - -static inline int qcom_scm_lmh_profile_change (u32 profile_id) {return -ENODEV ; } - -static inline bool qcom_scm_lmh_dcvsh_available (void ) {return -ENODEV ; } -#endif #endif Signature · 1 line
2.29.2
Quoted 22 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Compile-testing drivers that require access to a firmware layer fails when that firmware symbol is unavailable. This happened twice this week:- My proposed to change to rework the
QCOM_SCMfirmware symbol broke on ppc64 and others.- The
cs_dspfirmware patch added device specific firmware loader intodrivers/firmware, which broke on the same set of architectures.We should probably do the same thing for other subsystems as well, but fix this one first as this is a dependency for other patches getting merged.
Not sure how we'd want to merge this patch, if two other things need it. I'd prefer to merge it along with the
QCOM_SCMchange through the soc tree, but that leaves the cirrus firmware broken unless we also merge it the same way (rather than through ASoC as it is now).
Quoted 5 lines
Alternatively, we can try to find a different home for the Cirrus firmware to decouple the two problems. I'd argue that it's actually misplaced here, as
drivers/firmwareis meant for kernel code that interfaces with system firmware, not for device drivers to load their own firmware blobs from user space.
Thanks for looking at this for us. I don't think we are greatly attached to drivers/firmware as a location. Essentially, what we have is some firmware parsing code that needs to be shared across several devices, previously this was just in the sound subsystem as all our parts were audio. We are going to shortly be upstreaming some non-audio parts that use the same firmware infrastructure and it didn't seem very sensible to have them including bits of the audio subsystem.
I guess the question might be where else would said code go? drivers/firmware seemed most obvious, all the other locations I can think of don't really make sense. Can't really put it a bus like spi/i2c etc. because we have parts on many buses. Can't really put it in a functional subsystem (audio/input etc.) since the whole idea was to try and get some independence from that so we don't have parts including subsystems they don't use. Could maybe put it in MFD, but no hard guarantee every part using it will be an MFD device and I am fairly confident Lee will feel it isn't MFD code as it doesn't relate to managing multiple devices. Only other option I can think of would be to make some sort of drivers/dsp or maybe drivers/cs_dsp, but not clear to me that is obviously better than using drivers/firmware.
Thanks,
Charles
Quoted 10 lines · Charles Keepax
Thanks for looking at this for us. I don't think we are greatly attached to
drivers/firmwareas a location. Essentially, what we have is some firmware parsing code that needs to be shared across several devices, previously this was just in the sound subsystem as all our parts were audio. We are going to shortly be upstreaming some non-audio parts that use the same firmware infrastructure and it didn't seem very sensible to have them including bits of the audio subsystem.
Quoted 13 lines
I guess the question might be where else would said code go?
drivers/firmwareseemed most obvious, all the other locations I can think of don't really make sense. Can't really put it a bus like spi/i2c etc. because we have parts on many buses. Can't really put it in a functional subsystem (audio/input etc.) since the whole idea was to try and get some independence from that so we don't have parts including subsystems they don't use. Could maybe put it in MFD, but no hard guarantee every part using it will be an MFD device and I am fairly confident Lee will feel it isn't MFD code as it doesn't relate to managing multiple devices. Only other option I can think of would be to make some sort ofdrivers/dspor maybedrivers/cs_dsp, but not clear to me that is obviously better than usingdrivers/firmware.
Other DSPs use the drivers/remoteproc/ subsystem, but that is more for general-purpose DSPs that can load application specific firmware rather than loading a single firmware blob as you'd normally do with the request_firmware() style interface.
Not sure if that fits what you do. Can you point to a high-level description of what this DSP does besides audio, and how flexible it is? That might help find the right place for this.
Arnd
Quoted 16 lines · Arnd Bergmann
Quoted 5 lines · Charles Keepax
I guess the question might be where else would said code go?
drivers/firmwareseemed most obvious, all the other locations I can think of don't really make sense. Can't really put it a bus like spi/i2c etc. because we have parts on many buses. Can't really put it in a functional subsystem (audio/input etc.) sinceQuoted 8 lines
the whole idea was to try and get some independence from that so we don't have parts including subsystems they don't use. Could maybe put it in MFD, but no hard guarantee every part using it will be an MFD device and I am fairly confident Lee will feel it isn't MFD code as it doesn't relate to managing multiple devices. Only other option I can think of would be to make some sort of
drivers/dspor maybedrivers/cs_dsp, but not clear to me that is obviously better than usingdrivers/firmware.
Quoted 8 lines
Other DSPs use the
drivers/remoteproc/subsystem, but that is more for general-purpose DSPs that can load application specific firmware rather than loading a single firmware blob as you'd normally do with therequest_firmware()style interface.Not sure if that fits what you do. Can you point to a high-level description of what this DSP does besides audio, and how flexible it is? That might help find the right place for this.
Hm... wasn't aware of that one, we should probably investigate that a little more at this end. From a quick look, seems a bit more like it is designed for much larger more general purpose probably memory mapped DSPs. I guess our code is a little more firmware parsing and loading, and a bit less generic remote proceedure call stuff.
I am not sure there is great deal available publically on the DSP core. It is talked about in a few of our datasheets, see section 4.4 in [1]. But a basic description might be it is a signal processing focused, very small DSP core. If can be loaded with different firmwares at runtime, and indeed might be doing say echo cancellation in one use-case, or always on voice detect in another. Functionally it is very unlikely to be used for anything besides signal processing inside the device it is in, since it is typically quite integrated with that hardware and will be sitting behind a slow bus, like I2C or SPI.
Current users are all audio, planning to upstream some haptics parts soon, with possible other uses in the future.
[1] https://statics.cirrus.com/pubs/proDatasheet/CS48L32_DS1219F4.pdf
Thanks,
Charles
Quoted 11 lines · Charles Keepax
Quoted 8 lines · Arnd Bergmann
Other DSPs use the
drivers/remoteproc/subsystem, but that is more for general-purpose DSPs that can load application specific firmware rather than loading a single firmware blob as you'd normally do with therequest_firmware()style interface.Not sure if that fits what you do. Can you point to a high-level description of what this DSP does besides audio, and how flexible it is? That might help find the right place for this.
Quoted 5 lines
Hm... wasn't aware of that one, we should probably investigate that a little more at this end. From a quick look, seems a bit more like it is designed for much larger more general purpose probably memory mapped DSPs. I guess our code is a little more firmware parsing and loading, and a bit less generic remote proceedure call stuff.
Right, that was why I didn't suggest remoteproc - the DSPs wm_adsp covers seem much smaller than fits comfortably with remoteproc. You probably could make it fit though.
Quoted 26 lines · Charles Keepax
Quoted 16 lines · Arnd Bergmann
Quoted 5 lines · Charles Keepax
I guess the question might be where else would said code go?
drivers/firmwareseemed most obvious, all the other locations I can think of don't really make sense. Can't really put it a bus like spi/i2c etc. because we have parts on many buses. Can't really put it in a functional subsystem (audio/input etc.) sinceQuoted 8 lines
the whole idea was to try and get some independence from that so we don't have parts including subsystems they don't use. Could maybe put it in MFD, but no hard guarantee every part using it will be an MFD device and I am fairly confident Lee will feel it isn't MFD code as it doesn't relate to managing multiple devices. Only other option I can think of would be to make some sort of
drivers/dspor maybedrivers/cs_dsp, but not clear to me that is obviously better than usingdrivers/firmware.Quoted 8 lines
Other DSPs use the
drivers/remoteproc/subsystem, but that is more for general-purpose DSPs that can load application specific firmware rather than loading a single firmware blob as you'd normally do with therequest_firmware()style interface.Not sure if that fits what you do. Can you point to a high-level description of what this DSP does besides audio, and how flexible it is? That might help find the right place for this.
Quoted 6 lines
Hm... wasn't aware of that one, we should probably investigate that a little more at this end. From a quick look, seems a bit more like it is designed for much larger more general purpose probably memory mapped DSPs. I guess our code is a little more firmware parsing and loading, and a bit less generic remote proceedure call stuff.
You're correct, remoteproc tends to situations where you have multi-function firmware; be it at a single point in time, or due to different firmware choices. Where you essentially boot some firmware on the remoteproc and from that instantiate one of more functional devices based on the loaded firmware.
Quoted 11 lines
I am not sure there is great deal available publically on the DSP core. It is talked about in a few of our datasheets, see section 4.4 in [1]. But a basic description might be it is a signal processing focused, very small DSP core. If can be loaded with different firmwares at runtime, and indeed might be doing say echo cancellation in one use-case, or always on voice detect in another. Functionally it is very unlikely to be used for anything besides signal processing inside the device it is in, since it is typically quite integrated with that hardware and will be sitting behind a slow bus, like I2C or SPI.
To me it sounds like the main difference compared to above is that you have a single function that owns and controls the DSP and implements that function - i.e. the audio driver probes, boots the DSP, if there's a problem the audio driver will handle it etc.
When it comes to firmware parsing, that might be a somewhat unrelated topic. E.g. in the Qualcomm case, the same customized ELF header is used in both for remoteproc devices and in function-specific devices. For this we extracted the relevant functions into a library of some common helpers, which can be found in drivers/soc/qcom/mdt_loader.c.
Regards,
Bjorn
Quoted 7 lines
Current users are all audio, planning to upstream some haptics parts soon, with possible other uses in the future.
[1] https://statics.cirrus.com/pubs/proDatasheet/CS48L32_DS1219F4.pdf
Thanks,
Charles
Quoted 3 lines · Arnd Bergmann
Compile-testing drivers that require access to a firmware layer fails when that firmware symbol is unavailable. This happened twice this week:
...
Quoted 3 lines
We should probably do the same thing for other subsystems as well, but fix this one first as this is a dependency for other patches getting merged.
Regardless of what we do with the Cirrus DSP this just seems like a good idea - surprises due to this not being generally available keep coming up, IIRC with the i.MX firmware in the past for example.
Quoted 5 lines
Not sure how we'd want to merge this patch, if two other things need it. I'd prefer to merge it along with the
QCOM_SCMchange through the soc tree, but that leaves the cirrus firmware broken unless we also merge it the same way (rather than through ASoC as it is now).
We could also merge a tag into both places.
Quoted 5 lines
Alternatively, we can try to find a different home for the Cirrus firmware to decouple the two problems. I'd argue that it's actually misplaced here, as
drivers/firmwareis meant for kernel code that interfaces with system firmware, not for device drivers to load their own firmware blobs from user space.
Trying to enforce distinctions here feels like it's liable to lead to trouble at some point...
Quoted 9 lines · Mark Brown
Quoted 5 lines · Arnd Bergmann
Not sure how we'd want to merge this patch, if two other things need it. I'd prefer to merge it along with the
QCOM_SCMchange through the soc tree, but that leaves the cirrus firmware broken unless we also merge it the same way (rather than through ASoC as it is now).We could also merge a tag into both places.
I wonder if I should just take my two patches as bugfixes for 5.15, after all they do address real build failures. In that case, all you need is a merge with 5.15-rc4 or higher.
Arnd
Quoted 9 lines · Arnd Bergmann
Quoted 8 lines · Mark Brown
Quoted 5 lines · Arnd Bergmann
Not sure how we'd want to merge this patch, if two other things need it. I'd prefer to merge it along with the
QCOM_SCMchange through the soc tree, but that leaves the cirrus firmware broken unless we also merge it the same way (rather than through ASoC as it is now).
Quoted 6 lines
Quoted 1 line
We could also merge a tag into both places.
I wonder if I should just take my two patches as bugfixes for 5.15, after all they do address real build failures. In that case, all you need is a merge with 5.15-rc4 or higher.
I'm in favor of this, better get it over with. With QCOM_IOMMU fixed up as well, feel free to add my
on both the patches, and for the qcom_scm changes you have my
Thanks,
Bjorn
Quoted 36 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Compile-testing drivers that require access to a firmware layer fails when that firmware symbol is unavailable. This happened twice this week:
- My proposed to change to rework the
QCOM_SCMfirmware symbol broke on ppc64 and others.- The
cs_dspfirmware patch added device specific firmware loader intodrivers/firmware, which broke on the same set of architectures.We should probably do the same thing for other subsystems as well, but fix this one first as this is a dependency for other patches getting merged.
Cc Mark Brown <[email protected]>Cc Liam Girdwood <[email protected]>Cc Charles Keepax <[email protected]>Cc Simon Trimmer <[email protected]>Cc Arnd Bergmann <[email protected]>Cc Michael Ellerman <[email protected]>Signed-off-by Arnd Bergmann <[email protected]>---
Not sure how we'd want to merge this patch, if two other things need it. I'd prefer to merge it along with theQCOM_SCMchange through the soc tree, but that leaves the cirrus firmware broken unless we also merge it the same way (rather than through ASoC as it is now).Alternatively, we can try to find a different home for the Cirrus firmware to decouple the two problems. I'd argue that it's actually misplaced here, as
drivers/firmwareis meant for kernel code that interfaces with system firmware, not for device drivers to load their own firmware blobs from user space.
Quoted 10 lines
--- arch/arm/Kconfig | 2 -- arch/arm64/Kconfig | 2 -- arch/ia64/Kconfig | 2 -- arch/mips/Kconfig | 2 -- arch/parisc/Kconfig | 2 -- arch/riscv/Kconfig | 2 -- arch/x86/Kconfig | 2 -- drivers/Kconfig | 2 ++ 8 files changed, 2 insertions(+), 14 deletions(-)
For arm64:
Will
Quoted 17 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Compile-testing drivers that require access to a firmware layer fails when that firmware symbol is unavailable. This happened twice this week:
- My proposed to change to rework the
QCOM_SCMfirmware symbol broke on ppc64 and others.- The
cs_dspfirmware patch added device specific firmware loader intodrivers/firmware, which broke on the same set of architectures.We should probably do the same thing for other subsystems as well, but fix this one first as this is a dependency for other patches getting merged.
Quoted 8 lines
Cc Mark Brown <[email protected]>Cc Liam Girdwood <[email protected]>Cc Charles Keepax <[email protected]>Cc Simon Trimmer <[email protected]>Cc Arnd Bergmann <[email protected]>Cc Michael Ellerman <[email protected]>Signed-off-by Arnd Bergmann <[email protected]>---
Thanks,
Charles
[Cc: [email protected]]
Dear Arnd,
Am 28.09.21 um 09:50 schrieb Arnd Bergmann:
Quoted 139 lines
From: Arnd Bergmann <[email protected]>
Compile-testing drivers that require access to a firmware layer fails when that firmware symbol is unavailable. This happened twice this week:
- My proposed to change to rework the
QCOM_SCMfirmware symbol broke on ppc64 and others.- The
cs_dspfirmware patch added device specific firmware loader intodrivers/firmware, which broke on the same set of architectures.We should probably do the same thing for other subsystems as well, but fix this one first as this is a dependency for other patches getting merged.
Cc Mark Brown <[email protected]>Cc Liam Girdwood <[email protected]>Cc Charles Keepax <[email protected]>Cc Simon Trimmer <[email protected]>Cc Arnd Bergmann <[email protected]>Cc Michael Ellerman <[email protected]>Signed-off-by Arnd Bergmann <[email protected]>---
Not sure how we'd want to merge this patch, if two other things need it. I'd prefer to merge it along with theQCOM_SCMchange through the soc tree, but that leaves the cirrus firmware broken unless we also merge it the same way (rather than through ASoC as it is now).Alternatively, we can try to find a different home for the Cirrus firmware to decouple the two problems. I'd argue that it's actually misplaced here, as
drivers/firmwareis meant for kernel code that interfaces with system firmware, not for device drivers to load their own firmware blobs from user space.--- arch/arm/Kconfig | 2 -- arch/arm64/Kconfig | 2 -- arch/ia64/Kconfig | 2 -- arch/mips/Kconfig | 2 -- arch/parisc/Kconfig | 2 -- arch/riscv/Kconfig | 2 -- arch/x86/Kconfig | 2 -- drivers/Kconfig | 2 ++ 8 files changed, 2 insertions(+), 14 deletions(-)arch/arm/Kconfig +0
-2@@ -1993,8 +1993,6 @@ config ARCH_HIBERNATION_POSSIBLE endmenu -source "drivers/firmware/Kconfig" - if CRYPTO source "arch/arm/crypto/Kconfig" endifarch/arm64/Kconfig +0
-2@@ -1931,8 +1931,6 @@ source "drivers/cpufreq/Kconfig" endmenu -source "drivers/firmware/Kconfig" - source "drivers/acpi/Kconfig" source "arch/arm64/kvm/Kconfig"arch/ia64/Kconfig +0
-2@@ -388,8 +388,6 @@ config CRASH_DUMP help Generate crash dump after being started by kexec. -source "drivers/firmware/Kconfig" - endmenu menu "Power management and ACPI options"arch/mips/Kconfig +0
-2@@ -3316,8 +3316,6 @@ source "drivers/cpuidle/Kconfig" endmenu -source "drivers/firmware/Kconfig" - source "arch/mips/kvm/Kconfig" source "arch/mips/vdso/Kconfig"arch/parisc/Kconfig +0
-2@@ -384,6 +384,4 @@ config KEXEC_FILE endmenu -source "drivers/firmware/Kconfig" - source "drivers/parisc/Kconfig"arch/riscv/Kconfig +0
-2@@ -561,5 +561,3 @@ menu "Power management options" source "kernel/power/Kconfig" endmenu - -source "drivers/firmware/Kconfig"arch/x86/Kconfig +0
-2@@ -2834,8 +2834,6 @@ config HAVE_ATOMIC_IOMAP def_bool y depends on X86_32 -source "drivers/firmware/Kconfig" - source "arch/x86/kvm/Kconfig" source "arch/x86/Kconfig.assembler"drivers/Kconfig +0
-0
drivers/Kconfig source "drivers/bus/Kconfig" · line 24
Quoted 8 lines
drivers/Kconfig +2
-0@@ -17,6 +17,8 @@ source "drivers/bus/Kconfig" source "drivers/connector/Kconfig" +source "drivers/firmware/Kconfig" + source "drivers/gnss/Kconfig" source "drivers/mtd/Kconfig"
With this change, I have the new entries below in my .config:
``` $ diff -u .config.old .config --- .config.old 2021-10-07 11:38:39.544000000 +0200 +++ .config 2021-10-09 10:02:03.156000000 +0200 @@ -1992,6 +1992,25 @@ CONFIG_CONNECTOR=y CONFIG_PROC_EVENTS=y + +# +# Firmware Drivers +# + +# +# ARM System Control and Management Interface Protocol +# +# end of ARM System Control and Management Interface Protocol + +# CONFIG_FIRMWARE_MEMMAP is not set +# CONFIG_GOOGLE_FIRMWARE is not set + +# +# Tegra firmware driver +# +# end of Tegra firmware driver +# end of Firmware Drivers + # CONFIG_GNSS is not set CONFIG_MTD=m # CONFIG_MTD_TESTS is not set ```
No idea if the entries could be hidden for platforms not supporting them.
ARM System Control and Management Interface Protocol ----
[ ] Add firmware-provided memory map to sysfs
[ ] Google Firmware Drivers ----
Tegra firmware driver ----
Kind regards,
Paul
Quoted 55 lines · Paul Menzel
[Cc: [email protected]]
Am 28.09.21 um 09:50 schrieb Arnd Bergmann:
Quoted 9 lines
From: Arnd Bergmann <[email protected]>
Compile-testing drivers that require access to a firmware layer fails when that firmware symbol is unavailable. This happened twice this week:
- My proposed to change to rework the
QCOM_SCMfirmware symbol broke on ppc64 and others.Quoted 8 lines
- The
cs_dspfirmware patch added device specific firmware loader intodrivers/firmware, which broke on the same set of architectures.We should probably do the same thing for other subsystems as well, but fix this one first as this is a dependency for other patches getting merged.
With this change, I have the new entries below in my .config:
```
$ diff -u .config.old .config.config 2021-10-09 10:02:03.156000000 +0200 renamed from .config.old 2021-10-07 11:38:39.544000000 +0200 +19
-0@@ -1992,6 +1992,25 @@ CONFIG_CONNECTOR=y CONFIG_PROC_EVENTS=y + +# +# Firmware Drivers +# + +# +# ARM System Control and Management Interface Protocol +# +# end of ARM System Control and Management Interface Protocol + +# CONFIG_FIRMWARE_MEMMAP is not set +# CONFIG_GOOGLE_FIRMWARE is not set + +# +# Tegra firmware driver +# +# end of Tegra firmware driver +# end of Firmware Drivers + # CONFIG_GNSS is not set CONFIG_MTD=m # CONFIG_MTD_TESTS is not set```
Quoted 6 lines
No idea if the entries could be hidden for platforms not supporting them.
ARM System Control and Management Interface Protocol ----
[ ] Add firmware-provided memory map to sysfs
[ ] Google Firmware Drivers ----
Tegra firmware driver ----
GOOGLE_FIRMWARE should probably depend on something.
I highly doubt Google is running servers on e.g. h8300 and nds32.
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
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
Quoted 24 lines · Geert Uytterhoeven
Quoted 23 lines · Paul Menzel
Am 28.09.21 um 09:50 schrieb Arnd Bergmann:
Quoted 1 line
From: Arnd Bergmann <[email protected]>
(quoted diff) +14
-0+# +# ARM System Control and Management Interface Protocol +# +# end of ARM System Control and Management Interface Protocol + +# CONFIG_FIRMWARE_MEMMAP is not set +# CONFIG_GOOGLE_FIRMWARE is not set + +# +# Tegra firmware driver +# +# end of Tegra firmware driver +# end of Firmware Drivers + # CONFIG_GNSS is not set CONFIG_MTD=m # CONFIG_MTD_TESTS is not set```
No idea if the entries could be hidden for platforms not supporting them.
Quoted 7 lines
Quoted 4 lines
ARM System Control and Management Interface Protocol ----
[ ] Add firmware-provided memory map to sysfs
[ ] Google Firmware Drivers ----
Tegra firmware driver ----
GOOGLE_FIRMWAREshould probably depend on something.
I highly doubt Google is running servers on e.g. h8300 and nds32.
GOOGLE_FIRMWARE is only the 'menuconfig' option that contains the other options, but on architectures that have neither CONFIG_OF nor CONFIG_ACPI, this is empty. Most architectures of course do support or require CONFIG_OF, so it's unclear whether we should show the options for coreboot. Since it's a software-only driver, I would tend to keep showing it, given that coreboot can be ported to every architecture. The DT binding [1] seems to be neither Google nor Arm specific.
CONFIG_FIRMWARE_MEMMAP in turn can be used for anything that has memory hotplug, and in theory additional drivers that register with this interface.
I'd lean towards "leave as is" for both, to avoid having to change the dependencies again whenever something else can use these.
Arnd
[1] Documentation/devicetree/bindings/firmware/coreboot.txt