From patchwork Thu Jun 8 15:23:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 103399 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp2494365qgd; Thu, 8 Jun 2017 08:25:00 -0700 (PDT) X-Received: by 10.84.217.87 with SMTP id e23mr3200382plj.143.1496935500691; Thu, 08 Jun 2017 08:25:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496935500; cv=none; d=google.com; s=arc-20160816; b=wPymAo1XYDfWq5vssew0t3Xtfeh9nwvDFTmQgz1afnIChzpxd5pxNbbMSD3HKd3k2t Cx1KibK1y5y5i3EiEiaxbajXwQvYPt8N1RK2/nsCIPb/MOcjLC3Q8QTCzKaIok0fWv10 sUOqLq/sjdIt68mwefXbSeKUHps7qF1RTtyEK8j5UHmxkDwS8FOpcCQ2VhZkO+Zs9oec oYwLFvWzGMQAYteo7QpVzLRhhZIG/8C+3bRUQX08IAKnVfP6829d9F/8Yl6N1vEyx4mu MHantw0GlhF4kpevkJz/AcjBsxwnQdaBErkwmhDfdZVi0jwe3U28HYGhwT+oh9LZzAW5 E7+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=XWz0G0IVcImetlaCNxTa9yjc42o36MrSZ0+e89z7keM=; b=TRDvtsW8siE1zMFgmB5spPjjtOxBs44asVKxDv7ipSkfc1ncmxV4oyTqHx79I0IWVE yVPAGopwzuZQYogwHIh/1Wcg6B37nlITtsaygHwDHIS2k76bCLmW+TKUfPMkullgju2m jND3J6VkQ7H9SH5HZGl+XxhrQr0LyM3FjE/2767uppqx7KR1SV2h4g3dhEc5/QeoOSse wqGxOFB/kjtDtUwE+Q9szAoCe08q7BZ47LQCMwGwHgZG9sJlTD1AEkKE7Z521VOX8STl uMZPUHKRnG2HV+AH03qFJq7YjryNV+4EG0PAPZEeISY4Mf+CE7nodmk+nwTHV9SAc6Z+ cc7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y67si4609342pff.44.2017.06.08.08.25.00; Thu, 08 Jun 2017 08:25:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752021AbdFHPY6 (ORCPT + 10 others); Thu, 8 Jun 2017 11:24:58 -0400 Received: from mail-wm0-f45.google.com ([74.125.82.45]:34833 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751798AbdFHPY4 (ORCPT ); Thu, 8 Jun 2017 11:24:56 -0400 Received: by mail-wm0-f45.google.com with SMTP id x70so79861567wme.0 for ; Thu, 08 Jun 2017 08:24:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=LJLSwWNAf1G4fSwBH9voFiLRxbro0O0VNkp5+prDBpg=; b=hEdsX/zH4+3KkgLvL+lhYM1/7nykkfEkCsM5KIXR6xeJM7JucDiKJeZiWr1XuGjWHL wMA5CfLv1lHtmRCA16eNUnhR3jHaZxFBzt3gib+LHCHwRx4AZ7MN3R8Wu8sKXEHTdmld uJwuhy4AXZGJ29zkIiHlqQHdFi2BY7QvQzRzw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=LJLSwWNAf1G4fSwBH9voFiLRxbro0O0VNkp5+prDBpg=; b=YHIndVhEMt/m6f/WyoPKZJECBCWulD8Bji4GSiUJO10OmqrQLdX40mAwkcXnB+bUY2 P1UwFpHYOunpPyaqAyVb/CUK2WT9eLBWZoEZj0vF8RqQBYeIjahd7Tugqwa3blqmUT7i ymhCWzvtQjrAKaA9l/YKgNr2aaldFAICQxqEiceWbEFULG88LbvUGFmok+wzUh4mSuyN 2rwvRD7XaRl5Cw3jryEiAS4PkK7ytrZxQXv/o/gIx0d+q+HtS5a/y0E6d34qCXUvACi9 uGpx6kg5WHFzXMp3qq/jHLgrGNwz7v2KPRvDZ/cOfJ2FgggIqB43yG9nMy+RWNC8uO6r 41dA== X-Gm-Message-State: AODbwcCgpJnf+lBFWFbZdvxNxU6nKYU/mTBI6JjACcxkxNjIaMlfin/p Ad01sbQ3KWyLElmM X-Received: by 10.28.65.85 with SMTP id o82mr3912289wma.79.1496935495272; Thu, 08 Jun 2017 08:24:55 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id z32sm8118980wrc.12.2017.06.08.08.24.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Jun 2017 08:24:54 -0700 (PDT) From: Stanimir Varbanov To: Andy Gross Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Stanimir Varbanov , Stephen Boyd , Bjorn Andersson Subject: [PATCH v2] firmware: qcom_scm: Fix to allow COMPILE_TEST-ing Date: Thu, 8 Jun 2017 18:23:38 +0300 Message-Id: <1496935418-14142-1-git-send-email-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Unfortunatly previous attempt to allow consumer drivers to use COMPILE_TEST option in Kconfig is not enough, because in the past the consumer drivers used 'depends on' Kconfig option but now they are using 'select' Kconfig option which means on non ARM arch'es compilation is triggered. Thus we need to move the ifdefery one level below by touching the private qcom_scm.h header. Cc: Stephen Boyd Cc: Bjorn Andersson Signed-off-by: Stanimir Varbanov --- This is second version of the patch with comments addressed: * proper identation for static inline functions * to avoid duplicating defines group them on top of the header The first version has been part of the venus driver patchset v8 and can be found at: https://patchwork.kernel.org/patch/9704275/ drivers/firmware/Kconfig | 2 +- drivers/firmware/qcom_scm.h | 122 ++++++++++++++++++++++++++++++++++++-------- include/linux/qcom_scm.h | 32 ------------ 3 files changed, 101 insertions(+), 55 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index 6e4ed5a9c6fd..480578c3691a 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig @@ -204,7 +204,7 @@ config FW_CFG_SYSFS_CMDLINE config QCOM_SCM bool - depends on ARM || ARM64 + depends on ARM || ARM64 || COMPILE_TEST select RESET_CONTROLLER config QCOM_SCM_32 diff --git a/drivers/firmware/qcom_scm.h b/drivers/firmware/qcom_scm.h index 9bea691f30fb..60689fc8a567 100644 --- a/drivers/firmware/qcom_scm.h +++ b/drivers/firmware/qcom_scm.h @@ -16,31 +16,20 @@ #define QCOM_SCM_BOOT_ADDR 0x1 #define QCOM_SCM_BOOT_ADDR_MC 0x11 #define QCOM_SCM_SET_REMOTE_STATE 0xa -extern int __qcom_scm_set_remote_state(struct device *dev, u32 state, u32 id); #define QCOM_SCM_FLAG_HLOS 0x01 #define QCOM_SCM_FLAG_COLDBOOT_MC 0x02 #define QCOM_SCM_FLAG_WARMBOOT_MC 0x04 -extern int __qcom_scm_set_warm_boot_addr(struct device *dev, void *entry, - const cpumask_t *cpus); -extern int __qcom_scm_set_cold_boot_addr(void *entry, const cpumask_t *cpus); #define QCOM_SCM_CMD_TERMINATE_PC 0x2 #define QCOM_SCM_FLUSH_FLAG_MASK 0x3 #define QCOM_SCM_CMD_CORE_HOTPLUGGED 0x10 -extern void __qcom_scm_cpu_power_down(u32 flags); #define QCOM_SCM_SVC_INFO 0x6 #define QCOM_IS_CALL_AVAIL_CMD 0x1 -extern int __qcom_scm_is_call_available(struct device *dev, u32 svc_id, - u32 cmd_id); #define QCOM_SCM_SVC_HDCP 0x11 #define QCOM_SCM_CMD_HDCP 0x01 -extern int __qcom_scm_hdcp_req(struct device *dev, - struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp); - -extern void __qcom_scm_init(void); #define QCOM_SCM_SVC_PIL 0x2 #define QCOM_SCM_PAS_INIT_IMAGE_CMD 0x1 @@ -49,6 +38,27 @@ extern void __qcom_scm_init(void); #define QCOM_SCM_PAS_SHUTDOWN_CMD 0x6 #define QCOM_SCM_PAS_IS_SUPPORTED_CMD 0x7 #define QCOM_SCM_PAS_MSS_RESET 0xa + +#define QCOM_SCM_SVC_MP 0xc +#define QCOM_SCM_RESTORE_SEC_CFG 2 + +#define QCOM_SCM_IOMMU_SECURE_PTBL_SIZE 3 +#define QCOM_SCM_IOMMU_SECURE_PTBL_INIT 4 + +#define QCOM_SCM_SVC_HDCP 0x11 +#define QCOM_SCM_CMD_HDCP 0x01 + +#if IS_ENABLED(CONFIG_ARM) || IS_ENABLED(CONFIG_ARM64) +extern int __qcom_scm_set_remote_state(struct device *dev, u32 state, u32 id); +extern int __qcom_scm_set_warm_boot_addr(struct device *dev, void *entry, + const cpumask_t *cpus); +extern int __qcom_scm_set_cold_boot_addr(void *entry, const cpumask_t *cpus); +extern void __qcom_scm_cpu_power_down(u32 flags); +extern int __qcom_scm_is_call_available(struct device *dev, u32 svc_id, + u32 cmd_id); +extern int __qcom_scm_hdcp_req(struct device *dev, + struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp); +extern void __qcom_scm_init(void); extern bool __qcom_scm_pas_supported(struct device *dev, u32 peripheral); extern int __qcom_scm_pas_init_image(struct device *dev, u32 peripheral, dma_addr_t metadata_phys); @@ -57,6 +67,85 @@ extern int __qcom_scm_pas_mem_setup(struct device *dev, u32 peripheral, extern int __qcom_scm_pas_auth_and_reset(struct device *dev, u32 peripheral); extern int __qcom_scm_pas_shutdown(struct device *dev, u32 peripheral); extern int __qcom_scm_pas_mss_reset(struct device *dev, bool reset); +extern int __qcom_scm_restore_sec_cfg(struct device *dev, u32 device_id, + u32 spare); +extern int __qcom_scm_iommu_secure_ptbl_size(struct device *dev, u32 spare, + size_t *size); +extern int __qcom_scm_iommu_secure_ptbl_init(struct device *dev, u64 addr, + u32 size, u32 spare); +#else /* !ARM and !ARM64 */ +static inline int __qcom_scm_set_remote_state(struct device *dev, u32 state, + u32 id) +{ + return -ENODEV; +} +static inline int __qcom_scm_set_warm_boot_addr(struct device *dev, void *entry, + const cpumask_t *cpus) +{ + return -ENODEV; +} +static inline int __qcom_scm_set_cold_boot_addr(void *entry, + const cpumask_t *cpus) +{ + return -ENODEV; +} +static inline void __qcom_scm_cpu_power_down(u32 flags) {} +static inline int __qcom_scm_is_call_available(struct device *dev, u32 svc_id, + u32 cmd_id) +{ + return -ENODEV; +} +static inline int __qcom_scm_hdcp_req(struct device *dev, + struct qcom_scm_hdcp_req *req, + u32 req_cnt, u32 *resp) +{ + return -ENODEV; +} +static inline void __qcom_scm_init(void) {} +static inline bool __qcom_scm_pas_supported(struct device *dev, u32 peripheral) +{ + return false; +} +static inline int __qcom_scm_pas_init_image(struct device *dev, u32 peripheral, + dma_addr_t metadata_phys) +{ + return -ENODEV; +} +static inline int __qcom_scm_pas_mem_setup(struct device *dev, u32 peripheral, + phys_addr_t addr, phys_addr_t size) +{ + return -ENODEV; +} +static inline int __qcom_scm_pas_auth_and_reset(struct device *dev, + u32 peripheral) +{ + return -ENODEV; +} +static inline int __qcom_scm_pas_shutdown(struct device *dev, u32 peripheral) +{ + return -ENODEV; +} +static inline int __qcom_scm_pas_mss_reset(struct device *dev, bool reset) +{ + return -ENODEV; +} +static inline int __qcom_scm_restore_sec_cfg(struct device *dev, u32 device_id, + u32 spare) +{ + return -ENODEV; +} +static inline int __qcom_scm_iommu_secure_ptbl_size(struct device *dev, + u32 spare, size_t *size) +{ + return -ENODEV; +} +static inline int __qcom_scm_iommu_secure_ptbl_init(struct device *dev, + u64 addr, u32 size, + u32 spare) +{ + return -ENODEV; +} +#endif /* common error codes */ #define QCOM_SCM_V2_EBUSY -12 @@ -85,15 +174,4 @@ static inline int qcom_scm_remap_error(int err) return -EINVAL; } -#define QCOM_SCM_SVC_MP 0xc -#define QCOM_SCM_RESTORE_SEC_CFG 2 -extern int __qcom_scm_restore_sec_cfg(struct device *dev, u32 device_id, - u32 spare); -#define QCOM_SCM_IOMMU_SECURE_PTBL_SIZE 3 -#define QCOM_SCM_IOMMU_SECURE_PTBL_INIT 4 -extern int __qcom_scm_iommu_secure_ptbl_size(struct device *dev, u32 spare, - size_t *size); -extern int __qcom_scm_iommu_secure_ptbl_init(struct device *dev, u64 addr, - u32 size, u32 spare); - #endif diff --git a/include/linux/qcom_scm.h b/include/linux/qcom_scm.h index e5380471c2cd..b628f735f355 100644 --- a/include/linux/qcom_scm.h +++ b/include/linux/qcom_scm.h @@ -23,7 +23,6 @@ struct qcom_scm_hdcp_req { u32 val; }; -#if IS_ENABLED(CONFIG_QCOM_SCM) extern int qcom_scm_set_cold_boot_addr(void *entry, const cpumask_t *cpus); extern int qcom_scm_set_warm_boot_addr(void *entry, const cpumask_t *cpus); extern bool qcom_scm_is_available(void); @@ -43,35 +42,4 @@ extern int qcom_scm_set_remote_state(u32 state, u32 id); extern int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare); extern int qcom_scm_iommu_secure_ptbl_size(u32 spare, size_t *size); extern int qcom_scm_iommu_secure_ptbl_init(u64 addr, u32 size, u32 spare); -#else -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 bool qcom_scm_is_available(void) { return false; } -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 bool qcom_scm_pas_supported(u32 peripheral) { return false; } -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 void qcom_scm_cpu_power_down(u32 flags) {} -static inline u32 qcom_scm_get_version(void) { return 0; } -static inline u32 -qcom_scm_set_remote_state(u32 state,u32 id) { return -ENODEV; } -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; } -#endif #endif