Re: [PATCH v2 02/10] sysfs: introduce callback attribute_group::bin_size

2024-11-06 Thread Greg Kroah-Hartman
On Thu, Nov 07, 2024 at 05:05:13AM +0900, Krzysztof Wilczyński wrote:
> Hello,
> 
> > Several drivers need to dynamically calculate the size of an binary
> > attribute. Currently this is done by assigning attr->size from the
> > is_bin_visible() callback.
> > 
> > This has drawbacks:
> > * It is not documented.
> > * A single attribute can be instantiated multiple times, overwriting the
> >   shared size field.
> > * It prevents the structure to be moved to read-only memory.
> > 
> > Introduce a new dedicated callback to calculate the size of the
> > attribute.
> 
> Would it be possible to have a helper that when run against a specific
> kobject reference, then it would refresh or re-run the size callbacks?
> 
> We have an use case where we resize BARs on demand via sysfs, and currently
> the only way to update the size of each resource sysfs object is to remove
> and added them again, which is a bit crude, and can also be unsafe.

How is it unsafe?

> Hence the question.
> 
> There exist the sysfs_update_groups(), but the BAR resource sysfs objects
> are currently, at least not yet, added to any attribute group.

then maybe they should be added to one :)

thanks,

greg k-h



Re: [PATCH] tty: hvc: riscv_sbi: instantiate the legcay console earlier

2024-10-13 Thread Greg Kroah-Hartman
On Mon, Oct 14, 2024 at 08:08:57AM +0800, Jisheng Zhang wrote:
> The hvc_instantiate() is an early console discovery mechanism, it is
> usually called before allocating hvc terminal devices. In fact, if
> we check hvc_riscv_sbi's hvc_instantiate() return value, we'll find
> that it's -1. So the calling hvc_instantiate() is too late.
> 
> We can remove the hvc_instantiate() to only rely on the hvc_alloc() to
> register the kernel console. We can also move its calling earlier so
> the kernel console is registered earlier, so that we can get kernel
> console msg earlier. We take the 2nd choice in this patch.
> 
> Before the patch:
> [0.367440] printk: legacy console [hvc0] enabled
> [0.401397] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
> 
> After the patch:
> 
> [0.004665] printk: legacy console [hvc0] enabled
> [0.050183] Calibrating delay loop (skipped), value calculated using timer 
> frequency.. 20.00 BogoMIPS (lpj=10)
> 
> As can be seen, now the kernel console is registered much earlier before
> the BogoMIPS calibrating.
> 
> Signed-off-by: Jisheng Zhang 

What commit id does this fix?

> ---
>  drivers/tty/hvc/hvc_riscv_sbi.c | 17 +++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/hvc/hvc_riscv_sbi.c b/drivers/tty/hvc/hvc_riscv_sbi.c
> index cede8a572594..d2ecfbf7c84a 100644
> --- a/drivers/tty/hvc/hvc_riscv_sbi.c
> +++ b/drivers/tty/hvc/hvc_riscv_sbi.c
> @@ -68,12 +68,10 @@ static int __init hvc_sbi_init(void)
>   err = PTR_ERR_OR_ZERO(hvc_alloc(0, 0, &hvc_sbi_dbcn_ops, 256));
>   if (err)
>   return err;
> - hvc_instantiate(0, 0, &hvc_sbi_dbcn_ops);
>   } else if (IS_ENABLED(CONFIG_RISCV_SBI_V01)) {
>   err = PTR_ERR_OR_ZERO(hvc_alloc(0, 0, &hvc_sbi_v01_ops, 256));
>   if (err)
>   return err;
> - hvc_instantiate(0, 0, &hvc_sbi_v01_ops);
>   } else {
>   return -ENODEV;
>   }
> @@ -81,3 +79,18 @@ static int __init hvc_sbi_init(void)
>   return 0;
>  }
>  device_initcall(hvc_sbi_init);
> +
> +static int __init hvc_sbi_console_init(void)
> +{
> + int err;
> +
> + if (sbi_debug_console_available)
> + err = hvc_instantiate(0, 0, &hvc_sbi_dbcn_ops);
> + else if (IS_ENABLED(CONFIG_RISCV_SBI_V01))
> + err = hvc_instantiate(0, 0, &hvc_sbi_v01_ops);
> + else
> + return -ENODEV;
> +
> + return err < 0 ? -ENODEV : 0;

Please spell out a ? : line, it's not required here.

> +}
> +console_initcall(hvc_sbi_console_init);

Are you sure this will always work properly?  For some reason the
original code did not do this, you might want to check the
lore.kernel.org archives to find out why.

thanks,

greg k-h



[PATCH 6.10 345/809] tools/perf: Fix the string match for "/tmp/perf-$PID.map" files in dso__load

2024-07-30 Thread Greg Kroah-Hartman
6.10-stable review patch.  If anyone has any objections, please let me know.

--

From: Athira Rajeev 

[ Upstream commit b0979f008f1352a44cd3c8877e3eb8a1e3e1c6f3 ]

Perf test for perf probe of function from different CU fails
as below:

./perf test -vv "test perf probe of function from different CU"
116: test perf probe of function from different CU:
--- start ---
test child forked, pid 2679
Failed to find symbol foo in 
/tmp/perf-uprobe-different-cu-sh.Msa7iy89bx/testfile
  Error: Failed to add events.
--- Cleaning up ---
"foo" does not hit any event.
  Error: Failed to delete events.
 end(-1) 
116: test perf probe of function from different CU   : 
FAILED!

The test does below to probe function "foo" :

# gcc -g -Og -flto -c 
/tmp/perf-uprobe-different-cu-sh.XniNxNEVT7/testfile-foo.c
-o /tmp/perf-uprobe-different-cu-sh.XniNxNEVT7/testfile-foo.o
# gcc -g -Og -c 
/tmp/perf-uprobe-different-cu-sh.XniNxNEVT7/testfile-main.c
-o /tmp/perf-uprobe-different-cu-sh.XniNxNEVT7/testfile-main.o
# gcc -g -Og -o /tmp/perf-uprobe-different-cu-sh.XniNxNEVT7/testfile
/tmp/perf-uprobe-different-cu-sh.XniNxNEVT7/testfile-foo.o
/tmp/perf-uprobe-different-cu-sh.XniNxNEVT7/testfile-main.o

# ./perf probe -x /tmp/perf-uprobe-different-cu-sh.XniNxNEVT7/testfile 
foo
Failed to find symbol foo in 
/tmp/perf-uprobe-different-cu-sh.XniNxNEVT7/testfile
   Error: Failed to add events.

Perf probe fails to find symbol foo in the executable placed in
/tmp/perf-uprobe-different-cu-sh.XniNxNEVT7

Simple reproduce:

 # mktemp -d /tmp/perf-checkXX
   /tmp/perf-checkcWpuLRQI8j

 # gcc -g -o test test.c
 # cp test /tmp/perf-checkcWpuLRQI8j/
 # nm /tmp/perf-checkcWpuLRQI8j/test | grep foo
   16bc T foo

 # ./perf probe -x /tmp/perf-checkcWpuLRQI8j/test foo
   Failed to find symbol foo in /tmp/perf-checkcWpuLRQI8j/test
  Error: Failed to add events.

But it works with any files like /tmp/perf/test. Only for
patterns with "/tmp/perf-", this fails.

Further debugging, commit 80d496be89ed ("perf report: Add support
for profiling JIT generated code") added support for profiling JIT
generated code. This patch handles dso's of form
"/tmp/perf-$PID.map" .

The check used "if (strncmp(self->name, "/tmp/perf-", 10) == 0)"
to match "/tmp/perf-$PID.map". With this commit, any dso in
/tmp/perf- folder will be considered separately for processing
(not only JIT created map files ). Fix this by changing the
string pattern to check for "/tmp/perf-%d.map". Add a helper
function is_perf_pid_map_name to do this check. In "struct dso",
dso->long_name holds the long name of the dso file. Since the
/tmp/perf-$PID.map check uses the complete name, use dso___long_name for
the string name.

With the fix,
# ./perf test "test perf probe of function from different CU"
117: test perf probe of function from different CU   : 
Ok

Fixes: 56cbeacf1435 ("perf probe: Add test for regression introduced by switch 
to die_get_decl_file()")
Signed-off-by: Athira Rajeev 
Reviewed-by: Chaitanya S Prakash 
Reviewed-by: Adrian Hunter 
Cc: akank...@linux.ibm.com
Cc: kj...@linux.ibm.com
Cc: ma...@linux.ibm.com
Cc: disg...@linux.vnet.ibm.com
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Namhyung Kim 
Link: 
https://lore.kernel.org/r/20240623064850.83720-1-atraj...@linux.vnet.ibm.com
Signed-off-by: Sasha Levin 
---
 tools/perf/util/dso.c| 12 
 tools/perf/util/dso.h|  4 
 tools/perf/util/symbol.c |  3 ++-
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index dde706b71da7b..2340c4f6d0c24 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -1652,3 +1652,15 @@ int dso__strerror_load(struct dso *dso, char *buf, 
size_t buflen)
scnprintf(buf, buflen, "%s", dso_load__error_str[idx]);
return 0;
 }
+
+bool perf_pid_map_tid(const char *dso_name, int *tid)
+{
+   return sscanf(dso_name, "/tmp/perf-%d.map", tid) == 1;
+}
+
+bool is_perf_pid_map_name(const char *dso_name)
+{
+   int tid;
+
+   return perf_pid_map_tid(dso_name, &tid);
+}
diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
index df2c98402af3e..d72f3b8c37f6a 100644
--- a/tools/perf/util/dso.h
+++ b/tools/perf/util/dso.h
@@ -809,4 +809,8 @@ void reset_fd_limit(void);
 u64 dso__find_global_type(struct dso *dso, u64 addr);
 u64 dso__findnew_global_type(struct dso *dso, u64 addr, u64 offset);
 
+/* Check if dso name is of format "/tmp/perf-%d.map" */
+bool perf_pid_map_tid(const char *dso_name, int *tid);
+bool is_perf_pid_map_name(const char *dso_name);
+
 #endif /* __PERF_DSO */
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 9e5940b5bc591..aee0a4cfb3836 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@

[PATCH 6.1 157/440] perf tests arm_callgraph_fp: Address shellcheck warnings about signal names and adding double quotes for expression

2024-07-30 Thread Greg Kroah-Hartman
6.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Spoorthy S 

[ Upstream commit 1bb17b4c6c91ad4d9468247cf5f5464fa6440668 ]

Running shellcheck -S on test_arm_calligraph_fp throws warnings SC2086 and 
SC3049,

  $shellcheck -S warning tests/shell/test_arm_callgraph_fp.sh
 rm -f $PERF_DATA
: Double quote to prevent globbing and word splitting.
 trap cleanup_files exit term int
     : In POSIX sh, using lower/mixed case for signal names is 
undefined.

After fixing the warnings,

  $shellcheck tests/shell/test_arm_callgraph_fp.sh
  $ echo $?
  0

To address the POSIX shell warnings added changes to convert Lowercase
signal names to uppercase in the script and double quoted the
command substitutions($fix to "$fix") to solve Globbing warnings.

Signed-off-by: Spoorthy S
Cc: Disha Goel 
Cc: Ian Rogers 
Cc: Jiri Olsa 
Cc: John Garry 
Cc: Madhavan Srinivasan 
Cc: Namhyung Kim 
Cc: Ravi Bangoria 
Cc: linuxppc-dev@lists.ozlabs.org
Link: 
https://lore.kernel.org/r/20230613164145.50488-4-atraj...@linux.vnet.ibm.com
Signed-off-by: Athira Rajeev 
Signed-off-by: Kajol Jain 
Signed-off-by: Arnaldo Carvalho de Melo 
Stable-dep-of: ff16aeb9b834 ("perf test: Make test_arm_callgraph_fp.sh more 
robust")
Signed-off-by: Sasha Levin 
---
 tools/perf/tests/shell/test_arm_callgraph_fp.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/tests/shell/test_arm_callgraph_fp.sh 
b/tools/perf/tests/shell/test_arm_callgraph_fp.sh
index e61d8deaa0c41..1380e0d12dce3 100755
--- a/tools/perf/tests/shell/test_arm_callgraph_fp.sh
+++ b/tools/perf/tests/shell/test_arm_callgraph_fp.sh
@@ -9,13 +9,13 @@ TEST_PROGRAM="perf test -w leafloop"
 
 cleanup_files()
 {
-   rm -f $PERF_DATA
+   rm -f "$PERF_DATA"
 }
 
-trap cleanup_files exit term int
+trap cleanup_files EXIT TERM INT
 
 # Add a 1 second delay to skip samples that are not in the leaf() function
-perf record -o $PERF_DATA --call-graph fp -e cycles//u -D 1000 
--user-callchains -- $TEST_PROGRAM 2> /dev/null &
+perf record -o "$PERF_DATA" --call-graph fp -e cycles//u -D 1000 
--user-callchains -- "$TEST_PROGRAM" 2> /dev/null &
 PID=$!
 
 echo " + Recording (PID=$PID)..."
-- 
2.43.0





Re: [PATCH v4] cxl: Fix possible null pointer dereference in read_handle()

2024-07-15 Thread Greg Kroah-Hartman
On Mon, Jul 15, 2024 at 03:18:56PM +0200, Markus Elfring wrote:
> > In read_handle(), of_get_address() may return NULL if getting address and
> > size of the node failed. When of_read_number() uses prop to handle
> > conversions between different byte orders, it could lead to a null pointer
> > dereference. Add NULL check to fix potential issue.
> >
> > Found by static analysis.
> >
> > Cc: sta...@vger.kernel.org
> > Fixes: 14baf4d9c739 ("cxl: Add guest-specific code")
> > Signed-off-by: Ma Ke 
> 
> How will interests evolve for caring more according to known research
> and development processes?
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.10#n398
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/researcher-guidelines.rst?h=v6.10#n5
> 
> 
> > ---
> > Changes in v4:
> > - modified vulnerability description according to suggestions, making the
> > process of static analysis of vulnerabilities clearer. No active research
> > on developer behavior.
> …
> 
> Does such information indicate any communication difficulties?


Hi,

This is the semi-friendly patch-bot of Greg Kroah-Hartman.

Markus, you seem to have sent a nonsensical or otherwise pointless
review comment to a patch submission on a Linux kernel developer mailing
list.  I strongly suggest that you not do this anymore.  Please do not
bother developers who are actively working to produce patches and
features with comments that, in the end, are a waste of time.

Patch submitter, please ignore Markus's suggestion; you do not need to
follow it at all.  The person/bot/AI that sent it is being ignored by
almost all Linux kernel maintainers for having a persistent pattern of
behavior of producing distracting and pointless commentary, and
inability to adapt to feedback.  Please feel free to also ignore emails
from them.

thanks,

greg k-h's patch email bot


Re: WARNING&Oops in v6.6.37 on ppc64lea - Trying to vfree() bad address (00000000453be747)

2024-07-09 Thread Greg Kroah-Hartman
On Tue, Jul 09, 2024 at 03:02:13PM +0530, Naveen N Rao wrote:
> Greg Kroah-Hartman wrote:
> > On Mon, Jul 08, 2024 at 11:16:48PM -0400, matoro wrote:
> > > On 2024-07-05 16:34, Vitaly Chikunov wrote:
> > > > Hi,
> > > > > There is new WARNING and Oops on ppc64le in v6.6.37 when running
> > > LTP tests:
> > > > bpf_prog01, bpf_prog02, bpf_prog04, bpf_prog05, prctl04. Logs excerpt
> > > > below. I
> > > > see there is 1 commit in v6.6.36..v6.6.37 with call to
> > > > bpf_jit_binary_pack_finalize, backported from 5 patch mainline patchset:
> > > > >   f99feda5684a powerpc/bpf: use
> > > bpf_jit_binary_pack_[alloc|finalize|free]
> > > >
> 
> 
> 
> > > > > And so on. Temporary build/test log is at
> > > > https://git.altlinux.org/tasks/352218/build/100/ppc64le/log
> > > > > Other stable/longterm branches or other architectures does not
> > > exhibit this.
> > > > > Thanks,
> > > 
> > > Hi all - this just took down a production server for me, on POWER9 bare
> > > metal.  Not running tests, just booting normally, before services even 
> > > came
> > > up.  Had to perform manual restoration, reverting to 6.6.36 worked.  Also
> > > running 64k kernel, unsure if it's better on 4k kernel.
> > > 
> > > In case it's helpful, here's the log from my boot:
> > > https://dpaste.org/Gyxxg/raw
> > 
> > Ok, this isn't good, something went wrong with my backports here.  Let
> > me go revert them all and push out a new 6.6.y release right away.
> 
> I think the problem is that the series adding support for bpf prog_pack was
> partially backported. In particular, the below patches are missing from
> stable v6.6:
> 465cabc97b42 powerpc/code-patching: introduce patch_instructions()
> 033ffaf0af1f powerpc/bpf: implement bpf_arch_text_invalidate for bpf_prog_pack
> 6efc1675acb8 powerpc/bpf: implement bpf_arch_text_copy
> 
> It should be sufficient to revert commit f99feda5684a (powerpc/bpf: use
> bpf_jit_binary_pack_[alloc|finalize|free]) to allow the above to apply
> cleanly, followed by cherry picking commit 90d862f370b6 (powerpc/bpf: use
> bpf_jit_binary_pack_[alloc|finalize|free]) from upstream.
> 
> Alternately, commit f99feda5684a (powerpc/bpf: use
> bpf_jit_binary_pack_[alloc|finalize|free]) can be reverted.

I'm dropping them all now, if you want to submit a working series for
this, I'll be glad to queue them all up.

thanks,

greg k-h


Re: WARNING&Oops in v6.6.37 on ppc64lea - Trying to vfree() bad address (00000000453be747)

2024-07-09 Thread Greg Kroah-Hartman
On Mon, Jul 08, 2024 at 11:16:48PM -0400, matoro wrote:
> On 2024-07-05 16:34, Vitaly Chikunov wrote:
> > Hi,
> > 
> > There is new WARNING and Oops on ppc64le in v6.6.37 when running LTP tests:
> > bpf_prog01, bpf_prog02, bpf_prog04, bpf_prog05, prctl04. Logs excerpt
> > below. I
> > see there is 1 commit in v6.6.36..v6.6.37 with call to
> > bpf_jit_binary_pack_finalize, backported from 5 patch mainline patchset:
> > 
> >   f99feda5684a powerpc/bpf: use bpf_jit_binary_pack_[alloc|finalize|free]
> > 
> > Log:
> > 
> >  [8.822079] LTP: starting bpf_prog01
> >  [8.841853] [ cut here ]
> >  [8.841946] Trying to vfree() bad address (453be747)
> >  [8.842024] WARNING: CPU: 6 PID: 689 at mm/vmalloc.c:2700
> > remove_vm_area+0xb4/0xf0
> >  [8.842103] Modules linked in: virtio_rng rng_core virtio_net
> > net_failover failover sd_mod ata_generic ata_piix libata scsi_mod
> > scsi_common virtio_blk virtio_pci virtio_pci_legacy_dev
> > virtio_pci_modern_dev 9pnet_virtio virtio_ring virtio 9p 9pnet netfs
> >  [8.842323] CPU: 6 PID: 689 Comm: bpf_prog01 Not tainted
> > 6.6.37-un-def-alt1 #1
> >  [8.842396] Hardware name: IBM pSeries (emulated by qemu) POWER8
> > (raw) 0x4d0200 0xf04 of:SLOF,git-3a259d hv:linux,kvm pSeries
> >  [8.842519] NIP:  c04faf04 LR: c04faf00 CTR:
> > 
> >  [8.842598] REGS: c9b6f250 TRAP: 0700   Not tainted
> > (6.6.37-un-def-alt1)
> >  [8.842669] MSR:  80029033   CR:
> > 28002822  XER: 
> >  [8.842748] CFAR: c015df94 IRQMASK: 0
> >  [8.842748] GPR00:  c9b6f4f0
> > c1ac7f00 
> >  [8.842748] GPR04:  
> >  
> >  [8.842748] GPR08:  
> >  
> >  [8.842748] GPR12:  c0003fff7a00
> >  
> >  [8.842748] GPR16: 0012 
> > 008c 
> >  [8.842748] GPR20: c00800040a40 0002
> > c22a7560 c00800040a4c
> >  [8.842748] GPR24: c5716480 
> > c2155698 c22a7680
> >  [8.842748] GPR28: c2155688 c00800040a40
> > c00800040a40 c00800040a40
> >  [8.843347] NIP [c04faf04] remove_vm_area+0xb4/0xf0
> >  [8.843398] LR [c04faf00] remove_vm_area+0xb0/0xf0
> >  [8.843448] Call Trace:
> >  [8.843484] [c9b6f4f0] [c04faf00]
> > remove_vm_area+0xb0/0xf0 (unreliable)
> >  [8.843559] [c9b6f560] [c04fb360] vfree+0x60/0x2a0
> >  [8.843621] [c9b6f5e0] [c0269c6c]
> > module_memfree+0x3c/0x60
> >  [8.843685] [c9b6f600] [c038cf60]
> > bpf_jit_free_exec+0x20/0x40
> >  [8.843759] [c9b6f620] [c038f518]
> > bpf_prog_pack_free+0x2f8/0x390
> >  [8.843832] [c9b6f6b0] [c038f878]
> > bpf_jit_binary_pack_finalize+0x98/0xd0
> >  [8.843906] [c9b6f6e0] [c0118240]
> > bpf_int_jit_compile+0x2c0/0x710
> >  [8.843979] [c9b6f830] [c038ef64]
> > bpf_prog_select_runtime+0x154/0x1b0
> >  [8.844053] [c9b6f880] [c0398edc]
> > bpf_prog_load+0x94c/0xe90
> >  [8.844114] [c9b6f990] [c039c878] __sys_bpf+0x418/0x2970
> >  [8.844176] [c9b6fac0] [c039f1a0] sys_bpf+0x30/0x50
> >  [8.844237] [c9b6fae0] [c0030230]
> > system_call_exception+0x190/0x390
> >  [8.844312] [c9b6fe50] [c000c7d4]
> > system_call_common+0xf4/0x258
> >  [8.844386] --- interrupt: c00 at 0x7fffb0839ad4
> >  [8.844437] NIP:  7fffb0839ad4 LR: 00012a027fb4 CTR:
> > 
> >  [8.844524] REGS: c9b6fe80 TRAP: 0c00   Not tainted
> > (6.6.37-un-def-alt1)
> >  [8.844596] MSR:  8280f033
> >   CR: 22002240  XER: 
> >  [8.844690] IRQMASK: 0
> >  [8.844690] GPR00: 0169 7fffd8534200
> > 7fffb0936d00 0005
> >  [8.844690] GPR04: 7fffb06aff90 0070
> > 00012a0538a0 0001
> >  [8.844690] GPR08: 00012a0801f4 
> >  
> >  [8.844690] GPR12:  7fffb09ea540
> >  
> >  [8.844690] GPR16:  
> >  
> >  [8.844690] GPR20: 7fffd85344b0 
> > 0001 
> >  [8.844690] GPR24: 00012a0801f4 7fffb06ce000
> >  000f4240
> >  [8.844690] GPR28: 7fffb06aff90 7fffb09e3550
> > 0001 1118
> >  [8.845267] NIP [7fffb0839ad4] 0x7fffb0839ad4
> >  [8.845315] LR [00012a027fb4] 0x12a027fb4
> >  [8

[PATCH] driver core: have match() callback in struct bus_type take a const *

2024-07-01 Thread Greg Kroah-Hartman
In the match() callback, the struct device_driver * should not be
changed, so change the function callback to be a const *.  This is one
step of many towards making the driver core safe to have struct
device_driver in read-only memory.

Because the match() callback is in all busses, all busses are modified
to handle this properly.  This does entail switching some container_of()
calls to container_of_const() to properly handle the constant *.

For some busses, like PCI and USB and HV, the const * is cast away in
the match callback as those busses do want to modify those structures at
this point in time (they have a local lock in the driver structure.)
That will have to be changed in the future if they wish to have their
struct device * in read-only-memory.

Cc: "Rafael J. Wysocki" 
Signed-off-by: Greg Kroah-Hartman 
---
 - cc: list suppressed as it just touches too many different subsystems
   at once, sorry.  I tried to hit all of the mailing lists as a bcc:
   hopefully they don't reject it...

 arch/arm/common/locomo.c  |  4 ++--
 arch/arm/include/asm/hardware/locomo.h|  2 +-
 arch/parisc/include/asm/parisc-device.h   |  2 +-
 arch/parisc/kernel/drivers.c  |  4 ++--
 arch/powerpc/include/asm/ps3.h|  6 +-
 arch/powerpc/include/asm/vio.h|  6 +-
 arch/powerpc/platforms/ps3/system-bus.c   |  4 ++--
 arch/powerpc/platforms/pseries/ibmebus.c  |  2 +-
 arch/powerpc/platforms/pseries/vio.c  |  6 +++---
 arch/s390/include/asm/ccwdev.h|  2 +-
 arch/sparc/include/asm/vio.h  |  6 +-
 arch/sparc/kernel/vio.c   |  4 ++--
 drivers/acpi/bus.c|  4 ++--
 drivers/amba/bus.c|  6 +++---
 drivers/base/auxiliary.c  |  2 +-
 drivers/base/base.h   |  3 +--
 drivers/base/cpu.c|  2 +-
 drivers/base/isa.c|  2 +-
 drivers/base/platform.c   |  2 +-
 drivers/bcma/main.c   |  6 +++---
 drivers/bus/fsl-mc/fsl-mc-bus.c   |  4 ++--
 drivers/bus/mhi/ep/main.c |  4 ++--
 drivers/bus/mhi/host/init.c   |  4 ++--
 drivers/bus/mips_cdmm.c   |  6 +++---
 drivers/bus/moxtet.c  |  4 ++--
 drivers/bus/sunxi-rsb.c   |  2 +-
 drivers/cdx/cdx.c |  4 ++--
 drivers/cxl/core/port.c   |  2 +-
 drivers/cxl/cxl.h |  5 +
 drivers/dax/bus.c | 17 +++--
 drivers/dma/idxd/bus.c|  6 +++---
 drivers/eisa/eisa-bus.c   |  4 ++--
 drivers/firewire/core-device.c|  6 +++---
 drivers/firmware/arm_ffa/bus.c|  2 +-
 drivers/firmware/arm_scmi/bus.c   |  6 +++---
 drivers/firmware/google/coreboot_table.c  |  6 +++---
 drivers/fpga/dfl.c|  4 ++--
 drivers/fsi/fsi-core.c|  4 ++--
 drivers/gpio/gpiolib.c|  2 +-
 drivers/gpu/drm/display/drm_dp_aux_bus.c  |  2 +-
 drivers/gpu/drm/drm_mipi_dsi.c|  2 +-
 drivers/gpu/host1x/bus.c  |  2 +-
 drivers/greybus/core.c|  4 ++--
 drivers/hid/hid-core.c|  2 +-
 drivers/hid/intel-ish-hid/ishtp/bus.c |  2 +-
 drivers/hsi/hsi_core.c|  2 +-
 drivers/hv/vmbus_drv.c|  8 
 drivers/hwtracing/intel_th/core.c |  4 ++--
 drivers/hwtracing/intel_th/intel_th.h |  2 +-
 drivers/i2c/i2c-core-base.c   |  4 ++--
 drivers/i3c/master.c  |  4 ++--
 drivers/input/gameport/gameport.c |  4 ++--
 drivers/input/rmi4/rmi_bus.c  |  6 +++---
 drivers/input/rmi4/rmi_bus.h  |  2 +-
 drivers/input/rmi4/rmi_driver.c   |  2 +-
 drivers/input/rmi4/rmi_driver.h   |  2 +-
 drivers/input/serio/serio.c   |  4 ++--
 drivers/ipack/ipack.c |  6 +++---
 drivers/macintosh/macio_asic.c|  2 +-
 drivers/mcb/mcb-core.c|  4 ++--
 drivers/media/pci/bt8xx/bttv-gpio.c   |  4 ++--
 drivers/media/pci/bt8xx/bttv.h|  2 +-
 drivers/memstick/core/memstick.c  |  7 +++
 drivers/mfd/mcp-core.c|  2 +-
 drivers/misc/mei/bus.c|  4 ++--
 drivers/misc/tifm_core.c  |  6 +++---
 drivers/mmc/core/sdio_bus.c   | 10 +-
 drivers/most/core.c   |  2 +-
 drivers/net/phy/mdio_bus.c|  4 ++--
 drivers/net/phy/mdio_device.c  

Re: [PATCH 2/2] treewide: Use sysfs_bin_attr_simple_read() helper

2024-05-23 Thread Greg Kroah-Hartman
On Wed, May 22, 2024 at 07:51:35PM -0700, Guenter Roeck wrote:
> Hi,
> 
> On Sat, Apr 06, 2024 at 03:52:02PM +0200, Lukas Wunner wrote:
> > Deduplicate ->read() callbacks of bin_attributes which are backed by a
> > simple buffer in memory:
> > 
> > Use the newly introduced sysfs_bin_attr_simple_read() helper instead,
> > either by referencing it directly or by declaring such bin_attributes
> > with BIN_ATTR_SIMPLE_RO() or BIN_ATTR_SIMPLE_ADMIN_RO().
> > 
> > Aside from a reduction of LoC, this shaves off a few bytes from vmlinux
> > (304 bytes on an x86_64 allyesconfig).
> > 
> > No functional change intended.
> > 
> 
> Not really; see below.
> 
> > Signed-off-by: Lukas Wunner 
> > Acked-by: Michael Ellerman  (powerpc)
> > ---
> ...
> > index da79760..5193fae 100644
> > --- a/init/initramfs.c
> > +++ b/init/initramfs.c
> > @@ -575,15 +575,7 @@ static int __init initramfs_async_setup(char *str)
> >  #include 
> >  #include 
> >  
> > -static ssize_t raw_read(struct file *file, struct kobject *kobj,
> > -   struct bin_attribute *attr, char *buf,
> > -   loff_t pos, size_t count)
> > -{
> > -   memcpy(buf, attr->private + pos, count);
> > -   return count;
> > -}
> > -
> > -static BIN_ATTR(initrd, 0440, raw_read, NULL, 0);
> > +static BIN_ATTR(initrd, 0440, sysfs_bin_attr_simple_read, NULL, 0);
> >  
> 
> sysfs_bin_attr_simple_read is only declared and available if CONFIG_SYSFS=y.
> With m68k:m5208evb_defconfig + CONFIG_BLK_DEV_INITRD=y, this results in
> 
> /opt/buildbot/slave/qemu-m68k/build/init/initramfs.c:578:31:
>   error: 'sysfs_bin_attr_simple_read' undeclared here (not in a function)
> 
> This happens because CONFIG_SYSFS=n and there is no dummy function for
> sysfs_bin_attr_simple_read(). Presumably the problem will be seen for all
> configurations with CONFIG_BLK_DEV_INITRD=y and CONFIG_SYSFS=n.

Lukas, can you send a patch adding a dummy function?

thanks,

greg k-h


Re: CVE-2023-52665: powerpc/ps3_defconfig: Disable PPC64_BIG_ENDIAN_ELF_ABI_V2

2024-05-21 Thread Greg Kroah-Hartman
On Tue, May 21, 2024 at 09:47:33AM +1000, Michael Ellerman wrote:
> Greg Kroah-Hartman  writes:
> > On Mon, May 20, 2024 at 05:35:32PM +0900, Geoff Levand wrote:
> >> On 5/20/24 16:04, Michael Ellerman wrote:
> >> > Greg Kroah-Hartman  writes:
> >> >> Description
> >> >> ===
> >> >>
> >> >> In the Linux kernel, the following vulnerability has been resolved:
> >> >>
> >> >> powerpc/ps3_defconfig: Disable PPC64_BIG_ENDIAN_ELF_ABI_V2
> >> >>
> >> >> Commit 8c5fa3b5c4df ("powerpc/64: Make ELFv2 the default for big-endian
> >> >> builds"), merged in Linux-6.5-rc1 changes the calling ABI in a way
> >> >> that is incompatible with the current code for the PS3's LV1 hypervisor
> >> >> calls.
> >> >>
> >> >> This change just adds the line '# CONFIG_PPC64_BIG_ENDIAN_ELF_ABI_V2 is 
> >> >> not set'
> >> >> to the ps3_defconfig file so that the PPC64_ELF_ABI_V1 is used.
> >> >>
> >> >> Fixes run time errors like these:
> >> >>
> >> >>   BUG: Kernel NULL pointer dereference at 0x
> >> >>   Faulting instruction address: 0xc0047cf0
> >> >>   Oops: Kernel access of bad area, sig: 11 [#1]
> >> >>   Call Trace:
> >> >>   [c23039e0] [c100ebfc] ps3_create_spu+0xc4/0x2b0 
> >> >> (unreliable)
> >> >>   [c2303ab0] [c100d4c4] create_spu+0xcc/0x3c4
> >> >>   [c2303b40] [c100eae4] ps3_enumerate_spus+0xa4/0xf8
> >> >>
> >> >> The Linux kernel CVE team has assigned CVE-2023-52665 to this issue.
> >> > 
> >> > IMHO this doesn't warrant a CVE. The crash mentioned above happens at
> >> > boot, so the system is not vulnerable it's just broken :)
> >> 
> >> As Greg says, with PPC64_BIG_ENDIAN_ELF_ABI_V2 enabled the system won't
> >> boot, so there is no chance of a vulnerability.
> >
> > The definition of "vulnerability" from CVE.org is:
> > An instance of one or more weaknesses in a Product that can be
> > exploited, causing a negative impact to confidentiality, integrity, or
> > availability; a set of conditions or behaviors that allows the
> > violation of an explicit or implicit security policy.
> >
> > Having a system that does not boot is a "negative impact to
> > availability", which is why this was selected for a CVE.  I.e. if a new
> > kernel update has this problem in it, it would not allow the system to
> > boot correctly.
> 
> I think the key word above is "exploited", implying some sort of
> unauthorised action.
> 
> This bug can cause the system to not boot, but only by someone who
> builds a new kernel and installs it - and if they have permission to do
> that they can just replace the kernel with anything, they don't need a
> bug.
> 
> > But, if the maintainer of the subsystem thinks this should not be
> > assigned a CVE because of this fix, we'll be glad to revoke it.
> >
> > Michael, still want this revoked?
> 
> Yes please.

Now rejected, thanks all for the review!

greg k-h


Re: CVE-2023-52665: powerpc/ps3_defconfig: Disable PPC64_BIG_ENDIAN_ELF_ABI_V2

2024-05-20 Thread Greg Kroah-Hartman
On Mon, May 20, 2024 at 05:35:32PM +0900, Geoff Levand wrote:
> On 5/20/24 16:04, Michael Ellerman wrote:
> > Greg Kroah-Hartman  writes:
> >> Description
> >> ===
> >>
> >> In the Linux kernel, the following vulnerability has been resolved:
> >>
> >> powerpc/ps3_defconfig: Disable PPC64_BIG_ENDIAN_ELF_ABI_V2
> >>
> >> Commit 8c5fa3b5c4df ("powerpc/64: Make ELFv2 the default for big-endian
> >> builds"), merged in Linux-6.5-rc1 changes the calling ABI in a way
> >> that is incompatible with the current code for the PS3's LV1 hypervisor
> >> calls.
> >>
> >> This change just adds the line '# CONFIG_PPC64_BIG_ENDIAN_ELF_ABI_V2 is 
> >> not set'
> >> to the ps3_defconfig file so that the PPC64_ELF_ABI_V1 is used.
> >>
> >> Fixes run time errors like these:
> >>
> >>   BUG: Kernel NULL pointer dereference at 0x
> >>   Faulting instruction address: 0xc0047cf0
> >>   Oops: Kernel access of bad area, sig: 11 [#1]
> >>   Call Trace:
> >>   [c23039e0] [c100ebfc] ps3_create_spu+0xc4/0x2b0 
> >> (unreliable)
> >>   [c2303ab0] [c100d4c4] create_spu+0xcc/0x3c4
> >>   [c2303b40] [c100eae4] ps3_enumerate_spus+0xa4/0xf8
> >>
> >> The Linux kernel CVE team has assigned CVE-2023-52665 to this issue.
> > 
> > IMHO this doesn't warrant a CVE. The crash mentioned above happens at
> > boot, so the system is not vulnerable it's just broken :)
> 
> As Greg says, with PPC64_BIG_ENDIAN_ELF_ABI_V2 enabled the system won't
> boot, so there is no chance of a vulnerability.

The definition of "vulnerability" from CVE.org is:
An instance of one or more weaknesses in a Product that can be
exploited, causing a negative impact to confidentiality, integrity, or
availability; a set of conditions or behaviors that allows the
violation of an explicit or implicit security policy.

Having a system that does not boot is a "negative impact to
availability", which is why this was selected for a CVE.  I.e. if a new
kernel update has this problem in it, it would not allow the system to
boot correctly.

But, if the maintainer of the subsystem thinks this should not be
assigned a CVE because of this fix, we'll be glad to revoke it.

Michael, still want this revoked?

thanks,

greg k-h


Re: [PATCH 0/6] Deduplicate string exposure in sysfs

2024-05-04 Thread Greg Kroah-Hartman
On Sat, May 04, 2024 at 04:31:42PM +0200, Lukas Wunner wrote:
> Dear Greg,
> 
> On Sat, Apr 20, 2024 at 10:00:00PM +0200, Lukas Wunner wrote:
> > Introduce a generic ->show() callback to expose a string as a device
> > attribute in sysfs.  Deduplicate various identical callbacks across
> > the tree.
> > 
> > Result:  Minus 216 LoC, minus 1576 bytes vmlinux size (x86_64 allyesconfig).
> > 
> > This is a byproduct of my upcoming PCI device authentication v2 patches.
> > 
> > 
> > Lukas Wunner (6):
> >   driver core: Add device_show_string() helper for sysfs attributes
> >   hwmon: Use device_show_string() helper for sysfs attributes
> >   IB/qib: Use device_show_string() helper for sysfs attributes
> >   perf: Use device_show_string() helper for sysfs attributes
> >   platform/x86: Use device_show_string() helper for sysfs attributes
> >   scsi: Use device_show_string() helper for sysfs attributes
> 
> This series hasn't been applied to driver-core-next AFAICS and the
> merge window is drawing closer.
> 
> So far only patches 1, 2 and 5 have been ack'ed by the respective
> subsystem maintainers.  If the missing acks are the reason it hasn't
> been applied, would it be possibe to apply only 1, 2 and 5?
> 
> I would then resubmit the other ones individually to the subsystem
> maintainers in the next cycle.

I'll just pick it up now, thanks!

greg k-h


Re: [PATCH 0/2] Deduplicate bin_attribute simple read() callbacks

2024-04-11 Thread Greg Kroah-Hartman
On Sat, Apr 06, 2024 at 03:52:00PM +0200, Lukas Wunner wrote:
> For my upcoming PCI device authentication v2 patches, I have the need
> to expose a simple buffer in virtual memory as a bin_attribute.
> 
> It turns out we've duplicated the ->read() callback for such simple
> buffers a fair number of times across the tree.
> 
> So instead of reinventing the wheel, I decided to introduce a common
> helper and eliminate all duplications I could find.
> 
> I'm open to a bikeshedding discussion on the sysfs_bin_attr_simple_read()
> name. ;)

Seems like no one objects, should I just take this through my
driver-core tree for 6.10?

thanks,

greg k-h


Re: [PATCH 1/2] sysfs: Add sysfs_bin_attr_simple_read() helper

2024-04-11 Thread Greg Kroah-Hartman
On Sat, Apr 06, 2024 at 03:52:01PM +0200, Lukas Wunner wrote:
> When drivers expose a bin_attribute in sysfs which is backed by a buffer
> in memory, a common pattern is to set the @private and @size members in
> struct bin_attribute to the buffer's location and size.
> 
> The ->read() callback then merely consists of a single memcpy() call.
> It's not even necessary to perform bounds checks as these are already
> handled by sysfs_kf_bin_read().
> 
> However each driver is so far providing its own ->read() implementation.
> The pattern is sufficiently frequent to merit a public helper, so add
> sysfs_bin_attr_simple_read() as well as BIN_ATTR_SIMPLE_RO() and
> BIN_ATTR_SIMPLE_ADMIN_RO() macros to ease declaration of such
> bin_attributes and reduce LoC and .text section size.
> 
> Signed-off-by: Lukas Wunner 
> ---
>  fs/sysfs/file.c   | 27 +++
>  include/linux/sysfs.h | 15 +++++++
>  2 files changed, 42 insertions(+)

Reviewed-by: Greg Kroah-Hartman 


Re: [PATCH] MAINTAINERS: Drop Li Yang as their email address stopped working

2024-04-10 Thread Greg Kroah-Hartman
On Wed, Apr 10, 2024 at 08:42:06AM +0200, Uwe Kleine-König wrote:
> On Tue, Apr 09, 2024 at 02:42:04PM -0700, Jakub Kicinski wrote:
> > On Fri,  5 Apr 2024 09:20:41 +0200 Uwe Kleine-König wrote:
> > > When sending a patch to (among others) Li Yang the nxp MTA replied that
> > > the address doesn't exist and so the mail couldn't be delivered. The
> > > error code was 550, so at least technically that's not a temporal issue.
> > > 
> > > Signed-off-by: Uwe Kleine-König 
> > 
> > FWIW it's eaac25d026a1 in net, thanks!
> 
> Greg also picked it up, it's fbdd90334a6205e8a99d0bc2dfc738ee438f00bc in
> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-linus
> . Both are included in next-20240410. I guess that's not a big problem.
> (And please prevent that the patch is dropped from both trees as it's
> already included in the other :-)

We already got a report from linux-next about this, it's fine, we will
both keep it.

thanks,

greg k-h


Re: [PATCH] serial/pmac_zilog: Remove flawed mitigation for rx irq flood

2024-04-07 Thread Greg Kroah-Hartman
On Mon, Apr 08, 2024 at 07:37:22AM +0200, Jiri Slaby wrote:
> On 08. 04. 24, 7:32, Jiri Slaby wrote:
> > On 08. 04. 24, 7:29, Michael Ellerman wrote:
> > > Many maintainers won't drop Cc: tags if they are there in the submitted
> > > patch. So I agree with Andy that we should encourage folks not to add
> > > them in the first place.
> > 
> > But fix the docs first.
> > 
> > I am personally not biased to any variant (as in: I don't care where CCs
> > live in a patch).
> 
> OTOH, as a submitter, it's a major PITA to carry CCs in notes (to have those
> under the --- line). Esp. when I have patches in a queue for years.

Agreed, let's keep them where they are in the signed-off-by area, it's
not hurting or harming anything to have them there.

thanks,

greg k-h


Re: [PATCH 00/11] misc: Convert to platform remove callback returning void

2024-03-04 Thread Greg Kroah-Hartman
On Mon, Mar 04, 2024 at 11:36:23PM +0100, Uwe Kleine-König wrote:
> Hello Arnd, hello Greg,
> 
> On Wed, Feb 21, 2024 at 02:52:29PM +0100, Arnd Bergmann wrote:
> > On Wed, Feb 21, 2024, at 10:53, Uwe Kleine-König wrote:
> > > Hello,
> > >
> > > this series converts all drivers below drivers/misc to struct
> > > platform_driver::remove_new(). See commit 5c5a7680e67b ("platform:
> > > Provide a remove callback that returns no value") for an extended
> > > explanation and the eventual goal.
> > >
> > > All conversations are trivial, because their .remove() callbacks
> > > returned zero unconditionally.
> > >
> > > There are no interdependencies between these patches, so they could be
> > > picked up individually. But I'd hope that Greg or Arnd picks them up all
> > > together.
> > 
> > These all look good to me, whole series
> > 
> > Acked-by: Arnd Bergmann 
> 
> Thanks.
> 
> You (= Arnd and Greg) are the listed maintainers for drivers/misc/. How
> is this series supposed to be merged? Would a pull request help?

I can take the patchset, let me catch up...


Re: [PATCH] usb: gadget: fsl-udc: Replace custom log wrappers by pr_{err,warn,debug}

2024-03-04 Thread Greg Kroah-Hartman
On Mon, Mar 04, 2024 at 01:11:53PM +0100, Uwe Kleine-König wrote:
> The custom log wrappers ERR, WARNING and DBG don't add anything useful
> that cannot easily be done with pr_err() and friends. Replace the custom
> stuff by the well known functions from printk.h.

These really should be dev_*() as there is a device structure buried
down in there somewhere :)

thanks,

greg k-h


Re: [PATCH 0/2] ALSA: struct bus_type cleanup

2024-02-14 Thread Greg Kroah-Hartman
On Wed, Feb 14, 2024 at 04:28:27PM -0300, Ricardo B. Marliere wrote:
> This series is part of an effort to cleanup the users of the driver
> core, as can be seen in many recent patches authored by Greg across the
> tree (e.g. [1]).
> 
> ---
> [1]: 
> https://lore.kernel.org/lkml/?q=f%3Agregkh%40linuxfoundation.org+s%3A%22make%22+and+s%3A%22const%22
> 
> To: Johannes Berg 
> To: Jaroslav Kysela 
> To: Takashi Iwai 
> Cc:  
> Cc:  
> Cc:  
> Cc:  
> Cc: Greg Kroah-Hartman 
> Signed-off-by: Ricardo B. Marliere 

Reviewed-by: Greg Kroah-Hartman 


Re: [PATCH] tty: hvc-iucv: fix function pointer casts

2024-02-14 Thread Greg Kroah-Hartman
On Wed, Feb 14, 2024 at 09:46:33AM +, David Laight wrote:
> From: Segher Boessenkool
> > Sent: 13 February 2024 19:13
> > 
> > On Tue, Feb 13, 2024 at 11:17:49AM +0100, Arnd Bergmann wrote:
> > > clang warns about explicitly casting between incompatible function
> > > pointers:
> > >
> > > drivers/tty/hvc/hvc_iucv.c:1100:23: error: cast from 'void (*)(const void 
> > > *)' to 'void (*)(struct
> > device *)' converts to incompatible function type 
> > [-Werror,-Wcast-function-type-strict]
> > >  1100 | priv->dev->release = (void (*)(struct device *)) kfree;
> > >   |  ^
> > 
> > Such a cast of course is explicitly allowed by 6.3.2.3/8, only calling a
> > function using a non-compatible type is UB.  This warning message is
> > quite misleading.  Doubly so because of the -Werror, as always.
> 
> But it will get called using the wrong type.
> And (is it) fine-ibt will reject the incorrect call.

And rightfully so, this type of casting abuse is just that, abuse.

Almost no one should be just calling kfree() on a device pointer, I'll
look at the surrounding code as odds are something odd is going on.  But
for now, this patch is correct.

thanks,

greg k-h


Re: [PATCH v2 0/5] powerpc: struct bus_type cleanup

2024-02-13 Thread Greg Kroah-Hartman
On Mon, Feb 12, 2024 at 05:04:58PM -0300, Ricardo B. Marliere wrote:
> This series is part of an effort to cleanup the users of the driver
> core, as can be seen in many recent patches authored by Greg across the
> tree (e.g. [1]). Patch 1/5 is a prerequisite to 2/5, but the others have
> no dependency. They were built using bootlin's without warnings using
> powerpc64le-power8--glibc--stable-2023.11-1 toolchain.
> 
> ---
> [1]: 
> https://lore.kernel.org/lkml/?q=f%3Agregkh%40linuxfoundation.org+s%3A%22make%22+and+s%3A%22const%22
> 
> Cc: Greg Kroah-Hartman 
> Signed-off-by: Ricardo B. Marliere 

Reviewed-by: Greg Kroah-Hartman 


Re: [PATCH 0/4] powerpc: struct bus_type cleanup

2024-02-04 Thread Greg Kroah-Hartman
On Sun, Feb 04, 2024 at 11:21:54AM -0300, Ricardo B. Marliere wrote:
> This series is part of an effort to cleanup the users of the driver
> core, as can be seen in many recent patches authored by Greg across the
> tree (e.g. [1]). Specifically, this series is part of the task of
> splitting one of his TODOs [2].
> 
> ---
> [1]: 
> https://lore.kernel.org/lkml/?q=f%3Agregkh%40linuxfoundation.org+s%3A%22make%22+and+s%3A%22const%22
> [2]: 
> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git/commit/?h=bus_cleanup&id=26105f537f0c60eacfeb430abd2e05d7ddcdd8aa
> 
> Cc: Greg Kroah-Hartman 
> Signed-off-by: Ricardo B. Marliere 

Reviewed-by: Greg Kroah-Hartman 


[PATCH 6.7 517/641] perf vendor events powerpc: Update datasource event name to fix duplicate events

2024-01-22 Thread Greg Kroah-Hartman
6.7-stable review patch.  If anyone has any objections, please let me know.

--

From: Athira Rajeev 

[ Upstream commit 9eef41014fe01287dae79fe208b9b433b13040bb ]

Running "perf list" on powerpc fails with segfault as below:

   $ ./perf list
   Segmentation fault (core dumped)
   $

This happens because of duplicate events in the JSON list.  The powerpc
JSON event list contains some event with same event name, but different
event code. They are:

- PM_INST_FROM_L3MISS (Present in datasource and frontend)
- PM_MRK_DATA_FROM_L2MISS (Present in datasource and marked)
- PM_MRK_INST_FROM_L3MISS (Present in datasource and marked)
- PM_MRK_DATA_FROM_L3MISS (Present in datasource and marked)

pmu_events_table__num_events() uses the value from table_pmu->num_entries
which includes duplicate events as well. This causes issue during "perf
list" and results in a segmentation fault.

Since both event codes are valid, append _DSRC to the Data Source events
(datasource.json), so that they would have a unique name.

Also add PM_DATA_FROM_L2MISS_DSRC and PM_DATA_FROM_L3MISS_DSRC events.

With the fix, 'perf list' works as expected.

Fixes: fc143580753348c6 ("perf vendor events power10: Update JSON/events")
Signed-off-by: Athira Jajeev 
Tested-by: Disha Goel 
Cc: Adrian Hunter 
Cc: Disha Goel 
Cc: Ian Rogers 
Cc: James Clark 
Cc: Jiri Olsa 
Cc: Kajol Jain 
Cc: linuxppc-dev@lists.ozlabs.org
Cc: Madhavan Srinivasan 
Cc: Namhyung Kim 
Link: 
https://lore.kernel.org/r/20231123160110.94090-1-atraj...@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Sasha Levin 
---
 .../arch/powerpc/power10/datasource.json   | 18 ++
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/tools/perf/pmu-events/arch/powerpc/power10/datasource.json 
b/tools/perf/pmu-events/arch/powerpc/power10/datasource.json
index 6b0356f2d301..0eeaaf1a95b8 100644
--- a/tools/perf/pmu-events/arch/powerpc/power10/datasource.json
+++ b/tools/perf/pmu-events/arch/powerpc/power10/datasource.json
@@ -99,6 +99,11 @@
 "EventName": "PM_INST_FROM_L2MISS",
 "BriefDescription": "The processor's instruction cache was reloaded from a 
source beyond the local core's L2 due to a demand miss."
   },
+  {
+"EventCode": "0x0003C000C040",
+"EventName": "PM_DATA_FROM_L2MISS_DSRC",
+"BriefDescription": "The processor's L1 data cache was reloaded from a 
source beyond the local core's L2 due to a demand miss."
+  },
   {
 "EventCode": "0x00038010C040",
 "EventName": "PM_INST_FROM_L2MISS_ALL",
@@ -161,9 +166,14 @@
   },
   {
 "EventCode": "0x00078000C040",
-"EventName": "PM_INST_FROM_L3MISS",
+"EventName": "PM_INST_FROM_L3MISS_DSRC",
 "BriefDescription": "The processor's instruction cache was reloaded from 
beyond the local core's L3 due to a demand miss."
   },
+  {
+"EventCode": "0x0007C000C040",
+"EventName": "PM_DATA_FROM_L3MISS_DSRC",
+"BriefDescription": "The processor's L1 data cache was reloaded from 
beyond the local core's L3 due to a demand miss."
+  },
   {
 "EventCode": "0x00078010C040",
 "EventName": "PM_INST_FROM_L3MISS_ALL",
@@ -981,7 +991,7 @@
   },
   {
 "EventCode": "0x0003C000C142",
-"EventName": "PM_MRK_DATA_FROM_L2MISS",
+"EventName": "PM_MRK_DATA_FROM_L2MISS_DSRC",
 "BriefDescription": "The processor's L1 data cache was reloaded from a 
source beyond the local core's L2 due to a demand miss for a marked 
instruction."
   },
   {
@@ -1046,12 +1056,12 @@
   },
   {
 "EventCode": "0x00078000C142",
-"EventName": "PM_MRK_INST_FROM_L3MISS",
+"EventName": "PM_MRK_INST_FROM_L3MISS_DSRC",
 "BriefDescription": "The processor's instruction cache was reloaded from 
beyond the local core's L3 due to a demand miss for a marked instruction."
   },
   {
 "EventCode": "0x0007C000C142",
-"EventName": "PM_MRK_DATA_FROM_L3MISS",
+"EventName": "PM_MRK_DATA_FROM_L3MISS_DSRC",
 "BriefDescription": "The processor's L1 data cache was reloaded from 
beyond the local core's L3 due to a demand miss for a marked instruction."
   },
   {
-- 
2.43.0





Re: [PATCH 5.15 00/67] 5.15.142-rc1 review

2023-12-05 Thread Greg Kroah-Hartman
On Tue, Dec 05, 2023 at 10:18:49PM +0530, Naresh Kamboju wrote:
> On Tue, 5 Dec 2023 at 09:10, Greg Kroah-Hartman
>  wrote:
> >
> > This is the start of the stable review cycle for the 5.15.142 release.
> > There are 67 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> >
> > Responses should be made by Thu, 07 Dec 2023 03:14:57 +.
> > Anything received after that time might be too late.
> >
> > The whole patch series can be found in one patch at:
> > 
> > https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.142-rc1.gz
> > or in the git tree and branch at:
> > 
> > git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
> > linux-5.15.y
> > and the diffstat can be found below.
> >
> > thanks,
> >
> > greg k-h
> 
> 
> Following powerpc build failures noticed.
> 
> * powerpc, build
>   - clang-17-defconfig - FAILED
>   - gcc-12-defconfig - FAILED
>   - gcc-8-defconfig - FAILED
> 
> build error:
> ---
> arch/powerpc/platforms/pseries/iommu.c: In function 'find_existing_ddw':
> arch/powerpc/platforms/pseries/iommu.c:908:49: error: 'struct dma_win'
> has no member named 'direct'
>   908 | *direct_mapping = window->direct;
>   | ^~
> 
> suspected commit:
> powerpc/pseries/iommu: enable_ddw incorrectly returns direct mapping
> for SR-IOV device
>  [ Upstream commit 3bf983e4e93ce8e6d69e9d63f52a66ec0856672e ]
> 
> Reported-by: Linux Kernel Functional Testing 

Thanks, now dropped from 5.15.y and 6.1.y


Re: [PATCH v5 4/5] tty: Add SBI debug console support to HVC SBI driver

2023-11-28 Thread Greg Kroah-Hartman
On Fri, Nov 24, 2023 at 12:39:04PM +0530, Anup Patel wrote:
> From: Atish Patra 
> 
> RISC-V SBI specification supports advanced debug console
> support via SBI DBCN extension.
> 
> Extend the HVC SBI driver to support it.
> 
> Signed-off-by: Atish Patra 
> Signed-off-by: Anup Patel 
> ---
>  drivers/tty/hvc/Kconfig |  2 +-
>  drivers/tty/hvc/hvc_riscv_sbi.c | 37 ++---
>  2 files changed, 31 insertions(+), 8 deletions(-)

Acked-by: Greg Kroah-Hartman 


Re: [PATCH v5 3/5] tty/serial: Add RISC-V SBI debug console based earlycon

2023-11-28 Thread Greg Kroah-Hartman
On Fri, Nov 24, 2023 at 12:39:03PM +0530, Anup Patel wrote:
> We extend the existing RISC-V SBI earlycon support to use the new
> RISC-V SBI debug console extension.
> 
> Signed-off-by: Anup Patel 
> Reviewed-by: Andrew Jones 
> ---
>  drivers/tty/serial/Kconfig  |  2 +-
>  drivers/tty/serial/earlycon-riscv-sbi.c | 27 ++---
>  2 files changed, 25 insertions(+), 4 deletions(-)

Acked-by: Greg Kroah-Hartman 


Re: [PATCH 20/22] usb: fsl-mph-dr-of: mark fsl_usb2_mpc5121_init() static

2023-11-21 Thread Greg Kroah-Hartman
On Wed, Nov 08, 2023 at 01:58:41PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann 
> 
> This function is only called locally and should always have been static:
> 
> drivers/usb/host/fsl-mph-dr-of.c:291:5: error: no previous prototype for 
> 'fsl_usb2_mpc5121_init' [-Werror=missing-prototypes]
> 
> Fixes: 230f7ede6c2f ("USB: add USB EHCI support for MPC5121 SoC")
> Signed-off-by: Arnd Bergmann 

Acked-by: Greg Kroah-Hartman 


Re: [PATCH] cxl: make cxl_class constant

2023-10-25 Thread Greg Kroah-Hartman
On Wed, Oct 25, 2023 at 10:16:55AM +0200, Frederic Barrat wrote:
> 
> 
> On 24/10/2023 13:48, Greg Kroah-Hartman wrote:
> > Now that the driver core allows for struct class to be in read-only
> > memory, we should make all 'class' structures declared at build time
> > placing them into read-only memory, instead of having to be dynamically
> > allocated at runtime.
> > 
> > Cc: Frederic Barrat 
> > Cc: Andrew Donnellan 
> > Cc: Arnd Bergmann 
> > Cc: linuxppc-dev@lists.ozlabs.org
> > Signed-off-by: Greg Kroah-Hartman 
> > ---
> 
> Thanks!
> Acked-by: Frederic Barrat 

Thanks for the review of these, I'll take them through my char/misc tree
now.

greg k-h


[PATCH] ocxl: make ocxl_class constant

2023-10-24 Thread Greg Kroah-Hartman
Now that the driver core allows for struct class to be in read-only
memory, we should make all 'class' structures declared at build time
placing them into read-only memory, instead of having to be dynamically
allocated at runtime.

Cc: Frederic Barrat 
Cc: Andrew Donnellan 
Cc: Arnd Bergmann 
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/misc/ocxl/file.c | 27 +++
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c
index 6e63f060e4cc..ac69b7f361f5 100644
--- a/drivers/misc/ocxl/file.c
+++ b/drivers/misc/ocxl/file.c
@@ -14,7 +14,6 @@
 #define OCXL_NUM_MINORS 256 /* Total to reserve */
 
 static dev_t ocxl_dev;
-static struct class *ocxl_class;
 static DEFINE_MUTEX(minors_idr_lock);
 static struct idr minors_idr;
 
@@ -509,6 +508,16 @@ static void ocxl_file_make_invisible(struct ocxl_file_info 
*info)
cdev_del(&info->cdev);
 }
 
+static char *ocxl_devnode(const struct device *dev, umode_t *mode)
+{
+   return kasprintf(GFP_KERNEL, "ocxl/%s", dev_name(dev));
+}
+
+static const struct class ocxl_class = {
+   .name = "ocxl",
+   .devnode =  ocxl_devnode,
+};
+
 int ocxl_file_register_afu(struct ocxl_afu *afu)
 {
int minor;
@@ -529,7 +538,7 @@ int ocxl_file_register_afu(struct ocxl_afu *afu)
 
info->dev.parent = &fn->dev;
info->dev.devt = MKDEV(MAJOR(ocxl_dev), minor);
-   info->dev.class = ocxl_class;
+   info->dev.class = &ocxl_class;
info->dev.release = info_release;
 
info->afu = afu;
@@ -584,11 +593,6 @@ void ocxl_file_unregister_afu(struct ocxl_afu *afu)
device_unregister(&info->dev);
 }
 
-static char *ocxl_devnode(const struct device *dev, umode_t *mode)
-{
-   return kasprintf(GFP_KERNEL, "ocxl/%s", dev_name(dev));
-}
-
 int ocxl_file_init(void)
 {
int rc;
@@ -601,20 +605,19 @@ int ocxl_file_init(void)
return rc;
}
 
-   ocxl_class = class_create("ocxl");
-   if (IS_ERR(ocxl_class)) {
+   rc = class_register(&ocxl_class);
+   if (rc) {
pr_err("Unable to create ocxl class\n");
unregister_chrdev_region(ocxl_dev, OCXL_NUM_MINORS);
-   return PTR_ERR(ocxl_class);
+   return rc;
}
 
-   ocxl_class->devnode = ocxl_devnode;
return 0;
 }
 
 void ocxl_file_exit(void)
 {
-   class_destroy(ocxl_class);
+   class_unregister(&ocxl_class);
unregister_chrdev_region(ocxl_dev, OCXL_NUM_MINORS);
idr_destroy(&minors_idr);
 }
-- 
2.42.0



[PATCH] cxl: make cxl_class constant

2023-10-24 Thread Greg Kroah-Hartman
Now that the driver core allows for struct class to be in read-only
memory, we should make all 'class' structures declared at build time
placing them into read-only memory, instead of having to be dynamically
allocated at runtime.

Cc: Frederic Barrat 
Cc: Andrew Donnellan 
Cc: Arnd Bergmann 
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/misc/cxl/file.c | 21 ++---
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/misc/cxl/file.c b/drivers/misc/cxl/file.c
index 144d1f2d78ce..012e11b959bc 100644
--- a/drivers/misc/cxl/file.c
+++ b/drivers/misc/cxl/file.c
@@ -38,8 +38,6 @@
 
 static dev_t cxl_dev;
 
-static struct class *cxl_class;
-
 static int __afu_open(struct inode *inode, struct file *file, bool master)
 {
struct cxl *adapter;
@@ -559,7 +557,10 @@ static char *cxl_devnode(const struct device *dev, umode_t 
*mode)
return kasprintf(GFP_KERNEL, "cxl/%s", dev_name(dev));
 }
 
-extern struct class *cxl_class;
+static const struct class cxl_class = {
+   .name = "cxl",
+   .devnode =  cxl_devnode,
+};
 
 static int cxl_add_chardev(struct cxl_afu *afu, dev_t devt, struct cdev *cdev,
   struct device **chardev, char *postfix, char *desc,
@@ -575,7 +576,7 @@ static int cxl_add_chardev(struct cxl_afu *afu, dev_t devt, 
struct cdev *cdev,
return rc;
}
 
-   dev = device_create(cxl_class, &afu->dev, devt, afu,
+   dev = device_create(&cxl_class, &afu->dev, devt, afu,
"afu%i.%i%s", afu->adapter->adapter_num, afu->slice, 
postfix);
if (IS_ERR(dev)) {
rc = PTR_ERR(dev);
@@ -633,14 +634,14 @@ void cxl_chardev_afu_remove(struct cxl_afu *afu)
 
 int cxl_register_afu(struct cxl_afu *afu)
 {
-   afu->dev.class = cxl_class;
+   afu->dev.class = &cxl_class;
 
return device_register(&afu->dev);
 }
 
 int cxl_register_adapter(struct cxl *adapter)
 {
-   adapter->dev.class = cxl_class;
+   adapter->dev.class = &cxl_class;
 
/*
 * Future: When we support dynamically reprogramming the PSL & AFU we
@@ -678,13 +679,11 @@ int __init cxl_file_init(void)
 
pr_devel("CXL device allocated, MAJOR %i\n", MAJOR(cxl_dev));
 
-   cxl_class = class_create("cxl");
-   if (IS_ERR(cxl_class)) {
+   rc = class_register(&cxl_class);
+   if (rc) {
pr_err("Unable to create CXL class\n");
-   rc = PTR_ERR(cxl_class);
goto err;
}
-   cxl_class->devnode = cxl_devnode;
 
return 0;
 
@@ -696,5 +695,5 @@ int __init cxl_file_init(void)
 void cxl_file_exit(void)
 {
unregister_chrdev_region(cxl_dev, CXL_NUM_MINORS);
-   class_destroy(cxl_class);
+   class_unregister(&cxl_class);
 }
-- 
2.42.0



Re: [PATCH v3 8/9] tty: Add SBI debug console support to HVC SBI driver

2023-10-21 Thread Greg Kroah-Hartman
On Fri, Oct 20, 2023 at 12:51:39PM +0530, Anup Patel wrote:
> From: Atish Patra 
> 
> RISC-V SBI specification supports advanced debug console
> support via SBI DBCN extension.
> 
> Extend the HVC SBI driver to support it.
> 
> Signed-off-by: Atish Patra 
> Signed-off-by: Anup Patel 
> ---
>  drivers/tty/hvc/Kconfig |  2 +-
>  drivers/tty/hvc/hvc_riscv_sbi.c | 82 ++---
>  2 files changed, 76 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/tty/hvc/Kconfig b/drivers/tty/hvc/Kconfig
> index 4f9264d005c0..6e05c5c7bca1 100644
> --- a/drivers/tty/hvc/Kconfig
> +++ b/drivers/tty/hvc/Kconfig
> @@ -108,7 +108,7 @@ config HVC_DCC_SERIALIZE_SMP
>  
>  config HVC_RISCV_SBI
>   bool "RISC-V SBI console support"
> - depends on RISCV_SBI_V01
> + depends on RISCV_SBI
>   select HVC_DRIVER
>   help
> This enables support for console output via RISC-V SBI calls, which
> diff --git a/drivers/tty/hvc/hvc_riscv_sbi.c b/drivers/tty/hvc/hvc_riscv_sbi.c
> index 31f53fa77e4a..56da1a4b5aca 100644
> --- a/drivers/tty/hvc/hvc_riscv_sbi.c
> +++ b/drivers/tty/hvc/hvc_riscv_sbi.c
> @@ -39,21 +39,89 @@ static int hvc_sbi_tty_get(uint32_t vtermno, char *buf, 
> int count)
>   return i;
>  }
>  
> -static const struct hv_ops hvc_sbi_ops = {
> +static const struct hv_ops hvc_sbi_v01_ops = {
>   .get_chars = hvc_sbi_tty_get,
>   .put_chars = hvc_sbi_tty_put,
>  };
>  
> -static int __init hvc_sbi_init(void)
> +static int hvc_sbi_dbcn_tty_put(uint32_t vtermno, const char *buf, int count)
>  {
> - return PTR_ERR_OR_ZERO(hvc_alloc(0, 0, &hvc_sbi_ops, 16));
> + phys_addr_t pa;
> + struct sbiret ret;
> +
> + if (is_vmalloc_addr(buf)) {
> + pa = page_to_phys(vmalloc_to_page(buf)) + offset_in_page(buf);
> + if (PAGE_SIZE < (offset_in_page(buf) + count))
> + count = PAGE_SIZE - offset_in_page(buf);
> + } else {
> + pa = __pa(buf);
> + }
> +
> + if (IS_ENABLED(CONFIG_32BIT))
> + ret = sbi_ecall(SBI_EXT_DBCN, SBI_EXT_DBCN_CONSOLE_WRITE,
> + count, lower_32_bits(pa), upper_32_bits(pa),
> + 0, 0, 0);
> + else
> + ret = sbi_ecall(SBI_EXT_DBCN, SBI_EXT_DBCN_CONSOLE_WRITE,
> + count, pa, 0, 0, 0, 0);

Again, you need a helper function here to keep you from having to keep
this all in sync.

> + if (ret.error)
> + return 0;
> +
> + return count;
>  }
> -device_initcall(hvc_sbi_init);
>  
> -static int __init hvc_sbi_console_init(void)
> +static int hvc_sbi_dbcn_tty_get(uint32_t vtermno, char *buf, int count)
>  {
> - hvc_instantiate(0, 0, &hvc_sbi_ops);
> + phys_addr_t pa;
> + struct sbiret ret;
> +
> + if (is_vmalloc_addr(buf)) {
> + pa = page_to_phys(vmalloc_to_page(buf)) + offset_in_page(buf);
> + if (PAGE_SIZE < (offset_in_page(buf) + count))
> + count = PAGE_SIZE - offset_in_page(buf);
> + } else {
> + pa = __pa(buf);
> + }
> +
> + if (IS_ENABLED(CONFIG_32BIT))
> + ret = sbi_ecall(SBI_EXT_DBCN, SBI_EXT_DBCN_CONSOLE_READ,
> + count, lower_32_bits(pa), upper_32_bits(pa),
> + 0, 0, 0);
> + else
> + ret = sbi_ecall(SBI_EXT_DBCN, SBI_EXT_DBCN_CONSOLE_READ,
> + count, pa, 0, 0, 0, 0);

And here too.

thanks,

greg k-h


Re: [PATCH v3 7/9] tty/serial: Add RISC-V SBI debug console based earlycon

2023-10-21 Thread Greg Kroah-Hartman
On Fri, Oct 20, 2023 at 12:51:38PM +0530, Anup Patel wrote:
> We extend the existing RISC-V SBI earlycon support to use the new
> RISC-V SBI debug console extension.
> 
> Signed-off-by: Anup Patel 
> Reviewed-by: Andrew Jones 
> ---
>  drivers/tty/serial/Kconfig  |  2 +-
>  drivers/tty/serial/earlycon-riscv-sbi.c | 32 +
>  2 files changed, 29 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
> index bdc568a4ab66..cec46091a716 100644
> --- a/drivers/tty/serial/Kconfig
> +++ b/drivers/tty/serial/Kconfig
> @@ -87,7 +87,7 @@ config SERIAL_EARLYCON_SEMIHOST
>  
>  config SERIAL_EARLYCON_RISCV_SBI
>   bool "Early console using RISC-V SBI"
> - depends on RISCV_SBI_V01
> + depends on RISCV_SBI
>   select SERIAL_CORE
>   select SERIAL_CORE_CONSOLE
>   select SERIAL_EARLYCON
> diff --git a/drivers/tty/serial/earlycon-riscv-sbi.c 
> b/drivers/tty/serial/earlycon-riscv-sbi.c
> index 27afb0b74ea7..c21cdef254e7 100644
> --- a/drivers/tty/serial/earlycon-riscv-sbi.c
> +++ b/drivers/tty/serial/earlycon-riscv-sbi.c
> @@ -15,17 +15,41 @@ static void sbi_putc(struct uart_port *port, unsigned 
> char c)
>   sbi_console_putchar(c);
>  }
>  
> -static void sbi_console_write(struct console *con,
> -   const char *s, unsigned n)
> +static void sbi_0_1_console_write(struct console *con,
> +   const char *s, unsigned int n)
>  {
>   struct earlycon_device *dev = con->data;
>   uart_console_write(&dev->port, s, n, sbi_putc);
>  }
>  
> +static void sbi_dbcn_console_write(struct console *con,
> +const char *s, unsigned int n)
> +{
> + phys_addr_t pa = __pa(s);
> +
> + if (IS_ENABLED(CONFIG_32BIT))
> + sbi_ecall(SBI_EXT_DBCN, SBI_EXT_DBCN_CONSOLE_WRITE,
> +   n, lower_32_bits(pa), upper_32_bits(pa), 0, 0, 0);
> + else
> + sbi_ecall(SBI_EXT_DBCN, SBI_EXT_DBCN_CONSOLE_WRITE,
> +   n, pa, 0, 0, 0, 0);

This is still a bit hard to follow, and I guarantee it will be a pain to
maintain over time, trying to keep both calls in sync, right?

Why not fix up sbi_ecall() to get this correct instead?  It should be
handling phys_addr_t values, not forcing you to do odd bit masking every
single time you call it, right?  That would make things much easier
overall, and this patch simpler, as well as the next one.

Oh wait, sbi_ecall() is crazy, and just a pass-through, so that's not
going to work, you need a wrapper function for this mess to do that bit
twiddeling for you instead of forcing you to do it each time, I guess
that's what you are trying to do here, but ick, is it correct?

thanks,

greg k-h


Re: [PATCH v3 6/9] RISC-V: Add stubs for sbi_console_putchar/getchar()

2023-10-21 Thread Greg Kroah-Hartman
On Fri, Oct 20, 2023 at 12:51:37PM +0530, Anup Patel wrote:
> The functions sbi_console_putchar() and sbi_console_getchar() are
> not defined when CONFIG_RISCV_SBI_V01 is disabled so let us add
> stub of these functions to avoid "#ifdef" on user side.
> 
> Signed-off-by: Anup Patel 
> Reviewed-by: Andrew Jones 
> ---
>  arch/riscv/include/asm/sbi.h | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h
> index 12dfda6bb924..cbcefa344417 100644
> --- a/arch/riscv/include/asm/sbi.h
> +++ b/arch/riscv/include/asm/sbi.h
> @@ -271,8 +271,13 @@ struct sbiret sbi_ecall(int ext, int fid, unsigned long 
> arg0,
>   unsigned long arg3, unsigned long arg4,
>   unsigned long arg5);
>  
> +#ifdef CONFIG_RISCV_SBI_V01
>  void sbi_console_putchar(int ch);
>  int sbi_console_getchar(void);
> +#else
> +static inline void sbi_console_putchar(int ch) { }
> +static inline int sbi_console_getchar(void) { return -1; }

Why not return a real error, "-1" isn't that :)

thanks,

greg k-h


Re: [PATCH v2 1/3] hvc/xen: fix event channel handling for secondary consoles

2023-10-21 Thread Greg Kroah-Hartman
On Fri, Oct 20, 2023 at 05:15:27PM +0100, David Woodhouse wrote:
> From: David Woodhouse 
> 
> The xencons_connect_backend() function allocates a local interdomain
> event channel with xenbus_alloc_evtchn(), then calls
> bind_interdomain_evtchn_to_irq_lateeoi() to bind to that port# on the
> *remote* domain.
> 
> That doesn't work very well:
> 
> (qemu) device_add xen-console,id=con1,chardev=pty0
> [   44.323872] xenconsole console-1: 2 xenbus_dev_probe on device/console/1
> [   44.323995] xenconsole: probe of console-1 failed with error -2
> 
> Fix it to use bind_evtchn_to_irq_lateeoi(), which does the right thing
> by just binding that *local* event channel to an irq. The backend will
> do the interdomain binding.
> 
> This didn't affect the primary console because the setup for that is
> special — the toolstack allocates the guest event channel and the guest
> discovers it with HVMOP_get_param.
> 
> Fixes: fe415186b4 ("xen/console: harden hvc_xen against event channel storms")

Nit, our tools complain that the sha1 isn't big enough, "fe415186b43d"
I'll go fix it up...



Re: [PATCH 2/6] RISC-V: KVM: Change the SBI specification version to v2.0

2023-10-11 Thread Greg Kroah-Hartman
On Wed, Oct 11, 2023 at 04:32:22PM +0530, Anup Patel wrote:
> On Wed, Oct 11, 2023 at 12:57 PM Greg Kroah-Hartman
>  wrote:
> >
> > On Wed, Oct 11, 2023 at 11:49:14AM +0530, Anup Patel wrote:
> > > On Tue, Oct 10, 2023 at 10:43 PM Greg Kroah-Hartman
> > >  wrote:
> > > >
> > > > On Tue, Oct 10, 2023 at 10:34:59PM +0530, Anup Patel wrote:
> > > > > We will be implementing SBI DBCN extension for KVM RISC-V so let
> > > > > us change the KVM RISC-V SBI specification version to v2.0.
> > > > >
> > > > > Signed-off-by: Anup Patel 
> > > > > ---
> > > > >  arch/riscv/include/asm/kvm_vcpu_sbi.h | 2 +-
> > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/arch/riscv/include/asm/kvm_vcpu_sbi.h 
> > > > > b/arch/riscv/include/asm/kvm_vcpu_sbi.h
> > > > > index cdcf0ff07be7..8d6d4dce8a5e 100644
> > > > > --- a/arch/riscv/include/asm/kvm_vcpu_sbi.h
> > > > > +++ b/arch/riscv/include/asm/kvm_vcpu_sbi.h
> > > > > @@ -11,7 +11,7 @@
> > > > >
> > > > >  #define KVM_SBI_IMPID 3
> > > > >
> > > > > -#define KVM_SBI_VERSION_MAJOR 1
> > > > > +#define KVM_SBI_VERSION_MAJOR 2
> > > >
> > > > What does this number mean?  Who checks it?  Why do you have to keep
> > > > incrementing it?
> > >
> > > This number is the SBI specification version implemented by KVM RISC-V
> > > for the Guest kernel.
> > >
> > > The original sbi_console_putchar() and sbi_console_getchar() are legacy
> > > functions (aka SBI v0.1) which were introduced a few years back along
> > > with the Linux RISC-V port.
> > >
> > > The latest SBI v2.0 specification (which is now frozen) introduces a new
> > > SBI debug console extension which replaces legacy sbi_console_putchar()
> > > and sbi_console_getchar() functions with better alternatives.
> > > (Refer, 
> > > https://github.com/riscv-non-isa/riscv-sbi-doc/releases/download/commit-fe4562532a9cc57e5743b6466946c5e5c98c73ca/riscv-sbi.pdf)
> > >
> > > This series adds SBI debug console implementation in KVM RISC-V
> > > so the SBI specification version advertised by KVM RISC-V must also be
> > > upgraded to v2.0.
> > >
> > > Regarding who checks its, the SBI client drivers in the Linux kernel
> > > will check SBI specification version implemented by higher privilege
> > > mode (M-mode firmware or HS-mode hypervisor) before probing
> > > the SBI extension. For example, the HVC SBI driver (PATCH5)
> > > will ensure SBI spec version to be at least v2.0 before probing
> > > SBI debug console extension.
> >
> > Is this api backwards compatible, or did you just break existing
> > userspace that only expects version 1.0?
> 
> The legacy sbi_console_putchar() and sbi_console_getchar()
> functions have not changed so it does not break existing
> user-space.
> 
> The new SBI DBCN functions to be implemented by KVM
> user space are:
> sbi_debug_console_write()
> sbi_debug_console_read()
> sbi_debug_console_write_byte()

And where exactly is that code for us to review that this is tested?

thanks,

greg k-h


Re: [PATCH 2/6] RISC-V: KVM: Change the SBI specification version to v2.0

2023-10-11 Thread Greg Kroah-Hartman
On Wed, Oct 11, 2023 at 11:49:14AM +0530, Anup Patel wrote:
> On Tue, Oct 10, 2023 at 10:43 PM Greg Kroah-Hartman
>  wrote:
> >
> > On Tue, Oct 10, 2023 at 10:34:59PM +0530, Anup Patel wrote:
> > > We will be implementing SBI DBCN extension for KVM RISC-V so let
> > > us change the KVM RISC-V SBI specification version to v2.0.
> > >
> > > Signed-off-by: Anup Patel 
> > > ---
> > >  arch/riscv/include/asm/kvm_vcpu_sbi.h | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/arch/riscv/include/asm/kvm_vcpu_sbi.h 
> > > b/arch/riscv/include/asm/kvm_vcpu_sbi.h
> > > index cdcf0ff07be7..8d6d4dce8a5e 100644
> > > --- a/arch/riscv/include/asm/kvm_vcpu_sbi.h
> > > +++ b/arch/riscv/include/asm/kvm_vcpu_sbi.h
> > > @@ -11,7 +11,7 @@
> > >
> > >  #define KVM_SBI_IMPID 3
> > >
> > > -#define KVM_SBI_VERSION_MAJOR 1
> > > +#define KVM_SBI_VERSION_MAJOR 2
> >
> > What does this number mean?  Who checks it?  Why do you have to keep
> > incrementing it?
> 
> This number is the SBI specification version implemented by KVM RISC-V
> for the Guest kernel.
> 
> The original sbi_console_putchar() and sbi_console_getchar() are legacy
> functions (aka SBI v0.1) which were introduced a few years back along
> with the Linux RISC-V port.
> 
> The latest SBI v2.0 specification (which is now frozen) introduces a new
> SBI debug console extension which replaces legacy sbi_console_putchar()
> and sbi_console_getchar() functions with better alternatives.
> (Refer, 
> https://github.com/riscv-non-isa/riscv-sbi-doc/releases/download/commit-fe4562532a9cc57e5743b6466946c5e5c98c73ca/riscv-sbi.pdf)
> 
> This series adds SBI debug console implementation in KVM RISC-V
> so the SBI specification version advertised by KVM RISC-V must also be
> upgraded to v2.0.
> 
> Regarding who checks its, the SBI client drivers in the Linux kernel
> will check SBI specification version implemented by higher privilege
> mode (M-mode firmware or HS-mode hypervisor) before probing
> the SBI extension. For example, the HVC SBI driver (PATCH5)
> will ensure SBI spec version to be at least v2.0 before probing
> SBI debug console extension.

Is this api backwards compatible, or did you just break existing
userspace that only expects version 1.0?

thanks,

greg k-h


Re: [PATCH 3/6] RISC-V: KVM: Forward SBI DBCN extension to user-space

2023-10-11 Thread Greg Kroah-Hartman
On Wed, Oct 11, 2023 at 12:02:30PM +0530, Anup Patel wrote:
> On Tue, Oct 10, 2023 at 10:45 PM Greg Kroah-Hartman
>  wrote:
> >
> > On Tue, Oct 10, 2023 at 10:35:00PM +0530, Anup Patel wrote:
> > > The SBI DBCN extension needs to be emulated in user-space
> >
> > Why?
> 
> The SBI debug console is similar to a console port available to
> KVM Guest so the KVM user space tool (i.e. QEMU-KVM or
> KVMTOOL) can redirect the input/output of SBI debug console
> wherever it wants (e.g.  telnet, file, stdio, etc).
> 
> We forward SBI DBCN calls to KVM user space so that the
> in-kernel KVM does not need to be aware of the guest
> console devices.

Hint, my "Why" was attempting to get you to write a better changelog
description, which would include the above information.  Please read the
kernel documentation for hints on how to do this so that we know what
why changes are being made.

> > > so let
> > > us forward console_puts() call to user-space.
> >
> > What could go wrong!
> >
> > Why does userspace have to get involved in a console message?  Why is
> > this needed at all?  The kernel can not handle userspace consoles as
> > obviously they have to be re-entrant and irq safe.
> 
> As mentioned above, these are KVM guest console messages which
> the VMM (i.e. KVM user-space) can choose to manage on its own.

If it chooses not to, what happens?

> This is more about providing flexibility to KVM user-space which
> allows it to manage guest console devices.

Why not use the normal virtio console device interface instead of making
a riscv-custom one?

Where is the userspace side of this interface at?  Where are the patches
to handle this new api you added?

> 
> >
> > >
> > > Signed-off-by: Anup Patel 
> > > ---
> > >  arch/riscv/include/asm/kvm_vcpu_sbi.h |  1 +
> > >  arch/riscv/include/uapi/asm/kvm.h |  1 +
> > >  arch/riscv/kvm/vcpu_sbi.c |  4 
> > >  arch/riscv/kvm/vcpu_sbi_replace.c | 31 +++
> > >  4 files changed, 37 insertions(+)
> > >
> > > diff --git a/arch/riscv/include/asm/kvm_vcpu_sbi.h 
> > > b/arch/riscv/include/asm/kvm_vcpu_sbi.h
> > > index 8d6d4dce8a5e..a85f95eb6e85 100644
> > > --- a/arch/riscv/include/asm/kvm_vcpu_sbi.h
> > > +++ b/arch/riscv/include/asm/kvm_vcpu_sbi.h
> > > @@ -69,6 +69,7 @@ extern const struct kvm_vcpu_sbi_extension 
> > > vcpu_sbi_ext_ipi;
> > >  extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_rfence;
> > >  extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_srst;
> > >  extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_hsm;
> > > +extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_dbcn;
> > >  extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_experimental;
> > >  extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_vendor;
> > >
> > > diff --git a/arch/riscv/include/uapi/asm/kvm.h 
> > > b/arch/riscv/include/uapi/asm/kvm.h
> > > index 917d8cc2489e..60d3b21dead7 100644
> > > --- a/arch/riscv/include/uapi/asm/kvm.h
> > > +++ b/arch/riscv/include/uapi/asm/kvm.h
> > > @@ -156,6 +156,7 @@ enum KVM_RISCV_SBI_EXT_ID {
> > >   KVM_RISCV_SBI_EXT_PMU,
> > >   KVM_RISCV_SBI_EXT_EXPERIMENTAL,
> > >   KVM_RISCV_SBI_EXT_VENDOR,
> > > + KVM_RISCV_SBI_EXT_DBCN,
> > >   KVM_RISCV_SBI_EXT_MAX,
> >
> > You just broke a user/kernel ABI here, why?
> 
> The KVM_RISCV_SBI_EXT_MAX only represents the number
> of entries in "enum KVM_RISCV_SBI_EXT_ID" so we are not
> breaking "enum KVM_RISCV_SBI_EXT_ID" rather appending
> new ID to existing enum.

So you are sure that userspace never actually tests or sends that _MAX
value anywhere?  If not, why is it even needed?

thanks,

greg k-h


Re: [PATCH 4/6] tty/serial: Add RISC-V SBI debug console based earlycon

2023-10-10 Thread Greg Kroah-Hartman
On Tue, Oct 10, 2023 at 10:35:01PM +0530, Anup Patel wrote:
> We extend the existing RISC-V SBI earlycon support to use the new
> RISC-V SBI debug console extension.
> 
> Signed-off-by: Anup Patel 
> ---
>  drivers/tty/serial/Kconfig  |  2 +-
>  drivers/tty/serial/earlycon-riscv-sbi.c | 35 ++---
>  2 files changed, 32 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
> index bdc568a4ab66..cec46091a716 100644
> --- a/drivers/tty/serial/Kconfig
> +++ b/drivers/tty/serial/Kconfig
> @@ -87,7 +87,7 @@ config SERIAL_EARLYCON_SEMIHOST
>  
>  config SERIAL_EARLYCON_RISCV_SBI
>   bool "Early console using RISC-V SBI"
> - depends on RISCV_SBI_V01
> + depends on RISCV_SBI
>   select SERIAL_CORE
>   select SERIAL_CORE_CONSOLE
>   select SERIAL_EARLYCON
> diff --git a/drivers/tty/serial/earlycon-riscv-sbi.c 
> b/drivers/tty/serial/earlycon-riscv-sbi.c
> index 27afb0b74ea7..b1da34e8d8cd 100644
> --- a/drivers/tty/serial/earlycon-riscv-sbi.c
> +++ b/drivers/tty/serial/earlycon-riscv-sbi.c
> @@ -10,22 +10,49 @@
>  #include 
>  #include 
>  
> +#ifdef CONFIG_RISCV_SBI_V01
>  static void sbi_putc(struct uart_port *port, unsigned char c)
>  {
>   sbi_console_putchar(c);
>  }
>  
> -static void sbi_console_write(struct console *con,
> -   const char *s, unsigned n)
> +static void sbi_0_1_console_write(struct console *con,
> +   const char *s, unsigned int n)
>  {
>   struct earlycon_device *dev = con->data;
>   uart_console_write(&dev->port, s, n, sbi_putc);
>  }
> +#endif
> +
> +static void sbi_dbcn_console_write(struct console *con,
> +const char *s, unsigned int n)
> +{
> + phys_addr_t pa = __pa(s);
> +
> + sbi_ecall(SBI_EXT_DBCN, SBI_EXT_DBCN_CONSOLE_WRITE,
> +#ifdef CONFIG_32BIT
> +   n, pa, (u64)pa >> 32,
> +#else
> +   n, pa, 0,
> +#endif

Again, no #ifdef in .c files please.

thanks,

greg k-h


Re: [PATCH 3/6] RISC-V: KVM: Forward SBI DBCN extension to user-space

2023-10-10 Thread Greg Kroah-Hartman
On Tue, Oct 10, 2023 at 10:35:00PM +0530, Anup Patel wrote:
> The SBI DBCN extension needs to be emulated in user-space

Why?

> so let
> us forward console_puts() call to user-space.

What could go wrong!

Why does userspace have to get involved in a console message?  Why is
this needed at all?  The kernel can not handle userspace consoles as
obviously they have to be re-entrant and irq safe.

> 
> Signed-off-by: Anup Patel 
> ---
>  arch/riscv/include/asm/kvm_vcpu_sbi.h |  1 +
>  arch/riscv/include/uapi/asm/kvm.h |  1 +
>  arch/riscv/kvm/vcpu_sbi.c |  4 
>  arch/riscv/kvm/vcpu_sbi_replace.c | 31 +++
>  4 files changed, 37 insertions(+)
> 
> diff --git a/arch/riscv/include/asm/kvm_vcpu_sbi.h 
> b/arch/riscv/include/asm/kvm_vcpu_sbi.h
> index 8d6d4dce8a5e..a85f95eb6e85 100644
> --- a/arch/riscv/include/asm/kvm_vcpu_sbi.h
> +++ b/arch/riscv/include/asm/kvm_vcpu_sbi.h
> @@ -69,6 +69,7 @@ extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_ipi;
>  extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_rfence;
>  extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_srst;
>  extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_hsm;
> +extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_dbcn;
>  extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_experimental;
>  extern const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_vendor;
>  
> diff --git a/arch/riscv/include/uapi/asm/kvm.h 
> b/arch/riscv/include/uapi/asm/kvm.h
> index 917d8cc2489e..60d3b21dead7 100644
> --- a/arch/riscv/include/uapi/asm/kvm.h
> +++ b/arch/riscv/include/uapi/asm/kvm.h
> @@ -156,6 +156,7 @@ enum KVM_RISCV_SBI_EXT_ID {
>   KVM_RISCV_SBI_EXT_PMU,
>   KVM_RISCV_SBI_EXT_EXPERIMENTAL,
>   KVM_RISCV_SBI_EXT_VENDOR,
> + KVM_RISCV_SBI_EXT_DBCN,
>   KVM_RISCV_SBI_EXT_MAX,

You just broke a user/kernel ABI here, why?

thanks,

greg k-h


Re: [PATCH 2/6] RISC-V: KVM: Change the SBI specification version to v2.0

2023-10-10 Thread Greg Kroah-Hartman
On Tue, Oct 10, 2023 at 10:34:59PM +0530, Anup Patel wrote:
> We will be implementing SBI DBCN extension for KVM RISC-V so let
> us change the KVM RISC-V SBI specification version to v2.0.
> 
> Signed-off-by: Anup Patel 
> ---
>  arch/riscv/include/asm/kvm_vcpu_sbi.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/riscv/include/asm/kvm_vcpu_sbi.h 
> b/arch/riscv/include/asm/kvm_vcpu_sbi.h
> index cdcf0ff07be7..8d6d4dce8a5e 100644
> --- a/arch/riscv/include/asm/kvm_vcpu_sbi.h
> +++ b/arch/riscv/include/asm/kvm_vcpu_sbi.h
> @@ -11,7 +11,7 @@
>  
>  #define KVM_SBI_IMPID 3
>  
> -#define KVM_SBI_VERSION_MAJOR 1
> +#define KVM_SBI_VERSION_MAJOR 2

What does this number mean?  Who checks it?  Why do you have to keep
incrementing it?

thanks,

greg k-h


Re: [PATCH 5/6] tty: Add SBI debug console support to HVC SBI driver

2023-10-10 Thread Greg Kroah-Hartman
On Tue, Oct 10, 2023 at 10:35:02PM +0530, Anup Patel wrote:
> --- a/drivers/tty/hvc/hvc_riscv_sbi.c
> +++ b/drivers/tty/hvc/hvc_riscv_sbi.c
> @@ -15,6 +15,7 @@
>  
>  #include "hvc_console.h"
>  
> +#ifdef CONFIG_RISCV_SBI_V01

Please no #ifdef in a .c file, that's not a good style for Linux code at
all.

And what if you want to build the driver for both options here?  What
will happen?

> +static int hvc_sbi_dbcn_tty_put(uint32_t vtermno, const char *buf, int count)
>  {
> - return PTR_ERR_OR_ZERO(hvc_alloc(0, 0, &hvc_sbi_ops, 16));
> + phys_addr_t pa;
> + struct sbiret ret;
> +
> + if (is_vmalloc_addr(buf))
> + pa = page_to_phys(vmalloc_to_page(buf)) + offset_in_page(buf);
> + else
> + pa = __pa(buf);
> +
> + ret = sbi_ecall(SBI_EXT_DBCN, SBI_EXT_DBCN_CONSOLE_WRITE,
> +#ifdef CONFIG_32BIT
> +   count, pa, (u64)pa >> 32,
> +#else
> +   count, pa, 0,
> +#endif

This is not how to do an api, sorry, again, please no #ifdef if you want
to support this code for the next 20+ years.

thanks,

gre gk-h


Re: [PATCH v3 0/9] video: screen_info cleanups

2023-10-10 Thread Greg Kroah-Hartman
On Tue, Oct 10, 2023 at 01:48:07PM +0200, Daniel Vetter wrote:
> On Mon, Oct 09, 2023 at 11:18:36PM +0200, Arnd Bergmann wrote:
> > From: Arnd Bergmann 
> > 
> > v3 changelog
> > 
> > No real changes, just rebased for context changes, and picked up the Acks.
> > 
> > This now conflicts with the ia64 removal and introduces one new dependency
> > on IA64, but that is harmless and trivial to deal with later.
> > 
> > Link: https://lore.kernel.org/lkml/20230719123944.3438363-1-a...@kernel.org/
> > ---
> > v2 changelog
> > 
> > I refreshed the first four patches that I sent before with very minor
> > updates, and then added some more to further disaggregate the use
> > of screen_info:
> > 
> >  - I found that powerpc wasn't using vga16fb any more
> > 
> >  - vgacon can be almost entirely separated from the global
> >screen_info, except on x86
> > 
> >  - similarly, the EFI framebuffer initialization can be
> >kept separate, except on x86.
> > 
> > I did extensive build testing on arm/arm64/x86 and the normal built bot
> > testing for the other architectures.
> > 
> > Which tree should this get merged through?
> 
> I guess if no one else volunteers (Greg maybe?) I can stuff this into
> drm-misc ...

Oh, hey, console code is for me, I keep forgetting.

I can take it, looks like we have enough acks now, thanks for reminding
me!

greg k-h


Re: [PATCH 04/15] tty: Remove now superfluous sentinel element from ctl_table array

2023-10-02 Thread Greg Kroah-Hartman
On Mon, Oct 02, 2023 at 08:47:53AM +, Christophe Leroy wrote:
> 
> 
> Le 02/10/2023 à 10:17, Jiri Slaby a écrit :
> > On 28. 09. 23, 15:21, Joel Granados via B4 Relay wrote:
> >> From: Joel Granados 
> >>
> >> This commit comes at the tail end of a greater effort to remove the
> >> empty elements at the end of the ctl_table arrays (sentinels) which
> >> will reduce the overall build time size of the kernel and run time
> >> memory bloat by ~64 bytes per sentinel (further information Link :
> >> https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)
> >>
> >> Remove sentinel from tty_table
> >>
> >> Signed-off-by: Joel Granados 
> >> ---
> >>   drivers/tty/tty_io.c | 3 +--
> >>   1 file changed, 1 insertion(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
> >> index 8a94e5a43c6d..2f925dc54a20 100644
> >> --- a/drivers/tty/tty_io.c
> >> +++ b/drivers/tty/tty_io.c
> >> @@ -3607,8 +3607,7 @@ static struct ctl_table tty_table[] = {
> >>   .proc_handler    = proc_dointvec,
> >>   .extra1    = SYSCTL_ZERO,
> >>   .extra2    = SYSCTL_ONE,
> >> -    },
> >> -    { }
> >> +    }
> > 
> > Why to remove the comma? One would need to add one when adding a new entry?
> 
> Does it make any difference at all ?
> 
> In one case you have:
> 
> @
>   something old,
>   },
> + {
> + something new,
> + },
>   }
> 
> In the other case you have:
> 
> @
>   something old,
> + },
> + {
> + something new,
>   }
>   }

Because that way it is obvious you are only touching the "something new"
lines and never have to touch the "something old" ones.

It's just a long-standing tradition in Linux, don't have an extra
character if you don't need it :)

thanks,

greg k-h


Re: [PATCH 01/15] cdrom: Remove now superfluous sentinel element from ctl_table array

2023-09-28 Thread Greg Kroah-Hartman
On Thu, Sep 28, 2023 at 03:21:26PM +0200, Joel Granados via B4 Relay wrote:
> From: Joel Granados 
> 
> This commit comes at the tail end of a greater effort to remove the
> empty elements at the end of the ctl_table arrays (sentinels) which
> will reduce the overall build time size of the kernel and run time
> memory bloat by ~64 bytes per sentinel (further information Link :
> https://lore.kernel.org/all/zo5yx5jfoggi%2f...@bombadil.infradead.org/)
> 
> Remove sentinel element from cdrom_table
> 
> Signed-off-by: Joel Granados 
> ---
>  drivers/cdrom/cdrom.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
> index cc2839805983..451907ade389 100644
> --- a/drivers/cdrom/cdrom.c
> +++ b/drivers/cdrom/cdrom.c
> @@ -3654,8 +3654,7 @@ static struct ctl_table cdrom_table[] = {
>   .maxlen = sizeof(int),
>   .mode   = 0644,
>   .proc_handler   = cdrom_sysctl_handler
> - },
> - { }
> + }

You should have the final entry as "}," so as to make any future
additions to the list to only contain that entry, that's long been the
kernel style for lists like this.

So your patches will just remove one line, not 2 and add 1, making it a
smaller diff.

thanks,

greg k-h


Re: [PATCH v1 0/8] Fix set_huge_pte_at() panic on arm64

2023-09-22 Thread Greg Kroah-Hartman
On Thu, Sep 21, 2023 at 05:35:54PM +0100, Ryan Roberts wrote:
> On 21/09/2023 17:30, Andrew Morton wrote:
> > On Thu, 21 Sep 2023 17:19:59 +0100 Ryan Roberts  
> > wrote:
> > 
> >> Hi All,
> >>
> >> This series fixes a bug in arm64's implementation of set_huge_pte_at(), 
> >> which
> >> can result in an unprivileged user causing a kernel panic. The problem was
> >> triggered when running the new uffd poison mm selftest for HUGETLB memory. 
> >> This
> >> test (and the uffd poison feature) was merged for v6.6-rc1. However, upon
> >> inspection there are multiple other pre-existing paths that can trigger 
> >> this
> >> bug.
> >>
> >> Ideally, I'd like to get this fix in for v6.6 if possible? And I guess it 
> >> should
> >> be backported too, given there are call sites where this can theoretically
> >> happen that pre-date v6.6-rc1 (I've cc'ed sta...@vger.kernel.org).
> > 
> > This gets you a naggygram from Greg.  The way to request a backport is
> > to add cc:stable to all the changelogs.  I'll make that change to my copy.
> 
> Ahh, sorry about that... I just got the same moan from the kernel test robot 
> too.
> 
> > 
> > 
> >> Ryan Roberts (8):
> >>   parisc: hugetlb: Convert set_huge_pte_at() to take vma
> >>   powerpc: hugetlb: Convert set_huge_pte_at() to take vma
> >>   riscv: hugetlb: Convert set_huge_pte_at() to take vma
> >>   s390: hugetlb: Convert set_huge_pte_at() to take vma
> >>   sparc: hugetlb: Convert set_huge_pte_at() to take vma
> >>   mm: hugetlb: Convert set_huge_pte_at() to take vma
> >>   arm64: hugetlb: Convert set_huge_pte_at() to take vma
> >>   arm64: hugetlb: Fix set_huge_pte_at() to work with all swap entries
> >>
> >>  arch/arm64/include/asm/hugetlb.h  |  2 +-
> >>  arch/arm64/mm/hugetlbpage.c   | 22 --
> >>  arch/parisc/include/asm/hugetlb.h |  2 +-
> >>  arch/parisc/mm/hugetlbpage.c  |  4 +--
> >>  .../include/asm/nohash/32/hugetlb-8xx.h   |  3 +-
> >>  arch/powerpc/mm/book3s64/hugetlbpage.c|  2 +-
> >>  arch/powerpc/mm/book3s64/radix_hugetlbpage.c  |  2 +-
> >>  arch/powerpc/mm/nohash/8xx.c  |  2 +-
> >>  arch/powerpc/mm/pgtable.c |  7 -
> >>  arch/riscv/include/asm/hugetlb.h  |  2 +-
> >>  arch/riscv/mm/hugetlbpage.c   |  3 +-
> >>  arch/s390/include/asm/hugetlb.h   |  8 +++--
> >>  arch/s390/mm/hugetlbpage.c|  8 -
> >>  arch/sparc/include/asm/hugetlb.h  |  8 +++--
> >>  arch/sparc/mm/hugetlbpage.c   |  8 -
> >>  include/asm-generic/hugetlb.h |  6 ++--
> >>  include/linux/hugetlb.h   |  6 ++--
> >>  mm/damon/vaddr.c  |  2 +-
> >>  mm/hugetlb.c  | 30 +--
> >>  mm/migrate.c  |  2 +-
> >>  mm/rmap.c | 10 +++
> >>  mm/vmalloc.c  |  5 +++-
> >>  22 files changed, 80 insertions(+), 64 deletions(-)
> > 
> > Looks scary but it's actually a fairly modest patchset.  It could
> > easily be all rolled into a single patch for ease of backporting. 
> > Maybe Greg has an opinion?
> 
> Yes, I thought about doing that; or perhaps 2 patches - one for the interface
> change across all arches and core code, and one for the actual bug fix?

I have no issues with taking patch series, or one big patch, into stable
trees, they just have to match up with what is in Linus's tree.

so if it makes more sense to have this as a series (like you did here),
wonderful, make it a patch series.  Do not go out of your way to do
things differently just for stable kernels, that is not necessary or
needed at all.

thanks,

greg k-h


Re: [PATCH tty v1 00/74] serial: wrappers for uart port lock

2023-09-18 Thread Greg Kroah-Hartman
On Mon, Sep 18, 2023 at 10:29:30AM +0206, John Ogness wrote:
> On 2023-09-14, John Ogness  wrote:
> > Provide and use wrapper functions for spin_[un]lock*(port->lock)
> > invocations so that the console mechanics can be applied later on at a
> > single place and does not require to copy the same logic all over the
> > drivers.
> 
> For the full 74-patch series:
> 
> Signed-off-by: John Ogness 
> 
> Sorry that my SoB was missing from the initial posting.

Thanks for this, I'll rebuild my tree with this added.

greg k-h


[PATCH 5.15 422/511] perf vendor events: Drop some of the JSON/events for power10 platform

2023-09-17 Thread Greg Kroah-Hartman
5.15-stable review patch.  If anyone has any objections, please let me know.

--

From: Kajol Jain 

[ Upstream commit e104df97b8dcfbab2e42de634b99bf03f0805d85 ]

Drop some of the JSON/events for power10 platform due to counter
data mismatch.

Fixes: 32daa5d7899e0343 ("perf vendor events: Initial JSON/events list for 
power10 platform")
Signed-off-by: Kajol Jain 
Cc: Athira Rajeev 
Cc: Disha Goel 
Cc: Ian Rogers 
Cc: Kajol Jain 
Cc: Madhavan Srinivasan 
Cc: Namhyung Kim 
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20230814112803.1508296-2-kj...@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Sasha Levin 
---
 .../arch/powerpc/power10/floating_point.json   |  7 ---
 tools/perf/pmu-events/arch/powerpc/power10/marked.json | 10 --
 tools/perf/pmu-events/arch/powerpc/power10/others.json |  5 -
 .../perf/pmu-events/arch/powerpc/power10/pipeline.json | 10 --
 .../pmu-events/arch/powerpc/power10/translation.json   |  5 -
 5 files changed, 37 deletions(-)
 delete mode 100644 
tools/perf/pmu-events/arch/powerpc/power10/floating_point.json

diff --git a/tools/perf/pmu-events/arch/powerpc/power10/floating_point.json 
b/tools/perf/pmu-events/arch/powerpc/power10/floating_point.json
deleted file mode 100644
index 54acb55e2c8c6..0
--- a/tools/perf/pmu-events/arch/powerpc/power10/floating_point.json
+++ /dev/null
@@ -1,7 +0,0 @@
-[
-  {
-"EventCode": "0x4016E",
-"EventName": "PM_THRESH_NOT_MET",
-"BriefDescription": "Threshold counter did not meet threshold."
-  }
-]
diff --git a/tools/perf/pmu-events/arch/powerpc/power10/marked.json 
b/tools/perf/pmu-events/arch/powerpc/power10/marked.json
index 131f8d0e88317..f2436fc5537ce 100644
--- a/tools/perf/pmu-events/arch/powerpc/power10/marked.json
+++ b/tools/perf/pmu-events/arch/powerpc/power10/marked.json
@@ -19,11 +19,6 @@
 "EventName": "PM_MRK_BR_TAKEN_CMPL",
 "BriefDescription": "Marked Branch Taken instruction completed."
   },
-  {
-"EventCode": "0x20112",
-"EventName": "PM_MRK_NTF_FIN",
-"BriefDescription": "The marked instruction became the oldest in the 
pipeline before it finished. It excludes instructions that finish at dispatch."
-  },
   {
 "EventCode": "0x2C01C",
 "EventName": "PM_EXEC_STALL_DMISS_OFF_CHIP",
@@ -64,11 +59,6 @@
 "EventName": "PM_L1_ICACHE_MISS",
 "BriefDescription": "Demand instruction cache miss."
   },
-  {
-"EventCode": "0x30130",
-"EventName": "PM_MRK_INST_FIN",
-"BriefDescription": "marked instruction finished. Excludes instructions 
that finish at dispatch. Note that stores always finish twice since the address 
gets issued to the LSU and the data gets issued to the VSU."
-  },
   {
 "EventCode": "0x34146",
 "EventName": "PM_MRK_LD_CMPL",
diff --git a/tools/perf/pmu-events/arch/powerpc/power10/others.json 
b/tools/perf/pmu-events/arch/powerpc/power10/others.json
index e691041ee8678..36c5bbc64c3be 100644
--- a/tools/perf/pmu-events/arch/powerpc/power10/others.json
+++ b/tools/perf/pmu-events/arch/powerpc/power10/others.json
@@ -29,11 +29,6 @@
 "EventName": "PM_DISP_SS0_2_INSTR_CYC",
 "BriefDescription": "Cycles in which Superslice 0 dispatches either 1 or 2 
instructions."
   },
-  {
-"EventCode": "0x1F15C",
-"EventName": "PM_MRK_STCX_L2_CYC",
-"BriefDescription": "Cycles spent in the nest portion of a marked Stcx 
instruction. It starts counting when the operation starts to drain to the L2 
and it stops counting when the instruction retires from the Instruction 
Completion Table (ICT) in the Instruction Sequencing Unit (ISU)."
-  },
   {
 "EventCode": "0x10066",
 "EventName": "PM_ADJUNCT_CYC",
diff --git a/tools/perf/pmu-events/arch/powerpc/power10/pipeline.json 
b/tools/perf/pmu-events/arch/powerpc/power10/pipeline.json
index 449f57e8ba6af..799893c56f32b 100644
--- a/tools/perf/pmu-events/arch/powerpc/power10/pipeline.json
+++ b/tools/perf/pmu-events/arch/powerpc/power10/pipeline.json
@@ -194,11 +194,6 @@
 "EventName": "PM_TLBIE_FIN",
 "BriefDescription": "TLBIE instruction finished in the LSU. Two TLBIEs can 
finish each cycle. All will be counted."
   },
-  {
-"EventCode": "0x3D058",
-"EventName": "PM_SCALAR_FSQRT_FDIV_ISSUE",
-"BriefDescription": "Scalar versions of four floating point operations: 
fdiv,fsqrt (xvdivdp, xvdivsp, xvsqrtdp, xvsqrtsp)."
-  },
   {
 "EventCode": "0x30066",
 "EventName": "PM_LSU_FIN",
@@ -269,11 +264,6 @@
 "EventName": "PM_IC_MISS_CMPL",
 "BriefDescription": "Non-speculative instruction cache miss, counted at 
completion."
   },
-  {
-"EventCode": "0x4D050",
-"EventName": "PM_VSU_NON_FLOP_CMPL",
-"BriefDescription": "Non-floating point VSU instructions completed."
-  },
   {
 "EventCode": "0x4D052",
 "EventName": "PM_2FLOP_CMPL",
diff --git a/tools/perf/pmu-events/arch/powerpc/power10/translation.json 
b/tools/perf/pmu-events/arch/powerpc/power10/translat

[PATCH 5.15 421/511] perf vendor events: Update the JSON/events descriptions for power10 platform

2023-09-17 Thread Greg Kroah-Hartman
5.15-stable review patch.  If anyone has any objections, please let me know.

--

From: Kajol Jain 

[ Upstream commit 3286f88f31da060ac2789cee247153961ba57e49 ]

Update the description for some of the JSON/events for power10 platform.

Fixes: 32daa5d7899e0343 ("perf vendor events: Initial JSON/events list for 
power10 platform")
Signed-off-by: Kajol Jain 
Cc: Athira Rajeev 
Cc: Disha Goel 
Cc: Ian Rogers 
Cc: Kajol Jain 
Cc: Madhavan Srinivasan 
Cc: Namhyung Kim 
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20230814112803.1508296-1-kj...@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Sasha Levin 
---
 .../arch/powerpc/power10/cache.json   |  4 +-
 .../arch/powerpc/power10/frontend.json| 30 ++--
 .../arch/powerpc/power10/marked.json  | 20 
 .../arch/powerpc/power10/memory.json  |  6 +--
 .../arch/powerpc/power10/others.json  | 48 +--
 .../arch/powerpc/power10/pipeline.json| 20 
 .../pmu-events/arch/powerpc/power10/pmc.json  |  4 +-
 .../arch/powerpc/power10/translation.json |  6 +--
 8 files changed, 69 insertions(+), 69 deletions(-)

diff --git a/tools/perf/pmu-events/arch/powerpc/power10/cache.json 
b/tools/perf/pmu-events/arch/powerpc/power10/cache.json
index 605be14f441c8..9cb929bb64afd 100644
--- a/tools/perf/pmu-events/arch/powerpc/power10/cache.json
+++ b/tools/perf/pmu-events/arch/powerpc/power10/cache.json
@@ -17,7 +17,7 @@
   {
 "EventCode": "0x34056",
 "EventName": "PM_EXEC_STALL_LOAD_FINISH",
-"BriefDescription": "Cycles in which the oldest instruction in the 
pipeline was finishing a load after its data was reloaded from a data source 
beyond the local L1; cycles in which the LSU was processing an L1-hit; cycles 
in which the NTF instruction merged with another load in the LMQ; cycles in 
which the NTF instruction is waiting for a data reload for a load miss, but the 
data comes back with a non-NTF instruction."
+"BriefDescription": "Cycles in which the oldest instruction in the 
pipeline was finishing a load after its data was reloaded from a data source 
beyond the local L1; cycles in which the LSU was processing an L1-hit; cycles 
in which the next-to-finish (NTF) instruction merged with another load in the 
LMQ; cycles in which the NTF instruction is waiting for a data reload for a 
load miss, but the data comes back with a non-NTF instruction."
   },
   {
 "EventCode": "0x3006C",
@@ -27,7 +27,7 @@
   {
 "EventCode": "0x300F4",
 "EventName": "PM_RUN_INST_CMPL_CONC",
-"BriefDescription": "PowerPC instructions completed by this thread when 
all threads in the core had the run-latch set."
+"BriefDescription": "PowerPC instruction completed by this thread when all 
threads in the core had the run-latch set."
   },
   {
 "EventCode": "0x4C016",
diff --git a/tools/perf/pmu-events/arch/powerpc/power10/frontend.json 
b/tools/perf/pmu-events/arch/powerpc/power10/frontend.json
index 558f9530f54ec..61e9e0222c873 100644
--- a/tools/perf/pmu-events/arch/powerpc/power10/frontend.json
+++ b/tools/perf/pmu-events/arch/powerpc/power10/frontend.json
@@ -7,7 +7,7 @@
   {
 "EventCode": "0x10006",
 "EventName": "PM_DISP_STALL_HELD_OTHER_CYC",
-"BriefDescription": "Cycles in which the NTC instruction is held at 
dispatch for any other reason."
+"BriefDescription": "Cycles in which the next-to-complete (NTC) 
instruction is held at dispatch for any other reason."
   },
   {
 "EventCode": "0x10010",
@@ -32,12 +32,12 @@
   {
 "EventCode": "0x1D05E",
 "EventName": "PM_DISP_STALL_HELD_HALT_CYC",
-"BriefDescription": "Cycles in which the NTC instruction is held at 
dispatch because of power management."
+"BriefDescription": "Cycles in which the next-to-complete (NTC) 
instruction is held at dispatch because of power management."
   },
   {
 "EventCode": "0x1E050",
 "EventName": "PM_DISP_STALL_HELD_STF_MAPPER_CYC",
-"BriefDescription": "Cycles in which the NTC instruction is held at 
dispatch because the STF mapper/SRB was full. Includes GPR (count, link, tar), 
VSR, VMR, FPR."
+"BriefDescription": "Cycles in which the next-to-complete (NTC) 
instruction is held at dispatch because the STF mapper/SRB was full. Includes 
GPR (count, link, tar), VSR, VMR, FPR."
   },
   {
 "EventCode": "0x1F054",
@@ -67,7 +67,7 @@
   {
 "EventCode": "0x100F6",
 "EventName": "PM_IERAT_MISS",
-"BriefDescription": "IERAT Reloaded to satisfy an IERAT miss. All page 
sizes are counted by this event."
+"BriefDescription": "IERAT Reloaded to satisfy an IERAT miss. All page 
sizes are counted by this event. This event only counts instruction demand 
access."
   },
   {
 "EventCode": "0x100F8",
@@ -77,7 +77,7 @@
   {
 "EventCode": "0x20006",
 "EventName": "PM_DISP_STALL_HELD_ISSQ_FULL_CYC",
-"BriefDescription": "Cycles in which the NTC instruction is held at 
dispatch du

[PATCH 6.1 080/219] perf test stat_bpf_counters_cgrp: Fix shellcheck issue about logical operators

2023-09-17 Thread Greg Kroah-Hartman
6.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Kajol Jain 

[ Upstream commit 0dd1f815545d7210150642741c364521cc5cf116 ]

Running shellcheck on lock_contention.sh generates below warning:

In stat_bpf_counters_cgrp.sh line 28:
if [ -d /sys/fs/cgroup/system.slice -a -d /sys/fs/cgroup/user.slice ]; 
then
^-- SC2166 (warning): Prefer [ p ] 
&& [ q ] as [ p -a q ] is not well defined.

In stat_bpf_counters_cgrp.sh line 34:
local self_cgrp=$(grep perf_event /proc/self/cgroup | cut -d: -f3)
^-^ SC3043 (warning): In POSIX sh, 'local' is undefined.
  ^---^ SC2155 (warning): Declare and assign separately to 
avoid masking return values.
^-- SC2046 (warning): Quote this to prevent word 
splitting.

In stat_bpf_counters_cgrp.sh line 51:
local output
^--^ SC3043 (warning): In POSIX sh, 'local' is undefined.

In stat_bpf_counters_cgrp.sh line 65:
local output
^--^ SC3043 (warning): In POSIX sh, 'local' is undefined.

Fixed above warnings by:
- Changing the expression [p -a q] to [p] && [q].
- Fixing shellcheck warnings for local usage, by prefixing
  function name to the variable.

Signed-off-by: Kajol Jain 
Acked-by: Ian Rogers 
Cc: Disha Goel 
Cc: Jiri Olsa 
Cc: Madhavan Srinivasan 
Cc: Namhyung Kim 
Cc: linuxppc-dev@lists.ozlabs.org
Link: 
https://lore.kernel.org/r/20230709182800.53002-6-atraj...@linux.vnet.ibm.com
Signed-off-by: Athira Rajeev 
Signed-off-by: Arnaldo Carvalho de Melo 
Stable-dep-of: a84260e31402 ("perf test stat_bpf_counters_cgrp: Enhance perf 
stat cgroup BPF counter test")
Signed-off-by: Sasha Levin 
---
 .../tests/shell/stat_bpf_counters_cgrp.sh | 28 ---
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/tools/perf/tests/shell/stat_bpf_counters_cgrp.sh 
b/tools/perf/tests/shell/stat_bpf_counters_cgrp.sh
index d724855d097c2..a74440a00b6b6 100755
--- a/tools/perf/tests/shell/stat_bpf_counters_cgrp.sh
+++ b/tools/perf/tests/shell/stat_bpf_counters_cgrp.sh
@@ -25,22 +25,22 @@ check_bpf_counter()
 find_cgroups()
 {
# try usual systemd slices first
-   if [ -d /sys/fs/cgroup/system.slice -a -d /sys/fs/cgroup/user.slice ]; 
then
+   if [ -d /sys/fs/cgroup/system.slice ] && [ -d /sys/fs/cgroup/user.slice 
]; then
test_cgroups="system.slice,user.slice"
return
fi
 
# try root and self cgroups
-   local self_cgrp=$(grep perf_event /proc/self/cgroup | cut -d: -f3)
-   if [ -z ${self_cgrp} ]; then
+   find_cgroups_self_cgrp=$(grep perf_event /proc/self/cgroup | cut -d: 
-f3)
+   if [ -z ${find_cgroups_self_cgrp} ]; then
# cgroup v2 doesn't specify perf_event
-   self_cgrp=$(grep ^0: /proc/self/cgroup | cut -d: -f3)
+   find_cgroups_self_cgrp=$(grep ^0: /proc/self/cgroup | cut -d: 
-f3)
fi
 
-   if [ -z ${self_cgrp} ]; then
+   if [ -z ${find_cgroups_self_cgrp} ]; then
test_cgroups="/"
else
-   test_cgroups="/,${self_cgrp}"
+   test_cgroups="/,${find_cgroups_self_cgrp}"
fi
 }
 
@@ -48,13 +48,11 @@ find_cgroups()
 # Just check if it runs without failure and has non-zero results.
 check_system_wide_counted()
 {
-   local output
-
-   output=$(perf stat -a --bpf-counters --for-each-cgroup ${test_cgroups} 
-e cpu-clock -x, sleep 1  2>&1)
-   if echo ${output} | grep -q -F "&1)
+   if echo ${check_system_wide_counted_output} | grep -q -F "&1)
-   if echo ${output} | grep -q -F "&1)
+   if echo ${check_cpu_list_counted_output} | grep -q -F "

[PATCH 6.1 076/219] perf vendor events: Drop STORES_PER_INST metric event for power10 platform

2023-09-17 Thread Greg Kroah-Hartman
6.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Kajol Jain 

[ Upstream commit 4836b9a85ef148c7c9779b66fab3f7279e488d90 ]

Drop STORES_PER_INST metric event for the power10 platform, as the
metric expression of STORES_PER_INST metric event using dropped event
PM_ST_FIN.

Fixes: 3ca3af7d1f230d1f ("perf vendor events power10: Add metric events JSON 
file for power10 platform")
Signed-off-by: Kajol Jain 
Cc: Athira Rajeev 
Cc: Disha Goel 
Cc: Ian Rogers 
Cc: Kajol Jain 
Cc: Madhavan Srinivasan 
Cc: Namhyung Kim 
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20230814112803.1508296-3-kj...@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Sasha Levin 
---
 tools/perf/pmu-events/arch/powerpc/power10/metrics.json | 6 --
 1 file changed, 6 deletions(-)

diff --git a/tools/perf/pmu-events/arch/powerpc/power10/metrics.json 
b/tools/perf/pmu-events/arch/powerpc/power10/metrics.json
index b57526fa44f2d..6e76f65c314ce 100644
--- a/tools/perf/pmu-events/arch/powerpc/power10/metrics.json
+++ b/tools/perf/pmu-events/arch/powerpc/power10/metrics.json
@@ -453,12 +453,6 @@
 "MetricGroup": "General",
 "MetricName": "LOADS_PER_INST"
 },
-{
-"BriefDescription": "Average number of finished stores per completed 
instruction",
-"MetricExpr": "PM_ST_FIN / PM_RUN_INST_CMPL",
-"MetricGroup": "General",
-"MetricName": "STORES_PER_INST"
-},
 {
 "BriefDescription": "Percentage of demand loads that reloaded from 
beyond the L2 per completed instruction",
 "MetricExpr": "PM_DATA_FROM_L2MISS / PM_RUN_INST_CMPL * 100",
-- 
2.40.1





[PATCH 6.1 075/219] perf vendor events: Drop some of the JSON/events for power10 platform

2023-09-17 Thread Greg Kroah-Hartman
6.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Kajol Jain 

[ Upstream commit e104df97b8dcfbab2e42de634b99bf03f0805d85 ]

Drop some of the JSON/events for power10 platform due to counter
data mismatch.

Fixes: 32daa5d7899e0343 ("perf vendor events: Initial JSON/events list for 
power10 platform")
Signed-off-by: Kajol Jain 
Cc: Athira Rajeev 
Cc: Disha Goel 
Cc: Ian Rogers 
Cc: Kajol Jain 
Cc: Madhavan Srinivasan 
Cc: Namhyung Kim 
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20230814112803.1508296-2-kj...@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Sasha Levin 
---
 .../arch/powerpc/power10/floating_point.json   |  7 ---
 tools/perf/pmu-events/arch/powerpc/power10/marked.json | 10 --
 tools/perf/pmu-events/arch/powerpc/power10/others.json |  5 -
 .../perf/pmu-events/arch/powerpc/power10/pipeline.json | 10 --
 .../pmu-events/arch/powerpc/power10/translation.json   |  5 -
 5 files changed, 37 deletions(-)
 delete mode 100644 
tools/perf/pmu-events/arch/powerpc/power10/floating_point.json

diff --git a/tools/perf/pmu-events/arch/powerpc/power10/floating_point.json 
b/tools/perf/pmu-events/arch/powerpc/power10/floating_point.json
deleted file mode 100644
index 54acb55e2c8c6..0
--- a/tools/perf/pmu-events/arch/powerpc/power10/floating_point.json
+++ /dev/null
@@ -1,7 +0,0 @@
-[
-  {
-"EventCode": "0x4016E",
-"EventName": "PM_THRESH_NOT_MET",
-"BriefDescription": "Threshold counter did not meet threshold."
-  }
-]
diff --git a/tools/perf/pmu-events/arch/powerpc/power10/marked.json 
b/tools/perf/pmu-events/arch/powerpc/power10/marked.json
index 131f8d0e88317..f2436fc5537ce 100644
--- a/tools/perf/pmu-events/arch/powerpc/power10/marked.json
+++ b/tools/perf/pmu-events/arch/powerpc/power10/marked.json
@@ -19,11 +19,6 @@
 "EventName": "PM_MRK_BR_TAKEN_CMPL",
 "BriefDescription": "Marked Branch Taken instruction completed."
   },
-  {
-"EventCode": "0x20112",
-"EventName": "PM_MRK_NTF_FIN",
-"BriefDescription": "The marked instruction became the oldest in the 
pipeline before it finished. It excludes instructions that finish at dispatch."
-  },
   {
 "EventCode": "0x2C01C",
 "EventName": "PM_EXEC_STALL_DMISS_OFF_CHIP",
@@ -64,11 +59,6 @@
 "EventName": "PM_L1_ICACHE_MISS",
 "BriefDescription": "Demand instruction cache miss."
   },
-  {
-"EventCode": "0x30130",
-"EventName": "PM_MRK_INST_FIN",
-"BriefDescription": "marked instruction finished. Excludes instructions 
that finish at dispatch. Note that stores always finish twice since the address 
gets issued to the LSU and the data gets issued to the VSU."
-  },
   {
 "EventCode": "0x34146",
 "EventName": "PM_MRK_LD_CMPL",
diff --git a/tools/perf/pmu-events/arch/powerpc/power10/others.json 
b/tools/perf/pmu-events/arch/powerpc/power10/others.json
index e691041ee8678..36c5bbc64c3be 100644
--- a/tools/perf/pmu-events/arch/powerpc/power10/others.json
+++ b/tools/perf/pmu-events/arch/powerpc/power10/others.json
@@ -29,11 +29,6 @@
 "EventName": "PM_DISP_SS0_2_INSTR_CYC",
 "BriefDescription": "Cycles in which Superslice 0 dispatches either 1 or 2 
instructions."
   },
-  {
-"EventCode": "0x1F15C",
-"EventName": "PM_MRK_STCX_L2_CYC",
-"BriefDescription": "Cycles spent in the nest portion of a marked Stcx 
instruction. It starts counting when the operation starts to drain to the L2 
and it stops counting when the instruction retires from the Instruction 
Completion Table (ICT) in the Instruction Sequencing Unit (ISU)."
-  },
   {
 "EventCode": "0x10066",
 "EventName": "PM_ADJUNCT_CYC",
diff --git a/tools/perf/pmu-events/arch/powerpc/power10/pipeline.json 
b/tools/perf/pmu-events/arch/powerpc/power10/pipeline.json
index 449f57e8ba6af..799893c56f32b 100644
--- a/tools/perf/pmu-events/arch/powerpc/power10/pipeline.json
+++ b/tools/perf/pmu-events/arch/powerpc/power10/pipeline.json
@@ -194,11 +194,6 @@
 "EventName": "PM_TLBIE_FIN",
 "BriefDescription": "TLBIE instruction finished in the LSU. Two TLBIEs can 
finish each cycle. All will be counted."
   },
-  {
-"EventCode": "0x3D058",
-"EventName": "PM_SCALAR_FSQRT_FDIV_ISSUE",
-"BriefDescription": "Scalar versions of four floating point operations: 
fdiv,fsqrt (xvdivdp, xvdivsp, xvsqrtdp, xvsqrtsp)."
-  },
   {
 "EventCode": "0x30066",
 "EventName": "PM_LSU_FIN",
@@ -269,11 +264,6 @@
 "EventName": "PM_IC_MISS_CMPL",
 "BriefDescription": "Non-speculative instruction cache miss, counted at 
completion."
   },
-  {
-"EventCode": "0x4D050",
-"EventName": "PM_VSU_NON_FLOP_CMPL",
-"BriefDescription": "Non-floating point VSU instructions completed."
-  },
   {
 "EventCode": "0x4D052",
 "EventName": "PM_2FLOP_CMPL",
diff --git a/tools/perf/pmu-events/arch/powerpc/power10/translation.json 
b/tools/perf/pmu-events/arch/powerpc/power10/translati

[PATCH 6.1 074/219] perf vendor events: Update the JSON/events descriptions for power10 platform

2023-09-17 Thread Greg Kroah-Hartman
6.1-stable review patch.  If anyone has any objections, please let me know.

--

From: Kajol Jain 

[ Upstream commit 3286f88f31da060ac2789cee247153961ba57e49 ]

Update the description for some of the JSON/events for power10 platform.

Fixes: 32daa5d7899e0343 ("perf vendor events: Initial JSON/events list for 
power10 platform")
Signed-off-by: Kajol Jain 
Cc: Athira Rajeev 
Cc: Disha Goel 
Cc: Ian Rogers 
Cc: Kajol Jain 
Cc: Madhavan Srinivasan 
Cc: Namhyung Kim 
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20230814112803.1508296-1-kj...@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Sasha Levin 
---
 .../arch/powerpc/power10/cache.json   |  4 +-
 .../arch/powerpc/power10/frontend.json| 30 ++--
 .../arch/powerpc/power10/marked.json  | 20 
 .../arch/powerpc/power10/memory.json  |  6 +--
 .../arch/powerpc/power10/others.json  | 48 +--
 .../arch/powerpc/power10/pipeline.json| 20 
 .../pmu-events/arch/powerpc/power10/pmc.json  |  4 +-
 .../arch/powerpc/power10/translation.json |  6 +--
 8 files changed, 69 insertions(+), 69 deletions(-)

diff --git a/tools/perf/pmu-events/arch/powerpc/power10/cache.json 
b/tools/perf/pmu-events/arch/powerpc/power10/cache.json
index 605be14f441c8..9cb929bb64afd 100644
--- a/tools/perf/pmu-events/arch/powerpc/power10/cache.json
+++ b/tools/perf/pmu-events/arch/powerpc/power10/cache.json
@@ -17,7 +17,7 @@
   {
 "EventCode": "0x34056",
 "EventName": "PM_EXEC_STALL_LOAD_FINISH",
-"BriefDescription": "Cycles in which the oldest instruction in the 
pipeline was finishing a load after its data was reloaded from a data source 
beyond the local L1; cycles in which the LSU was processing an L1-hit; cycles 
in which the NTF instruction merged with another load in the LMQ; cycles in 
which the NTF instruction is waiting for a data reload for a load miss, but the 
data comes back with a non-NTF instruction."
+"BriefDescription": "Cycles in which the oldest instruction in the 
pipeline was finishing a load after its data was reloaded from a data source 
beyond the local L1; cycles in which the LSU was processing an L1-hit; cycles 
in which the next-to-finish (NTF) instruction merged with another load in the 
LMQ; cycles in which the NTF instruction is waiting for a data reload for a 
load miss, but the data comes back with a non-NTF instruction."
   },
   {
 "EventCode": "0x3006C",
@@ -27,7 +27,7 @@
   {
 "EventCode": "0x300F4",
 "EventName": "PM_RUN_INST_CMPL_CONC",
-"BriefDescription": "PowerPC instructions completed by this thread when 
all threads in the core had the run-latch set."
+"BriefDescription": "PowerPC instruction completed by this thread when all 
threads in the core had the run-latch set."
   },
   {
 "EventCode": "0x4C016",
diff --git a/tools/perf/pmu-events/arch/powerpc/power10/frontend.json 
b/tools/perf/pmu-events/arch/powerpc/power10/frontend.json
index 558f9530f54ec..61e9e0222c873 100644
--- a/tools/perf/pmu-events/arch/powerpc/power10/frontend.json
+++ b/tools/perf/pmu-events/arch/powerpc/power10/frontend.json
@@ -7,7 +7,7 @@
   {
 "EventCode": "0x10006",
 "EventName": "PM_DISP_STALL_HELD_OTHER_CYC",
-"BriefDescription": "Cycles in which the NTC instruction is held at 
dispatch for any other reason."
+"BriefDescription": "Cycles in which the next-to-complete (NTC) 
instruction is held at dispatch for any other reason."
   },
   {
 "EventCode": "0x10010",
@@ -32,12 +32,12 @@
   {
 "EventCode": "0x1D05E",
 "EventName": "PM_DISP_STALL_HELD_HALT_CYC",
-"BriefDescription": "Cycles in which the NTC instruction is held at 
dispatch because of power management."
+"BriefDescription": "Cycles in which the next-to-complete (NTC) 
instruction is held at dispatch because of power management."
   },
   {
 "EventCode": "0x1E050",
 "EventName": "PM_DISP_STALL_HELD_STF_MAPPER_CYC",
-"BriefDescription": "Cycles in which the NTC instruction is held at 
dispatch because the STF mapper/SRB was full. Includes GPR (count, link, tar), 
VSR, VMR, FPR."
+"BriefDescription": "Cycles in which the next-to-complete (NTC) 
instruction is held at dispatch because the STF mapper/SRB was full. Includes 
GPR (count, link, tar), VSR, VMR, FPR."
   },
   {
 "EventCode": "0x1F054",
@@ -67,7 +67,7 @@
   {
 "EventCode": "0x100F6",
 "EventName": "PM_IERAT_MISS",
-"BriefDescription": "IERAT Reloaded to satisfy an IERAT miss. All page 
sizes are counted by this event."
+"BriefDescription": "IERAT Reloaded to satisfy an IERAT miss. All page 
sizes are counted by this event. This event only counts instruction demand 
access."
   },
   {
 "EventCode": "0x100F8",
@@ -77,7 +77,7 @@
   {
 "EventCode": "0x20006",
 "EventName": "PM_DISP_STALL_HELD_ISSQ_FULL_CYC",
-"BriefDescription": "Cycles in which the NTC instruction is held at 
dispatch due

[PATCH 6.5 097/285] perf test stat_bpf_counters_cgrp: Fix shellcheck issue about logical operators

2023-09-17 Thread Greg Kroah-Hartman
6.5-stable review patch.  If anyone has any objections, please let me know.

--

From: Kajol Jain 

[ Upstream commit 0dd1f815545d7210150642741c364521cc5cf116 ]

Running shellcheck on lock_contention.sh generates below warning:

In stat_bpf_counters_cgrp.sh line 28:
if [ -d /sys/fs/cgroup/system.slice -a -d /sys/fs/cgroup/user.slice ]; 
then
^-- SC2166 (warning): Prefer [ p ] 
&& [ q ] as [ p -a q ] is not well defined.

In stat_bpf_counters_cgrp.sh line 34:
local self_cgrp=$(grep perf_event /proc/self/cgroup | cut -d: -f3)
^-^ SC3043 (warning): In POSIX sh, 'local' is undefined.
  ^---^ SC2155 (warning): Declare and assign separately to 
avoid masking return values.
^-- SC2046 (warning): Quote this to prevent word 
splitting.

In stat_bpf_counters_cgrp.sh line 51:
local output
^--^ SC3043 (warning): In POSIX sh, 'local' is undefined.

In stat_bpf_counters_cgrp.sh line 65:
local output
^--^ SC3043 (warning): In POSIX sh, 'local' is undefined.

Fixed above warnings by:
- Changing the expression [p -a q] to [p] && [q].
- Fixing shellcheck warnings for local usage, by prefixing
  function name to the variable.

Signed-off-by: Kajol Jain 
Acked-by: Ian Rogers 
Cc: Disha Goel 
Cc: Jiri Olsa 
Cc: Madhavan Srinivasan 
Cc: Namhyung Kim 
Cc: linuxppc-dev@lists.ozlabs.org
Link: 
https://lore.kernel.org/r/20230709182800.53002-6-atraj...@linux.vnet.ibm.com
Signed-off-by: Athira Rajeev 
Signed-off-by: Arnaldo Carvalho de Melo 
Stable-dep-of: a84260e31402 ("perf test stat_bpf_counters_cgrp: Enhance perf 
stat cgroup BPF counter test")
Signed-off-by: Sasha Levin 
---
 .../tests/shell/stat_bpf_counters_cgrp.sh | 28 ---
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/tools/perf/tests/shell/stat_bpf_counters_cgrp.sh 
b/tools/perf/tests/shell/stat_bpf_counters_cgrp.sh
index d724855d097c2..a74440a00b6b6 100755
--- a/tools/perf/tests/shell/stat_bpf_counters_cgrp.sh
+++ b/tools/perf/tests/shell/stat_bpf_counters_cgrp.sh
@@ -25,22 +25,22 @@ check_bpf_counter()
 find_cgroups()
 {
# try usual systemd slices first
-   if [ -d /sys/fs/cgroup/system.slice -a -d /sys/fs/cgroup/user.slice ]; 
then
+   if [ -d /sys/fs/cgroup/system.slice ] && [ -d /sys/fs/cgroup/user.slice 
]; then
test_cgroups="system.slice,user.slice"
return
fi
 
# try root and self cgroups
-   local self_cgrp=$(grep perf_event /proc/self/cgroup | cut -d: -f3)
-   if [ -z ${self_cgrp} ]; then
+   find_cgroups_self_cgrp=$(grep perf_event /proc/self/cgroup | cut -d: 
-f3)
+   if [ -z ${find_cgroups_self_cgrp} ]; then
# cgroup v2 doesn't specify perf_event
-   self_cgrp=$(grep ^0: /proc/self/cgroup | cut -d: -f3)
+   find_cgroups_self_cgrp=$(grep ^0: /proc/self/cgroup | cut -d: 
-f3)
fi
 
-   if [ -z ${self_cgrp} ]; then
+   if [ -z ${find_cgroups_self_cgrp} ]; then
test_cgroups="/"
else
-   test_cgroups="/,${self_cgrp}"
+   test_cgroups="/,${find_cgroups_self_cgrp}"
fi
 }
 
@@ -48,13 +48,11 @@ find_cgroups()
 # Just check if it runs without failure and has non-zero results.
 check_system_wide_counted()
 {
-   local output
-
-   output=$(perf stat -a --bpf-counters --for-each-cgroup ${test_cgroups} 
-e cpu-clock -x, sleep 1  2>&1)
-   if echo ${output} | grep -q -F "&1)
+   if echo ${check_system_wide_counted_output} | grep -q -F "&1)
-   if echo ${output} | grep -q -F "&1)
+   if echo ${check_cpu_list_counted_output} | grep -q -F "

[PATCH 6.5 088/285] perf vendor events: Update metric event names for power10 platform

2023-09-17 Thread Greg Kroah-Hartman
6.5-stable review patch.  If anyone has any objections, please let me know.

--

From: Kajol Jain 

[ Upstream commit edd65d2bc55fb84d7b80c2ffe3b74d9b11ac4e2f ]

Update metric event name for some of the JSON/metric events for
power10 platform.

Fixes: 3ca3af7d1f230d1f ("perf vendor events power10: Add metric events JSON 
file for power10 platform")
Signed-off-by: Kajol Jain 
Cc: Athira Rajeev 
Cc: Disha Goel 
Cc: Ian Rogers 
Cc: Kajol Jain 
Cc: Madhavan Srinivasan 
Cc: Namhyung Kim 
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20230814112803.1508296-6-kj...@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Sasha Levin 
---
 .../arch/powerpc/power10/metrics.json | 50 +--
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/tools/perf/pmu-events/arch/powerpc/power10/metrics.json 
b/tools/perf/pmu-events/arch/powerpc/power10/metrics.json
index e3087eb1ccff8..182369076d956 100644
--- a/tools/perf/pmu-events/arch/powerpc/power10/metrics.json
+++ b/tools/perf/pmu-events/arch/powerpc/power10/metrics.json
@@ -16,133 +16,133 @@
 "BriefDescription": "Average cycles per completed instruction when 
dispatch was stalled for any reason",
 "MetricExpr": "PM_DISP_STALL_CYC / PM_RUN_INST_CMPL",
 "MetricGroup": "CPI;CPI_STALL_RATIO",
-"MetricName": "DISPATCHED_CPI"
+"MetricName": "DISPATCH_STALL_CPI"
 },
 {
 "BriefDescription": "Average cycles per completed instruction when 
dispatch was stalled because there was a flush",
 "MetricExpr": "PM_DISP_STALL_FLUSH / PM_RUN_INST_CMPL",
 "MetricGroup": "CPI",
-"MetricName": "DISPATCHED_FLUSH_CPI"
+"MetricName": "DISPATCH_STALL_FLUSH_CPI"
 },
 {
 "BriefDescription": "Average cycles per completed instruction when 
dispatch was stalled because the MMU was handling a translation miss",
 "MetricExpr": "PM_DISP_STALL_TRANSLATION / PM_RUN_INST_CMPL",
 "MetricGroup": "CPI",
-"MetricName": "DISPATCHED_TRANSLATION_CPI"
+"MetricName": "DISPATCH_STALL_TRANSLATION_CPI"
 },
 {
 "BriefDescription": "Average cycles per completed instruction when 
dispatch was stalled waiting to resolve an instruction ERAT miss",
 "MetricExpr": "PM_DISP_STALL_IERAT_ONLY_MISS / PM_RUN_INST_CMPL",
 "MetricGroup": "CPI",
-"MetricName": "DISPATCHED_IERAT_ONLY_MISS_CPI"
+"MetricName": "DISPATCH_STALL_IERAT_ONLY_MISS_CPI"
 },
 {
 "BriefDescription": "Average cycles per completed instruction when 
dispatch was stalled waiting to resolve an instruction TLB miss",
 "MetricExpr": "PM_DISP_STALL_ITLB_MISS / PM_RUN_INST_CMPL",
 "MetricGroup": "CPI",
-"MetricName": "DISPATCHED_ITLB_MISS_CPI"
+"MetricName": "DISPATCH_STALL_ITLB_MISS_CPI"
 },
 {
 "BriefDescription": "Average cycles per completed instruction when 
dispatch was stalled due to an icache miss",
 "MetricExpr": "PM_DISP_STALL_IC_MISS / PM_RUN_INST_CMPL",
 "MetricGroup": "CPI",
-"MetricName": "DISPATCHED_IC_MISS_CPI"
+"MetricName": "DISPATCH_STALL_IC_MISS_CPI"
 },
 {
 "BriefDescription": "Average cycles per completed instruction when 
dispatch was stalled while the instruction was fetched from the local L2",
 "MetricExpr": "PM_DISP_STALL_IC_L2 / PM_RUN_INST_CMPL",
 "MetricGroup": "CPI",
-"MetricName": "DISPATCHED_IC_L2_CPI"
+"MetricName": "DISPATCH_STALL_IC_L2_CPI"
 },
 {
 "BriefDescription": "Average cycles per completed instruction when 
dispatch was stalled while the instruction was fetched from the local L3",
 "MetricExpr": "PM_DISP_STALL_IC_L3 / PM_RUN_INST_CMPL",
 "MetricGroup": "CPI",
-"MetricName": "DISPATCHED_IC_L3_CPI"
+"MetricName": "DISPATCH_STALL_IC_L3_CPI"
 },
 {
 "BriefDescription": "Average cycles per completed instruction when 
dispatch was stalled while the instruction was fetched from any source beyond 
the local L3",
 "MetricExpr": "PM_DISP_STALL_IC_L3MISS / PM_RUN_INST_CMPL",
 "MetricGroup": "CPI",
-"MetricName": "DISPATCHED_IC_L3MISS_CPI"
+"MetricName": "DISPATCH_STALL_IC_L3MISS_CPI"
 },
 {
 "BriefDescription": "Average cycles per completed instruction when 
dispatch was stalled due to an icache miss after a branch mispredict",
 "MetricExpr": "PM_DISP_STALL_BR_MPRED_ICMISS / PM_RUN_INST_CMPL",
 "MetricGroup": "CPI",
-"MetricName": "DISPATCHED_BR_MPRED_ICMISS_CPI"
+"MetricName": "DISPATCH_STALL_BR_MPRED_ICMISS_CPI"
 },
 {
 "BriefDescription": "Average cycles per completed instruction when 
dispatch was stalled while instruction was fetched from the local L2 after 
suffering a branch mispredict",
 "MetricExpr": "PM_DISP_STALL_BR_MPRED_IC_L2 / PM_RUN_INST_CMPL",
 "M

[PATCH 6.5 087/285] perf vendor events: Move JSON/events to appropriate files for power10 platform

2023-09-17 Thread Greg Kroah-Hartman
6.5-stable review patch.  If anyone has any objections, please let me know.

--

From: Kajol Jain 

[ Upstream commit 7d473f475b2aff7e7c5d63b6f701c54590f84781 ]

Move some of the power10 JSON/events to appropriate files.

Fixes: 32daa5d7899e0343 ("perf vendor events: Initial JSON/events list for 
power10 platform")
Signed-off-by: Kajol Jain 
Cc: Athira Rajeev 
Cc: Disha Goel 
Cc: Ian Rogers 
Cc: Kajol Jain 
Cc: Madhavan Srinivasan 
Cc: Namhyung Kim 
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20230814112803.1508296-4-kj...@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Sasha Levin 
---
 .../arch/powerpc/power10/cache.json   |  45 
 .../arch/powerpc/power10/floating_point.json  |  67 +
 .../arch/powerpc/power10/frontend.json| 180 -
 .../arch/powerpc/power10/marked.json  | 186 ++---
 .../arch/powerpc/power10/memory.json  |  85 --
 .../arch/powerpc/power10/others.json  | 192 ++
 .../arch/powerpc/power10/pipeline.json| 247 ++
 .../pmu-events/arch/powerpc/power10/pmc.json  | 193 +-
 .../arch/powerpc/power10/translation.json |  35 ---
 9 files changed, 616 insertions(+), 614 deletions(-)
 create mode 100644 
tools/perf/pmu-events/arch/powerpc/power10/floating_point.json

diff --git a/tools/perf/pmu-events/arch/powerpc/power10/cache.json 
b/tools/perf/pmu-events/arch/powerpc/power10/cache.json
index 9cb929bb64afd..839ae26945fb2 100644
--- a/tools/perf/pmu-events/arch/powerpc/power10/cache.json
+++ b/tools/perf/pmu-events/arch/powerpc/power10/cache.json
@@ -1,54 +1,9 @@
 [
-  {
-"EventCode": "0x1003C",
-"EventName": "PM_EXEC_STALL_DMISS_L2L3",
-"BriefDescription": "Cycles in which the oldest instruction in the 
pipeline was waiting for a load miss to resolve from either the local L2 or 
local L3."
-  },
-  {
-"EventCode": "0x1E054",
-"EventName": "PM_EXEC_STALL_DMISS_L21_L31",
-"BriefDescription": "Cycles in which the oldest instruction in the 
pipeline was waiting for a load miss to resolve from another core's L2 or L3 on 
the same chip."
-  },
-  {
-"EventCode": "0x34054",
-"EventName": "PM_EXEC_STALL_DMISS_L2L3_NOCONFLICT",
-"BriefDescription": "Cycles in which the oldest instruction in the 
pipeline was waiting for a load miss to resolve from the local L2 or local L3, 
without a dispatch conflict."
-  },
-  {
-"EventCode": "0x34056",
-"EventName": "PM_EXEC_STALL_LOAD_FINISH",
-"BriefDescription": "Cycles in which the oldest instruction in the 
pipeline was finishing a load after its data was reloaded from a data source 
beyond the local L1; cycles in which the LSU was processing an L1-hit; cycles 
in which the next-to-finish (NTF) instruction merged with another load in the 
LMQ; cycles in which the NTF instruction is waiting for a data reload for a 
load miss, but the data comes back with a non-NTF instruction."
-  },
-  {
-"EventCode": "0x3006C",
-"EventName": "PM_RUN_CYC_SMT2_MODE",
-"BriefDescription": "Cycles when this thread's run latch is set and the 
core is in SMT2 mode."
-  },
   {
 "EventCode": "0x300F4",
 "EventName": "PM_RUN_INST_CMPL_CONC",
 "BriefDescription": "PowerPC instruction completed by this thread when all 
threads in the core had the run-latch set."
   },
-  {
-"EventCode": "0x4C016",
-"EventName": "PM_EXEC_STALL_DMISS_L2L3_CONFLICT",
-"BriefDescription": "Cycles in which the oldest instruction in the 
pipeline was waiting for a load miss to resolve from the local L2 or local L3, 
with a dispatch conflict."
-  },
-  {
-"EventCode": "0x4D014",
-"EventName": "PM_EXEC_STALL_LOAD",
-"BriefDescription": "Cycles in which the oldest instruction in the 
pipeline was a load instruction executing in the Load Store Unit."
-  },
-  {
-"EventCode": "0x4D016",
-"EventName": "PM_EXEC_STALL_PTESYNC",
-"BriefDescription": "Cycles in which the oldest instruction in the 
pipeline was a PTESYNC instruction executing in the Load Store Unit."
-  },
-  {
-"EventCode": "0x401EA",
-"EventName": "PM_THRESH_EXC_128",
-"BriefDescription": "Threshold counter exceeded a value of 128."
-  },
   {
 "EventCode": "0x400F6",
 "EventName": "PM_BR_MPRED_CMPL",
diff --git a/tools/perf/pmu-events/arch/powerpc/power10/floating_point.json 
b/tools/perf/pmu-events/arch/powerpc/power10/floating_point.json
new file mode 100644
index 0..e816cd10c1293
--- /dev/null
+++ b/tools/perf/pmu-events/arch/powerpc/power10/floating_point.json
@@ -0,0 +1,67 @@
+[
+  {
+"EventCode": "0x100F4",
+"EventName": "PM_FLOP_CMPL",
+"BriefDescription": "Floating Point Operations Completed. Includes any 
type. It counts once for each 1, 2, 4 or 8 flop instruction. Use 
PM_1|2|4|8_FLOP_CMPL events to count flops."
+  },
+  {
+"EventCode": "0x45050",
+"EventName": "PM_1FLOP_CMPL",
+"BriefDescription": "One floati

[PATCH 6.5 086/285] perf vendor events: Drop STORES_PER_INST metric event for power10 platform

2023-09-17 Thread Greg Kroah-Hartman
6.5-stable review patch.  If anyone has any objections, please let me know.

--

From: Kajol Jain 

[ Upstream commit 4836b9a85ef148c7c9779b66fab3f7279e488d90 ]

Drop STORES_PER_INST metric event for the power10 platform, as the
metric expression of STORES_PER_INST metric event using dropped event
PM_ST_FIN.

Fixes: 3ca3af7d1f230d1f ("perf vendor events power10: Add metric events JSON 
file for power10 platform")
Signed-off-by: Kajol Jain 
Cc: Athira Rajeev 
Cc: Disha Goel 
Cc: Ian Rogers 
Cc: Kajol Jain 
Cc: Madhavan Srinivasan 
Cc: Namhyung Kim 
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20230814112803.1508296-3-kj...@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Sasha Levin 
---
 tools/perf/pmu-events/arch/powerpc/power10/metrics.json | 6 --
 1 file changed, 6 deletions(-)

diff --git a/tools/perf/pmu-events/arch/powerpc/power10/metrics.json 
b/tools/perf/pmu-events/arch/powerpc/power10/metrics.json
index 6f53583a0c62c..e3087eb1ccff8 100644
--- a/tools/perf/pmu-events/arch/powerpc/power10/metrics.json
+++ b/tools/perf/pmu-events/arch/powerpc/power10/metrics.json
@@ -453,12 +453,6 @@
 "MetricGroup": "General",
 "MetricName": "LOADS_PER_INST"
 },
-{
-"BriefDescription": "Average number of finished stores per completed 
instruction",
-"MetricExpr": "PM_ST_FIN / PM_RUN_INST_CMPL",
-"MetricGroup": "General",
-"MetricName": "STORES_PER_INST"
-},
 {
 "BriefDescription": "Percentage of demand loads that reloaded from 
beyond the L2 per completed instruction",
 "MetricExpr": "PM_DATA_FROM_L2MISS / PM_RUN_INST_CMPL * 100",
-- 
2.40.1





[PATCH 6.5 085/285] perf vendor events: Drop some of the JSON/events for power10 platform

2023-09-17 Thread Greg Kroah-Hartman
6.5-stable review patch.  If anyone has any objections, please let me know.

--

From: Kajol Jain 

[ Upstream commit e104df97b8dcfbab2e42de634b99bf03f0805d85 ]

Drop some of the JSON/events for power10 platform due to counter
data mismatch.

Fixes: 32daa5d7899e0343 ("perf vendor events: Initial JSON/events list for 
power10 platform")
Signed-off-by: Kajol Jain 
Cc: Athira Rajeev 
Cc: Disha Goel 
Cc: Ian Rogers 
Cc: Kajol Jain 
Cc: Madhavan Srinivasan 
Cc: Namhyung Kim 
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20230814112803.1508296-2-kj...@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Sasha Levin 
---
 .../arch/powerpc/power10/floating_point.json   |  7 ---
 tools/perf/pmu-events/arch/powerpc/power10/marked.json | 10 --
 tools/perf/pmu-events/arch/powerpc/power10/others.json |  5 -
 .../perf/pmu-events/arch/powerpc/power10/pipeline.json | 10 --
 .../pmu-events/arch/powerpc/power10/translation.json   |  5 -
 5 files changed, 37 deletions(-)
 delete mode 100644 
tools/perf/pmu-events/arch/powerpc/power10/floating_point.json

diff --git a/tools/perf/pmu-events/arch/powerpc/power10/floating_point.json 
b/tools/perf/pmu-events/arch/powerpc/power10/floating_point.json
deleted file mode 100644
index 54acb55e2c8c6..0
--- a/tools/perf/pmu-events/arch/powerpc/power10/floating_point.json
+++ /dev/null
@@ -1,7 +0,0 @@
-[
-  {
-"EventCode": "0x4016E",
-"EventName": "PM_THRESH_NOT_MET",
-"BriefDescription": "Threshold counter did not meet threshold."
-  }
-]
diff --git a/tools/perf/pmu-events/arch/powerpc/power10/marked.json 
b/tools/perf/pmu-events/arch/powerpc/power10/marked.json
index 131f8d0e88317..f2436fc5537ce 100644
--- a/tools/perf/pmu-events/arch/powerpc/power10/marked.json
+++ b/tools/perf/pmu-events/arch/powerpc/power10/marked.json
@@ -19,11 +19,6 @@
 "EventName": "PM_MRK_BR_TAKEN_CMPL",
 "BriefDescription": "Marked Branch Taken instruction completed."
   },
-  {
-"EventCode": "0x20112",
-"EventName": "PM_MRK_NTF_FIN",
-"BriefDescription": "The marked instruction became the oldest in the 
pipeline before it finished. It excludes instructions that finish at dispatch."
-  },
   {
 "EventCode": "0x2C01C",
 "EventName": "PM_EXEC_STALL_DMISS_OFF_CHIP",
@@ -64,11 +59,6 @@
 "EventName": "PM_L1_ICACHE_MISS",
 "BriefDescription": "Demand instruction cache miss."
   },
-  {
-"EventCode": "0x30130",
-"EventName": "PM_MRK_INST_FIN",
-"BriefDescription": "marked instruction finished. Excludes instructions 
that finish at dispatch. Note that stores always finish twice since the address 
gets issued to the LSU and the data gets issued to the VSU."
-  },
   {
 "EventCode": "0x34146",
 "EventName": "PM_MRK_LD_CMPL",
diff --git a/tools/perf/pmu-events/arch/powerpc/power10/others.json 
b/tools/perf/pmu-events/arch/powerpc/power10/others.json
index a5319cdba89b3..17c5424ef1ac1 100644
--- a/tools/perf/pmu-events/arch/powerpc/power10/others.json
+++ b/tools/perf/pmu-events/arch/powerpc/power10/others.json
@@ -29,11 +29,6 @@
 "EventName": "PM_DISP_SS0_2_INSTR_CYC",
 "BriefDescription": "Cycles in which Superslice 0 dispatches either 1 or 2 
instructions."
   },
-  {
-"EventCode": "0x1F15C",
-"EventName": "PM_MRK_STCX_L2_CYC",
-"BriefDescription": "Cycles spent in the nest portion of a marked Stcx 
instruction. It starts counting when the operation starts to drain to the L2 
and it stops counting when the instruction retires from the Instruction 
Completion Table (ICT) in the Instruction Sequencing Unit (ISU)."
-  },
   {
 "EventCode": "0x10066",
 "EventName": "PM_ADJUNCT_CYC",
diff --git a/tools/perf/pmu-events/arch/powerpc/power10/pipeline.json 
b/tools/perf/pmu-events/arch/powerpc/power10/pipeline.json
index 449f57e8ba6af..799893c56f32b 100644
--- a/tools/perf/pmu-events/arch/powerpc/power10/pipeline.json
+++ b/tools/perf/pmu-events/arch/powerpc/power10/pipeline.json
@@ -194,11 +194,6 @@
 "EventName": "PM_TLBIE_FIN",
 "BriefDescription": "TLBIE instruction finished in the LSU. Two TLBIEs can 
finish each cycle. All will be counted."
   },
-  {
-"EventCode": "0x3D058",
-"EventName": "PM_SCALAR_FSQRT_FDIV_ISSUE",
-"BriefDescription": "Scalar versions of four floating point operations: 
fdiv,fsqrt (xvdivdp, xvdivsp, xvsqrtdp, xvsqrtsp)."
-  },
   {
 "EventCode": "0x30066",
 "EventName": "PM_LSU_FIN",
@@ -269,11 +264,6 @@
 "EventName": "PM_IC_MISS_CMPL",
 "BriefDescription": "Non-speculative instruction cache miss, counted at 
completion."
   },
-  {
-"EventCode": "0x4D050",
-"EventName": "PM_VSU_NON_FLOP_CMPL",
-"BriefDescription": "Non-floating point VSU instructions completed."
-  },
   {
 "EventCode": "0x4D052",
 "EventName": "PM_2FLOP_CMPL",
diff --git a/tools/perf/pmu-events/arch/powerpc/power10/translation.json 
b/tools/perf/pmu-events/arch/powerpc/power10/translati

[PATCH 6.5 084/285] perf vendor events: Update the JSON/events descriptions for power10 platform

2023-09-17 Thread Greg Kroah-Hartman
6.5-stable review patch.  If anyone has any objections, please let me know.

--

From: Kajol Jain 

[ Upstream commit 3286f88f31da060ac2789cee247153961ba57e49 ]

Update the description for some of the JSON/events for power10 platform.

Fixes: 32daa5d7899e0343 ("perf vendor events: Initial JSON/events list for 
power10 platform")
Signed-off-by: Kajol Jain 
Cc: Athira Rajeev 
Cc: Disha Goel 
Cc: Ian Rogers 
Cc: Kajol Jain 
Cc: Madhavan Srinivasan 
Cc: Namhyung Kim 
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20230814112803.1508296-1-kj...@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Sasha Levin 
---
 .../arch/powerpc/power10/cache.json   |  4 +-
 .../arch/powerpc/power10/frontend.json| 30 ++--
 .../arch/powerpc/power10/marked.json  | 20 
 .../arch/powerpc/power10/memory.json  |  6 +--
 .../arch/powerpc/power10/others.json  | 48 +--
 .../arch/powerpc/power10/pipeline.json| 20 
 .../pmu-events/arch/powerpc/power10/pmc.json  |  4 +-
 .../arch/powerpc/power10/translation.json |  6 +--
 8 files changed, 69 insertions(+), 69 deletions(-)

diff --git a/tools/perf/pmu-events/arch/powerpc/power10/cache.json 
b/tools/perf/pmu-events/arch/powerpc/power10/cache.json
index 605be14f441c8..9cb929bb64afd 100644
--- a/tools/perf/pmu-events/arch/powerpc/power10/cache.json
+++ b/tools/perf/pmu-events/arch/powerpc/power10/cache.json
@@ -17,7 +17,7 @@
   {
 "EventCode": "0x34056",
 "EventName": "PM_EXEC_STALL_LOAD_FINISH",
-"BriefDescription": "Cycles in which the oldest instruction in the 
pipeline was finishing a load after its data was reloaded from a data source 
beyond the local L1; cycles in which the LSU was processing an L1-hit; cycles 
in which the NTF instruction merged with another load in the LMQ; cycles in 
which the NTF instruction is waiting for a data reload for a load miss, but the 
data comes back with a non-NTF instruction."
+"BriefDescription": "Cycles in which the oldest instruction in the 
pipeline was finishing a load after its data was reloaded from a data source 
beyond the local L1; cycles in which the LSU was processing an L1-hit; cycles 
in which the next-to-finish (NTF) instruction merged with another load in the 
LMQ; cycles in which the NTF instruction is waiting for a data reload for a 
load miss, but the data comes back with a non-NTF instruction."
   },
   {
 "EventCode": "0x3006C",
@@ -27,7 +27,7 @@
   {
 "EventCode": "0x300F4",
 "EventName": "PM_RUN_INST_CMPL_CONC",
-"BriefDescription": "PowerPC instructions completed by this thread when 
all threads in the core had the run-latch set."
+"BriefDescription": "PowerPC instruction completed by this thread when all 
threads in the core had the run-latch set."
   },
   {
 "EventCode": "0x4C016",
diff --git a/tools/perf/pmu-events/arch/powerpc/power10/frontend.json 
b/tools/perf/pmu-events/arch/powerpc/power10/frontend.json
index 558f9530f54ec..61e9e0222c873 100644
--- a/tools/perf/pmu-events/arch/powerpc/power10/frontend.json
+++ b/tools/perf/pmu-events/arch/powerpc/power10/frontend.json
@@ -7,7 +7,7 @@
   {
 "EventCode": "0x10006",
 "EventName": "PM_DISP_STALL_HELD_OTHER_CYC",
-"BriefDescription": "Cycles in which the NTC instruction is held at 
dispatch for any other reason."
+"BriefDescription": "Cycles in which the next-to-complete (NTC) 
instruction is held at dispatch for any other reason."
   },
   {
 "EventCode": "0x10010",
@@ -32,12 +32,12 @@
   {
 "EventCode": "0x1D05E",
 "EventName": "PM_DISP_STALL_HELD_HALT_CYC",
-"BriefDescription": "Cycles in which the NTC instruction is held at 
dispatch because of power management."
+"BriefDescription": "Cycles in which the next-to-complete (NTC) 
instruction is held at dispatch because of power management."
   },
   {
 "EventCode": "0x1E050",
 "EventName": "PM_DISP_STALL_HELD_STF_MAPPER_CYC",
-"BriefDescription": "Cycles in which the NTC instruction is held at 
dispatch because the STF mapper/SRB was full. Includes GPR (count, link, tar), 
VSR, VMR, FPR."
+"BriefDescription": "Cycles in which the next-to-complete (NTC) 
instruction is held at dispatch because the STF mapper/SRB was full. Includes 
GPR (count, link, tar), VSR, VMR, FPR."
   },
   {
 "EventCode": "0x1F054",
@@ -67,7 +67,7 @@
   {
 "EventCode": "0x100F6",
 "EventName": "PM_IERAT_MISS",
-"BriefDescription": "IERAT Reloaded to satisfy an IERAT miss. All page 
sizes are counted by this event."
+"BriefDescription": "IERAT Reloaded to satisfy an IERAT miss. All page 
sizes are counted by this event. This event only counts instruction demand 
access."
   },
   {
 "EventCode": "0x100F8",
@@ -77,7 +77,7 @@
   {
 "EventCode": "0x20006",
 "EventName": "PM_DISP_STALL_HELD_ISSQ_FULL_CYC",
-"BriefDescription": "Cycles in which the NTC instruction is held at 
dispatch due

[PATCH 4.19 077/323] crypto: nx - fix build warnings when DEBUG_FS is not enabled

2023-08-09 Thread Greg Kroah-Hartman
From: Randy Dunlap 

[ Upstream commit b04b076fb56560b39d695ac3744db457e12278fd ]

Fix build warnings when DEBUG_FS is not enabled by using an empty
do-while loop instead of a value:

In file included from ../drivers/crypto/nx/nx.c:27:
../drivers/crypto/nx/nx.c: In function 'nx_register_algs':
../drivers/crypto/nx/nx.h:173:33: warning: statement with no effect 
[-Wunused-value]
  173 | #define NX_DEBUGFS_INIT(drv)(0)
../drivers/crypto/nx/nx.c:573:9: note: in expansion of macro 'NX_DEBUGFS_INIT'
  573 | NX_DEBUGFS_INIT(&nx_driver);
../drivers/crypto/nx/nx.c: In function 'nx_remove':
../drivers/crypto/nx/nx.h:174:33: warning: statement with no effect 
[-Wunused-value]
  174 | #define NX_DEBUGFS_FINI(drv)(0)
../drivers/crypto/nx/nx.c:793:17: note: in expansion of macro 'NX_DEBUGFS_FINI'
  793 | NX_DEBUGFS_FINI(&nx_driver);

Also, there is no need to build nx_debugfs.o when DEBUG_FS is not
enabled, so change the Makefile to accommodate that.

Fixes: ae0222b7289d ("powerpc/crypto: nx driver code supporting nx encryption")
Fixes: aef7b31c8833 ("powerpc/crypto: Build files for the nx device driver")
Signed-off-by: Randy Dunlap 
Cc: Breno Leitão 
Cc: Nayna Jain 
Cc: Paulo Flabiano Smorigo 
Cc: Herbert Xu 
Cc: "David S. Miller" 
Cc: linux-cry...@vger.kernel.org
Cc: Michael Ellerman 
Cc: Nicholas Piggin 
Cc: Christophe Leroy 
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Herbert Xu 
Signed-off-by: Sasha Levin 
---
 drivers/crypto/nx/Makefile | 2 +-
 drivers/crypto/nx/nx.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/nx/Makefile b/drivers/crypto/nx/Makefile
index 015155da59c29..76139865d7fa1 100644
--- a/drivers/crypto/nx/Makefile
+++ b/drivers/crypto/nx/Makefile
@@ -1,7 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_CRYPTO_DEV_NX_ENCRYPT) += nx-crypto.o
 nx-crypto-objs := nx.o \
- nx_debugfs.o \
  nx-aes-cbc.o \
  nx-aes-ecb.o \
  nx-aes-gcm.o \
@@ -11,6 +10,7 @@ nx-crypto-objs := nx.o \
  nx-sha256.o \
  nx-sha512.o
 
+nx-crypto-$(CONFIG_DEBUG_FS) += nx_debugfs.o
 obj-$(CONFIG_CRYPTO_DEV_NX_COMPRESS_PSERIES) += nx-compress-pseries.o 
nx-compress.o
 obj-$(CONFIG_CRYPTO_DEV_NX_COMPRESS_POWERNV) += nx-compress-powernv.o 
nx-compress.o
 nx-compress-objs := nx-842.o
diff --git a/drivers/crypto/nx/nx.h b/drivers/crypto/nx/nx.h
index c3e54af18645c..ebad937a9545c 100644
--- a/drivers/crypto/nx/nx.h
+++ b/drivers/crypto/nx/nx.h
@@ -180,8 +180,8 @@ struct nx_sg *nx_walk_and_build(struct nx_sg *, unsigned 
int,
 int nx_debugfs_init(struct nx_crypto_driver *);
 void nx_debugfs_fini(struct nx_crypto_driver *);
 #else
-#define NX_DEBUGFS_INIT(drv)   (0)
-#define NX_DEBUGFS_FINI(drv)   (0)
+#define NX_DEBUGFS_INIT(drv)   do {} while (0)
+#define NX_DEBUGFS_FINI(drv)   do {} while (0)
 #endif
 
 #define NX_PAGE_NUM(x) ((u64)(x) & 0xf000ULL)
-- 
2.39.2





[PATCH 4.19 061/323] soc/fsl/qe: fix usb.c build errors

2023-08-09 Thread Greg Kroah-Hartman
From: Randy Dunlap 

[ Upstream commit 7b1a78babd0d2cd27aa07255dee0c2d7ac0f31e3 ]

Fix build errors in soc/fsl/qe/usb.c when QUICC_ENGINE is not set.
This happens when PPC_EP88XC is set, which selects CPM1 & CPM.
When CPM is set, USB_FSL_QE can be set without QUICC_ENGINE
being set. When USB_FSL_QE is set, QE_USB deafults to y, which
causes build errors when QUICC_ENGINE is not set. Making
QE_USB depend on QUICC_ENGINE prevents QE_USB from defaulting to y.

Fixes these build errors:

drivers/soc/fsl/qe/usb.o: in function `qe_usb_clock_set':
usb.c:(.text+0x1e): undefined reference to `qe_immr'
powerpc-linux-ld: usb.c:(.text+0x2a): undefined reference to `qe_immr'
powerpc-linux-ld: usb.c:(.text+0xbc): undefined reference to `qe_setbrg'
powerpc-linux-ld: usb.c:(.text+0xca): undefined reference to `cmxgcr_lock'
powerpc-linux-ld: usb.c:(.text+0xce): undefined reference to `cmxgcr_lock'

Fixes: 5e41486c408e ("powerpc/QE: add support for QE USB clocks routing")
Signed-off-by: Randy Dunlap 
Reported-by: kernel test robot 
Link: https://lore.kernel.org/all/202301101500.pillnv6r-...@intel.com/
Suggested-by: Michael Ellerman 
Cc: Christophe Leroy 
Cc: Leo Li 
Cc: Masahiro Yamada 
Cc: Nicolas Schier 
Cc: Qiang Zhao 
Cc: linuxppc-dev 
Cc: linux-arm-ker...@lists.infradead.org
Cc: Kumar Gala 
Acked-by: Nicolas Schier 
Signed-off-by: Li Yang 
Signed-off-by: Sasha Levin 
---
 drivers/soc/fsl/qe/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/soc/fsl/qe/Kconfig b/drivers/soc/fsl/qe/Kconfig
index fabba17e9d65b..7ec158e2acf91 100644
--- a/drivers/soc/fsl/qe/Kconfig
+++ b/drivers/soc/fsl/qe/Kconfig
@@ -37,6 +37,7 @@ config QE_TDM
 
 config QE_USB
bool
+   depends on QUICC_ENGINE
default y if USB_FSL_QE
help
  QE USB Controller support
-- 
2.39.2





[PATCH 4.14 050/204] crypto: nx - fix build warnings when DEBUG_FS is not enabled

2023-08-09 Thread Greg Kroah-Hartman
From: Randy Dunlap 

[ Upstream commit b04b076fb56560b39d695ac3744db457e12278fd ]

Fix build warnings when DEBUG_FS is not enabled by using an empty
do-while loop instead of a value:

In file included from ../drivers/crypto/nx/nx.c:27:
../drivers/crypto/nx/nx.c: In function 'nx_register_algs':
../drivers/crypto/nx/nx.h:173:33: warning: statement with no effect 
[-Wunused-value]
  173 | #define NX_DEBUGFS_INIT(drv)(0)
../drivers/crypto/nx/nx.c:573:9: note: in expansion of macro 'NX_DEBUGFS_INIT'
  573 | NX_DEBUGFS_INIT(&nx_driver);
../drivers/crypto/nx/nx.c: In function 'nx_remove':
../drivers/crypto/nx/nx.h:174:33: warning: statement with no effect 
[-Wunused-value]
  174 | #define NX_DEBUGFS_FINI(drv)(0)
../drivers/crypto/nx/nx.c:793:17: note: in expansion of macro 'NX_DEBUGFS_FINI'
  793 | NX_DEBUGFS_FINI(&nx_driver);

Also, there is no need to build nx_debugfs.o when DEBUG_FS is not
enabled, so change the Makefile to accommodate that.

Fixes: ae0222b7289d ("powerpc/crypto: nx driver code supporting nx encryption")
Fixes: aef7b31c8833 ("powerpc/crypto: Build files for the nx device driver")
Signed-off-by: Randy Dunlap 
Cc: Breno Leitão 
Cc: Nayna Jain 
Cc: Paulo Flabiano Smorigo 
Cc: Herbert Xu 
Cc: "David S. Miller" 
Cc: linux-cry...@vger.kernel.org
Cc: Michael Ellerman 
Cc: Nicholas Piggin 
Cc: Christophe Leroy 
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Herbert Xu 
Signed-off-by: Sasha Levin 
---
 drivers/crypto/nx/Makefile | 2 +-
 drivers/crypto/nx/nx.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/nx/Makefile b/drivers/crypto/nx/Makefile
index 015155da59c29..76139865d7fa1 100644
--- a/drivers/crypto/nx/Makefile
+++ b/drivers/crypto/nx/Makefile
@@ -1,7 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_CRYPTO_DEV_NX_ENCRYPT) += nx-crypto.o
 nx-crypto-objs := nx.o \
- nx_debugfs.o \
  nx-aes-cbc.o \
  nx-aes-ecb.o \
  nx-aes-gcm.o \
@@ -11,6 +10,7 @@ nx-crypto-objs := nx.o \
  nx-sha256.o \
  nx-sha512.o
 
+nx-crypto-$(CONFIG_DEBUG_FS) += nx_debugfs.o
 obj-$(CONFIG_CRYPTO_DEV_NX_COMPRESS_PSERIES) += nx-compress-pseries.o 
nx-compress.o
 obj-$(CONFIG_CRYPTO_DEV_NX_COMPRESS_POWERNV) += nx-compress-powernv.o 
nx-compress.o
 nx-compress-objs := nx-842.o
diff --git a/drivers/crypto/nx/nx.h b/drivers/crypto/nx/nx.h
index c3e54af18645c..ebad937a9545c 100644
--- a/drivers/crypto/nx/nx.h
+++ b/drivers/crypto/nx/nx.h
@@ -180,8 +180,8 @@ struct nx_sg *nx_walk_and_build(struct nx_sg *, unsigned 
int,
 int nx_debugfs_init(struct nx_crypto_driver *);
 void nx_debugfs_fini(struct nx_crypto_driver *);
 #else
-#define NX_DEBUGFS_INIT(drv)   (0)
-#define NX_DEBUGFS_FINI(drv)   (0)
+#define NX_DEBUGFS_INIT(drv)   do {} while (0)
+#define NX_DEBUGFS_FINI(drv)   do {} while (0)
 #endif
 
 #define NX_PAGE_NUM(x) ((u64)(x) & 0xf000ULL)
-- 
2.39.2





[PATCH 4.14 041/204] soc/fsl/qe: fix usb.c build errors

2023-08-09 Thread Greg Kroah-Hartman
From: Randy Dunlap 

[ Upstream commit 7b1a78babd0d2cd27aa07255dee0c2d7ac0f31e3 ]

Fix build errors in soc/fsl/qe/usb.c when QUICC_ENGINE is not set.
This happens when PPC_EP88XC is set, which selects CPM1 & CPM.
When CPM is set, USB_FSL_QE can be set without QUICC_ENGINE
being set. When USB_FSL_QE is set, QE_USB deafults to y, which
causes build errors when QUICC_ENGINE is not set. Making
QE_USB depend on QUICC_ENGINE prevents QE_USB from defaulting to y.

Fixes these build errors:

drivers/soc/fsl/qe/usb.o: in function `qe_usb_clock_set':
usb.c:(.text+0x1e): undefined reference to `qe_immr'
powerpc-linux-ld: usb.c:(.text+0x2a): undefined reference to `qe_immr'
powerpc-linux-ld: usb.c:(.text+0xbc): undefined reference to `qe_setbrg'
powerpc-linux-ld: usb.c:(.text+0xca): undefined reference to `cmxgcr_lock'
powerpc-linux-ld: usb.c:(.text+0xce): undefined reference to `cmxgcr_lock'

Fixes: 5e41486c408e ("powerpc/QE: add support for QE USB clocks routing")
Signed-off-by: Randy Dunlap 
Reported-by: kernel test robot 
Link: https://lore.kernel.org/all/202301101500.pillnv6r-...@intel.com/
Suggested-by: Michael Ellerman 
Cc: Christophe Leroy 
Cc: Leo Li 
Cc: Masahiro Yamada 
Cc: Nicolas Schier 
Cc: Qiang Zhao 
Cc: linuxppc-dev 
Cc: linux-arm-ker...@lists.infradead.org
Cc: Kumar Gala 
Acked-by: Nicolas Schier 
Signed-off-by: Li Yang 
Signed-off-by: Sasha Levin 
---
 drivers/soc/fsl/qe/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/soc/fsl/qe/Kconfig b/drivers/soc/fsl/qe/Kconfig
index 73a2e08b47ef9..e2ccddd348b5b 100644
--- a/drivers/soc/fsl/qe/Kconfig
+++ b/drivers/soc/fsl/qe/Kconfig
@@ -37,6 +37,7 @@ config QE_TDM
 
 config QE_USB
bool
+   depends on QUICC_ENGINE
default y if USB_FSL_QE
help
  QE USB Controller support
-- 
2.39.2





Re: [PATCH] Documentation: devices.txt: reconcile serial/ucc_uart minor numers

2023-07-25 Thread Greg Kroah-Hartman
On Sun, Jul 23, 2023 at 11:33:41PM -0700, Randy Dunlap wrote:
> Reconcile devices.txt with serial/ucc_uart.c regarding device number
> assignments. ucc_uart.c supports 4 ports and uses minor devnums
> 46-49, so update devices.txt with that info.
> Then update ucc_uart.c's reference to the location of the devices.txt
> list in the kernel source tree.
> 
> Fixes: d7584ed2b994 ("[POWERPC] qe-uart: add support for Freescale 
> QUICCEngine UART")
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Signed-off-by: Randy Dunlap 
> Cc: Timur Tabi 
> Cc: Kumar Gala 
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: Greg Kroah-Hartman 
> Cc: Jiri Slaby 
> Cc: linux-ser...@vger.kernel.org
> Cc: Jonathan Corbet 
> Cc: linux-...@vger.kernel.org
> ---
>  Documentation/admin-guide/devices.txt |2 +-
>  drivers/tty/serial/ucc_uart.c |2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Very nice, thanks for catching this, I'll go queue it up.

Actually, how did you notice this?  I don't think the devices.txt file
is up to date at all anymore, and odds are, other things are wrong in it
too.

thanks,

greg k-h


[PATCH 5.4 110/313] crypto: nx - fix build warnings when DEBUG_FS is not enabled

2023-07-25 Thread Greg Kroah-Hartman
From: Randy Dunlap 

[ Upstream commit b04b076fb56560b39d695ac3744db457e12278fd ]

Fix build warnings when DEBUG_FS is not enabled by using an empty
do-while loop instead of a value:

In file included from ../drivers/crypto/nx/nx.c:27:
../drivers/crypto/nx/nx.c: In function 'nx_register_algs':
../drivers/crypto/nx/nx.h:173:33: warning: statement with no effect 
[-Wunused-value]
  173 | #define NX_DEBUGFS_INIT(drv)(0)
../drivers/crypto/nx/nx.c:573:9: note: in expansion of macro 'NX_DEBUGFS_INIT'
  573 | NX_DEBUGFS_INIT(&nx_driver);
../drivers/crypto/nx/nx.c: In function 'nx_remove':
../drivers/crypto/nx/nx.h:174:33: warning: statement with no effect 
[-Wunused-value]
  174 | #define NX_DEBUGFS_FINI(drv)(0)
../drivers/crypto/nx/nx.c:793:17: note: in expansion of macro 'NX_DEBUGFS_FINI'
  793 | NX_DEBUGFS_FINI(&nx_driver);

Also, there is no need to build nx_debugfs.o when DEBUG_FS is not
enabled, so change the Makefile to accommodate that.

Fixes: ae0222b7289d ("powerpc/crypto: nx driver code supporting nx encryption")
Fixes: aef7b31c8833 ("powerpc/crypto: Build files for the nx device driver")
Signed-off-by: Randy Dunlap 
Cc: Breno Leitão 
Cc: Nayna Jain 
Cc: Paulo Flabiano Smorigo 
Cc: Herbert Xu 
Cc: "David S. Miller" 
Cc: linux-cry...@vger.kernel.org
Cc: Michael Ellerman 
Cc: Nicholas Piggin 
Cc: Christophe Leroy 
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Herbert Xu 
Signed-off-by: Sasha Levin 
---
 drivers/crypto/nx/Makefile | 2 +-
 drivers/crypto/nx/nx.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/nx/Makefile b/drivers/crypto/nx/Makefile
index 015155da59c29..76139865d7fa1 100644
--- a/drivers/crypto/nx/Makefile
+++ b/drivers/crypto/nx/Makefile
@@ -1,7 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_CRYPTO_DEV_NX_ENCRYPT) += nx-crypto.o
 nx-crypto-objs := nx.o \
- nx_debugfs.o \
  nx-aes-cbc.o \
  nx-aes-ecb.o \
  nx-aes-gcm.o \
@@ -11,6 +10,7 @@ nx-crypto-objs := nx.o \
  nx-sha256.o \
  nx-sha512.o
 
+nx-crypto-$(CONFIG_DEBUG_FS) += nx_debugfs.o
 obj-$(CONFIG_CRYPTO_DEV_NX_COMPRESS_PSERIES) += nx-compress-pseries.o 
nx-compress.o
 obj-$(CONFIG_CRYPTO_DEV_NX_COMPRESS_POWERNV) += nx-compress-powernv.o 
nx-compress.o
 nx-compress-objs := nx-842.o
diff --git a/drivers/crypto/nx/nx.h b/drivers/crypto/nx/nx.h
index 7ecca168f8c48..5c77aba450cf8 100644
--- a/drivers/crypto/nx/nx.h
+++ b/drivers/crypto/nx/nx.h
@@ -169,8 +169,8 @@ struct nx_sg *nx_walk_and_build(struct nx_sg *, unsigned 
int,
 void nx_debugfs_init(struct nx_crypto_driver *);
 void nx_debugfs_fini(struct nx_crypto_driver *);
 #else
-#define NX_DEBUGFS_INIT(drv)   (0)
-#define NX_DEBUGFS_FINI(drv)   (0)
+#define NX_DEBUGFS_INIT(drv)   do {} while (0)
+#define NX_DEBUGFS_FINI(drv)   do {} while (0)
 #endif
 
 #define NX_PAGE_NUM(x) ((u64)(x) & 0xf000ULL)
-- 
2.39.2





[PATCH 5.4 084/313] soc/fsl/qe: fix usb.c build errors

2023-07-25 Thread Greg Kroah-Hartman
From: Randy Dunlap 

[ Upstream commit 7b1a78babd0d2cd27aa07255dee0c2d7ac0f31e3 ]

Fix build errors in soc/fsl/qe/usb.c when QUICC_ENGINE is not set.
This happens when PPC_EP88XC is set, which selects CPM1 & CPM.
When CPM is set, USB_FSL_QE can be set without QUICC_ENGINE
being set. When USB_FSL_QE is set, QE_USB deafults to y, which
causes build errors when QUICC_ENGINE is not set. Making
QE_USB depend on QUICC_ENGINE prevents QE_USB from defaulting to y.

Fixes these build errors:

drivers/soc/fsl/qe/usb.o: in function `qe_usb_clock_set':
usb.c:(.text+0x1e): undefined reference to `qe_immr'
powerpc-linux-ld: usb.c:(.text+0x2a): undefined reference to `qe_immr'
powerpc-linux-ld: usb.c:(.text+0xbc): undefined reference to `qe_setbrg'
powerpc-linux-ld: usb.c:(.text+0xca): undefined reference to `cmxgcr_lock'
powerpc-linux-ld: usb.c:(.text+0xce): undefined reference to `cmxgcr_lock'

Fixes: 5e41486c408e ("powerpc/QE: add support for QE USB clocks routing")
Signed-off-by: Randy Dunlap 
Reported-by: kernel test robot 
Link: https://lore.kernel.org/all/202301101500.pillnv6r-...@intel.com/
Suggested-by: Michael Ellerman 
Cc: Christophe Leroy 
Cc: Leo Li 
Cc: Masahiro Yamada 
Cc: Nicolas Schier 
Cc: Qiang Zhao 
Cc: linuxppc-dev 
Cc: linux-arm-ker...@lists.infradead.org
Cc: Kumar Gala 
Acked-by: Nicolas Schier 
Signed-off-by: Li Yang 
Signed-off-by: Sasha Levin 
---
 drivers/soc/fsl/qe/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/soc/fsl/qe/Kconfig b/drivers/soc/fsl/qe/Kconfig
index cfa4b2939992c..3ed0838607647 100644
--- a/drivers/soc/fsl/qe/Kconfig
+++ b/drivers/soc/fsl/qe/Kconfig
@@ -38,6 +38,7 @@ config QE_TDM
 
 config QE_USB
bool
+   depends on QUICC_ENGINE
default y if USB_FSL_QE
help
  QE USB Controller support
-- 
2.39.2





[PATCH 5.10 201/509] crypto: nx - fix build warnings when DEBUG_FS is not enabled

2023-07-25 Thread Greg Kroah-Hartman
From: Randy Dunlap 

[ Upstream commit b04b076fb56560b39d695ac3744db457e12278fd ]

Fix build warnings when DEBUG_FS is not enabled by using an empty
do-while loop instead of a value:

In file included from ../drivers/crypto/nx/nx.c:27:
../drivers/crypto/nx/nx.c: In function 'nx_register_algs':
../drivers/crypto/nx/nx.h:173:33: warning: statement with no effect 
[-Wunused-value]
  173 | #define NX_DEBUGFS_INIT(drv)(0)
../drivers/crypto/nx/nx.c:573:9: note: in expansion of macro 'NX_DEBUGFS_INIT'
  573 | NX_DEBUGFS_INIT(&nx_driver);
../drivers/crypto/nx/nx.c: In function 'nx_remove':
../drivers/crypto/nx/nx.h:174:33: warning: statement with no effect 
[-Wunused-value]
  174 | #define NX_DEBUGFS_FINI(drv)(0)
../drivers/crypto/nx/nx.c:793:17: note: in expansion of macro 'NX_DEBUGFS_FINI'
  793 | NX_DEBUGFS_FINI(&nx_driver);

Also, there is no need to build nx_debugfs.o when DEBUG_FS is not
enabled, so change the Makefile to accommodate that.

Fixes: ae0222b7289d ("powerpc/crypto: nx driver code supporting nx encryption")
Fixes: aef7b31c8833 ("powerpc/crypto: Build files for the nx device driver")
Signed-off-by: Randy Dunlap 
Cc: Breno Leitão 
Cc: Nayna Jain 
Cc: Paulo Flabiano Smorigo 
Cc: Herbert Xu 
Cc: "David S. Miller" 
Cc: linux-cry...@vger.kernel.org
Cc: Michael Ellerman 
Cc: Nicholas Piggin 
Cc: Christophe Leroy 
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Herbert Xu 
Signed-off-by: Sasha Levin 
---
 drivers/crypto/nx/Makefile | 2 +-
 drivers/crypto/nx/nx.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/nx/Makefile b/drivers/crypto/nx/Makefile
index bc89a20e5d9d8..351822a598f97 100644
--- a/drivers/crypto/nx/Makefile
+++ b/drivers/crypto/nx/Makefile
@@ -1,7 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_CRYPTO_DEV_NX_ENCRYPT) += nx-crypto.o
 nx-crypto-objs := nx.o \
- nx_debugfs.o \
  nx-aes-cbc.o \
  nx-aes-ecb.o \
  nx-aes-gcm.o \
@@ -11,6 +10,7 @@ nx-crypto-objs := nx.o \
  nx-sha256.o \
  nx-sha512.o
 
+nx-crypto-$(CONFIG_DEBUG_FS) += nx_debugfs.o
 obj-$(CONFIG_CRYPTO_DEV_NX_COMPRESS_PSERIES) += nx-compress-pseries.o 
nx-compress.o
 obj-$(CONFIG_CRYPTO_DEV_NX_COMPRESS_POWERNV) += nx-compress-powernv.o 
nx-compress.o
 nx-compress-objs := nx-842.o
diff --git a/drivers/crypto/nx/nx.h b/drivers/crypto/nx/nx.h
index c6233173c612e..2697baebb6a35 100644
--- a/drivers/crypto/nx/nx.h
+++ b/drivers/crypto/nx/nx.h
@@ -170,8 +170,8 @@ struct nx_sg *nx_walk_and_build(struct nx_sg *, unsigned 
int,
 void nx_debugfs_init(struct nx_crypto_driver *);
 void nx_debugfs_fini(struct nx_crypto_driver *);
 #else
-#define NX_DEBUGFS_INIT(drv)   (0)
-#define NX_DEBUGFS_FINI(drv)   (0)
+#define NX_DEBUGFS_INIT(drv)   do {} while (0)
+#define NX_DEBUGFS_FINI(drv)   do {} while (0)
 #endif
 
 #define NX_PAGE_NUM(x) ((u64)(x) & 0xf000ULL)
-- 
2.39.2





[PATCH 5.10 132/509] soc/fsl/qe: fix usb.c build errors

2023-07-25 Thread Greg Kroah-Hartman
From: Randy Dunlap 

[ Upstream commit 7b1a78babd0d2cd27aa07255dee0c2d7ac0f31e3 ]

Fix build errors in soc/fsl/qe/usb.c when QUICC_ENGINE is not set.
This happens when PPC_EP88XC is set, which selects CPM1 & CPM.
When CPM is set, USB_FSL_QE can be set without QUICC_ENGINE
being set. When USB_FSL_QE is set, QE_USB deafults to y, which
causes build errors when QUICC_ENGINE is not set. Making
QE_USB depend on QUICC_ENGINE prevents QE_USB from defaulting to y.

Fixes these build errors:

drivers/soc/fsl/qe/usb.o: in function `qe_usb_clock_set':
usb.c:(.text+0x1e): undefined reference to `qe_immr'
powerpc-linux-ld: usb.c:(.text+0x2a): undefined reference to `qe_immr'
powerpc-linux-ld: usb.c:(.text+0xbc): undefined reference to `qe_setbrg'
powerpc-linux-ld: usb.c:(.text+0xca): undefined reference to `cmxgcr_lock'
powerpc-linux-ld: usb.c:(.text+0xce): undefined reference to `cmxgcr_lock'

Fixes: 5e41486c408e ("powerpc/QE: add support for QE USB clocks routing")
Signed-off-by: Randy Dunlap 
Reported-by: kernel test robot 
Link: https://lore.kernel.org/all/202301101500.pillnv6r-...@intel.com/
Suggested-by: Michael Ellerman 
Cc: Christophe Leroy 
Cc: Leo Li 
Cc: Masahiro Yamada 
Cc: Nicolas Schier 
Cc: Qiang Zhao 
Cc: linuxppc-dev 
Cc: linux-arm-ker...@lists.infradead.org
Cc: Kumar Gala 
Acked-by: Nicolas Schier 
Signed-off-by: Li Yang 
Signed-off-by: Sasha Levin 
---
 drivers/soc/fsl/qe/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/soc/fsl/qe/Kconfig b/drivers/soc/fsl/qe/Kconfig
index 357c5800b112f..7afa796dbbb89 100644
--- a/drivers/soc/fsl/qe/Kconfig
+++ b/drivers/soc/fsl/qe/Kconfig
@@ -39,6 +39,7 @@ config QE_TDM
 
 config QE_USB
bool
+   depends on QUICC_ENGINE
default y if USB_FSL_QE
help
  QE USB Controller support
-- 
2.39.2





[PATCH 5.15 225/532] crypto: nx - fix build warnings when DEBUG_FS is not enabled

2023-07-21 Thread Greg Kroah-Hartman
From: Randy Dunlap 

[ Upstream commit b04b076fb56560b39d695ac3744db457e12278fd ]

Fix build warnings when DEBUG_FS is not enabled by using an empty
do-while loop instead of a value:

In file included from ../drivers/crypto/nx/nx.c:27:
../drivers/crypto/nx/nx.c: In function 'nx_register_algs':
../drivers/crypto/nx/nx.h:173:33: warning: statement with no effect 
[-Wunused-value]
  173 | #define NX_DEBUGFS_INIT(drv)(0)
../drivers/crypto/nx/nx.c:573:9: note: in expansion of macro 'NX_DEBUGFS_INIT'
  573 | NX_DEBUGFS_INIT(&nx_driver);
../drivers/crypto/nx/nx.c: In function 'nx_remove':
../drivers/crypto/nx/nx.h:174:33: warning: statement with no effect 
[-Wunused-value]
  174 | #define NX_DEBUGFS_FINI(drv)(0)
../drivers/crypto/nx/nx.c:793:17: note: in expansion of macro 'NX_DEBUGFS_FINI'
  793 | NX_DEBUGFS_FINI(&nx_driver);

Also, there is no need to build nx_debugfs.o when DEBUG_FS is not
enabled, so change the Makefile to accommodate that.

Fixes: ae0222b7289d ("powerpc/crypto: nx driver code supporting nx encryption")
Fixes: aef7b31c8833 ("powerpc/crypto: Build files for the nx device driver")
Signed-off-by: Randy Dunlap 
Cc: Breno Leitão 
Cc: Nayna Jain 
Cc: Paulo Flabiano Smorigo 
Cc: Herbert Xu 
Cc: "David S. Miller" 
Cc: linux-cry...@vger.kernel.org
Cc: Michael Ellerman 
Cc: Nicholas Piggin 
Cc: Christophe Leroy 
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Herbert Xu 
Signed-off-by: Sasha Levin 
---
 drivers/crypto/nx/Makefile | 2 +-
 drivers/crypto/nx/nx.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/nx/Makefile b/drivers/crypto/nx/Makefile
index d00181a26dd65..483cef62acee8 100644
--- a/drivers/crypto/nx/Makefile
+++ b/drivers/crypto/nx/Makefile
@@ -1,7 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_CRYPTO_DEV_NX_ENCRYPT) += nx-crypto.o
 nx-crypto-objs := nx.o \
- nx_debugfs.o \
  nx-aes-cbc.o \
  nx-aes-ecb.o \
  nx-aes-gcm.o \
@@ -11,6 +10,7 @@ nx-crypto-objs := nx.o \
  nx-sha256.o \
  nx-sha512.o
 
+nx-crypto-$(CONFIG_DEBUG_FS) += nx_debugfs.o
 obj-$(CONFIG_CRYPTO_DEV_NX_COMPRESS_PSERIES) += nx-compress-pseries.o 
nx-compress.o
 obj-$(CONFIG_CRYPTO_DEV_NX_COMPRESS_POWERNV) += nx-compress-powernv.o 
nx-compress.o
 nx-compress-objs := nx-842.o
diff --git a/drivers/crypto/nx/nx.h b/drivers/crypto/nx/nx.h
index c6233173c612e..2697baebb6a35 100644
--- a/drivers/crypto/nx/nx.h
+++ b/drivers/crypto/nx/nx.h
@@ -170,8 +170,8 @@ struct nx_sg *nx_walk_and_build(struct nx_sg *, unsigned 
int,
 void nx_debugfs_init(struct nx_crypto_driver *);
 void nx_debugfs_fini(struct nx_crypto_driver *);
 #else
-#define NX_DEBUGFS_INIT(drv)   (0)
-#define NX_DEBUGFS_FINI(drv)   (0)
+#define NX_DEBUGFS_INIT(drv)   do {} while (0)
+#define NX_DEBUGFS_FINI(drv)   do {} while (0)
 #endif
 
 #define NX_PAGE_NUM(x) ((u64)(x) & 0xf000ULL)
-- 
2.39.2





[PATCH 5.15 149/532] soc/fsl/qe: fix usb.c build errors

2023-07-21 Thread Greg Kroah-Hartman
From: Randy Dunlap 

[ Upstream commit 7b1a78babd0d2cd27aa07255dee0c2d7ac0f31e3 ]

Fix build errors in soc/fsl/qe/usb.c when QUICC_ENGINE is not set.
This happens when PPC_EP88XC is set, which selects CPM1 & CPM.
When CPM is set, USB_FSL_QE can be set without QUICC_ENGINE
being set. When USB_FSL_QE is set, QE_USB deafults to y, which
causes build errors when QUICC_ENGINE is not set. Making
QE_USB depend on QUICC_ENGINE prevents QE_USB from defaulting to y.

Fixes these build errors:

drivers/soc/fsl/qe/usb.o: in function `qe_usb_clock_set':
usb.c:(.text+0x1e): undefined reference to `qe_immr'
powerpc-linux-ld: usb.c:(.text+0x2a): undefined reference to `qe_immr'
powerpc-linux-ld: usb.c:(.text+0xbc): undefined reference to `qe_setbrg'
powerpc-linux-ld: usb.c:(.text+0xca): undefined reference to `cmxgcr_lock'
powerpc-linux-ld: usb.c:(.text+0xce): undefined reference to `cmxgcr_lock'

Fixes: 5e41486c408e ("powerpc/QE: add support for QE USB clocks routing")
Signed-off-by: Randy Dunlap 
Reported-by: kernel test robot 
Link: https://lore.kernel.org/all/202301101500.pillnv6r-...@intel.com/
Suggested-by: Michael Ellerman 
Cc: Christophe Leroy 
Cc: Leo Li 
Cc: Masahiro Yamada 
Cc: Nicolas Schier 
Cc: Qiang Zhao 
Cc: linuxppc-dev 
Cc: linux-arm-ker...@lists.infradead.org
Cc: Kumar Gala 
Acked-by: Nicolas Schier 
Signed-off-by: Li Yang 
Signed-off-by: Sasha Levin 
---
 drivers/soc/fsl/qe/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/soc/fsl/qe/Kconfig b/drivers/soc/fsl/qe/Kconfig
index 357c5800b112f..7afa796dbbb89 100644
--- a/drivers/soc/fsl/qe/Kconfig
+++ b/drivers/soc/fsl/qe/Kconfig
@@ -39,6 +39,7 @@ config QE_TDM
 
 config QE_USB
bool
+   depends on QUICC_ENGINE
default y if USB_FSL_QE
help
  QE USB Controller support
-- 
2.39.2





[PATCH 6.1 336/591] crypto: nx - fix build warnings when DEBUG_FS is not enabled

2023-07-16 Thread Greg Kroah-Hartman
From: Randy Dunlap 

[ Upstream commit b04b076fb56560b39d695ac3744db457e12278fd ]

Fix build warnings when DEBUG_FS is not enabled by using an empty
do-while loop instead of a value:

In file included from ../drivers/crypto/nx/nx.c:27:
../drivers/crypto/nx/nx.c: In function 'nx_register_algs':
../drivers/crypto/nx/nx.h:173:33: warning: statement with no effect 
[-Wunused-value]
  173 | #define NX_DEBUGFS_INIT(drv)(0)
../drivers/crypto/nx/nx.c:573:9: note: in expansion of macro 'NX_DEBUGFS_INIT'
  573 | NX_DEBUGFS_INIT(&nx_driver);
../drivers/crypto/nx/nx.c: In function 'nx_remove':
../drivers/crypto/nx/nx.h:174:33: warning: statement with no effect 
[-Wunused-value]
  174 | #define NX_DEBUGFS_FINI(drv)(0)
../drivers/crypto/nx/nx.c:793:17: note: in expansion of macro 'NX_DEBUGFS_FINI'
  793 | NX_DEBUGFS_FINI(&nx_driver);

Also, there is no need to build nx_debugfs.o when DEBUG_FS is not
enabled, so change the Makefile to accommodate that.

Fixes: ae0222b7289d ("powerpc/crypto: nx driver code supporting nx encryption")
Fixes: aef7b31c8833 ("powerpc/crypto: Build files for the nx device driver")
Signed-off-by: Randy Dunlap 
Cc: Breno Leitão 
Cc: Nayna Jain 
Cc: Paulo Flabiano Smorigo 
Cc: Herbert Xu 
Cc: "David S. Miller" 
Cc: linux-cry...@vger.kernel.org
Cc: Michael Ellerman 
Cc: Nicholas Piggin 
Cc: Christophe Leroy 
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Herbert Xu 
Signed-off-by: Sasha Levin 
---
 drivers/crypto/nx/Makefile | 2 +-
 drivers/crypto/nx/nx.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/nx/Makefile b/drivers/crypto/nx/Makefile
index d00181a26dd65..483cef62acee8 100644
--- a/drivers/crypto/nx/Makefile
+++ b/drivers/crypto/nx/Makefile
@@ -1,7 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_CRYPTO_DEV_NX_ENCRYPT) += nx-crypto.o
 nx-crypto-objs := nx.o \
- nx_debugfs.o \
  nx-aes-cbc.o \
  nx-aes-ecb.o \
  nx-aes-gcm.o \
@@ -11,6 +10,7 @@ nx-crypto-objs := nx.o \
  nx-sha256.o \
  nx-sha512.o
 
+nx-crypto-$(CONFIG_DEBUG_FS) += nx_debugfs.o
 obj-$(CONFIG_CRYPTO_DEV_NX_COMPRESS_PSERIES) += nx-compress-pseries.o 
nx-compress.o
 obj-$(CONFIG_CRYPTO_DEV_NX_COMPRESS_POWERNV) += nx-compress-powernv.o 
nx-compress.o
 nx-compress-objs := nx-842.o
diff --git a/drivers/crypto/nx/nx.h b/drivers/crypto/nx/nx.h
index c6233173c612e..2697baebb6a35 100644
--- a/drivers/crypto/nx/nx.h
+++ b/drivers/crypto/nx/nx.h
@@ -170,8 +170,8 @@ struct nx_sg *nx_walk_and_build(struct nx_sg *, unsigned 
int,
 void nx_debugfs_init(struct nx_crypto_driver *);
 void nx_debugfs_fini(struct nx_crypto_driver *);
 #else
-#define NX_DEBUGFS_INIT(drv)   (0)
-#define NX_DEBUGFS_FINI(drv)   (0)
+#define NX_DEBUGFS_INIT(drv)   do {} while (0)
+#define NX_DEBUGFS_FINI(drv)   do {} while (0)
 #endif
 
 #define NX_PAGE_NUM(x) ((u64)(x) & 0xf000ULL)
-- 
2.39.2





[PATCH 6.1 219/591] soc/fsl/qe: fix usb.c build errors

2023-07-16 Thread Greg Kroah-Hartman
From: Randy Dunlap 

[ Upstream commit 7b1a78babd0d2cd27aa07255dee0c2d7ac0f31e3 ]

Fix build errors in soc/fsl/qe/usb.c when QUICC_ENGINE is not set.
This happens when PPC_EP88XC is set, which selects CPM1 & CPM.
When CPM is set, USB_FSL_QE can be set without QUICC_ENGINE
being set. When USB_FSL_QE is set, QE_USB deafults to y, which
causes build errors when QUICC_ENGINE is not set. Making
QE_USB depend on QUICC_ENGINE prevents QE_USB from defaulting to y.

Fixes these build errors:

drivers/soc/fsl/qe/usb.o: in function `qe_usb_clock_set':
usb.c:(.text+0x1e): undefined reference to `qe_immr'
powerpc-linux-ld: usb.c:(.text+0x2a): undefined reference to `qe_immr'
powerpc-linux-ld: usb.c:(.text+0xbc): undefined reference to `qe_setbrg'
powerpc-linux-ld: usb.c:(.text+0xca): undefined reference to `cmxgcr_lock'
powerpc-linux-ld: usb.c:(.text+0xce): undefined reference to `cmxgcr_lock'

Fixes: 5e41486c408e ("powerpc/QE: add support for QE USB clocks routing")
Signed-off-by: Randy Dunlap 
Reported-by: kernel test robot 
Link: https://lore.kernel.org/all/202301101500.pillnv6r-...@intel.com/
Suggested-by: Michael Ellerman 
Cc: Christophe Leroy 
Cc: Leo Li 
Cc: Masahiro Yamada 
Cc: Nicolas Schier 
Cc: Qiang Zhao 
Cc: linuxppc-dev 
Cc: linux-arm-ker...@lists.infradead.org
Cc: Kumar Gala 
Acked-by: Nicolas Schier 
Signed-off-by: Li Yang 
Signed-off-by: Sasha Levin 
---
 drivers/soc/fsl/qe/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/soc/fsl/qe/Kconfig b/drivers/soc/fsl/qe/Kconfig
index 357c5800b112f..7afa796dbbb89 100644
--- a/drivers/soc/fsl/qe/Kconfig
+++ b/drivers/soc/fsl/qe/Kconfig
@@ -39,6 +39,7 @@ config QE_TDM
 
 config QE_USB
bool
+   depends on QUICC_ENGINE
default y if USB_FSL_QE
help
  QE USB Controller support
-- 
2.39.2





[PATCH 6.4 501/800] crypto: nx - fix build warnings when DEBUG_FS is not enabled

2023-07-16 Thread Greg Kroah-Hartman
From: Randy Dunlap 

[ Upstream commit b04b076fb56560b39d695ac3744db457e12278fd ]

Fix build warnings when DEBUG_FS is not enabled by using an empty
do-while loop instead of a value:

In file included from ../drivers/crypto/nx/nx.c:27:
../drivers/crypto/nx/nx.c: In function 'nx_register_algs':
../drivers/crypto/nx/nx.h:173:33: warning: statement with no effect 
[-Wunused-value]
  173 | #define NX_DEBUGFS_INIT(drv)(0)
../drivers/crypto/nx/nx.c:573:9: note: in expansion of macro 'NX_DEBUGFS_INIT'
  573 | NX_DEBUGFS_INIT(&nx_driver);
../drivers/crypto/nx/nx.c: In function 'nx_remove':
../drivers/crypto/nx/nx.h:174:33: warning: statement with no effect 
[-Wunused-value]
  174 | #define NX_DEBUGFS_FINI(drv)(0)
../drivers/crypto/nx/nx.c:793:17: note: in expansion of macro 'NX_DEBUGFS_FINI'
  793 | NX_DEBUGFS_FINI(&nx_driver);

Also, there is no need to build nx_debugfs.o when DEBUG_FS is not
enabled, so change the Makefile to accommodate that.

Fixes: ae0222b7289d ("powerpc/crypto: nx driver code supporting nx encryption")
Fixes: aef7b31c8833 ("powerpc/crypto: Build files for the nx device driver")
Signed-off-by: Randy Dunlap 
Cc: Breno Leitão 
Cc: Nayna Jain 
Cc: Paulo Flabiano Smorigo 
Cc: Herbert Xu 
Cc: "David S. Miller" 
Cc: linux-cry...@vger.kernel.org
Cc: Michael Ellerman 
Cc: Nicholas Piggin 
Cc: Christophe Leroy 
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Herbert Xu 
Signed-off-by: Sasha Levin 
---
 drivers/crypto/nx/Makefile | 2 +-
 drivers/crypto/nx/nx.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/nx/Makefile b/drivers/crypto/nx/Makefile
index d00181a26dd65..483cef62acee8 100644
--- a/drivers/crypto/nx/Makefile
+++ b/drivers/crypto/nx/Makefile
@@ -1,7 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_CRYPTO_DEV_NX_ENCRYPT) += nx-crypto.o
 nx-crypto-objs := nx.o \
- nx_debugfs.o \
  nx-aes-cbc.o \
  nx-aes-ecb.o \
  nx-aes-gcm.o \
@@ -11,6 +10,7 @@ nx-crypto-objs := nx.o \
  nx-sha256.o \
  nx-sha512.o
 
+nx-crypto-$(CONFIG_DEBUG_FS) += nx_debugfs.o
 obj-$(CONFIG_CRYPTO_DEV_NX_COMPRESS_PSERIES) += nx-compress-pseries.o 
nx-compress.o
 obj-$(CONFIG_CRYPTO_DEV_NX_COMPRESS_POWERNV) += nx-compress-powernv.o 
nx-compress.o
 nx-compress-objs := nx-842.o
diff --git a/drivers/crypto/nx/nx.h b/drivers/crypto/nx/nx.h
index c6233173c612e..2697baebb6a35 100644
--- a/drivers/crypto/nx/nx.h
+++ b/drivers/crypto/nx/nx.h
@@ -170,8 +170,8 @@ struct nx_sg *nx_walk_and_build(struct nx_sg *, unsigned 
int,
 void nx_debugfs_init(struct nx_crypto_driver *);
 void nx_debugfs_fini(struct nx_crypto_driver *);
 #else
-#define NX_DEBUGFS_INIT(drv)   (0)
-#define NX_DEBUGFS_FINI(drv)   (0)
+#define NX_DEBUGFS_INIT(drv)   do {} while (0)
+#define NX_DEBUGFS_FINI(drv)   do {} while (0)
 #endif
 
 #define NX_PAGE_NUM(x) ((u64)(x) & 0xf000ULL)
-- 
2.39.2





[PATCH 6.4 473/800] perf tests task_analyzer: Skip tests if no libtraceevent support

2023-07-16 Thread Greg Kroah-Hartman
From: Aditya Gupta 

[ Upstream commit c3ac3b0779770acd3ad7eecb5099ab4419ef2e2e ]

Test "perf script task-analyzer tests" fails in environment with missing
libtraceevent support, as perf record fails to create the perf.data
file, which further tests depend on.

Instead, when perf is not compiled with libtraceevent support, skip
those tests instead of failing them, by checking the output of `perf
record --dry-run` to see if it prints the error "libtraceevent is
necessary for tracepoint support"

For the following output, perf compiled with: `make NO_LIBTRACEEVENT=1`

Before the patch:

108: perf script task-analyzer tests :
test child forked, pid 24105
failed to open perf.data: No such file or directory  (try 'perf record' first)
FAIL: "invokation of perf script report task-analyzer command failed" Error 
message: ""
FAIL: "test_basic" Error message: "Failed to find required string:'Comm'."
failed to open perf.data: No such file or directory  (try 'perf record' first)
FAIL: "invokation of perf script report task-analyzer --ns 
--rename-comms-by-tids 0:random command failed" Error message: ""
FAIL: "test_ns_rename" Error message: "Failed to find required string:'Comm'."
failed to open perf.data: No such file or directory  (try 'perf record' first)
<...>
perf script task-analyzer tests: FAILED!

With this patch, the script instead returns 2 signifying SKIP, and after
the patch:

108: perf script task-analyzer tests :
test child forked, pid 26010
libtraceevent is necessary for tracepoint support
WARN: Skipping tests. No libtraceevent support
test child finished with -2
perf script task-analyzer tests: Skip

Fixes: e8478b84d6ba9ccf ("perf test: Add new task-analyzer tests")
Signed-off-by: Aditya Gupta 
Cc: Disha Goel 
Cc: Ian Rogers 
Cc: Jiri Olsa 
Cc: John Garry 
Cc: Madhavan Srinivasan 
Cc: Namhyung Kim 
Cc: Petar Gligoric 
Cc: Ravi Bangoria 
Cc: linuxppc-dev@lists.ozlabs.org
Link: 
https://lore.kernel.org/r/20230613164145.50488-18-atraj...@linux.vnet.ibm.com
Signed-off-by: Athira Rajeev 
Signed-off-by: Kajol Jain 
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Sasha Levin 
---
 tools/perf/tests/shell/test_task_analyzer.sh | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/tools/perf/tests/shell/test_task_analyzer.sh 
b/tools/perf/tests/shell/test_task_analyzer.sh
index 6b3343234a6b2..1b7f3c1ec218b 100755
--- a/tools/perf/tests/shell/test_task_analyzer.sh
+++ b/tools/perf/tests/shell/test_task_analyzer.sh
@@ -44,9 +44,20 @@ find_str_or_fail() {
fi
 }
 
+# check if perf is compiled with libtraceevent support
+skip_no_probe_record_support() {
+   perf record -e "sched:sched_switch" -a -- sleep 1 2>&1 | grep 
"libtraceevent is necessary for tracepoint support" && return 2
+   return 0
+}
+
 prepare_perf_data() {
# 1s should be sufficient to catch at least some switches
perf record -e sched:sched_switch -a -- sleep 1 > /dev/null 2>&1
+   # check if perf data file got created in above step.
+   if [ ! -e "perf.data" ]; then
+   printf "FAIL: perf record failed to create \"perf.data\" \n"
+   return 1
+   fi
 }
 
 # check standard inkvokation with no arguments
@@ -134,6 +145,13 @@ test_csvsummary_extended() {
find_str_or_fail "Out-Out;" csvsummary ${FUNCNAME[0]}
 }
 
+skip_no_probe_record_support
+err=$?
+if [ $err -ne 0 ]; then
+   echo "WARN: Skipping tests. No libtraceevent support"
+   cleanup
+   exit $err
+fi
 prepare_perf_data
 test_basic
 test_ns_rename
-- 
2.39.2





[PATCH 6.4 472/800] perf tests task_analyzer: Fix bad substitution ${$1}

2023-07-16 Thread Greg Kroah-Hartman
From: Aditya Gupta 

[ Upstream commit 5c4396efb53ef07d046a2e9456b240880e0c3076 ]

${$1} gives bad substitution error on sh, bash, and zsh. This seems like
a typo, and this patch modifies it to $1, since that is what it's usage
looks like from wherever `check_exec_0` is called.

This issue due to ${$1} caused all function calls to give error in
`find_str_or_fail` line, and so no test runs completely. But
'perf test "perf script task-analyzer tests"' wrongly reports
that tests passed with the status OK, which is wrong considering
the tests didn't even run completely

Fixes: e8478b84d6ba9ccf ("perf test: add new task-analyzer tests")
Signed-off-by: Aditya Gupta 
Signed-off-by: Athira Rajeev 
Signed-off-by: Kajol Jain 
Cc: Disha Goel 
Cc: Hagen Paul Pfeifer 
Cc: Ian Rogers 
Cc: Jiri Olsa 
Cc: John Garry 
Cc: Madhavan Srinivasan 
Cc: Namhyung Kim 
Cc: Petar Gligoric 
Cc: Ravi Bangoria 
Cc: linuxppc-dev@lists.ozlabs.org
Link: 
https://lore.kernel.org/r/20230613164145.50488-16-atraj...@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Sasha Levin 
---
 tools/perf/tests/shell/test_task_analyzer.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/tests/shell/test_task_analyzer.sh 
b/tools/perf/tests/shell/test_task_analyzer.sh
index a98e4ab66040e..6b3343234a6b2 100755
--- a/tools/perf/tests/shell/test_task_analyzer.sh
+++ b/tools/perf/tests/shell/test_task_analyzer.sh
@@ -31,7 +31,7 @@ report() {
 
 check_exec_0() {
if [ $? != 0 ]; then
-   report 1 "invokation of ${$1} command failed"
+   report 1 "invocation of $1 command failed"
fi
 }
 
-- 
2.39.2





[PATCH 6.4 336/800] soc/fsl/qe: fix usb.c build errors

2023-07-16 Thread Greg Kroah-Hartman
From: Randy Dunlap 

[ Upstream commit 7b1a78babd0d2cd27aa07255dee0c2d7ac0f31e3 ]

Fix build errors in soc/fsl/qe/usb.c when QUICC_ENGINE is not set.
This happens when PPC_EP88XC is set, which selects CPM1 & CPM.
When CPM is set, USB_FSL_QE can be set without QUICC_ENGINE
being set. When USB_FSL_QE is set, QE_USB deafults to y, which
causes build errors when QUICC_ENGINE is not set. Making
QE_USB depend on QUICC_ENGINE prevents QE_USB from defaulting to y.

Fixes these build errors:

drivers/soc/fsl/qe/usb.o: in function `qe_usb_clock_set':
usb.c:(.text+0x1e): undefined reference to `qe_immr'
powerpc-linux-ld: usb.c:(.text+0x2a): undefined reference to `qe_immr'
powerpc-linux-ld: usb.c:(.text+0xbc): undefined reference to `qe_setbrg'
powerpc-linux-ld: usb.c:(.text+0xca): undefined reference to `cmxgcr_lock'
powerpc-linux-ld: usb.c:(.text+0xce): undefined reference to `cmxgcr_lock'

Fixes: 5e41486c408e ("powerpc/QE: add support for QE USB clocks routing")
Signed-off-by: Randy Dunlap 
Reported-by: kernel test robot 
Link: https://lore.kernel.org/all/202301101500.pillnv6r-...@intel.com/
Suggested-by: Michael Ellerman 
Cc: Christophe Leroy 
Cc: Leo Li 
Cc: Masahiro Yamada 
Cc: Nicolas Schier 
Cc: Qiang Zhao 
Cc: linuxppc-dev 
Cc: linux-arm-ker...@lists.infradead.org
Cc: Kumar Gala 
Acked-by: Nicolas Schier 
Signed-off-by: Li Yang 
Signed-off-by: Sasha Levin 
---
 drivers/soc/fsl/qe/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/soc/fsl/qe/Kconfig b/drivers/soc/fsl/qe/Kconfig
index e0d096607fefb..fa9ffbed0e929 100644
--- a/drivers/soc/fsl/qe/Kconfig
+++ b/drivers/soc/fsl/qe/Kconfig
@@ -62,6 +62,7 @@ config QE_TDM
 
 config QE_USB
bool
+   depends on QUICC_ENGINE
default y if USB_FSL_QE
help
  QE USB Controller support
-- 
2.39.2





Re: [PATCH v4 12/18] staging: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers

2023-07-15 Thread Greg Kroah-Hartman
On Sat, Jul 15, 2023 at 08:51:54PM +0200, Thomas Zimmermann wrote:
> The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct
> fbinfo.flags has been allocated to zero by framebuffer_alloc(). So do
> not set it.
> 
> Flags should signal differences from the default values. After cleaning
> up all occurrences of FBINFO_DEFAULT, the token will be removed.
> 
> v2:
>   * fix commit message (Miguel)
> 
> Signed-off-by: Thomas Zimmermann 
> Acked-by: Sam Ravnborg 
> Cc: Greg Kroah-Hartman 
> Cc: Sudip Mukherjee 
> Cc: Teddy Wang 

Acked-by: Greg Kroah-Hartman 


[PATCH 6.3 400/431] crypto: nx - fix build warnings when DEBUG_FS is not enabled

2023-07-09 Thread Greg Kroah-Hartman
From: Randy Dunlap 

[ Upstream commit b04b076fb56560b39d695ac3744db457e12278fd ]

Fix build warnings when DEBUG_FS is not enabled by using an empty
do-while loop instead of a value:

In file included from ../drivers/crypto/nx/nx.c:27:
../drivers/crypto/nx/nx.c: In function 'nx_register_algs':
../drivers/crypto/nx/nx.h:173:33: warning: statement with no effect 
[-Wunused-value]
  173 | #define NX_DEBUGFS_INIT(drv)(0)
../drivers/crypto/nx/nx.c:573:9: note: in expansion of macro 'NX_DEBUGFS_INIT'
  573 | NX_DEBUGFS_INIT(&nx_driver);
../drivers/crypto/nx/nx.c: In function 'nx_remove':
../drivers/crypto/nx/nx.h:174:33: warning: statement with no effect 
[-Wunused-value]
  174 | #define NX_DEBUGFS_FINI(drv)(0)
../drivers/crypto/nx/nx.c:793:17: note: in expansion of macro 'NX_DEBUGFS_FINI'
  793 | NX_DEBUGFS_FINI(&nx_driver);

Also, there is no need to build nx_debugfs.o when DEBUG_FS is not
enabled, so change the Makefile to accommodate that.

Fixes: ae0222b7289d ("powerpc/crypto: nx driver code supporting nx encryption")
Fixes: aef7b31c8833 ("powerpc/crypto: Build files for the nx device driver")
Signed-off-by: Randy Dunlap 
Cc: Breno Leitão 
Cc: Nayna Jain 
Cc: Paulo Flabiano Smorigo 
Cc: Herbert Xu 
Cc: "David S. Miller" 
Cc: linux-cry...@vger.kernel.org
Cc: Michael Ellerman 
Cc: Nicholas Piggin 
Cc: Christophe Leroy 
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Herbert Xu 
Signed-off-by: Sasha Levin 
---
 drivers/crypto/nx/Makefile | 2 +-
 drivers/crypto/nx/nx.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/nx/Makefile b/drivers/crypto/nx/Makefile
index d00181a26dd65..483cef62acee8 100644
--- a/drivers/crypto/nx/Makefile
+++ b/drivers/crypto/nx/Makefile
@@ -1,7 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_CRYPTO_DEV_NX_ENCRYPT) += nx-crypto.o
 nx-crypto-objs := nx.o \
- nx_debugfs.o \
  nx-aes-cbc.o \
  nx-aes-ecb.o \
  nx-aes-gcm.o \
@@ -11,6 +10,7 @@ nx-crypto-objs := nx.o \
  nx-sha256.o \
  nx-sha512.o
 
+nx-crypto-$(CONFIG_DEBUG_FS) += nx_debugfs.o
 obj-$(CONFIG_CRYPTO_DEV_NX_COMPRESS_PSERIES) += nx-compress-pseries.o 
nx-compress.o
 obj-$(CONFIG_CRYPTO_DEV_NX_COMPRESS_POWERNV) += nx-compress-powernv.o 
nx-compress.o
 nx-compress-objs := nx-842.o
diff --git a/drivers/crypto/nx/nx.h b/drivers/crypto/nx/nx.h
index c6233173c612e..2697baebb6a35 100644
--- a/drivers/crypto/nx/nx.h
+++ b/drivers/crypto/nx/nx.h
@@ -170,8 +170,8 @@ struct nx_sg *nx_walk_and_build(struct nx_sg *, unsigned 
int,
 void nx_debugfs_init(struct nx_crypto_driver *);
 void nx_debugfs_fini(struct nx_crypto_driver *);
 #else
-#define NX_DEBUGFS_INIT(drv)   (0)
-#define NX_DEBUGFS_FINI(drv)   (0)
+#define NX_DEBUGFS_INIT(drv)   do {} while (0)
+#define NX_DEBUGFS_FINI(drv)   do {} while (0)
 #endif
 
 #define NX_PAGE_NUM(x) ((u64)(x) & 0xf000ULL)
-- 
2.39.2





[PATCH 6.3 376/431] perf tests task_analyzer: Skip tests if no libtraceevent support

2023-07-09 Thread Greg Kroah-Hartman
From: Aditya Gupta 

[ Upstream commit c3ac3b0779770acd3ad7eecb5099ab4419ef2e2e ]

Test "perf script task-analyzer tests" fails in environment with missing
libtraceevent support, as perf record fails to create the perf.data
file, which further tests depend on.

Instead, when perf is not compiled with libtraceevent support, skip
those tests instead of failing them, by checking the output of `perf
record --dry-run` to see if it prints the error "libtraceevent is
necessary for tracepoint support"

For the following output, perf compiled with: `make NO_LIBTRACEEVENT=1`

Before the patch:

108: perf script task-analyzer tests :
test child forked, pid 24105
failed to open perf.data: No such file or directory  (try 'perf record' first)
FAIL: "invokation of perf script report task-analyzer command failed" Error 
message: ""
FAIL: "test_basic" Error message: "Failed to find required string:'Comm'."
failed to open perf.data: No such file or directory  (try 'perf record' first)
FAIL: "invokation of perf script report task-analyzer --ns 
--rename-comms-by-tids 0:random command failed" Error message: ""
FAIL: "test_ns_rename" Error message: "Failed to find required string:'Comm'."
failed to open perf.data: No such file or directory  (try 'perf record' first)
<...>
perf script task-analyzer tests: FAILED!

With this patch, the script instead returns 2 signifying SKIP, and after
the patch:

108: perf script task-analyzer tests :
test child forked, pid 26010
libtraceevent is necessary for tracepoint support
WARN: Skipping tests. No libtraceevent support
test child finished with -2
perf script task-analyzer tests: Skip

Fixes: e8478b84d6ba9ccf ("perf test: Add new task-analyzer tests")
Signed-off-by: Aditya Gupta 
Cc: Disha Goel 
Cc: Ian Rogers 
Cc: Jiri Olsa 
Cc: John Garry 
Cc: Madhavan Srinivasan 
Cc: Namhyung Kim 
Cc: Petar Gligoric 
Cc: Ravi Bangoria 
Cc: linuxppc-dev@lists.ozlabs.org
Link: 
https://lore.kernel.org/r/20230613164145.50488-18-atraj...@linux.vnet.ibm.com
Signed-off-by: Athira Rajeev 
Signed-off-by: Kajol Jain 
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Sasha Levin 
---
 tools/perf/tests/shell/test_task_analyzer.sh | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/tools/perf/tests/shell/test_task_analyzer.sh 
b/tools/perf/tests/shell/test_task_analyzer.sh
index 6b3343234a6b2..1b7f3c1ec218b 100755
--- a/tools/perf/tests/shell/test_task_analyzer.sh
+++ b/tools/perf/tests/shell/test_task_analyzer.sh
@@ -44,9 +44,20 @@ find_str_or_fail() {
fi
 }
 
+# check if perf is compiled with libtraceevent support
+skip_no_probe_record_support() {
+   perf record -e "sched:sched_switch" -a -- sleep 1 2>&1 | grep 
"libtraceevent is necessary for tracepoint support" && return 2
+   return 0
+}
+
 prepare_perf_data() {
# 1s should be sufficient to catch at least some switches
perf record -e sched:sched_switch -a -- sleep 1 > /dev/null 2>&1
+   # check if perf data file got created in above step.
+   if [ ! -e "perf.data" ]; then
+   printf "FAIL: perf record failed to create \"perf.data\" \n"
+   return 1
+   fi
 }
 
 # check standard inkvokation with no arguments
@@ -134,6 +145,13 @@ test_csvsummary_extended() {
find_str_or_fail "Out-Out;" csvsummary ${FUNCNAME[0]}
 }
 
+skip_no_probe_record_support
+err=$?
+if [ $err -ne 0 ]; then
+   echo "WARN: Skipping tests. No libtraceevent support"
+   cleanup
+   exit $err
+fi
 prepare_perf_data
 test_basic
 test_ns_rename
-- 
2.39.2





[PATCH 6.3 375/431] perf tests task_analyzer: Fix bad substitution ${$1}

2023-07-09 Thread Greg Kroah-Hartman
From: Aditya Gupta 

[ Upstream commit 5c4396efb53ef07d046a2e9456b240880e0c3076 ]

${$1} gives bad substitution error on sh, bash, and zsh. This seems like
a typo, and this patch modifies it to $1, since that is what it's usage
looks like from wherever `check_exec_0` is called.

This issue due to ${$1} caused all function calls to give error in
`find_str_or_fail` line, and so no test runs completely. But
'perf test "perf script task-analyzer tests"' wrongly reports
that tests passed with the status OK, which is wrong considering
the tests didn't even run completely

Fixes: e8478b84d6ba9ccf ("perf test: add new task-analyzer tests")
Signed-off-by: Aditya Gupta 
Signed-off-by: Athira Rajeev 
Signed-off-by: Kajol Jain 
Cc: Disha Goel 
Cc: Hagen Paul Pfeifer 
Cc: Ian Rogers 
Cc: Jiri Olsa 
Cc: John Garry 
Cc: Madhavan Srinivasan 
Cc: Namhyung Kim 
Cc: Petar Gligoric 
Cc: Ravi Bangoria 
Cc: linuxppc-dev@lists.ozlabs.org
Link: 
https://lore.kernel.org/r/20230613164145.50488-16-atraj...@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Sasha Levin 
---
 tools/perf/tests/shell/test_task_analyzer.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/tests/shell/test_task_analyzer.sh 
b/tools/perf/tests/shell/test_task_analyzer.sh
index a98e4ab66040e..6b3343234a6b2 100755
--- a/tools/perf/tests/shell/test_task_analyzer.sh
+++ b/tools/perf/tests/shell/test_task_analyzer.sh
@@ -31,7 +31,7 @@ report() {
 
 check_exec_0() {
if [ $? != 0 ]; then
-   report 1 "invokation of ${$1} command failed"
+   report 1 "invocation of $1 command failed"
fi
 }
 
-- 
2.39.2





[PATCH 6.3 257/431] soc/fsl/qe: fix usb.c build errors

2023-07-09 Thread Greg Kroah-Hartman
From: Randy Dunlap 

[ Upstream commit 7b1a78babd0d2cd27aa07255dee0c2d7ac0f31e3 ]

Fix build errors in soc/fsl/qe/usb.c when QUICC_ENGINE is not set.
This happens when PPC_EP88XC is set, which selects CPM1 & CPM.
When CPM is set, USB_FSL_QE can be set without QUICC_ENGINE
being set. When USB_FSL_QE is set, QE_USB deafults to y, which
causes build errors when QUICC_ENGINE is not set. Making
QE_USB depend on QUICC_ENGINE prevents QE_USB from defaulting to y.

Fixes these build errors:

drivers/soc/fsl/qe/usb.o: in function `qe_usb_clock_set':
usb.c:(.text+0x1e): undefined reference to `qe_immr'
powerpc-linux-ld: usb.c:(.text+0x2a): undefined reference to `qe_immr'
powerpc-linux-ld: usb.c:(.text+0xbc): undefined reference to `qe_setbrg'
powerpc-linux-ld: usb.c:(.text+0xca): undefined reference to `cmxgcr_lock'
powerpc-linux-ld: usb.c:(.text+0xce): undefined reference to `cmxgcr_lock'

Fixes: 5e41486c408e ("powerpc/QE: add support for QE USB clocks routing")
Signed-off-by: Randy Dunlap 
Reported-by: kernel test robot 
Link: https://lore.kernel.org/all/202301101500.pillnv6r-...@intel.com/
Suggested-by: Michael Ellerman 
Cc: Christophe Leroy 
Cc: Leo Li 
Cc: Masahiro Yamada 
Cc: Nicolas Schier 
Cc: Qiang Zhao 
Cc: linuxppc-dev 
Cc: linux-arm-ker...@lists.infradead.org
Cc: Kumar Gala 
Acked-by: Nicolas Schier 
Signed-off-by: Li Yang 
Signed-off-by: Sasha Levin 
---
 drivers/soc/fsl/qe/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/soc/fsl/qe/Kconfig b/drivers/soc/fsl/qe/Kconfig
index 357c5800b112f..7afa796dbbb89 100644
--- a/drivers/soc/fsl/qe/Kconfig
+++ b/drivers/soc/fsl/qe/Kconfig
@@ -39,6 +39,7 @@ config QE_TDM
 
 config QE_USB
bool
+   depends on QUICC_ENGINE
default y if USB_FSL_QE
help
  QE USB Controller support
-- 
2.39.2





Re: [PATCH 00/97] usb: Convert to platform remove callback returning void

2023-05-28 Thread Greg Kroah-Hartman
On Sun, May 28, 2023 at 12:37:17PM +0100, Greg Kroah-Hartman wrote:
> On Thu, May 18, 2023 at 01:01:02AM +0200, Uwe Kleine-König wrote:
> > Hello,
> > 
> > this series convers the drivers below drivers/usb to the .remove_new()
> > callback of struct platform_driver(). The motivation is to make the
> > remove callback less prone for errors and wrong assumptions. See commit
> > 5c5a7680e67b ("platform: Provide a remove callback that returns no
> > value") for a more detailed rationale.
> > 
> > All drivers converted here already returned zero unconditionally in their
> > .remove() callback, so converting them to .remove_new() is trivial.
> 
> All but 2 patches applied, as one was for a driver that wasn't in the
> tree anymore, and the dwc2 patch didn't apply at all.

Oops, the xhci patches broke the build so I dropped them too.  Please
regenerate the series against the next linux-next that has these in
them and resend the remaining bits.

thanks,

greg k-h


Re: [PATCH 00/97] usb: Convert to platform remove callback returning void

2023-05-28 Thread Greg Kroah-Hartman
On Thu, May 18, 2023 at 01:01:02AM +0200, Uwe Kleine-König wrote:
> Hello,
> 
> this series convers the drivers below drivers/usb to the .remove_new()
> callback of struct platform_driver(). The motivation is to make the
> remove callback less prone for errors and wrong assumptions. See commit
> 5c5a7680e67b ("platform: Provide a remove callback that returns no
> value") for a more detailed rationale.
> 
> All drivers converted here already returned zero unconditionally in their
> .remove() callback, so converting them to .remove_new() is trivial.

All but 2 patches applied, as one was for a driver that wasn't in the
tree anymore, and the dwc2 patch didn't apply at all.

thanks,

greg k-h


[PATCH 5.4 236/282] perf vendor events power9: Remove UTF-8 characters from JSON files

2023-05-15 Thread Greg Kroah-Hartman
From: Kajol Jain 

[ Upstream commit 5d9df8731c0941f3add30f96745a62586a0c9d52 ]

Commit 3c22ba5243040c13 ("perf vendor events powerpc: Update POWER9
events") added and updated power9 PMU JSON events. However some of the
JSON events which are part of other.json and pipeline.json files,
contains UTF-8 characters in their brief description.  Having UTF-8
character could breaks the perf build on some distros.

Fix this issue by removing the UTF-8 characters from other.json and
pipeline.json files.

Result without the fix:

  [command]# file -i pmu-events/arch/powerpc/power9/*
  pmu-events/arch/powerpc/power9/cache.json:  application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/floating-point.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/frontend.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/marked.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/memory.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/metrics.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/nest_metrics.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/other.json:  application/json; 
charset=utf-8
  pmu-events/arch/powerpc/power9/pipeline.json:   application/json; 
charset=utf-8
  pmu-events/arch/powerpc/power9/pmc.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/translation.json:application/json; 
charset=us-ascii
  [command]#

Result with the fix:

  [command]# file -i pmu-events/arch/powerpc/power9/*
  pmu-events/arch/powerpc/power9/cache.json:  application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/floating-point.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/frontend.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/marked.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/memory.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/metrics.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/nest_metrics.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/other.json:  application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/pipeline.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/pmc.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/translation.json:application/json; 
charset=us-ascii
  [command]#

Fixes: 3c22ba5243040c13 ("perf vendor events powerpc: Update POWER9 events")
Reported-by: Arnaldo Carvalho de Melo 
Signed-off-by: Kajol Jain 
Acked-by: Ian Rogers 
Tested-by: Arnaldo Carvalho de Melo 
Cc: Athira Rajeev 
Cc: Disha Goel 
Cc: Jiri Olsa 
Cc: Madhavan Srinivasan 
Cc: Sukadev Bhattiprolu 
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/lkml/zbxp77deq7ikt...@kernel.org/
Link: https://lore.kernel.org/r/20230328112908.113158-1-kj...@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Sasha Levin 
---
 tools/perf/pmu-events/arch/powerpc/power9/other.json| 4 ++--
 tools/perf/pmu-events/arch/powerpc/power9/pipeline.json | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/pmu-events/arch/powerpc/power9/other.json 
b/tools/perf/pmu-events/arch/powerpc/power9/other.json
index 62b8642696237..ce75652e90516 100644
--- a/tools/perf/pmu-events/arch/powerpc/power9/other.json
+++ b/tools/perf/pmu-events/arch/powerpc/power9/other.json
@@ -1417,7 +1417,7 @@
   {,
 "EventCode": "0x45054",
 "EventName": "PM_FMA_CMPL",
-"BriefDescription": "two flops operation completed (fmadd, fnmadd, fmsub, 
fnmsub) Scalar instructions only. "
+"BriefDescription": "two flops operation completed (fmadd, fnmadd, fmsub, 
fnmsub) Scalar instructions only."
   },
   {,
 "EventCode": "0x201E8",
@@ -2017,7 +2017,7 @@
   {,
 "EventCode": "0xC0BC",
 "EventName": "PM_LSU_FLUSH_OTHER",
-"BriefDescription": "Other LSU flushes including: Sync (sync ack from L2 
caused search of LRQ for oldest snooped load, This will either signal a Precise 
Flush of the oldest snooped loa or a Flush Next PPC); Data Valid Flush Next 
(several cases of this, one example is store and reload are lined up such that 
a store-hit-reload scenario exists and the CDF has already launched and has 
gotten bad/stale data); Bad Data Valid Flush Next (might be a few cases of 
this, one example is a larxa (D$ hit) return data and dval but can't allocate 
to LMQ (LMQ full or other reason). Already gave dval but can't watch it for 
snoop_hit_larx. Need to take the “bad dval” back and flush all younger ops)"
+"BriefDescription": "Other LSU flushes including: Sync (sync ack from L2 
caused search of LRQ for oldest snooped load, This will either signal a Precise 
Flush of 

[PATCH 5.10 329/381] perf vendor events power9: Remove UTF-8 characters from JSON files

2023-05-15 Thread Greg Kroah-Hartman
From: Kajol Jain 

[ Upstream commit 5d9df8731c0941f3add30f96745a62586a0c9d52 ]

Commit 3c22ba5243040c13 ("perf vendor events powerpc: Update POWER9
events") added and updated power9 PMU JSON events. However some of the
JSON events which are part of other.json and pipeline.json files,
contains UTF-8 characters in their brief description.  Having UTF-8
character could breaks the perf build on some distros.

Fix this issue by removing the UTF-8 characters from other.json and
pipeline.json files.

Result without the fix:

  [command]# file -i pmu-events/arch/powerpc/power9/*
  pmu-events/arch/powerpc/power9/cache.json:  application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/floating-point.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/frontend.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/marked.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/memory.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/metrics.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/nest_metrics.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/other.json:  application/json; 
charset=utf-8
  pmu-events/arch/powerpc/power9/pipeline.json:   application/json; 
charset=utf-8
  pmu-events/arch/powerpc/power9/pmc.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/translation.json:application/json; 
charset=us-ascii
  [command]#

Result with the fix:

  [command]# file -i pmu-events/arch/powerpc/power9/*
  pmu-events/arch/powerpc/power9/cache.json:  application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/floating-point.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/frontend.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/marked.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/memory.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/metrics.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/nest_metrics.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/other.json:  application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/pipeline.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/pmc.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/translation.json:application/json; 
charset=us-ascii
  [command]#

Fixes: 3c22ba5243040c13 ("perf vendor events powerpc: Update POWER9 events")
Reported-by: Arnaldo Carvalho de Melo 
Signed-off-by: Kajol Jain 
Acked-by: Ian Rogers 
Tested-by: Arnaldo Carvalho de Melo 
Cc: Athira Rajeev 
Cc: Disha Goel 
Cc: Jiri Olsa 
Cc: Madhavan Srinivasan 
Cc: Sukadev Bhattiprolu 
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/lkml/zbxp77deq7ikt...@kernel.org/
Link: https://lore.kernel.org/r/20230328112908.113158-1-kj...@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Sasha Levin 
---
 tools/perf/pmu-events/arch/powerpc/power9/other.json| 4 ++--
 tools/perf/pmu-events/arch/powerpc/power9/pipeline.json | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/pmu-events/arch/powerpc/power9/other.json 
b/tools/perf/pmu-events/arch/powerpc/power9/other.json
index 3f69422c21f99..f10bd554521a0 100644
--- a/tools/perf/pmu-events/arch/powerpc/power9/other.json
+++ b/tools/perf/pmu-events/arch/powerpc/power9/other.json
@@ -1417,7 +1417,7 @@
   {
 "EventCode": "0x45054",
 "EventName": "PM_FMA_CMPL",
-"BriefDescription": "two flops operation completed (fmadd, fnmadd, fmsub, 
fnmsub) Scalar instructions only. "
+"BriefDescription": "two flops operation completed (fmadd, fnmadd, fmsub, 
fnmsub) Scalar instructions only."
   },
   {
 "EventCode": "0x201E8",
@@ -2017,7 +2017,7 @@
   {
 "EventCode": "0xC0BC",
 "EventName": "PM_LSU_FLUSH_OTHER",
-"BriefDescription": "Other LSU flushes including: Sync (sync ack from L2 
caused search of LRQ for oldest snooped load, This will either signal a Precise 
Flush of the oldest snooped loa or a Flush Next PPC); Data Valid Flush Next 
(several cases of this, one example is store and reload are lined up such that 
a store-hit-reload scenario exists and the CDF has already launched and has 
gotten bad/stale data); Bad Data Valid Flush Next (might be a few cases of 
this, one example is a larxa (D$ hit) return data and dval but can't allocate 
to LMQ (LMQ full or other reason). Already gave dval but can't watch it for 
snoop_hit_larx. Need to take the “bad dval” back and flush all younger ops)"
+"BriefDescription": "Other LSU flushes including: Sync (sync ack from L2 
caused search of LRQ for oldest snooped load, This will either signal a Precise 
Flush of the

[PATCH 5.15 050/134] perf vendor events power9: Remove UTF-8 characters from JSON files

2023-05-15 Thread Greg Kroah-Hartman
From: Kajol Jain 

[ Upstream commit 5d9df8731c0941f3add30f96745a62586a0c9d52 ]

Commit 3c22ba5243040c13 ("perf vendor events powerpc: Update POWER9
events") added and updated power9 PMU JSON events. However some of the
JSON events which are part of other.json and pipeline.json files,
contains UTF-8 characters in their brief description.  Having UTF-8
character could breaks the perf build on some distros.

Fix this issue by removing the UTF-8 characters from other.json and
pipeline.json files.

Result without the fix:

  [command]# file -i pmu-events/arch/powerpc/power9/*
  pmu-events/arch/powerpc/power9/cache.json:  application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/floating-point.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/frontend.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/marked.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/memory.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/metrics.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/nest_metrics.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/other.json:  application/json; 
charset=utf-8
  pmu-events/arch/powerpc/power9/pipeline.json:   application/json; 
charset=utf-8
  pmu-events/arch/powerpc/power9/pmc.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/translation.json:application/json; 
charset=us-ascii
  [command]#

Result with the fix:

  [command]# file -i pmu-events/arch/powerpc/power9/*
  pmu-events/arch/powerpc/power9/cache.json:  application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/floating-point.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/frontend.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/marked.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/memory.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/metrics.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/nest_metrics.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/other.json:  application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/pipeline.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/pmc.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/translation.json:application/json; 
charset=us-ascii
  [command]#

Fixes: 3c22ba5243040c13 ("perf vendor events powerpc: Update POWER9 events")
Reported-by: Arnaldo Carvalho de Melo 
Signed-off-by: Kajol Jain 
Acked-by: Ian Rogers 
Tested-by: Arnaldo Carvalho de Melo 
Cc: Athira Rajeev 
Cc: Disha Goel 
Cc: Jiri Olsa 
Cc: Madhavan Srinivasan 
Cc: Sukadev Bhattiprolu 
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/lkml/zbxp77deq7ikt...@kernel.org/
Link: https://lore.kernel.org/r/20230328112908.113158-1-kj...@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Sasha Levin 
---
 tools/perf/pmu-events/arch/powerpc/power9/other.json| 4 ++--
 tools/perf/pmu-events/arch/powerpc/power9/pipeline.json | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/pmu-events/arch/powerpc/power9/other.json 
b/tools/perf/pmu-events/arch/powerpc/power9/other.json
index 3f69422c21f99..f10bd554521a0 100644
--- a/tools/perf/pmu-events/arch/powerpc/power9/other.json
+++ b/tools/perf/pmu-events/arch/powerpc/power9/other.json
@@ -1417,7 +1417,7 @@
   {
 "EventCode": "0x45054",
 "EventName": "PM_FMA_CMPL",
-"BriefDescription": "two flops operation completed (fmadd, fnmadd, fmsub, 
fnmsub) Scalar instructions only. "
+"BriefDescription": "two flops operation completed (fmadd, fnmadd, fmsub, 
fnmsub) Scalar instructions only."
   },
   {
 "EventCode": "0x201E8",
@@ -2017,7 +2017,7 @@
   {
 "EventCode": "0xC0BC",
 "EventName": "PM_LSU_FLUSH_OTHER",
-"BriefDescription": "Other LSU flushes including: Sync (sync ack from L2 
caused search of LRQ for oldest snooped load, This will either signal a Precise 
Flush of the oldest snooped loa or a Flush Next PPC); Data Valid Flush Next 
(several cases of this, one example is store and reload are lined up such that 
a store-hit-reload scenario exists and the CDF has already launched and has 
gotten bad/stale data); Bad Data Valid Flush Next (might be a few cases of 
this, one example is a larxa (D$ hit) return data and dval but can't allocate 
to LMQ (LMQ full or other reason). Already gave dval but can't watch it for 
snoop_hit_larx. Need to take the “bad dval” back and flush all younger ops)"
+"BriefDescription": "Other LSU flushes including: Sync (sync ack from L2 
caused search of LRQ for oldest snooped load, This will either signal a Precise 
Flush of the

[PATCH 6.2 101/242] perf vendor events power9: Remove UTF-8 characters from JSON files

2023-05-15 Thread Greg Kroah-Hartman
From: Kajol Jain 

[ Upstream commit 5d9df8731c0941f3add30f96745a62586a0c9d52 ]

Commit 3c22ba5243040c13 ("perf vendor events powerpc: Update POWER9
events") added and updated power9 PMU JSON events. However some of the
JSON events which are part of other.json and pipeline.json files,
contains UTF-8 characters in their brief description.  Having UTF-8
character could breaks the perf build on some distros.

Fix this issue by removing the UTF-8 characters from other.json and
pipeline.json files.

Result without the fix:

  [command]# file -i pmu-events/arch/powerpc/power9/*
  pmu-events/arch/powerpc/power9/cache.json:  application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/floating-point.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/frontend.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/marked.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/memory.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/metrics.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/nest_metrics.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/other.json:  application/json; 
charset=utf-8
  pmu-events/arch/powerpc/power9/pipeline.json:   application/json; 
charset=utf-8
  pmu-events/arch/powerpc/power9/pmc.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/translation.json:application/json; 
charset=us-ascii
  [command]#

Result with the fix:

  [command]# file -i pmu-events/arch/powerpc/power9/*
  pmu-events/arch/powerpc/power9/cache.json:  application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/floating-point.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/frontend.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/marked.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/memory.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/metrics.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/nest_metrics.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/other.json:  application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/pipeline.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/pmc.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/translation.json:application/json; 
charset=us-ascii
  [command]#

Fixes: 3c22ba5243040c13 ("perf vendor events powerpc: Update POWER9 events")
Reported-by: Arnaldo Carvalho de Melo 
Signed-off-by: Kajol Jain 
Acked-by: Ian Rogers 
Tested-by: Arnaldo Carvalho de Melo 
Cc: Athira Rajeev 
Cc: Disha Goel 
Cc: Jiri Olsa 
Cc: Madhavan Srinivasan 
Cc: Sukadev Bhattiprolu 
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/lkml/zbxp77deq7ikt...@kernel.org/
Link: https://lore.kernel.org/r/20230328112908.113158-1-kj...@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Sasha Levin 
---
 tools/perf/pmu-events/arch/powerpc/power9/other.json| 4 ++--
 tools/perf/pmu-events/arch/powerpc/power9/pipeline.json | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/pmu-events/arch/powerpc/power9/other.json 
b/tools/perf/pmu-events/arch/powerpc/power9/other.json
index 3f69422c21f99..f10bd554521a0 100644
--- a/tools/perf/pmu-events/arch/powerpc/power9/other.json
+++ b/tools/perf/pmu-events/arch/powerpc/power9/other.json
@@ -1417,7 +1417,7 @@
   {
 "EventCode": "0x45054",
 "EventName": "PM_FMA_CMPL",
-"BriefDescription": "two flops operation completed (fmadd, fnmadd, fmsub, 
fnmsub) Scalar instructions only. "
+"BriefDescription": "two flops operation completed (fmadd, fnmadd, fmsub, 
fnmsub) Scalar instructions only."
   },
   {
 "EventCode": "0x201E8",
@@ -2017,7 +2017,7 @@
   {
 "EventCode": "0xC0BC",
 "EventName": "PM_LSU_FLUSH_OTHER",
-"BriefDescription": "Other LSU flushes including: Sync (sync ack from L2 
caused search of LRQ for oldest snooped load, This will either signal a Precise 
Flush of the oldest snooped loa or a Flush Next PPC); Data Valid Flush Next 
(several cases of this, one example is store and reload are lined up such that 
a store-hit-reload scenario exists and the CDF has already launched and has 
gotten bad/stale data); Bad Data Valid Flush Next (might be a few cases of 
this, one example is a larxa (D$ hit) return data and dval but can't allocate 
to LMQ (LMQ full or other reason). Already gave dval but can't watch it for 
snoop_hit_larx. Need to take the “bad dval” back and flush all younger ops)"
+"BriefDescription": "Other LSU flushes including: Sync (sync ack from L2 
caused search of LRQ for oldest snooped load, This will either signal a Precise 
Flush of the

[PATCH 6.1 095/239] perf vendor events power9: Remove UTF-8 characters from JSON files

2023-05-15 Thread Greg Kroah-Hartman
From: Kajol Jain 

[ Upstream commit 5d9df8731c0941f3add30f96745a62586a0c9d52 ]

Commit 3c22ba5243040c13 ("perf vendor events powerpc: Update POWER9
events") added and updated power9 PMU JSON events. However some of the
JSON events which are part of other.json and pipeline.json files,
contains UTF-8 characters in their brief description.  Having UTF-8
character could breaks the perf build on some distros.

Fix this issue by removing the UTF-8 characters from other.json and
pipeline.json files.

Result without the fix:

  [command]# file -i pmu-events/arch/powerpc/power9/*
  pmu-events/arch/powerpc/power9/cache.json:  application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/floating-point.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/frontend.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/marked.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/memory.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/metrics.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/nest_metrics.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/other.json:  application/json; 
charset=utf-8
  pmu-events/arch/powerpc/power9/pipeline.json:   application/json; 
charset=utf-8
  pmu-events/arch/powerpc/power9/pmc.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/translation.json:application/json; 
charset=us-ascii
  [command]#

Result with the fix:

  [command]# file -i pmu-events/arch/powerpc/power9/*
  pmu-events/arch/powerpc/power9/cache.json:  application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/floating-point.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/frontend.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/marked.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/memory.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/metrics.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/nest_metrics.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/other.json:  application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/pipeline.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/pmc.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/translation.json:application/json; 
charset=us-ascii
  [command]#

Fixes: 3c22ba5243040c13 ("perf vendor events powerpc: Update POWER9 events")
Reported-by: Arnaldo Carvalho de Melo 
Signed-off-by: Kajol Jain 
Acked-by: Ian Rogers 
Tested-by: Arnaldo Carvalho de Melo 
Cc: Athira Rajeev 
Cc: Disha Goel 
Cc: Jiri Olsa 
Cc: Madhavan Srinivasan 
Cc: Sukadev Bhattiprolu 
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/lkml/zbxp77deq7ikt...@kernel.org/
Link: https://lore.kernel.org/r/20230328112908.113158-1-kj...@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Sasha Levin 
---
 tools/perf/pmu-events/arch/powerpc/power9/other.json| 4 ++--
 tools/perf/pmu-events/arch/powerpc/power9/pipeline.json | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/pmu-events/arch/powerpc/power9/other.json 
b/tools/perf/pmu-events/arch/powerpc/power9/other.json
index 3f69422c21f99..f10bd554521a0 100644
--- a/tools/perf/pmu-events/arch/powerpc/power9/other.json
+++ b/tools/perf/pmu-events/arch/powerpc/power9/other.json
@@ -1417,7 +1417,7 @@
   {
 "EventCode": "0x45054",
 "EventName": "PM_FMA_CMPL",
-"BriefDescription": "two flops operation completed (fmadd, fnmadd, fmsub, 
fnmsub) Scalar instructions only. "
+"BriefDescription": "two flops operation completed (fmadd, fnmadd, fmsub, 
fnmsub) Scalar instructions only."
   },
   {
 "EventCode": "0x201E8",
@@ -2017,7 +2017,7 @@
   {
 "EventCode": "0xC0BC",
 "EventName": "PM_LSU_FLUSH_OTHER",
-"BriefDescription": "Other LSU flushes including: Sync (sync ack from L2 
caused search of LRQ for oldest snooped load, This will either signal a Precise 
Flush of the oldest snooped loa or a Flush Next PPC); Data Valid Flush Next 
(several cases of this, one example is store and reload are lined up such that 
a store-hit-reload scenario exists and the CDF has already launched and has 
gotten bad/stale data); Bad Data Valid Flush Next (might be a few cases of 
this, one example is a larxa (D$ hit) return data and dval but can't allocate 
to LMQ (LMQ full or other reason). Already gave dval but can't watch it for 
snoop_hit_larx. Need to take the “bad dval” back and flush all younger ops)"
+"BriefDescription": "Other LSU flushes including: Sync (sync ack from L2 
caused search of LRQ for oldest snooped load, This will either signal a Precise 
Flush of the

[PATCH 6.3 110/246] perf vendor events power9: Remove UTF-8 characters from JSON files

2023-05-15 Thread Greg Kroah-Hartman
From: Kajol Jain 

[ Upstream commit 5d9df8731c0941f3add30f96745a62586a0c9d52 ]

Commit 3c22ba5243040c13 ("perf vendor events powerpc: Update POWER9
events") added and updated power9 PMU JSON events. However some of the
JSON events which are part of other.json and pipeline.json files,
contains UTF-8 characters in their brief description.  Having UTF-8
character could breaks the perf build on some distros.

Fix this issue by removing the UTF-8 characters from other.json and
pipeline.json files.

Result without the fix:

  [command]# file -i pmu-events/arch/powerpc/power9/*
  pmu-events/arch/powerpc/power9/cache.json:  application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/floating-point.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/frontend.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/marked.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/memory.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/metrics.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/nest_metrics.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/other.json:  application/json; 
charset=utf-8
  pmu-events/arch/powerpc/power9/pipeline.json:   application/json; 
charset=utf-8
  pmu-events/arch/powerpc/power9/pmc.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/translation.json:application/json; 
charset=us-ascii
  [command]#

Result with the fix:

  [command]# file -i pmu-events/arch/powerpc/power9/*
  pmu-events/arch/powerpc/power9/cache.json:  application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/floating-point.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/frontend.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/marked.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/memory.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/metrics.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/nest_metrics.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/other.json:  application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/pipeline.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/pmc.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/translation.json:application/json; 
charset=us-ascii
  [command]#

Fixes: 3c22ba5243040c13 ("perf vendor events powerpc: Update POWER9 events")
Reported-by: Arnaldo Carvalho de Melo 
Signed-off-by: Kajol Jain 
Acked-by: Ian Rogers 
Tested-by: Arnaldo Carvalho de Melo 
Cc: Athira Rajeev 
Cc: Disha Goel 
Cc: Jiri Olsa 
Cc: Madhavan Srinivasan 
Cc: Sukadev Bhattiprolu 
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/lkml/zbxp77deq7ikt...@kernel.org/
Link: https://lore.kernel.org/r/20230328112908.113158-1-kj...@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Sasha Levin 
---
 tools/perf/pmu-events/arch/powerpc/power9/other.json| 4 ++--
 tools/perf/pmu-events/arch/powerpc/power9/pipeline.json | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/pmu-events/arch/powerpc/power9/other.json 
b/tools/perf/pmu-events/arch/powerpc/power9/other.json
index 3f69422c21f99..f10bd554521a0 100644
--- a/tools/perf/pmu-events/arch/powerpc/power9/other.json
+++ b/tools/perf/pmu-events/arch/powerpc/power9/other.json
@@ -1417,7 +1417,7 @@
   {
 "EventCode": "0x45054",
 "EventName": "PM_FMA_CMPL",
-"BriefDescription": "two flops operation completed (fmadd, fnmadd, fmsub, 
fnmsub) Scalar instructions only. "
+"BriefDescription": "two flops operation completed (fmadd, fnmadd, fmsub, 
fnmsub) Scalar instructions only."
   },
   {
 "EventCode": "0x201E8",
@@ -2017,7 +2017,7 @@
   {
 "EventCode": "0xC0BC",
 "EventName": "PM_LSU_FLUSH_OTHER",
-"BriefDescription": "Other LSU flushes including: Sync (sync ack from L2 
caused search of LRQ for oldest snooped load, This will either signal a Precise 
Flush of the oldest snooped loa or a Flush Next PPC); Data Valid Flush Next 
(several cases of this, one example is store and reload are lined up such that 
a store-hit-reload scenario exists and the CDF has already launched and has 
gotten bad/stale data); Bad Data Valid Flush Next (might be a few cases of 
this, one example is a larxa (D$ hit) return data and dval but can't allocate 
to LMQ (LMQ full or other reason). Already gave dval but can't watch it for 
snoop_hit_larx. Need to take the “bad dval” back and flush all younger ops)"
+"BriefDescription": "Other LSU flushes including: Sync (sync ack from L2 
caused search of LRQ for oldest snooped load, This will either signal a Precise 
Flush of the

[PATCH 4.19 164/191] perf vendor events power9: Remove UTF-8 characters from JSON files

2023-05-15 Thread Greg Kroah-Hartman
From: Kajol Jain 

[ Upstream commit 5d9df8731c0941f3add30f96745a62586a0c9d52 ]

Commit 3c22ba5243040c13 ("perf vendor events powerpc: Update POWER9
events") added and updated power9 PMU JSON events. However some of the
JSON events which are part of other.json and pipeline.json files,
contains UTF-8 characters in their brief description.  Having UTF-8
character could breaks the perf build on some distros.

Fix this issue by removing the UTF-8 characters from other.json and
pipeline.json files.

Result without the fix:

  [command]# file -i pmu-events/arch/powerpc/power9/*
  pmu-events/arch/powerpc/power9/cache.json:  application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/floating-point.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/frontend.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/marked.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/memory.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/metrics.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/nest_metrics.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/other.json:  application/json; 
charset=utf-8
  pmu-events/arch/powerpc/power9/pipeline.json:   application/json; 
charset=utf-8
  pmu-events/arch/powerpc/power9/pmc.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/translation.json:application/json; 
charset=us-ascii
  [command]#

Result with the fix:

  [command]# file -i pmu-events/arch/powerpc/power9/*
  pmu-events/arch/powerpc/power9/cache.json:  application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/floating-point.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/frontend.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/marked.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/memory.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/metrics.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/nest_metrics.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/other.json:  application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/pipeline.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/pmc.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/translation.json:application/json; 
charset=us-ascii
  [command]#

Fixes: 3c22ba5243040c13 ("perf vendor events powerpc: Update POWER9 events")
Reported-by: Arnaldo Carvalho de Melo 
Signed-off-by: Kajol Jain 
Acked-by: Ian Rogers 
Tested-by: Arnaldo Carvalho de Melo 
Cc: Athira Rajeev 
Cc: Disha Goel 
Cc: Jiri Olsa 
Cc: Madhavan Srinivasan 
Cc: Sukadev Bhattiprolu 
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/lkml/zbxp77deq7ikt...@kernel.org/
Link: https://lore.kernel.org/r/20230328112908.113158-1-kj...@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Sasha Levin 
---
 tools/perf/pmu-events/arch/powerpc/power9/other.json| 4 ++--
 tools/perf/pmu-events/arch/powerpc/power9/pipeline.json | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/pmu-events/arch/powerpc/power9/other.json 
b/tools/perf/pmu-events/arch/powerpc/power9/other.json
index 48cf4f920b3ff..064341c0df575 100644
--- a/tools/perf/pmu-events/arch/powerpc/power9/other.json
+++ b/tools/perf/pmu-events/arch/powerpc/power9/other.json
@@ -1417,7 +1417,7 @@
   {,
 "EventCode": "0x45054",
 "EventName": "PM_FMA_CMPL",
-"BriefDescription": "two flops operation completed (fmadd, fnmadd, fmsub, 
fnmsub) Scalar instructions only. "
+"BriefDescription": "two flops operation completed (fmadd, fnmadd, fmsub, 
fnmsub) Scalar instructions only."
   },
   {,
 "EventCode": "0x201E8",
@@ -2017,7 +2017,7 @@
   {,
 "EventCode": "0xC0BC",
 "EventName": "PM_LSU_FLUSH_OTHER",
-"BriefDescription": "Other LSU flushes including: Sync (sync ack from L2 
caused search of LRQ for oldest snooped load, This will either signal a Precise 
Flush of the oldest snooped loa or a Flush Next PPC); Data Valid Flush Next 
(several cases of this, one example is store and reload are lined up such that 
a store-hit-reload scenario exists and the CDF has already launched and has 
gotten bad/stale data); Bad Data Valid Flush Next (might be a few cases of 
this, one example is a larxa (D$ hit) return data and dval but can't allocate 
to LMQ (LMQ full or other reason). Already gave dval but can't watch it for 
snoop_hit_larx. Need to take the “bad dval” back and flush all younger ops)"
+"BriefDescription": "Other LSU flushes including: Sync (sync ack from L2 
caused search of LRQ for oldest snooped load, This will either signal a Precise 
Flush of 

[PATCH 4.14 094/116] perf vendor events power9: Remove UTF-8 characters from JSON files

2023-05-15 Thread Greg Kroah-Hartman
From: Kajol Jain 

[ Upstream commit 5d9df8731c0941f3add30f96745a62586a0c9d52 ]

Commit 3c22ba5243040c13 ("perf vendor events powerpc: Update POWER9
events") added and updated power9 PMU JSON events. However some of the
JSON events which are part of other.json and pipeline.json files,
contains UTF-8 characters in their brief description.  Having UTF-8
character could breaks the perf build on some distros.

Fix this issue by removing the UTF-8 characters from other.json and
pipeline.json files.

Result without the fix:

  [command]# file -i pmu-events/arch/powerpc/power9/*
  pmu-events/arch/powerpc/power9/cache.json:  application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/floating-point.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/frontend.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/marked.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/memory.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/metrics.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/nest_metrics.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/other.json:  application/json; 
charset=utf-8
  pmu-events/arch/powerpc/power9/pipeline.json:   application/json; 
charset=utf-8
  pmu-events/arch/powerpc/power9/pmc.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/translation.json:application/json; 
charset=us-ascii
  [command]#

Result with the fix:

  [command]# file -i pmu-events/arch/powerpc/power9/*
  pmu-events/arch/powerpc/power9/cache.json:  application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/floating-point.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/frontend.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/marked.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/memory.json: application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/metrics.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/nest_metrics.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/other.json:  application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/pipeline.json:   application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/pmc.json:application/json; 
charset=us-ascii
  pmu-events/arch/powerpc/power9/translation.json:application/json; 
charset=us-ascii
  [command]#

Fixes: 3c22ba5243040c13 ("perf vendor events powerpc: Update POWER9 events")
Reported-by: Arnaldo Carvalho de Melo 
Signed-off-by: Kajol Jain 
Acked-by: Ian Rogers 
Tested-by: Arnaldo Carvalho de Melo 
Cc: Athira Rajeev 
Cc: Disha Goel 
Cc: Jiri Olsa 
Cc: Madhavan Srinivasan 
Cc: Sukadev Bhattiprolu 
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/lkml/zbxp77deq7ikt...@kernel.org/
Link: https://lore.kernel.org/r/20230328112908.113158-1-kj...@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Sasha Levin 
---
 tools/perf/pmu-events/arch/powerpc/power9/other.json| 4 ++--
 tools/perf/pmu-events/arch/powerpc/power9/pipeline.json | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/pmu-events/arch/powerpc/power9/other.json 
b/tools/perf/pmu-events/arch/powerpc/power9/other.json
index 54cc3be00fc2d..0048c27d75f35 100644
--- a/tools/perf/pmu-events/arch/powerpc/power9/other.json
+++ b/tools/perf/pmu-events/arch/powerpc/power9/other.json
@@ -1452,7 +1452,7 @@
   {,
 "EventCode": "0x45054",
 "EventName": "PM_FMA_CMPL",
-"BriefDescription": "two flops operation completed (fmadd, fnmadd, fmsub, 
fnmsub) Scalar instructions only. "
+"BriefDescription": "two flops operation completed (fmadd, fnmadd, fmsub, 
fnmsub) Scalar instructions only."
   },
   {,
 "EventCode": "0x5090",
@@ -2067,7 +2067,7 @@
   {,
 "EventCode": "0xC0BC",
 "EventName": "PM_LSU_FLUSH_OTHER",
-"BriefDescription": "Other LSU flushes including: Sync (sync ack from L2 
caused search of LRQ for oldest snooped load, This will either signal a Precise 
Flush of the oldest snooped loa or a Flush Next PPC); Data Valid Flush Next 
(several cases of this, one example is store and reload are lined up such that 
a store-hit-reload scenario exists and the CDF has already launched and has 
gotten bad/stale data); Bad Data Valid Flush Next (might be a few cases of 
this, one example is a larxa (D$ hit) return data and dval but can't allocate 
to LMQ (LMQ full or other reason). Already gave dval but can't watch it for 
snoop_hit_larx. Need to take the “bad dval” back and flush all younger ops)"
+"BriefDescription": "Other LSU flushes including: Sync (sync ack from L2 
caused search of LRQ for oldest snooped load, This will either signal a Precise 
Flush of t

Re: Fwd: Linux 6.3.1 + AMD RX 570 on ppc64le 4K: Kernel attempted to read user page (1128) - exploit attempt? (uid: 0)

2023-05-12 Thread Greg Kroah-Hartman
On Fri, May 12, 2023 at 03:25:47PM +, Christophe Leroy wrote:
> 
> 
> Le 12/05/2023 à 17:16, Christophe Leroy a écrit :
> > 
> > 
> > Le 11/05/2023 à 19:25, Niccolò Belli a écrit :
> >> [Vous ne recevez pas souvent de courriers de 
> >> darkba...@linuxsystems.it. D?couvrez pourquoi ceci est important ? 
> >> https://aka.ms/LearnAboutSenderIdentification ]
> >>
> >> Il 2023-05-12 10:32 Bagas Sanjaya ha scritto:
> >>> #regzbot introduced: f4f3b7dedbe849
> >>> #regzbot link: https://gitlab.freedesktop.org/drm/amd/-/issues/2553
> >>
> >> It doesn't look like the aforementioned patch made its way into 6.3 yet:
> >>
> >> niko@talos2 ~/devel/linux-stable $ git branch
> >> * linux-6.3.y
> >>    master
> >> niko@talos2 ~/devel/linux-stable $ git show f4f3b7dedbe8 | patch -p1
> >> patching file
> >> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
> >> Hunk #1 succeeded at 227 (offset 15 lines).
> >> Hunk #2 succeeded at 269 with fuzz 2 (offset 19 lines).
> >> patching file
> >> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h
> >> Hunk #1 succeeded at 49 with fuzz 2 (offset 15 lines).
> > 
> > As far as I can see that patch has no Fixes: tag, so it will unlikely be 
> > automatically merged into stable.
> > 
> > Has anybody requested greg/sasha to get it into 6.3 ?
> > 
> 
> In fact, it seems that patch is already part of 6.3:
> 
> $ git tag --contains f4f3b7dedbe8
> v6.3
> v6.3-rc5
> v6.3-rc6
> v6.3-rc7
> v6.3.1
> v6.3.2
> v6.4-rc1

And that commit is already in the following releases:
5.10.177 5.15.106 6.1.23 6.2.10 6.3

So what needs to be done here?

confused,

greg k-h


Re: [PATCH 10/19] cacheinfo: Adjust includes to remove of_device.h

2023-03-29 Thread Greg Kroah-Hartman
On Wed, Mar 29, 2023 at 10:52:07AM -0500, Rob Herring wrote:
> Now that of_cpu_device_node_get() is defined in of.h, of_device.h is just
> implicitly including other includes, and is no longer needed. Update the
> includes to use of.h instead of of_device.h.
> 
> Signed-off-by: Rob Herring 
> ---
> Please ack and I will take the series via the DT tree.
> ---

Acked-by: Greg Kroah-Hartman 


[PATCH] powerpc/fsl: fix compiler warning in fsl_wakeup_sys_init()

2023-03-27 Thread Greg Kroah-Hartman
Commit c93bd175414a ("powerpc/fsl: move to use bus_get_dev_root()")
changed to use bus_get_dev_root() but didn't consider that the function
can fail and return an uninitialized value of ret (hint, the function
can never fail, but the compiler doesn't know that.)

Fix this up by setting ret to -EINVAL just in case something really goes
wrong with the call to bus_get_dev_root().

Cc: Michael Ellerman 
Cc: Nicholas Piggin 
Cc: Christophe Leroy 
Cc: linuxppc-dev@lists.ozlabs.org
Fixes: c93bd175414a ("powerpc/fsl: move to use bus_get_dev_root()")
Reported-by: kernel test robot 
Link: https://lore.kernel.org/oe-kbuild-all/202303280045.4oaaezcn-...@intel.com/
Signed-off-by: Greg Kroah-Hartman 
---
 arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c 
b/arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c
index 147b5d8bb904..ce6c739c51e5 100644
--- a/arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c
+++ b/arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c
@@ -117,7 +117,7 @@ static struct device_attribute mpic_attributes = 
__ATTR(timer_wakeup, 0644,
 static int __init fsl_wakeup_sys_init(void)
 {
struct device *dev_root;
-   int ret;
+   int ret = -EINVAL;
 
fsl_wakeup = kzalloc(sizeof(struct fsl_mpic_timer_wakeup), GFP_KERNEL);
if (!fsl_wakeup)
-- 
2.40.0



[PATCH] driver core: class: mark the struct class for sysfs callbacks as constant

2023-03-25 Thread Greg Kroah-Hartman
struct class should never be modified in a sysfs callback as there is
nothing in the structure to modify, and frankly, the structure is almost
never used in a sysfs callback, so mark it as constant to allow struct
class to be moved to read-only memory.

While we are touching all class sysfs callbacks also mark the attribute
as constant as it can not be modified.  The bonding code still uses this
structure so it can not be removed from the function callbacks.

Cc: "David S. Miller" 
Cc: "Rafael J. Wysocki" 
Cc: Bartosz Golaszewski 
Cc: Eric Dumazet 
Cc: Jakub Kicinski 
Cc: Jens Axboe 
Cc: Johannes Berg 
Cc: Linus Walleij 
Cc: Luis Chamberlain 
Cc: Minchan Kim 
Cc: Miquel Raynal 
Cc: Namjae Jeon 
Cc: Paolo Abeni 
Cc: Russ Weight 
Cc: Sergey Senozhatsky 
Cc: Steve French 
Cc: Vignesh Raghavendra 
Cc: linux-c...@vger.kernel.org
Cc: linux-g...@vger.kernel.org
Cc: linux-...@lists.infradead.org
Cc: linux-r...@vger.kernel.org
Cc: linux-s...@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: net...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 arch/powerpc/platforms/pseries/dlpar.c|  4 ++--
 arch/powerpc/platforms/pseries/mobility.c |  4 ++--
 drivers/base/class.c  |  4 ++--
 drivers/base/devcoredump.c|  4 ++--
 drivers/base/firmware_loader/sysfs.c  |  4 ++--
 drivers/block/pktcdvd.c   |  6 +++---
 drivers/block/zram/zram_drv.c | 11 +--
 drivers/gpio/gpiolib-sysfs.c  |  8 
 drivers/infiniband/core/user_mad.c|  4 ++--
 drivers/mtd/ubi/build.c   |  2 +-
 drivers/net/bonding/bond_sysfs.c  | 18 +-
 drivers/s390/crypto/zcrypt_api.c  |  8 
 fs/ksmbd/server.c | 10 +-
 include/linux/device/class.h  |  9 +
 14 files changed, 48 insertions(+), 48 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/dlpar.c 
b/arch/powerpc/platforms/pseries/dlpar.c
index 75ffdbcd2865..719c97a155ed 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -512,7 +512,7 @@ static int dlpar_parse_id_type(char **cmd, struct 
pseries_hp_errorlog *hp_elog)
return 0;
 }
 
-static ssize_t dlpar_store(struct class *class, struct class_attribute *attr,
+static ssize_t dlpar_store(const struct class *class, const struct 
class_attribute *attr,
   const char *buf, size_t count)
 {
struct pseries_hp_errorlog hp_elog;
@@ -551,7 +551,7 @@ static ssize_t dlpar_store(struct class *class, struct 
class_attribute *attr,
return rc ? rc : count;
 }
 
-static ssize_t dlpar_show(struct class *class, struct class_attribute *attr,
+static ssize_t dlpar_show(const struct class *class, const struct 
class_attribute *attr,
  char *buf)
 {
return sprintf(buf, "%s\n", "memory,cpu");
diff --git a/arch/powerpc/platforms/pseries/mobility.c 
b/arch/powerpc/platforms/pseries/mobility.c
index 643d309d1bd0..6b25642adfa0 100644
--- a/arch/powerpc/platforms/pseries/mobility.c
+++ b/arch/powerpc/platforms/pseries/mobility.c
@@ -787,8 +787,8 @@ int rtas_syscall_dispatch_ibm_suspend_me(u64 handle)
return pseries_migrate_partition(handle);
 }
 
-static ssize_t migration_store(struct class *class,
-  struct class_attribute *attr, const char *buf,
+static ssize_t migration_store(const struct class *class,
+  const struct class_attribute *attr, const char 
*buf,
   size_t count)
 {
u64 streamid;
diff --git a/drivers/base/class.c b/drivers/base/class.c
index 41a6a10da8dd..ecbf8b5b0dff 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -483,8 +483,8 @@ void class_interface_unregister(struct class_interface 
*class_intf)
 }
 EXPORT_SYMBOL_GPL(class_interface_unregister);
 
-ssize_t show_class_attr_string(struct class *class,
-  struct class_attribute *attr, char *buf)
+ssize_t show_class_attr_string(const struct class *class,
+  const struct class_attribute *attr, char *buf)
 {
struct class_attribute_string *cs;
 
diff --git a/drivers/base/devcoredump.c b/drivers/base/devcoredump.c
index 59aaf2e1375a..91536ee05f14 100644
--- a/drivers/base/devcoredump.c
+++ b/drivers/base/devcoredump.c
@@ -167,7 +167,7 @@ static int devcd_free(struct device *dev, void *data)
return 0;
 }
 
-static ssize_t disabled_show(struct class *class, struct class_attribute *attr,
+static ssize_t disabled_show(const struct class *class, const struct 
class_attribute *attr,
 char *buf)
 {
return sysfs_emit(buf, "%d\n", devcd_disabled);
@@ -197,7 +197,7 @@ static ssize_t disabled_show(struct class *class, struct 
class_attribute *attr,
  * so, above situation would not occur.
  */
 
-static 

[PATCH 15/36] powerpc/fsl: move to use bus_get_dev_root()

2023-03-13 Thread Greg Kroah-Hartman
Direct access to the struct bus_type dev_root pointer is going away soon
so replace that with a call to bus_get_dev_root() instead, which is what
it is there for.

Cc: Michael Ellerman 
Cc: Nicholas Piggin 
Cc: Christophe Leroy 
Cc: Greg Kroah-Hartman 
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Greg Kroah-Hartman 
---
Note, this is a patch that is a prepatory cleanup as part of a larger
series of patches that is working on resolving some old driver core
design mistakes.  It will build and apply cleanly on top of 6.3-rc2 on
its own, but I'd prefer if I could take it through my driver-core tree
so that the driver core changes can be taken through there for 6.4-rc1.

 arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c 
b/arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c
index c2baa283e624..147b5d8bb904 100644
--- a/arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c
+++ b/arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c
@@ -116,6 +116,7 @@ static struct device_attribute mpic_attributes = 
__ATTR(timer_wakeup, 0644,
 
 static int __init fsl_wakeup_sys_init(void)
 {
+   struct device *dev_root;
int ret;
 
fsl_wakeup = kzalloc(sizeof(struct fsl_mpic_timer_wakeup), GFP_KERNEL);
@@ -124,16 +125,26 @@ static int __init fsl_wakeup_sys_init(void)
 
INIT_WORK(&fsl_wakeup->free_work, fsl_free_resource);
 
-   ret = device_create_file(mpic_subsys.dev_root, &mpic_attributes);
-   if (ret)
-   kfree(fsl_wakeup);
+   dev_root = bus_get_dev_root(&mpic_subsys);
+   if (dev_root) {
+   ret = device_create_file(dev_root, &mpic_attributes);
+   put_device(dev_root);
+   if (ret)
+   kfree(fsl_wakeup);
+   }
 
return ret;
 }
 
 static void __exit fsl_wakeup_sys_exit(void)
 {
-   device_remove_file(mpic_subsys.dev_root, &mpic_attributes);
+   struct device *dev_root;
+
+   dev_root = bus_get_dev_root(&mpic_subsys);
+   if (dev_root) {
+   device_remove_file(dev_root, &mpic_attributes);
+   put_device(dev_root);
+   }
 
mutex_lock(&sysfs_lock);
 
-- 
2.39.2



[PATCH 13/36] powerpc/powernv: move to use bus_get_dev_root()

2023-03-13 Thread Greg Kroah-Hartman
Direct access to the struct bus_type dev_root pointer is going away soon
so replace that with a call to bus_get_dev_root() instead, which is what
it is there for.

Cc: Michael Ellerman 
Cc: Nicholas Piggin 
Cc: Christophe Leroy 
Cc: Wolfram Sang 
Cc: Joel Stanley 
Cc: Liang He 
Cc: Greg Kroah-Hartman 
Cc: Julia Lawall 
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Greg Kroah-Hartman 
---
Note, this is a patch that is a prepatory cleanup as part of a larger
series of patches that is working on resolving some old driver core
design mistakes.  It will build and apply cleanly on top of 6.3-rc2 on
its own, but I'd prefer if I could take it through my driver-core tree
so that the driver core changes can be taken through there for 6.4-rc1.

 arch/powerpc/platforms/powernv/idle.c|  9 +++--
 arch/powerpc/platforms/powernv/subcore.c | 10 --
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/idle.c 
b/arch/powerpc/platforms/powernv/idle.c
index 841cb7f31f4f..6dfe8d611164 100644
--- a/arch/powerpc/platforms/powernv/idle.c
+++ b/arch/powerpc/platforms/powernv/idle.c
@@ -1464,14 +1464,19 @@ static int __init pnv_init_idle_states(void)
power7_fastsleep_workaround_entry = false;
power7_fastsleep_workaround_exit = false;
} else {
+   struct device *dev_root;
/*
 * OPAL_PM_SLEEP_ENABLED_ER1 is set. It indicates that
 * workaround is needed to use fastsleep. Provide sysfs
 * control to choose how this workaround has to be
 * applied.
 */
-   device_create_file(cpu_subsys.dev_root,
-   &dev_attr_fastsleep_workaround_applyonce);
+   dev_root = bus_get_dev_root(&cpu_subsys);
+   if (dev_root) {
+   device_create_file(dev_root,
+  
&dev_attr_fastsleep_workaround_applyonce);
+   put_device(dev_root);
+   }
}
 
update_subcore_sibling_mask();
diff --git a/arch/powerpc/platforms/powernv/subcore.c 
b/arch/powerpc/platforms/powernv/subcore.c
index 7e98b00ea2e8..428532a69762 100644
--- a/arch/powerpc/platforms/powernv/subcore.c
+++ b/arch/powerpc/platforms/powernv/subcore.c
@@ -415,7 +415,9 @@ static DEVICE_ATTR(subcores_per_core, 0644,
 
 static int subcore_init(void)
 {
+   struct device *dev_root;
unsigned pvr_ver;
+   int rc = 0;
 
pvr_ver = PVR_VER(mfspr(SPRN_PVR));
 
@@ -435,7 +437,11 @@ static int subcore_init(void)
 
set_subcores_per_core(1);
 
-   return device_create_file(cpu_subsys.dev_root,
- &dev_attr_subcores_per_core);
+   dev_root = bus_get_dev_root(&cpu_subsys);
+   if (dev_root) {
+   rc = device_create_file(dev_root, &dev_attr_subcores_per_core);
+   put_device(dev_root);
+   }
+   return rc;
 }
 machine_device_initcall(powernv, subcore_init);
-- 
2.39.2



[PATCH 14/36] powerpc/pseries: move to use bus_get_dev_root()

2023-03-13 Thread Greg Kroah-Hartman
Direct access to the struct bus_type dev_root pointer is going away soon
so replace that with a call to bus_get_dev_root() instead, which is what
it is there for.

Cc: Michael Ellerman 
Cc: Nicholas Piggin 
Cc: Christophe Leroy 
Cc: Greg Kroah-Hartman 
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Greg Kroah-Hartman 
---
Note, this is a patch that is a prepatory cleanup as part of a larger
series of patches that is working on resolving some old driver core
design mistakes.  It will build and apply cleanly on top of 6.3-rc2 on
its own, but I'd prefer if I could take it through my driver-core tree
so that the driver core changes can be taken through there for 6.4-rc1.

 .../platforms/pseries/pseries_energy.c| 28 +++
 arch/powerpc/platforms/pseries/suspend.c  | 10 +--
 2 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/pseries_energy.c 
b/arch/powerpc/platforms/pseries/pseries_energy.c
index 09e98d301db0..2c661b798235 100644
--- a/arch/powerpc/platforms/pseries/pseries_energy.c
+++ b/arch/powerpc/platforms/pseries/pseries_energy.c
@@ -300,20 +300,22 @@ static struct device_attribute 
attr_percpu_deactivate_hint =
 static int __init pseries_energy_init(void)
 {
int cpu, err;
-   struct device *cpu_dev;
+   struct device *cpu_dev, *dev_root;
 
if (!firmware_has_feature(FW_FEATURE_BEST_ENERGY))
return 0; /* H_BEST_ENERGY hcall not supported */
 
/* Create the sysfs files */
-   err = device_create_file(cpu_subsys.dev_root,
-   &attr_cpu_activate_hint_list);
-   if (!err)
-   err = device_create_file(cpu_subsys.dev_root,
-   &attr_cpu_deactivate_hint_list);
+   dev_root = bus_get_dev_root(&cpu_subsys);
+   if (dev_root) {
+   err = device_create_file(dev_root, 
&attr_cpu_activate_hint_list);
+   if (!err)
+   err = device_create_file(dev_root, 
&attr_cpu_deactivate_hint_list);
+   put_device(dev_root);
+   if (err)
+   return err;
+   }
 
-   if (err)
-   return err;
for_each_possible_cpu(cpu) {
cpu_dev = get_cpu_device(cpu);
err = device_create_file(cpu_dev,
@@ -337,14 +339,18 @@ static int __init pseries_energy_init(void)
 static void __exit pseries_energy_cleanup(void)
 {
int cpu;
-   struct device *cpu_dev;
+   struct device *cpu_dev, *dev_root;
 
if (!sysfs_entries)
return;
 
/* Remove the sysfs files */
-   device_remove_file(cpu_subsys.dev_root, &attr_cpu_activate_hint_list);
-   device_remove_file(cpu_subsys.dev_root, &attr_cpu_deactivate_hint_list);
+   dev_root = bus_get_dev_root(&cpu_subsys);
+   if (dev_root) {
+   device_remove_file(dev_root, &attr_cpu_activate_hint_list);
+   device_remove_file(dev_root, &attr_cpu_deactivate_hint_list);
+   put_device(dev_root);
+   }
 
for_each_possible_cpu(cpu) {
cpu_dev = get_cpu_device(cpu);
diff --git a/arch/powerpc/platforms/pseries/suspend.c 
b/arch/powerpc/platforms/pseries/suspend.c
index 1b902cbf85c5..5c43435472cc 100644
--- a/arch/powerpc/platforms/pseries/suspend.c
+++ b/arch/powerpc/platforms/pseries/suspend.c
@@ -143,6 +143,7 @@ static const struct platform_suspend_ops 
pseries_suspend_ops = {
  **/
 static int pseries_suspend_sysfs_register(struct device *dev)
 {
+   struct device *dev_root;
int rc;
 
if ((rc = subsys_system_register(&suspend_subsys, NULL)))
@@ -151,8 +152,13 @@ static int pseries_suspend_sysfs_register(struct device 
*dev)
dev->id = 0;
dev->bus = &suspend_subsys;
 
-   if ((rc = device_create_file(suspend_subsys.dev_root, 
&dev_attr_hibernate)))
-   goto subsys_unregister;
+   dev_root = bus_get_dev_root(&suspend_subsys);
+   if (dev_root) {
+   rc = device_create_file(dev_root, &dev_attr_hibernate);
+   put_device(dev_root);
+   if (rc)
+   goto subsys_unregister;
+   }
 
return 0;
 
-- 
2.39.2



[PATCH 12/36] powerpc/sysfs: move to use bus_get_dev_root()

2023-03-13 Thread Greg Kroah-Hartman
Direct access to the struct bus_type dev_root pointer is going away soon
so replace that with a call to bus_get_dev_root() instead, which is what
it is there for.

Cc: Michael Ellerman 
Cc: Nicholas Piggin 
Cc: Christophe Leroy 
Cc: David Hildenbrand 
Cc: Andrew Morton 
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Greg Kroah-Hartman 
---
Note, this is a patch that is a prepatory cleanup as part of a larger
series of patches that is working on resolving some old driver core
design mistakes.  It will build and apply cleanly on top of 6.3-rc2 on
its own, but I'd prefer if I could take it through my driver-core tree
so that the driver core changes can be taken through there for 6.4-rc1.

 arch/powerpc/kernel/sysfs.c | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index ef9a61718940..0f39a6b84132 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -217,13 +217,18 @@ static DEVICE_ATTR(dscr_default, 0600,
 static void __init sysfs_create_dscr_default(void)
 {
if (cpu_has_feature(CPU_FTR_DSCR)) {
+   struct device *dev_root;
int cpu;
 
dscr_default = spr_default_dscr;
for_each_possible_cpu(cpu)
paca_ptrs[cpu]->dscr_default = dscr_default;
 
-   device_create_file(cpu_subsys.dev_root, &dev_attr_dscr_default);
+   dev_root = bus_get_dev_root(&cpu_subsys);
+   if (dev_root) {
+   device_create_file(dev_root, &dev_attr_dscr_default);
+   put_device(dev_root);
+   }
}
 }
 #endif /* CONFIG_PPC64 */
@@ -746,7 +751,12 @@ static DEVICE_ATTR(svm, 0444, show_svm, NULL);
 
 static void __init create_svm_file(void)
 {
-   device_create_file(cpu_subsys.dev_root, &dev_attr_svm);
+   struct device *dev_root = bus_get_dev_root(&cpu_subsys);
+
+   if (dev_root) {
+   device_create_file(dev_root, &dev_attr_svm);
+   put_device(dev_root);
+   }
 }
 #else
 static void __init create_svm_file(void)
-- 
2.39.2



[PATCH 6.1 400/885] perf tests stat_all_metrics: Change true workload to sleep workload for system wide check

2023-03-07 Thread Greg Kroah-Hartman
From: Kajol Jain 

[ Upstream commit f9fa0778ee7349a9aa3d2ea10e9f2ab843a0b44e ]

Testcase stat_all_metrics.sh fails in powerpc:

98: perf all metrics test : FAILED!

Logs with verbose:

  [command]# ./perf test 98 -vv
   98: perf all metrics test   :
   --- start ---
  test child forked, pid 13262
  Testing BRU_STALL_CPI
  Testing COMPLETION_STALL_CPI
   
  Testing TOTAL_LOCAL_NODE_PUMPS_P23
  Metric 'TOTAL_LOCAL_NODE_PUMPS_P23' not printed in:
  Error:
  Invalid event (hv_24x7/PM_PB_LNS_PUMP23,chip=3/) in per-thread mode, enable 
system wide with '-a'.
  Testing TOTAL_LOCAL_NODE_PUMPS_RETRIES_P01
  Metric 'TOTAL_LOCAL_NODE_PUMPS_RETRIES_P01' not printed in:
  Error:
  Invalid event (hv_24x7/PM_PB_RTY_LNS_PUMP01,chip=3/) in per-thread mode, 
enable system wide with '-a'.
   

Based on above logs, we could see some of the hv-24x7 metric events
fails, and logs suggest to run the metric event with -a option.  This
change happened after the commit a4b8cfcabb1d90ec ("perf stat: Delay
metric parsing"), which delayed the metric parsing phase and now before
metric parsing phase perf tool identifies, whether target is system-wide
or not. With this change, perf_event_open will fails with workload
monitoring for uncore events as expected.

The perf all metric test case fails as some of the hv-24x7 metric events
may need bigger workload with system wide monitoring to get the data.
Fix this issue by changing current system wide check from true workload
to sleep 0.01 workload.

Result with the patch changes in powerpc:

  98: perf all metrics test : Ok

Fixes: a4b8cfcabb1d90ec ("perf stat: Delay metric parsing")
Suggested-by: Ian Rogers 
Reviewed-by: Athira Rajeev 
Signed-off-by: Kajol Jain 
Tested-by: Disha Goel 
Tested-by: Ian Rogers 
Cc: Madhavan Srinivasan 
Cc: Nageswara R Sastry 
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20230215093827.124921-1-kj...@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Sasha Levin 
---
 tools/perf/tests/shell/stat_all_metrics.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/tests/shell/stat_all_metrics.sh 
b/tools/perf/tests/shell/stat_all_metrics.sh
index 6e79349e42bef..22e9cb294b40e 100755
--- a/tools/perf/tests/shell/stat_all_metrics.sh
+++ b/tools/perf/tests/shell/stat_all_metrics.sh
@@ -11,7 +11,7 @@ for m in $(perf list --raw-dump metrics); do
 continue
   fi
   # Failed so try system wide.
-  result=$(perf stat -M "$m" -a true 2>&1)
+  result=$(perf stat -M "$m" -a sleep 0.01 2>&1)
   if [[ "$result" =~ "${m:0:50}" ]]
   then
 continue
-- 
2.39.2





[PATCH 6.1 392/885] perf test bpf: Skip test if kernel-debuginfo is not present

2023-03-07 Thread Greg Kroah-Hartman
From: Athira Rajeev 

[ Upstream commit 34266f904abd45731bdade2e92d0536c092ee9bc ]

Perf BPF filter test fails in environment where "kernel-debuginfo"
is not installed.

Test failure logs:

  <<>>
  42: BPF filter:
  42.1: Basic BPF filtering : Ok
  42.2: BPF pinning : Ok
  42.3: BPF prologue generation : FAILED!
  <<>>

Enabling verbose option provided debug logs, which says debuginfo
needs to be installed. Snippet of verbose logs:

  <<>>
  42.3: BPF prologue generation   :
  --- start ---
  test child forked, pid 28218
  <<>>
  Rebuild with CONFIG_DEBUG_INFO=y, or install an appropriate debuginfo
  package.
  bpf_probe: failed to convert perf probe events
  Failed to add events selected by BPF
  test child finished with -1
   end 
  BPF filter subtest 3: FAILED!
  <<>>

Here the subtest "BPF prologue generation" failed and logs shows
debuginfo is needed. After installing kernel-debuginfo package, testcase
passes.

The "BPF prologue generation" subtest failed because, the do_test()
returns TEST_FAIL without checking the error type returned by
parse_events_load_bpf_obj().

parse_events_load_bpf_obj() can also return error of type -ENODATA
incase kernel-debuginfo package is not installed. Fix this by adding
check for -ENODATA error.

Test result after the patch changes:

Test failure logs:

  <<>>
  42: BPF filter :
  42.1: Basic BPF filtering  : Ok
  42.2: BPF pinning  : Ok
  42.3: BPF prologue generation  : Skip (clang/debuginfo isn't installed or 
environment missing BPF support)
  <<>>

Fixes: ba1fae431e74bb42 ("perf test: Add 'perf test BPF'")
Signed-off-by: Athira Rajeev 
Cc: Andi Kleen 
Cc: Disha Goel 
Cc: Ian Rogers 
Cc: James Clark 
Cc: Jiri Olsa 
Cc: Kajol Jain 
Cc: Madhavan Srinivasan 
Cc: Michael Ellerman 
Cc: Nageswara R Sastry 
Cc: Namhyung Kim 
Cc: Wang Nan 
Cc: linuxppc-dev@lists.ozlabs.org
Link: http://lore.kernel.org/linux-perf-users/y7bik77mde4j8...@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Sasha Levin 
---
 tools/perf/tests/bpf.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/perf/tests/bpf.c b/tools/perf/tests/bpf.c
index 17c023823713d..6a4235a9cf57e 100644
--- a/tools/perf/tests/bpf.c
+++ b/tools/perf/tests/bpf.c
@@ -126,6 +126,10 @@ static int do_test(struct bpf_object *obj, int 
(*func)(void),
 
err = parse_events_load_bpf_obj(&parse_state, &parse_state.list, obj, 
NULL);
parse_events_error__exit(&parse_error);
+   if (err == -ENODATA) {
+   pr_debug("Failed to add events selected by BPF, debuginfo 
package not installed\n");
+   return TEST_SKIP;
+   }
if (err || list_empty(&parse_state.list)) {
pr_debug("Failed to add events selected by BPF\n");
return TEST_FAIL;
@@ -368,7 +372,7 @@ static struct test_case bpf_tests[] = {
"clang isn't installed or environment missing BPF 
support"),
 #ifdef HAVE_BPF_PROLOGUE
TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test,
-   "clang isn't installed or environment missing BPF 
support"),
+   "clang/debuginfo isn't installed or environment missing 
BPF support"),
 #else
TEST_CASE_REASON("BPF prologue generation", bpf_prologue_test, "not 
compiled in"),
 #endif
-- 
2.39.2





  1   2   3   4   5   6   >