From patchwork Thu Jan 7 11:17:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ionela Voinescu X-Patchwork-Id: 12003603 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2722FC43381 for ; Thu, 7 Jan 2021 11:19:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E0AC223142 for ; Thu, 7 Jan 2021 11:19:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727771AbhAGLTA (ORCPT ); Thu, 7 Jan 2021 06:19:00 -0500 Received: from foss.arm.com ([217.140.110.172]:58064 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726326AbhAGLTA (ORCPT ); Thu, 7 Jan 2021 06:19:00 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6698B106F; Thu, 7 Jan 2021 03:18:14 -0800 (PST) Received: from e108754-lin.cambridge.arm.com (unknown [10.1.198.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 17AAC3F719; Thu, 7 Jan 2021 03:18:12 -0800 (PST) From: Ionela Voinescu To: rjw@rjwysocki.net, lenb@kernel.org, robert.moore@intel.com Cc: viro@zeniv.linux.org.uk, catalin.marinas@arm.com, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, ionela.voinescu@arm.com, Erik Kaneda , "Rafael J. Wysocki" Subject: [PATCH 1/3] acpi: cppc_acpi: remove __iomem annotation for cpc_reg's address Date: Thu, 7 Jan 2021 11:17:15 +0000 Message-Id: <20210107111717.5571-2-ionela.voinescu@arm.com> X-Mailer: git-send-email 2.29.2.dirty In-Reply-To: <20210107111717.5571-1-ionela.voinescu@arm.com> References: <20210107111717.5571-1-ionela.voinescu@arm.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org The cpc_reg address does not represent either an I/O virtual address, nor a field located in iomem. This address is used as an address offset which eventually is given as physical address argument to ioremap or PCC space offset to GET_PCC_VADDR. Therefore, having the __iomem annotation does not make sense. Fix the following sparse warnings by removing the __iomem annotation for cpc_reg's address. drivers/acpi/cppc_acpi.c:762:37: warning: dereference of noderef expression drivers/acpi/cppc_acpi.c:765:48: warning: dereference of noderef expression drivers/acpi/cppc_acpi.c:948:25: warning: dereference of noderef expression drivers/acpi/cppc_acpi.c:954:67: warning: dereference of noderef expression drivers/acpi/cppc_acpi.c:987:25: warning: dereference of noderef expression drivers/acpi/cppc_acpi.c:993:68: warning: dereference of noderef expression drivers/acpi/cppc_acpi.c:1120:13: warning: dereference of noderef expression drivers/acpi/cppc_acpi.c:1134:13: warning: dereference of noderef expression drivers/acpi/cppc_acpi.c:1137:13: warning: dereference of noderef expression drivers/acpi/cppc_acpi.c:1182:14: warning: dereference of noderef expression drivers/acpi/cppc_acpi.c:1212:13: warning: dereference of noderef expression Suggested-by: Al Viro Signed-off-by: Ionela Voinescu Cc: Robert Moore Cc: Erik Kaneda Cc: "Rafael J. Wysocki" --- include/acpi/cppc_acpi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/acpi/cppc_acpi.h b/include/acpi/cppc_acpi.h index 232838d28f50..c7fc4524e151 100644 --- a/include/acpi/cppc_acpi.h +++ b/include/acpi/cppc_acpi.h @@ -39,7 +39,7 @@ struct cpc_reg { u8 bit_width; u8 bit_offset; u8 access_width; - u64 __iomem address; + u64 address; } __packed; /* From patchwork Thu Jan 7 11:17:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ionela Voinescu X-Patchwork-Id: 12003605 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9A33C433E0 for ; Thu, 7 Jan 2021 11:20:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ADFB1221E9 for ; Thu, 7 Jan 2021 11:20:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727843AbhAGLTE (ORCPT ); Thu, 7 Jan 2021 06:19:04 -0500 Received: from foss.arm.com ([217.140.110.172]:58076 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726326AbhAGLTD (ORCPT ); Thu, 7 Jan 2021 06:19:03 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8F39711B3; Thu, 7 Jan 2021 03:18:17 -0800 (PST) Received: from e108754-lin.cambridge.arm.com (unknown [10.1.198.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 752223F719; Thu, 7 Jan 2021 03:18:16 -0800 (PST) From: Ionela Voinescu To: rjw@rjwysocki.net, lenb@kernel.org, robert.moore@intel.com Cc: viro@zeniv.linux.org.uk, catalin.marinas@arm.com, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, ionela.voinescu@arm.com Subject: [PATCH 2/3] acpi: cppc_acpi: add __iomem annotation to generic_comm_base pointer Date: Thu, 7 Jan 2021 11:17:16 +0000 Message-Id: <20210107111717.5571-3-ionela.voinescu@arm.com> X-Mailer: git-send-email 2.29.2.dirty In-Reply-To: <20210107111717.5571-1-ionela.voinescu@arm.com> References: <20210107111717.5571-1-ionela.voinescu@arm.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org ppc_comm_addr is a virtual address to the PCC space and it's annotated with __iomem. Therefore, generic_comm_base which gets assigned the value of pcc_comm_address should be annotated as well. This already happens in check_pcc_chan(), but not in send_pcc_cmd(), which results in the following sparse warnings: drivers/acpi/cppc_acpi.c:237:18: warning: cast removes address space '__iomem' of expression drivers/acpi/cppc_acpi.c:299:9: warning: incorrect type in argument 2 (different address spaces) drivers/acpi/cppc_acpi.c:299:9: expected void volatile [noderef] __iomem *addr drivers/acpi/cppc_acpi.c:299:9: got unsigned short * drivers/acpi/cppc_acpi.c:302:9: warning: incorrect type in argument 2 (different address spaces) drivers/acpi/cppc_acpi.c:302:9: expected void volatile [noderef] __iomem *addr drivers/acpi/cppc_acpi.c:302:9: got unsigned short * Signed-off-by: Ionela Voinescu Cc: "Rafael J. Wysocki" Cc: Len Brown --- drivers/acpi/cppc_acpi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c index 75aaf94ae0a9..fd71020f5d5f 100644 --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -233,8 +233,8 @@ static int send_pcc_cmd(int pcc_ss_id, u16 cmd) { int ret = -EIO, i; struct cppc_pcc_data *pcc_ss_data = pcc_data[pcc_ss_id]; - struct acpi_pcct_shared_memory *generic_comm_base = - (struct acpi_pcct_shared_memory *)pcc_ss_data->pcc_comm_addr; + struct acpi_pcct_shared_memory __iomem *generic_comm_base = + pcc_ss_data->pcc_comm_addr; unsigned int time_delta; /* From patchwork Thu Jan 7 11:17:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ionela Voinescu X-Patchwork-Id: 12003607 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FB76C433E6 for ; Thu, 7 Jan 2021 11:20:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E3451221E9 for ; Thu, 7 Jan 2021 11:20:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726326AbhAGLTi (ORCPT ); Thu, 7 Jan 2021 06:19:38 -0500 Received: from foss.arm.com ([217.140.110.172]:58090 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727850AbhAGLTF (ORCPT ); Thu, 7 Jan 2021 06:19:05 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 81D0B11D4; Thu, 7 Jan 2021 03:18:19 -0800 (PST) Received: from e108754-lin.cambridge.arm.com (unknown [10.1.198.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 67BC13F719; Thu, 7 Jan 2021 03:18:18 -0800 (PST) From: Ionela Voinescu To: rjw@rjwysocki.net, lenb@kernel.org, robert.moore@intel.com Cc: viro@zeniv.linux.org.uk, catalin.marinas@arm.com, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, ionela.voinescu@arm.com Subject: [PATCH 3/3] acpi: cppc_acpi: initialise vaddr pointers to NULL Date: Thu, 7 Jan 2021 11:17:17 +0000 Message-Id: <20210107111717.5571-4-ionela.voinescu@arm.com> X-Mailer: git-send-email 2.29.2.dirty In-Reply-To: <20210107111717.5571-1-ionela.voinescu@arm.com> References: <20210107111717.5571-1-ionela.voinescu@arm.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Properly initialise vaddr pointers in cpc_read() and cpc_write() to NULL instead of 0. This fixes the following sparse warnings: drivers/acpi/cppc_acpi.c:937:31: warning: Using plain integer as NULL pointer drivers/acpi/cppc_acpi.c:982:31: warning: Using plain integer as NULL pointer Signed-off-by: Ionela Voinescu Cc: "Rafael J. Wysocki" Cc: Len Brown --- drivers/acpi/cppc_acpi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c index fd71020f5d5f..69057fcd2c04 100644 --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -934,7 +934,7 @@ int __weak cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val) static int cpc_read(int cpu, struct cpc_register_resource *reg_res, u64 *val) { int ret_val = 0; - void __iomem *vaddr = 0; + void __iomem *vaddr = NULL; int pcc_ss_id = per_cpu(cpu_pcc_subspace_idx, cpu); struct cpc_reg *reg = ®_res->cpc_entry.reg; @@ -979,7 +979,7 @@ static int cpc_read(int cpu, struct cpc_register_resource *reg_res, u64 *val) static int cpc_write(int cpu, struct cpc_register_resource *reg_res, u64 val) { int ret_val = 0; - void __iomem *vaddr = 0; + void __iomem *vaddr = NULL; int pcc_ss_id = per_cpu(cpu_pcc_subspace_idx, cpu); struct cpc_reg *reg = ®_res->cpc_entry.reg;