]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
firmware: qcom: scm: Fix NULL coherent device
authorAndy Gross <agross@codeaurora.org>
Fri, 10 Jul 2015 17:35:29 +0000 (12:35 -0500)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Mon, 14 Aug 2017 10:51:30 +0000 (12:51 +0200)
Signed-off-by: Andy Gross <agross@codeaurora.org>
drivers/firmware/qcom_scm-32.c
drivers/firmware/qcom_scm-64.c
drivers/firmware/qcom_scm.c
drivers/firmware/qcom_scm.h
include/linux/qcom_scm.h

index bbff5fe6d949d87e31071d5356c2cc954291e1b9..4bafb1abd93768b597e36ded008ba77ae3505c23 100644 (file)
@@ -496,7 +496,7 @@ bool __qcom_scm_pas_supported(u32 peripheral)
        return ret ? false : !!ret_val;
 }
 
-int __qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size)
+int __qcom_scm_pas_init_image(struct device *dev, u32 peripheral, const void *metadata, size_t size)
 {
        dma_addr_t mdata_phys;
        void *mdata_buf;
@@ -512,7 +512,7 @@ int __qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size)
         * data blob, so make sure it's physically contiguous, 4K aligned and
         * non-cachable to avoid XPU violations.
         */
-       mdata_buf = dma_alloc_coherent(NULL, size, &mdata_phys, GFP_KERNEL);
+       mdata_buf = dma_alloc_coherent(dev, size, &mdata_phys, GFP_KERNEL);
        if (!mdata_buf) {
                pr_err("Allocation of metadata buffer failed.\n");
                return -ENOMEM;
@@ -526,7 +526,7 @@ int __qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size)
                            &request, sizeof(request),
                            &scm_ret, sizeof(scm_ret));
 
-       dma_free_coherent(NULL, size, mdata_buf, mdata_phys);
+       dma_free_coherent(dev, size, mdata_buf, mdata_phys);
 
        return ret ? : scm_ret;
 }
index 751e2ef8ba41c47005d7cc81fb1c0ff6c65f7b8e..934746eca59a8fce91a5d9cb9b3fe77bc3191f20 100644 (file)
@@ -15,6 +15,7 @@
  * 02110-1301, USA.
  */
 
+#include <linux/platform_device.h>
 #include <linux/cpumask.h>
 #include <linux/delay.h>
 #include <linux/mutex.h>
@@ -460,7 +461,7 @@ bool __qcom_scm_pas_supported(u32 peripheral)
        return ret ? false : !!desc.ret[0];
 }
 
-int __qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size)
+int __qcom_scm_pas_init_image(struct device *dev, u32 peripheral, const void *metadata, size_t size)
 {
        int ret;
        struct qcom_scm_desc desc = {0};
@@ -468,12 +469,14 @@ int __qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size)
        dma_addr_t mdata_phys;
        void *mdata_buf;
 
+dev->coherent_dma_mask = DMA_BIT_MASK(sizeof(dma_addr_t) * 8);
+
        /*
         * During the scm call memory protection will be enabled for the meta
         * data blob, so make sure it's physically contiguous, 4K aligned and
         * non-cachable to avoid XPU violations.
         */
-       mdata_buf = dma_alloc_coherent(NULL, size, &mdata_phys, GFP_KERNEL);
+       mdata_buf = dma_alloc_coherent(dev, size, &mdata_phys, GFP_KERNEL);
        if (!mdata_buf) {
                pr_err("Allocation of metadata buffer failed.\n");
                return -ENOMEM;
@@ -488,7 +491,7 @@ int __qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size)
                                &desc);
        scm_ret = desc.ret[0];
 
-       dma_free_coherent(NULL, size, mdata_buf, mdata_phys);
+       dma_free_coherent(dev, size, mdata_buf, mdata_phys);
        return ret ? : scm_ret;
 }
 
index ee7150d93b2981a330589aea6b0eb0a6b79ff583..cbdf5fdd91ebc56dfe747f1062e3773e933eff6e 100644 (file)
@@ -16,6 +16,7 @@
  * 02110-1301, USA.
  */
 
+#include <linux/platform_device.h>
 #include <linux/cpumask.h>
 #include <linux/export.h>
 #include <linux/types.h>
@@ -127,9 +128,9 @@ EXPORT_SYMBOL(qcom_scm_pas_supported);
  *
  * Returns 0 on success.
  */
-int qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size)
+int qcom_scm_pas_init_image(struct device *dev, u32 peripheral, const void *metadata, size_t size)
 {
-       return __qcom_scm_pas_init_image(peripheral, metadata, size);
+       return __qcom_scm_pas_init_image(dev, peripheral, metadata, size);
 }
 EXPORT_SYMBOL(qcom_scm_pas_init_image);
 
index ffdf9e835de61b1e0c215da29893c610afd00734..f7219025156c5c18a2a094d1113127c0753408df 100644 (file)
@@ -43,7 +43,7 @@ extern int __qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt,
 #define QCOM_SCM_PAS_SHUTDOWN_CMD      0x6
 #define QCOM_SCM_PAS_IS_SUPPORTED_CMD  0x7
 extern bool __qcom_scm_pas_supported(u32 peripheral);
-extern int  __qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size);
+extern int  __qcom_scm_pas_init_image(struct device *dev, u32 peripheral, const void *metadata, size_t size);
 extern int  __qcom_scm_pas_mem_setup(u32 peripheral, phys_addr_t addr, phys_addr_t size);
 extern int  __qcom_scm_pas_auth_and_reset(u32 peripheral);
 extern int  __qcom_scm_pas_shutdown(u32 peripheral);
index 1e36898edbda783215113a857c60003d736abd1c..46d9a51bf67492361ae5f80f55cac30ae772c7c2 100644 (file)
@@ -13,6 +13,8 @@
 #ifndef __QCOM_SCM_H
 #define __QCOM_SCM_H
 
+#include <linux/platform_device.h>
+
 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);
 
@@ -30,7 +32,7 @@ extern int qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt,
                u32 *resp);
 
 extern bool qcom_scm_pas_supported(u32 peripheral);
-extern int qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size);
+extern int qcom_scm_pas_init_image(struct device *dev, u32 peripheral, const void *metadata, size_t size);
 extern int qcom_scm_pas_mem_setup(u32 peripheral, phys_addr_t addr, phys_addr_t size);
 extern int qcom_scm_pas_auth_and_reset(u32 peripheral);
 extern int qcom_scm_pas_shutdown(u32 peripheral);