Re: [PATCH] KVM: fix repeated words in comments

2022-08-30 Thread Paul Mackerras
On Wed, Aug 31, 2022 at 08:44:54AM +0800, Jilin Yuan wrote:
> Delete the redundant word 'that'.

Nack, having two "that"s in a row is intentional.  It's "make sure
that" (i.e. bring about the situation described in what follows)
"that many HPTEs" (i.e. the number of HPTEs referenced previously)
"are invalid".

> Signed-off-by: Jilin Yuan 
> ---
>  arch/powerpc/kvm/book3s_64_mmu_hv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c 
> b/arch/powerpc/kvm/book3s_64_mmu_hv.c
> index e9744b41a226..8e4b42b5f37f 100644
> --- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
> +++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
> @@ -1601,7 +1601,7 @@ long kvm_vm_ioctl_resize_hpt_commit(struct kvm *kvm,
>   * is valid, it is written to the HPT as if an H_ENTER with the
>   * exact flag set was done.  When the invalid count is non-zero
>   * in the header written to the stream, the kernel will make
> - * sure that that many HPTEs are invalid, and invalidate them
> + * sure that many HPTEs are invalid, and invalidate them
>   * if not.
>   */

Paul.


Re: [PATCH v2 02/16] powerpc: override __ALIGN() and __ALIGN_STR() macros

2022-08-30 Thread Nicholas Piggin
On Mon Aug 29, 2022 at 3:52 PM AEST, Sathvika Vasireddy wrote:
> Powerpc instructions must be word-aligned. Currently,
> there is an alignment of 16 bytes (by default), and it is
> much more than what is required for powerpc (4 bytes).
>
> The default expansion of __ALIGN() macro is:
> #define __ALIGN   .align 4,0x90
>
> Since Powerpc Linux does not require a 16 byte alignment,
> override __ALIGN() and __ALIGN_STR() macros to use required
> 4 byte alignment.

Alignment can be desirable beyond the minimum requirement, for
example 16 byte alignment for functions could be helpful for
instruction fetch. So it should be explained why possible
benefits of the larger alignment are not worth it.

And if you have the patch in a series, it should be explained
why the patch is required for the series if it is not obvious.

Thanks,
Nick

>
> Signed-off-by: Sathvika Vasireddy 
> ---
>  arch/powerpc/include/asm/linkage.h | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/arch/powerpc/include/asm/linkage.h 
> b/arch/powerpc/include/asm/linkage.h
> index b71b9582e754..8df88fe61438 100644
> --- a/arch/powerpc/include/asm/linkage.h
> +++ b/arch/powerpc/include/asm/linkage.h
> @@ -2,8 +2,12 @@
>  #ifndef _ASM_POWERPC_LINKAGE_H
>  #define _ASM_POWERPC_LINKAGE_H
>  
> +#include 
>  #include 
>  
> +#define __ALIGN  .align 2
> +#define __ALIGN_STR  __stringify(__ALIGN)
> +
>  #ifdef CONFIG_PPC64_ELF_ABI_V1
>  #define cond_syscall(x) \
>   asm ("\t.weak " #x "\n\t.set " #x ", sys_ni_syscall\n"  \
> -- 
> 2.31.1



[PATCH] powerpc/xive: fix repeated words in comments

2022-08-30 Thread Jilin Yuan
Delete the redundant word 'set'.

Signed-off-by: Jilin Yuan 
---
 arch/powerpc/sysdev/xive/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/sysdev/xive/common.c 
b/arch/powerpc/sysdev/xive/common.c
index 61b9f98dfd4a..a289cb97c1d7 100644
--- a/arch/powerpc/sysdev/xive/common.c
+++ b/arch/powerpc/sysdev/xive/common.c
@@ -783,7 +783,7 @@ static int xive_irq_set_type(struct irq_data *d, unsigned 
int flow_type)
 * the corresponding descriptor bits mind you but those will in turn
 * affect the resend function when re-enabling an edge interrupt.
 *
-* Set set the default to edge as explained in map().
+* Set the default to edge as explained in map().
 */
if (flow_type == IRQ_TYPE_DEFAULT || flow_type == IRQ_TYPE_NONE)
flow_type = IRQ_TYPE_EDGE_RISING;
-- 
2.36.1



[PATCH] powerpc/mobility: fix repeated words in comments

2022-08-30 Thread Jilin Yuan
Delete the redundant word 'the'.

Signed-off-by: Jilin Yuan 
---
 arch/powerpc/platforms/pseries/mobility.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/mobility.c 
b/arch/powerpc/platforms/pseries/mobility.c
index 3d36a8955eaf..c92c78332303 100644
--- a/arch/powerpc/platforms/pseries/mobility.c
+++ b/arch/powerpc/platforms/pseries/mobility.c
@@ -216,7 +216,7 @@ static int update_dt_node(struct device_node *dn, s32 scope)
nprops = be32_to_cpu(upwa->nprops);
 
/* On the first call to ibm,update-properties for a node the
-* the first property value descriptor contains an empty
+* first property value descriptor contains an empty
 * property name, the property value length encoded as u32,
 * and the property value is the node path being updated.
 */
-- 
2.36.1



[PATCH] powerpc/vas: fix repeated words in comments

2022-08-30 Thread Jilin Yuan
Delete the redundant word 'the'.

Signed-off-by: Jilin Yuan 
---
 arch/powerpc/platforms/book3s/vas-api.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/book3s/vas-api.c 
b/arch/powerpc/platforms/book3s/vas-api.c
index c0799fb26b6d..40f5ae5e1238 100644
--- a/arch/powerpc/platforms/book3s/vas-api.c
+++ b/arch/powerpc/platforms/book3s/vas-api.c
@@ -431,7 +431,7 @@ static vm_fault_t vas_mmap_fault(struct vm_fault *vmf)
 * The window may be inactive due to lost credit (Ex: core
 * removal with DLPAR). If the window is active again when
 * the credit is available, map the new paste address at the
-* the window virtual address.
+* window virtual address.
 */
if (txwin->status == VAS_WIN_ACTIVE) {
paste_addr = cp_inst->coproc->vops->paste_addr(txwin);
-- 
2.36.1



[PATCH] KVM: fix repeated words in comments

2022-08-30 Thread Jilin Yuan
Delete the redundant word 'that'.

Signed-off-by: Jilin Yuan 
---
 arch/powerpc/kvm/book3s_64_mmu_hv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c 
b/arch/powerpc/kvm/book3s_64_mmu_hv.c
index e9744b41a226..8e4b42b5f37f 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
@@ -1601,7 +1601,7 @@ long kvm_vm_ioctl_resize_hpt_commit(struct kvm *kvm,
  * is valid, it is written to the HPT as if an H_ENTER with the
  * exact flag set was done.  When the invalid count is non-zero
  * in the header written to the stream, the kernel will make
- * sure that that many HPTEs are invalid, and invalidate them
+ * sure that many HPTEs are invalid, and invalidate them
  * if not.
  */
 
-- 
2.36.1



[PATCH v2 3/3] powerpc: dts: turris1x.dts: Set lower priority for CPLD syscon-reboot

2022-08-30 Thread Pali Rohár
Due to CPLD firmware bugs, set CPLD syscon-reboot priority level to 64
(between rstcr and watchdog) to ensure that rstcr's global-utilities reset
method which is preferred stay as default one, and to ensure that CPLD
syscon-reboot is more preferred than watchdog reset method.

Fixes: 0531a4abd1c6 ("powerpc: dts: turris1x.dts: Add CPLD reboot node")
Signed-off-by: Pali Rohár 
---
 arch/powerpc/boot/dts/turris1x.dts | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/arch/powerpc/boot/dts/turris1x.dts 
b/arch/powerpc/boot/dts/turris1x.dts
index 69c38ed8a3a5..c189293d5a1e 100644
--- a/arch/powerpc/boot/dts/turris1x.dts
+++ b/arch/powerpc/boot/dts/turris1x.dts
@@ -353,11 +353,34 @@
};
 
reboot@d {
+   /*
+* CPLD firmware which manages system reset and
+* watchdog registers has bugs. It does not
+* autoclear system reset register after change
+* and watchdog ignores reset line on immediate
+* succeeding reset cycle triggered by watchdog.
+* These bugs have to be workarounded in U-Boot
+* bootloader. So use system reset via syscon as
+* a last resort because older U-Boot versions
+* do not have workaround for watchdog.
+*
+* Reset method via rstcr's global-utilities
+* (the preferred one) has priority level 128,
+* watchdog has priority level 0 and default
+* syscon-reboot priority level is 192.
+*
+* So define syscon-reboot with custom priority
+* level 64 (between rstcr and watchdog) because
+* rstcr should stay as default preferred reset
+* method and reset via watchdog is more broken
+* than system reset via syscon.
+*/
compatible = "syscon-reboot";
reg = <0x0d 0x01>;
offset = <0x0d>;
mask = <0x01>;
value = <0x01>;
+   priority = <64>;
};
 
led-controller@13 {
-- 
2.20.1



[PATCH v2 2/3] power: reset: syscon-reboot: Add support for specifying priority

2022-08-30 Thread Pali Rohár
Read new optional device tree property priority for specifying priority
level of reset handler. Default value is 192 as before.

Signed-off-by: Pali Rohár 
---
 drivers/power/reset/syscon-reboot.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/power/reset/syscon-reboot.c 
b/drivers/power/reset/syscon-reboot.c
index 510e363381ca..45e34e6885f7 100644
--- a/drivers/power/reset/syscon-reboot.c
+++ b/drivers/power/reset/syscon-reboot.c
@@ -44,6 +44,7 @@ static int syscon_reboot_probe(struct platform_device *pdev)
struct syscon_reboot_context *ctx;
struct device *dev = &pdev->dev;
int mask_err, value_err;
+   int priority;
int err;
 
ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
@@ -57,6 +58,9 @@ static int syscon_reboot_probe(struct platform_device *pdev)
return PTR_ERR(ctx->map);
}
 
+   if (of_property_read_s32(pdev->dev.of_node, "priority", &priority))
+   priority = 192;
+
if (of_property_read_u32(pdev->dev.of_node, "offset", &ctx->offset))
return -EINVAL;
 
@@ -77,7 +81,7 @@ static int syscon_reboot_probe(struct platform_device *pdev)
}
 
ctx->restart_handler.notifier_call = syscon_restart_handle;
-   ctx->restart_handler.priority = 192;
+   ctx->restart_handler.priority = priority;
err = register_restart_handler(&ctx->restart_handler);
if (err)
dev_err(dev, "can't register restart notifier (err=%d)\n", err);
-- 
2.20.1



[PATCH v2 1/3] dt-bindings: reset: syscon-reboot: Add priority property

2022-08-30 Thread Pali Rohár
This new optional priority property allows to specify custom priority level
of reset device. Default level was always 192.

Signed-off-by: Pali Rohár 

---
Changes in v2:
* Change sint32 to int32
* Add default
---
 .../devicetree/bindings/power/reset/syscon-reboot.yaml   | 5 +
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml 
b/Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml
index da2509724812..4c8b0d0a0111 100644
--- a/Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml
+++ b/Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml
@@ -42,6 +42,11 @@ properties:
 $ref: /schemas/types.yaml#/definitions/uint32
 description: The reset value written to the reboot register (32 bit 
access).
 
+  priority:
+$ref: /schemas/types.yaml#/definitions/int32
+description: Priority level of this syscon reset device.
+default: 192
+
 required:
   - compatible
   - offset
-- 
2.20.1



[PATCH] powerpc: dts: turris1x.dts: Fix NOR partitions labels

2022-08-30 Thread Pali Rohár
Partition partition@2 contains generic kernel image and it does not
have to be used only for rescue purposes. Partition partition@1c
contains bootable rescue system and partition partition@34 contains
factory image/data for restoring to NAND. So change partition labels to
better fit their purpose by removing possible misleading substring "rootfs"
from these labels.

Fixes: 54c15ec3b738 ("powerpc: dts: Add DTS file for CZ.NIC Turris 1.x routers")
Signed-off-by: Pali Rohár 
---
 arch/powerpc/boot/dts/turris1x.dts | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/boot/dts/turris1x.dts 
b/arch/powerpc/boot/dts/turris1x.dts
index b7635f0b87a9..64c0dd733e40 100644
--- a/arch/powerpc/boot/dts/turris1x.dts
+++ b/arch/powerpc/boot/dts/turris1x.dts
@@ -263,21 +263,21 @@
};
 
partition@2 {
-   /* 1.7 MB for Rescue Linux Kernel Image 
*/
+   /* 1.7 MB for Linux Kernel Image */
reg = <0x0002 0x001a>;
-   label = "rescue-kernel";
+   label = "kernel";
};
 
partition@1c {
/* 1.5 MB for Rescue JFFS2 Root File 
System */
reg = <0x001c 0x0018>;
-   label = "rescue-rootfs";
+   label = "rescue";
};
 
partition@34 {
-   /* 11 MB for TAR.XZ Backup with content 
of NAND Root File System */
+   /* 11 MB for TAR.XZ Archive with 
Factory content of NAND Root File System */
reg = <0x0034 0x00b0>;
-   label = "backup-rootfs";
+   label = "factory";
};
 
partition@e4 {
-- 
2.20.1



Re: [PATCH] net: move from strlcpy with unused retval to strscpy

2022-08-30 Thread Wolfram Sang

> Unfortunately looks like patchwork was unable to ingest this change :(
> Not sure why.

vger rejected this mail because the header was too big. I updated my
scripts to estimate that before sending out.

> Would you mind splitting it into 3 chunks - wireless, ethernet,
> everything else, and resending? Let's see if that'll be small enough..

I did this and my scripts estimate that the patches will be small enough
now. Let's see...



signature.asc
Description: PGP signature


Re: [RFC PATCH 2/2] fs/xattr: wire up syscalls

2022-08-30 Thread Christian Brauner
On Tue, Aug 30, 2022 at 05:28:38PM +0200, Christian Göttsche wrote:
> Enable the new added extended attribute related syscalls.
> 
> Signed-off-by: Christian Göttsche 
> ---

Fwiw, I think a while ago it was pointed out that for most syscall
additions you can just fold the hookup patch in. It probably also
wouldn't hurt to trim that Cc list significantly down to mostly the
lists...


Re: [PATCH v4 0/8] phy: Add support for Lynx 10G SerDes

2022-08-30 Thread Sean Anderson



On 8/4/22 6:05 PM, Sean Anderson wrote:
> This adds support for the Lynx 10G SerDes found on the QorIQ T-series
> and Layerscape series. Due to limited time and hardware, only support
> for the LS1046ARDB is added in this initial series. There is a sketch
> for LS1088ARDB support, but it is incomplete.
> 
> Dynamic reconfiguration does not work. That is, the configuration must
> match what is set in the RCW. From my testing, SerDes register settings
> appear identical. The issue appears to be between the PCS and the MAC.
> The link itself comes up at both ends, and a mac loopback succeeds.
> However, a PCS loopback results in dropped packets. Perhaps there is
> some undocumented register in the PCS?
> 
> I suspect this driver is around 95% complete, but unfortunately, I no
> longer have time to investigate this further.
> 
> To facilitate testing, this series was prepared on top of
> next-next/master. I can rebase it onto another branch if that is
> necessary.
> 
> Changes in v4:
> - Add 2500BASE-X and 10GBASE-R phy types
> - Use subnodes to describe lane configuration, instead of describing
>   PCCRs. This is the same style used by phy-cadence-sierra et al.
> - Add ids for Lynx 10g PLLs
> - Rework all debug statements to remove use of __func__. Additional
>   information has been provided as necessary.
> - Consider alternative parent rates in round_rate and not in set_rate.
>   Trying to modify out parent's rate in set_rate will deadlock.
> - Explicitly perform a stop/reset sequence in set_rate. This way we
>   always ensure that the PLL is properly stopped.
> - Set the power-down bit when disabling the PLL. We can do this now that
>   enable/disable aren't abused during the set rate sequence.
> - Fix typos in QSGMII_OFFSET and XFI_OFFSET
> - Rename LNmTECR0_TEQ_TYPE_PRE to LNmTECR0_TEQ_TYPE_POST to better
>   reflect its function (adding post-cursor equalization).
> - Use of_clk_hw_onecell_get instead of a custom function.
> - Return struct clks from lynx_clks_init instead of embedding lynx_clk
>   in lynx_priv.
> - Rework PCCR helper functions; T-series SoCs differ from Layerscape SoCs
>   primarily in the layout and offset of the PCCRs. This will help bring a
>   cleaner abstraction layer. The caps have been removed, since this handles 
> the
>   only current usage.
> - Convert to use new binding format. As a result of this, we no longer need to
>   have protocols for PCIe or SATA. Additionally, modes now live in lynx_group
>   instead of lynx_priv.
> - Remove teq from lynx_proto_params, since it can be determined from
>   preq_ratio/postq_ratio.
> - Fix an early return from lynx_set_mode not releasing serdes->lock.
> - Rename lynx_priv.conf to .cfg, since I kept mistyping it.
> 
> Changes in v3:
> - Manually expand yaml references
> - Add mode configuration to device tree
> - Rename remaining references to QorIQ SerDes to Lynx 10G
> - Fix PLL enable sequence by waiting for our reset request to be cleared
>   before continuing. Do the same for the lock, even though it isn't as
>   critical. Because we will delay for 1.5ms on average, use prepare
>   instead of enable so we can sleep.
> - Document the status of each protocol
> - Fix offset of several bitfields in RECR0
> - Take into account PLLRST_B, SDRST_B, and SDEN when considering whether
>   a PLL is "enabled."
> - Only power off unused lanes.
> - Split mode lane mask into first/last lane (like group)
> - Read modes from device tree
> - Use caps to determine whether KX/KR are supported
> - Move modes to lynx_priv
> - Ensure that the protocol controller is not already in-use when we try
>   to configure a new mode. This should only occur if the device tree is
>   misconfigured (e.g. when QSGMII is selected on two lanes but there is
>   only one QSGMII controller).
> - Split PLL drivers off into their own file
> - Add clock for "ext_dly" instead of writing the bit directly (and
>   racing with any clock code).
> - Use kasprintf instead of open-coding the snprintf dance
> - Support 1000BASE-KX in lynx_lookup_proto. This still requires PCS
>   support, so nothing is truly "enabled" yet.
> - Describe modes in device tree
> - ls1088a: Add serdes bindings
> 
> Changes in v2:
> - Rename to fsl,lynx-10g.yaml
> - Refer to the device in the documentation, rather than the binding
> - Move compatible first
> - Document phy cells in the description
> - Allow a value of 1 for phy-cells. This allows for compatibility with
>   the similar (but according to Ioana Ciornei different enough) lynx-28g
>   binding.
> - Remove minItems
> - Use list for clock-names
> - Fix example binding having too many cells in regs
> - Add #clock-cells. This will allow using assigned-clocks* to configure
>   the PLLs.
> - Document the structure of the compatible strings
> - Rename driver to Lynx 10G (etc.)
> - Fix not clearing group->pll after disabling it
> - Support 1 and 2 phy-cells
> - Power off lanes during probe
> - Clear SGMIIaCR1_PCS_EN during probe
> - Rename LYNX_PROTO_UNKN

Re: [PATCH 2/2] powerpc: remove old code for binutils < 2.25

2022-08-30 Thread Nathan Chancellor
On Tue, Aug 30, 2022 at 02:13:20PM -0700, Nick Desaulniers wrote:
> On Tue, Aug 30, 2022 at 12:10 PM Masahiro Yamada  wrote:
> >
> > The minimum supported version of binutils has been raised to 2.25.1.
> > Drop the old code.
> >
> > PPC is the last user of ld-ifversion. With all the callers removed,
> > the macro definition in scripts/Makefile.compiler can go away.
> >
> > Signed-off-by: Masahiro Yamada 
> > ---
> >
> >  arch/powerpc/Makefile | 21 -
> >  arch/powerpc/lib/Makefile |  8 
> >  scripts/Makefile.compiler |  4 
> >  3 files changed, 33 deletions(-)
> >
> > diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> > index 02742facf895..fb607758eeca 100644
> > --- a/arch/powerpc/Makefile
> > +++ b/arch/powerpc/Makefile
> > @@ -46,13 +46,7 @@ UTS_MACHINE := $(subst $(space),,$(machine-y))
> >  ifdef CONFIG_PPC32
> >  KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
> >  else
> > -ifeq ($(call ld-ifversion, -ge, 22500, y),y)
> > -# Have the linker provide sfpr if possible.
> 
> ^ Perhaps this comment is still relevant and should not yet be
> discarded? Or updated, dropping " if possible".
> 
> Either way:
> Reviewed-by: Nick Desaulniers 

I think we still want this block for ld.lld. Prior to this change,
ld.lld would fail the ld-ifversion check and use crtsavres.o. Now, it
will try to use '--save-restore-funcs', which it doesn't have support
for, breaking the build for at least powernv_defconfig:

ld.lld: error: unknown argument '--save-restore-funcs'

> > -# There is a corresponding test in arch/powerpc/lib/Makefile
> >  KBUILD_LDFLAGS_MODULE += --save-restore-funcs
> > -else
> > -KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
> > -endif
> >  endif
> >
> >  ifdef CONFIG_CPU_LITTLE_ENDIAN
> > @@ -395,8 +389,6 @@ vdso_prepare: prepare0
> > $(build)=arch/powerpc/kernel/vdso 
> > include/generated/vdso64-offsets.h)
> >  endif
> >
> > -archprepare: checkbin
> > -
> >  archheaders:
> > $(Q)$(MAKE) $(build)=arch/powerpc/kernel/syscalls all
> >
> > @@ -411,16 +403,3 @@ else
> > $(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk 
> > '{if ($$2 == "TASK_CANARY") print $$3;}' include/generated/asm-offsets.h))
> >  endif
> >  endif
> > -
> > -PHONY += checkbin
> > -# Check toolchain versions:
> > -# - gcc-4.6 is the minimum kernel-wide version so nothing required.
> > -checkbin:
> > -   @if test "x${CONFIG_LD_IS_LLD}" != "xy" -a \
> > -   "x$(call ld-ifversion, -le, 22400, y)" = "xy" ; then \
> > -   echo -n '*** binutils 2.24 miscompiles weak symbols ' ; \
> > -   echo 'in some circumstances.' ; \
> > -   echo'*** binutils 2.23 do not define the TOC symbol ' ; 
> > \
> > -   echo -n '*** Please use a different binutils version.' ; \
> > -   false ; \
> > -   fi
> > diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
> > index 8560c912186d..5eb3971ccb9c 100644
> > --- a/arch/powerpc/lib/Makefile
> > +++ b/arch/powerpc/lib/Makefile
> > @@ -38,14 +38,6 @@ obj-$(CONFIG_PPC32)  += div64.o copy_32.o crtsavres.o
> >
> >  obj-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o
> >
> > -# See corresponding test in arch/powerpc/Makefile
> > -# 64-bit linker creates .sfpr on demand for final link (vmlinux),
> > -# so it is only needed for modules, and only for older linkers which
> > -# do not support --save-restore-funcs
> > -ifeq ($(call ld-ifversion, -lt, 22500, y),y)
> > -extra-$(CONFIG_PPC64)  += crtsavres.o
> > -endif
> > -
> >  obj-$(CONFIG_PPC_BOOK3S_64) += copyuser_power7.o copypage_power7.o \
> >memcpy_power7.o restart_table.o
> >
> > diff --git a/scripts/Makefile.compiler b/scripts/Makefile.compiler
> > index 94d0d40cddb3..63e7d79dd877 100644
> > --- a/scripts/Makefile.compiler
> > +++ b/scripts/Makefile.compiler
> > @@ -68,7 +68,3 @@ cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) 
> > $(2)000 ] && echo $(3) || e
> >  # ld-option
> >  # Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)
> >  ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3))
> > -
> > -# ld-ifversion
> > -# Usage:  $(call ld-ifversion, -ge, 22252, y)
> > -ld-ifversion = $(shell [ $(CONFIG_LD_VERSION)0 $(1) $(2)0 ] && echo $(3) 
> > || echo $(4))
> > --
> > 2.34.1
> >
> 
> 
> -- 
> Thanks,
> ~Nick Desaulniers


[PATCH] vdso: Improve cmd_vdso_check to check all dynamic relocations

2022-08-30 Thread Fangrui Song
The actual intention is that no dynamic relocation exists. However, some
GNU ld ports produce unneeded R_*_NONE. (If a port is not care enough to
determine the exact .rel[a].dyn size, the trailing zeros become R_*_NONE
relocations. E.g. powerpc64le ld as of 2.38 has the issue with
defconfig.) R_*_NONE are generally no-op in the dynamic loaders. So just
ignore them.

With the change, we can remove ARCH_REL_TYPE_ABS. ARCH_REL_TYPE_ABS is a
bit misnomer as ports may check RELAVETIVE/GLOB_DAT/JUMP_SLOT which are
not called "absolute relocations". (The patch is motivated by the arm64
port missing R_AARCH64_RELATIVE.)

While here, replace "egrep" with "grep" as "egrep" is deprecated in GNU
grep 3.7.

Signed-off-by: Fangrui Song 
---
 arch/arm/vdso/Makefile|  3 ---
 arch/arm64/kernel/vdso/Makefile   |  3 ---
 arch/arm64/kernel/vdso32/Makefile |  3 ---
 arch/csky/kernel/vdso/Makefile|  3 ---
 arch/loongarch/vdso/Makefile  |  3 ---
 arch/mips/vdso/Makefile   |  3 ---
 arch/powerpc/kernel/vdso/Makefile |  1 -
 arch/riscv/kernel/vdso/Makefile   |  3 ---
 arch/s390/kernel/vdso32/Makefile  |  2 --
 arch/s390/kernel/vdso64/Makefile  |  2 --
 arch/x86/entry/vdso/Makefile  |  4 
 lib/vdso/Makefile | 13 -
 12 files changed, 4 insertions(+), 39 deletions(-)

diff --git a/arch/arm/vdso/Makefile b/arch/arm/vdso/Makefile
index 8ca1c9f262a2..5ebd2e6f7d46 100644
--- a/arch/arm/vdso/Makefile
+++ b/arch/arm/vdso/Makefile
@@ -1,8 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
 
-# Absolute relocation type $(ARCH_REL_TYPE_ABS) needs to be defined before
-# the inclusion of generic Makefile.
-ARCH_REL_TYPE_ABS := R_ARM_JUMP_SLOT|R_ARM_GLOB_DAT|R_ARM_ABS32
 include $(srctree)/lib/vdso/Makefile
 
 hostprogs := vdsomunge
diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile
index bafbf78fab77..66dc4f338a86 100644
--- a/arch/arm64/kernel/vdso/Makefile
+++ b/arch/arm64/kernel/vdso/Makefile
@@ -6,9 +6,6 @@
 # Heavily based on the vDSO Makefiles for other archs.
 #
 
-# Absolute relocation type $(ARCH_REL_TYPE_ABS) needs to be defined before
-# the inclusion of generic Makefile.
-ARCH_REL_TYPE_ABS := R_AARCH64_JUMP_SLOT|R_AARCH64_GLOB_DAT|R_AARCH64_ABS64
 include $(srctree)/lib/vdso/Makefile
 
 obj-vdso := vgettimeofday.o note.o sigreturn.o
diff --git a/arch/arm64/kernel/vdso32/Makefile 
b/arch/arm64/kernel/vdso32/Makefile
index 36c8f66cad25..48d713d59ef2 100644
--- a/arch/arm64/kernel/vdso32/Makefile
+++ b/arch/arm64/kernel/vdso32/Makefile
@@ -3,9 +3,6 @@
 # Makefile for vdso32
 #
 
-# Absolute relocation type $(ARCH_REL_TYPE_ABS) needs to be defined before
-# the inclusion of generic Makefile.
-ARCH_REL_TYPE_ABS := R_ARM_JUMP_SLOT|R_ARM_GLOB_DAT|R_ARM_ABS32
 include $(srctree)/lib/vdso/Makefile
 
 # Same as cc-*option, but using CC_COMPAT instead of CC
diff --git a/arch/csky/kernel/vdso/Makefile b/arch/csky/kernel/vdso/Makefile
index 0b6909f10667..86c8c4de1b0f 100644
--- a/arch/csky/kernel/vdso/Makefile
+++ b/arch/csky/kernel/vdso/Makefile
@@ -1,8 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
-# Absolute relocation type $(ARCH_REL_TYPE_ABS) needs to be defined before
-# the inclusion of generic Makefile.
-ARCH_REL_TYPE_ABS := R_CKCORE_ADDR32|R_CKCORE_JUMP_SLOT
 include $(srctree)/lib/vdso/Makefile
 
 # Symbols present in the vdso
diff --git a/arch/loongarch/vdso/Makefile b/arch/loongarch/vdso/Makefile
index d89e2ac75f7b..1b2e0f149f55 100644
--- a/arch/loongarch/vdso/Makefile
+++ b/arch/loongarch/vdso/Makefile
@@ -1,9 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 # Objects to go into the VDSO.
 
-# Absolute relocation type $(ARCH_REL_TYPE_ABS) needs to be defined before
-# the inclusion of generic Makefile.
-ARCH_REL_TYPE_ABS := R_LARCH_32|R_LARCH_64|R_LARCH_MARK_LA|R_LARCH_JUMP_SLOT
 include $(srctree)/lib/vdso/Makefile
 
 obj-vdso-y := elf.o vgetcpu.o vgettimeofday.o sigreturn.o
diff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile
index f72658b3a53f..cea97abffc03 100644
--- a/arch/mips/vdso/Makefile
+++ b/arch/mips/vdso/Makefile
@@ -4,9 +4,6 @@
 # Sanitizer runtimes are unavailable and cannot be linked here.
  KCSAN_SANITIZE:= n
 
-# Absolute relocation type $(ARCH_REL_TYPE_ABS) needs to be defined before
-# the inclusion of generic Makefile.
-ARCH_REL_TYPE_ABS := R_MIPS_JUMP_SLOT|R_MIPS_GLOB_DAT
 include $(srctree)/lib/vdso/Makefile
 
 obj-vdso-y := elf.o vgettimeofday.o sigreturn.o
diff --git a/arch/powerpc/kernel/vdso/Makefile 
b/arch/powerpc/kernel/vdso/Makefile
index 096b0bf1335f..d3c5be32034d 100644
--- a/arch/powerpc/kernel/vdso/Makefile
+++ b/arch/powerpc/kernel/vdso/Makefile
@@ -2,7 +2,6 @@
 
 # List of files in the vdso, has to be asm only for now
 
-ARCH_REL_TYPE_ABS := 
R_PPC_JUMP_SLOT|R_PPC_GLOB_DAT|R_PPC_ADDR32|R_PPC_ADDR24|R_PPC_ADDR16|R_PPC_ADDR16_LO|R_PPC_ADDR16_HI|R_PPC_ADDR16_HA|R_PPC_ADDR14|R_PPC_ADDR14_BRTAKEN|R_PPC_ADDR14_BRNTAKEN|R_PPC_REL24
 include $(srctree)/lib/vdso/Makefile
 
 obj-vdso32 

[PATCH 2/2] powerpc: remove old code for binutils < 2.25

2022-08-30 Thread Masahiro Yamada
The minimum supported version of binutils has been raised to 2.25.1.
Drop the old code.

PPC is the last user of ld-ifversion. With all the callers removed,
the macro definition in scripts/Makefile.compiler can go away.

Signed-off-by: Masahiro Yamada 
---

 arch/powerpc/Makefile | 21 -
 arch/powerpc/lib/Makefile |  8 
 scripts/Makefile.compiler |  4 
 3 files changed, 33 deletions(-)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 02742facf895..fb607758eeca 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -46,13 +46,7 @@ UTS_MACHINE := $(subst $(space),,$(machine-y))
 ifdef CONFIG_PPC32
 KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
 else
-ifeq ($(call ld-ifversion, -ge, 22500, y),y)
-# Have the linker provide sfpr if possible.
-# There is a corresponding test in arch/powerpc/lib/Makefile
 KBUILD_LDFLAGS_MODULE += --save-restore-funcs
-else
-KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
-endif
 endif
 
 ifdef CONFIG_CPU_LITTLE_ENDIAN
@@ -395,8 +389,6 @@ vdso_prepare: prepare0
$(build)=arch/powerpc/kernel/vdso 
include/generated/vdso64-offsets.h)
 endif
 
-archprepare: checkbin
-
 archheaders:
$(Q)$(MAKE) $(build)=arch/powerpc/kernel/syscalls all
 
@@ -411,16 +403,3 @@ else
$(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if 
($$2 == "TASK_CANARY") print $$3;}' include/generated/asm-offsets.h))
 endif
 endif
-
-PHONY += checkbin
-# Check toolchain versions:
-# - gcc-4.6 is the minimum kernel-wide version so nothing required.
-checkbin:
-   @if test "x${CONFIG_LD_IS_LLD}" != "xy" -a \
-   "x$(call ld-ifversion, -le, 22400, y)" = "xy" ; then \
-   echo -n '*** binutils 2.24 miscompiles weak symbols ' ; \
-   echo 'in some circumstances.' ; \
-   echo'*** binutils 2.23 do not define the TOC symbol ' ; \
-   echo -n '*** Please use a different binutils version.' ; \
-   false ; \
-   fi
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 8560c912186d..5eb3971ccb9c 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -38,14 +38,6 @@ obj-$(CONFIG_PPC32)  += div64.o copy_32.o crtsavres.o
 
 obj-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o
 
-# See corresponding test in arch/powerpc/Makefile
-# 64-bit linker creates .sfpr on demand for final link (vmlinux),
-# so it is only needed for modules, and only for older linkers which
-# do not support --save-restore-funcs
-ifeq ($(call ld-ifversion, -lt, 22500, y),y)
-extra-$(CONFIG_PPC64)  += crtsavres.o
-endif
-
 obj-$(CONFIG_PPC_BOOK3S_64) += copyuser_power7.o copypage_power7.o \
   memcpy_power7.o restart_table.o
 
diff --git a/scripts/Makefile.compiler b/scripts/Makefile.compiler
index 94d0d40cddb3..63e7d79dd877 100644
--- a/scripts/Makefile.compiler
+++ b/scripts/Makefile.compiler
@@ -68,7 +68,3 @@ cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 
] && echo $(3) || e
 # ld-option
 # Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)
 ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3))
-
-# ld-ifversion
-# Usage:  $(call ld-ifversion, -ge, 22252, y)
-ld-ifversion = $(shell [ $(CONFIG_LD_VERSION)0 $(1) $(2)0 ] && echo $(3) || 
echo $(4))
-- 
2.34.1



[PATCH 1/2] Documentation: raise minimum supported version of binutils to 2.25.1

2022-08-30 Thread Masahiro Yamada
Binutils 2.23 was released in 2012. Almost 10 years old.

We already require GCC 5.1, which was released in 2015.

Bump the binutils version to 2.25.1, which was also released in 2015.

Suggested-by: Nick Desaulniers 
Signed-off-by: Masahiro Yamada 
---

 Documentation/process/changes.rst | 4 ++--
 scripts/min-tool-version.sh   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/process/changes.rst 
b/Documentation/process/changes.rst
index 19c286c23786..5fb6a60677ef 100644
--- a/Documentation/process/changes.rst
+++ b/Documentation/process/changes.rst
@@ -33,7 +33,7 @@ GNU C  5.1  gcc --version
 Clang/LLVM (optional)  11.0.0   clang --version
 GNU make   3.81 make --version
 bash   4.2  bash --version
-binutils   2.23 ld -v
+binutils   2.25.1   ld -v
 flex   2.5.35   flex --version
 bison  2.0  bison --version
 pahole 1.16 pahole --version
@@ -94,7 +94,7 @@ Bash 4.2 or newer is needed.
 Binutils
 
 
-Binutils 2.23 or newer is needed to build the kernel.
+Binutils 2.25.1 or newer is needed to build the kernel.
 
 pkg-config
 --
diff --git a/scripts/min-tool-version.sh b/scripts/min-tool-version.sh
index 250925aab101..8b1edd1f7281 100755
--- a/scripts/min-tool-version.sh
+++ b/scripts/min-tool-version.sh
@@ -14,7 +14,7 @@ fi
 
 case "$1" in
 binutils)
-   echo 2.23.0
+   echo 2.25.1
;;
 gcc)
echo 5.1.0
-- 
2.34.1



[PATCH v5] livepatch: Clear relocation targets on a module removal

2022-08-30 Thread Song Liu
From: Miroslav Benes 

Josh reported a bug:

  When the object to be patched is a module, and that module is
  rmmod'ed and reloaded, it fails to load with:

  module: x86/modules: Skipping invalid relocation target, existing value is 
nonzero for type 2, loc ba0302e9, val a03e293c
  livepatch: failed to initialize patch 'livepatch_nfsd' for module 'nfsd' (-8)
  livepatch: patch 'livepatch_nfsd' failed for module 'nfsd', refusing to load 
module 'nfsd'

  The livepatch module has a relocation which references a symbol
  in the _previous_ loading of nfsd. When apply_relocate_add()
  tries to replace the old relocation with a new one, it sees that
  the previous one is nonzero and it errors out.

  On ppc64le, we have a similar issue:

  module_64: livepatch_nfsd: Expected nop after call, got e8410018 at 
e_show+0x60/0x548 [livepatch_nfsd]
  livepatch: failed to initialize patch 'livepatch_nfsd' for module 'nfsd' (-8)
  livepatch: patch 'livepatch_nfsd' failed for module 'nfsd', refusing to load 
module 'nfsd'

He also proposed three different solutions. We could remove the error
check in apply_relocate_add() introduced by commit eda9cec4c9a1
("x86/module: Detect and skip invalid relocations"). However the check
is useful for detecting corrupted modules.

We could also deny the patched modules to be removed. If it proved to be
a major drawback for users, we could still implement a different
approach. The solution would also complicate the existing code a lot.

We thus decided to reverse the relocation patching (clear all relocation
targets on x86_64). The solution is not
universal and is too much arch-specific, but it may prove to be simpler
in the end.

Reported-by: Josh Poimboeuf 
Signed-off-by: Miroslav Benes 
Signed-off-by: Song Liu 

---

NOTE: powerpc code has not be tested.

Changes v4 = v5:
1. Fix compile with powerpc.

Changes v3 = v4:
1. Reuse __apply_relocate_add to make it more reliable in long term.
   (Josh Poimboeuf)
2. Add back ppc64 logic from v2, with changes to match current code.
   (Josh Poimboeuf)

Changes v2 => v3:
1. Rewrite x86 changes to match current code style.
2. Remove powerpc changes as there is no test coverage in v3.
3. Only keep 1/3 of v2.

v2: https://lore.kernel.org/all/20190905124514.8944-1-mbe...@suse.cz/T/#u
---
 arch/powerpc/kernel/module_64.c |  49 +++
 arch/s390/kernel/module.c   |   8 +++
 arch/x86/kernel/module.c| 102 +++-
 include/linux/moduleloader.h|   7 +++
 kernel/livepatch/core.c |  41 -
 5 files changed, 179 insertions(+), 28 deletions(-)

diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c
index 7e45dc98df8a..6aaf5720070d 100644
--- a/arch/powerpc/kernel/module_64.c
+++ b/arch/powerpc/kernel/module_64.c
@@ -739,6 +739,55 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
return 0;
 }
 
+#ifdef CONFIG_LIVEPATCH
+void clear_relocate_add(Elf64_Shdr *sechdrs,
+  const char *strtab,
+  unsigned int symindex,
+  unsigned int relsec,
+  struct module *me)
+{
+   unsigned int i;
+   Elf64_Rela *rela = (void *)sechdrs[relsec].sh_addr;
+   Elf64_Sym *sym;
+   unsigned long *location;
+   const char *symname;
+   u32 *instruction;
+
+   pr_debug("Clearing ADD relocate section %u to %u\n", relsec,
+sechdrs[relsec].sh_info);
+
+   for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rela); i++) {
+   location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
+   + rela[i].r_offset;
+   sym = (Elf64_Sym *)sechdrs[symindex].sh_addr
+   + ELF64_R_SYM(rela[i].r_info);
+   symname = me->core_kallsyms.strtab
+   + sym->st_name;
+
+   if (ELF64_R_TYPE(rela[i].r_info) != R_PPC_REL24)
+   continue;
+   /*
+* reverse the operations in apply_relocate_add() for case
+* R_PPC_REL24.
+*/
+   if (sym->st_shndx != SHN_UNDEF &&
+   sym->st_shndx != SHN_LIVEPATCH)
+   continue;
+
+   instruction = (u32 *)location;
+   if (is_mprofile_ftrace_call(symname))
+   continue;
+
+   if (!instr_is_relative_link_branch(ppc_inst(*instruction)))
+   continue;
+
+   instruction += 1;
+   *instruction = PPC_RAW_NOP();
+   }
+
+}
+#endif
+
 #ifdef CONFIG_DYNAMIC_FTRACE
 int module_trampoline_target(struct module *mod, unsigned long addr,
 unsigned long *target)
diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c
index 2d159b32885b..cc6784fbc1ac 100644
--- a/arch/s390/kernel/module.c
+++ b/arch/s390/kernel/module.c
@@ -500,6 +500,14 @@ static int module_alloc_ftrace_hotpatch_trampoli

Re: [PATCH v2 1/5] serial: ucc_uart: Remove custom frame size calculation

2022-08-30 Thread Timur Tabi
On Tue, Aug 30, 2022 at 3:49 AM Ilpo Järvinen
 wrote:
>
> The number of bits can be calculated using tty_get_frame_size(), no
> need for the driver to do it on its own.
>
> Also remove a comment on number of bits that doesn't match the code nor
> the comment on ucc_uart_pram's rx_length ("minus 1" part differs). That
> comment seems a verbatim copy of that in cpm_uart/cpm_uart_core.c
> anyway so perhaps it was just copied over w/o much thinking.
>
> Reviewed-by: Andy Shevchenko 
> Signed-off-by: Ilpo Järvinen 

Acked-by: Timur Tabi 


Re: [PATCH] powerpc: clean up binutils version check

2022-08-30 Thread Masahiro Yamada
On Tue, Aug 30, 2022 at 7:44 PM Michael Ellerman  wrote:
>
> Christophe Leroy  writes:
> > Le 27/08/2022 à 20:03, Masahiro Yamada a écrit :
> >> On Sun, Aug 28, 2022 at 2:37 AM Christophe Leroy
> >>  wrote:
> >>> Le 27/08/2022 à 18:40, Masahiro Yamada a écrit :
>  The checkbin in arch/powerpc/Makefile errors out if ld <= 2.24.
>  So, the requirement on PPC is binutils >= 2.25. It is cleaner to
>  specify it in scripts/min-tool-version.sh. If binutils < 2.25 is
>  used, the toolchain check will fail in the Kconfig stage going
>  forward.
> 
>  Since binutils >= 2.25 is already required, another version test
>  for --save-restore-funcs on PPC64 is always met.
> ...
>  diff --git a/scripts/min-tool-version.sh b/scripts/min-tool-version.sh
>  index 250925aab101..7df9f2150ea1 100755
>  --- a/scripts/min-tool-version.sh
>  +++ b/scripts/min-tool-version.sh
>  @@ -14,7 +14,13 @@ fi
> 
> case "$1" in
> binutils)
>  - echo 2.23.0
>  + if [ "$SRCARCH" = powerpc ]; then
> >>>
> >>> Isn't this limitation only for ppc64le ?
> >>>
> >>> Refer commit 60e065f70bdb ("powerpc: Reject binutils 2.24 when building
> >>> little endian")
> >>
> >> I do not see any CONFIG check in the current checkbin.
> >>
> >> Refer commit a3ad84da0760 ("powerpc/toc: Future proof
> >> kernel toc")
> >
> > That's odd. There is no toc on PPC32.
>
> I think that's just a bug in a3ad84da0760.
>
> But that means we inadvertantly dropped support for 2.24 about 8 months
> ago, and no one noticed.
>
> Let's see what the responses are to Nick's proposal to increase the
> minimum to 2.25.1.
>
> cheers



Either way is fine with me, but in that case,
do I need to get a higher-level Ack from Linus?

The current one can go to the ppc tree
since apparently it does not affect any other arches.

-- 
Best Regards
Masahiro Yamada


[PATCH] powerpc/papr_scm: Ensure rc is always initialized in papr_scm_pmu_register()

2022-08-30 Thread Nathan Chancellor
Clang warns:

  arch/powerpc/platforms/pseries/papr_scm.c:492:6: warning: variable 'rc' is 
used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
  if (!p->stat_buffer_len)
  ^~~
  arch/powerpc/platforms/pseries/papr_scm.c:523:64: note: uninitialized use 
occurs here
  dev_info(&p->pdev->dev, "nvdimm pmu didn't register rc=%d\n", rc);
^~
  include/linux/dev_printk.h:150:67: note: expanded from macro 'dev_info'
  dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), 
##__VA_ARGS__)
  
^~~
  include/linux/dev_printk.h:110:23: note: expanded from macro 
'dev_printk_index_wrap'
  _p_func(dev, fmt, ##__VA_ARGS__);   \
  ^~~
  arch/powerpc/platforms/pseries/papr_scm.c:492:2: note: remove the 'if' if its 
condition is always false
  if (!p->stat_buffer_len)
  ^~~~
  arch/powerpc/platforms/pseries/papr_scm.c:484:8: note: initialize the 
variable 'rc' to silence this warning
  int rc, nodeid;
^
= 0
  1 warning generated.

The call to papr_scm_pmu_check_events() was eliminated but a return code
was not added to the if statement. Add the same return code from
papr_scm_pmu_check_events() for this condition so there is no more
warning.

Fixes: 9b1ac04698a4 ("powerpc/papr_scm: Fix nvdimm event mappings")
Link: https://github.com/ClangBuiltLinux/linux/issues/1701
Signed-off-by: Nathan Chancellor 
---
 arch/powerpc/platforms/pseries/papr_scm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/papr_scm.c 
b/arch/powerpc/platforms/pseries/papr_scm.c
index 54740af21557..2f8385523a13 100644
--- a/arch/powerpc/platforms/pseries/papr_scm.c
+++ b/arch/powerpc/platforms/pseries/papr_scm.c
@@ -489,8 +489,10 @@ static void papr_scm_pmu_register(struct papr_scm_priv *p)
goto pmu_err_print;
}
 
-   if (!p->stat_buffer_len)
+   if (!p->stat_buffer_len) {
+   rc = -ENOENT;
goto pmu_check_events_err;
+   }
 
nd_pmu->pmu.task_ctx_nr = perf_invalid_context;
nd_pmu->pmu.name = nvdimm_name(p->nvdimm);

base-commit: 91926d8b7e71aaf5f84f0cf208fc5a8b7a761050
-- 
2.37.2



Re: [PATCH v2 03/16] powerpc: Fix objtool unannotated intra-function call warnings

2022-08-30 Thread Christophe Leroy


Le 29/08/2022 à 07:52, Sathvika Vasireddy a écrit :
> objtool throws unannotated intra-function call warnings
> in the following assembly files:
> 
> arch/powerpc/kernel/vector.o: warning: objtool: .text+0x53c: unannotated 
> intra-function call
> 
> arch/powerpc/kvm/book3s_hv_rmhandlers.o: warning: objtool: .text+0x60: 
> unannotated intra-function call
> arch/powerpc/kvm/book3s_hv_rmhandlers.o: warning: objtool: .text+0x124: 
> unannotated intra-function call
> arch/powerpc/kvm/book3s_hv_rmhandlers.o: warning: objtool: .text+0x5d4: 
> unannotated intra-function call
> arch/powerpc/kvm/book3s_hv_rmhandlers.o: warning: objtool: .text+0x5dc: 
> unannotated intra-function call
> arch/powerpc/kvm/book3s_hv_rmhandlers.o: warning: objtool: .text+0xcb8: 
> unannotated intra-function call
> arch/powerpc/kvm/book3s_hv_rmhandlers.o: warning: objtool: .text+0xd0c: 
> unannotated intra-function call
> arch/powerpc/kvm/book3s_hv_rmhandlers.o: warning: objtool: .text+0x1030: 
> unannotated intra-function call
> 
> arch/powerpc/kernel/head_64.o: warning: objtool: .text+0x358: unannotated 
> intra-function call
> arch/powerpc/kernel/head_64.o: warning: objtool: .text+0x728: unannotated 
> intra-function call
> arch/powerpc/kernel/head_64.o: warning: objtool: .text+0x4d94: unannotated 
> intra-function call
> arch/powerpc/kernel/head_64.o: warning: objtool: .text+0x4ec4: unannotated 
> intra-function call
> 
> arch/powerpc/kvm/book3s_hv_interrupts.o: warning: objtool: .text+0x6c: 
> unannotated intra-function call
> arch/powerpc/kernel/misc_64.o: warning: objtool: .text+0x64: unannotated 
> intra-function call
> 
> objtool does not add STT_NOTYPE symbols with size 0 to the
> rbtree, which is why find_call_destination() function is not able
> to find the destination symbol for 'bl' instruction. For such symbols,
> objtool is throwing unannotated intra-function call warnings in
> assembly files. Fix these warnings by adding SYM_FUNC_START_LOCAL()
> and SYM_FUNC_END() annotations to those symbols to be able to set symbol
> type to STT_FUNC and set size of these symbols accordingly.
> 
> Signed-off-by: Sathvika Vasireddy 
> ---
>   arch/powerpc/kernel/exceptions-64s.S|  7 +--
>   arch/powerpc/kernel/head_64.S   |  7 +--
>   arch/powerpc/kernel/misc_64.S   |  4 +++-
>   arch/powerpc/kernel/vector.S|  4 +++-
>   arch/powerpc/kvm/book3s_hv_interrupts.S |  4 +++-
>   arch/powerpc/kvm/book3s_hv_rmhandlers.S | 22 +++---
>   6 files changed, 34 insertions(+), 14 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/exceptions-64s.S 
> b/arch/powerpc/kernel/exceptions-64s.S
> index 3d0dc133a9ae..4242c1a20bcd 100644
> --- a/arch/powerpc/kernel/exceptions-64s.S
> +++ b/arch/powerpc/kernel/exceptions-64s.S
> @@ -20,6 +20,7 @@
>   #include 
>   #include 
>   #include 
> +#include 

Can you keep all  all together _before_ the  ones 
as usual ?

Christophe

Re: [PATCH] powerpc: clean up binutils version check

2022-08-30 Thread Michael Ellerman
Christophe Leroy  writes:
> Le 27/08/2022 à 20:03, Masahiro Yamada a écrit :
>> On Sun, Aug 28, 2022 at 2:37 AM Christophe Leroy
>>  wrote:
>>> Le 27/08/2022 à 18:40, Masahiro Yamada a écrit :
 The checkbin in arch/powerpc/Makefile errors out if ld <= 2.24.
 So, the requirement on PPC is binutils >= 2.25. It is cleaner to
 specify it in scripts/min-tool-version.sh. If binutils < 2.25 is
 used, the toolchain check will fail in the Kconfig stage going
 forward.

 Since binutils >= 2.25 is already required, another version test
 for --save-restore-funcs on PPC64 is always met.
...
 diff --git a/scripts/min-tool-version.sh b/scripts/min-tool-version.sh
 index 250925aab101..7df9f2150ea1 100755
 --- a/scripts/min-tool-version.sh
 +++ b/scripts/min-tool-version.sh
 @@ -14,7 +14,13 @@ fi

case "$1" in
binutils)
 - echo 2.23.0
 + if [ "$SRCARCH" = powerpc ]; then
>>>
>>> Isn't this limitation only for ppc64le ?
>>>
>>> Refer commit 60e065f70bdb ("powerpc: Reject binutils 2.24 when building
>>> little endian")
>> 
>> I do not see any CONFIG check in the current checkbin.
>> 
>> Refer commit a3ad84da0760 ("powerpc/toc: Future proof
>> kernel toc")
>
> That's odd. There is no toc on PPC32.

I think that's just a bug in a3ad84da0760.

But that means we inadvertantly dropped support for 2.24 about 8 months
ago, and no one noticed.

Let's see what the responses are to Nick's proposal to increase the
minimum to 2.25.1.

cheers


Re: [PATCH v2] powerpc: Fix irq_soft_mask_set() and irq_soft_mask_return() with sanitizer

2022-08-30 Thread Christophe Leroy


Le 30/08/2022 à 11:01, Nicholas Piggin a écrit :
> On Tue Aug 30, 2022 at 3:24 PM AEST, Christophe Leroy wrote:
>>> This is still slightly concerning to me. Is there any guarantee that the
>>> compiler would not use a different sequence for the address here?
>>>
>>> Maybe explicit r13 is required.
>>>
>>
>> local_paca is defined as:
>>
>>  register struct paca_struct *local_paca asm("r13");
>>
>> Why would the compiler use another register ?
> 
> Hopefully it doesn't. Is it guaranteed that it won't?
> 
>> If so, do we also have an
>> issue with the use of current_stack_pointer in irq.c ?
> 
> What problems do you think it might have?  I think it may be okay
> because we're only using it to check what stack we are using so doesn't
> really matter what value it is when we sample it.
> 
> The overflow check similarly probably doesn't matter the exact value.
> 
>> Segher ?
> 
> I'm sure Segher will be delighted with the creative asm in __do_IRQ
> and call_do_irq :) *Grabs popcorn*
> 

Segher was in the loop, 
https://patchwork.ozlabs.org/project/linuxppc-dev/patch/5ca6639b7c1c21ee4b4138b7cfb31d6245c4195c.1570684298.git.christophe.le...@c-s.fr/

Re: [PATCH v2] powerpc: Fix irq_soft_mask_set() and irq_soft_mask_return() with sanitizer

2022-08-30 Thread Nicholas Piggin
On Tue Aug 30, 2022 at 3:24 PM AEST, Christophe Leroy wrote:
>
>
> Le 30/08/2022 à 07:15, Nicholas Piggin a écrit :
> > On Wed Aug 24, 2022 at 2:39 AM AEST, Christophe Leroy wrote:
> >> In ppc, compiler based sanitizer will generate instrument instructions
> >> around statement WRITE_ONCE(local_paca->irq_soft_mask, mask):
> >>
>
> [...]
>
> >>
> >> If there is a context switch before "stb r9,2354(r31)", r31 may
> >> not equal to r13, in such case, irq soft mask will not work.
> >>
> >> The same problem occurs in irq_soft_mask_return() with
> >> READ_ONCE(local_paca->irq_soft_mask).
> > 
> > WRITE_ONCE doesn't require address generation to be atomic with the
> > store so this is a bug without sanitizer too. I have seen gcc put r13
> > into a nvgpr before.
> > 
> > READ_ONCE maybe could be argued is safe in this case because data
> > could be stale when you use it anyway, but pointless and risky
> > in some cases (imagine cpu offline -> store poison value to irq soft
> > mask.
> > 
> >> This patch partially reverts commit ef5b570d3700 ("powerpc/irq: Don't
> >> open code irq_soft_mask helpers") with a more modern inline assembly.
> >>
> >> Reported-by: Zhouyi Zhou 
> >> Fixes: ef5b570d3700 ("powerpc/irq: Don't open code irq_soft_mask helpers")
> >> Signed-off-by: Christophe Leroy 
> >> ---
> >> v2: Use =m constraint for stb instead of m constraint
> >> ---
> >>   arch/powerpc/include/asm/hw_irq.h | 9 ++---
> >>   1 file changed, 6 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/arch/powerpc/include/asm/hw_irq.h 
> >> b/arch/powerpc/include/asm/hw_irq.h
> >> index 26ede09c521d..815420988ef3 100644
> >> --- a/arch/powerpc/include/asm/hw_irq.h
> >> +++ b/arch/powerpc/include/asm/hw_irq.h
> >> @@ -113,7 +113,11 @@ static inline void __hard_RI_enable(void)
> >>   
> >>   static inline notrace unsigned long irq_soft_mask_return(void)
> >>   {
> >> -  return READ_ONCE(local_paca->irq_soft_mask);
> >> +  unsigned long flags;
> >> +
> >> +  asm volatile("lbz%X1 %0,%1" : "=r" (flags) : "m" 
> >> (local_paca->irq_soft_mask));
> >> +
> >> +  return flags;
> >>   }
> >>   
> >>   /*
> >> @@ -140,8 +144,7 @@ static inline notrace void irq_soft_mask_set(unsigned 
> >> long mask)
> >>if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG))
> >>WARN_ON(mask && !(mask & IRQS_DISABLED));
> >>   
> >> -  WRITE_ONCE(local_paca->irq_soft_mask, mask);
> >> -  barrier();
> >> +  asm volatile("stb%X0 %1,%0" : "=m" (local_paca->irq_soft_mask) : "r" 
> >> (mask) : "memory");
> > 
> > This is still slightly concerning to me. Is there any guarantee that the
> > compiler would not use a different sequence for the address here?
> > 
> > Maybe explicit r13 is required.
> > 
>
> local_paca is defined as:
>
>   register struct paca_struct *local_paca asm("r13");
>
> Why would the compiler use another register ?

Hopefully it doesn't. Is it guaranteed that it won't?

> If so, do we also have an 
> issue with the use of current_stack_pointer in irq.c ?

What problems do you think it might have?  I think it may be okay
because we're only using it to check what stack we are using so doesn't
really matter what value it is when we sample it.

The overflow check similarly probably doesn't matter the exact value.

> Segher ?

I'm sure Segher will be delighted with the creative asm in __do_IRQ
and call_do_irq :) *Grabs popcorn*

Thanks,
Nick


[PATCH v2 1/5] serial: ucc_uart: Remove custom frame size calculation

2022-08-30 Thread Ilpo Järvinen
The number of bits can be calculated using tty_get_frame_size(), no
need for the driver to do it on its own.

Also remove a comment on number of bits that doesn't match the code nor
the comment on ucc_uart_pram's rx_length ("minus 1" part differs). That
comment seems a verbatim copy of that in cpm_uart/cpm_uart_core.c
anyway so perhaps it was just copied over w/o much thinking.

Reviewed-by: Andy Shevchenko 
Signed-off-by: Ilpo Järvinen 
---
 drivers/tty/serial/ucc_uart.c | 15 +--
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c
index 3cc9ef08455c..7331964163c5 100644
--- a/drivers/tty/serial/ucc_uart.c
+++ b/drivers/tty/serial/ucc_uart.c
@@ -853,13 +853,6 @@ static void qe_uart_set_termios(struct uart_port *port,
u16 upsmr = ioread16be(&uccp->upsmr);
struct ucc_uart_pram __iomem *uccup = qe_port->uccup;
u16 supsmr = ioread16be(&uccup->supsmr);
-   u8 char_length = 2; /* 1 + CL + PEN + 1 + SL */
-
-   /* Character length programmed into the mode register is the
-* sum of: 1 start bit, number of data bits, 0 or 1 parity bit,
-* 1 or 2 stop bits, minus 1.
-* The value 'bits' counts this for us.
-*/
 
/* byte size */
upsmr &= UCC_UART_UPSMR_CL_MASK;
@@ -869,22 +862,18 @@ static void qe_uart_set_termios(struct uart_port *port,
case CS5:
upsmr |= UCC_UART_UPSMR_CL_5;
supsmr |= UCC_UART_SUPSMR_CL_5;
-   char_length += 5;
break;
case CS6:
upsmr |= UCC_UART_UPSMR_CL_6;
supsmr |= UCC_UART_SUPSMR_CL_6;
-   char_length += 6;
break;
case CS7:
upsmr |= UCC_UART_UPSMR_CL_7;
supsmr |= UCC_UART_SUPSMR_CL_7;
-   char_length += 7;
break;
default:/* case CS8 */
upsmr |= UCC_UART_UPSMR_CL_8;
supsmr |= UCC_UART_SUPSMR_CL_8;
-   char_length += 8;
break;
}
 
@@ -892,13 +881,11 @@ static void qe_uart_set_termios(struct uart_port *port,
if (termios->c_cflag & CSTOPB) {
upsmr |= UCC_UART_UPSMR_SL;
supsmr |= UCC_UART_SUPSMR_SL;
-   char_length++;  /* + SL */
}
 
if (termios->c_cflag & PARENB) {
upsmr |= UCC_UART_UPSMR_PEN;
supsmr |= UCC_UART_SUPSMR_PEN;
-   char_length++;  /* + PEN */
 
if (!(termios->c_cflag & PARODD)) {
upsmr &= ~(UCC_UART_UPSMR_RPM_MASK |
@@ -953,7 +940,7 @@ static void qe_uart_set_termios(struct uart_port *port,
iowrite16be(upsmr, &uccp->upsmr);
if (soft_uart) {
iowrite16be(supsmr, &uccup->supsmr);
-   iowrite8(char_length, &uccup->rx_length);
+   iowrite8(tty_get_frame_size(termios->c_cflag), 
&uccup->rx_length);
 
/* Soft-UART requires a 1X multiplier for TX */
qe_setbrg(qe_port->us_info.rx_clock, baud, 16);
-- 
2.30.2



Re: [PATCH] tty: move from strlcpy with unused retval to strscpy

2022-08-30 Thread Jiri Slaby

On 18. 08. 22, 23:01, Wolfram Sang wrote:

Follow the advice of the below link and prefer 'strscpy' in this
subsystem. Conversion is 1:1 because the return value is not used.
Generated by a coccinelle script.


Reviewed-by: Jiri Slaby 


Link: 
https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=v6a6g1ouzcprm...@mail.gmail.com/
Signed-off-by: Wolfram Sang 
---
  drivers/tty/hvc/hvcs.c   | 2 +-
  drivers/tty/serial/earlycon.c| 6 +++---
  drivers/tty/serial/serial_core.c | 2 +-
  drivers/tty/serial/sunsu.c   | 6 +++---
  drivers/tty/serial/sunzilog.c| 6 +++---
  5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
index 9b7e8246a464..b79ce8d34f11 100644
--- a/drivers/tty/hvc/hvcs.c
+++ b/drivers/tty/hvc/hvcs.c
@@ -839,7 +839,7 @@ static void hvcs_set_pi(struct hvcs_partner_info *pi, 
struct hvcs_struct *hvcsd)
hvcsd->p_partition_ID  = pi->partition_ID;
  
  	/* copy the null-term char too */

-   strlcpy(hvcsd->p_location_code, pi->location_code,
+   strscpy(hvcsd->p_location_code, pi->location_code,
sizeof(hvcsd->p_location_code));
  }
  
diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c

index 88d08ba1ca83..a5f380584cda 100644
--- a/drivers/tty/serial/earlycon.c
+++ b/drivers/tty/serial/earlycon.c
@@ -67,7 +67,7 @@ static void __init earlycon_init(struct earlycon_device 
*device,
if (*s)
earlycon->index = simple_strtoul(s, NULL, 10);
len = s - name;
-   strlcpy(earlycon->name, name, min(len + 1, sizeof(earlycon->name)));
+   strscpy(earlycon->name, name, min(len + 1, sizeof(earlycon->name)));
earlycon->data = &early_console_dev;
  }
  
@@ -123,7 +123,7 @@ static int __init parse_options(struct earlycon_device *device, char *options)

device->baud = simple_strtoul(options, NULL, 0);
length = min(strcspn(options, " ") + 1,
 (size_t)(sizeof(device->options)));
-   strlcpy(device->options, options, length);
+   strscpy(device->options, options, length);
}
  
  	return 0;

@@ -304,7 +304,7 @@ int __init of_setup_earlycon(const struct earlycon_id 
*match,
  
  	if (options) {

early_console_dev.baud = simple_strtoul(options, NULL, 0);
-   strlcpy(early_console_dev.options, options,
+   strscpy(early_console_dev.options, options,
sizeof(early_console_dev.options));
}
earlycon_init(&early_console_dev, match->name);
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 12c87cd201a7..3561a160cbd5 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -2497,7 +2497,7 @@ uart_report_port(struct uart_driver *drv, struct 
uart_port *port)
 "MMIO 0x%llx", (unsigned long long)port->mapbase);
break;
default:
-   strlcpy(address, "*unknown*", sizeof(address));
+   strscpy(address, "*unknown*", sizeof(address));
break;
}
  
diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c

index 84d545e5a8c7..d5dcb612804e 100644
--- a/drivers/tty/serial/sunsu.c
+++ b/drivers/tty/serial/sunsu.c
@@ -1217,13 +1217,13 @@ static int sunsu_kbd_ms_init(struct uart_sunsu_port *up)
serio->id.type = SERIO_RS232;
if (up->su_type == SU_PORT_KBD) {
serio->id.proto = SERIO_SUNKBD;
-   strlcpy(serio->name, "sukbd", sizeof(serio->name));
+   strscpy(serio->name, "sukbd", sizeof(serio->name));
} else {
serio->id.proto = SERIO_SUN;
serio->id.extra = 1;
-   strlcpy(serio->name, "sums", sizeof(serio->name));
+   strscpy(serio->name, "sums", sizeof(serio->name));
}
-   strlcpy(serio->phys,
+   strscpy(serio->phys,
(!(up->port.line & 1) ? "su/serio0" : "su/serio1"),
sizeof(serio->phys));
  
diff --git a/drivers/tty/serial/sunzilog.c b/drivers/tty/serial/sunzilog.c

index c14275d83b0b..c44cf613ff1a 100644
--- a/drivers/tty/serial/sunzilog.c
+++ b/drivers/tty/serial/sunzilog.c
@@ -1307,13 +1307,13 @@ static void sunzilog_register_serio(struct 
uart_sunzilog_port *up)
serio->id.type = SERIO_RS232;
if (up->flags & SUNZILOG_FLAG_CONS_KEYB) {
serio->id.proto = SERIO_SUNKBD;
-   strlcpy(serio->name, "zskbd", sizeof(serio->name));
+   strscpy(serio->name, "zskbd", sizeof(serio->name));
} else {
serio->id.proto = SERIO_SUN;
serio->id.extra = 1;
-   strlcpy(serio->name, "zsms", sizeof(serio->name));
+   strscpy(serio->name, "zsms", sizeof(serio->name));
}
-   strlcpy(serio->phys,
+   strscpy(serio->phys,
((up->flags & SU

Re: [PATCH v2 00/10] crypto: Kconfig - simplify menus and help text

2022-08-30 Thread Christophe Leroy


Le 29/08/2022 à 15:59, Elliott, Robert (Servers) a écrit :
> 
> 
>> -Original Message-
>> From: Christophe Leroy 
>> Sent: Monday, August 29, 2022 3:53 AM
>> To: Elliott, Robert (Servers) ; Nayna
>> ; Andrew Donnellan 
>> Cc: linuxppc-dev@lists.ozlabs.org
>> Subject: Re: [PATCH v2 00/10] crypto: Kconfig - simplify menus and help
>> text
>>
>> Le 29/08/2022 à 02:05, Elliott, Robert (Servers) a écrit :
>>>
 -Original Message-
 From: Christophe Leroy 
 Sent: Sunday, August 28, 2022 2:33 AM
 To: Elliott, Robert (Servers) ; Nayna
 ; Andrew Donnellan 
 Cc: linuxppc-dev@lists.ozlabs.org
 Subject: Re: [PATCH v2 00/10] crypto: Kconfig - simplify menus and help
 text

 Le 27/08/2022 à 22:06, Elliott, Robert (Servers) a écrit :
> (adding Christophe, per
> bba496656a73fc1 ("powerpc/32: Fix boot failure with GCC latent entropy
 plugin")
>
> Adding libmpc-devel gets all the architectures building except powerpc.
>
> (I also installed gcc-plugins-devel to get the native x86
> build to detect plugins.)
>
> However, powerpc still fails to build. Several of the Linux standard
> include files end up including nodemask.h, which includes random.h,
> which has a problem finding a global called latent_entropy while
> building init/main.o:

 Isn't it fixed in mainline by commit 012e8d2034f1 ("gcc-plugins:
 Undefine LATENT_ENTROPY_PLUGIN when plugin disabled for a file") ?
>>>
>>> Yes, adding that patch fixes this particular problem. Thanks!
>>>
>>> Next up is:
>>> Cannot find symbol for section 94: .text.free_initmem.
>>> init/main.o: failed
>>> make[2]: *** [../scripts/Makefile.build:249: init/main.o] Error 1
>>>
>>
>> Can you please provide some context, which .config, which version of
>> gcc/binutils etc 
>>
>> FWIW, free_initmem() is supposed to be in arch/powerpc/mm/mem.o
> 
> I'm running the same commands for each architecture:
> make ARCH=powerpc O=build-powerpc CROSS_COMPILE=powerpc64-linux-gnu- clean
> make ARCH=powerpc O=build-powerpc CROSS_COMPILE=powerpc64-linux-gnu- mrproper
> make ARCH=powerpc O=build-powerpc CROSS_COMPILE=powerpc64-linux-gnu- 
> allmodconfig
> make ARCH=powerpc O=build-powerpc CROSS_COMPILE=powerpc64-linux-gnu- 
> olddefconfig
> make ARCH=powerpc O=build-powerpc CROSS_COMPILE=powerpc64-linux-gnu- -j 55
> 
> For 6.0-rc3 (which includes 012e8d2034f1), that works for
>  arm, arm64, sparc, and s390
> but fails for
>  mips, powerpc, and x86.
> 
> mips complains about:
> ../include/linux/fortify-string.h:44:33: error: ‘__builtin_memcmp’ specified 
> bound 6 exceeds source size 0 [-W
> error=stringop-overread]
> 44 | #define __underlying_memcmp __builtin_memcmp
>| ^
> 
> x86 complains about:
> You are building kernel with non-retpoline compiler.
> Please update your compiler.
> 
> (I'm using gcc 12.2.1, from Fedora 36)
> 
> For powerpc, these are the error/failed/Cannot lines:
> 
> Cannot find symbol for section 19: .text.create_section_mapping.
> Cannot find symbol for section 94: .text.free_initmem.
> Cannot find symbol for section 27: .text.copy_from_kernel_nofault_allowed.
> Cannot find symbol for section 31: .text.arch_suspend_disable_irqs.
> Cannot find symbol for section 53: .text.arch_resume_nosmt.
> Cannot find symbol for section 223: .text.arch_cpu_idle_prepare.
> Cannot find symbol for section 44: .text.arch_show_interrupts.
> Cannot find symbol for section 183: .text.arch_asym_cpu_priority.
> Cannot find symbol for section 157: .text.module_arch_cleanup.
> Cannot find symbol for section 13: .text.sched_clock.
> Cannot find symbol for section 10: .text.arch_report_meminfo.
> Cannot find symbol for section 18: 
> .text.dereference_module_function_descriptor.

This is an issue in recordmcount together with binutils 37 when 
CONFIG_LD_DEAD_CODE_DATA_ELIMINATION is selected. There is some work in 
progress to replace recordmcount by objtool on powerpc, but it is not 
yet available, and even with objtool there may still be an issue with 
binutils 37 allthough it doesn't throw an error at build.

Unfortunately, Fedora 36 is shipped with 
binutils-powerpc64-linux-gnu-2.37-7.fc36.x86_64


If you take the crosstools from kernel.org, it works because they don't 
use binutils 37. See https://mirrors.edge.kernel.org/pub/tools/crosstool/.
All older ones are available at 
https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/

gcc 11.1 uses binutils 36.1
gcc 11.3 uses binutils 38
gcc 12.1 uses binutils 38
gcc 12.2 uses binutils 39

Christophe