From patchwork Fri Apr 28 09:13:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 9704275 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D2D6B602BF for ; Fri, 28 Apr 2017 09:20:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C345A28304 for ; Fri, 28 Apr 2017 09:20:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B824F28653; Fri, 28 Apr 2017 09:20:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14E4E28304 for ; Fri, 28 Apr 2017 09:20:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423630AbdD1JPy (ORCPT ); Fri, 28 Apr 2017 05:15:54 -0400 Received: from mail-wm0-f43.google.com ([74.125.82.43]:34844 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S969337AbdD1JOw (ORCPT ); Fri, 28 Apr 2017 05:14:52 -0400 Received: by mail-wm0-f43.google.com with SMTP id w64so36907677wma.0 for ; Fri, 28 Apr 2017 02:14:40 -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:in-reply-to:references; bh=4jU5DmfrXnlwleOmYlVCETyguavsKjwJKkvW9UA3204=; b=cyaNMaPyIYjWhNYlBJp8rHFTSQUT8svXM6zMVtP0Gv9Yt6Ho91LKt5vizwyxfFFava b5gHwz1/+5fZNL6FlwpJL1rfn3SH5AsiPJiMHUFNFxLQ6pSCulbeF1M5AvnpgqUa5lbx XKHA86eMDWAlXMQvyHC0JkvIKkvj//1ERTQGg= 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:in-reply-to :references; bh=4jU5DmfrXnlwleOmYlVCETyguavsKjwJKkvW9UA3204=; b=FpUAWCJUxiIkYbAXIi8BjD07iSEcBNUAPUXaqj9cg7FhPCIMGq3O/0MCBTibgvHJH/ Nt8jSIYALPhBBIPUb9mqgF+3igLHOSmE/AF6oc85YqtIE4QCTyCaWCLeNhN5py3K/sCT ny+4NYXIW/v7YVOPpwn/rwTRmk9XY/F2svxLRRfaFgUyg/u6BLtLOyb+vHCzKfTNcIz2 7gtyajZGpe6qoLxoNBLCz1yW5c7PLxSTSwgJ3QGqYcoAtSymKERHBwNBOuFDFbo4I2Ca WTuVghE/sIcNCJnGNmgWn9FYn9miRq1eLTaKLfKT1Fz9w6KKtXdaOfipZdjrq8Ug/jeR 1sZA== X-Gm-Message-State: AN3rC/7P+Dt8WIG4qXjuTYs0/6sotQ48XMwxIRb193iYmArKjW2b0xHx sJVfE/VGufjy8dir X-Received: by 10.28.113.135 with SMTP id d7mr5157880wmi.71.1493370874653; Fri, 28 Apr 2017 02:14:34 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id p197sm5653070wmb.34.2017.04.28.02.14.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 28 Apr 2017 02:14:34 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: Andy Gross , Bjorn Andersson , Stephen Boyd , Srinivas Kandagatla , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Stanimir Varbanov Subject: [PATCH v8 01/10] firmware: qcom_scm: Fix to allow COMPILE_TEST-ing Date: Fri, 28 Apr 2017 12:13:48 +0300 Message-Id: <1493370837-19793-2-git-send-email-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493370837-19793-1-git-send-email-stanimir.varbanov@linaro.org> References: <1493370837-19793-1-git-send-email-stanimir.varbanov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. To: Andy Gross Cc: Stephen Boyd Cc: Bjorn Andersson Signed-off-by: Stanimir Varbanov --- drivers/firmware/Kconfig | 2 +- drivers/firmware/qcom_scm.h | 72 ++++++++++++++++++++++++++++++++++++++------- include/linux/qcom_scm.h | 32 -------------------- 3 files changed, 62 insertions(+), 44 deletions(-) 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..d2b5723afb3f 100644 --- a/drivers/firmware/qcom_scm.h +++ b/drivers/firmware/qcom_scm.h @@ -12,6 +12,7 @@ #ifndef __QCOM_SCM_INT_H #define __QCOM_SCM_INT_H +#if IS_ENABLED(CONFIG_ARM) || IS_ENABLED(CONFIG_ARM64) #define QCOM_SCM_SVC_BOOT 0x1 #define QCOM_SCM_BOOT_ADDR 0x1 #define QCOM_SCM_BOOT_ADDR_MC 0x11 @@ -58,6 +59,66 @@ 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); +#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); +#else +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; } +#define QCOM_SCM_SVC_HDCP 0x11 +#define QCOM_SCM_CMD_HDCP 0x01 +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) {} +#define QCOM_SCM_SVC_PIL 0x2 +#define QCOM_SCM_PAS_IS_SUPPORTED_CMD 0x7 +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; } +extern 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 #define QCOM_SCM_ENOMEM -5 @@ -85,15 +146,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