0258ae34e14048a138768f750e40125d520dbf5b
[openwrt/staging/rmilecki.git] /
1 From 79dd0145cb8220a5be0007350a7501056378e720 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Wed, 2 Mar 2022 17:23:16 +0000
4 Subject: [PATCH] staging/vc-sm-cma: Avoid log spamming on Pi0/1 over
5 cache alias.
6
7 Pi 0/1 use the 0x80000000 cache alias as the ARM also sees the world
8 through the VPU L2 cache.
9 vc-sm-cma was trying to ensure it was in an uncached alias (0xc), and
10 complaining on every allocation if it weren't. Reduce this logging.
11
12 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
13 ---
14 drivers/staging/vc04_services/vc-sm-cma/vc_sm.c | 7 ++++++-
15 1 file changed, 6 insertions(+), 1 deletion(-)
16
17 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c
18 +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c
19 @@ -720,6 +720,7 @@ vc_sm_cma_import_dmabuf_internal(struct
20 struct dma_buf_attachment *attach = NULL;
21 struct sg_table *sgt = NULL;
22 dma_addr_t dma_addr;
23 + u32 cache_alias;
24 int ret = 0;
25 int status;
26
27 @@ -762,9 +763,13 @@ vc_sm_cma_import_dmabuf_internal(struct
28 import.type = VC_SM_ALLOC_NON_CACHED;
29 dma_addr = sg_dma_address(sgt->sgl);
30 import.addr = (u32)dma_addr;
31 - if ((import.addr & 0xC0000000) != 0xC0000000) {
32 + cache_alias = import.addr & 0xC0000000;
33 + if (cache_alias != 0xC0000000 && cache_alias != 0x80000000) {
34 pr_err("%s: Expecting an uncached alias for dma_addr %pad\n",
35 __func__, &dma_addr);
36 + /* Note that this assumes we're on >= Pi2, but it implies a
37 + * DT configuration error.
38 + */
39 import.addr |= 0xC0000000;
40 }
41 import.size = sg_dma_len(sgt->sgl);