Message ID | 20230710100931.255234-1-suijingfeng@loongson.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4928116vqx; Mon, 10 Jul 2023 03:40:08 -0700 (PDT) X-Google-Smtp-Source: APBJJlEhXOiQGOszSeVaY4fgLGEAH0k+0DyWAB1PGMCdECKNXQQwuplpooXgy8v5TZnyR3fZo05e X-Received: by 2002:a05:6a20:7d84:b0:11f:54fe:82d9 with SMTP id v4-20020a056a207d8400b0011f54fe82d9mr12329728pzj.28.1688985608211; Mon, 10 Jul 2023 03:40:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688985608; cv=none; d=google.com; s=arc-20160816; b=RiCKgGxUq9XjKPGiZA4TSm6n4sEKYRQ0fUM8L8Go7opDjOoPKOomV3NyQV1IrPo+XF Nxe4FVUQUmTq99Twjjvsklp2IKJOeTe+xWDDqwuthP1dznEVTB+F2zmHcNh8ShEyvuIU t2GaaaMzqkT518w45i9bb8StsLWxHK6/NY7d3VncGGYcLB/O0VivrOX0yz0j/a7CA6vl 56KFWr2ZOQhSSZAd0eovdH/QQ6tHlR6/taNVaKpR6S8lK8qHQhBbDhdVd2jDIq1dLaK8 h6jx2uWjQKqoSFnHIUcs/836M1Zq5OwWnEXzYDdNUUdIBUC2W2yw2ExcMwyKWZyDfrp8 hP4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=sSAQNHr0Tuu5w+wBkg85Px+nRZe1E5e8jRYlgIDrnpw=; fh=/ZqpAP8bC36i4IInRe3vCSZ24/TVToXdss7fr6cDdV8=; b=SqZlEolnFKudcIaNCrXknKkxC8TSEKLTs693qTIXxTv6WaRLkuAIPCmdALs+Hc/YKc 3HNqmWNm0+R1IjvJJO2TGgHsfen5MaO4ym+FjkI5+tQIf8voaCl0hJGvAm8ECnXRewhh XhFuYTQ3QxQIvM5A2s4IhFmmkGjx5jTkKTsFiWQNil2VRtkmajS22ZDPYuWYJmiUDksM d50vP9Dd43Lkvz2kgF5cFPBpZ0H9HMGUJLD2q8oMZ374W/zU2kObDucRRrf6g357ffcQ xTJHgQebf5eeh1v3wXwKgJL58pT0QYUBTyGgupPQySkFr4kHHc6zF0TqiQ+b/pIuK6KL 3gUA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q17-20020a170902789100b001b5afcfa180si2756401pll.213.2023.07.10.03.39.55; Mon, 10 Jul 2023 03:40:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233291AbjGJKMM (ORCPT <rfc822;ybw1215001957@gmail.com> + 99 others); Mon, 10 Jul 2023 06:12:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232851AbjGJKLy (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 10 Jul 2023 06:11:54 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9B9252724 for <linux-kernel@vger.kernel.org>; Mon, 10 Jul 2023 03:09:39 -0700 (PDT) Received: from loongson.cn (unknown [10.20.42.43]) by gateway (Coremail) with SMTP id _____8AxV_Hh2KtkwBcDAA--.9201S3; Mon, 10 Jul 2023 18:09:37 +0800 (CST) Received: from openarena.loongson.cn (unknown [10.20.42.43]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Cx_c7g2KtknCInAA--.45834S2; Mon, 10 Jul 2023 18:09:36 +0800 (CST) From: Sui Jingfeng <suijingfeng@loongson.cn> To: Sui Jingfeng <suijingfeng@loongson.cn>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Thomas Zimmermann <tzimmermann@suse.de>, Li Yi <liyi@loongson.cn> Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn, kernel test robot <lkp@intel.com> Subject: [PATCH] drm/loongson: Fix two warnings because of passing wrong type Date: Mon, 10 Jul 2023 18:09:31 +0800 Message-Id: <20230710100931.255234-1-suijingfeng@loongson.cn> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8Cx_c7g2KtknCInAA--.45834S2 X-CM-SenderInfo: xvxlyxpqjiv03j6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBj93XoW7tw4fur45Gw15KFWUXFykXrc_yoW8Ar1kpF 47Ca48trZ8Jr12yr4kG3WUZ34Fv3ZaqFZa9FZ7C3Z09w1DAF1UZF1kuFW5Kry7Zay2vrWa yr93G3yag3WqqwcCm3ZEXasCq-sJn29KB7ZKAUJUUUU7529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUU9Fb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2kKe7AKxVWUXVWUAwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07 AIYIkI8VC2zVCFFI0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWU AVWUtwAv7VC2z280aVAFwI0_Gr0_Cr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7V AKI48JMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMxCIbckI1I0E14v2 6r1Y6r17MI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17 CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF 0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIx AIcVC2z280aVAFwI0_Gr0_Cr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2 KfnxnUUI43ZEXa7IU8uuWJUUUUU== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771029772982904309 X-GMAIL-MSGID: 1771029772982904309 |
Series |
drm/loongson: Fix two warnings because of passing wrong type
|
|
Commit Message
Sui Jingfeng
July 10, 2023, 10:09 a.m. UTC
When accessing I/O memory, we should pass '__iomem *' type instead of
'void *' simply, otherwise sparse tests will complain. After applied
this patch, the following two sparse warnings got fixed.
1) drivers/gpu/drm/loongson/lsdc_benchmark.c:27:35:
sparse: expected void volatile [noderef] __iomem *
sparse: got void *kptr
2) drivers/gpu/drm/loongson/lsdc_benchmark.c:42:51:
sparse: expected void const volatile [noderef] __iomem *
sparse: got void *kptr
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202307100243.v3hv6aes-lkp@intel.com/
Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
---
drivers/gpu/drm/loongson/lsdc_benchmark.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On Mon, 10 Jul 2023, Sui Jingfeng <suijingfeng@loongson.cn> wrote: > When accessing I/O memory, we should pass '__iomem *' type instead of > 'void *' simply, otherwise sparse tests will complain. After applied > this patch, the following two sparse warnings got fixed. Usually the commit message should explain why it's okay to cast away the warning. Because realistically this doesn't "fix" the warning, this merely hides it. BR, Jani. > > 1) drivers/gpu/drm/loongson/lsdc_benchmark.c:27:35: > sparse: expected void volatile [noderef] __iomem * > sparse: got void *kptr > > 2) drivers/gpu/drm/loongson/lsdc_benchmark.c:42:51: > sparse: expected void const volatile [noderef] __iomem * > sparse: got void *kptr > > Reported-by: kernel test robot <lkp@intel.com> > Closes: https://lore.kernel.org/oe-kbuild-all/202307100243.v3hv6aes-lkp@intel.com/ > Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn> > --- > drivers/gpu/drm/loongson/lsdc_benchmark.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/loongson/lsdc_benchmark.c b/drivers/gpu/drm/loongson/lsdc_benchmark.c > index b088646a2ff9..36e352820bdb 100644 > --- a/drivers/gpu/drm/loongson/lsdc_benchmark.c > +++ b/drivers/gpu/drm/loongson/lsdc_benchmark.c > @@ -24,7 +24,7 @@ static void lsdc_copy_gtt_to_vram_cpu(struct lsdc_bo *src_bo, > lsdc_bo_kmap(dst_bo); > > while (n--) > - memcpy_toio(dst_bo->kptr, src_bo->kptr, size); > + memcpy_toio((void __iomem *)dst_bo->kptr, src_bo->kptr, size); > > lsdc_bo_kunmap(src_bo); > lsdc_bo_kunmap(dst_bo); > @@ -39,7 +39,7 @@ static void lsdc_copy_vram_to_gtt_cpu(struct lsdc_bo *src_bo, > lsdc_bo_kmap(dst_bo); > > while (n--) > - memcpy_fromio(dst_bo->kptr, src_bo->kptr, size); > + memcpy_fromio(dst_bo->kptr, (void __iomem *)src_bo->kptr, size); > > lsdc_bo_kunmap(src_bo); > lsdc_bo_kunmap(dst_bo);
Hi Am 10.07.23 um 12:09 schrieb Sui Jingfeng: > When accessing I/O memory, we should pass '__iomem *' type instead of > 'void *' simply, otherwise sparse tests will complain. After applied > this patch, the following two sparse warnings got fixed. > > 1) drivers/gpu/drm/loongson/lsdc_benchmark.c:27:35: > sparse: expected void volatile [noderef] __iomem * > sparse: got void *kptr > > 2) drivers/gpu/drm/loongson/lsdc_benchmark.c:42:51: > sparse: expected void const volatile [noderef] __iomem * > sparse: got void *kptr > > Reported-by: kernel test robot <lkp@intel.com> > Closes: https://lore.kernel.org/oe-kbuild-all/202307100243.v3hv6aes-lkp@intel.com/ > Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn> > --- > drivers/gpu/drm/loongson/lsdc_benchmark.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/loongson/lsdc_benchmark.c b/drivers/gpu/drm/loongson/lsdc_benchmark.c > index b088646a2ff9..36e352820bdb 100644 > --- a/drivers/gpu/drm/loongson/lsdc_benchmark.c > +++ b/drivers/gpu/drm/loongson/lsdc_benchmark.c > @@ -24,7 +24,7 @@ static void lsdc_copy_gtt_to_vram_cpu(struct lsdc_bo *src_bo, > lsdc_bo_kmap(dst_bo); > > while (n--) > - memcpy_toio(dst_bo->kptr, src_bo->kptr, size); > + memcpy_toio((void __iomem *)dst_bo->kptr, src_bo->kptr, size); If this is I/O memory, better add the __iomem qualifier to dst_bo->kptr rather than casting here. If if can be both, you could use an unnamed union like this: struct lscd_bo { union { void __iomem *kptr_iomem; void *kptr; }; }; Best regards Thomas > > lsdc_bo_kunmap(src_bo); > lsdc_bo_kunmap(dst_bo); > @@ -39,7 +39,7 @@ static void lsdc_copy_vram_to_gtt_cpu(struct lsdc_bo *src_bo, > lsdc_bo_kmap(dst_bo); > > while (n--) > - memcpy_fromio(dst_bo->kptr, src_bo->kptr, size); > + memcpy_fromio(dst_bo->kptr, (void __iomem *)src_bo->kptr, size); > > lsdc_bo_kunmap(src_bo); > lsdc_bo_kunmap(dst_bo); -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Hi, On 2023/7/10 18:26, Jani Nikula wrote: > On Mon, 10 Jul 2023, Sui Jingfeng <suijingfeng@loongson.cn> wrote: >> When accessing I/O memory, we should pass '__iomem *' type instead of >> 'void *' simply, otherwise sparse tests will complain. After applied >> this patch, the following two sparse warnings got fixed. > Usually the commit message should explain why it's okay to cast away the > warning. > > Because realistically this doesn't "fix" the warning, this merely hides > it. My understanding is that a point itself is just a variable where store a address, if this address originally point to I/O memory, then, we can other cast it to u64 type, then cast it back to '__iomem *' again. as long as the type's bit-width is width enough to store this address, we won't lost the information. 'void *' or 'u64' is just a intermediate represent of the address. we can other cast it to u64 type, then cast it back to 'void __iomem *' or 'void *' again. Why it's okay ? My answer is that As long as a address is really point to the I/O memory, cast it to 'void __iomem *' is OK. As long as a address is really point to the system memory, cast it to 'void *' is OK. > BR, > Jani. > >> 1) drivers/gpu/drm/loongson/lsdc_benchmark.c:27:35: >> sparse: expected void volatile [noderef] __iomem * >> sparse: got void *kptr >> >> 2) drivers/gpu/drm/loongson/lsdc_benchmark.c:42:51: >> sparse: expected void const volatile [noderef] __iomem * >> sparse: got void *kptr >> >> Reported-by: kernel test robot <lkp@intel.com> >> Closes: https://lore.kernel.org/oe-kbuild-all/202307100243.v3hv6aes-lkp@intel.com/ >> Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn> >> --- >> drivers/gpu/drm/loongson/lsdc_benchmark.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/gpu/drm/loongson/lsdc_benchmark.c b/drivers/gpu/drm/loongson/lsdc_benchmark.c >> index b088646a2ff9..36e352820bdb 100644 >> --- a/drivers/gpu/drm/loongson/lsdc_benchmark.c >> +++ b/drivers/gpu/drm/loongson/lsdc_benchmark.c >> @@ -24,7 +24,7 @@ static void lsdc_copy_gtt_to_vram_cpu(struct lsdc_bo *src_bo, >> lsdc_bo_kmap(dst_bo); >> >> while (n--) >> - memcpy_toio(dst_bo->kptr, src_bo->kptr, size); >> + memcpy_toio((void __iomem *)dst_bo->kptr, src_bo->kptr, size); >> >> lsdc_bo_kunmap(src_bo); >> lsdc_bo_kunmap(dst_bo); >> @@ -39,7 +39,7 @@ static void lsdc_copy_vram_to_gtt_cpu(struct lsdc_bo *src_bo, >> lsdc_bo_kmap(dst_bo); >> >> while (n--) >> - memcpy_fromio(dst_bo->kptr, src_bo->kptr, size); >> + memcpy_fromio(dst_bo->kptr, (void __iomem *)src_bo->kptr, size); >> >> lsdc_bo_kunmap(src_bo); >> lsdc_bo_kunmap(dst_bo);
Hi, On 2023/7/10 18:26, Jani Nikula wrote: > On Mon, 10 Jul 2023, Sui Jingfeng <suijingfeng@loongson.cn> wrote: >> When accessing I/O memory, we should pass '__iomem *' type instead of >> 'void *' simply, otherwise sparse tests will complain. After applied >> this patch, the following two sparse warnings got fixed. > Usually the commit message should explain why it's okay to cast away the > warning. > > Because realistically this doesn't "fix" the warning, this merely hides > it. The reason why we don't fix this at the very beginning is that we are following the ttm_kmap_obj_virtual() and the ttm_bo_kmap() function. Our lsdc_bo_kmap() is implemented with the ttm_bo_kmap() function. Another reason is that this warning don't emerge when compile with W=1, at least this is true on our platform. We don't think this warning is harmful, because implicit cast will do the cast for us. It is just that we need eliminate the noise as a programmer. Again, for the code at here, before you do the de-reference operation, As long as a address is really(originally) point to the I/O memory, cast it to 'void __iomem *' is OK. As long as a address is really(originally) point to the system memory, cast it to 'void *' is OK. > BR, > Jani. > >> 1) drivers/gpu/drm/loongson/lsdc_benchmark.c:27:35: >> sparse: expected void volatile [noderef] __iomem * >> sparse: got void *kptr >> >> 2) drivers/gpu/drm/loongson/lsdc_benchmark.c:42:51: >> sparse: expected void const volatile [noderef] __iomem * >> sparse: got void *kptr >> >> Reported-by: kernel test robot <lkp@intel.com> >> Closes: https://lore.kernel.org/oe-kbuild-all/202307100243.v3hv6aes-lkp@intel.com/ >> Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn> >> --- >> drivers/gpu/drm/loongson/lsdc_benchmark.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/gpu/drm/loongson/lsdc_benchmark.c b/drivers/gpu/drm/loongson/lsdc_benchmark.c >> index b088646a2ff9..36e352820bdb 100644 >> --- a/drivers/gpu/drm/loongson/lsdc_benchmark.c >> +++ b/drivers/gpu/drm/loongson/lsdc_benchmark.c >> @@ -24,7 +24,7 @@ static void lsdc_copy_gtt_to_vram_cpu(struct lsdc_bo *src_bo, >> lsdc_bo_kmap(dst_bo); >> >> while (n--) >> - memcpy_toio(dst_bo->kptr, src_bo->kptr, size); >> + memcpy_toio((void __iomem *)dst_bo->kptr, src_bo->kptr, size); >> >> lsdc_bo_kunmap(src_bo); >> lsdc_bo_kunmap(dst_bo); >> @@ -39,7 +39,7 @@ static void lsdc_copy_vram_to_gtt_cpu(struct lsdc_bo *src_bo, >> lsdc_bo_kmap(dst_bo); >> >> while (n--) >> - memcpy_fromio(dst_bo->kptr, src_bo->kptr, size); >> + memcpy_fromio(dst_bo->kptr, (void __iomem *)src_bo->kptr, size); >> >> lsdc_bo_kunmap(src_bo); >> lsdc_bo_kunmap(dst_bo);
On Mon, 10 Jul 2023, suijingfeng <suijingfeng@loongson.cn> wrote: > Hi, > > On 2023/7/10 18:26, Jani Nikula wrote: >> On Mon, 10 Jul 2023, Sui Jingfeng <suijingfeng@loongson.cn> wrote: >>> When accessing I/O memory, we should pass '__iomem *' type instead of >>> 'void *' simply, otherwise sparse tests will complain. After applied >>> this patch, the following two sparse warnings got fixed. >> Usually the commit message should explain why it's okay to cast away the >> warning. >> >> Because realistically this doesn't "fix" the warning, this merely hides >> it. > > > My understanding is that a point itself is just a variable where store a > address, > > if this address originally point to I/O memory, > > then, we can other cast it to u64 type, then cast it back to '__iomem *' > again. > > as long as the type's bit-width is width enough to store this address, > we won't lost the information. > > > 'void *' or 'u64' is just a intermediate represent of the address. > > we can other cast it to u64 type, then cast it back to 'void __iomem *' > or 'void *' again. > > > Why it's okay ? My answer is that > > As long as a address is really point to the I/O memory, cast it to 'void > __iomem *' is OK. > > As long as a address is really point to the system memory, cast it to > 'void *' is OK. The point of __iomem is to have sparse help you in tracking that, so you don't accidentally mix up the two. BR, Jani. > > >> BR, >> Jani. >> >>> 1) drivers/gpu/drm/loongson/lsdc_benchmark.c:27:35: >>> sparse: expected void volatile [noderef] __iomem * >>> sparse: got void *kptr >>> >>> 2) drivers/gpu/drm/loongson/lsdc_benchmark.c:42:51: >>> sparse: expected void const volatile [noderef] __iomem * >>> sparse: got void *kptr >>> >>> Reported-by: kernel test robot <lkp@intel.com> >>> Closes: https://lore.kernel.org/oe-kbuild-all/202307100243.v3hv6aes-lkp@intel.com/ >>> Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn> >>> --- >>> drivers/gpu/drm/loongson/lsdc_benchmark.c | 4 ++-- >>> 1 file changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/gpu/drm/loongson/lsdc_benchmark.c b/drivers/gpu/drm/loongson/lsdc_benchmark.c >>> index b088646a2ff9..36e352820bdb 100644 >>> --- a/drivers/gpu/drm/loongson/lsdc_benchmark.c >>> +++ b/drivers/gpu/drm/loongson/lsdc_benchmark.c >>> @@ -24,7 +24,7 @@ static void lsdc_copy_gtt_to_vram_cpu(struct lsdc_bo *src_bo, >>> lsdc_bo_kmap(dst_bo); >>> >>> while (n--) >>> - memcpy_toio(dst_bo->kptr, src_bo->kptr, size); >>> + memcpy_toio((void __iomem *)dst_bo->kptr, src_bo->kptr, size); >>> >>> lsdc_bo_kunmap(src_bo); >>> lsdc_bo_kunmap(dst_bo); >>> @@ -39,7 +39,7 @@ static void lsdc_copy_vram_to_gtt_cpu(struct lsdc_bo *src_bo, >>> lsdc_bo_kmap(dst_bo); >>> >>> while (n--) >>> - memcpy_fromio(dst_bo->kptr, src_bo->kptr, size); >>> + memcpy_fromio(dst_bo->kptr, (void __iomem *)src_bo->kptr, size); >>> >>> lsdc_bo_kunmap(src_bo); >>> lsdc_bo_kunmap(dst_bo); >
diff --git a/drivers/gpu/drm/loongson/lsdc_benchmark.c b/drivers/gpu/drm/loongson/lsdc_benchmark.c index b088646a2ff9..36e352820bdb 100644 --- a/drivers/gpu/drm/loongson/lsdc_benchmark.c +++ b/drivers/gpu/drm/loongson/lsdc_benchmark.c @@ -24,7 +24,7 @@ static void lsdc_copy_gtt_to_vram_cpu(struct lsdc_bo *src_bo, lsdc_bo_kmap(dst_bo); while (n--) - memcpy_toio(dst_bo->kptr, src_bo->kptr, size); + memcpy_toio((void __iomem *)dst_bo->kptr, src_bo->kptr, size); lsdc_bo_kunmap(src_bo); lsdc_bo_kunmap(dst_bo); @@ -39,7 +39,7 @@ static void lsdc_copy_vram_to_gtt_cpu(struct lsdc_bo *src_bo, lsdc_bo_kmap(dst_bo); while (n--) - memcpy_fromio(dst_bo->kptr, src_bo->kptr, size); + memcpy_fromio(dst_bo->kptr, (void __iomem *)src_bo->kptr, size); lsdc_bo_kunmap(src_bo); lsdc_bo_kunmap(dst_bo);