Commit c15b4245 authored by Bjorn Andersson's avatar Bjorn Andersson

Merge branch '20240622-qcom-pd-mapper-v9-0-a84ee3591c8e@linaro.org' of...

Merge branch '20240622-qcom-pd-mapper-v9-0-a84ee3591c8e@linaro.org' of https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux into rproc-next

Merge the pd-mapper implementation from the Qualcomm SoC in order to
provide the dependencies for the Qualcomm PAS remoteproc driver.
parents 78aaf429 1ebcde04
...@@ -72,11 +72,26 @@ config QCOM_OCMEM ...@@ -72,11 +72,26 @@ config QCOM_OCMEM
requirements. This is typically used by the GPU, camera/video, and requirements. This is typically used by the GPU, camera/video, and
audio components on some Snapdragon SoCs. audio components on some Snapdragon SoCs.
config QCOM_PD_MAPPER
tristate "Qualcomm Protection Domain Mapper"
select QCOM_QMI_HELPERS
depends on NET && QRTR
default QCOM_RPROC_COMMON
help
The Protection Domain Mapper maps registered services to the domains
and instances handled by the remote DSPs. This is a kernel-space
implementation of the service. It is a simpler alternative to the
userspace daemon.
config QCOM_PDR_HELPERS config QCOM_PDR_HELPERS
tristate tristate
select QCOM_QMI_HELPERS select QCOM_QMI_HELPERS
select QCOM_PDR_MSG
depends on NET depends on NET
config QCOM_PDR_MSG
tristate
config QCOM_PMIC_PDCHARGER_ULOG config QCOM_PMIC_PDCHARGER_ULOG
tristate "Qualcomm PMIC PDCharger ULOG driver" tristate "Qualcomm PMIC PDCharger ULOG driver"
depends on RPMSG depends on RPMSG
......
...@@ -7,7 +7,9 @@ obj-$(CONFIG_QCOM_COMMAND_DB) += cmd-db.o ...@@ -7,7 +7,9 @@ obj-$(CONFIG_QCOM_COMMAND_DB) += cmd-db.o
obj-$(CONFIG_QCOM_GSBI) += qcom_gsbi.o obj-$(CONFIG_QCOM_GSBI) += qcom_gsbi.o
obj-$(CONFIG_QCOM_MDT_LOADER) += mdt_loader.o obj-$(CONFIG_QCOM_MDT_LOADER) += mdt_loader.o
obj-$(CONFIG_QCOM_OCMEM) += ocmem.o obj-$(CONFIG_QCOM_OCMEM) += ocmem.o
obj-$(CONFIG_QCOM_PD_MAPPER) += qcom_pd_mapper.o
obj-$(CONFIG_QCOM_PDR_HELPERS) += pdr_interface.o obj-$(CONFIG_QCOM_PDR_HELPERS) += pdr_interface.o
obj-$(CONFIG_QCOM_PDR_MSG) += qcom_pdr_msg.o
obj-$(CONFIG_QCOM_PMIC_GLINK) += pmic_glink.o obj-$(CONFIG_QCOM_PMIC_GLINK) += pmic_glink.o
obj-$(CONFIG_QCOM_PMIC_GLINK) += pmic_glink_altmode.o obj-$(CONFIG_QCOM_PMIC_GLINK) += pmic_glink_altmode.o
obj-$(CONFIG_QCOM_PMIC_PDCHARGER_ULOG) += pmic_pdcharger_ulog.o obj-$(CONFIG_QCOM_PMIC_PDCHARGER_ULOG) += pmic_pdcharger_ulog.o
......
...@@ -76,12 +76,12 @@ static int pdr_locator_new_server(struct qmi_handle *qmi, ...@@ -76,12 +76,12 @@ static int pdr_locator_new_server(struct qmi_handle *qmi,
locator_hdl); locator_hdl);
struct pdr_service *pds; struct pdr_service *pds;
mutex_lock(&pdr->lock);
/* Create a local client port for QMI communication */ /* Create a local client port for QMI communication */
pdr->locator_addr.sq_family = AF_QIPCRTR; pdr->locator_addr.sq_family = AF_QIPCRTR;
pdr->locator_addr.sq_node = svc->node; pdr->locator_addr.sq_node = svc->node;
pdr->locator_addr.sq_port = svc->port; pdr->locator_addr.sq_port = svc->port;
mutex_lock(&pdr->lock);
pdr->locator_init_complete = true; pdr->locator_init_complete = true;
mutex_unlock(&pdr->lock); mutex_unlock(&pdr->lock);
...@@ -104,10 +104,10 @@ static void pdr_locator_del_server(struct qmi_handle *qmi, ...@@ -104,10 +104,10 @@ static void pdr_locator_del_server(struct qmi_handle *qmi,
mutex_lock(&pdr->lock); mutex_lock(&pdr->lock);
pdr->locator_init_complete = false; pdr->locator_init_complete = false;
mutex_unlock(&pdr->lock);
pdr->locator_addr.sq_node = 0; pdr->locator_addr.sq_node = 0;
pdr->locator_addr.sq_port = 0; pdr->locator_addr.sq_port = 0;
mutex_unlock(&pdr->lock);
} }
static const struct qmi_ops pdr_locator_ops = { static const struct qmi_ops pdr_locator_ops = {
...@@ -365,12 +365,14 @@ static int pdr_get_domain_list(struct servreg_get_domain_list_req *req, ...@@ -365,12 +365,14 @@ static int pdr_get_domain_list(struct servreg_get_domain_list_req *req,
if (ret < 0) if (ret < 0)
return ret; return ret;
mutex_lock(&pdr->lock);
ret = qmi_send_request(&pdr->locator_hdl, ret = qmi_send_request(&pdr->locator_hdl,
&pdr->locator_addr, &pdr->locator_addr,
&txn, SERVREG_GET_DOMAIN_LIST_REQ, &txn, SERVREG_GET_DOMAIN_LIST_REQ,
SERVREG_GET_DOMAIN_LIST_REQ_MAX_LEN, SERVREG_GET_DOMAIN_LIST_REQ_MAX_LEN,
servreg_get_domain_list_req_ei, servreg_get_domain_list_req_ei,
req); req);
mutex_unlock(&pdr->lock);
if (ret < 0) { if (ret < 0) {
qmi_txn_cancel(&txn); qmi_txn_cancel(&txn);
return ret; return ret;
...@@ -415,7 +417,7 @@ static int pdr_locate_service(struct pdr_handle *pdr, struct pdr_service *pds) ...@@ -415,7 +417,7 @@ static int pdr_locate_service(struct pdr_handle *pdr, struct pdr_service *pds)
if (ret < 0) if (ret < 0)
goto out; goto out;
for (i = domains_read; i < resp->domain_list_len; i++) { for (i = 0; i < resp->domain_list_len; i++) {
entry = &resp->domain_list[i]; entry = &resp->domain_list[i];
if (strnlen(entry->name, sizeof(entry->name)) == sizeof(entry->name)) if (strnlen(entry->name, sizeof(entry->name)) == sizeof(entry->name))
......
This diff is collapsed.
This diff is collapsed.
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2020 The Linux Foundation. All rights reserved.
*/
#include <linux/module.h>
#include <linux/soc/qcom/qmi.h>
#include "pdr_internal.h"
const struct qmi_elem_info servreg_location_entry_ei[] = {
{
.data_type = QMI_STRING,
.elem_len = SERVREG_NAME_LENGTH + 1,
.elem_size = sizeof(char),
.array_type = NO_ARRAY,
.tlv_type = 0,
.offset = offsetof(struct servreg_location_entry,
name),
},
{
.data_type = QMI_UNSIGNED_4_BYTE,
.elem_len = 1,
.elem_size = sizeof(u32),
.array_type = NO_ARRAY,
.tlv_type = 0,
.offset = offsetof(struct servreg_location_entry,
instance),
},
{
.data_type = QMI_UNSIGNED_1_BYTE,
.elem_len = 1,
.elem_size = sizeof(u8),
.array_type = NO_ARRAY,
.tlv_type = 0,
.offset = offsetof(struct servreg_location_entry,
service_data_valid),
},
{
.data_type = QMI_UNSIGNED_4_BYTE,
.elem_len = 1,
.elem_size = sizeof(u32),
.array_type = NO_ARRAY,
.tlv_type = 0,
.offset = offsetof(struct servreg_location_entry,
service_data),
},
{}
};
EXPORT_SYMBOL_GPL(servreg_location_entry_ei);
const struct qmi_elem_info servreg_get_domain_list_req_ei[] = {
{
.data_type = QMI_STRING,
.elem_len = SERVREG_NAME_LENGTH + 1,
.elem_size = sizeof(char),
.array_type = NO_ARRAY,
.tlv_type = 0x01,
.offset = offsetof(struct servreg_get_domain_list_req,
service_name),
},
{
.data_type = QMI_OPT_FLAG,
.elem_len = 1,
.elem_size = sizeof(u8),
.array_type = NO_ARRAY,
.tlv_type = 0x10,
.offset = offsetof(struct servreg_get_domain_list_req,
domain_offset_valid),
},
{
.data_type = QMI_UNSIGNED_4_BYTE,
.elem_len = 1,
.elem_size = sizeof(u32),
.array_type = NO_ARRAY,
.tlv_type = 0x10,
.offset = offsetof(struct servreg_get_domain_list_req,
domain_offset),
},
{}
};
EXPORT_SYMBOL_GPL(servreg_get_domain_list_req_ei);
const struct qmi_elem_info servreg_get_domain_list_resp_ei[] = {
{
.data_type = QMI_STRUCT,
.elem_len = 1,
.elem_size = sizeof(struct qmi_response_type_v01),
.array_type = NO_ARRAY,
.tlv_type = 0x02,
.offset = offsetof(struct servreg_get_domain_list_resp,
resp),
.ei_array = qmi_response_type_v01_ei,
},
{
.data_type = QMI_OPT_FLAG,
.elem_len = 1,
.elem_size = sizeof(u8),
.array_type = NO_ARRAY,
.tlv_type = 0x10,
.offset = offsetof(struct servreg_get_domain_list_resp,
total_domains_valid),
},
{
.data_type = QMI_UNSIGNED_2_BYTE,
.elem_len = 1,
.elem_size = sizeof(u16),
.array_type = NO_ARRAY,
.tlv_type = 0x10,
.offset = offsetof(struct servreg_get_domain_list_resp,
total_domains),
},
{
.data_type = QMI_OPT_FLAG,
.elem_len = 1,
.elem_size = sizeof(u8),
.array_type = NO_ARRAY,
.tlv_type = 0x11,
.offset = offsetof(struct servreg_get_domain_list_resp,
db_rev_count_valid),
},
{
.data_type = QMI_UNSIGNED_2_BYTE,
.elem_len = 1,
.elem_size = sizeof(u16),
.array_type = NO_ARRAY,
.tlv_type = 0x11,
.offset = offsetof(struct servreg_get_domain_list_resp,
db_rev_count),
},
{
.data_type = QMI_OPT_FLAG,
.elem_len = 1,
.elem_size = sizeof(u8),
.array_type = NO_ARRAY,
.tlv_type = 0x12,
.offset = offsetof(struct servreg_get_domain_list_resp,
domain_list_valid),
},
{
.data_type = QMI_DATA_LEN,
.elem_len = 1,
.elem_size = sizeof(u8),
.array_type = NO_ARRAY,
.tlv_type = 0x12,
.offset = offsetof(struct servreg_get_domain_list_resp,
domain_list_len),
},
{
.data_type = QMI_STRUCT,
.elem_len = SERVREG_DOMAIN_LIST_LENGTH,
.elem_size = sizeof(struct servreg_location_entry),
.array_type = VAR_LEN_ARRAY,
.tlv_type = 0x12,
.offset = offsetof(struct servreg_get_domain_list_resp,
domain_list),
.ei_array = servreg_location_entry_ei,
},
{}
};
EXPORT_SYMBOL_GPL(servreg_get_domain_list_resp_ei);
const struct qmi_elem_info servreg_register_listener_req_ei[] = {
{
.data_type = QMI_UNSIGNED_1_BYTE,
.elem_len = 1,
.elem_size = sizeof(u8),
.array_type = NO_ARRAY,
.tlv_type = 0x01,
.offset = offsetof(struct servreg_register_listener_req,
enable),
},
{
.data_type = QMI_STRING,
.elem_len = SERVREG_NAME_LENGTH + 1,
.elem_size = sizeof(char),
.array_type = NO_ARRAY,
.tlv_type = 0x02,
.offset = offsetof(struct servreg_register_listener_req,
service_path),
},
{}
};
EXPORT_SYMBOL_GPL(servreg_register_listener_req_ei);
const struct qmi_elem_info servreg_register_listener_resp_ei[] = {
{
.data_type = QMI_STRUCT,
.elem_len = 1,
.elem_size = sizeof(struct qmi_response_type_v01),
.array_type = NO_ARRAY,
.tlv_type = 0x02,
.offset = offsetof(struct servreg_register_listener_resp,
resp),
.ei_array = qmi_response_type_v01_ei,
},
{
.data_type = QMI_OPT_FLAG,
.elem_len = 1,
.elem_size = sizeof(u8),
.array_type = NO_ARRAY,
.tlv_type = 0x10,
.offset = offsetof(struct servreg_register_listener_resp,
curr_state_valid),
},
{
.data_type = QMI_SIGNED_4_BYTE_ENUM,
.elem_len = 1,
.elem_size = sizeof(enum servreg_service_state),
.array_type = NO_ARRAY,
.tlv_type = 0x10,
.offset = offsetof(struct servreg_register_listener_resp,
curr_state),
},
{}
};
EXPORT_SYMBOL_GPL(servreg_register_listener_resp_ei);
const struct qmi_elem_info servreg_restart_pd_req_ei[] = {
{
.data_type = QMI_STRING,
.elem_len = SERVREG_NAME_LENGTH + 1,
.elem_size = sizeof(char),
.array_type = NO_ARRAY,
.tlv_type = 0x01,
.offset = offsetof(struct servreg_restart_pd_req,
service_path),
},
{}
};
EXPORT_SYMBOL_GPL(servreg_restart_pd_req_ei);
const struct qmi_elem_info servreg_restart_pd_resp_ei[] = {
{
.data_type = QMI_STRUCT,
.elem_len = 1,
.elem_size = sizeof(struct qmi_response_type_v01),
.array_type = NO_ARRAY,
.tlv_type = 0x02,
.offset = offsetof(struct servreg_restart_pd_resp,
resp),
.ei_array = qmi_response_type_v01_ei,
},
{}
};
EXPORT_SYMBOL_GPL(servreg_restart_pd_resp_ei);
const struct qmi_elem_info servreg_state_updated_ind_ei[] = {
{
.data_type = QMI_SIGNED_4_BYTE_ENUM,
.elem_len = 1,
.elem_size = sizeof(u32),
.array_type = NO_ARRAY,
.tlv_type = 0x01,
.offset = offsetof(struct servreg_state_updated_ind,
curr_state),
},
{
.data_type = QMI_STRING,
.elem_len = SERVREG_NAME_LENGTH + 1,
.elem_size = sizeof(char),
.array_type = NO_ARRAY,
.tlv_type = 0x02,
.offset = offsetof(struct servreg_state_updated_ind,
service_path),
},
{
.data_type = QMI_UNSIGNED_2_BYTE,
.elem_len = 1,
.elem_size = sizeof(u16),
.array_type = NO_ARRAY,
.tlv_type = 0x03,
.offset = offsetof(struct servreg_state_updated_ind,
transaction_id),
},
{}
};
EXPORT_SYMBOL_GPL(servreg_state_updated_ind_ei);
const struct qmi_elem_info servreg_set_ack_req_ei[] = {
{
.data_type = QMI_STRING,
.elem_len = SERVREG_NAME_LENGTH + 1,
.elem_size = sizeof(char),
.array_type = NO_ARRAY,
.tlv_type = 0x01,
.offset = offsetof(struct servreg_set_ack_req,
service_path),
},
{
.data_type = QMI_UNSIGNED_2_BYTE,
.elem_len = 1,
.elem_size = sizeof(u16),
.array_type = NO_ARRAY,
.tlv_type = 0x02,
.offset = offsetof(struct servreg_set_ack_req,
transaction_id),
},
{}
};
EXPORT_SYMBOL_GPL(servreg_set_ack_req_ei);
const struct qmi_elem_info servreg_set_ack_resp_ei[] = {
{
.data_type = QMI_STRUCT,
.elem_len = 1,
.elem_size = sizeof(struct qmi_response_type_v01),
.array_type = NO_ARRAY,
.tlv_type = 0x02,
.offset = offsetof(struct servreg_set_ack_resp,
resp),
.ei_array = qmi_response_type_v01_ei,
},
{}
};
EXPORT_SYMBOL_GPL(servreg_set_ack_resp_ei);
const struct qmi_elem_info servreg_loc_pfr_req_ei[] = {
{
.data_type = QMI_STRING,
.elem_len = SERVREG_NAME_LENGTH + 1,
.elem_size = sizeof(char),
.array_type = VAR_LEN_ARRAY,
.tlv_type = 0x01,
.offset = offsetof(struct servreg_loc_pfr_req, service)
},
{
.data_type = QMI_STRING,
.elem_len = SERVREG_NAME_LENGTH + 1,
.elem_size = sizeof(char),
.array_type = VAR_LEN_ARRAY,
.tlv_type = 0x02,
.offset = offsetof(struct servreg_loc_pfr_req, reason)
},
{}
};
EXPORT_SYMBOL_GPL(servreg_loc_pfr_req_ei);
const struct qmi_elem_info servreg_loc_pfr_resp_ei[] = {
{
.data_type = QMI_STRUCT,
.elem_len = 1,
.elem_size = sizeof_field(struct servreg_loc_pfr_resp, rsp),
.tlv_type = 0x02,
.offset = offsetof(struct servreg_loc_pfr_resp, rsp),
.ei_array = qmi_response_type_v01_ei,
},
{}
};
EXPORT_SYMBOL_GPL(servreg_loc_pfr_resp_ei);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Qualcomm Protection Domain messages data");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment