Message ID | 20230723191758.1262960-1-sunilvl@ventanamicro.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp1409620vqg; Sun, 23 Jul 2023 13:00:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlGjlAWXgx23lKGQ6wDCENO8CUWfd3xpr1PsNcLkN+PNumanFT6rWYzGe4U98gIIOwt7xIbq X-Received: by 2002:aa7:d61a:0:b0:522:1fd1:1035 with SMTP id c26-20020aa7d61a000000b005221fd11035mr2720317edr.6.1690142438903; Sun, 23 Jul 2023 13:00:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690142438; cv=none; d=google.com; s=arc-20160816; b=VabYkGRilVPXXSSPJByGZYyjfTn1XDl4Ztmt96eYFwDvaUxP5CEbccONjxE2Ip/mFQ DEVKlP5tpTJ5BeOP+h/AORl6twenOLQBYJMjegLyi1fFoxQtWxMATirsR8rFSzqIK+4f T4iWVSvLGEp7WHdbz0tgVrPXcBGE0DIxq8TPEIxE3x+CsSh/waFQVGf4IbZSZwQR7JwV 4nUmz2C+qu85fYRA5ooa6V1m3SSKzPsR2aheSJcxv7mF/QCmDonn4XPrCUx4v8DDRD/q Sbewy4G0Lms3/Jjwar1gxqbFep4AC4TqVLaAtw8CvQiPJ0pOPQbgvC/vPw/gy+Fv30RM eg7A== 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:dkim-signature; bh=pW/D68CVUATDRvkkjfDHL+y9HJPS05BTKqrSEexxpog=; fh=bKq58Q1fTORvr7XzrLw/Gaej7DfUpSShbqNQVpqVsKo=; b=iAjus7VhdhRRlG96D5j0BZ5iq0euwS0uejBG6Ax5GkC8WG3Qzrqtc8gT6yOXEz17Ss StdleriTBkbz2KL5I2trrMr1DijJWUM7sq5kVihYzFSQ3/yafCB2/v17IuD5w4NnlP9I dvsQBOii63bSkH17zVXZrNKgRtV+i9BWVaO7X+VIZSlhAl9WS9RapgSGIZUI+qI+ykWu wephtcqdiXZtE57XbPEqK3b+HCDR5U12VsrG2gY+680qbs9O7w2cOjNbE+vfbTHbhQiq wAvnX35+LMhUc35TBBuDtb9VaWKUx0yfmdCIqybtuCRtReH69jl//IjlczQuQXjUgWo6 Otew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=S4mbzqky; 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 ba14-20020a0564021ace00b0050bc94fe05csi5773912edb.117.2023.07.23.13.00.14; Sun, 23 Jul 2023 13:00:38 -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; dkim=pass header.i=@ventanamicro.com header.s=google header.b=S4mbzqky; 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 S229572AbjGWTSS (ORCPT <rfc822;chrisben.tianve@gmail.com> + 99 others); Sun, 23 Jul 2023 15:18:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbjGWTSQ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 23 Jul 2023 15:18:16 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DF711BC for <linux-kernel@vger.kernel.org>; Sun, 23 Jul 2023 12:18:16 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1b89114266dso29709495ad.0 for <linux-kernel@vger.kernel.org>; Sun, 23 Jul 2023 12:18:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1690139895; x=1690744695; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=pW/D68CVUATDRvkkjfDHL+y9HJPS05BTKqrSEexxpog=; b=S4mbzqkyBOsbsoQQ28NtKbuZQoLczx3V7rt47BuYtA6nNDw1b8k0dDBQq1WvMmftYu ZtHDIrrjgIKDFhVbESxIkTD5yG4KPUWjw1A5SINWXZlrkC5YJ+by0mXd8PPux7hkjMwZ P/KjGym1/AaFTLnf1m3f2NwOftCPWfENn0oeyrxzpr0xD4FjYhhKx6qunB6S6NnGe2Cy rlW13aUC+J0c27hbQO+3xXcvKXx4mSh4Az3Gg9BNNHw4BCgzkgW5Cg7ba93kfn/VM7NC Qv8/Kdr9XkXhrIXz76SCkuF3veGgb7SIo1UJm+A7Khx6+RIRWq8lCN0rdis/9XQ/TYKZ hm0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690139895; x=1690744695; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=pW/D68CVUATDRvkkjfDHL+y9HJPS05BTKqrSEexxpog=; b=kc45Usn0BCL10F2l+m8ezWfXj9bJXRF0Y9GSmjHfG3WBGDgrLeP6TV5i3aidqi5gUm gEtmsoMdMEUVQUo4on5YiAmFH+I9usQdDVHZIU8YjCHMwxdLM2TOx5Qu/yuPH0D17Vsv q4VdzjgwGJWwUuffBSQisMnp4myqx4cojTskyEJSwl7mCNhgxxi0PyTDo/Bk1lRX0pD7 TB1GGd6+pYhNsVmFMiCFP2733xEysqdXqPpU6xbT+fPz5QcBCEd96qXODzCfxgLkpJMD K3RSIswaxB+0SYVVjfvJ9UI6M9f140YP/Og8ikjvbHbpESj56BMDv8FwLpnHvgOuJiRl 93Xg== X-Gm-Message-State: ABy/qLYp7G+C+LchToYYaycX/RWmXYRyuPgIsgJoONhEJJFXp+pFeKv/ pRHqxJ8bSJY/vSO4NOHromV1BT8f+6G7wuKwCl4= X-Received: by 2002:a17:902:ec83:b0:1b8:b41e:66b4 with SMTP id x3-20020a170902ec8300b001b8b41e66b4mr10434855plg.67.1690139895538; Sun, 23 Jul 2023 12:18:15 -0700 (PDT) Received: from sunil-pc.Dlink ([106.51.190.25]) by smtp.gmail.com with ESMTPSA id s7-20020a170902988700b001b9e86e05b7sm7235508plp.0.2023.07.23.12.18.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jul 2023 12:18:15 -0700 (PDT) From: Sunil V L <sunilvl@ventanamicro.com> To: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Conor Dooley <conor.dooley@microchip.com>, Andrew Jones <ajones@ventanamicro.com>, Sunil V L <sunilvl@ventanamicro.com>, kernel test robot <lkp@intel.com> Subject: [PATCH v2 -fixes] RISC-V: ACPI: Fix acpi_os_ioremap to return iomem address Date: Mon, 24 Jul 2023 00:47:58 +0530 Message-Id: <20230723191758.1262960-1-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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: 1772228255779459868 X-GMAIL-MSGID: 1772242797538977784 |
Series |
[v2,-fixes] RISC-V: ACPI: Fix acpi_os_ioremap to return iomem address
|
|
Commit Message
Sunil V L
July 23, 2023, 7:17 p.m. UTC
acpi_os_ioremap() currently is a wrapper to memremap() on
RISC-V. But the callers of acpi_os_ioremap() expect it to
return __iomem address and hence sparse tool reports a new
warning. Fix this issue by type casting to __iomem type.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202307230357.egcTAefj-lkp@intel.com/
Fixes: a91a9ffbd3a5 ("RISC-V: Add support to build the ACPI core")
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
---
Changes since v1:
1) Removed enhancements from the fix patch.
arch/riscv/include/asm/acpi.h | 2 +-
arch/riscv/kernel/acpi.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
Comments
On Mon, Jul 24, 2023 at 12:47:58AM +0530, Sunil V L wrote: > acpi_os_ioremap() currently is a wrapper to memremap() on > RISC-V. But the callers of acpi_os_ioremap() expect it to > return __iomem address and hence sparse tool reports a new > warning. Fix this issue by type casting to __iomem type. > > Reported-by: kernel test robot <lkp@intel.com> > Closes: https://lore.kernel.org/oe-kbuild-all/202307230357.egcTAefj-lkp@intel.com/ > Fixes: a91a9ffbd3a5 ("RISC-V: Add support to build the ACPI core") > Signed-off-by: Sunil V L <sunilvl@ventanamicro.com> > --- > Changes since v1: > 1) Removed enhancements from the fix patch. > > arch/riscv/include/asm/acpi.h | 2 +- > arch/riscv/kernel/acpi.c | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/arch/riscv/include/asm/acpi.h b/arch/riscv/include/asm/acpi.h > index f71ce21ff684..d5604d2073bc 100644 > --- a/arch/riscv/include/asm/acpi.h > +++ b/arch/riscv/include/asm/acpi.h > @@ -19,7 +19,7 @@ typedef u64 phys_cpuid_t; > #define PHYS_CPUID_INVALID INVALID_HARTID > > /* ACPI table mapping after acpi_permanent_mmap is set */ > -void *acpi_os_ioremap(acpi_physical_address phys, acpi_size size); > +void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size); > #define acpi_os_ioremap acpi_os_ioremap > > #define acpi_strict 1 /* No out-of-spec workarounds on RISC-V */ > diff --git a/arch/riscv/kernel/acpi.c b/arch/riscv/kernel/acpi.c > index 5ee03ebab80e..e6fdb9edcdd9 100644 > --- a/arch/riscv/kernel/acpi.c > +++ b/arch/riscv/kernel/acpi.c > @@ -215,9 +215,9 @@ void __init __acpi_unmap_table(void __iomem *map, unsigned long size) > early_iounmap(map, size); > } > > -void *acpi_os_ioremap(acpi_physical_address phys, acpi_size size) > +void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size) > { > - return memremap(phys, size, MEMREMAP_WB); > + return (__force void __iomem *) memremap(phys, size, MEMREMAP_WB); Why's the __force needed? Does sparse complain about the cast too?
On Mon, Jul 24, 2023 at 09:07:46AM +0100, Conor Dooley wrote: > On Mon, Jul 24, 2023 at 12:47:58AM +0530, Sunil V L wrote: > > acpi_os_ioremap() currently is a wrapper to memremap() on > > RISC-V. But the callers of acpi_os_ioremap() expect it to > > return __iomem address and hence sparse tool reports a new > > warning. Fix this issue by type casting to __iomem type. > > > > Reported-by: kernel test robot <lkp@intel.com> > > Closes: https://lore.kernel.org/oe-kbuild-all/202307230357.egcTAefj-lkp@intel.com/ > > Fixes: a91a9ffbd3a5 ("RISC-V: Add support to build the ACPI core") > > Signed-off-by: Sunil V L <sunilvl@ventanamicro.com> > > --- > > Changes since v1: > > 1) Removed enhancements from the fix patch. > > > > arch/riscv/include/asm/acpi.h | 2 +- > > arch/riscv/kernel/acpi.c | 4 ++-- > > 2 files changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/arch/riscv/include/asm/acpi.h b/arch/riscv/include/asm/acpi.h > > index f71ce21ff684..d5604d2073bc 100644 > > --- a/arch/riscv/include/asm/acpi.h > > +++ b/arch/riscv/include/asm/acpi.h > > @@ -19,7 +19,7 @@ typedef u64 phys_cpuid_t; > > #define PHYS_CPUID_INVALID INVALID_HARTID > > > > /* ACPI table mapping after acpi_permanent_mmap is set */ > > -void *acpi_os_ioremap(acpi_physical_address phys, acpi_size size); > > +void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size); > > #define acpi_os_ioremap acpi_os_ioremap > > > > #define acpi_strict 1 /* No out-of-spec workarounds on RISC-V */ > > diff --git a/arch/riscv/kernel/acpi.c b/arch/riscv/kernel/acpi.c > > index 5ee03ebab80e..e6fdb9edcdd9 100644 > > --- a/arch/riscv/kernel/acpi.c > > +++ b/arch/riscv/kernel/acpi.c > > @@ -215,9 +215,9 @@ void __init __acpi_unmap_table(void __iomem *map, unsigned long size) > > early_iounmap(map, size); > > } > > > > -void *acpi_os_ioremap(acpi_physical_address phys, acpi_size size) > > +void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size) > > { > > - return memremap(phys, size, MEMREMAP_WB); > > + return (__force void __iomem *) memremap(phys, size, MEMREMAP_WB); > > Why's the __force needed? Does sparse complain about the cast too? Nope, I think it is required only if the cast is other way. Let me remove this in v3. Thanks, Sunil
diff --git a/arch/riscv/include/asm/acpi.h b/arch/riscv/include/asm/acpi.h index f71ce21ff684..d5604d2073bc 100644 --- a/arch/riscv/include/asm/acpi.h +++ b/arch/riscv/include/asm/acpi.h @@ -19,7 +19,7 @@ typedef u64 phys_cpuid_t; #define PHYS_CPUID_INVALID INVALID_HARTID /* ACPI table mapping after acpi_permanent_mmap is set */ -void *acpi_os_ioremap(acpi_physical_address phys, acpi_size size); +void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size); #define acpi_os_ioremap acpi_os_ioremap #define acpi_strict 1 /* No out-of-spec workarounds on RISC-V */ diff --git a/arch/riscv/kernel/acpi.c b/arch/riscv/kernel/acpi.c index 5ee03ebab80e..e6fdb9edcdd9 100644 --- a/arch/riscv/kernel/acpi.c +++ b/arch/riscv/kernel/acpi.c @@ -215,9 +215,9 @@ void __init __acpi_unmap_table(void __iomem *map, unsigned long size) early_iounmap(map, size); } -void *acpi_os_ioremap(acpi_physical_address phys, acpi_size size) +void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size) { - return memremap(phys, size, MEMREMAP_WB); + return (__force void __iomem *) memremap(phys, size, MEMREMAP_WB); } #ifdef CONFIG_PCI