* Re: [PATCH 0/4] riscv: Allow userspace to directly access perf counters
From: Ian Rogers @ 2023-04-19 17:42 UTC (permalink / raw)
To: Alexandre Ghiti, paranlee
Cc: Atish Patra, David Laight, Jonathan Corbet, Peter Zijlstra,
Ingo Molnar, Arnaldo Carvalho de Melo, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Namhyung Kim, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Anup Patel, Will Deacon, Rob Herring,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-perf-users@vger.kernel.org, linux-riscv@lists.infradead.org,
linux-arm-kernel@lists.infradead.org
In-Reply-To: <CAHVXubjhORBEDok_Zhq5p_Yv4Ty4Hct84dWJZXzo48+40N=CGg@mail.gmail.com>
On Wed, Apr 19, 2023 at 2:21 AM Alexandre Ghiti <alexghiti@rivosinc.com> wrote:
>
> Hi Ian,
>
> On Tue, Apr 18, 2023 at 10:30 PM Atish Patra <atishp@atishpatra.org> wrote:
> >
> > On Tue, Apr 18, 2023 at 11:46 PM Ian Rogers <irogers@google.com> wrote:
> > >
> > > On Tue, Apr 18, 2023 at 9:43 AM Atish Patra <atishp@atishpatra.org> wrote:
> > > >
> > > > On Fri, Apr 14, 2023 at 2:40 AM David Laight <David.Laight@aculab.com> wrote:
> > > > >
> > > > > From: Atish Patra
> > > > > > Sent: 13 April 2023 20:18
> > > > > >
> > > > > > On Thu, Apr 13, 2023 at 9:47 PM Alexandre Ghiti <alexghiti@rivosinc.com> wrote:
> > > > > > >
> > > > > > > riscv used to allow direct access to cycle/time/instret counters,
> > > > > > > bypassing the perf framework, this patchset intends to allow the user to
> > > > > > > mmap any counter when accessed through perf. But we can't break the
> > > > > > > existing behaviour so we introduce a sysctl perf_user_access like arm64
> > > > > > > does, which defaults to the legacy mode described above.
> > > > > > >
> > > > > >
> > > > > > It would be good provide additional direction for user space packages:
> > > > > >
> > > > > > The legacy behavior is supported for now in order to avoid breaking
> > > > > > existing software.
> > > > > > However, reading counters directly without perf interaction may
> > > > > > provide incorrect values which
> > > > > > the userspace software must avoid. We are hoping that the user space
> > > > > > packages which
> > > > > > read the cycle/instret directly, will move to the proper interface
> > > > > > eventually if they actually need it.
> > > > > > Most of the users are supposed to read "time" instead of "cycle" if
> > > > > > they intend to read timestamps.
> > > > >
> > > > > If you are trying to measure the performance of short code
> > > > > fragments then you need pretty much raw access directly to
> > > > > the cycle/clock count register.
> > > > >
> > > > > I've done this on x86 to compare the actual cycle times
> > > > > of different implementations of the IP checksum loop
> > > > > (and compare them to the theoretical limit).
> > > > > The perf framework just added far too much latency,
> > > > > only directly reading the cpu registers gave anything
> > > > > like reliable (and consistent) answers.
> > > > >
> > > >
> > > > This series allows direct access to the counters once configured
> > > > through the perf.
> > > > Earlier the cycle/instret counters are directly exposed to the
> > > > userspace without kernel/perf frameworking knowing
> > > > when/which user space application is reading it. That has security implications.
> > > >
> > > > With this series applied, the user space application just needs to
> > > > configure the event (cycle/instret) through perf syscall.
> > > > Once configured, the userspace application can find out the counter
> > > > information from the mmap & directly
> > > > read the counter. There is no latency while reading the counters.
> > > >
> > > > This mechanism allows stop/clear the counters when the requesting task
> > > > is not running. It also takes care of context switching
> > > > which may result in invalid values as you mentioned below. This is
> > > > nothing new and all other arch (x86, ARM64) allow user space
> > > > counter read through the same mechanism.
> > > >
> > > > Here is the relevant upstream discussion:
> > > > https://lore.kernel.org/lkml/Y7wLa7I2hlz3rKw%2F@hirez.programming.kicks-ass.net/T/
> > > >
> > > > ARM64:
> > > > https://docs.kernel.org/arm64/perf.html?highlight=perf_user_access#perf-userspace-pmu-hardware-counter-access
> > > >
> > > > example usage in x86:
> > > > https://github.com/andikleen/pmu-tools/blob/master/jevents/rdpmc.c
> > >
> > > The canonical implementation of this should be:
> > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/lib/perf/mmap.c#n400
> >
> > Thanks for sharing the libperf implementation.
> >
> > > which is updated in these patches but the tests are not:
> > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/tests/mmap-basic.c#n287
> > > Which appears to be an oversight. The tests display some differences
> >
> > Yes. It's an oversight. We should make sure that perf mmap tests pass
> > for RISC-V as well.
>
> Yes, that's an oversight, I had a local test adapted from this one but
> forgot to update it afterwards, I'll do that in the next version.
>
> Thanks for your quick feedbacks and sorry for being late,
>
> Alex
Thanks Alex, there was an equally likely chance that I wasn't
understanding things :-) Is there any information on RISC-V PMU
testing? I know ParanLee is interested. It'd be awesome to have
something say on:
https://perf.wiki.kernel.org/index.php/Main_Page
on how to run tests, perhaps on QEMU or known to work boards. We can
also just drop a link on there if there is information. We can also
add the RISC-V PMU information to the links here:
https://perf.wiki.kernel.org/index.php/Useful_Links
Thanks,
Ian
>
> >
> >
> > > between x86 and aarch64 that have assumed userspace hardware counter
> > > access, and everything else that it is assumed don't.
> > >
> > > Thanks,
> > > Ian
> > >
> > > > > Clearly process switches (especially cpu migrations) cause
> > > > > problems, but they are obviously invalid values and can
> > > > > be ignored.
> > > > >
> > > > > So while a lot of uses may be 'happy' with the values the
> > > > > perf framework gives, sometimes you do need to directly
> > > > > read the relevant registers.
> > > > >
> > > > > David
> > > > >
> > > > > -
> > > > > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
> > > > > Registration No: 1397386 (Wales)
> > > >
> > > >
> > > >
> > > > --
> > > > Regards,
> > > > Atish
> >
> >
> >
> > --
> > Regards,
> > Atish
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v3 00/19] arch: Consolidate <asm/fb.h>
From: Helge Deller @ 2023-04-19 17:22 UTC (permalink / raw)
To: Thomas Zimmermann, Arnd Bergmann, Daniel Vetter,
Javier Martinez Canillas, Greg Kroah-Hartman
Cc: Linux-Arch, linux-fbdev, linux-ia64, linux-parisc, linux-sh, x86,
linux-kernel, dri-devel, linux-mips, linux-m68k, loongarch,
sparclinux, linux-snps-arc, linuxppc-dev, linux-arm-kernel
In-Reply-To: <5fa98536-a4b0-7b71-7342-9ba05158062f@suse.de>
Hi Thomas,
> Am 17.04.23 um 16:12 schrieb Arnd Bergmann:>> On Mon, Apr 17, 2023, at 14:56, Thomas Zimmermann wrote:
>>> Various architectures provide <asm/fb.h> with helpers for fbdev
>>> framebuffer devices. Share the contained code where possible. There
>>> is already <asm-generic/fb.h>, which implements generic (as in
>>> 'empty') functions of the fbdev helpers. The header was added in
>>> commit aafe4dbed0bf ("asm-generic: add generic versions of common
>>> headers"), but never used.
>>>
>>> Each per-architecture header file declares and/or implements fbdev
>>> helpers and defines a preprocessor token for each. The generic
>>> header then provides the remaining helpers. It works like the I/O
>>> helpers in <asm/io.h>.
>>
>> Looks all good to me,
>>
>> Acked-by: Arnd Bergmann <arnd@arndb.de>
>
> Thanks a lot. I know that Helge wants to test the PARISC changes, so
> I'll keep this series pending for a bit longer. I'd like to merge the
> patches through the DRM tree, if no one objects.
Yes, patch is good and I've tested it on parisc. Thanks!
You may add:
Acked-by: Helge Deller <deller@gmx.de>
to the series and take it through the drm tree.
Helge
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* [PATCH] perf cs-etm: Add support for coresight trace for any range of CPUs
From: Ganapatrao Kulkarni @ 2023-04-19 17:21 UTC (permalink / raw)
To: linux-kernel, coresight, linux-arm-kernel, mike.leach,
suzuki.poulose
Cc: mathieu.poirier, acme, darren, scott, scclevenger, gankulkarni
The current implementation supports coresight trace for a range of
CPUs, if the first CPU is CPU0.
Adding changes to enable coresight trace for any range of CPUs by
decoding the first CPU also from the header.
Later, first CPU id is used instead of CPU0 across the decoder functions.
Signed-off-by: Ganapatrao Kulkarni <gankulkarni@os.amperecomputing.com>
---
.../perf/util/cs-etm-decoder/cs-etm-decoder.c | 4 +-
.../perf/util/cs-etm-decoder/cs-etm-decoder.h | 3 +-
tools/perf/util/cs-etm.c | 62 ++++++++++++-------
3 files changed, 42 insertions(+), 27 deletions(-)
diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
index 82a27ab90c8b..41ab299b643b 100644
--- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
+++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
@@ -724,7 +724,7 @@ cs_etm_decoder__create_etm_decoder(struct cs_etm_decoder_params *d_params,
}
struct cs_etm_decoder *
-cs_etm_decoder__new(int decoders, struct cs_etm_decoder_params *d_params,
+cs_etm_decoder__new(int first_decoder, int decoders, struct cs_etm_decoder_params *d_params,
struct cs_etm_trace_params t_params[])
{
struct cs_etm_decoder *decoder;
@@ -769,7 +769,7 @@ cs_etm_decoder__new(int decoders, struct cs_etm_decoder_params *d_params,
/* init raw frame logging if required */
cs_etm_decoder__init_raw_frame_logging(d_params, decoder);
- for (i = 0; i < decoders; i++) {
+ for (i = first_decoder; i < decoders; i++) {
ret = cs_etm_decoder__create_etm_decoder(d_params,
&t_params[i],
decoder);
diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h
index 92a855fbe5b8..b06193fc75b4 100644
--- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h
+++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h
@@ -90,7 +90,8 @@ int cs_etm_decoder__process_data_block(struct cs_etm_decoder *decoder,
size_t len, size_t *consumed);
struct cs_etm_decoder *
-cs_etm_decoder__new(int num_cpu,
+cs_etm_decoder__new(int first_decoder,
+ int decoders,
struct cs_etm_decoder_params *d_params,
struct cs_etm_trace_params t_params[]);
diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index 94e2d02009eb..2619513ae088 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -55,6 +55,8 @@ struct cs_etm_auxtrace {
u8 has_virtual_ts; /* Virtual/Kernel timestamps in the trace. */
int num_cpu;
+ int first_cpu;
+ int last_cpu;
u64 latest_kernel_timestamp;
u32 auxtrace_type;
u64 branches_sample_type;
@@ -638,14 +640,13 @@ static void cs_etm__set_trace_param_ete(struct cs_etm_trace_params *t_params,
}
static int cs_etm__init_trace_params(struct cs_etm_trace_params *t_params,
- struct cs_etm_auxtrace *etm,
- int decoders)
+ struct cs_etm_auxtrace *etm)
{
int i;
u32 etmidr;
u64 architecture;
- for (i = 0; i < decoders; i++) {
+ for (i = etm->first_cpu; i < etm->last_cpu; i++) {
architecture = etm->metadata[i][CS_ETM_MAGIC];
switch (architecture) {
@@ -817,7 +818,7 @@ static void cs_etm__free(struct perf_session *session)
/* Then the RB tree itself */
intlist__delete(traceid_list);
- for (i = 0; i < aux->num_cpu; i++)
+ for (i = aux->first_cpu; i < aux->last_cpu; i++)
zfree(&aux->metadata[i]);
thread__zput(aux->unknown_thread);
@@ -921,7 +922,8 @@ static struct cs_etm_queue *cs_etm__alloc_queue(struct cs_etm_auxtrace *etm,
* Each queue can only contain data from one CPU when unformatted, so only one decoder is
* needed.
*/
- int decoders = formatted ? etm->num_cpu : 1;
+ int first_decoder = formatted ? etm->first_cpu : 0;
+ int decoders = first_decoder + (formatted ? etm->num_cpu : 1);
etmq = zalloc(sizeof(*etmq));
if (!etmq)
@@ -937,7 +939,7 @@ static struct cs_etm_queue *cs_etm__alloc_queue(struct cs_etm_auxtrace *etm,
if (!t_params)
goto out_free;
- if (cs_etm__init_trace_params(t_params, etm, decoders))
+ if (cs_etm__init_trace_params(t_params, etm))
goto out_free;
/* Set decoder parameters to decode trace packets */
@@ -947,8 +949,7 @@ static struct cs_etm_queue *cs_etm__alloc_queue(struct cs_etm_auxtrace *etm,
formatted))
goto out_free;
- etmq->decoder = cs_etm_decoder__new(decoders, &d_params,
- t_params);
+ etmq->decoder = cs_etm_decoder__new(first_decoder, decoders, &d_params, t_params);
if (!etmq->decoder)
goto out_free;
@@ -2959,11 +2960,11 @@ static int cs_etm__queue_aux_records(struct perf_session *session)
* Loop through the ETMs and complain if we find at least one where ts_source != 1 (virtual
* timestamps).
*/
-static bool cs_etm__has_virtual_ts(u64 **metadata, int num_cpu)
+static bool cs_etm__has_virtual_ts(u64 **metadata, struct cs_etm_auxtrace *etm)
{
int j;
- for (j = 0; j < num_cpu; j++) {
+ for (j = etm->first_cpu; j < etm->last_cpu; j++) {
switch (metadata[j][CS_ETM_MAGIC]) {
case __perf_cs_etmv4_magic:
if (HAS_PARAM(j, ETMV4, TS_SOURCE) || metadata[j][CS_ETMV4_TS_SOURCE] != 1)
@@ -2982,13 +2983,14 @@ static bool cs_etm__has_virtual_ts(u64 **metadata, int num_cpu)
}
/* map trace ids to correct metadata block, from information in metadata */
-static int cs_etm__map_trace_ids_metadata(int num_cpu, u64 **metadata)
+static int cs_etm__map_trace_ids_metadata(struct cs_etm_auxtrace *etm)
{
u64 cs_etm_magic;
+ u64 **metadata = etm->metadata;
u8 trace_chan_id;
int i, err;
- for (i = 0; i < num_cpu; i++) {
+ for (i = etm->first_cpu; i < etm->last_cpu; i++) {
cs_etm_magic = metadata[i][CS_ETM_MAGIC];
switch (cs_etm_magic) {
case __perf_cs_etmv3_magic:
@@ -3015,12 +3017,13 @@ static int cs_etm__map_trace_ids_metadata(int num_cpu, u64 **metadata)
* If we found AUX_HW_ID packets, then set any metadata marked as unused to the
* unused value to reduce the number of unneeded decoders created.
*/
-static int cs_etm__clear_unused_trace_ids_metadata(int num_cpu, u64 **metadata)
+static int cs_etm__clear_unused_trace_ids_metadata(struct cs_etm_auxtrace *etm)
{
u64 cs_etm_magic;
+ u64 **metadata = etm->metadata;
int i;
- for (i = 0; i < num_cpu; i++) {
+ for (i = etm->first_cpu; i < etm->last_cpu; i++) {
cs_etm_magic = metadata[i][CS_ETM_MAGIC];
switch (cs_etm_magic) {
case __perf_cs_etmv3_magic:
@@ -3049,7 +3052,7 @@ int cs_etm__process_auxtrace_info_full(union perf_event *event,
int event_header_size = sizeof(struct perf_event_header);
int total_size = auxtrace_info->header.size;
int priv_size = 0;
- int num_cpu;
+ int num_cpu, first_cpu = 0, last_cpu;
int err = 0;
int aux_hw_id_found;
int i, j;
@@ -3068,22 +3071,31 @@ int cs_etm__process_auxtrace_info_full(union perf_event *event,
/* First the global part */
ptr = (u64 *) auxtrace_info->priv;
num_cpu = ptr[CS_PMU_TYPE_CPUS] & 0xffffffff;
- metadata = zalloc(sizeof(*metadata) * num_cpu);
+
+ /* Start parsing after the common part of the header */
+ i = CS_HEADER_VERSION_MAX;
+
+ /*Get CPU id of first event */
+ first_cpu = ptr[i + CS_ETM_CPU];
+ last_cpu = first_cpu + num_cpu;
+
+ if (first_cpu > cpu__max_cpu().cpu ||
+ last_cpu > cpu__max_cpu().cpu)
+ return -EINVAL;
+
+ metadata = zalloc(sizeof(*metadata) * last_cpu);
if (!metadata) {
err = -ENOMEM;
goto err_free_traceid_list;
}
- /* Start parsing after the common part of the header */
- i = CS_HEADER_VERSION_MAX;
-
/*
* The metadata is stored in the auxtrace_info section and encodes
* the configuration of the ARM embedded trace macrocell which is
* required by the trace decoder to properly decode the trace due
* to its highly compressed nature.
*/
- for (j = 0; j < num_cpu; j++) {
+ for (j = first_cpu; j < last_cpu; j++) {
if (ptr[i] == __perf_cs_etmv3_magic) {
metadata[j] =
cs_etm__create_meta_blk(ptr, &i,
@@ -3145,6 +3157,8 @@ int cs_etm__process_auxtrace_info_full(union perf_event *event,
etm->machine = &session->machines.host;
etm->num_cpu = num_cpu;
+ etm->first_cpu = first_cpu;
+ etm->last_cpu = last_cpu;
etm->pmu_type = (unsigned int) ((ptr[CS_PMU_TYPE_CPUS] >> 32) & 0xffffffff);
etm->snapshot_mode = (ptr[CS_ETM_SNAPSHOT] != 0);
etm->metadata = metadata;
@@ -3152,7 +3166,7 @@ int cs_etm__process_auxtrace_info_full(union perf_event *event,
etm->timeless_decoding = cs_etm__is_timeless_decoding(etm);
/* Use virtual timestamps if all ETMs report ts_source = 1 */
- etm->has_virtual_ts = cs_etm__has_virtual_ts(metadata, num_cpu);
+ etm->has_virtual_ts = cs_etm__has_virtual_ts(metadata, etm);
if (!etm->has_virtual_ts)
ui__warning("Virtual timestamps are not enabled, or not supported by the traced system.\n"
@@ -3232,10 +3246,10 @@ int cs_etm__process_auxtrace_info_full(union perf_event *event,
/* if HW ID found then clear any unused metadata ID values */
if (aux_hw_id_found)
- err = cs_etm__clear_unused_trace_ids_metadata(num_cpu, metadata);
+ err = cs_etm__clear_unused_trace_ids_metadata(etm);
/* otherwise, this is a file with metadata values only, map from metadata */
else
- err = cs_etm__map_trace_ids_metadata(num_cpu, metadata);
+ err = cs_etm__map_trace_ids_metadata(etm);
if (err)
goto err_delete_thread;
@@ -3256,7 +3270,7 @@ int cs_etm__process_auxtrace_info_full(union perf_event *event,
zfree(&etm);
err_free_metadata:
/* No need to check @metadata[j], free(NULL) is supported */
- for (j = 0; j < num_cpu; j++)
+ for (j = first_cpu; j < last_cpu; j++)
zfree(&metadata[j]);
zfree(&metadata);
err_free_traceid_list:
--
2.39.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH] arm64: dts: rockchip: fix nEXTRST on SOQuartz
From: Nicolas Frattaroli @ 2023-04-19 17:17 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Heiko Stuebner, Peter Geis
Cc: Nicolas Frattaroli, devicetree, linux-arm-kernel, linux-rockchip,
linux-kernel
In pre-production prototypes (of which I only know one person
having one, Peter Geis), GPIO0 pin A5 was tied to the SDMMC
power enable pin on the CM4 connector. On all production models,
this is not the case; instead, this pin is used for the nEXTRST
signal, and the SDMMC power enable pin is always pulled high.
Since everyone currently using the SOQuartz device trees will
want this change, it is made to the tree without splitting the
trees into two separate ones of which users will then inevitably
choose the wrong one.
This fixes USB and PCIe on a wide variety of CM4IO-compatible
boards which either rely on the 3.3V being there or use the
nEXTRST signal.
Fixes: 5859b5a9c3ac ("arm64: dts: rockchip: add SoQuartz CM4IO dts")
Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
---
.../boot/dts/rockchip/rk3566-soquartz-cm4.dts | 18 +++++++------
.../boot/dts/rockchip/rk3566-soquartz.dtsi | 25 ++++++++++---------
2 files changed, 24 insertions(+), 19 deletions(-)
diff --git a/arch/arm64/boot/dts/rockchip/rk3566-soquartz-cm4.dts b/arch/arm64/boot/dts/rockchip/rk3566-soquartz-cm4.dts
index 263ce40770dd..cddf6cd2fecb 100644
--- a/arch/arm64/boot/dts/rockchip/rk3566-soquartz-cm4.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3566-soquartz-cm4.dts
@@ -28,6 +28,16 @@ vcc_5v: vcc-5v-regulator {
regulator-max-microvolt = <5000000>;
vin-supply = <&vcc12v_dcin>;
};
+
+ vcc_sd_pwr: vcc-sd-pwr-regulator {
+ compatible = "regulator-fixed";
+ regulator-name = "vcc_sd_pwr";
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ vin-supply = <&vcc3v3_sys>;
+ };
};
/* phy for pcie */
@@ -130,13 +140,7 @@ &saradc {
};
&sdmmc0 {
- vmmc-supply = <&sdmmc_pwr>;
- status = "okay";
-};
-
-&sdmmc_pwr {
- regulator-min-microvolt = <3300000>;
- regulator-max-microvolt = <3300000>;
+ vmmc-supply = <&vcc_sd_pwr>;
status = "okay";
};
diff --git a/arch/arm64/boot/dts/rockchip/rk3566-soquartz.dtsi b/arch/arm64/boot/dts/rockchip/rk3566-soquartz.dtsi
index ce7165d7f1a1..f589a4fdaccb 100644
--- a/arch/arm64/boot/dts/rockchip/rk3566-soquartz.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3566-soquartz.dtsi
@@ -65,6 +65,17 @@ led_work: led-work {
};
};
+ nextrst_pin: nextrst-pin-regulator {
+ compatible = "regulator-fixed";
+ enable-active-high;
+ gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&nextrst_h>;
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-name = "nextrst";
+ };
+
sdio_pwrseq: sdio-pwrseq {
status = "okay";
compatible = "mmc-pwrseq-simple";
@@ -104,16 +115,6 @@ vcc3v3_sys: vcc3v3-sys-regulator {
regulator-max-microvolt = <3300000>;
vin-supply = <&vcc5v0_sys>;
};
-
- sdmmc_pwr: sdmmc-pwr-regulator {
- compatible = "regulator-fixed";
- enable-active-high;
- gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>;
- pinctrl-names = "default";
- pinctrl-0 = <&sdmmc_pwr_h>;
- regulator-name = "sdmmc_pwr";
- status = "disabled";
- };
};
&cpu0 {
@@ -539,8 +540,8 @@ wifi_enable_h: wifi-enable-h {
};
};
- sdmmc-pwr {
- sdmmc_pwr_h: sdmmc-pwr-h {
+ nextrst {
+ nextrst_h: nextrst-h {
rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>;
};
};
--
2.40.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* Re: [RFC PATCH 1/2] arm64: amlogic: add new ARCH_AMLIPC for IPC SoC
From: Dmitry Rokosov @ 2023-04-19 17:00 UTC (permalink / raw)
To: Neil Armstrong
Cc: =Xianwei Zhao, linux-arm-kernel, linux-kernel, linux-amlogic,
devicetree, Catalin Marinas, Will Deacon, Kevin Hilman,
Rob Herring, Krzysztof Kozlowski
In-Reply-To: <427e79ef-156d-027e-9296-6f4e6513a04d@linaro.org>
On Wed, Apr 19, 2023 at 06:25:07PM +0200, Neil Armstrong wrote:
> On 19/04/2023 18:04, Dmitry Rokosov wrote:
> > On Wed, Apr 19, 2023 at 03:43:12PM +0200, Neil Armstrong wrote:
> > > On 19/04/2023 15:14, Dmitry Rokosov wrote:
> > > > On Wed, Apr 19, 2023 at 03:38:33PM +0800, =Xianwei Zhao wrote:
> > > > > From: Xianwei Zhao <xianwei.zhao@amlogic.com>
> > > > >
> > > > > The C series SoCs are designed for smart IP camera
> > > > > applications, which does not belong to Meson series.
> > > > > So, Add ARCH_AMLIPC for the new series.
> > > > >
> > > > > There are now multiple amlogic SoC seies supported, so group them under
> > > > > their own menu. we can easily add new platforms there in the future.
> > > > > Introduce ARCH_AMLOGIC to cover all Amlogic SoC series.
> > > > >
> > > > > No functional changes introduced.
> > > > >
> > > > > Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
> > > > > ---
> > > > > arch/arm64/Kconfig.platforms | 12 ++++++++++++
> > > > > arch/arm64/configs/defconfig | 2 ++
> > > > > 2 files changed, 14 insertions(+)
> > > > >
> > > > > diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms
> > > > > index 89a0b13b058d..bfbc817eef8f 100644
> > > > > --- a/arch/arm64/Kconfig.platforms
> > > > > +++ b/arch/arm64/Kconfig.platforms
> > > > > @@ -162,12 +162,24 @@ config ARCH_MEDIATEK
> > > > > This enables support for MediaTek MT27xx, MT65xx, MT76xx
> > > > > & MT81xx ARMv8 SoCs
> > > > > +menuconfig ARCH_AMLOGIC
> > > > > + bool "NXP SoC support"
> > > >
> > > > NXP? Did you mean "Amlogic"?
> > > >
> > > > > +
> > > > > +if ARCH_AMLOGIC
> > > > > +
> > > > > config ARCH_MESON
> > > > > bool "Amlogic Platforms"
> > > > > help
> > > > > This enables support for the arm64 based Amlogic SoCs
> > > > > such as the s905, S905X/D, S912, A113X/D or S905X/D2
> > > > > +config ARCH_AMLIPC
> > > >
> > > > Do we really need a different ARCH for Amlogic IPC?
> > > > I can imagine that it's not the Meson architecture at all.
> > > > But maybe a better solution is just to rename ARCH_MESON to ARCH_AMLOGIC?
> > >
> > > It should be changed treewide, and is it worth it ?
> >
> > As far as I understand, the A1 and S4 families are not fully compatible
> > with the Meson architecture, and we haven't provided additional ARCH_*
> > for them.
>
> The GXBB, GXL/GXM, G12A, G12B & SM1 are also not fully compatible,
> but they lie under the "MESON" umbrella which covers SoC since the
> Meson6 architecture. It's a facility to include/exclude Amlogic
> drivers/DT, nothing else.
>
> If you compare it to BCM or NXP, it's different situation, the
> different ARCH_* actually targets totally different SoCs from
> completely different Business Units or from companies acquisitions.
>
> We should have named it ARCH_AMLOGIC since the beginning, but we
> can't change history.
>
> > In my opinion, it's a good time to split the Meson architecture into
> > proper subsets, or rename it treewide (maybe only config option
> > ARCH_MESON => ARCH_AMLOGIC).
>
> MESON is only a codename to differentiate from other SoC vendors
> because Amlogic used it as a codename for a long time.
> Compare this to Allwinner's "sunxi" or Qualcomm's "msm".
>
> This config has no functional mean, it's only a config namespace.
>
> Renaming it would need renaming it in all subsystems Kconfig/Makefiles
> and will certainly break builds with custom kernel configs
> in various publicly used builds like Armbian, meta-meson, LibreELEC,
> Debian, Suse, ...
>
> So it's pointless to change, and even add a different one since
> it's not a family differentiator since the Kernel is modular
> and works around DT to determine which drivers to probe.
>
> Neil
>
Thank you for the detailed explanation; it makes sense!
Actually, I disagree with creating a separate ARCH without first reworking
all of its subsets - that's why I started this discussion.
Now, I see that you share my perspective and believe that C3
should be added to the ARCH_MESON subset, so I have no objections.
[...]
--
Thank you,
Dmitry
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* [PATCH v3 2/3] PCI: brcmstb: Configure HW CLKREQ# mode appropriate for downstream device
From: Jim Quinlan @ 2023-04-19 16:57 UTC (permalink / raw)
To: linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, Cyril Brulebois, Phil Elwell,
bcm-kernel-feedback-list, jim2101024, james.quinlan
Cc: Florian Fainelli, Lorenzo Pieralisi, Krzysztof Wilczyński,
Rob Herring,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list
In-Reply-To: <20230419165721.29533-1-jim2101024@gmail.com>
The Broadcom STB/CM PCIe HW core, which is also used in RPi SOCs, must be
deliberately set by the RC probe() into one of three mutually exclusive
modes:
(a) No CLKREQ# expected or required, refclk is always available.
(b) CLKREQ# is expected to be driven by downstream device when needed.
(c) Bidirectional CLKREQ# for L1SS capable devices.
Previously, only (b) was supported by the driver, as almost all STB/CM
boards operate in this mode. But now there is interest in activating L1SS
power savings from STB/CM customers, and also interest in accommodating
mode (a) for designs such as the RPi CM4 with IO board.
The HW+driver is able to tell us when mode (a) or (b) is needed. All
devices should be functional using the RC-driver selected (a) or (b) mode.
For those with L1SS-capable devices that desire the power savings that come
with mode (c) we rely on the DT prop "brcm,enable-l1ss". It would be nice
to do this automatically but there is no easy way to determine this at the
time the PCI RC driver executes its probe(). Using this mode only makes
sense when the downstream device is L1SS-capable and the OS has been
configured to activate L1SS (e.g. policy==powersupersave).
The "brcm,enable-l1ss" property has already been in use by Raspian Linux,
but this implementation adds more details and discerns between (a) and (b)
automatically.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=217276
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jim Quinlan <jim2101024@gmail.com>
---
drivers/pci/controller/pcie-brcmstb.c | 69 +++++++++++++++++++++++----
1 file changed, 59 insertions(+), 10 deletions(-)
diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
index edf283e2b5dd..c4b076ea5180 100644
--- a/drivers/pci/controller/pcie-brcmstb.c
+++ b/drivers/pci/controller/pcie-brcmstb.c
@@ -48,10 +48,17 @@
#define PCIE_RC_CFG_PRIV1_LINK_CAPABILITY 0x04dc
#define PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK 0xc00
+#define PCIE_RC_CFG_PRIV1_ROOT_CAP 0x4f8
+#define PCIE_RC_CFG_PRIV1_ROOT_CAP_L1SS_MODE_MASK 0xf8
+
#define PCIE_RC_DL_MDIO_ADDR 0x1100
#define PCIE_RC_DL_MDIO_WR_DATA 0x1104
#define PCIE_RC_DL_MDIO_RD_DATA 0x1108
+#define PCIE_0_RC_PL_PHY_DBG_CLKREQ2_0 0x1e30
+#define CLKREQ2_0_CLKREQ_IN_CNT_MASK 0x3f000000
+#define CLKREQ2_0_CLKREQ_IN_MASK 0x40000000
+
#define PCIE_MISC_MISC_CTRL 0x4008
#define PCIE_MISC_MISC_CTRL_PCIE_RCB_64B_MODE_MASK 0x80
#define PCIE_MISC_MISC_CTRL_PCIE_RCB_MPS_MODE_MASK 0x400
@@ -121,9 +128,12 @@
#define PCIE_MISC_HARD_PCIE_HARD_DEBUG 0x4204
#define PCIE_MISC_HARD_PCIE_HARD_DEBUG_CLKREQ_DEBUG_ENABLE_MASK 0x2
+#define PCIE_MISC_HARD_PCIE_HARD_DEBUG_L1SS_ENABLE_MASK 0x200000
#define PCIE_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK 0x08000000
#define PCIE_BMIPS_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK 0x00800000
-
+#define PCIE_CLKREQ_MASK \
+ (PCIE_MISC_HARD_PCIE_HARD_DEBUG_CLKREQ_DEBUG_ENABLE_MASK | \
+ PCIE_MISC_HARD_PCIE_HARD_DEBUG_L1SS_ENABLE_MASK)
#define PCIE_INTR2_CPU_BASE 0x4300
#define PCIE_MSI_INTR2_BASE 0x4500
@@ -1024,13 +1034,58 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie)
return 0;
}
+static void brcm_config_clkreq(struct brcm_pcie *pcie)
+{
+ bool l1ss = of_property_read_bool(pcie->np, "brcm,enable-l1ss");
+ void __iomem *base = pcie->base;
+ u32 clkreq_set, tmp = readl(base + PCIE_0_RC_PL_PHY_DBG_CLKREQ2_0);
+ bool clkreq_in_seen;
+
+ /*
+ * We have "seen" CLKREQ# if it is asserted or has been in the past.
+ * Note that the CLKREQ_IN_MASK is 1 if CLKREQ# is asserted.
+ */
+ clkreq_in_seen = !!(tmp & CLKREQ2_0_CLKREQ_IN_MASK) ||
+ !!FIELD_GET(CLKREQ2_0_CLKREQ_IN_CNT_MASK, tmp);
+
+ /* Start with safest setting where we provide refclk regardless */
+ clkreq_set = readl(pcie->base + PCIE_MISC_HARD_PCIE_HARD_DEBUG) &
+ ~PCIE_CLKREQ_MASK;
+
+ if (l1ss && IS_ENABLED(CONFIG_PCIEASPM)) {
+ /*
+ * Note: For boards using a mini-card connector, this mode
+ * may not meet the TCRLon maximum time of 400ns, as
+ * specified in 3.2.5.2.5 of the PCI Express Mini CEM 2.0
+ * specification.
+ */
+ clkreq_set |= PCIE_MISC_HARD_PCIE_HARD_DEBUG_L1SS_ENABLE_MASK;
+ dev_info(pcie->dev, "bi-dir CLKREQ# for L1SS power savings");
+ } else {
+ if (clkreq_in_seen && IS_ENABLED(CONFIG_PCIEASPM)) {
+ clkreq_set |= PCIE_MISC_HARD_PCIE_HARD_DEBUG_CLKREQ_DEBUG_ENABLE_MASK;
+ dev_info(pcie->dev, "uni-dir CLKREQ# for L0s, L1 ASPM\n");
+ } else {
+ dev_info(pcie->dev, "CLKREQ# ignored; no ASPM\n");
+ /* Might as well unadvertise ASPM */
+ tmp = readl(base + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY) &
+ ~PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK;
+ writel(tmp, base + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY);
+ }
+ /* Setting the field to 2 unadvertises L1SS support */
+ tmp = readl(base + PCIE_RC_CFG_PRIV1_ROOT_CAP);
+ u32p_replace_bits(&tmp, 2, PCIE_RC_CFG_PRIV1_ROOT_CAP_L1SS_MODE_MASK);
+ writel(tmp, base + PCIE_RC_CFG_PRIV1_ROOT_CAP);
+ }
+ writel(clkreq_set, pcie->base + PCIE_MISC_HARD_PCIE_HARD_DEBUG);
+}
+
static int brcm_pcie_start_link(struct brcm_pcie *pcie)
{
struct device *dev = pcie->dev;
void __iomem *base = pcie->base;
u16 nlw, cls, lnksta;
bool ssc_good = false;
- u32 tmp;
int ret, i;
/* Unassert the fundamental reset */
@@ -1055,6 +1110,8 @@ static int brcm_pcie_start_link(struct brcm_pcie *pcie)
return -ENODEV;
}
+ brcm_config_clkreq(pcie);
+
if (pcie->gen)
brcm_pcie_set_gen(pcie, pcie->gen);
@@ -1073,14 +1130,6 @@ static int brcm_pcie_start_link(struct brcm_pcie *pcie)
pci_speed_string(pcie_link_speed[cls]), nlw,
ssc_good ? "(SSC)" : "(!SSC)");
- /*
- * Refclk from RC should be gated with CLKREQ# input when ASPM L0s,L1
- * is enabled => setting the CLKREQ_DEBUG_ENABLE field to 1.
- */
- tmp = readl(base + PCIE_MISC_HARD_PCIE_HARD_DEBUG);
- tmp |= PCIE_MISC_HARD_PCIE_HARD_DEBUG_CLKREQ_DEBUG_ENABLE_MASK;
- writel(tmp, base + PCIE_MISC_HARD_PCIE_HARD_DEBUG);
-
return 0;
}
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH v3 1/3] dt-bindings: PCI: brcmstb: brcm,{enable-l1ss,completion-timeout-us} props
From: Jim Quinlan @ 2023-04-19 16:57 UTC (permalink / raw)
To: linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, Cyril Brulebois, Phil Elwell,
bcm-kernel-feedback-list, jim2101024, james.quinlan
Cc: Florian Fainelli, Lorenzo Pieralisi, Krzysztof Wilczyński,
Rob Herring, Krzysztof Kozlowski,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list
In-Reply-To: <20230419165721.29533-1-jim2101024@gmail.com>
This commit introduces two new properties:
brcm,enable-l1ss (bool):
The Broadcom STB/CM PCIe HW -- a core that is also used by RPi SOCs --
requires the driver probe() to deliberately place the HW one of three
CLKREQ# modes:
(a) CLKREQ# driven by the RC unconditionally
(b) CLKREQ# driven by the EP for ASPM L0s, L1
(c) Bidirectional CLKREQ#, as used for L1 Substates (L1SS).
The HW+driver can tell the difference between downstream devices that
need (a) and (b), but does not know when to configure (c). All devices
should work fine when the driver chooses (a) or (b), but (c) may be
desired to realize the extra power savings that L1SS offers. So we
introduce the boolean "brcm,enable-l1ss" property to inform the driver
that (c) is desired. Setting this property only makes sense when the
downstream device is L1SS-capable and the OS is configured to activate
this mode (e.g. policy==superpowersave).
This property is already present in the Raspian version of Linux, but the
upstream driver implementaion that follows adds more details and discerns
between (a) and (b).
brcm,completion-timeout-us (u32):
Our HW will cause a CPU abort on any PCI transaction completion abort
error. It makes sense then to increase the timeout value for this type
of error in hopes that the response is merely delayed. Further,
L1SS-capable devices may have a long L1SS exit time and may require a
custom timeout value: we've been asked by our customers to make this
configurable for just this reason.
Signed-off-by: Jim Quinlan <jim2101024@gmail.com>
---
.../devicetree/bindings/pci/brcm,stb-pcie.yaml | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml
index 7e15aae7d69e..239cc95545bd 100644
--- a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml
+++ b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml
@@ -64,6 +64,22 @@ properties:
aspm-no-l0s: true
+ brcm,enable-l1ss:
+ description: Indicates that PCIe L1SS power savings
+ are desired, the downstream device is L1SS-capable, and the
+ OS has been configured to enable this mode. For boards
+ using a mini-card connector, this mode may not meet the
+ TCRLon maximum time of 400ns, as specified in 3.2.5.2.5
+ of the PCI Express Mini CEM 2.0 specification.
+ type: boolean
+
+ brcm,completion-timeout-us:
+ description: Number of microseconds before PCI transaction
+ completion timeout abort is signalled.
+ minimum: 16
+ default: 1000000
+ maximum: 19884107
+
brcm,scb-sizes:
description: u64 giving the 64bit PCIe memory
viewport size of a memory controller. There may be up to
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH v3 3/3] PCI: brcmstb: Set PCIe transaction completion timeout
From: Jim Quinlan @ 2023-04-19 16:57 UTC (permalink / raw)
To: linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, Cyril Brulebois, Phil Elwell,
bcm-kernel-feedback-list, jim2101024, james.quinlan
Cc: Florian Fainelli, Lorenzo Pieralisi, Krzysztof Wilczyński,
Rob Herring,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list
In-Reply-To: <20230419165721.29533-1-jim2101024@gmail.com>
Since the STB PCIe HW will cause a CPU abort on a PCIe transaction
completion timeout abort, we might as well extend the default timeout
limit. Further, different devices and systems may requires a larger or
smaller amount commensurate with their L1SS exit time, so the property
"brcm,completion-timeout-us" may be used to set a custom timeout value.
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jim Quinlan <jim2101024@gmail.com>
---
drivers/pci/controller/pcie-brcmstb.c | 30 +++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
index c4b076ea5180..c2cb683447ac 100644
--- a/drivers/pci/controller/pcie-brcmstb.c
+++ b/drivers/pci/controller/pcie-brcmstb.c
@@ -1080,6 +1080,35 @@ static void brcm_config_clkreq(struct brcm_pcie *pcie)
writel(clkreq_set, pcie->base + PCIE_MISC_HARD_PCIE_HARD_DEBUG);
}
+static void brcm_config_completion_timeout(struct brcm_pcie *pcie)
+{
+ /* TIMEOUT register is two registers before RGR1_SW_INIT_1 */
+ const char *fmt = "brcm,completion-timeout-us clamped to region [%u..%u]\n";
+ const unsigned int REG_OFFSET = PCIE_RGR1_SW_INIT_1(pcie) - 8;
+ const u32 timeout_us_min = 16;
+ const u32 timeout_us_max = 19884107;
+ u32 timeout_us = 1000000; /* Our default, 1 second */
+ int rval, ret;
+
+ ret = of_property_read_u32(pcie->np, "brcm,completion-timeout-us",
+ &timeout_us);
+ if (ret && ret != -EINVAL)
+ dev_err(pcie->dev, "malformed/invalid 'brcm,completion-timeout-us'\n");
+
+ /* If needed, clamp the requested timeout value and issue a warning */
+ if (timeout_us < timeout_us_min) {
+ timeout_us = timeout_us_min;
+ dev_warn(pcie->dev, fmt, timeout_us_min, timeout_us_max);
+ } else if (timeout_us > timeout_us_max) {
+ timeout_us = timeout_us_max;
+ dev_warn(pcie->dev, fmt, timeout_us_min, timeout_us_max);
+ }
+
+ /* Each unit in timeout register is 1/216,000,000 seconds */
+ rval = 216 * timeout_us;
+ writel(rval, pcie->base + REG_OFFSET);
+}
+
static int brcm_pcie_start_link(struct brcm_pcie *pcie)
{
struct device *dev = pcie->dev;
@@ -1110,6 +1139,7 @@ static int brcm_pcie_start_link(struct brcm_pcie *pcie)
return -ENODEV;
}
+ brcm_config_completion_timeout(pcie);
brcm_config_clkreq(pcie);
if (pcie->gen)
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH v3 0/3] PCI: brcmstb: Configure appropriate HW CLKREQ# mode
From: Jim Quinlan @ 2023-04-19 16:57 UTC (permalink / raw)
To: linux-pci, Nicolas Saenz Julienne, Bjorn Helgaas,
Lorenzo Pieralisi, Cyril Brulebois, Phil Elwell,
bcm-kernel-feedback-list, jim2101024, james.quinlan
Cc: Krzysztof Wilczyński, Florian Fainelli, Krzysztof Kozlowski,
Lorenzo Pieralisi, Rob Herring,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE
Note: (a) With this series, all downstream devices should work w/o DT changes.
Only if the user desires L1SS savings and has an L1SS-capable
device is a DT change required (brcm,enable-l1ss).
(b) No code changes between V2->V3 except to remove a dev_info()
and change the string of another dev_info().
v3 -- Rewrote commit msgs and comments refering panics if L1SS
is enabled/disabled; the code snippet that unadvertises L1SS
eliminates the panic scenario. (Bjorn)
-- Add reference for "400ns of CLKREQ# assertion" blurb (Bjorn)
-- Put binding names in DT commit Subject (Bjorn)
-- Add a verb to a commit's subject line (Bjorn)
-- s/accomodat(\w+)/accommodat$1/g (Bjorn)
-- Rewrote commit msgs and comments refering panics if L1SS
is enabled/disabled; the code snippet that unadvertises L1SS
eliminates the panic scenario. (Bjorn)
v2 -- Changed binding property 'brcm,completion-timeout-msec' to
'brcm,completion-timeout-us'. (StefanW for standard suffix).
-- Warn when clamping timeout value, and include clamped
region in message. Also add min and max in YAML. (StefanW)
-- Qualify description of "brcm,completion-timeout-us" so that
it refers to PCIe transactions. (StefanW)
-- Remvove mention of Linux specifics in binding description. (StefanW)
-- s/clkreq#/CLKREQ#/g (Bjorn)
-- Refactor completion-timeout-us code to compare max and min to
value given by the property (as opposed to the computed value).
v1 -- The current driver assumes the downstream devices can
provide CLKREQ# for ASPM. These commits accomodate devices
w/ or w/o clkreq# and also handle L1SS-capable devices.
-- The Raspian Linux folks have already been using a PCIe RC
property "brcm,enable-l1ss". These commits use the same
property, in a backward-compatible manner, and the implementaion
adds more detail and also automatically identifies devices w/o
a clkreq# signal, i.e. most devices plugged into an RPi CM4
IO board.
Jim Quinlan (3):
dt-bindings: PCI: brcmstb: brcm,{enable-l1ss,completion-timeout-us}
props
PCI: brcmstb: Configure HW CLKREQ# mode appropriate for downstream
device
PCI: brcmstb: Set PCIe transaction completion timeout
.../bindings/pci/brcm,stb-pcie.yaml | 16 +++
drivers/pci/controller/pcie-brcmstb.c | 99 +++++++++++++++++--
2 files changed, 105 insertions(+), 10 deletions(-)
base-commit: 76f598ba7d8e2bfb4855b5298caedd5af0c374a8
prerequisite-patch-id: f38de8681d8746126d60b3430eaf218d2dd169cd
prerequisite-patch-id: 23e13189f200358976abf5bf3600973a20cf386c
prerequisite-patch-id: edfbe6ea39ed6a4937e2cec3bb8ee0e60091546d
prerequisite-patch-id: c87dd155e8506a2a277726c47d85bf3fa83727d5
prerequisite-patch-id: 579841e1dc179517506a7a7c42e0e651b3bc3649
prerequisite-patch-id: b5b079998ea451821edffd7c52cd3d89d06046a1
prerequisite-patch-id: b51b3918e554e279b2ace1f68ed6b4176f8ccc24
prerequisite-patch-id: 333e5188fb27d0ed010f5359e83e539172a67690
prerequisite-patch-id: bb107ee7b4811a9719508ea667cad2466933dec0
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* [PATCH v3 2/2] PCI: layerscape: Add power management support for ls1028a
From: Frank Li @ 2023-04-19 16:41 UTC (permalink / raw)
To: helgaas
Cc: imx, bhelgaas, devicetree, frank.li, gustavo.pimentel, kw,
leoyang.li, linux-arm-kernel, linux-imx, linux-kernel, linux-pci,
lorenzo.pieralisi, minghuan.lian, mingkai.hu, robh+dt, roy.zang,
shawnguo, zhiqiang.hou
In-Reply-To: <20230419164118.596300-1-Frank.Li@nxp.com>
From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Add PME_Turn_Off/PME_TO_Ack handshake sequence, and finally
put the PCIe controller into D3 state after the L2/L3 ready
state transition process completion.
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
- Basic rewrite whole patch according rob herry suggestion.
put common function into dwc, so more soc can share the same logic.
drivers/pci/controller/dwc/pci-layerscape.c | 148 ++++++++++++++++++--
1 file changed, 139 insertions(+), 9 deletions(-)
diff --git a/drivers/pci/controller/dwc/pci-layerscape.c b/drivers/pci/controller/dwc/pci-layerscape.c
index ed5fb492fe08..32832d74a074 100644
--- a/drivers/pci/controller/dwc/pci-layerscape.c
+++ b/drivers/pci/controller/dwc/pci-layerscape.c
@@ -8,9 +8,11 @@
* Author: Minghuan Lian <Minghuan.Lian@freescale.com>
*/
+#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/interrupt.h>
#include <linux/init.h>
+#include <linux/iopoll.h>
#include <linux/of_pci.h>
#include <linux/of_platform.h>
#include <linux/of_address.h>
@@ -27,12 +29,33 @@
#define PCIE_ABSERR 0x8d0 /* Bridge Slave Error Response Register */
#define PCIE_ABSERR_SETTING 0x9401 /* Forward error of non-posted request */
+/* PF Message Command Register */
+#define LS_PCIE_PF_MCR 0x2c
+#define PF_MCR_PTOMR BIT(0)
+#define PF_MCR_EXL2S BIT(1)
+
#define PCIE_IATU_NUM 6
+struct ls_pcie;
+
+struct ls_pcie_drvdata {
+ const u32 pf_off;
+ const u32 lut_off;
+ bool pm_support;
+};
+
struct ls_pcie {
struct dw_pcie *pci;
+ const struct ls_pcie_drvdata *drvdata;
+ void __iomem *pf_base;
+ void __iomem *lut_base;
+ bool big_endian;
+ bool ep_presence;
+ struct regmap *scfg;
+ int index;
};
+#define ls_pcie_pf_readl_addr(addr) ls_pcie_pf_readl(pcie, addr)
#define to_ls_pcie(x) dev_get_drvdata((x)->dev)
static bool ls_pcie_is_bridge(struct ls_pcie *pcie)
@@ -73,6 +96,57 @@ static void ls_pcie_fix_error_response(struct ls_pcie *pcie)
iowrite32(PCIE_ABSERR_SETTING, pci->dbi_base + PCIE_ABSERR);
}
+static u32 ls_pcie_pf_readl(struct ls_pcie *pcie, u32 off)
+{
+ if (pcie->big_endian)
+ return ioread32be(pcie->pf_base + off);
+
+ return ioread32(pcie->pf_base + off);
+}
+
+static void ls_pcie_pf_writel(struct ls_pcie *pcie, u32 off, u32 val)
+{
+ if (pcie->big_endian)
+ return iowrite32be(val, pcie->pf_base + off);
+
+ return iowrite32(val, pcie->pf_base + off);
+
+}
+
+static void ls_pcie_send_turnoff_msg(struct dw_pcie_rp *pp)
+{
+ struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
+ struct ls_pcie *pcie = to_ls_pcie(pci);
+ u32 val;
+ int ret;
+
+ val = ls_pcie_pf_readl(pcie, LS_PCIE_PF_MCR);
+ val |= PF_MCR_PTOMR;
+ ls_pcie_pf_writel(pcie, LS_PCIE_PF_MCR, val);
+
+ ret = readx_poll_timeout(ls_pcie_pf_readl_addr, LS_PCIE_PF_MCR,
+ val, !(val & PF_MCR_PTOMR), 100, 10000);
+ if (ret)
+ dev_info(pcie->pci->dev, "poll turn off message timeout\n");
+}
+
+static void ls_pcie_exit_from_l2(struct dw_pcie_rp *pp)
+{
+ struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
+ struct ls_pcie *pcie = to_ls_pcie(pci);
+ u32 val;
+ int ret;
+
+ val = ls_pcie_pf_readl(pcie, LS_PCIE_PF_MCR);
+ val |= PF_MCR_EXL2S;
+ ls_pcie_pf_writel(pcie, LS_PCIE_PF_MCR, val);
+
+ ret = readx_poll_timeout(ls_pcie_pf_readl_addr, LS_PCIE_PF_MCR,
+ val, !(val & PF_MCR_EXL2S), 100, 10000);
+ if (ret)
+ dev_info(pcie->pci->dev, "poll exit L2 state timeout\n");
+}
+
static int ls_pcie_host_init(struct dw_pcie_rp *pp)
{
struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
@@ -91,18 +165,33 @@ static int ls_pcie_host_init(struct dw_pcie_rp *pp)
static const struct dw_pcie_host_ops ls_pcie_host_ops = {
.host_init = ls_pcie_host_init,
+ .pme_turn_off = ls_pcie_send_turnoff_msg,
+ .exit_from_l2 = ls_pcie_exit_from_l2,
+};
+
+static const struct ls_pcie_drvdata ls1021a_drvdata = {
+};
+
+static const struct ls_pcie_drvdata ls1043a_drvdata = {
+ .lut_off = 0x10000,
+};
+
+static const struct ls_pcie_drvdata layerscape_drvdata = {
+ .lut_off = 0x80000,
+ .pf_off = 0xc0000,
+ .pm_support = true,
};
static const struct of_device_id ls_pcie_of_match[] = {
- { .compatible = "fsl,ls1012a-pcie", },
- { .compatible = "fsl,ls1021a-pcie", },
- { .compatible = "fsl,ls1028a-pcie", },
- { .compatible = "fsl,ls1043a-pcie", },
- { .compatible = "fsl,ls1046a-pcie", },
- { .compatible = "fsl,ls2080a-pcie", },
- { .compatible = "fsl,ls2085a-pcie", },
- { .compatible = "fsl,ls2088a-pcie", },
- { .compatible = "fsl,ls1088a-pcie", },
+ { .compatible = "fsl,ls1012a-pcie", .data = &layerscape_drvdata },
+ { .compatible = "fsl,ls1021a-pcie", .data = &ls1021a_drvdata },
+ { .compatible = "fsl,ls1028a-pcie", .data = &layerscape_drvdata },
+ { .compatible = "fsl,ls1043a-pcie", .data = &ls1043a_drvdata },
+ { .compatible = "fsl,ls1046a-pcie", .data = &layerscape_drvdata },
+ { .compatible = "fsl,ls2080a-pcie", .data = &layerscape_drvdata },
+ { .compatible = "fsl,ls2085a-pcie", .data = &layerscape_drvdata },
+ { .compatible = "fsl,ls2088a-pcie", .data = &layerscape_drvdata },
+ { .compatible = "fsl,ls1088a-pcie", .data = &layerscape_drvdata },
{ },
};
@@ -121,6 +210,8 @@ static int ls_pcie_probe(struct platform_device *pdev)
if (!pci)
return -ENOMEM;
+ pcie->drvdata = of_device_get_match_data(dev);
+
pci->dev = dev;
pci->pp.ops = &ls_pcie_host_ops;
@@ -131,6 +222,14 @@ static int ls_pcie_probe(struct platform_device *pdev)
if (IS_ERR(pci->dbi_base))
return PTR_ERR(pci->dbi_base);
+ pcie->big_endian = of_property_read_bool(dev->of_node, "big-endian");
+
+ if (pcie->drvdata->lut_off)
+ pcie->lut_base = pci->dbi_base + pcie->drvdata->lut_off;
+
+ if (pcie->drvdata->pf_off)
+ pcie->pf_base = pci->dbi_base + pcie->drvdata->pf_off;
+
if (!ls_pcie_is_bridge(pcie))
return -ENODEV;
@@ -139,12 +238,43 @@ static int ls_pcie_probe(struct platform_device *pdev)
return dw_pcie_host_init(&pci->pp);
}
+#ifdef CONFIG_PM_SLEEP
+static int ls_pcie_suspend_noirq(struct device *dev)
+{
+ struct ls_pcie *pcie = dev_get_drvdata(dev);
+ struct dw_pcie *pci = pcie->pci;
+
+ if (!pcie->drvdata->pm_support)
+ return 0;
+
+ return dw_pcie_suspend_noirq(pci);
+}
+
+static int ls_pcie_resume_noirq(struct device *dev)
+{
+
+ struct ls_pcie *pcie = dev_get_drvdata(dev);
+ struct dw_pcie *pci = pcie->pci;
+
+ if (!pcie->drvdata->pm_support)
+ return 0;
+
+ return dw_pcie_resume_noirq(pci);
+}
+#endif /* CONFIG_PM_SLEEP */
+
+static const struct dev_pm_ops ls_pcie_pm_ops = {
+ SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(ls_pcie_suspend_noirq,
+ ls_pcie_resume_noirq)
+};
+
static struct platform_driver ls_pcie_driver = {
.probe = ls_pcie_probe,
.driver = {
.name = "layerscape-pcie",
.of_match_table = ls_pcie_of_match,
.suppress_bind_attrs = true,
+ .pm = &ls_pcie_pm_ops,
},
};
builtin_platform_driver(ls_pcie_driver);
--
2.34.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH v3 1/2] PCI: dwc: Implement general suspend/resume functionality for L2/L3 transitions
From: Frank Li @ 2023-04-19 16:41 UTC (permalink / raw)
To: helgaas
Cc: imx, bhelgaas, devicetree, frank.li, gustavo.pimentel, kw,
leoyang.li, linux-arm-kernel, linux-imx, linux-kernel, linux-pci,
lorenzo.pieralisi, minghuan.lian, mingkai.hu, robh+dt, roy.zang,
shawnguo, zhiqiang.hou
Introduced helper function dw_pcie_get_ltssm to retrieve SMLH_LTSS_STATE.
Added API pme_turn_off and exit_from_l2 for managing L2/L3 state transitions.
Typical L2 entry workflow:
1. Transmit PME turn off signal to PCI devices.
2. Await link entering L2_IDLE state.
3. Transition Root complex to D3 state.
Typical L2 exit workflow:
1. Transition Root complex to D0 state.
2. Issue exit from L2 command.
3. Reinitialize PCI host.
4. Wait for link to become active.
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
Change from v2 to v3:
- Basic rewrite whole patch according rob herry suggestion.
put common function into dwc, so more soc can share the same logic.
.../pci/controller/dwc/pcie-designware-host.c | 80 +++++++++++++++++++
drivers/pci/controller/dwc/pcie-designware.h | 28 +++++++
2 files changed, 108 insertions(+)
diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index 9952057c8819..ef6869488bde 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -8,6 +8,7 @@
* Author: Jingoo Han <jg1.han@samsung.com>
*/
+#include <linux/iopoll.h>
#include <linux/irqchip/chained_irq.h>
#include <linux/irqdomain.h>
#include <linux/msi.h>
@@ -807,3 +808,82 @@ int dw_pcie_setup_rc(struct dw_pcie_rp *pp)
return 0;
}
EXPORT_SYMBOL_GPL(dw_pcie_setup_rc);
+
+/*
+ * There are for configuring host controllers, which are bridges *to* PCI devices
+ * but are not PCI devices themselves.
+ */
+static void dw_pcie_set_dstate(struct dw_pcie *pci, u32 dstate)
+{
+ u8 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_PM);
+ u32 val;
+
+ val = dw_pcie_readw_dbi(pci, offset + PCI_PM_CTRL);
+ val &= ~PCI_PM_CTRL_STATE_MASK;
+ val |= dstate;
+ dw_pcie_writew_dbi(pci, offset + PCI_PM_CTRL, val);
+}
+
+int dw_pcie_suspend_noirq(struct dw_pcie *pci)
+{
+ u32 val;
+ int ret;
+
+ if (dw_pcie_get_ltssm(pci) <= DW_PCIE_LTSSM_DETECT_ACT)
+ return 0;
+
+ pci->pp.ops->pme_turn_off(&pci->pp);
+
+ /*
+ * PCI Express Base Specification Rev 4.0
+ * 5.3.3.2.1 PME Synchronization
+ * Recommand 1ms to 10ms timeout to check L2 ready
+ */
+ ret = read_poll_timeout(dw_pcie_get_ltssm, val, val == DW_PCIE_LTSSM_L2_IDLE,
+ 100, 10000, false, pci);
+ if (ret) {
+ dev_err(pci->dev, "PCIe link enter L2 timeout! ltssm = 0x%x\n", val);
+ return ret;
+ }
+
+ dw_pcie_set_dstate(pci, 0x3);
+
+ pci->suspended = true;
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(dw_pcie_suspend_noirq);
+
+int dw_pcie_resume_noirq(struct dw_pcie *pci)
+{
+ int ret;
+
+ if (!pci->suspended)
+ return 0;
+
+ pci->suspended = false;
+
+ dw_pcie_set_dstate(pci, 0x0);
+
+ pci->pp.ops->exit_from_l2(&pci->pp);
+
+ /* delay 10 ms to access EP */
+ mdelay(10);
+
+ ret = pci->pp.ops->host_init(&pci->pp);
+ if (ret) {
+ dev_err(pci->dev, "ls_pcie_host_init failed! ret = 0x%x\n", ret);
+ return ret;
+ }
+
+ dw_pcie_setup_rc(&pci->pp);
+
+ ret = dw_pcie_wait_for_link(pci);
+ if (ret) {
+ dev_err(pci->dev, "wait link up timeout! ret = 0x%x\n", ret);
+ return ret;
+ }
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(dw_pcie_resume_noirq);
diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
index 79713ce075cc..effb07a506e4 100644
--- a/drivers/pci/controller/dwc/pcie-designware.h
+++ b/drivers/pci/controller/dwc/pcie-designware.h
@@ -288,10 +288,21 @@ enum dw_pcie_core_rst {
DW_PCIE_NUM_CORE_RSTS
};
+enum dw_pcie_ltssm {
+ DW_PCIE_LTSSM_UNKNOWN = 0xFFFFFFFF,
+ /* Need align PCIE_PORT_DEBUG0 bit0:5 */
+ DW_PCIE_LTSSM_DETECT_QUIET = 0x0,
+ DW_PCIE_LTSSM_DETECT_ACT = 0x1,
+ DW_PCIE_LTSSM_L0 = 0x11,
+ DW_PCIE_LTSSM_L2_IDLE = 0x15,
+};
+
struct dw_pcie_host_ops {
int (*host_init)(struct dw_pcie_rp *pp);
void (*host_deinit)(struct dw_pcie_rp *pp);
int (*msi_host_init)(struct dw_pcie_rp *pp);
+ void (*pme_turn_off)(struct dw_pcie_rp *pp);
+ void (*exit_from_l2)(struct dw_pcie_rp *pp);
};
struct dw_pcie_rp {
@@ -364,6 +375,7 @@ struct dw_pcie_ops {
void (*write_dbi2)(struct dw_pcie *pcie, void __iomem *base, u32 reg,
size_t size, u32 val);
int (*link_up)(struct dw_pcie *pcie);
+ enum dw_pcie_ltssm (*get_ltssm)(struct dw_pcie *pcie);
int (*start_link)(struct dw_pcie *pcie);
void (*stop_link)(struct dw_pcie *pcie);
};
@@ -393,6 +405,7 @@ struct dw_pcie {
struct reset_control_bulk_data app_rsts[DW_PCIE_NUM_APP_RSTS];
struct reset_control_bulk_data core_rsts[DW_PCIE_NUM_CORE_RSTS];
struct gpio_desc *pe_rst;
+ bool suspended;
};
#define to_dw_pcie_from_pp(port) container_of((port), struct dw_pcie, pp)
@@ -430,6 +443,9 @@ void dw_pcie_iatu_detect(struct dw_pcie *pci);
int dw_pcie_edma_detect(struct dw_pcie *pci);
void dw_pcie_edma_remove(struct dw_pcie *pci);
+int dw_pcie_suspend_noirq(struct dw_pcie *pci);
+int dw_pcie_resume_noirq(struct dw_pcie *pci);
+
static inline void dw_pcie_writel_dbi(struct dw_pcie *pci, u32 reg, u32 val)
{
dw_pcie_write_dbi(pci, reg, 0x4, val);
@@ -501,6 +517,18 @@ static inline void dw_pcie_stop_link(struct dw_pcie *pci)
pci->ops->stop_link(pci);
}
+static inline enum dw_pcie_ltssm dw_pcie_get_ltssm(struct dw_pcie *pci)
+{
+ u32 val;
+
+ if (pci->ops && pci->ops->get_ltssm)
+ return pci->ops->get_ltssm(pci);
+
+ val = dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG0);
+
+ return (enum dw_pcie_ltssm)FIELD_GET(PORT_LOGIC_LTSSM_STATE_MASK, val);
+}
+
#ifdef CONFIG_PCIE_DW_HOST
irqreturn_t dw_handle_msi_irq(struct dw_pcie_rp *pp);
int dw_pcie_setup_rc(struct dw_pcie_rp *pp);
--
2.34.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* Re: [RFC PATCH 1/2] arm64: amlogic: add new ARCH_AMLIPC for IPC SoC
From: Neil Armstrong @ 2023-04-19 16:25 UTC (permalink / raw)
To: Dmitry Rokosov
Cc: =Xianwei Zhao, linux-arm-kernel, linux-kernel, linux-amlogic,
devicetree, Catalin Marinas, Will Deacon, Kevin Hilman,
Rob Herring, Krzysztof Kozlowski
In-Reply-To: <20230419160405.d7qfir3nv6tlxx2a@CAB-WSD-L081021>
On 19/04/2023 18:04, Dmitry Rokosov wrote:
> On Wed, Apr 19, 2023 at 03:43:12PM +0200, Neil Armstrong wrote:
>> On 19/04/2023 15:14, Dmitry Rokosov wrote:
>>> On Wed, Apr 19, 2023 at 03:38:33PM +0800, =Xianwei Zhao wrote:
>>>> From: Xianwei Zhao <xianwei.zhao@amlogic.com>
>>>>
>>>> The C series SoCs are designed for smart IP camera
>>>> applications, which does not belong to Meson series.
>>>> So, Add ARCH_AMLIPC for the new series.
>>>>
>>>> There are now multiple amlogic SoC seies supported, so group them under
>>>> their own menu. we can easily add new platforms there in the future.
>>>> Introduce ARCH_AMLOGIC to cover all Amlogic SoC series.
>>>>
>>>> No functional changes introduced.
>>>>
>>>> Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
>>>> ---
>>>> arch/arm64/Kconfig.platforms | 12 ++++++++++++
>>>> arch/arm64/configs/defconfig | 2 ++
>>>> 2 files changed, 14 insertions(+)
>>>>
>>>> diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms
>>>> index 89a0b13b058d..bfbc817eef8f 100644
>>>> --- a/arch/arm64/Kconfig.platforms
>>>> +++ b/arch/arm64/Kconfig.platforms
>>>> @@ -162,12 +162,24 @@ config ARCH_MEDIATEK
>>>> This enables support for MediaTek MT27xx, MT65xx, MT76xx
>>>> & MT81xx ARMv8 SoCs
>>>> +menuconfig ARCH_AMLOGIC
>>>> + bool "NXP SoC support"
>>>
>>> NXP? Did you mean "Amlogic"?
>>>
>>>> +
>>>> +if ARCH_AMLOGIC
>>>> +
>>>> config ARCH_MESON
>>>> bool "Amlogic Platforms"
>>>> help
>>>> This enables support for the arm64 based Amlogic SoCs
>>>> such as the s905, S905X/D, S912, A113X/D or S905X/D2
>>>> +config ARCH_AMLIPC
>>>
>>> Do we really need a different ARCH for Amlogic IPC?
>>> I can imagine that it's not the Meson architecture at all.
>>> But maybe a better solution is just to rename ARCH_MESON to ARCH_AMLOGIC?
>>
>> It should be changed treewide, and is it worth it ?
>
> As far as I understand, the A1 and S4 families are not fully compatible
> with the Meson architecture, and we haven't provided additional ARCH_*
> for them.
The GXBB, GXL/GXM, G12A, G12B & SM1 are also not fully compatible,
but they lie under the "MESON" umbrella which covers SoC since the
Meson6 architecture. It's a facility to include/exclude Amlogic
drivers/DT, nothing else.
If you compare it to BCM or NXP, it's different situation, the
different ARCH_* actually targets totally different SoCs from
completely different Business Units or from companies acquisitions.
We should have named it ARCH_AMLOGIC since the beginning, but we
can't change history.
> In my opinion, it's a good time to split the Meson architecture into
> proper subsets, or rename it treewide (maybe only config option
> ARCH_MESON => ARCH_AMLOGIC).
MESON is only a codename to differentiate from other SoC vendors
because Amlogic used it as a codename for a long time.
Compare this to Allwinner's "sunxi" or Qualcomm's "msm".
This config has no functional mean, it's only a config namespace.
Renaming it would need renaming it in all subsystems Kconfig/Makefiles
and will certainly break builds with custom kernel configs
in various publicly used builds like Armbian, meta-meson, LibreELEC,
Debian, Suse, ...
So it's pointless to change, and even add a different one since
it's not a family differentiator since the Kernel is modular
and works around DT to determine which drivers to probe.
Neil
>
>>>
>>>> + bool "Amlogic IPC Platforms"
>>>> + help
>>>> + This enables support for the arm64 based Amlogic IPC SoCs
>>>> + such as the C302X, C308L
>>>> +endif
>>>> +
>>>> config ARCH_MVEBU
>>>> bool "Marvell EBU SoC Family"
>>>> select ARMADA_AP806_SYSCON
>>>> diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
>>>> index 7790ee42c68a..f231bd1723fd 100644
>>>> --- a/arch/arm64/configs/defconfig
>>>> +++ b/arch/arm64/configs/defconfig
>>>> @@ -46,7 +46,9 @@ CONFIG_ARCH_LG1K=y
>>>> CONFIG_ARCH_HISI=y
>>>> CONFIG_ARCH_KEEMBAY=y
>>>> CONFIG_ARCH_MEDIATEK=y
>>>> +CONFIG_ARCH_AMLOGIC=y
>>>> CONFIG_ARCH_MESON=y
>>>> +CONFIG_ARCH_AMLIPC=y
>>>> CONFIG_ARCH_MVEBU=y
>>>> CONFIG_ARCH_NXP=y
>>>> CONFIG_ARCH_LAYERSCAPE=y
>>>> --
>>>> 2.37.1
>>>>
>>>>
>>>> _______________________________________________
>>>> linux-amlogic mailing list
>>>> linux-amlogic@lists.infradead.org
>>>> http://lists.infradead.org/mailman/listinfo/linux-amlogic
>>>
>>
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [patch 00/37] cpu/hotplug, x86: Reworked parallel CPU bringup
From: Andrew Cooper @ 2023-04-19 16:21 UTC (permalink / raw)
To: Thomas Gleixner, Paul Menzel
Cc: linux-kernel, x86, David Woodhouse, Brian Gerst,
Arjan van de Veen, Paolo Bonzini, Paul McKenney, Tom Lendacky,
Sean Christopherson, Oleksandr Natalenko, Guilherme G. Piccoli,
Piotr Gorski, David Woodhouse, Usama Arif, Jürgen Groß,
Boris Ostrovsky, xen-devel, Russell King, Arnd Bergmann,
linux-arm-kernel, Catalin Marinas, Will Deacon, Guo Ren,
linux-csky, Thomas Bogendoerfer, linux-mips,
James E. J. Bottomley, Helge Deller, linux-parisc, Paul Walmsley,
Palmer Dabbelt, linux-riscv, Mark Rutland, Sabin Rapan
In-Reply-To: <0f5463fd-9c4a-6361-adbb-dd89dbb9138d@citrix.com>
On 19/04/2023 2:50 pm, Andrew Cooper wrote:
> On 19/04/2023 2:43 pm, Thomas Gleixner wrote:
>> On Wed, Apr 19 2023 at 14:38, Thomas Gleixner wrote:
>>> On Wed, Apr 19 2023 at 11:38, Thomas Gleixner wrote:
>>> IOW, the BIOS assignes random numbers to the AP APICs for whatever
>>> raisins, which leaves the parallel startup low level code up a creek
>>> without a paddle, except for actually reading the APICID back from the
>>> APIC. *SHUDDER*
>> So Andrew just pointed out on IRC that this might be related to the
>> ancient issue of the 3-wire APIC bus where IO/APIC and APIC shared the
>> ID space, but that system is definitely post 3-wire APIC :)
> Doesn't mean the BIOS code was updated adequately following that.
>
> What I'm confused by is why this system boots in the first place. I can
> only think that's is a system which only has 4-bit APIC IDs, and happens
> to function when bit 4 gets truncated off the top of the SIPI destination...
https://www.amd.com/system/files/TechDocs/42300_15h_Mod_10h-1Fh_BKDG.pdf
This system does still require the IO-APICs to be at 0, and the LAPICs
to start at some offset, which is clearly 16 in this case. Also, this
system has configurable 4-bit or 8-bit wide APIC IDs, and I can't tell
which mode is active just from the manual.
But, it does mean that the BIOS has genuinely modified the APIC IDs of
the logic processors. This does highlight an error in reasoning with
the parallel bringup code.
For xAPIC, the APIC_ID register is writeable (at least, model
specifically), and CPUID is only the value it would have had at reset.
So the AP bringup logic can't actually use CPUID reliably.
This was changed in x2APIC, which made the x2APIC_ID immutable.
I don't see an option other than the AP bringup code query for xAPIC vs
x2APIC mode, and either looking at the real APIC_ID register, or falling
back to CPUID.
~Andrew
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH V22 2/3] misc: dcc: Add driver support for Data Capture and Compare unit(DCC)
From: Trilok Soni @ 2023-04-19 16:10 UTC (permalink / raw)
To: Souradeep Chowdhury, Arnd Bergmann, Greg Kroah-Hartman
Cc: Andy Gross, Konrad Dybcio, Krzysztof Kozlowski, Bjorn Andersson,
Rob Herring, Alex Elder, linux-arm-kernel, linux-kernel,
linux-arm-msm, devicetree, Sibi Sankar, Rajendra Nayak
In-Reply-To: <9808142e-d6e6-71bc-f362-09b878cb3b87@quicinc.com>
On 4/19/2023 9:08 AM, Trilok Soni wrote:
> On 4/19/2023 3:20 AM, Souradeep Chowdhury wrote:
>>
>>
>> On 4/19/2023 1:00 PM, Arnd Bergmann wrote:
>>> On Wed, Apr 19, 2023, at 09:00, Souradeep Chowdhury wrote:
>>>> On 4/18/2023 9:15 PM, Greg Kroah-Hartman wrote:
>>>>>
>>>>>> The following is the justification of using debugfs interface over
>>>>>> the
>>>>>> other alternatives like sysfs/ioctls
>>>>>>
>>>>>> i) As can be seen from the debugfs attribute descriptions, some of
>>>>>> the
>>>>>> debugfs attribute files here contains multiple arguments which
>>>>>> needs to
>>>>>> be accepted from the user. This goes against the design style of
>>>>>> sysfs.
>>>>>>
>>>>>> ii) The user input patterns have been made simple and convenient
>>>>>> in this
>>>>>> case with the use of debugfs interface as user doesn't need to
>>>>>> shuffle
>>>>>> between different files to execute one instruction as was the case on
>>>>>> using other alternatives.
>>>>>
>>>>> Why do you have debugfs and also a misc device? How are they related?
>>>>> Why both? Why not just one? What userspace tools are going to use
>>>>> either of these interfaces and where are they published to show how
>>>>> this
>>>>> all was tested?
>>>>
>>>> DCC has two fundamental steps of usage:-
>>>>
>>>> 1.Configuring the register addresses on the dcc_sram which is done by
>>>> user through the debugfs interface. For example:-
>>>>
>>>> echo R 0x10c004 > /sys/kernel/debug/dcc/../3/config
>>>>
>>>> Here we are configuring the register addresses for list 3, the 'R'
>>>> indicates a read operation, so this register value will be read
>>>> in case of a software trigger or kernel panic/watchdog bite and
>>>> dumped into the dcc_sram.
>>>
>>> Can you describe why the register location needs to be
>>> runtime configurable? I would have expected this type of setting
>>> to be part of the devicetree, which already describes other
>>> parts that interact with sram devices.
>>
>> Register addresses are made runtime configurable to give the user the
>> option of going for a software trigger. So the user can debug issues
>> during run-time as well. These register locations are arbitrary
>> and is configured by the user for debugging purposes and is not
>> related to the DCC hardware itself.
>
> Please note that we don't want to recompile the devicetree for new
> settings since these registers can be set by team of engineers who are
> debugging system level issues with various IPs across the SOCs. You
> don't want to recompile the images while reproducing the system hangs/IP
> watchdogs etc;
...and also these registers list is not fixed, it will vary based on the
problem you are seeing and debugging on the SOC across the IPs.
---Trilok Soni
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH V22 2/3] misc: dcc: Add driver support for Data Capture and Compare unit(DCC)
From: Trilok Soni @ 2023-04-19 16:08 UTC (permalink / raw)
To: Souradeep Chowdhury, Arnd Bergmann, Greg Kroah-Hartman
Cc: Andy Gross, Konrad Dybcio, Krzysztof Kozlowski, Bjorn Andersson,
Rob Herring, Alex Elder, linux-arm-kernel, linux-kernel,
linux-arm-msm, devicetree, Sibi Sankar, Rajendra Nayak
In-Reply-To: <44834c75-4db7-ec8a-9367-c6b83fa96b22@quicinc.com>
On 4/19/2023 3:20 AM, Souradeep Chowdhury wrote:
>
>
> On 4/19/2023 1:00 PM, Arnd Bergmann wrote:
>> On Wed, Apr 19, 2023, at 09:00, Souradeep Chowdhury wrote:
>>> On 4/18/2023 9:15 PM, Greg Kroah-Hartman wrote:
>>>>
>>>>> The following is the justification of using debugfs interface over the
>>>>> other alternatives like sysfs/ioctls
>>>>>
>>>>> i) As can be seen from the debugfs attribute descriptions, some of the
>>>>> debugfs attribute files here contains multiple arguments which
>>>>> needs to
>>>>> be accepted from the user. This goes against the design style of
>>>>> sysfs.
>>>>>
>>>>> ii) The user input patterns have been made simple and convenient in
>>>>> this
>>>>> case with the use of debugfs interface as user doesn't need to shuffle
>>>>> between different files to execute one instruction as was the case on
>>>>> using other alternatives.
>>>>
>>>> Why do you have debugfs and also a misc device? How are they related?
>>>> Why both? Why not just one? What userspace tools are going to use
>>>> either of these interfaces and where are they published to show how
>>>> this
>>>> all was tested?
>>>
>>> DCC has two fundamental steps of usage:-
>>>
>>> 1.Configuring the register addresses on the dcc_sram which is done by
>>> user through the debugfs interface. For example:-
>>>
>>> echo R 0x10c004 > /sys/kernel/debug/dcc/../3/config
>>>
>>> Here we are configuring the register addresses for list 3, the 'R'
>>> indicates a read operation, so this register value will be read
>>> in case of a software trigger or kernel panic/watchdog bite and
>>> dumped into the dcc_sram.
>>
>> Can you describe why the register location needs to be
>> runtime configurable? I would have expected this type of setting
>> to be part of the devicetree, which already describes other
>> parts that interact with sram devices.
>
> Register addresses are made runtime configurable to give the user the
> option of going for a software trigger. So the user can debug issues
> during run-time as well. These register locations are arbitrary
> and is configured by the user for debugging purposes and is not related
> to the DCC hardware itself.
Please note that we don't want to recompile the devicetree for new
settings since these registers can be set by team of engineers who are
debugging system level issues with various IPs across the SOCs. You
don't want to recompile the images while reproducing the system hangs/IP
watchdogs etc;
---Trilok Soni
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v3 00/13] mm, dma, arm64: Reduce ARCH_KMALLOC_MINALIGN to 8
From: Catalin Marinas @ 2023-04-19 16:06 UTC (permalink / raw)
To: Isaac Manjarres
Cc: Linus Torvalds, Arnd Bergmann, Christoph Hellwig,
Greg Kroah-Hartman, Will Deacon, Marc Zyngier, Andrew Morton,
Herbert Xu, Ard Biesheuvel, Saravana Kannan, Alasdair Kergon,
Daniel Vetter, Joerg Roedel, Mark Brown, Mike Snitzer,
Rafael J. Wysocki, Robin Murphy, linux-mm, iommu,
linux-arm-kernel, Petr Tesarik
In-Reply-To: <ZBNiN9CR2F/fvUTh@google.com>
On Thu, Mar 16, 2023 at 11:38:47AM -0700, Isaac Manjarres wrote:
> On Sun, Nov 06, 2022 at 10:01:30PM +0000, Catalin Marinas wrote:
> > Patches 7-12 change some ARCH_KMALLOC_MINALIGN uses to
> > ARCH_DMA_MINALIGN. The crypto changes have been rejected by Herbert
> > previously but I still included them here until the crypto code is
> > refactored.
>
> Herbert merged the changes to the crypto code that were required to be
> able to safely lower the minimum alignment for kmalloc in [1].
Yes, I saw this.
> Given this, I don't think there's anything blocking this series from
> being merged. The requirement for SWIOTLB to get to the minimum
> kmalloc alignment down to 8 bytes shouldn't prevent this series from
> being merged, as the amount of memory that is allocated for SWIOTLB
> can be configured through the commandline to minimize the impact of
> having SWIOTLB memory. Additionally, even if no SWIOTLB is present,
> this series still offers memory savings on a lot of ARM64 platforms
> by using the cache line size as the minimum alignment for kmalloc.
Actually, there's some progress on the swiotlb front to allow dynamic
allocation. I haven't reviewed the series yet (I wasn't aware of it
until v2) but at a quick look, it limits the dynamic allocation to
bouncing buffers of at least a page size. Maybe this can be later
improved for buffers below ARCH_DMA_MINALIGN.
https://lore.kernel.org/r/cover.1681898595.git.petr.tesarik.ext@huawei.com
> Can you please rebase this series so that it can be merged?
I rebased it locally but the last stumbling block is sorting out the
iommu bouncing. I was hoping Robin Murphy can lend a hand but he's been
busy with other bits. I'll repost the series at 6.4-rc1.
--
Catalin
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [RFC PATCH 1/2] arm64: amlogic: add new ARCH_AMLIPC for IPC SoC
From: Dmitry Rokosov @ 2023-04-19 16:04 UTC (permalink / raw)
To: Neil Armstrong
Cc: =Xianwei Zhao, linux-arm-kernel, linux-kernel, linux-amlogic,
devicetree, Catalin Marinas, Will Deacon, Kevin Hilman,
Rob Herring, Krzysztof Kozlowski
In-Reply-To: <661cea17-a4dd-75d1-6a7e-16efa5aea52b@linaro.org>
On Wed, Apr 19, 2023 at 03:43:12PM +0200, Neil Armstrong wrote:
> On 19/04/2023 15:14, Dmitry Rokosov wrote:
> > On Wed, Apr 19, 2023 at 03:38:33PM +0800, =Xianwei Zhao wrote:
> > > From: Xianwei Zhao <xianwei.zhao@amlogic.com>
> > >
> > > The C series SoCs are designed for smart IP camera
> > > applications, which does not belong to Meson series.
> > > So, Add ARCH_AMLIPC for the new series.
> > >
> > > There are now multiple amlogic SoC seies supported, so group them under
> > > their own menu. we can easily add new platforms there in the future.
> > > Introduce ARCH_AMLOGIC to cover all Amlogic SoC series.
> > >
> > > No functional changes introduced.
> > >
> > > Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
> > > ---
> > > arch/arm64/Kconfig.platforms | 12 ++++++++++++
> > > arch/arm64/configs/defconfig | 2 ++
> > > 2 files changed, 14 insertions(+)
> > >
> > > diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms
> > > index 89a0b13b058d..bfbc817eef8f 100644
> > > --- a/arch/arm64/Kconfig.platforms
> > > +++ b/arch/arm64/Kconfig.platforms
> > > @@ -162,12 +162,24 @@ config ARCH_MEDIATEK
> > > This enables support for MediaTek MT27xx, MT65xx, MT76xx
> > > & MT81xx ARMv8 SoCs
> > > +menuconfig ARCH_AMLOGIC
> > > + bool "NXP SoC support"
> >
> > NXP? Did you mean "Amlogic"?
> >
> > > +
> > > +if ARCH_AMLOGIC
> > > +
> > > config ARCH_MESON
> > > bool "Amlogic Platforms"
> > > help
> > > This enables support for the arm64 based Amlogic SoCs
> > > such as the s905, S905X/D, S912, A113X/D or S905X/D2
> > > +config ARCH_AMLIPC
> >
> > Do we really need a different ARCH for Amlogic IPC?
> > I can imagine that it's not the Meson architecture at all.
> > But maybe a better solution is just to rename ARCH_MESON to ARCH_AMLOGIC?
>
> It should be changed treewide, and is it worth it ?
As far as I understand, the A1 and S4 families are not fully compatible
with the Meson architecture, and we haven't provided additional ARCH_*
for them.
In my opinion, it's a good time to split the Meson architecture into
proper subsets, or rename it treewide (maybe only config option
ARCH_MESON => ARCH_AMLOGIC).
> >
> > > + bool "Amlogic IPC Platforms"
> > > + help
> > > + This enables support for the arm64 based Amlogic IPC SoCs
> > > + such as the C302X, C308L
> > > +endif
> > > +
> > > config ARCH_MVEBU
> > > bool "Marvell EBU SoC Family"
> > > select ARMADA_AP806_SYSCON
> > > diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
> > > index 7790ee42c68a..f231bd1723fd 100644
> > > --- a/arch/arm64/configs/defconfig
> > > +++ b/arch/arm64/configs/defconfig
> > > @@ -46,7 +46,9 @@ CONFIG_ARCH_LG1K=y
> > > CONFIG_ARCH_HISI=y
> > > CONFIG_ARCH_KEEMBAY=y
> > > CONFIG_ARCH_MEDIATEK=y
> > > +CONFIG_ARCH_AMLOGIC=y
> > > CONFIG_ARCH_MESON=y
> > > +CONFIG_ARCH_AMLIPC=y
> > > CONFIG_ARCH_MVEBU=y
> > > CONFIG_ARCH_NXP=y
> > > CONFIG_ARCH_LAYERSCAPE=y
> > > --
> > > 2.37.1
> > >
> > >
> > > _______________________________________________
> > > linux-amlogic mailing list
> > > linux-amlogic@lists.infradead.org
> > > http://lists.infradead.org/mailman/listinfo/linux-amlogic
> >
>
--
Thank you,
Dmitry
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v2 4/4] spi: s3c64xx: support interrupt based pio mode
From: Andi Shyti @ 2023-04-19 16:03 UTC (permalink / raw)
To: Jaewon Kim
Cc: Mark Brown, Krzysztof Kozlowski, Andi Shyti, Alim Akhtar,
linux-spi, linux-samsung-soc, linux-arm-kernel, linux-kernel,
Chanho Park
In-Reply-To: <20230419060639.38853-5-jaewon02.kim@samsung.com>
[-- Attachment #1.1: Type: text/plain, Size: 3756 bytes --]
Hi Jaewon,
On Wed, Apr 19, 2023 at 03:06:39PM +0900, Jaewon Kim wrote:
> Interrupt based pio mode is supported to reduce CPU load.
> If transfer size is larger than 32 byte, it is processed using interrupt.
>
> Signed-off-by: Jaewon Kim <jaewon02.kim@samsung.com>
> ---
> drivers/spi/spi-s3c64xx.c | 82 ++++++++++++++++++++++++++++++++-------
> 1 file changed, 67 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
> index cf3060b2639b..ce1afb9a4ed4 100644
> --- a/drivers/spi/spi-s3c64xx.c
> +++ b/drivers/spi/spi-s3c64xx.c
> @@ -58,6 +58,8 @@
> #define S3C64XX_SPI_MODE_BUS_TSZ_HALFWORD (1<<17)
> #define S3C64XX_SPI_MODE_BUS_TSZ_WORD (2<<17)
> #define S3C64XX_SPI_MODE_BUS_TSZ_MASK (3<<17)
> +#define S3C64XX_SPI_MODE_RX_RDY_LVL GENMASK(16, 11)
> +#define S3C64XX_SPI_MODE_RX_RDY_LVL_SHIFT 11
> #define S3C64XX_SPI_MODE_SELF_LOOPBACK (1<<3)
> #define S3C64XX_SPI_MODE_RXDMA_ON (1<<2)
> #define S3C64XX_SPI_MODE_TXDMA_ON (1<<1)
> @@ -114,6 +116,8 @@
>
> #define S3C64XX_SPI_TRAILCNT S3C64XX_SPI_MAX_TRAILCNT
>
> +#define S3C64XX_SPI_POLLING_SIZE 32
> +
> #define msecs_to_loops(t) (loops_per_jiffy / 1000 * HZ * t)
> #define is_polling(x) (x->cntrlr_info->polling)
>
> @@ -552,10 +556,11 @@ static int s3c64xx_wait_for_dma(struct s3c64xx_spi_driver_data *sdd,
> }
>
> static int s3c64xx_wait_for_pio(struct s3c64xx_spi_driver_data *sdd,
> - struct spi_transfer *xfer)
> + struct spi_transfer *xfer, int use_irq)
bool use_irq
> {
> void __iomem *regs = sdd->regs;
> unsigned long val;
> + unsigned long time;
this time is used only in "if (use_irq)" can you move its
declaration under the if?
> u32 status;
> int loops;
> u32 cpy_len;
> @@ -563,17 +568,24 @@ static int s3c64xx_wait_for_pio(struct s3c64xx_spi_driver_data *sdd,
> int ms;
> u32 tx_time;
>
> - /* sleep during signal transfer time */
> - status = readl(regs + S3C64XX_SPI_STATUS);
> - if (RX_FIFO_LVL(status, sdd) < xfer->len) {
> - tx_time = (xfer->len * 8 * 1000 * 1000) / sdd->cur_speed;
> - usleep_range(tx_time / 2, tx_time);
> - }
> -
> /* millisecs to xfer 'len' bytes @ 'cur_speed' */
> ms = xfer->len * 8 * 1000 / sdd->cur_speed;
> ms += 10; /* some tolerance */
>
> + if (use_irq) {
> + val = msecs_to_jiffies(ms);
> + time = wait_for_completion_timeout(&sdd->xfer_completion, val);
> + if (!time)
> + return -EIO;
> + } else {
> + /* sleep during signal transfer time */
> + status = readl(regs + S3C64XX_SPI_STATUS);
> + if (RX_FIFO_LVL(status, sdd) < xfer->len) {
> + tx_time = (xfer->len * 8 * 1000 * 1000) / sdd->cur_speed;
> + usleep_range(tx_time / 2, tx_time);
yeah... just use 'ms'.
> + }
> + }
> +
> val = msecs_to_loops(ms);
> do {
> cpu_relax();
> @@ -737,10 +749,13 @@ static int s3c64xx_spi_transfer_one(struct spi_master *master,
> void *rx_buf = NULL;
> int target_len = 0, origin_len = 0;
> int use_dma = 0;
> + int use_irq = 0;
> int status;
> u32 speed;
> u8 bpw;
> unsigned long flags;
> + u32 rdy_lv;
> + u32 val;
>
> reinit_completion(&sdd->xfer_completion);
>
> @@ -761,17 +776,46 @@ static int s3c64xx_spi_transfer_one(struct spi_master *master,
> sdd->rx_dma.ch && sdd->tx_dma.ch) {
> use_dma = 1;
>
> - } else if (xfer->len > fifo_len) {
> + } else if (xfer->len >= fifo_len) {
> tx_buf = xfer->tx_buf;
> rx_buf = xfer->rx_buf;
> origin_len = xfer->len;
> -
> target_len = xfer->len;
> - if (xfer->len > fifo_len)
> - xfer->len = fifo_len;
> + xfer->len = fifo_len - 1;
> }
Is this change related to this patch?
The rest looks good.
Andi
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v2 2/3] PCI: brcmstb: CLKREQ# accomodations of downstream device
From: Cyril Brulebois @ 2023-04-19 15:57 UTC (permalink / raw)
To: Jim Quinlan
Cc: Florian Fainelli, linux-pci, Nicolas Saenz Julienne,
Bjorn Helgaas, Lorenzo Pieralisi, Phil Elwell,
bcm-kernel-feedback-list, james.quinlan, Lorenzo Pieralisi,
Krzysztof Wilczyński, Rob Herring,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list
In-Reply-To: <CANCKTBsgkv-8cCMi+H=3xYrdgVcDVTRNczg667L7b=DH2J76Bw@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 2561 bytes --]
Hi Jim,
It might take a few days before getting back to you regarding the
various questions you asked. To be on the safe side, I'll probably run
a cold boot for each setup a number of times (e.g. 10), so that any
possible outlier can be spotted/rejected. And maybe share results off
list once we have a better understanding of what's going on. Does that
make sense to you?
I'll cover a particular topic right away though.
Jim Quinlan <jim2101024@gmail.com> (2023-04-19):
> Second, you say that you used a different "CM4" from the one used in
> the Bugzilla report -- what do you mean by that? Are you referring
> to the CM4 module proper, whose only change was going from 4GB to 8GB,
> or the IO board being used? My testing is done with a standard RPi
> CM4 and standard RPi IO board. Before this patch series, the only way
> this standard configuration can work for most hobbyist PCI cards (i.e.
> floating CLKREQ# pin) is by using Raspian AND adding
> "brcm,enable-l1ss" to the DT node.
Regarding the IO Board, I'm using the official Compute Module 4 IO
Board: https://www.raspberrypi.com/products/compute-module-4-io-board/
I've been using the very same IO Board for all my testing, and what I'm
changing is the standard RPi CM4 plugged on it.
> I'm guessing that you are using the configuration that you described
> to me in a personal email: "[the] chip is embedded directly on the
> modified PCB, as opposed to plugged into the PCIe slot on the official
> CM4 IO Board". If true, you are testing on a configuration that (a)
> is unique to you and your group and (b) must be doing something with
> the CLKREQ# signal so that your "before" case does not panic. Is this
> the case?
That's definitely not the case.
True, as mentioned in a personal mail, we've seen problems with a custom
PCB, derived from the CM4 IO Board design, but of course there could be
some faulty design at work there… So we've first researched whether the
same problem could be produced with consumer grade products, and once
we've verified that, I opened #217276 on Bugzilla.
Since Florian's testing seems overwhelmingly positive, and since I'm
seeing definitive improvement with at least one CM4, maybe it would make
sense not to block the patch series on the kernel panic I'm seeing with
the other CM4, and track that particular issue via a separate bug?
Cheers,
--
Cyril Brulebois (kibi@debian.org) <https://debamax.com/>
D-I release manager -- Release team member -- Freelance Consultant
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v2 3/4] spi: s3c64xx: add sleep during transfer
From: Andi Shyti @ 2023-04-19 15:56 UTC (permalink / raw)
To: Jaewon Kim
Cc: Krzysztof Kozlowski, Mark Brown, Andi Shyti, Alim Akhtar,
linux-spi, linux-samsung-soc, linux-arm-kernel, linux-kernel,
Chanho Park
In-Reply-To: <9d2e2bda-4213-35d0-55d7-827bad9b13a1@samsung.com>
[-- Attachment #1.1: Type: text/plain, Size: 1551 bytes --]
Hi Jaewon,
> >> In polling mode, the status register is constantly read to check transfer
> >> completion. It cause excessive CPU usage.
> >> So, it calculates the SPI transfer time and made it sleep.
> >>
> >> Signed-off-by: Jaewon Kim <jaewon02.kim@samsung.com>
> >> ---
> >> drivers/spi/spi-s3c64xx.c | 8 ++++++++
> >> 1 file changed, 8 insertions(+)
> >>
> >> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
> >> index 886722fb40ea..cf3060b2639b 100644
> >> --- a/drivers/spi/spi-s3c64xx.c
> >> +++ b/drivers/spi/spi-s3c64xx.c
> >> @@ -561,6 +561,14 @@ static int s3c64xx_wait_for_pio(struct s3c64xx_spi_driver_data *sdd,
> >> u32 cpy_len;
> >> u8 *buf;
> >> int ms;
> >> + u32 tx_time;
> >> +
> >> + /* sleep during signal transfer time */
> >> + status = readl(regs + S3C64XX_SPI_STATUS);
> >> + if (RX_FIFO_LVL(status, sdd) < xfer->len) {
> >> + tx_time = (xfer->len * 8 * 1000 * 1000) / sdd->cur_speed;
> >> + usleep_range(tx_time / 2, tx_time);
> >> + }
> > Did you actually check the delays introduced by it? Is it worth?
>
> Yes, I already test it.
>
> Throughput was the same, CPU utilization decreased to 30~40% from 100%.
>
> Tested board is ExynosAutov9 SADK.
>
>
> >
> >>
> >> /* millisecs to xfer 'len' bytes @ 'cur_speed' */
> >> ms = xfer->len * 8 * 1000 / sdd->cur_speed;
> > You have now some code duplication so this could be combined.
you could put the 'if' under the 'ms = ...' and just use ms
without declaring any tx_time.
Andi
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v2 1/4] spi: s3c64xx: changed to PIO mode if there is no DMA
From: Andi Shyti @ 2023-04-19 15:46 UTC (permalink / raw)
To: Jaewon Kim
Cc: Mark Brown, Krzysztof Kozlowski, Andi Shyti, Alim Akhtar,
linux-spi, linux-samsung-soc, linux-arm-kernel, linux-kernel,
Chanho Park
In-Reply-To: <20230419060639.38853-2-jaewon02.kim@samsung.com>
[-- Attachment #1.1: Type: text/plain, Size: 2175 bytes --]
Hi Jaewon,
On Wed, Apr 19, 2023 at 03:06:36PM +0900, Jaewon Kim wrote:
> Polling mode supported with qurik if there was no DMA in the SOC.
I think you want to say here that "Through quirks we choose to
use polling mode whenever there is no DMA in the SoC".
> However, there are cased where we cannot or do not want to use DMA.
/cased/cases/
> To support this case, if DMA is not set, it is switched to polling mode.
You haven't really described what you are doing here... you could
just write something like: "Use DTS properties to select wether
to use polling or DMA mode."
Side note, please use the imperative form when you want to
describe what you have done to fix the issue.
> Signed-off-by: Jaewon Kim <jaewon02.kim@samsung.com>
> ---
> drivers/spi/spi-s3c64xx.c | 8 ++++++--
> include/linux/platform_data/spi-s3c64xx.h | 1 +
> 2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
> index 71d324ec9a70..273aa02322d9 100644
> --- a/drivers/spi/spi-s3c64xx.c
> +++ b/drivers/spi/spi-s3c64xx.c
> @@ -19,7 +19,6 @@
> #include <linux/platform_data/spi-s3c64xx.h>
>
> #define MAX_SPI_PORTS 12
> -#define S3C64XX_SPI_QUIRK_POLL (1 << 0)
> #define S3C64XX_SPI_QUIRK_CS_AUTO (1 << 1)
> #define AUTOSUSPEND_TIMEOUT 2000
>
> @@ -116,7 +115,7 @@
> #define S3C64XX_SPI_TRAILCNT S3C64XX_SPI_MAX_TRAILCNT
>
> #define msecs_to_loops(t) (loops_per_jiffy / 1000 * HZ * t)
> -#define is_polling(x) (x->port_conf->quirks & S3C64XX_SPI_QUIRK_POLL)
> +#define is_polling(x) (x->cntrlr_info->polling)
>
> #define RXBUSY (1<<2)
> #define TXBUSY (1<<3)
> @@ -1067,6 +1066,11 @@ static struct s3c64xx_spi_info *s3c64xx_spi_parse_dt(struct device *dev)
> sci->num_cs = temp;
> }
>
> + if (!of_find_property(dev->of_node, "dmas", NULL)) {
> + dev_warn(dev, "cannot find DMA, changed to PIO mode\n");
> + sci->polling = 1;
sci->polling = true;
But it could be even better:
sci->polling = !of_find_property(dev->of_node, "dmas", NULL));
and you get rid of the dev_warn() that is not required.
Andi
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v2] KVM: arm64: Fix buffer overflow in kvm_arm_set_fw_reg()
From: Oliver Upton @ 2023-04-19 15:24 UTC (permalink / raw)
To: Dan Carpenter, Andre Przywara
Cc: Oliver Upton, James Morse, Zenghui Yu, Catalin Marinas,
Steven Price, Suzuki K Poulose, kernel-janitors, kvmarm,
Eric Auger, Will Deacon, linux-arm-kernel
In-Reply-To: <4efbab8c-640f-43b2-8ac6-6d68e08280fe@kili.mountain>
On Wed, 19 Apr 2023 13:16:13 +0300, Dan Carpenter wrote:
> The KVM_REG_SIZE() comes from the ioctl and it can be a power of two
> between 0-32768 but if it is more than sizeof(long) this will corrupt
> memory.
>
>
Applied to kvmarm/fixes, thanks!
[1/1] KVM: arm64: Fix buffer overflow in kvm_arm_set_fw_reg()
https://git.kernel.org/kvmarm/kvmarm/c/a25bc8486f9c
--
Best,
Oliver
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v9 05/11] remoteproc: mediatek: Extract remoteproc initialization flow
From: Mathieu Poirier @ 2023-04-19 15:09 UTC (permalink / raw)
To: TingHan Shen (沈廷翰)
Cc: linux-kernel@vger.kernel.org, robh+dt@kernel.org,
linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org,
linux-mediatek@lists.infradead.org,
Project_Global_Chrome_Upstream_Group,
linux-arm-kernel@lists.infradead.org,
krzysztof.kozlowski+dt@linaro.org, matthias.bgg@gmail.com,
andersson@kernel.org, angelogioacchino.delregno@collabora.com
In-Reply-To: <46baff1f95fa13976d7a07b5e50ff2175e464baa.camel@mediatek.com>
On Wed, Apr 19, 2023 at 03:38:14AM +0000, TingHan Shen (沈廷翰) wrote:
> Hi Mathieu,
>
> On Fri, 2023-03-31 at 11:44 -0600, Mathieu Poirier wrote:
> > External email : Please do not click links or open attachments until you have verified the sender or the content.
> >
> >
> > On Tue, Mar 28, 2023 at 10:27:27AM +0800, Tinghan Shen wrote:
> > > This is the preparation for probing multi-core SCP. The remoteproc
> > > initialization flow is similar on cores and is reused to avoid
> > > redundant code.
> > >
> > > The registers of config and l1tcm are shared for multi-core
> > > SCP. Reuse the mapped addresses for all cores.
> > >
> > > Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
> > > Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> > > ---
> > > drivers/remoteproc/mtk_scp.c | 64 +++++++++++++++++++++++++-----------
> > > 1 file changed, 45 insertions(+), 19 deletions(-)
> > >
> > > diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
> > > index a3b9bc158cd9..32ecd1450c6f 100644
> > > --- a/drivers/remoteproc/mtk_scp.c
> > > +++ b/drivers/remoteproc/mtk_scp.c
> > > @@ -23,6 +23,13 @@
> > > #define MAX_CODE_SIZE 0x500000
> > > #define SECTION_NAME_IPI_BUFFER ".ipi_buffer"
> > >
> > > +struct mtk_scp_of_regs {
> > > + void __iomem *reg_base;
> > > + void __iomem *l1tcm_base;
> > > + size_t l1tcm_size;
> > > + phys_addr_t l1tcm_phys;
> > > +};
> > > +
> >
> > This should represent the cluster with a list of mtk_scp instead of @cluster_cores as
> > introduced in the next patch.
>
> If I'm understanding you correctly, you're suggesting that @cluster_cores should be included
> as a member of this structure. Is that correct?
Correct. Than this structure is allocated in probe() and added as driver data
for the platform device. Its name should also be something like
mtk_scp_cluster or something like that. I suggest you look at what has been
done in ti_k3_r5_remoteproc.c, your end design should be quite similar to that.
In fact you are close but a few things need to be addressed.
>
> Best regards,
> TingHan
>
> >
> > > /**
> > > * scp_get() - get a reference to SCP.
> > > *
> > > @@ -855,7 +862,8 @@ static void scp_remove_rpmsg_subdev(struct mtk_scp *scp)
> > > }
> > > }
> > >
> > > -static int scp_probe(struct platform_device *pdev)
> > > +static int scp_rproc_init(struct platform_device *pdev,
> > > + struct mtk_scp_of_regs *of_regs)
> > > {
> > > struct device *dev = &pdev->dev;
> > > struct device_node *np = dev->of_node;
> > > @@ -879,6 +887,11 @@ static int scp_probe(struct platform_device *pdev)
> > > scp->data = of_device_get_match_data(dev);
> > > platform_set_drvdata(pdev, scp);
> > >
> > > + scp->reg_base = of_regs->reg_base;
> > > + scp->l1tcm_base = of_regs->l1tcm_base;
> > > + scp->l1tcm_size = of_regs->l1tcm_size;
> > > + scp->l1tcm_phys = of_regs->l1tcm_phys;
> > > +
> > > res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sram");
> > > scp->sram_base = devm_ioremap_resource(dev, res);
> > > if (IS_ERR(scp->sram_base))
> > > @@ -888,24 +901,6 @@ static int scp_probe(struct platform_device *pdev)
> > > scp->sram_size = resource_size(res);
> > > scp->sram_phys = res->start;
> > >
> > > - /* l1tcm is an optional memory region */
> > > - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "l1tcm");
> > > - scp->l1tcm_base = devm_ioremap_resource(dev, res);
> > > - if (IS_ERR(scp->l1tcm_base)) {
> > > - ret = PTR_ERR(scp->l1tcm_base);
> > > - if (ret != -EINVAL) {
> > > - return dev_err_probe(dev, ret, "Failed to map l1tcm memory\n");
> > > - }
> > > - } else {
> >
> > scp->l1tcm_base = NULL;
> >
> > > - scp->l1tcm_size = resource_size(res);
> > > - scp->l1tcm_phys = res->start;
> > > - }
> > > -
> > > - scp->reg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
> > > - if (IS_ERR(scp->reg_base))
> > > - return dev_err_probe(dev, PTR_ERR(scp->reg_base),
> > > - "Failed to parse and map cfg memory\n");
> > > -
> > > ret = scp->data->scp_clk_get(scp);
> > > if (ret)
> > > return ret;
> > > @@ -957,6 +952,37 @@ static int scp_probe(struct platform_device *pdev)
> > > return ret;
> > > }
> > >
> > > +static int scp_probe(struct platform_device *pdev)
> > > +{
> > > + struct device *dev = &pdev->dev;
> > > + struct mtk_scp_of_regs scp_regs;
> > > + struct resource *res;
> > > + int ret;
> > > +
> > > + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg");
> > > + scp_regs.reg_base = devm_ioremap_resource(dev, res);
> > > + if (IS_ERR(scp_regs.reg_base))
> > > + return dev_err_probe(dev, PTR_ERR(scp_regs.reg_base),
> > > + "Failed to parse and map cfg memory\n");
> > > +
> > > + /* l1tcm is an optional memory region */
> > > + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "l1tcm");
> > > + scp_regs.l1tcm_base = devm_ioremap_resource(dev, res);
> > > + if (IS_ERR(scp_regs.l1tcm_base)) {
> > > + ret = PTR_ERR(scp_regs.l1tcm_base);
> > > + if (ret != -EINVAL)
> > > + return dev_err_probe(dev, ret, "Failed to map l1tcm memory\n");
> > > +
> > > + scp_regs.l1tcm_size = 0;
> > > + scp_regs.l1tcm_phys = 0;
> > > + } else {
> > > + scp_regs.l1tcm_size = resource_size(res);
> > > + scp_regs.l1tcm_phys = res->start;
> > > + }
> > > +
> > > + return scp_rproc_init(pdev, &scp_regs);
> > > +}
> > > +
> > > static int scp_remove(struct platform_device *pdev)
> > > {
> > > struct mtk_scp *scp = platform_get_drvdata(pdev);
> > > --
> > > 2.18.0
> > >
>
> --
> Best regards,
> TingHan
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v1 2/9] hwmon: (gxp_fan_ctrl) Give GPIO access to fan data
From: kernel test robot @ 2023-04-19 15:01 UTC (permalink / raw)
To: nick.hawkins, verdun, linus.walleij, brgl, robh+dt,
krzysztof.kozlowski+dt, jdelvare, linux, linux, linux-gpio,
devicetree, linux-kernel, linux-hwmon, linux-arm-kernel
Cc: llvm, oe-kbuild-all
In-Reply-To: <20230418152824.110823-3-nick.hawkins@hpe.com>
Hi,
kernel test robot noticed the following build warnings:
[auto build test WARNING on groeck-staging/hwmon-next]
[also build test WARNING on robh/for-next linus/master v6.3-rc7]
[cannot apply to brgl/gpio/for-next next-20230418]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/nick-hawkins-hpe-com/gpio-gxp-Add-HPE-GXP-GPIO/20230418-233513
base: https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
patch link: https://lore.kernel.org/r/20230418152824.110823-3-nick.hawkins%40hpe.com
patch subject: [PATCH v1 2/9] hwmon: (gxp_fan_ctrl) Give GPIO access to fan data
config: hexagon-randconfig-r045-20230419 (https://download.01.org/0day-ci/archive/20230419/202304192243.9hwJ1Cad-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 437b7602e4a998220871de78afcb020b9c14a661)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/be3722d7f32fea1ea375090d05cbfdd3dd4e04d3
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review nick-hawkins-hpe-com/gpio-gxp-Add-HPE-GXP-GPIO/20230418-233513
git checkout be3722d7f32fea1ea375090d05cbfdd3dd4e04d3
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash block/partitions/ drivers/hwmon/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304192243.9hwJ1Cad-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from drivers/hwmon/gxp-fan-ctrl.c:7:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __raw_readb(PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
^
In file included from drivers/hwmon/gxp-fan-ctrl.c:7:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
^
In file included from drivers/hwmon/gxp-fan-ctrl.c:7:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writeb(value, PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
>> drivers/hwmon/gxp-fan-ctrl.c:32:4: warning: no previous prototype for function 'get_fans_installed' [-Wmissing-prototypes]
u8 get_fans_installed(void)
^
drivers/hwmon/gxp-fan-ctrl.c:32:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
u8 get_fans_installed(void)
^
static
>> drivers/hwmon/gxp-fan-ctrl.c:52:4: warning: no previous prototype for function 'get_fans_failed' [-Wmissing-prototypes]
u8 get_fans_failed(void)
^
drivers/hwmon/gxp-fan-ctrl.c:52:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
u8 get_fans_failed(void)
^
static
8 warnings generated.
vim +/get_fans_installed +32 drivers/hwmon/gxp-fan-ctrl.c
31
> 32 u8 get_fans_installed(void)
33 {
34 static u8 val;
35
36 val = readb(drvdata->plreg + OFS_FAN_INST);
37
38 return val;
39 }
40 EXPORT_SYMBOL(get_fans_installed);
41
42 static long fan_failed(struct device *dev, int fan)
43 {
44 struct gxp_fan_ctrl_drvdata *drvdata = dev_get_drvdata(dev);
45 u8 val;
46
47 val = readb(drvdata->plreg + OFS_FAN_FAIL);
48
49 return !!(val & BIT(fan));
50 }
51
> 52 u8 get_fans_failed(void)
53 {
54 static u8 val;
55
56 val = readb(drvdata->plreg + OFS_FAN_FAIL);
57
58 return val;
59 }
60 EXPORT_SYMBOL(get_fans_failed);
61
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH V2 2/5] arm64: dts: ti: k3-am65*: Drop bootargs
From: Jan Kiszka @ 2023-04-19 14:47 UTC (permalink / raw)
To: Nishanth Menon, Krzysztof Kozlowski, Rob Herring,
Vignesh Raghavendra
Cc: linux-kernel, devicetree, linux-arm-kernel, Tero Kristo,
Krzysztof Kozlowski, Roger Quadros
In-Reply-To: <20230419141222.383567-3-nm@ti.com>
On 19.04.23 16:12, Nishanth Menon wrote:
> Drop bootargs from the dts. earlycon is a debug property that should be
> enabled only when debug is desired and not as default - see referenced
> link on discussion on this topic.
>
> Cc: Jan Kiszka <jan.kiszka@siemens.com>
> Link: https://lore.kernel.org/linux-arm-kernel/81134eb9-2b7d-05bc-3035-a47f020861a8@linaro.org/
> Suggested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Reviewed-by: Roger Quadros <rogerq@kernel.org>
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
> Similar discussions can be seen in https://lore.kernel.org/linux-devicetree/?q=Krzysztof+bootargs
>
> Changes since v1:
> - improved commit message
> - picked up acks and reviews from Roger and Krzysztof
>
> V1: https://lore.kernel.org/r/20230418165212.1456415-3-nm@ti.com
>
> arch/arm64/boot/dts/ti/k3-am65-iot2050-common.dtsi | 1 -
> arch/arm64/boot/dts/ti/k3-am654-base-board.dts | 1 -
> 2 files changed, 2 deletions(-)
>
> diff --git a/arch/arm64/boot/dts/ti/k3-am65-iot2050-common.dtsi b/arch/arm64/boot/dts/ti/k3-am65-iot2050-common.dtsi
> index 96ac2b476b11..7d256a1638ff 100644
> --- a/arch/arm64/boot/dts/ti/k3-am65-iot2050-common.dtsi
> +++ b/arch/arm64/boot/dts/ti/k3-am65-iot2050-common.dtsi
> @@ -21,7 +21,6 @@ aliases {
>
> chosen {
> stdout-path = "serial3:115200n8";
> - bootargs = "earlycon=ns16550a,mmio32,0x02810000";
> };
>
> reserved-memory {
> diff --git a/arch/arm64/boot/dts/ti/k3-am654-base-board.dts b/arch/arm64/boot/dts/ti/k3-am654-base-board.dts
> index 592ab2b54cb3..0d6fc89eba7a 100644
> --- a/arch/arm64/boot/dts/ti/k3-am654-base-board.dts
> +++ b/arch/arm64/boot/dts/ti/k3-am654-base-board.dts
> @@ -15,7 +15,6 @@ / {
>
> chosen {
> stdout-path = "serial2:115200n8";
> - bootargs = "earlycon=ns16550a,mmio32,0x02800000";
> };
>
> memory@80000000 {
For the IOT2050:
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Jan
--
Siemens AG, Technology
Competence Center Embedded Linux
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox