From patchwork Tue Jun 27 15:02:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 106443 Delivered-To: patch@linaro.org Received: by 10.182.135.102 with SMTP id pr6csp2504693obb; Tue, 27 Jun 2017 08:06:31 -0700 (PDT) X-Received: by 10.99.120.193 with SMTP id t184mr5695152pgc.35.1498575991409; Tue, 27 Jun 2017 08:06:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498575991; cv=none; d=google.com; s=arc-20160816; b=AFDZOWBFvKuMmfPe0WJWQMtOdbfP54Yf5l9NcxiAb2umdCN1PUlxmKKN9jEQfOlY/5 PROoVBeSluQyeqOP46XUBfpbLLtbR4JhkBZIs/qUOxMT5+AD6cccKIqIbTmF87OSsyUr orA92jvQ0ynfQ+tTZtYj2+YCy1ojosJKUOrK7lB6lZCsECNVychbqbaVc3UnuJRQccUP 0b+X1+ACPvHbRBQiRjvc54DbVXXZZuUJ4NfSMG00eqQRF8VBTKtC4BQeVAsq7Q4+pZhj n0g3IBXVzI3/XJW/QY5zUqX0M73SHlCgX2SEZf4x2JEYZ4445p5QhWEh8dqbBCz4KpJR O3oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=tlCi+0kaEqezpxgXAZuMrxBJe4AyFswWCmf7utUnyzI=; b=RqmDtnkNmcS2lwDrWw/yg3WMEWDYPwPLJaQsm/wi7GVjiQ6fp6roX2xi/L65o6oLAj yb3J1chA8/NLh+lwkkx5uqamDQ3GS59p9WnpKNBdhFpPtV0tbvSXo8ZcmHHhJ8LQDxKt De7TrYf6Unsq4L7XtFSAdhA2Dvy+jz+TU5m1sKtfxTCfbvzYxOHak3hXaRNeujejdZe/ +6Z+yyZti5xlYzWni5YKlL4qhhq1tpIAqSbJLdXjeLHQ7bwWv8ibzWQK5G79/UNfWE7K tbHE7vRmGcN9ee3vQXHk3vJjXN0k69smejSgivJKcqbUUuKX9bFVX53hXTDQZZ6Hlw1U o7Ug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 7si2302499plb.66.2017.06.27.08.06.31; Tue, 27 Jun 2017 08:06:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753245AbdF0PGT (ORCPT + 25 others); Tue, 27 Jun 2017 11:06:19 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:64543 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753262AbdF0PDh (ORCPT ); Tue, 27 Jun 2017 11:03:37 -0400 Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue003 [212.227.15.129]) with ESMTPA (Nemesis) id 0LyyIe-1dlsyI1VEO-014Er0; Tue, 27 Jun 2017 17:03:22 +0200 From: Arnd Bergmann To: Stanimir Varbanov , Mauro Carvalho Chehab Cc: Arnd Bergmann , Hans Verkuil , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] [media] venus: don't abuse dma_alloc for non-DMA allocations Date: Tue, 27 Jun 2017 17:02:47 +0200 Message-Id: <20170627150310.719212-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170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mRCtUpwjZ8oug4= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In venus_boot(), we pass a pointer to a phys_addr_t into dmam_alloc_coherent, which the compiler warns about: platform/qcom/venus/firmware.c: In function 'venus_boot': platform/qcom/venus/firmware.c:63:49: error: passing argument 3 of 'dmam_alloc_coherent' from incompatible pointer type [-Werror=incompatible-pointer-types] The returned DMA address is later passed on to a function that takes a phys_addr_t, so it's clearly wrong to use the DMA mapping interface here: the memory may be uncached, or the address may be completely wrong if there is an IOMMU connected to the device. My interpretation is that using dmam_alloc_coherent() had two purposes: a) get a chunk of consecutive memory that may be larger than the limit for kmalloc() b) use the devres infrastructure to simplify the unwinding in the error case. I think ideally we'd use a devres-based version of alloc_pages_exact() here, but since that doesn't exist, let's use devm_get_free_pages() instead. This wastes a little memory as the size gets rounded up to a power of two, but is otherwise harmless. If we want to save memory here, calling devm_free_pages() to release the memory once it is no longer needed is probably better anyway. Fixes: af2c3834c8ca ("[media] media: venus: adding core part and helper functions") Signed-off-by: Arnd Bergmann --- The same problem exists in the drm driver, as of commit 7c65817e6d38 ("drm/msm: gpu: Enable zap shader for A5XX"), and I submitted the same patch for that already. --- drivers/media/platform/qcom/venus/firmware.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.9.0 diff --git a/drivers/media/platform/qcom/venus/firmware.c b/drivers/media/platform/qcom/venus/firmware.c index 1b1a4f355918..76edb9f60311 100644 --- a/drivers/media/platform/qcom/venus/firmware.c +++ b/drivers/media/platform/qcom/venus/firmware.c @@ -60,11 +60,13 @@ int venus_boot(struct device *parent, struct device *fw_dev, const char *fwname) mem_size = VENUS_FW_MEM_SIZE; - mem_va = dmam_alloc_coherent(fw_dev, mem_size, &mem_phys, GFP_KERNEL); + mem_va = (void *)devm_get_free_pages(parent, GFP_KERNEL, + get_order(mem_size)); if (!mem_va) { ret = -ENOMEM; goto err_unreg_device; } + mem_phys = virt_to_phys(mem_va); ret = request_firmware(&mdt, fwname, fw_dev); if (ret < 0) From patchwork Tue Jun 27 15:02:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 106441 Delivered-To: patch@linaro.org Received: by 10.182.135.102 with SMTP id pr6csp2503824obb; Tue, 27 Jun 2017 08:05:45 -0700 (PDT) X-Received: by 10.84.224.141 with SMTP id s13mr6305366plj.217.1498575945419; Tue, 27 Jun 2017 08:05:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498575945; cv=none; d=google.com; s=arc-20160816; b=v90SQt5SwLzLmQ+/FvZ7j+sHrK6q8+e+J6GPERazPTd5XHiz2tiZsxfH41qJBpwj9b a/LBKdQG0WNruGV59amJ9y01jT2N5+Gqpo+TVZB/Nz2ZyhOETSahfkTlsxALw4Ib2Ftt g0rNKX4jrBS5dwdp2OYCUAxw69kCKkV+SvXB4yxUdgJG8qKOub2Xb9HLHY/bBwtvJeKm 8Bb0O3J+djMyF7kiEDmd3ASCRq7zB9ofDhiLa9/K7kPvvi1Qh1hz4djF4UtT1xZyQYp+ cCUr55MlQGRlKxj8Zn8bw17v5VB9U2swcRahb0F4XkVG4OKggkVufXdkQEJqteImbZXS QZSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=t5z1X/G3Yc4/HkHAYfblWCRWw0DopkoVx3LGPiDCa0Q=; b=QwcrbZxq62LBFLPVyEwcPu4yFEsRICE1rA+ttRkABRhuSClc4p4ulP0BBU+z80qUtV OGvrdwBQnD9hKILU8MmvXHlLFhc+6I+mzXDIsd6S6z+ZIdiugQzH83Ov1q5elsEo80HT kv0Ji3LCSU3MYZ/2BQgrQMwzrS+Cdxl0V0h5oEqsYhPqlBdZu/Ymk3wRwcN3BTJkyofB cjPy4e1G+z4+YMXBvY/iL1vKAqxEX7rL6M32BGZGR7dU1UEkWKQiU8faE6/jezBgRSC+ 2bbGjqa8oaulVPUTK39GpXh5h2v7qCRCA4Sna7C8FA7jdRDf0VpjNUL3pEXMvEPmM29n gThA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h188si2071581pgc.65.2017.06.27.08.05.45; Tue, 27 Jun 2017 08:05:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753105AbdF0PFd (ORCPT + 25 others); Tue, 27 Jun 2017 11:05:33 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:60142 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752871AbdF0PE0 (ORCPT ); Tue, 27 Jun 2017 11:04:26 -0400 Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue003 [212.227.15.129]) with ESMTPA (Nemesis) id 0LhRPo-1e3YMV0WoK-00mZRe; Tue, 27 Jun 2017 17:04:19 +0200 From: Arnd Bergmann To: Mauro Carvalho Chehab Cc: Arnd Bergmann , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] [media] venus: fix compile-test build on non-qcom ARM platform Date: Tue, 27 Jun 2017 17:02:48 +0200 Message-Id: <20170627150310.719212-3-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170627150310.719212-1-arnd@arndb.de> References: <20170627150310.719212-1-arnd@arndb.de> X-Provags-ID: V03:K0:V+C4IGl64tDf1pFH8zmsxB2dJ9u6kRR6HsPnoECwys3SljxU+Y5 cScFAb4N2RvwJhuy+w4Kjbss5O57EHZfWgJM4qu2Dr1NozTUKuGyLrdFQTTMLmmu3lH2cxL U79OcY0xF1q1+ngOMVjiUWXIyHBR7RKMspcpaEmcZeeYzV1wFsnTQcmAVYkC1JcfxBcqoNa A7KJKVbFzxZ+RHGa7Bovw== X-UI-Out-Filterresults: notjunk:1; V01:K0:bMTv7Cb9KUo=:CvXKXFrPIWvL/Va+QU9UZT ANBJA8wzoPSrBrqJ+QrNdsTw1w9WaXdkFS0m/3ExAEj/IybuKfp1THbgg5Nw7ozxq5z9zhQVZ rxIRVYIv4zBWI50yVsFFjobGOzXyaxLUon4txpcC2rthBvjEBaOoE27YTuQgQgtEFRuwcNQVN UU+iINOsJ+5dNpyfBMdlR77UBooqU3CS4jORa+o8zSg5S1jWyfFOmpMRlu+ydNGCYWZPgS54B EJ7kVuiKD0PlCELNkhd1dZNQkmgIGKDWrjpy5XMuIS609ilulaNYMXanijCyVV+9Mu5weCUKH PRp5Z8aq+PWq1ImZ16dbUbsVw07DDw9VtxZpgdXuuaCl69cwbQYXEld8ULVlbfw9kpRZyqCT9 y3m13IerHJ2Pao9t6DSBeBMuit/aOR9SwBWZ02wW8hjc0rVxnTaQwlgL8QVmTubhBgr23n0kr BHNV6QmL4j3CQ2B07ABpUWEBg1Z+la/AEjoGT3lPWeRwhZ7isSnzZsBHFN7HDbl+xWqciUlgH ymA0u7PNGRAtlXLql2wIRPwnLmFHU7bKfaHBkchcxm5N9i23xMpgW7RKOXIpJ0Om32+OcF5SB Q97Mnp/py/ZTdD5AGON3KbCU8ClGTgLbhvjySrTkv1NVOcm3B63MdFiWRIZwPTom0/9Xj1pOG 3bdeVBzLEcoz65nHAd5/dYcIrqK73euMKS0ux1x1diPUOg1z9E2vOonbq9ik+706v1/w= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If QCOM_MDT_LOADER is enabled, but ARCH_QCOM is not, we run into a build error: ERROR: "qcom_mdt_load" [drivers/media/platform/qcom/venus/venus-core.ko] undefined! ERROR: "qcom_mdt_get_size" [drivers/media/platform/qcom/venus/venus-core.ko] undefined! This changes the 'select' statement again, so we only try to enable those symbols when the drivers will actually get built. Fixes: 76724b30f222 ("[media] media: venus: enable building with COMPILE_TEST") Signed-off-by: Arnd Bergmann --- drivers/media/platform/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.9.0 diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index cb2f31cd0088..635c53e61f8a 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -475,8 +475,8 @@ config VIDEO_QCOM_VENUS tristate "Qualcomm Venus V4L2 encoder/decoder driver" depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA depends on (ARCH_QCOM && IOMMU_DMA) || COMPILE_TEST - select QCOM_MDT_LOADER if (ARM || ARM64) - select QCOM_SCM if (ARM || ARM64) + select QCOM_MDT_LOADER if ARCH_QCOM + select QCOM_SCM if ARCH_QCOM select VIDEOBUF2_DMA_SG select V4L2_MEM2MEM_DEV ---help---