More Qualcomm driver updates for v6.7

The Qualcomm SMC an QSEECOM drivers are moved into a "qcom"
 subdirectory, to declutter the base directory. Missing include guards
 are added to the qseecom header file. Unneded extern specifiers are
 removed from the scm call wrappers.
 
 __counted_by is added to the apr_rx_buf structure, in the APR driver.
 
 Lastly in the pmic_glink driver the pmic_glink drm_bridge type is
 corrected to DisplayPort, over the incorrect "USB" value. The return
 values are added to error prints for the various typec set() calls.
 -----BEGIN PGP SIGNATURE-----
 
 iQJJBAABCAAzFiEEBd4DzF816k8JZtUlCx85Pw2ZrcUFAmU5desVHGFuZGVyc3Nv
 bkBrZXJuZWwub3JnAAoJEAsfOT8Nma3FEY4QAL9q2iDnHbo908AiD781vvoJ0t6H
 FJDFRwDQXv/JaLHKc6kXt2JQZZGAkTFqPiiu06DWVfgk7oXwBHmdsaq+nXqJGTfx
 3vR6/1TBzMgv3eT4zzPPZF/0E0mttLczZSd5z7Vg4oe1RSVGpaOe6icmxxLNiG0J
 LZN6o18rsfcl0TrCt2nR95BkkKINO7mfqz5iJWYTS8K8SM+APjrAoYOlWfE9VfBo
 FFni1UIJAVGL3qMECZ2ntUEVIUQZJu1vhL50/S5tRROPR1PCDJ1i2SThD209I3M2
 cmbVST3boIgqC9lv36NsZzDNg1kYCR7lT9SVOxSZUjZvAxY5Kz+t7HJyTvRcnTA7
 INw02mk2lWPvvTYKpwo0d0JMfTa7ReYC5Im4Nijk5hNExwu4zomWDpcCtrb6I/T8
 Eqrr4p/2WVGZ5OvMEcZzUULLyenZ9vS3ABKmjmbI2oj4CuVukJPFy0LSLgy1ZgAh
 RKAplCRp0HkxL+M9qsCB1HhQksS6y7sjrx7amXl+mn2+/7AVa61QfsuDg2Qc/k5r
 SHhfk51jXPI3modH96ieThOHmcoK+vHUFPgwGbgPkiHdNaXXbMkFgYdD1XQ6WLJc
 ZYLDhpWrSzB6NkrczCogXbJflla6knZ1dz5zRQVeBO4x4dRq5O8O3VPQ3k18/Aj4
 w7NtiweoKMx3RuBp
 =dVO+
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmU5gXYACgkQYKtH/8kJ
 Uic6/xAA2ZU8EPNMnsFe7kXEmBo9/OTHpFD7A7snaF2tjZ3NgP/vGR8D/nxCb8g3
 WbgBwHAvR1QfOGc1ACC0j20t+c0GvcsIoLn296madHHZtO42j46O0OQW7uC7vm7u
 Bu8QSyjUl9DncZOUFD64Q9yTZhi+857iJEvras2qpyiaXFdmoq0FKWzOf2y79DZl
 GwrIVOSWM8rA739JU4LEW7Xe21deTjqOpdTv9yLu+levOQaUwTs/waCTgTdDiLaG
 3C7ptpkWTeqlfKUKMXWzPSmggnRDRnRJNOyQMzpq8ftalbZYv34ScNBNtuevahcu
 dmB8iFEBSZGdvCAMB0rGEopENW7lfoJXqxyTalS1S8yPjy3cSsHq3pkkU9R84L8Y
 0MoI0IARwYoZvzEXYHEMi+BstGBQglXoCgBYaBlvhjJ1+kgtFfiW+xTPd1DghkyM
 /NiV6/4a87ccbT05Je0qbZdRBptu4EGSwcFeUHEkskfEWtps6RZCqWWnPSQoUgQC
 Lu6lOvle+rSrQ5hNS+RlX5NIdfbKJ0x6HamZVfeDXzuSnh7023dmXUqib7xpCMa7
 PQAIhsXDesT8b2gP04+JX2hphvQ/il2BowCOw5j9Xg2XQSs5Alf++sfY9DS32oYk
 pnqMT/6UISVbwI4MVgNtwFujW1+zF+RwyMXurKSAi2hTirdgHuw=
 =PxVV
 -----END PGP SIGNATURE-----

Merge tag 'qcom-drivers-for-6.7-2' of https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux into soc/drivers

More Qualcomm driver updates for v6.7

The Qualcomm SMC an QSEECOM drivers are moved into a "qcom"
subdirectory, to declutter the base directory. Missing include guards
are added to the qseecom header file. Unneded extern specifiers are
removed from the scm call wrappers.

__counted_by is added to the apr_rx_buf structure, in the APR driver.

Lastly in the pmic_glink driver the pmic_glink drm_bridge type is
corrected to DisplayPort, over the incorrect "USB" value. The return
values are added to error prints for the various typec set() calls.

* tag 'qcom-drivers-for-6.7-2' of https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux:
  soc: qcom: pmic_glink_altmode: Print return value on error
  firmware: qcom: scm: remove unneeded 'extern' specifiers
  firmware: qcom: scm: add a missing forward declaration for struct device
  firmware: qcom: move Qualcomm code into its own directory
  soc: qcom: apr: Add __counted_by for struct apr_rx_buf and use struct_size()
  soc: qcom: pmic_glink: fix connector type to be DisplayPort
  firmware: qcom: qseecom: add missing include guards

Link: https://lore.kernel.org/r/20231025201109.1016121-1-andersson@kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Arnd Bergmann 2023-10-25 22:58:30 +02:00
commit dfae947836
14 changed files with 93 additions and 70 deletions

View File

@ -17805,13 +17805,13 @@ QUALCOMM QSEECOM DRIVER
M: Maximilian Luz <luzmaximilian@gmail.com> M: Maximilian Luz <luzmaximilian@gmail.com>
L: linux-arm-msm@vger.kernel.org L: linux-arm-msm@vger.kernel.org
S: Maintained S: Maintained
F: drivers/firmware/qcom_qseecom.c F: drivers/firmware/qcom/qcom_qseecom.c
QUALCOMM QSEECOM UEFISECAPP DRIVER QUALCOMM QSEECOM UEFISECAPP DRIVER
M: Maximilian Luz <luzmaximilian@gmail.com> M: Maximilian Luz <luzmaximilian@gmail.com>
L: linux-arm-msm@vger.kernel.org L: linux-arm-msm@vger.kernel.org
S: Maintained S: Maintained
F: drivers/firmware/qcom_qseecom_uefisecapp.c F: drivers/firmware/qcom/qcom_qseecom_uefisecapp.c
QUALCOMM RMNET DRIVER QUALCOMM RMNET DRIVER
M: Subash Abhinov Kasiviswanathan <quic_subashab@quicinc.com> M: Subash Abhinov Kasiviswanathan <quic_subashab@quicinc.com>

View File

@ -212,53 +212,6 @@ config MTK_ADSP_IPC
ADSP exists on some mtk processors. ADSP exists on some mtk processors.
Client might use shared memory to exchange information with ADSP. Client might use shared memory to exchange information with ADSP.
config QCOM_SCM
tristate
config QCOM_SCM_DOWNLOAD_MODE_DEFAULT
bool "Qualcomm download mode enabled by default"
depends on QCOM_SCM
help
A device with "download mode" enabled will upon an unexpected
warm-restart enter a special debug mode that allows the user to
"download" memory content over USB for offline postmortem analysis.
The feature can be enabled/disabled on the kernel command line.
Say Y here to enable "download mode" by default.
config QCOM_QSEECOM
bool "Qualcomm QSEECOM interface driver"
depends on QCOM_SCM=y
select AUXILIARY_BUS
help
Various Qualcomm SoCs have a Secure Execution Environment (SEE) running
in the Trust Zone. This module provides an interface to that via the
QSEECOM mechanism, using SCM calls.
The QSEECOM interface allows, among other things, access to applications
running in the SEE. An example of such an application is 'uefisecapp',
which is required to access UEFI variables on certain systems. If
selected, the interface will also attempt to detect and register client
devices for supported applications.
Select Y here to enable the QSEECOM interface driver.
config QCOM_QSEECOM_UEFISECAPP
bool "Qualcomm SEE UEFI Secure App client driver"
depends on QCOM_QSEECOM
depends on EFI
help
Various Qualcomm SoCs do not allow direct access to EFI variables.
Instead, these need to be accessed via the UEFI Secure Application
(uefisecapp), residing in the Secure Execution Environment (SEE).
This module provides a client driver for uefisecapp, installing efivar
operations to allow the kernel accessing EFI variables, and via that also
provide user-space with access to EFI variables via efivarfs.
Select Y here to provide access to EFI variables on the aforementioned
platforms.
config SYSFB config SYSFB
bool bool
select BOOT_VESA_SUPPORT select BOOT_VESA_SUPPORT
@ -344,6 +297,7 @@ source "drivers/firmware/efi/Kconfig"
source "drivers/firmware/imx/Kconfig" source "drivers/firmware/imx/Kconfig"
source "drivers/firmware/meson/Kconfig" source "drivers/firmware/meson/Kconfig"
source "drivers/firmware/psci/Kconfig" source "drivers/firmware/psci/Kconfig"
source "drivers/firmware/qcom/Kconfig"
source "drivers/firmware/smccc/Kconfig" source "drivers/firmware/smccc/Kconfig"
source "drivers/firmware/tegra/Kconfig" source "drivers/firmware/tegra/Kconfig"
source "drivers/firmware/xilinx/Kconfig" source "drivers/firmware/xilinx/Kconfig"

View File

@ -18,10 +18,6 @@ obj-$(CONFIG_FIRMWARE_MEMMAP) += memmap.o
obj-$(CONFIG_MTK_ADSP_IPC) += mtk-adsp-ipc.o obj-$(CONFIG_MTK_ADSP_IPC) += mtk-adsp-ipc.o
obj-$(CONFIG_RASPBERRYPI_FIRMWARE) += raspberrypi.o obj-$(CONFIG_RASPBERRYPI_FIRMWARE) += raspberrypi.o
obj-$(CONFIG_FW_CFG_SYSFS) += qemu_fw_cfg.o obj-$(CONFIG_FW_CFG_SYSFS) += qemu_fw_cfg.o
obj-$(CONFIG_QCOM_SCM) += qcom-scm.o
qcom-scm-objs += qcom_scm.o qcom_scm-smc.o qcom_scm-legacy.o
obj-$(CONFIG_QCOM_QSEECOM) += qcom_qseecom.o
obj-$(CONFIG_QCOM_QSEECOM_UEFISECAPP) += qcom_qseecom_uefisecapp.o
obj-$(CONFIG_SYSFB) += sysfb.o obj-$(CONFIG_SYSFB) += sysfb.o
obj-$(CONFIG_SYSFB_SIMPLEFB) += sysfb_simplefb.o obj-$(CONFIG_SYSFB_SIMPLEFB) += sysfb_simplefb.o
obj-$(CONFIG_TI_SCI_PROTOCOL) += ti_sci.o obj-$(CONFIG_TI_SCI_PROTOCOL) += ti_sci.o
@ -37,6 +33,7 @@ obj-$(CONFIG_GOOGLE_FIRMWARE) += google/
obj-y += efi/ obj-y += efi/
obj-y += imx/ obj-y += imx/
obj-y += psci/ obj-y += psci/
obj-y += qcom/
obj-y += smccc/ obj-y += smccc/
obj-y += tegra/ obj-y += tegra/
obj-y += xilinx/ obj-y += xilinx/

View File

@ -0,0 +1,56 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.rst.
#
menu "Qualcomm firmware drivers"
config QCOM_SCM
tristate
config QCOM_SCM_DOWNLOAD_MODE_DEFAULT
bool "Qualcomm download mode enabled by default"
depends on QCOM_SCM
help
A device with "download mode" enabled will upon an unexpected
warm-restart enter a special debug mode that allows the user to
"download" memory content over USB for offline postmortem analysis.
The feature can be enabled/disabled on the kernel command line.
Say Y here to enable "download mode" by default.
config QCOM_QSEECOM
bool "Qualcomm QSEECOM interface driver"
depends on QCOM_SCM=y
select AUXILIARY_BUS
help
Various Qualcomm SoCs have a Secure Execution Environment (SEE) running
in the Trust Zone. This module provides an interface to that via the
QSEECOM mechanism, using SCM calls.
The QSEECOM interface allows, among other things, access to applications
running in the SEE. An example of such an application is 'uefisecapp',
which is required to access UEFI variables on certain systems. If
selected, the interface will also attempt to detect and register client
devices for supported applications.
Select Y here to enable the QSEECOM interface driver.
config QCOM_QSEECOM_UEFISECAPP
bool "Qualcomm SEE UEFI Secure App client driver"
depends on QCOM_QSEECOM
depends on EFI
help
Various Qualcomm SoCs do not allow direct access to EFI variables.
Instead, these need to be accessed via the UEFI Secure Application
(uefisecapp), residing in the Secure Execution Environment (SEE).
This module provides a client driver for uefisecapp, installing efivar
operations to allow the kernel accessing EFI variables, and via that also
provide user-space with access to EFI variables via efivarfs.
Select Y here to provide access to EFI variables on the aforementioned
platforms.
endmenu

View File

@ -0,0 +1,9 @@
# SPDX-License-Identifier: GPL-2.0
#
# Makefile for the linux kernel.
#
obj-$(CONFIG_QCOM_SCM) += qcom-scm.o
qcom-scm-objs += qcom_scm.o qcom_scm-smc.o qcom_scm-legacy.o
obj-$(CONFIG_QCOM_QSEECOM) += qcom_qseecom.o
obj-$(CONFIG_QCOM_QSEECOM_UEFISECAPP) += qcom_qseecom_uefisecapp.o

View File

@ -4,6 +4,8 @@
#ifndef __QCOM_SCM_INT_H #ifndef __QCOM_SCM_INT_H
#define __QCOM_SCM_INT_H #define __QCOM_SCM_INT_H
struct device;
enum qcom_scm_convention { enum qcom_scm_convention {
SMC_CONVENTION_UNKNOWN, SMC_CONVENTION_UNKNOWN,
SMC_CONVENTION_LEGACY, SMC_CONVENTION_LEGACY,
@ -64,18 +66,17 @@ int qcom_scm_wait_for_wq_completion(u32 wq_ctx);
int scm_get_wq_ctx(u32 *wq_ctx, u32 *flags, u32 *more_pending); int scm_get_wq_ctx(u32 *wq_ctx, u32 *flags, u32 *more_pending);
#define SCM_SMC_FNID(s, c) ((((s) & 0xFF) << 8) | ((c) & 0xFF)) #define SCM_SMC_FNID(s, c) ((((s) & 0xFF) << 8) | ((c) & 0xFF))
extern int __scm_smc_call(struct device *dev, const struct qcom_scm_desc *desc, int __scm_smc_call(struct device *dev, const struct qcom_scm_desc *desc,
enum qcom_scm_convention qcom_convention, enum qcom_scm_convention qcom_convention,
struct qcom_scm_res *res, bool atomic); struct qcom_scm_res *res, bool atomic);
#define scm_smc_call(dev, desc, res, atomic) \ #define scm_smc_call(dev, desc, res, atomic) \
__scm_smc_call((dev), (desc), qcom_scm_convention, (res), (atomic)) __scm_smc_call((dev), (desc), qcom_scm_convention, (res), (atomic))
#define SCM_LEGACY_FNID(s, c) (((s) << 10) | ((c) & 0x3ff)) #define SCM_LEGACY_FNID(s, c) (((s) << 10) | ((c) & 0x3ff))
extern int scm_legacy_call_atomic(struct device *dev, int scm_legacy_call_atomic(struct device *dev, const struct qcom_scm_desc *desc,
const struct qcom_scm_desc *desc,
struct qcom_scm_res *res);
extern int scm_legacy_call(struct device *dev, const struct qcom_scm_desc *desc,
struct qcom_scm_res *res); struct qcom_scm_res *res);
int scm_legacy_call(struct device *dev, const struct qcom_scm_desc *desc,
struct qcom_scm_res *res);
#define QCOM_SCM_SVC_BOOT 0x01 #define QCOM_SCM_SVC_BOOT 0x01
#define QCOM_SCM_BOOT_SET_ADDR 0x01 #define QCOM_SCM_BOOT_SET_ADDR 0x01

View File

@ -41,7 +41,7 @@ struct packet_router {
struct apr_rx_buf { struct apr_rx_buf {
struct list_head node; struct list_head node;
int len; int len;
uint8_t buf[]; uint8_t buf[] __counted_by(len);
}; };
/** /**
@ -171,7 +171,7 @@ static int apr_callback(struct rpmsg_device *rpdev, void *buf,
return -EINVAL; return -EINVAL;
} }
abuf = kzalloc(sizeof(*abuf) + len, GFP_ATOMIC); abuf = kzalloc(struct_size(abuf, buf, len), GFP_ATOMIC);
if (!abuf) if (!abuf)
return -ENOMEM; return -ENOMEM;

View File

@ -160,7 +160,7 @@ static void pmic_glink_altmode_enable_dp(struct pmic_glink_altmode *altmode,
ret = typec_mux_set(port->typec_mux, &port->state); ret = typec_mux_set(port->typec_mux, &port->state);
if (ret) if (ret)
dev_err(altmode->dev, "failed to switch mux to DP\n"); dev_err(altmode->dev, "failed to switch mux to DP: %d\n", ret);
port->retimer_state.alt = &port->dp_alt; port->retimer_state.alt = &port->dp_alt;
port->retimer_state.data = &dp_data; port->retimer_state.data = &dp_data;
@ -168,7 +168,7 @@ static void pmic_glink_altmode_enable_dp(struct pmic_glink_altmode *altmode,
ret = typec_retimer_set(port->typec_retimer, &port->retimer_state); ret = typec_retimer_set(port->typec_retimer, &port->retimer_state);
if (ret) if (ret)
dev_err(altmode->dev, "failed to setup retimer to DP\n"); dev_err(altmode->dev, "failed to setup retimer to DP: %d\n", ret);
} }
static void pmic_glink_altmode_enable_usb(struct pmic_glink_altmode *altmode, static void pmic_glink_altmode_enable_usb(struct pmic_glink_altmode *altmode,
@ -182,7 +182,7 @@ static void pmic_glink_altmode_enable_usb(struct pmic_glink_altmode *altmode,
ret = typec_mux_set(port->typec_mux, &port->state); ret = typec_mux_set(port->typec_mux, &port->state);
if (ret) if (ret)
dev_err(altmode->dev, "failed to switch mux to USB\n"); dev_err(altmode->dev, "failed to switch mux to USB: %d\n", ret);
port->retimer_state.alt = NULL; port->retimer_state.alt = NULL;
port->retimer_state.data = NULL; port->retimer_state.data = NULL;
@ -190,7 +190,7 @@ static void pmic_glink_altmode_enable_usb(struct pmic_glink_altmode *altmode,
ret = typec_retimer_set(port->typec_retimer, &port->retimer_state); ret = typec_retimer_set(port->typec_retimer, &port->retimer_state);
if (ret) if (ret)
dev_err(altmode->dev, "failed to setup retimer to USB\n"); dev_err(altmode->dev, "failed to setup retimer to USB: %d\n", ret);
} }
static void pmic_glink_altmode_safe(struct pmic_glink_altmode *altmode, static void pmic_glink_altmode_safe(struct pmic_glink_altmode *altmode,
@ -204,7 +204,7 @@ static void pmic_glink_altmode_safe(struct pmic_glink_altmode *altmode,
ret = typec_mux_set(port->typec_mux, &port->state); ret = typec_mux_set(port->typec_mux, &port->state);
if (ret) if (ret)
dev_err(altmode->dev, "failed to switch mux to safe mode\n"); dev_err(altmode->dev, "failed to switch mux to safe mode: %d\n", ret);
port->retimer_state.alt = NULL; port->retimer_state.alt = NULL;
port->retimer_state.data = NULL; port->retimer_state.data = NULL;
@ -212,7 +212,7 @@ static void pmic_glink_altmode_safe(struct pmic_glink_altmode *altmode,
ret = typec_retimer_set(port->typec_retimer, &port->retimer_state); ret = typec_retimer_set(port->typec_retimer, &port->retimer_state);
if (ret) if (ret)
dev_err(altmode->dev, "failed to setup retimer to USB\n"); dev_err(altmode->dev, "failed to setup retimer to USB: %d\n", ret);
} }
static void pmic_glink_altmode_worker(struct work_struct *work) static void pmic_glink_altmode_worker(struct work_struct *work)
@ -397,7 +397,7 @@ static void pmic_glink_altmode_enable_worker(struct work_struct *work)
ret = pmic_glink_altmode_request(altmode, ALTMODE_PAN_EN, 0); ret = pmic_glink_altmode_request(altmode, ALTMODE_PAN_EN, 0);
if (ret) if (ret)
dev_err(altmode->dev, "failed to request altmode notifications\n"); dev_err(altmode->dev, "failed to request altmode notifications: %d\n", ret);
} }
static void pmic_glink_altmode_pdr_notify(void *priv, int state) static void pmic_glink_altmode_pdr_notify(void *priv, int state)
@ -467,7 +467,7 @@ static int pmic_glink_altmode_probe(struct auxiliary_device *adev,
alt_port->bridge.funcs = &pmic_glink_altmode_bridge_funcs; alt_port->bridge.funcs = &pmic_glink_altmode_bridge_funcs;
alt_port->bridge.of_node = to_of_node(fwnode); alt_port->bridge.of_node = to_of_node(fwnode);
alt_port->bridge.ops = DRM_BRIDGE_OP_HPD; alt_port->bridge.ops = DRM_BRIDGE_OP_HPD;
alt_port->bridge.type = DRM_MODE_CONNECTOR_USB; alt_port->bridge.type = DRM_MODE_CONNECTOR_DisplayPort;
ret = devm_drm_bridge_add(dev, &alt_port->bridge); ret = devm_drm_bridge_add(dev, &alt_port->bridge);
if (ret) { if (ret) {

View File

@ -5,6 +5,10 @@
* *
* Copyright (C) 2023 Maximilian Luz <luzmaximilian@gmail.com> * Copyright (C) 2023 Maximilian Luz <luzmaximilian@gmail.com>
*/ */
#ifndef __QCOM_QSEECOM_H
#define __QCOM_QSEECOM_H
#include <linux/auxiliary_bus.h> #include <linux/auxiliary_bus.h>
#include <linux/types.h> #include <linux/types.h>
@ -44,3 +48,5 @@ static inline int qcom_qseecom_app_send(struct qseecom_client *client, void *req
{ {
return qcom_scm_qseecom_app_send(client->app_id, req, req_size, rsp, rsp_size); return qcom_scm_qseecom_app_send(client->app_id, req, req_size, rsp, rsp_size);
} }
#endif /* __QCOM_QSEECOM_H */