From: Pierre Gondois <pierre.gondois@arm.com>
To: linux-kernel@vger.kernel.org
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
Conor Dooley <conor.dooley@microchip.com>,
Dan Carpenter <error27@gmail.com>,
Pierre Gondois <pierre.gondois@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Sudeep Holla <sudeep.holla@arm.com>,
Akihiko Odaki <akihiko.odaki@daynix.com>,
Palmer Dabbelt <palmer@rivosinc.com>,
Gavin Shan <gshan@redhat.com>,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH -next v2 2/3] cacheinfo: Make default acpi_get_cache_info() return an error
Date: Tue, 24 Jan 2023 16:40:47 +0100 [thread overview]
Message-ID: <20230124154053.355376-3-pierre.gondois@arm.com> (raw)
In-Reply-To: <20230124154053.355376-1-pierre.gondois@arm.com>
commit bd500361a937 ("ACPI: PPTT: Update acpi_find_last_cache_level()
to acpi_get_cache_info()")
updates the prototype of acpi_get_cache_info(). The cache 'levels'
is update through a pointer and not the return value of the function.
If CONFIG_ACPI_PPTT is not defined, acpi_get_cache_info() doesn't
update its *levels and *split_levels parameters and returns 0.
This can lead to a faulty behaviour.
Make acpi_get_cache_info() return an error code if CONFIG_ACPI_PPTT
is not defined.
Also,
In init_cache_level(), if no PPTT is present or CONFIG_ACPI_PPTT is
not defined, instead of aborting if acpi_get_cache_info() returns an
error code, just continue. This allows to try fetching the cache
information from clidr_el1.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
---
arch/arm64/kernel/cacheinfo.c | 2 +-
include/linux/cacheinfo.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kernel/cacheinfo.c b/arch/arm64/kernel/cacheinfo.c
index d3fe9542c370..bf348b8d321f 100644
--- a/arch/arm64/kernel/cacheinfo.c
+++ b/arch/arm64/kernel/cacheinfo.c
@@ -59,7 +59,7 @@ int init_cache_level(unsigned int cpu)
} else {
ret = acpi_get_cache_info(cpu, &fw_level, NULL);
if (ret < 0)
- return ret;
+ fw_level = 0;
}
if (fw_level < 0)
diff --git a/include/linux/cacheinfo.h b/include/linux/cacheinfo.h
index dfef57077cd0..908e19d17f49 100644
--- a/include/linux/cacheinfo.h
+++ b/include/linux/cacheinfo.h
@@ -100,7 +100,7 @@ static inline
int acpi_get_cache_info(unsigned int cpu,
unsigned int *levels, unsigned int *split_levels)
{
- return 0;
+ return -ENOENT;
}
#else
int acpi_get_cache_info(unsigned int cpu,
--
2.25.1
next prev parent reply other threads:[~2023-01-24 15:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-24 15:40 [PATCH -next v2 0/3] cacheinfo: Fix misbehaviours around init_cache_level() Pierre Gondois
2023-01-24 15:40 ` [PATCH -next v2 1/3] cacheinfo: Initialize variables in fetch_cache_info() Pierre Gondois
2023-01-24 17:19 ` Conor Dooley
2023-01-24 15:40 ` Pierre Gondois [this message]
2023-01-24 17:15 ` [PATCH -next v2 2/3] cacheinfo: Make default acpi_get_cache_info() return an error Conor Dooley
2023-01-24 15:40 ` [PATCH -next v2 3/3] cacheinfo: Remove unused check in init_cache_level() Pierre Gondois
2023-01-24 17:01 ` Conor Dooley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230124154053.355376-3-pierre.gondois@arm.com \
--to=pierre.gondois@arm.com \
--cc=akihiko.odaki@daynix.com \
--cc=catalin.marinas@arm.com \
--cc=conor.dooley@microchip.com \
--cc=error27@gmail.com \
--cc=geert@linux-m68k.org \
--cc=gregkh@linuxfoundation.org \
--cc=gshan@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=palmer@rivosinc.com \
--cc=rafael@kernel.org \
--cc=sudeep.holla@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®