* Re: [PATCH 2/8] CMDLINE: drivers: of: ifdef out cmdline section
From: Christophe Leroy @ 2021-04-02 17:32 UTC (permalink / raw)
To: Daniel Walker, Will Deacon, ob Herring, Daniel Gimpelevich,
Andrew Morton, x86, linux-mips, linuxppc-dev, Rob Herring,
Frank Rowand
Cc: devicetree, Ruslan Ruslichenko, linux-kernel, xe-linux-external
In-Reply-To: <0c4b839f023f87c451c8aa3c4f7a8d92729c2f02.1617126961.git.danielwa@cisco.com>
Le 30/03/2021 à 19:56, Daniel Walker a écrit :
> It looks like there's some seepage of cmdline stuff into
> the generic device tree code. This conflicts with the
> generic cmdline implementation so I remove it in the case
> when that's enabled.
>
> Cc: xe-linux-external@cisco.com
> Signed-off-by: Ruslan Ruslichenko <rruslich@cisco.com>
> Signed-off-by: Daniel Walker <danielwa@cisco.com>
> ---
> drivers/of/fdt.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index dcc1dd96911a..d8805cd9717a 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -25,6 +25,7 @@
> #include <linux/serial_core.h>
> #include <linux/sysfs.h>
> #include <linux/random.h>
> +#include <linux/cmdline.h>
>
> #include <asm/setup.h> /* for COMMAND_LINE_SIZE */
> #include <asm/page.h>
> @@ -1050,6 +1051,18 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
>
> /* Retrieve command line */
> p = of_get_flat_dt_prop(node, "bootargs", &l);
> +
> +#if defined(CONFIG_GENERIC_CMDLINE) && defined(CONFIG_GENERIC_CMDLINE_OF)
> + /*
> + * The builtin command line will be added here, or it can override
> + * with the DT bootargs.
> + */
> + cmdline_add_builtin(data,
> + (l > 0 ? p : NULL), /* This is sanity checking */
> + COMMAND_LINE_SIZE);
> +#elif defined(CONFIG_GENERIC_CMDLINE)
> + strlcpy(data, p, COMMAND_LINE_SIZE);
> +#else
Ugly.
Linux codying style recommend to limit the use of #ifdefs to headers as much as possible.
Why do we need so many alternatives ? Allthough they are temporary, can we order the changes in
another way to reduce that ?
> if (p != NULL && l > 0)
> strlcpy(data, p, min(l, COMMAND_LINE_SIZE));
>
> @@ -1070,6 +1083,7 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
> strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
> #endif
> #endif /* CONFIG_CMDLINE */
> +#endif /* CONFIG_GENERIC_CMDLINE */
>
> pr_debug("Command line is: %s\n", (char *)data);
>
>
^ permalink raw reply
* Re: [PATCH 3/8] powerpc: convert strcpy to strlcpy in prom_init
From: Christophe Leroy @ 2021-04-02 17:32 UTC (permalink / raw)
To: Daniel Walker, Will Deacon, ob Herring, Daniel Gimpelevich,
Andrew Morton, x86, linux-mips, linuxppc-dev
Cc: linux-kernel, Paul Mackerras, xe-linux-external
In-Reply-To: <0c80a08ad4cf788c75043c1615c05bad893f4fde.1617126961.git.danielwa@cisco.com>
Le 30/03/2021 à 19:56, Daniel Walker a écrit :
> There's only two users of strcpy and one is the command
> line handling. The generic command line handling uses strlcpy
> and it makes sense to convert this one other user to strlcpy to
> keep prom_init size consistent.
>
> Cc: xe-linux-external@cisco.com
> Signed-off-by: Daniel Walker <danielwa@cisco.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> arch/powerpc/kernel/prom_init.c | 25 +++++++++++++++----------
> 1 file changed, 15 insertions(+), 10 deletions(-)
>
> diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
> index ccf77b985c8f..2c2f33155317 100644
> --- a/arch/powerpc/kernel/prom_init.c
> +++ b/arch/powerpc/kernel/prom_init.c
> @@ -242,15 +242,6 @@ static int __init prom_strcmp(const char *cs, const char *ct)
> return 0;
> }
>
> -static char __init *prom_strcpy(char *dest, const char *src)
> -{
> - char *tmp = dest;
> -
> - while ((*dest++ = *src++) != '\0')
> - /* nothing */;
> - return tmp;
> -}
> -
> static int __init prom_strncmp(const char *cs, const char *ct, size_t count)
> {
> unsigned char c1, c2;
> @@ -276,6 +267,20 @@ static size_t __init prom_strlen(const char *s)
> return sc - s;
> }
>
> +static size_t __init prom_strlcpy(char *dest, const char *src, size_t size)
> +{
> + size_t ret = prom_strlen(src);
> +
> + if (size) {
> + size_t len = (ret >= size) ? size - 1 : ret;
> +
> + memcpy(dest, src, len);
> + dest[len] = '\0';
> + }
> + return ret;
> +}
> +
> +
> static int __init prom_memcmp(const void *cs, const void *ct, size_t count)
> {
> const unsigned char *su1, *su2;
> @@ -2702,7 +2707,7 @@ static void __init flatten_device_tree(void)
>
> /* Add "phandle" in there, we'll need it */
> namep = make_room(&mem_start, &mem_end, 16, 1);
> - prom_strcpy(namep, "phandle");
> + prom_strlcpy(namep, "phandle", 8);
> mem_start = (unsigned long)namep + prom_strlen(namep) + 1;
>
> /* Build string array */
>
^ permalink raw reply
* Re: [PATCH 4/8] CMDLINE: powerpc: convert to generic builtin command line
From: Christophe Leroy @ 2021-04-02 17:34 UTC (permalink / raw)
To: Daniel Walker, Will Deacon, ob Herring, Daniel Gimpelevich,
Andrew Morton, x86, linux-mips, linuxppc-dev, Michael Ellerman,
Benjamin Herrenschmidt, Paul Mackerras
Cc: Ruslan Ruslichenko, Ruslan Bilovol, linux-kernel,
xe-linux-external
In-Reply-To: <e51a16e369f6a7dfae948c6de76061f3a061a375.1617126961.git.danielwa@cisco.com>
Le 30/03/2021 à 19:56, Daniel Walker a écrit :
> This updates the powerpc code to use the CONFIG_GENERIC_CMDLINE
> option.
>
> This includes a scripted mass convert of the config files to use
> the new generic cmdline. There is a bit of a trim effect here.
> It would seems that some of the config haven't been trimmed in
> a while.
Sorry, this patch is not acceptable as is, the default for powerpc is CMDLINE_FROM_BOOTLOADER, ie
builtin-cmdline is taken if and only if none is provided by the bootloader.
As far as I understand, that disappear with this patch.
>
> The bash script used to convert is as follows,
>
> if [[ -z "$1" || -z "$2" ]]; then
> echo "Two arguments are needed."
> exit 1
> fi
> mkdir $1
> cp $2 $1/.config
> sed -i 's/CONFIG_CMDLINE=/CONFIG_CMDLINE_BOOL=y\nCONFIG_CMDLINE_PREPEND=/g' $1/.config
> make ARCH=$1 O=$1 olddefconfig
> make ARCH=$1 O=$1 savedefconfig
> cp $1/defconfig $2
> rm -Rf $1
>
> Cc: xe-linux-external@cisco.com
> Signed-off-by: Ruslan Ruslichenko <rruslich@cisco.com>
> Signed-off-by: Ruslan Bilovol <rbilovol@cisco.com>
> Signed-off-by: Daniel Walker <danielwa@cisco.com>
> ---
> arch/powerpc/Kconfig | 38 +------------------
> arch/powerpc/configs/44x/fsp2_defconfig | 32 ++++++++--------
> arch/powerpc/configs/44x/iss476-smp_defconfig | 24 ++++++------
> arch/powerpc/configs/44x/warp_defconfig | 17 ++++-----
> arch/powerpc/configs/holly_defconfig | 13 ++++---
> arch/powerpc/configs/mvme5100_defconfig | 23 +++++------
> arch/powerpc/configs/skiroot_defconfig | 12 +++---
> arch/powerpc/configs/storcenter_defconfig | 18 ++++-----
> arch/powerpc/kernel/prom_init.c | 10 +++--
> 9 files changed, 74 insertions(+), 113 deletions(-)
>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 386ae12d8523..3a19e5b74177 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -167,6 +167,8 @@ config PPC
> select EDAC_SUPPORT
> select GENERIC_ATOMIC64 if PPC32
> select GENERIC_CLOCKEVENTS_BROADCAST if SMP
> + select GENERIC_CMDLINE
> + select GENERIC_CMDLINE_OF
> select GENERIC_CMOS_UPDATE
> select GENERIC_CPU_AUTOPROBE
> select GENERIC_CPU_VULNERABILITIES if PPC_BARRIER_NOSPEC
> @@ -886,42 +888,6 @@ config PPC_DENORMALISATION
> Add support for handling denormalisation of single precision
> values. Useful for bare metal only. If unsure say Y here.
>
> -config CMDLINE
> - string "Initial kernel command string"
> - default ""
> - help
> - On some platforms, there is currently no way for the boot loader to
> - pass arguments to the kernel. For these platforms, you can supply
> - some command-line options at build time by entering them here. In
> - most cases you will need to specify the root device here.
> -
> -choice
> - prompt "Kernel command line type" if CMDLINE != ""
> - default CMDLINE_FROM_BOOTLOADER
> -
> -config CMDLINE_FROM_BOOTLOADER
> - bool "Use bootloader kernel arguments if available"
> - help
> - Uses the command-line options passed by the boot loader. If
> - the boot loader doesn't provide any, the default kernel command
> - string provided in CMDLINE will be used.
> -
> -config CMDLINE_EXTEND
> - bool "Extend bootloader kernel arguments"
> - help
> - The command-line arguments provided by the boot loader will be
> - appended to the default kernel command string.
> -
> -config CMDLINE_FORCE
> - bool "Always use the default kernel command string"
> - help
> - Always use the default kernel command string, even if the boot
> - loader passes other arguments to the kernel.
> - This is useful if you cannot or don't want to change the
> - command-line options your boot loader passes to the kernel.
> -
> -endchoice
> -
> config EXTRA_TARGETS
> string "Additional default image types"
> help
> diff --git a/arch/powerpc/configs/44x/fsp2_defconfig b/arch/powerpc/configs/44x/fsp2_defconfig
> index 8da316e61a08..4993db054589 100644
> --- a/arch/powerpc/configs/44x/fsp2_defconfig
> +++ b/arch/powerpc/configs/44x/fsp2_defconfig
> @@ -1,8 +1,6 @@
> -CONFIG_44x=y
> # CONFIG_SWAP is not set
> CONFIG_SYSVIPC=y
> # CONFIG_CROSS_MEMORY_ATTACH is not set
> -# CONFIG_FHANDLE is not set
> CONFIG_NO_HZ=y
> CONFIG_HIGH_RES_TIMERS=y
> CONFIG_IKCONFIG=y
> @@ -13,23 +11,25 @@ CONFIG_BLK_DEV_INITRD=y
> # CONFIG_RD_XZ is not set
> # CONFIG_RD_LZO is not set
> # CONFIG_RD_LZ4 is not set
> +# CONFIG_FHANDLE is not set
> CONFIG_KALLSYMS_ALL=y
> CONFIG_BPF_SYSCALL=y
> CONFIG_EMBEDDED=y
> CONFIG_PROFILING=y
> -CONFIG_MODULES=y
> -CONFIG_MODULE_UNLOAD=y
> -# CONFIG_BLK_DEV_BSG is not set
> +CONFIG_CMDLINE_BOOL=y
> +CONFIG_CMDLINE_PREPEND="ip=on rw"
> +CONFIG_44x=y
> CONFIG_PPC_47x=y
> # CONFIG_EBONY is not set
> CONFIG_FSP2=y
> CONFIG_476FPE_ERR46=y
> -CONFIG_SWIOTLB=y
> CONFIG_KEXEC=y
> CONFIG_CRASH_DUMP=y
> -CONFIG_CMDLINE="ip=on rw"
> # CONFIG_SUSPEND is not set
> -# CONFIG_PCI is not set
> +CONFIG_OPROFILE=y
> +CONFIG_MODULES=y
> +CONFIG_MODULE_UNLOAD=y
> +# CONFIG_BLK_DEV_BSG is not set
> CONFIG_NET=y
> CONFIG_PACKET=y
> CONFIG_UNIX=y
> @@ -46,14 +46,12 @@ CONFIG_MTD=y
> CONFIG_MTD_BLOCK=y
> CONFIG_MTD_JEDECPROBE=y
> CONFIG_MTD_CFI_AMDSTD=y
> -CONFIG_MTD_PHYSMAP_OF=y
> CONFIG_BLK_DEV_RAM=y
> CONFIG_BLK_DEV_RAM_SIZE=35000
> # CONFIG_SCSI_PROC_FS is not set
> CONFIG_BLK_DEV_SD=y
> # CONFIG_SCSI_LOWLEVEL is not set
> CONFIG_ATA=y
> -# CONFIG_SATA_PMP is not set
> # CONFIG_ATA_SFF is not set
> CONFIG_NETDEVICES=y
> CONFIG_BONDING=m
> @@ -62,7 +60,6 @@ CONFIG_IBM_EMAC=m
> # CONFIG_SERIO is not set
> # CONFIG_VT is not set
> # CONFIG_LEGACY_PTYS is not set
> -# CONFIG_DEVMEM is not set
> CONFIG_SERIAL_8250=y
> CONFIG_SERIAL_8250_CONSOLE=y
> CONFIG_SERIAL_8250_NR_UARTS=32
> @@ -71,6 +68,7 @@ CONFIG_SERIAL_8250_EXTENDED=y
> CONFIG_SERIAL_8250_SHARE_IRQ=y
> CONFIG_SERIAL_OF_PLATFORM=y
> # CONFIG_HW_RANDOM is not set
> +# CONFIG_DEVMEM is not set
> CONFIG_I2C=y
> CONFIG_I2C_IBM_IIC=y
> CONFIG_PTP_1588_CLOCK=y
> @@ -106,6 +104,12 @@ CONFIG_NFS_V3_ACL=y
> CONFIG_NFS_V4=y
> CONFIG_ROOT_NFS=y
> CONFIG_NLS_DEFAULT="n"
> +CONFIG_CRYPTO_CBC=y
> +CONFIG_CRYPTO_ECB=y
> +CONFIG_CRYPTO_PCBC=y
> +CONFIG_CRYPTO_MD5=y
> +CONFIG_CRYPTO_DES=y
> +# CONFIG_CRYPTO_HW is not set
> CONFIG_XZ_DEC=y
> CONFIG_PRINTK_TIME=y
> CONFIG_MESSAGE_LOGLEVEL_DEFAULT=3
> @@ -113,9 +117,3 @@ CONFIG_DYNAMIC_DEBUG=y
> CONFIG_DEBUG_INFO=y
> CONFIG_MAGIC_SYSRQ=y
> CONFIG_DETECT_HUNG_TASK=y
> -CONFIG_CRYPTO_CBC=y
> -CONFIG_CRYPTO_ECB=y
> -CONFIG_CRYPTO_PCBC=y
> -CONFIG_CRYPTO_MD5=y
> -CONFIG_CRYPTO_DES=y
> -# CONFIG_CRYPTO_HW is not set
> diff --git a/arch/powerpc/configs/44x/iss476-smp_defconfig b/arch/powerpc/configs/44x/iss476-smp_defconfig
> index c11e777b2f3d..b8d97061517a 100644
> --- a/arch/powerpc/configs/44x/iss476-smp_defconfig
> +++ b/arch/powerpc/configs/44x/iss476-smp_defconfig
> @@ -1,5 +1,3 @@
> -CONFIG_44x=y
> -CONFIG_SMP=y
> CONFIG_SYSVIPC=y
> CONFIG_POSIX_MQUEUE=y
> CONFIG_LOG_BUF_SHIFT=14
> @@ -7,19 +5,22 @@ CONFIG_BLK_DEV_INITRD=y
> CONFIG_EXPERT=y
> CONFIG_KALLSYMS_ALL=y
> CONFIG_PROFILING=y
> -CONFIG_MODULES=y
> -CONFIG_MODULE_UNLOAD=y
> -# CONFIG_BLK_DEV_BSG is not set
> +CONFIG_CMDLINE_BOOL=y
> +CONFIG_CMDLINE_PREPEND="root=/dev/issblk0"
> +CONFIG_44x=y
> +CONFIG_SMP=y
> CONFIG_PPC_47x=y
> # CONFIG_EBONY is not set
> CONFIG_ISS4xx=y
> CONFIG_HZ_100=y
> CONFIG_MATH_EMULATION=y
> CONFIG_IRQ_ALL_CPUS=y
> -CONFIG_CMDLINE="root=/dev/issblk0"
> -# CONFIG_PCI is not set
> CONFIG_ADVANCED_OPTIONS=y
> CONFIG_DYNAMIC_MEMSTART=y
> +CONFIG_OPROFILE=y
> +CONFIG_MODULES=y
> +CONFIG_MODULE_UNLOAD=y
> +# CONFIG_BLK_DEV_BSG is not set
> CONFIG_NET=y
> CONFIG_PACKET=y
> CONFIG_UNIX=y
> @@ -33,7 +34,6 @@ CONFIG_MTD=y
> CONFIG_MTD_BLOCK=y
> CONFIG_MTD_JEDECPROBE=y
> CONFIG_MTD_CFI_AMDSTD=y
> -CONFIG_MTD_PHYSMAP_OF=y
> CONFIG_BLK_DEV_RAM=y
> CONFIG_BLK_DEV_RAM_SIZE=35000
> # CONFIG_INPUT is not set
> @@ -56,13 +56,13 @@ CONFIG_PROC_KCORE=y
> CONFIG_TMPFS=y
> CONFIG_CRAMFS=y
> # CONFIG_NETWORK_FILESYSTEMS is not set
> -CONFIG_DEBUG_INFO=y
> -CONFIG_MAGIC_SYSRQ=y
> -CONFIG_DETECT_HUNG_TASK=y
> -CONFIG_PPC_EARLY_DEBUG=y
> CONFIG_CRYPTO_CBC=y
> CONFIG_CRYPTO_ECB=y
> CONFIG_CRYPTO_PCBC=y
> CONFIG_CRYPTO_MD5=y
> CONFIG_CRYPTO_DES=y
> # CONFIG_CRYPTO_HW is not set
> +CONFIG_DEBUG_INFO=y
> +CONFIG_MAGIC_SYSRQ=y
> +CONFIG_DETECT_HUNG_TASK=y
> +CONFIG_PPC_EARLY_DEBUG=y
> diff --git a/arch/powerpc/configs/44x/warp_defconfig b/arch/powerpc/configs/44x/warp_defconfig
> index 47252c2d7669..d2e4bbe1492c 100644
> --- a/arch/powerpc/configs/44x/warp_defconfig
> +++ b/arch/powerpc/configs/44x/warp_defconfig
> @@ -1,4 +1,3 @@
> -CONFIG_44x=y
> CONFIG_LOCALVERSION="-pika"
> # CONFIG_LOCALVERSION_AUTO is not set
> CONFIG_SYSVIPC=y
> @@ -7,15 +6,16 @@ CONFIG_IKCONFIG_PROC=y
> CONFIG_LOG_BUF_SHIFT=14
> CONFIG_BLK_DEV_INITRD=y
> CONFIG_EXPERT=y
> -CONFIG_MODULES=y
> -CONFIG_MODULE_UNLOAD=y
> -# CONFIG_BLK_DEV_BSG is not set
> +CONFIG_CMDLINE_BOOL=y
> +CONFIG_CMDLINE_PREPEND="ip=on"
> +CONFIG_44x=y
> # CONFIG_EBONY is not set
> CONFIG_WARP=y
> CONFIG_PPC4xx_GPIO=y
> CONFIG_HZ_1000=y
> -CONFIG_CMDLINE="ip=on"
> -# CONFIG_PCI is not set
> +CONFIG_MODULES=y
> +CONFIG_MODULE_UNLOAD=y
> +# CONFIG_BLK_DEV_BSG is not set
> CONFIG_NET=y
> CONFIG_PACKET=y
> CONFIG_UNIX=y
> @@ -31,7 +31,6 @@ CONFIG_MTD_CMDLINE_PARTS=y
> CONFIG_MTD_BLOCK=y
> CONFIG_MTD_CFI=y
> CONFIG_MTD_CFI_AMDSTD=y
> -CONFIG_MTD_PHYSMAP_OF=y
> CONFIG_MTD_RAW_NAND=y
> CONFIG_MTD_NAND_NDFC=y
> CONFIG_MTD_UBI=y
> @@ -88,9 +87,9 @@ CONFIG_NLS_UTF8=y
> CONFIG_CRC_CCITT=y
> CONFIG_CRC_T10DIF=y
> CONFIG_PRINTK_TIME=y
> +# CONFIG_DEBUG_BUGVERBOSE is not set
> CONFIG_DEBUG_INFO=y
> -CONFIG_DEBUG_FS=y
> CONFIG_MAGIC_SYSRQ=y
> +CONFIG_DEBUG_FS=y
> CONFIG_DETECT_HUNG_TASK=y
> # CONFIG_SCHED_DEBUG is not set
> -# CONFIG_DEBUG_BUGVERBOSE is not set
> diff --git a/arch/powerpc/configs/holly_defconfig b/arch/powerpc/configs/holly_defconfig
> index 271daff47d1d..98c0644e80b4 100644
> --- a/arch/powerpc/configs/holly_defconfig
> +++ b/arch/powerpc/configs/holly_defconfig
> @@ -4,17 +4,18 @@ CONFIG_HIGH_RES_TIMERS=y
> CONFIG_LOG_BUF_SHIFT=14
> CONFIG_BLK_DEV_INITRD=y
> CONFIG_EXPERT=y
> -CONFIG_MODULES=y
> -# CONFIG_BLK_DEV_BSG is not set
> -CONFIG_PARTITION_ADVANCED=y
> +CONFIG_CMDLINE_BOOL=y
> +CONFIG_CMDLINE_PREPEND="console=ttyS0,115200"
> # CONFIG_PPC_CHRP is not set
> # CONFIG_PPC_PMAC is not set
> CONFIG_EMBEDDED6xx=y
> CONFIG_PPC_HOLLY=y
> CONFIG_GEN_RTC=y
> -CONFIG_BINFMT_MISC=y
> -CONFIG_CMDLINE="console=ttyS0,115200"
> # CONFIG_SECCOMP is not set
> +CONFIG_MODULES=y
> +# CONFIG_BLK_DEV_BSG is not set
> +CONFIG_PARTITION_ADVANCED=y
> +CONFIG_BINFMT_MISC=y
> CONFIG_NET=y
> CONFIG_PACKET=y
> CONFIG_UNIX=y
> @@ -53,8 +54,8 @@ CONFIG_PROC_KCORE=y
> CONFIG_TMPFS=y
> CONFIG_NFS_FS=y
> CONFIG_ROOT_NFS=y
> +# CONFIG_DEBUG_BUGVERBOSE is not set
> CONFIG_MAGIC_SYSRQ=y
> # CONFIG_SCHED_DEBUG is not set
> -# CONFIG_DEBUG_BUGVERBOSE is not set
> CONFIG_XMON=y
> CONFIG_XMON_DEFAULT=y
> diff --git a/arch/powerpc/configs/mvme5100_defconfig b/arch/powerpc/configs/mvme5100_defconfig
> index 1fed6be95d53..884a3e0defde 100644
> --- a/arch/powerpc/configs/mvme5100_defconfig
> +++ b/arch/powerpc/configs/mvme5100_defconfig
> @@ -11,16 +11,17 @@ CONFIG_LOG_BUF_SHIFT=14
> # CONFIG_NET_NS is not set
> CONFIG_CC_OPTIMIZE_FOR_SIZE=y
> # CONFIG_COMPAT_BRK is not set
> -CONFIG_MODULES=y
> -CONFIG_MODULE_UNLOAD=y
> -# CONFIG_BLK_DEV_BSG is not set
> +CONFIG_CMDLINE_BOOL=y
> +CONFIG_CMDLINE_PREPEND="console=ttyS0,9600 ip=dhcp root=/dev/nfs"
> # CONFIG_PPC_CHRP is not set
> # CONFIG_PPC_PMAC is not set
> CONFIG_EMBEDDED6xx=y
> CONFIG_MVME5100=y
> CONFIG_KVM_GUEST=y
> CONFIG_HZ_100=y
> -CONFIG_CMDLINE="console=ttyS0,9600 ip=dhcp root=/dev/nfs"
> +CONFIG_MODULES=y
> +CONFIG_MODULE_UNLOAD=y
> +# CONFIG_BLK_DEV_BSG is not set
> # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
> # CONFIG_COMPACTION is not set
> CONFIG_NET=y
> @@ -108,13 +109,6 @@ CONFIG_NLS_CODEPAGE_437=m
> CONFIG_NLS_CODEPAGE_932=m
> CONFIG_NLS_ISO8859_1=m
> CONFIG_NLS_UTF8=m
> -CONFIG_CRC_CCITT=m
> -CONFIG_CRC_T10DIF=y
> -CONFIG_XZ_DEC=y
> -CONFIG_MAGIC_SYSRQ=y
> -CONFIG_DEBUG_KERNEL=y
> -CONFIG_DETECT_HUNG_TASK=y
> -CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=20
> CONFIG_CRYPTO_CBC=y
> CONFIG_CRYPTO_PCBC=m
> CONFIG_CRYPTO_MD5=y
> @@ -125,3 +119,10 @@ CONFIG_CRYPTO_DES=y
> CONFIG_CRYPTO_SERPENT=m
> CONFIG_CRYPTO_TWOFISH=m
> CONFIG_CRYPTO_DEFLATE=m
> +CONFIG_CRC_CCITT=m
> +CONFIG_CRC_T10DIF=y
> +CONFIG_XZ_DEC=y
> +CONFIG_MAGIC_SYSRQ=y
> +CONFIG_DEBUG_KERNEL=y
> +CONFIG_DETECT_HUNG_TASK=y
> +CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=20
> diff --git a/arch/powerpc/configs/skiroot_defconfig b/arch/powerpc/configs/skiroot_defconfig
> index b806a5d3a695..5e11995508d7 100644
> --- a/arch/powerpc/configs/skiroot_defconfig
> +++ b/arch/powerpc/configs/skiroot_defconfig
> @@ -26,6 +26,8 @@ CONFIG_PERF_EVENTS=y
> # CONFIG_SLAB_MERGE_DEFAULT is not set
> CONFIG_SLAB_FREELIST_RANDOM=y
> CONFIG_SLAB_FREELIST_HARDENED=y
> +CONFIG_CMDLINE_BOOL=y
> +CONFIG_CMDLINE_PREPEND="console=tty0 console=hvc0 ipr.fast_reboot=1 quiet"
> CONFIG_PPC64=y
> CONFIG_ALTIVEC=y
> CONFIG_VSX=y
> @@ -42,14 +44,11 @@ CONFIG_KEXEC=y
> CONFIG_KEXEC_FILE=y
> CONFIG_PRESERVE_FA_DUMP=y
> CONFIG_IRQ_ALL_CPUS=y
> -CONFIG_NUMA=y
> CONFIG_PPC_64K_PAGES=y
> CONFIG_SCHED_SMT=y
> -CONFIG_CMDLINE="console=tty0 console=hvc0 ipr.fast_reboot=1 quiet"
> -# CONFIG_SECCOMP is not set
> # CONFIG_PPC_MEM_KEYS is not set
> CONFIG_JUMP_LABEL=y
> -CONFIG_STRICT_KERNEL_RWX=y
> +# CONFIG_SECCOMP is not set
> CONFIG_MODULES=y
> CONFIG_MODULE_UNLOAD=y
> CONFIG_MODULE_SIG_FORCE=y
> @@ -80,7 +79,6 @@ CONFIG_BLK_DEV_NVME=m
> CONFIG_NVME_MULTIPATH=y
> CONFIG_EEPROM_AT24=m
> # CONFIG_CXL is not set
> -# CONFIG_OCXL is not set
> CONFIG_BLK_DEV_SD=m
> CONFIG_BLK_DEV_SR=m
> CONFIG_CHR_DEV_SG=m
> @@ -199,7 +197,6 @@ CONFIG_PHYLIB=y
> CONFIG_INPUT_EVDEV=y
> CONFIG_INPUT_MISC=y
> # CONFIG_SERIO_SERPORT is not set
> -# CONFIG_DEVMEM is not set
> CONFIG_SERIAL_8250=y
> CONFIG_SERIAL_8250_CONSOLE=y
> CONFIG_IPMI_HANDLER=y
> @@ -207,9 +204,10 @@ CONFIG_IPMI_DEVICE_INTERFACE=y
> CONFIG_IPMI_POWERNV=y
> CONFIG_IPMI_WATCHDOG=y
> CONFIG_HW_RANDOM=y
> +# CONFIG_DEVMEM is not set
> +# CONFIG_DEVPORT is not set
> CONFIG_TCG_TPM=y
> CONFIG_TCG_TIS_I2C_NUVOTON=y
> -# CONFIG_DEVPORT is not set
> CONFIG_I2C=y
> # CONFIG_I2C_COMPAT is not set
> CONFIG_I2C_CHARDEV=y
> diff --git a/arch/powerpc/configs/storcenter_defconfig b/arch/powerpc/configs/storcenter_defconfig
> index 47dcfaddc1ac..17a17b8ae160 100644
> --- a/arch/powerpc/configs/storcenter_defconfig
> +++ b/arch/powerpc/configs/storcenter_defconfig
> @@ -2,18 +2,19 @@ CONFIG_SYSVIPC=y
> CONFIG_LOG_BUF_SHIFT=14
> CONFIG_EXPERT=y
> # CONFIG_KALLSYMS is not set
> -CONFIG_MODULES=y
> -CONFIG_MODULE_UNLOAD=y
> -# CONFIG_BLK_DEV_BSG is not set
> -CONFIG_PARTITION_ADVANCED=y
> +CONFIG_CMDLINE_BOOL=y
> +CONFIG_CMDLINE_PREPEND="console=ttyS0,115200"
> # CONFIG_PPC_CHRP is not set
> # CONFIG_PPC_PMAC is not set
> CONFIG_EMBEDDED6xx=y
> CONFIG_STORCENTER=y
> CONFIG_HZ_100=y
> -CONFIG_BINFMT_MISC=y
> -CONFIG_CMDLINE="console=ttyS0,115200"
> # CONFIG_SECCOMP is not set
> +CONFIG_MODULES=y
> +CONFIG_MODULE_UNLOAD=y
> +# CONFIG_BLK_DEV_BSG is not set
> +CONFIG_PARTITION_ADVANCED=y
> +CONFIG_BINFMT_MISC=y
> CONFIG_NET=y
> CONFIG_PACKET=m
> CONFIG_UNIX=y
> @@ -35,7 +36,6 @@ CONFIG_BLK_DEV_SD=y
> CONFIG_BLK_DEV_SR=y
> CONFIG_SCSI_SPI_ATTRS=y
> CONFIG_ATA=y
> -CONFIG_PATA_VIA=y
> CONFIG_MD=y
> CONFIG_BLK_DEV_MD=y
> CONFIG_MD_LINEAR=y
> @@ -44,16 +44,13 @@ CONFIG_MD_RAID1=y
> CONFIG_MD_RAID456=y
> CONFIG_NETDEVICES=y
> CONFIG_DUMMY=m
> -CONFIG_R8169=y
> # CONFIG_INPUT is not set
> # CONFIG_SERIO is not set
> # CONFIG_VT is not set
> CONFIG_SERIAL_8250=y
> CONFIG_SERIAL_8250_CONSOLE=y
> -# CONFIG_SERIAL_8250_PCI is not set
> CONFIG_SERIAL_8250_NR_UARTS=2
> CONFIG_SERIAL_8250_RUNTIME_UARTS=2
> -CONFIG_NVRAM=y
> CONFIG_I2C=y
> CONFIG_I2C_CHARDEV=y
> CONFIG_I2C_MPC=y
> @@ -76,4 +73,3 @@ CONFIG_NLS_CODEPAGE_437=y
> CONFIG_NLS_ISO8859_1=y
> CONFIG_NLS_UTF8=y
> CONFIG_CRC_T10DIF=y
> -# CONFIG_ENABLE_MUST_CHECK is not set
> diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
> index 2c2f33155317..27fece82ff93 100644
> --- a/arch/powerpc/kernel/prom_init.c
> +++ b/arch/powerpc/kernel/prom_init.c
> @@ -27,6 +27,7 @@
> #include <linux/initrd.h>
> #include <linux/bitops.h>
> #include <linux/pgtable.h>
> +#include <linux/cmdline.h>
> #include <asm/prom.h>
> #include <asm/rtas.h>
> #include <asm/page.h>
> @@ -309,6 +310,7 @@ static char __init *prom_strstr(const char *s1, const char *s2)
> return NULL;
> }
>
> +#ifdef GENERIC_CMDLINE_NEED_STRLCAT
> static size_t __init prom_strlcat(char *dest, const char *src, size_t count)
> {
> size_t dsize = prom_strlen(dest);
> @@ -328,6 +330,7 @@ static size_t __init prom_strlcat(char *dest, const char *src, size_t count)
> return res;
>
> }
> +#endif
>
> #ifdef CONFIG_PPC_PSERIES
> static int __init prom_strtobool(const char *s, bool *res)
> @@ -780,12 +783,11 @@ static void __init early_cmdline_parse(void)
> prom_cmd_line[0] = 0;
> p = prom_cmd_line;
>
> - if (!IS_ENABLED(CONFIG_CMDLINE_FORCE) && (long)prom.chosen > 0)
> + if ((long)prom.chosen > 0)
> l = prom_getprop(prom.chosen, "bootargs", p, COMMAND_LINE_SIZE-1);
>
> - if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) || l <= 0 || p[0] == '\0')
> - prom_strlcat(prom_cmd_line, " " CONFIG_CMDLINE,
> - sizeof(prom_cmd_line));
> + cmdline_add_builtin_custom(prom_cmd_line, (l > 0 ? p : NULL), sizeof(prom_cmd_line),
> + __prombss, prom_strlcpy, prom_strlcat);
>
> prom_printf("command line: %s\n", prom_cmd_line);
>
>
^ permalink raw reply
* Re: [PATCH 6/8] drivers: firmware: efi: libstub: enable generic commandline
From: Christophe Leroy @ 2021-04-02 17:36 UTC (permalink / raw)
To: Daniel Walker, Will Deacon, ob Herring, Daniel Gimpelevich,
Andrew Morton, x86, linux-mips, linuxppc-dev
Cc: linux-kernel, linux-efi, Ard Biesheuvel, xe-linux-external
In-Reply-To: <e5d98d566c38d6f8516b8d9d1fd603ec1f131037.1617126961.git.danielwa@cisco.com>
Le 30/03/2021 à 19:57, Daniel Walker a écrit :
> This adds code to handle the generic command line changes.
> The efi code appears that it doesn't benefit as much from this design
> as it could.
>
> For example, if you had a prepend command line with "nokaslr" then
> you might be helpful to re-enable it in the boot loader or dts,
> but there appears to be no way to re-enable kaslr or some of the
> other options.
>
> Cc: xe-linux-external@cisco.com
> Signed-off-by: Daniel Walker <danielwa@cisco.com>
> ---
> .../firmware/efi/libstub/efi-stub-helper.c | 35 +++++++++++++++++++
> drivers/firmware/efi/libstub/efi-stub.c | 7 ++++
> drivers/firmware/efi/libstub/efistub.h | 1 +
> drivers/firmware/efi/libstub/x86-stub.c | 13 +++++--
> 4 files changed, 54 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c
> index aa8da0a49829..c155837cedc9 100644
> --- a/drivers/firmware/efi/libstub/efi-stub-helper.c
> +++ b/drivers/firmware/efi/libstub/efi-stub-helper.c
> @@ -13,6 +13,7 @@
> #include <linux/efi.h>
> #include <linux/kernel.h>
> #include <linux/printk.h> /* For CONSOLE_LOGLEVEL_* */
> +#include <linux/cmdline.h>
> #include <asm/efi.h>
> #include <asm/setup.h>
>
> @@ -172,6 +173,40 @@ int efi_printk(const char *fmt, ...)
> return printed;
> }
>
> +/**
> + * efi_handle_cmdline() - handle adding in building parts of the command line
> + * @cmdline: kernel command line
> + *
> + * Add in the generic parts of the commandline and start the parsing of the
> + * command line.
> + *
> + * Return: status code
> + */
> +efi_status_t efi_handle_cmdline(char const *cmdline)
> +{
> + efi_status_t status;
> +
> + status = efi_parse_options(CMDLINE_PREPEND);
> + if (status != EFI_SUCCESS) {
> + efi_err("Failed to parse options\n");
> + return status;
> + }
> +
> + status = efi_parse_options(IS_ENABLED(CONFIG_CMDLINE_OVERRIDE) ? "" : cmdline);
> + if (status != EFI_SUCCESS) {
> + efi_err("Failed to parse options\n");
> + return status;
> + }
> +
> + status = efi_parse_options(CMDLINE_APPEND);
> + if (status != EFI_SUCCESS) {
> + efi_err("Failed to parse options\n");
> + return status;
> + }
> +
> + return EFI_SUCCESS;
> +}
I think we can refactor to first build the final command line, then call efi_parse_options() only
once after that.
The big advantage of GENERIC_CMDLINE should be to not address anymore CONFIG_CMDLINE_XXX options at
all outside of linux/cmdline.h
> +
> /**
> * efi_parse_options() - Parse EFI command line options
> * @cmdline: kernel command line
> diff --git a/drivers/firmware/efi/libstub/efi-stub.c b/drivers/firmware/efi/libstub/efi-stub.c
> index 26e69788f27a..760480248adf 100644
> --- a/drivers/firmware/efi/libstub/efi-stub.c
> +++ b/drivers/firmware/efi/libstub/efi-stub.c
> @@ -172,6 +172,12 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,
> goto fail;
> }
>
> +#ifdef CONFIG_GENERIC_CMDLINE
> + status = efi_handle_cmdline(cmdline_ptr);
> + if (status != EFI_SUCCESS) {
> + goto fail_free_cmdline;
> + }
> +#else
Why an alternative ?
> if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) ||
> IS_ENABLED(CONFIG_CMDLINE_FORCE) ||
> cmdline_size == 0) {
> @@ -189,6 +195,7 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,
> goto fail_free_cmdline;
> }
> }
> +#endif
>
> efi_info("Booting Linux Kernel...\n");
>
> diff --git a/drivers/firmware/efi/libstub/efistub.h b/drivers/firmware/efi/libstub/efistub.h
> index cde0a2ef507d..07c7f9fdfffc 100644
> --- a/drivers/firmware/efi/libstub/efistub.h
> +++ b/drivers/firmware/efi/libstub/efistub.h
> @@ -800,6 +800,7 @@ efi_status_t efi_relocate_kernel(unsigned long *image_addr,
> unsigned long alignment,
> unsigned long min_addr);
>
> +efi_status_t efi_handle_cmdline(char const *cmdline);
> efi_status_t efi_parse_options(char const *cmdline);
>
> void efi_parse_option_graphics(char *option);
> diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c
> index f14c4ff5839f..30ad8fb7122d 100644
> --- a/drivers/firmware/efi/libstub/x86-stub.c
> +++ b/drivers/firmware/efi/libstub/x86-stub.c
> @@ -673,6 +673,8 @@ unsigned long efi_main(efi_handle_t handle,
> unsigned long bzimage_addr = (unsigned long)startup_32;
> unsigned long buffer_start, buffer_end;
> struct setup_header *hdr = &boot_params->hdr;
> + unsigned long cmdline_paddr = ((u64)hdr->cmd_line_ptr |
> + ((u64)boot_params->ext_cmd_line_ptr << 32));
> efi_status_t status;
>
> efi_system_table = sys_table_arg;
> @@ -735,6 +737,14 @@ unsigned long efi_main(efi_handle_t handle,
> image_offset = 0;
> }
>
> +#ifdef CONFIG_GENERIC_CMDLINE
> + status = efi_handle_cmdline((char *)cmdline_paddr);
> + if (status != EFI_SUCCESS) {
> + efi_err("Failed to parse options\n");
> + goto fail;
> + }
> +#else /* CONFIG_GENERIC_CMDLINE */
> +
> #ifdef CONFIG_CMDLINE_BOOL
> status = efi_parse_options(CONFIG_CMDLINE);
> if (status != EFI_SUCCESS) {
> @@ -743,8 +753,6 @@ unsigned long efi_main(efi_handle_t handle,
> }
> #endif
> if (!IS_ENABLED(CONFIG_CMDLINE_OVERRIDE)) {
> - unsigned long cmdline_paddr = ((u64)hdr->cmd_line_ptr |
> - ((u64)boot_params->ext_cmd_line_ptr << 32));
> status = efi_parse_options((char *)cmdline_paddr);
> if (status != EFI_SUCCESS) {
> efi_err("Failed to parse options\n");
> @@ -752,6 +760,7 @@ unsigned long efi_main(efi_handle_t handle,
> }
> }
>
> +#endif
> /*
> * At this point, an initrd may already have been loaded by the
> * bootloader and passed via bootparams. We permit an initrd loaded
>
^ permalink raw reply
* Re: [PATCH v5 31/48] KVM: PPC: Book3S HV P9: inline kvmhv_load_hv_regs_and_go into __kvmhv_vcpu_entry_p9
From: kernel test robot @ 2021-04-02 20:58 UTC (permalink / raw)
To: Nicholas Piggin, kvm-ppc
Cc: linuxppc-dev, kbuild-all, Nicholas Piggin, Fabiano Rosas
In-Reply-To: <20210401150325.442125-32-npiggin@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 18530 bytes --]
Hi Nicholas,
I love your patch! Yet something to improve:
[auto build test ERROR on powerpc/next]
[also build test ERROR on v5.12-rc5 next-20210401]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Nicholas-Piggin/KVM-PPC-Book3S-C-ify-the-P9-entry-exit-code/20210401-232743
base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc64-randconfig-r033-20210402 (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/f2a35edda3ab6cba30fbfc362e163d5bc1e086d0
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Nicholas-Piggin/KVM-PPC-Book3S-C-ify-the-P9-entry-exit-code/20210401-232743
git checkout f2a35edda3ab6cba30fbfc362e163d5bc1e086d0
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
arch/powerpc/kvm/book3s_hv_interrupt.c: In function 'switch_mmu_to_guest_radix':
arch/powerpc/kvm/book3s_hv_interrupt.c:61:46: error: 'struct kvm_vcpu_arch' has no member named 'nested'
61 | struct kvm_nested_guest *nested = vcpu->arch.nested;
| ^
arch/powerpc/kvm/book3s_hv_interrupt.c:80:2: error: implicit declaration of function 'kvmppc_check_need_tlb_flush' [-Werror=implicit-function-declaration]
80 | kvmppc_check_need_tlb_flush(kvm, vc->pcpu, nested);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from arch/powerpc/include/asm/processor.h:11,
from arch/powerpc/include/asm/thread_info.h:40,
from include/linux/thread_info.h:58,
from include/asm-generic/preempt.h:5,
from ./arch/powerpc/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:78,
from include/linux/percpu.h:6,
from include/linux/context_tracking_state.h:5,
from include/linux/hardirq.h:5,
from include/linux/kvm_host.h:7,
from arch/powerpc/kvm/book3s_hv_interrupt.c:3:
arch/powerpc/kvm/book3s_hv_interrupt.c: In function 'switch_mmu_to_host_radix':
arch/powerpc/kvm/book3s_hv_interrupt.c:88:28: error: 'struct kvm_arch' has no member named 'host_lpid'
88 | mtspr(SPRN_LPID, kvm->arch.host_lpid);
| ^
arch/powerpc/include/asm/reg.h:1393:33: note: in definition of macro 'mtspr'
1393 | : "r" ((unsigned long)(v)) \
| ^
arch/powerpc/kvm/book3s_hv_interrupt.c:90:28: error: 'struct kvm_arch' has no member named 'host_lpcr'
90 | mtspr(SPRN_LPCR, kvm->arch.host_lpcr);
| ^
arch/powerpc/include/asm/reg.h:1393:33: note: in definition of macro 'mtspr'
1393 | : "r" ((unsigned long)(v)) \
| ^
arch/powerpc/kvm/book3s_hv_interrupt.c: At top level:
arch/powerpc/kvm/book3s_hv_interrupt.c:128:5: error: no previous prototype for 'kvmhv_vcpu_entry_p9' [-Werror=missing-prototypes]
128 | int kvmhv_vcpu_entry_p9(struct kvm_vcpu *vcpu, u64 time_limit, unsigned long lpcr)
| ^~~~~~~~~~~~~~~~~~~
arch/powerpc/kvm/book3s_hv_interrupt.c: In function 'kvmhv_vcpu_entry_p9':
>> arch/powerpc/kvm/book3s_hv_interrupt.c:170:25: error: 'struct kvmppc_host_state' has no member named 'host_purr'; did you mean 'host_r1'?
170 | local_paca->kvm_hstate.host_purr = mfspr(SPRN_PURR);
| ^~~~~~~~~
| host_r1
>> arch/powerpc/kvm/book3s_hv_interrupt.c:171:25: error: 'struct kvmppc_host_state' has no member named 'host_spurr'; did you mean 'host_r1'?
171 | local_paca->kvm_hstate.host_spurr = mfspr(SPRN_SPURR);
| ^~~~~~~~~~
| host_r1
In file included from arch/powerpc/include/asm/processor.h:11,
from arch/powerpc/include/asm/thread_info.h:40,
from include/linux/thread_info.h:58,
from include/asm-generic/preempt.h:5,
from ./arch/powerpc/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:78,
from include/linux/percpu.h:6,
from include/linux/context_tracking_state.h:5,
from include/linux/hardirq.h:5,
from include/linux/kvm_host.h:7,
from arch/powerpc/kvm/book3s_hv_interrupt.c:3:
>> arch/powerpc/kvm/book3s_hv_interrupt.c:187:31: error: 'struct kvmppc_host_state' has no member named 'fake_suspend'
187 | (local_paca->kvm_hstate.fake_suspend << PSSCR_FAKE_SUSPEND_LG));
| ^
arch/powerpc/include/asm/reg.h:1393:33: note: in definition of macro 'mtspr'
1393 | : "r" ((unsigned long)(v)) \
| ^
arch/powerpc/kvm/book3s_hv_interrupt.c:191:31: error: 'struct kvm_vcpu_arch' has no member named 'shregs'; did you mean 'regs'?
191 | mtspr(SPRN_SPRG0, vcpu->arch.shregs.sprg0);
| ^~~~~~
arch/powerpc/include/asm/reg.h:1393:33: note: in definition of macro 'mtspr'
1393 | : "r" ((unsigned long)(v)) \
| ^
arch/powerpc/kvm/book3s_hv_interrupt.c:192:31: error: 'struct kvm_vcpu_arch' has no member named 'shregs'; did you mean 'regs'?
192 | mtspr(SPRN_SPRG1, vcpu->arch.shregs.sprg1);
| ^~~~~~
arch/powerpc/include/asm/reg.h:1393:33: note: in definition of macro 'mtspr'
1393 | : "r" ((unsigned long)(v)) \
| ^
arch/powerpc/kvm/book3s_hv_interrupt.c:193:31: error: 'struct kvm_vcpu_arch' has no member named 'shregs'; did you mean 'regs'?
193 | mtspr(SPRN_SPRG2, vcpu->arch.shregs.sprg2);
| ^~~~~~
arch/powerpc/include/asm/reg.h:1393:33: note: in definition of macro 'mtspr'
1393 | : "r" ((unsigned long)(v)) \
| ^
arch/powerpc/kvm/book3s_hv_interrupt.c:194:31: error: 'struct kvm_vcpu_arch' has no member named 'shregs'; did you mean 'regs'?
194 | mtspr(SPRN_SPRG3, vcpu->arch.shregs.sprg3);
| ^~~~~~
arch/powerpc/include/asm/reg.h:1393:33: note: in definition of macro 'mtspr'
1393 | : "r" ((unsigned long)(v)) \
| ^
arch/powerpc/kvm/book3s_hv_interrupt.c:206:30: error: 'struct kvm_vcpu_arch' has no member named 'shregs'; did you mean 'regs'?
206 | mtspr(SPRN_SRR0, vcpu->arch.shregs.srr0);
| ^~~~~~
arch/powerpc/include/asm/reg.h:1393:33: note: in definition of macro 'mtspr'
1393 | : "r" ((unsigned long)(v)) \
| ^
arch/powerpc/kvm/book3s_hv_interrupt.c:207:30: error: 'struct kvm_vcpu_arch' has no member named 'shregs'; did you mean 'regs'?
207 | mtspr(SPRN_SRR1, vcpu->arch.shregs.srr1);
| ^~~~~~
arch/powerpc/include/asm/reg.h:1393:33: note: in definition of macro 'mtspr'
1393 | : "r" ((unsigned long)(v)) \
| ^
In file included from arch/powerpc/include/asm/bug.h:109,
from include/linux/bug.h:5,
from include/linux/mmdebug.h:5,
from include/linux/percpu.h:5,
from include/linux/context_tracking_state.h:5,
from include/linux/hardirq.h:5,
from include/linux/kvm_host.h:7,
from arch/powerpc/kvm/book3s_hv_interrupt.c:3:
arch/powerpc/kvm/book3s_hv_interrupt.c:213:26: error: 'struct kvm_vcpu_arch' has no member named 'shregs'; did you mean 'regs'?
213 | WARN_ON_ONCE(vcpu->arch.shregs.msr & MSR_HV);
| ^~~~~~
include/asm-generic/bug.h:102:25: note: in definition of macro 'WARN_ON_ONCE'
102 | int __ret_warn_on = !!(condition); \
| ^~~~~~~~~
arch/powerpc/kvm/book3s_hv_interrupt.c:214:28: error: 'struct kvm_vcpu_arch' has no member named 'shregs'; did you mean 'regs'?
214 | WARN_ON_ONCE(!(vcpu->arch.shregs.msr & MSR_ME));
| ^~~~~~
include/asm-generic/bug.h:102:25: note: in definition of macro 'WARN_ON_ONCE'
102 | int __ret_warn_on = !!(condition); \
| ^~~~~~~~~
In file included from arch/powerpc/include/asm/processor.h:11,
from arch/powerpc/include/asm/thread_info.h:40,
from include/linux/thread_info.h:58,
from include/asm-generic/preempt.h:5,
from ./arch/powerpc/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:78,
from include/linux/percpu.h:6,
from include/linux/context_tracking_state.h:5,
from include/linux/hardirq.h:5,
from include/linux/kvm_host.h:7,
from arch/powerpc/kvm/book3s_hv_interrupt.c:3:
arch/powerpc/kvm/book3s_hv_interrupt.c:217:32: error: 'struct kvm_vcpu_arch' has no member named 'shregs'; did you mean 'regs'?
217 | mtspr(SPRN_HSRR1, (vcpu->arch.shregs.msr & ~MSR_HV) | MSR_ME);
| ^~~~~~
arch/powerpc/include/asm/reg.h:1393:33: note: in definition of macro 'mtspr'
1393 | : "r" ((unsigned long)(v)) \
| ^
arch/powerpc/kvm/book3s_hv_interrupt.c:244:13: error: 'struct kvm_vcpu_arch' has no member named 'shregs'; did you mean 'regs'?
244 | vcpu->arch.shregs.srr0 = mfspr(SPRN_SRR0);
| ^~~~~~
| regs
arch/powerpc/kvm/book3s_hv_interrupt.c:245:13: error: 'struct kvm_vcpu_arch' has no member named 'shregs'; did you mean 'regs'?
245 | vcpu->arch.shregs.srr1 = mfspr(SPRN_SRR1);
| ^~~~~~
| regs
arch/powerpc/kvm/book3s_hv_interrupt.c:246:13: error: 'struct kvm_vcpu_arch' has no member named 'shregs'; did you mean 'regs'?
246 | vcpu->arch.shregs.dar = mfspr(SPRN_DAR);
| ^~~~~~
| regs
arch/powerpc/kvm/book3s_hv_interrupt.c:247:13: error: 'struct kvm_vcpu_arch' has no member named 'shregs'; did you mean 'regs'?
247 | vcpu->arch.shregs.dsisr = mfspr(SPRN_DSISR);
| ^~~~~~
| regs
arch/powerpc/kvm/book3s_hv_interrupt.c:281:13: error: 'struct kvm_vcpu_arch' has no member named 'emul_inst'
281 | vcpu->arch.emul_inst = mfspr(SPRN_HEIR);
| ^
In file included from arch/powerpc/include/asm/processor.h:11,
from arch/powerpc/include/asm/thread_info.h:40,
from include/linux/thread_info.h:58,
vim +170 arch/powerpc/kvm/book3s_hv_interrupt.c
127
128 int kvmhv_vcpu_entry_p9(struct kvm_vcpu *vcpu, u64 time_limit, unsigned long lpcr)
129 {
130 struct kvm *kvm = vcpu->kvm;
131 struct kvmppc_vcore *vc = vcpu->arch.vcore;
132 s64 hdec;
133 u64 tb, purr, spurr;
134 u64 *exsave;
135 unsigned long msr = mfmsr();
136 int trap;
137 unsigned long host_hfscr = mfspr(SPRN_HFSCR);
138 unsigned long host_ciabr = mfspr(SPRN_CIABR);
139 unsigned long host_dawr0 = mfspr(SPRN_DAWR0);
140 unsigned long host_dawrx0 = mfspr(SPRN_DAWRX0);
141 unsigned long host_psscr = mfspr(SPRN_PSSCR);
142 unsigned long host_pidr = mfspr(SPRN_PID);
143 unsigned long host_dawr1 = 0;
144 unsigned long host_dawrx1 = 0;
145
146 if (cpu_has_feature(CPU_FTR_DAWR1)) {
147 host_dawr1 = mfspr(SPRN_DAWR1);
148 host_dawrx1 = mfspr(SPRN_DAWRX1);
149 }
150
151 tb = mftb();
152 hdec = time_limit - tb;
153 if (hdec < 0)
154 return BOOK3S_INTERRUPT_HV_DECREMENTER;
155
156 if (vc->tb_offset) {
157 u64 new_tb = tb + vc->tb_offset;
158 mtspr(SPRN_TBU40, new_tb);
159 tb = mftb();
160 if ((tb & 0xffffff) < (new_tb & 0xffffff))
161 mtspr(SPRN_TBU40, new_tb + 0x1000000);
162 vc->tb_offset_applied = vc->tb_offset;
163 }
164
165 if (vc->pcr)
166 mtspr(SPRN_PCR, vc->pcr | PCR_MASK);
167 mtspr(SPRN_DPDES, vc->dpdes);
168 mtspr(SPRN_VTB, vc->vtb);
169
> 170 local_paca->kvm_hstate.host_purr = mfspr(SPRN_PURR);
> 171 local_paca->kvm_hstate.host_spurr = mfspr(SPRN_SPURR);
172 mtspr(SPRN_PURR, vcpu->arch.purr);
173 mtspr(SPRN_SPURR, vcpu->arch.spurr);
174
175 if (dawr_enabled()) {
176 mtspr(SPRN_DAWR0, vcpu->arch.dawr0);
177 mtspr(SPRN_DAWRX0, vcpu->arch.dawrx0);
178 if (cpu_has_feature(CPU_FTR_DAWR1)) {
179 mtspr(SPRN_DAWR1, vcpu->arch.dawr1);
180 mtspr(SPRN_DAWRX1, vcpu->arch.dawrx1);
181 }
182 }
183 mtspr(SPRN_CIABR, vcpu->arch.ciabr);
184 mtspr(SPRN_IC, vcpu->arch.ic);
185
186 mtspr(SPRN_PSSCR, vcpu->arch.psscr | PSSCR_EC |
> 187 (local_paca->kvm_hstate.fake_suspend << PSSCR_FAKE_SUSPEND_LG));
188
189 mtspr(SPRN_HFSCR, vcpu->arch.hfscr);
190
191 mtspr(SPRN_SPRG0, vcpu->arch.shregs.sprg0);
192 mtspr(SPRN_SPRG1, vcpu->arch.shregs.sprg1);
193 mtspr(SPRN_SPRG2, vcpu->arch.shregs.sprg2);
194 mtspr(SPRN_SPRG3, vcpu->arch.shregs.sprg3);
195
196 mtspr(SPRN_AMOR, ~0UL);
197
198 switch_mmu_to_guest_radix(kvm, vcpu, lpcr);
199
200 /*
201 * P9 suppresses the HDEC exception when LPCR[HDICE] = 0,
202 * so set guest LPCR (with HDICE) before writing HDEC.
203 */
204 mtspr(SPRN_HDEC, hdec);
205
206 mtspr(SPRN_SRR0, vcpu->arch.shregs.srr0);
207 mtspr(SPRN_SRR1, vcpu->arch.shregs.srr1);
208
209 start_timing(vcpu, &vcpu->arch.rm_entry);
210
211 vcpu->arch.ceded = 0;
212
213 WARN_ON_ONCE(vcpu->arch.shregs.msr & MSR_HV);
214 WARN_ON_ONCE(!(vcpu->arch.shregs.msr & MSR_ME));
215
216 mtspr(SPRN_HSRR0, vcpu->arch.regs.nip);
217 mtspr(SPRN_HSRR1, (vcpu->arch.shregs.msr & ~MSR_HV) | MSR_ME);
218
219 /*
220 * On POWER9 DD2.1 and below, sometimes on a Hypervisor Data Storage
221 * Interrupt (HDSI) the HDSISR is not be updated at all.
222 *
223 * To work around this we put a canary value into the HDSISR before
224 * returning to a guest and then check for this canary when we take a
225 * HDSI. If we find the canary on a HDSI, we know the hardware didn't
226 * update the HDSISR. In this case we return to the guest to retake the
227 * HDSI which should correctly update the HDSISR the second time HDSI
228 * entry.
229 *
230 * Just do this on all p9 processors for now.
231 */
232 mtspr(SPRN_HDSISR, HDSISR_CANARY);
233
234 accumulate_time(vcpu, &vcpu->arch.guest_time);
235
236 local_paca->kvm_hstate.in_guest = KVM_GUEST_MODE_GUEST_HV_FAST;
237 kvmppc_p9_enter_guest(vcpu);
238 // Radix host and guest means host never runs with guest MMU state
239 local_paca->kvm_hstate.in_guest = KVM_GUEST_MODE_NONE;
240
241 accumulate_time(vcpu, &vcpu->arch.rm_intr);
242
243 /* Get these from r11/12 and paca exsave */
244 vcpu->arch.shregs.srr0 = mfspr(SPRN_SRR0);
245 vcpu->arch.shregs.srr1 = mfspr(SPRN_SRR1);
246 vcpu->arch.shregs.dar = mfspr(SPRN_DAR);
247 vcpu->arch.shregs.dsisr = mfspr(SPRN_DSISR);
248
249 /* 0x2 bit for HSRR is only used by PR and P7/8 HV paths, clear it */
250 trap = local_paca->kvm_hstate.scratch0 & ~0x2;
251 if (likely(trap > BOOK3S_INTERRUPT_MACHINE_CHECK)) {
252 exsave = local_paca->exgen;
253 } else if (trap == BOOK3S_INTERRUPT_SYSTEM_RESET) {
254 exsave = local_paca->exnmi;
255 } else { /* trap == 0x200 */
256 exsave = local_paca->exmc;
257 }
258
259 vcpu->arch.regs.gpr[1] = local_paca->kvm_hstate.scratch1;
260 vcpu->arch.regs.gpr[3] = local_paca->kvm_hstate.scratch2;
261 vcpu->arch.regs.gpr[9] = exsave[EX_R9/sizeof(u64)];
262 vcpu->arch.regs.gpr[10] = exsave[EX_R10/sizeof(u64)];
263 vcpu->arch.regs.gpr[11] = exsave[EX_R11/sizeof(u64)];
264 vcpu->arch.regs.gpr[12] = exsave[EX_R12/sizeof(u64)];
265 vcpu->arch.regs.gpr[13] = exsave[EX_R13/sizeof(u64)];
266 vcpu->arch.ppr = exsave[EX_PPR/sizeof(u64)];
267 vcpu->arch.cfar = exsave[EX_CFAR/sizeof(u64)];
268 vcpu->arch.regs.ctr = exsave[EX_CTR/sizeof(u64)];
269
270 vcpu->arch.last_inst = KVM_INST_FETCH_FAILED;
271
272 if (unlikely(trap == BOOK3S_INTERRUPT_MACHINE_CHECK)) {
273 vcpu->arch.fault_dar = exsave[EX_DAR/sizeof(u64)];
274 vcpu->arch.fault_dsisr = exsave[EX_DSISR/sizeof(u64)];
275 kvmppc_realmode_machine_check(vcpu);
276
277 } else if (unlikely(trap == BOOK3S_INTERRUPT_HMI)) {
278 kvmppc_realmode_hmi_handler();
279
280 } else if (trap == BOOK3S_INTERRUPT_H_EMUL_ASSIST) {
281 vcpu->arch.emul_inst = mfspr(SPRN_HEIR);
282
283 } else if (trap == BOOK3S_INTERRUPT_H_DATA_STORAGE) {
284 vcpu->arch.fault_dar = exsave[EX_DAR/sizeof(u64)];
285 vcpu->arch.fault_dsisr = exsave[EX_DSISR/sizeof(u64)];
286 vcpu->arch.fault_gpa = mfspr(SPRN_ASDR);
287
288 } else if (trap == BOOK3S_INTERRUPT_H_INST_STORAGE) {
289 vcpu->arch.fault_gpa = mfspr(SPRN_ASDR);
290
291 } else if (trap == BOOK3S_INTERRUPT_H_FAC_UNAVAIL) {
292 vcpu->arch.hfscr = mfspr(SPRN_HFSCR);
293
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 27150 bytes --]
^ permalink raw reply
* Re: [PATCH 04/14] powerpc/64s: avoid reloading (H)SRR registers if they are still valid
From: Michael Ellerman @ 2021-04-02 22:39 UTC (permalink / raw)
To: Nicholas Piggin, linuxppc-dev; +Cc: Nicholas Piggin
In-Reply-To: <20210315220402.260594-5-npiggin@gmail.com>
Nicholas Piggin <npiggin@gmail.com> writes:
> When an interrupt is taken, the SRR registers are set to return to
> where it left off. Unless they are modified in the meantime, or the
> return address or MSR are modified, there is no need to reload these
> registers when returning from interrupt.
>
> Introduce per-CPU flags that track the validity of SRR and HSRR
> registers, clear them when returning from interrupt, using the registers
> for something else (e.g., OPAL calls), or adjusting return address or MSR.
>
> This improves the performance of interrupt returns.
>
> XXX: may not need to invalidate both hsrr and srr all the time
>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
I needed something like below to get 32-bit building.
cheers
diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h
index 6d6237e0cbd7..7f9bbd19db10 100644
--- a/arch/powerpc/include/asm/ptrace.h
+++ b/arch/powerpc/include/asm/ptrace.h
@@ -153,15 +153,21 @@ static inline void regs_set_return_value(struct pt_regs *regs, unsigned long rc)
regs->gpr[3] = rc;
}
-static inline void regs_set_return_ip(struct pt_regs *regs, unsigned long ip)
+static inline void invalidate_srrs(void)
{
- regs->nip = ip;
#ifdef CONFIG_PPC_BOOK3S_64
+ // XXX: We may not need to invalidate both hsrr and srr all the time
local_paca->hsrr_valid = 0;
local_paca->srr_valid = 0;
#endif
}
+static inline void regs_set_return_ip(struct pt_regs *regs, unsigned long ip)
+{
+ regs->nip = ip;
+ invalidate_srrs();
+}
+
static inline void regs_add_return_ip(struct pt_regs *regs, long offset)
{
regs_set_return_ip(regs, regs->nip + offset);
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 200b4805f999..82623b57e2d6 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -98,8 +98,7 @@ static void check_if_tm_restore_required(struct task_struct *tsk)
!test_thread_flag(TIF_RESTORE_TM)) {
tsk->thread.ckpt_regs.msr = tsk->thread.regs->msr;
set_thread_flag(TIF_RESTORE_TM);
- local_paca->hsrr_valid = 0;
- local_paca->srr_valid = 0;
+ invalidate_srrs();
}
}
@@ -164,8 +163,7 @@ static void __giveup_fpu(struct task_struct *tsk)
if (cpu_has_feature(CPU_FTR_VSX))
msr &= ~MSR_VSX;
tsk->thread.regs->msr = msr;
- local_paca->hsrr_valid = 0;
- local_paca->srr_valid = 0;
+ invalidate_srrs();
}
void giveup_fpu(struct task_struct *tsk)
@@ -249,8 +247,7 @@ static void __giveup_altivec(struct task_struct *tsk)
if (cpu_has_feature(CPU_FTR_VSX))
msr &= ~MSR_VSX;
tsk->thread.regs->msr = msr;
- local_paca->hsrr_valid = 0;
- local_paca->srr_valid = 0;
+ invalidate_srrs();
}
void giveup_altivec(struct task_struct *tsk)
@@ -566,8 +563,7 @@ void notrace restore_math(struct pt_regs *regs)
msr_check_and_clear(new_msr);
regs->msr |= new_msr | fpexc_mode;
- local_paca->hsrr_valid = 0;
- local_paca->srr_valid = 0;
+ invalidate_srrs();
}
}
#endif /* CONFIG_PPC_BOOK3S_64 */
@@ -1293,8 +1289,7 @@ struct task_struct *__switch_to(struct task_struct *prev,
atomic_read(¤t->mm->context.vas_windows)))
asm volatile(PPC_CP_ABORT);
}
- local_paca->hsrr_valid = 0;
- local_paca->srr_valid = 0;
+ invalidate_srrs();
#endif /* CONFIG_PPC_BOOK3S_64 */
return last;
@@ -1884,8 +1879,7 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp)
current->thread.load_tm = 0;
#endif /* CONFIG_PPC_TRANSACTIONAL_MEM */
- local_paca->hsrr_valid = 0;
- local_paca->srr_valid = 0;
+ invalidate_srrs();
}
EXPORT_SYMBOL(start_thread);
@@ -1936,8 +1930,7 @@ int set_fpexc_mode(struct task_struct *tsk, unsigned int val)
if (regs != NULL && (regs->msr & MSR_FP) != 0) {
regs->msr = (regs->msr & ~(MSR_FE0|MSR_FE1))
| tsk->thread.fpexc_mode;
- local_paca->hsrr_valid = 0;
- local_paca->srr_valid = 0;
+ invalidate_srrs();
}
return 0;
}
@@ -1990,8 +1983,7 @@ int set_endian(struct task_struct *tsk, unsigned int val)
else
return -EINVAL;
- local_paca->hsrr_valid = 0;
- local_paca->srr_valid = 0;
+ invalidate_srrs();
return 0;
}
diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
index 4cb38afa28a8..9d1d6070a516 100644
--- a/arch/powerpc/kernel/syscalls.c
+++ b/arch/powerpc/kernel/syscalls.c
@@ -115,8 +115,8 @@ SYSCALL_DEFINE0(switch_endian)
struct thread_info *ti;
current->thread.regs->msr ^= MSR_LE;
- local_paca->hsrr_valid = 0;
- local_paca->srr_valid = 0;
+
+ invalidate_srrs();
/*
* Set TIF_RESTOREALL so that r3 isn't clobbered on return to
diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
index 96505d4bba1c..2b94bf21d6ae 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -3480,8 +3480,7 @@ int emulate_step(struct pt_regs *regs, struct ppc_inst instr)
unsigned long val;
unsigned long ea;
- local_paca->hsrr_valid = 0;
- local_paca->srr_valid = 0;
+ invalidate_srrs();
r = analyse_instr(&op, regs, instr);
if (r < 0)
^ permalink raw reply related
* [PATCH] powerpc/dts: fix not include DTC_FLAGS
From: Youlin Song @ 2021-04-03 2:04 UTC (permalink / raw)
To: robh+dt, mpe, benh, paulus
Cc: devicetree, linuxppc-dev, linux-kernel, Youlin Song
I wanted to build the fsl dts in my machine and found that
the dtb have not extra space,so uboot will cause about
FDT_ERR_NOSPACE issue.
Signed-off-by: Youlin Song <syl.loop@gmail.com>
---
arch/powerpc/boot/dts/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/boot/dts/Makefile b/arch/powerpc/boot/dts/Makefile
index fb335d05aae8..c21165c0cd76 100644
--- a/arch/powerpc/boot/dts/Makefile
+++ b/arch/powerpc/boot/dts/Makefile
@@ -2,5 +2,6 @@
subdir-y += fsl
+DTC_FLAGS ?= -p 1024
dtstree := $(srctree)/$(src)
dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard $(dtstree)/*.dts))
--
2.25.1
^ permalink raw reply related
* Re: [PATCH 04/14] powerpc/64s: avoid reloading (H)SRR registers if they are still valid
From: Michael Ellerman @ 2021-04-03 2:28 UTC (permalink / raw)
To: Nicholas Piggin, linuxppc-dev; +Cc: Nicholas Piggin
In-Reply-To: <20210315220402.260594-5-npiggin@gmail.com>
Nicholas Piggin <npiggin@gmail.com> writes:
> diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
> index ccf913cedd29..b466b3e1bb3f 100644
> --- a/arch/powerpc/kernel/entry_64.S
> +++ b/arch/powerpc/kernel/entry_64.S
> @@ -64,6 +64,30 @@ exception_marker:
> .section ".text"
> .align 7
>
> +.macro DEBUG_SRR_VALID srr
> +#ifdef CONFIG_PPC_RFI_SRR_DEBUG
> + .ifc \srr,srr
> + mfspr r11,SPRN_SRR0
> + ld r12,_NIP(r1)
> +100: tdne r11,r12
> + EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE)
This always points at *this* line, not the caller. Works better with the
patch below.
cheers
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index b466b3e1bb3f..ada76b1279f9 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -64,26 +64,26 @@
.section ".text"
.align 7
-.macro DEBUG_SRR_VALID srr
+.macro DEBUG_SRR_VALID srr line
#ifdef CONFIG_PPC_RFI_SRR_DEBUG
.ifc \srr,srr
mfspr r11,SPRN_SRR0
ld r12,_NIP(r1)
100: tdne r11,r12
- EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE)
+ EMIT_BUG_ENTRY 100b,__FILE__,\line,(BUGFLAG_WARNING | BUGFLAG_ONCE)
mfspr r11,SPRN_SRR1
ld r12,_MSR(r1)
100: tdne r11,r12
- EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE)
+ EMIT_BUG_ENTRY 100b,__FILE__,\line,(BUGFLAG_WARNING | BUGFLAG_ONCE)
.else
mfspr r11,SPRN_HSRR0
ld r12,_NIP(r1)
100: tdne r11,r12
- EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE)
+ EMIT_BUG_ENTRY 100b,__FILE__,\line,(BUGFLAG_WARNING | BUGFLAG_ONCE)
mfspr r11,SPRN_HSRR1
ld r12,_MSR(r1)
100: tdne r11,r12
- EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE)
+ EMIT_BUG_ENTRY 100b,__FILE__,\line,(BUGFLAG_WARNING | BUGFLAG_ONCE)
.endif
#endif
.endm
@@ -358,7 +358,7 @@ END_BTB_FLUSH_SECTION
mtspr SPRN_SRR0,r4
mtspr SPRN_SRR1,r5
1:
- DEBUG_SRR_VALID srr
+ DEBUG_SRR_VALID srr __LINE__
BEGIN_FTR_SECTION
stdcx. r0,0,r1 /* to clear the reservation */
@@ -753,7 +753,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)
stb r4,PACAHSRR_VALID(r13)
#endif
.endif
- DEBUG_SRR_VALID \srr
+ DEBUG_SRR_VALID \srr __LINE__
BEGIN_FTR_SECTION
stdcx. r0,0,r1 /* to clear the reservation */
@@ -825,7 +825,7 @@ ALT_FTR_SECTION_END_IFCLR(CPU_FTR_STCX_CHECKS_ADDRESS)
stb r4,PACAHSRR_VALID(r13)
#endif
.endif
- DEBUG_SRR_VALID \srr
+ DEBUG_SRR_VALID \srr __LINE__
BEGIN_FTR_SECTION
stdcx. r0,0,r1 /* to clear the reservation */
^ permalink raw reply related
* [GIT PULL] Please pull powerpc/linux.git powerpc-5.12-5 tag
From: Michael Ellerman @ 2021-04-03 11:48 UTC (permalink / raw)
To: Linus Torvalds; +Cc: nathanl, aneesh.kumar, linuxppc-dev, linux-kernel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Hi Linus,
Please pull some more powerpc fixes for 5.12:
The following changes since commit cc7a0bb058b85ea03db87169c60c7cfdd5d34678:
PCI: rpadlpar: Fix potential drc_name corruption in store functions (2021-03-17 13:48:07 +1100)
are available in the git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git tags/powerpc-5.12-5
for you to fetch changes up to 53f1d31708f6240e4615b0927df31f182e389e2f:
powerpc/mm/book3s64: Use the correct storage key value when calling H_PROTECT (2021-03-26 22:19:39 +1100)
- ------------------------------------------------------------------
powerpc fixes for 5.12 #5
Fix a bug on pseries where spurious wakeups from H_PROD would prevent partition migration
from succeeding.
Fix oopses seen in pcpu_alloc(), caused by parallel faults of the percpu mapping causing
us to corrupt the protection key used for the mapping, and cause a fatal key fault.
Thanks to Aneesh Kumar K.V, Murilo Opsfelder Araujo, Nathan Lynch.
- ------------------------------------------------------------------
Aneesh Kumar K.V (1):
powerpc/mm/book3s64: Use the correct storage key value when calling H_PROTECT
Nathan Lynch (2):
powerpc/pseries/mobility: use struct for shared state
powerpc/pseries/mobility: handle premature return from H_JOIN
arch/powerpc/platforms/pseries/lpar.c | 3 +-
arch/powerpc/platforms/pseries/mobility.c | 48 ++++++++++++++++++--
2 files changed, 46 insertions(+), 5 deletions(-)
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEEJFGtCPCthwEv2Y/bUevqPMjhpYAFAmBoVTsACgkQUevqPMjh
pYDlFxAAkkiy2RiHbaAlWHpVekXVQN1/oRISHQ+9jRco3BQUAEq8wHJNrlArnab6
N7C/ig2SiugagpLelRsXeXWyM54U3syIQnX3NRg82PgUBxU/LGJmIcyWCgDIf9x0
/xbMrWcRMuzY1x916rX7MPuSVc8LcyVu9nByBrbFWNE6IqUrJ0ngrBNNsEyWbEf/
NBHYqUzpurXYv/OHEPOQu9GIOWej5SR8oOKGn3/aJ66cg3WoC7iC56seBjSIrcLe
zwhUenwRYM6YQ6boX0OBKs/NaPSeT9qy4JyZOe0Sqeo0Yvhj4VJs9W0napIYQde5
y6ieoyHk33xPawUWiTEtkLmvH2nZPVRXCfGOQmh5B4mvuS/rrv6hTeFkdLFZ74yJ
Fuan/ljnXSPTkT+xRITrOO/irZyTaRXJ4j0Ck3LrtluUFib9psf+OqtoIiqqy11w
u+E8T1GChRZTuy2iMZy1jiyvmKwa/S5v67YUU2xUXNYeRI8j3g3cPo/W9Skn3TS2
LiO5+/6Ws1ABn7TohGV2R7sTPu5AnJP7jyHVJuDbtf/Z79U1SMiNAOb8jA/8WNbW
0NtLSQsy1PHonsqUIJgJntmstA46Xnsr1ruA2wR7GEuaaBrjSynw9cG55KlA4Lug
16kaOFPBnJhvkgjTDI7Xl7+ktr4yuR5EriDI0wJMqbhxn+IJ5VM=
=9cfb
-----END PGP SIGNATURE-----
^ permalink raw reply
* Re: [PATCH] powerpc/ptrace: Don't return error when getting/setting FP regs without CONFIG_PPC_FPU_REGS
From: Michael Ellerman @ 2021-04-03 11:51 UTC (permalink / raw)
To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras,
Michael Ellerman
Cc: linuxppc-dev, linux-kernel
In-Reply-To: <9121a44a2d50ba1af18d8aa5ada06c9a3bea8afd.1617200085.git.christophe.leroy@csgroup.eu>
On Wed, 31 Mar 2021 14:14:58 +0000 (UTC), Christophe Leroy wrote:
> An #ifdef CONFIG_PPC_FPU_REGS is missing in arch_ptrace() leading
> to the following Oops because [REGSET_FPR] entry is not initialised in
> native_regsets[].
>
> [ 41.917608] BUG: Unable to handle kernel instruction fetch
> [ 41.922849] Faulting instruction address: 0xff8fd228
> [ 41.927760] Oops: Kernel access of bad area, sig: 11 [#1]
> [ 41.933089] BE PAGE_SIZE=4K PREEMPT CMPC885
> [ 41.940753] Modules linked in:
> [ 41.943768] CPU: 0 PID: 366 Comm: gdb Not tainted 5.12.0-rc5-s3k-dev-01666-g7aac86a0f057-dirty #4835
> [ 41.952800] NIP: ff8fd228 LR: c004d9e0 CTR: ff8fd228
> [ 41.957790] REGS: caae9df0 TRAP: 0400 Not tainted (5.12.0-rc5-s3k-dev-01666-g7aac86a0f057-dirty)
> [ 41.966741] MSR: 40009032 <EE,ME,IR,DR,RI> CR: 82004248 XER: 20000000
> [ 41.973540]
> [ 41.973540] GPR00: c004d9b4 caae9eb0 c1b64f60 c1b64520 c0713cd4 caae9eb8 c1bacdfc 00000004
> [ 41.973540] GPR08: 00000200 ff8fd228 c1bac700 00001032 28004242 1061aaf4 00000001 106d64a0
> [ 41.973540] GPR16: 00000000 00000000 7fa0a774 10610000 7fa0aef9 00000000 10610000 7fa0a538
> [ 41.973540] GPR24: 7fa0a580 7fa0a570 c1bacc00 c1b64520 c1bacc00 caae9ee8 00000108 c0713cd4
> [ 42.009685] NIP [ff8fd228] 0xff8fd228
> [ 42.013300] LR [c004d9e0] __regset_get+0x100/0x124
> [ 42.018036] Call Trace:
> [ 42.020443] [caae9eb0] [c004d9b4] __regset_get+0xd4/0x124 (unreliable)
> [ 42.026899] [caae9ee0] [c004da94] copy_regset_to_user+0x5c/0xb0
> [ 42.032751] [caae9f10] [c002f640] sys_ptrace+0xe4/0x588
> [ 42.037915] [caae9f30] [c0011010] ret_from_syscall+0x0/0x28
> [ 42.043422] --- interrupt: c00 at 0xfd1f8e4
> [ 42.047553] NIP: 0fd1f8e4 LR: 1004a688 CTR: 00000000
> [ 42.052544] REGS: caae9f40 TRAP: 0c00 Not tainted (5.12.0-rc5-s3k-dev-01666-g7aac86a0f057-dirty)
> [ 42.061494] MSR: 0000d032 <EE,PR,ME,IR,DR,RI> CR: 48004442 XER: 00000000
> [ 42.068551]
> [ 42.068551] GPR00: 0000001a 7fa0a040 77dad7e0 0000000e 00000170 00000000 7fa0a078 00000004
> [ 42.068551] GPR08: 00000000 108deb88 108dda40 106d6010 44004442 1061aaf4 00000001 106d64a0
> [ 42.068551] GPR16: 00000000 00000000 7fa0a774 10610000 7fa0aef9 00000000 10610000 7fa0a538
> [ 42.068551] GPR24: 7fa0a580 7fa0a570 1078fe00 1078fd70 1078fd70 00000170 0fdd3244 0000000d
> [ 42.104696] NIP [0fd1f8e4] 0xfd1f8e4
> [ 42.108225] LR [1004a688] 0x1004a688
> [ 42.111753] --- interrupt: c00
> [ 42.114768] Instruction dump:
> [ 42.117698] XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
> [ 42.125443] XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
> [ 42.133195] ---[ end trace d35616f22ab2100c ]---
>
> [...]
Applied to powerpc/fixes.
[1/1] powerpc/ptrace: Don't return error when getting/setting FP regs without CONFIG_PPC_FPU_REGS
https://git.kernel.org/powerpc/c/3618250c8399cb36f4a0fbc48610a178307e1c64
cheers
^ permalink raw reply
* Re: [PATCH] powerpc/vdso: Make sure vdso_wrapper.o is rebuilt everytime vdso.so is rebuilt
From: Michael Ellerman @ 2021-04-03 11:51 UTC (permalink / raw)
To: Paul Mackerras, Michael Ellerman, Benjamin Herrenschmidt,
masahiroy, Christophe Leroy
Cc: linuxppc-dev, linux-kernel
In-Reply-To: <8bb015bc98c51d8ced581415b7e3d157e18da7c9.1617181918.git.christophe.leroy@csgroup.eu>
On Wed, 31 Mar 2021 09:12:19 +0000 (UTC), Christophe Leroy wrote:
> Commit bce74491c300 ("powerpc/vdso: fix unnecessary rebuilds of
> vgettimeofday.o") moved vdso32_wrapper.o and vdso64_wrapper.o out
> of arch/powerpc/kernel/vdso[32/64]/ and removed the dependencies in
> the Makefile. This leads to the wrappers not being re-build hence the
> kernel embedding the old vdso library.
>
> Add back missing dependencies to ensure vdso32_wrapper.o and vdso64_wrapper.o
> are rebuilt when vdso32.so.dbg and vdso64.so.dbg are changed.
Applied to powerpc/fixes.
[1/1] powerpc/vdso: Make sure vdso_wrapper.o is rebuilt everytime vdso.so is rebuilt
https://git.kernel.org/powerpc/c/791f9e36599d94af5a76d3f74d04e16326761aae
cheers
^ permalink raw reply
* Re: [PATCH v2] powerpc/signal32: Fix Oops on sigreturn with unmapped VDSO
From: Michael Ellerman @ 2021-04-03 11:51 UTC (permalink / raw)
To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras,
Michael Ellerman
Cc: linuxppc-dev, linux-kernel
In-Reply-To: <bde9154e5351a5ac7bca3d59cdb5a5e8edacbb79.1617199569.git.christophe.leroy@csgroup.eu>
On Wed, 31 Mar 2021 14:07:04 +0000 (UTC), Christophe Leroy wrote:
> PPC32 encounters a KUAP fault when trying to handle a signal with
> VDSO unmapped.
>
> Kernel attempted to read user page (7fc07ec0) - exploit attempt? (uid: 0)
> BUG: Unable to handle kernel data access on read at 0x7fc07ec0
> Faulting instruction address: 0xc00111d4
> Oops: Kernel access of bad area, sig: 11 [#1]
> BE PAGE_SIZE=16K PREEMPT CMPC885
> CPU: 0 PID: 353 Comm: sigreturn_vdso Not tainted 5.12.0-rc4-s3k-dev-01553-gb30c310ea220 #4814
> NIP: c00111d4 LR: c0005a28 CTR: 00000000
> REGS: cadb3dd0 TRAP: 0300 Not tainted (5.12.0-rc4-s3k-dev-01553-gb30c310ea220)
> MSR: 00009032 <EE,ME,IR,DR,RI> CR: 48000884 XER: 20000000
> DAR: 7fc07ec0 DSISR: 88000000
> GPR00: c0007788 cadb3e90 c28d4a40 7fc07ec0 7fc07ed0 000004e0 7fc07ce0 00000000
> GPR08: 00000001 00000001 7fc07ec0 00000000 28000282 1001b828 100a0920 00000000
> GPR16: 100cac0c 100b0000 105c43a4 105c5685 100d0000 100d0000 100d0000 100b2e9e
> GPR24: ffffffff 105c43c8 00000000 7fc07ec8 cadb3f40 cadb3ec8 c28d4a40 00000000
> NIP [c00111d4] flush_icache_range+0x90/0xb4
> LR [c0005a28] handle_signal32+0x1bc/0x1c4
> Call Trace:
> [cadb3e90] [100d0000] 0x100d0000 (unreliable)
> [cadb3ec0] [c0007788] do_notify_resume+0x260/0x314
> [cadb3f20] [c000c764] syscall_exit_prepare+0x120/0x184
> [cadb3f30] [c00100b4] ret_from_syscall+0xc/0x28
> --- interrupt: c00 at 0xfe807f8
> NIP: 0fe807f8 LR: 10001060 CTR: c0139378
> REGS: cadb3f40 TRAP: 0c00 Not tainted (5.12.0-rc4-s3k-dev-01553-gb30c310ea220)
> MSR: 0000d032 <EE,PR,ME,IR,DR,RI> CR: 28000482 XER: 20000000
>
> [...]
Applied to powerpc/fixes.
[1/1] powerpc/signal32: Fix Oops on sigreturn with unmapped VDSO
https://git.kernel.org/powerpc/c/acca57217c688c5bbbd5140974533d81e8757cc9
cheers
^ permalink raw reply
* Re: [PATCH 08/10] powerpc/signal32: Convert restore_[tm]_user_regs() to user access block
From: Christophe Leroy @ 2021-04-03 17:32 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, cmr
Cc: linuxppc-dev, linux-kernel
In-Reply-To: <181adf15a6f644efcd1aeafb355f3578ff1b6bc5.1616151715.git.christophe.leroy@csgroup.eu>
Le 19/03/2021 à 12:06, Christophe Leroy a écrit :
> Convert restore_user_regs() and restore_tm_user_regs()
> to use user_access_read_begin/end blocks.
>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> arch/powerpc/include/asm/ptrace.h | 2 +-
> arch/powerpc/kernel/signal_32.c | 141 +++++++++++++++---------------
> 2 files changed, 72 insertions(+), 71 deletions(-)
>
> diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
> index 088c83853026..0b1a6f53e553 100644
> --- a/arch/powerpc/kernel/signal_32.c
> +++ b/arch/powerpc/kernel/signal_32.c
> @@ -567,19 +569,22 @@ static long restore_user_regs(struct pt_regs *regs,
> regs->msr &= ~MSR_SPE;
> if (msr & MSR_SPE) {
> /* restore spe registers from the stack */
> - if (__copy_from_user(current->thread.evr, &sr->mc_vregs,
> - ELF_NEVRREG * sizeof(u32)))
> - return 1;
> + unsafe_copy_from_user(current->thread.evr, &sr->mc_vregs,
> + ELF_NEVRREG * sizeof(u32));
Missing the , failed); here at the end of the line.
Michael can you add it ?
Thanks
Christophe
^ permalink raw reply
* Re: [GIT PULL] Please pull powerpc/linux.git powerpc-5.12-5 tag
From: pr-tracker-bot @ 2021-04-03 18:18 UTC (permalink / raw)
To: Michael Ellerman
Cc: nathanl, aneesh.kumar, Linus Torvalds, linuxppc-dev, linux-kernel
In-Reply-To: <871rbr1te5.fsf@mpe.ellerman.id.au>
The pull request you sent on Sat, 03 Apr 2021 22:48:02 +1100:
> https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git tags/powerpc-5.12-5
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/9c2ef23e4dae122d2b18e834d90f8bd4dda48fe6
Thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html
^ permalink raw reply
* [powerpc:next-test] BUILD REGRESSION 556baad64ee9f87db99de05be3b53edbd7beeaa1
From: kernel test robot @ 2021-04-04 0:06 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next-test
branch HEAD: 556baad64ee9f87db99de05be3b53edbd7beeaa1 selftests/powerpc: Suggest memtrace instead of /dev/mem for ci memory
Error/Warning in current branch:
arch/powerpc/kernel/signal_32.c:572:3: error: 'unsafe_copy_from_user' undeclared (first use in this function); did you mean 'raw_copy_from_user'?
arch/powerpc/kernel/signal_32.c:573:36: error: macro "unsafe_copy_from_user" requires 4 arguments, but only 3 given
arch/powerpc/platforms/powernv/memtrace.c:49:5: error: no previous prototype for 'memtrace_mmap' [-Werror=missing-prototypes]
Error/Warning ids grouped by kconfigs:
gcc_recent_errors
|-- powerpc-mpc8540_ads_defconfig
| |-- arch-powerpc-kernel-signal_32.c:error:macro-unsafe_copy_from_user-requires-arguments-but-only-given
| `-- arch-powerpc-kernel-signal_32.c:error:unsafe_copy_from_user-undeclared-(first-use-in-this-function)
`-- powerpc-powernv_defconfig
`-- arch-powerpc-platforms-powernv-memtrace.c:error:no-previous-prototype-for-memtrace_mmap
elapsed time: 721m
configs tested: 119
configs skipped: 2
gcc tested configs:
arm defconfig
arm64 allyesconfig
arm64 defconfig
arm allyesconfig
arm allmodconfig
x86_64 allyesconfig
riscv allmodconfig
i386 allyesconfig
riscv allyesconfig
powerpc powernv_defconfig
mips malta_kvm_defconfig
m68k mvme16x_defconfig
powerpc ppc40x_defconfig
mips tb0226_defconfig
powerpc mpc8540_ads_defconfig
mips bigsur_defconfig
sh sh03_defconfig
powerpc katmai_defconfig
arm assabet_defconfig
arc axs103_defconfig
ia64 allmodconfig
m68k amcore_defconfig
m68k bvme6000_defconfig
arm spear13xx_defconfig
powerpc ppa8548_defconfig
powerpc g5_defconfig
arm mini2440_defconfig
sh migor_defconfig
arm eseries_pxa_defconfig
m68k q40_defconfig
um x86_64_defconfig
powerpc acadia_defconfig
sh kfr2r09-romimage_defconfig
sh sdk7780_defconfig
powerpc ep8248e_defconfig
powerpc ppc64e_defconfig
arm lpc32xx_defconfig
m68k m5272c3_defconfig
h8300 alldefconfig
nds32 alldefconfig
arm netwinder_defconfig
mips mpc30x_defconfig
powerpc mpc836x_mds_defconfig
xtensa nommu_kc705_defconfig
powerpc tqm8xx_defconfig
arm rpc_defconfig
sparc64 defconfig
powerpc mpc834x_mds_defconfig
powerpc ep88xc_defconfig
parisc generic-32bit_defconfig
sh sh2007_defconfig
ia64 defconfig
ia64 allyesconfig
m68k allmodconfig
m68k defconfig
m68k allyesconfig
nios2 defconfig
arc allyesconfig
nds32 allnoconfig
nds32 defconfig
nios2 allyesconfig
csky defconfig
alpha defconfig
alpha allyesconfig
xtensa allyesconfig
h8300 allyesconfig
arc defconfig
sh allmodconfig
parisc defconfig
s390 allyesconfig
s390 allmodconfig
parisc allyesconfig
s390 defconfig
sparc allyesconfig
sparc defconfig
i386 defconfig
mips allyesconfig
mips allmodconfig
powerpc allyesconfig
powerpc allmodconfig
powerpc allnoconfig
i386 randconfig-a006-20210403
i386 randconfig-a003-20210403
i386 randconfig-a001-20210403
i386 randconfig-a004-20210403
i386 randconfig-a002-20210403
i386 randconfig-a005-20210403
x86_64 randconfig-a014-20210403
x86_64 randconfig-a015-20210403
x86_64 randconfig-a011-20210403
x86_64 randconfig-a013-20210403
x86_64 randconfig-a012-20210403
x86_64 randconfig-a016-20210403
i386 randconfig-a014-20210403
i386 randconfig-a011-20210403
i386 randconfig-a016-20210403
i386 randconfig-a012-20210403
i386 randconfig-a013-20210403
i386 randconfig-a015-20210403
riscv nommu_k210_defconfig
riscv nommu_virt_defconfig
riscv allnoconfig
riscv defconfig
riscv rv32_defconfig
um allmodconfig
um allnoconfig
um allyesconfig
um defconfig
x86_64 rhel-8.3-kselftests
x86_64 defconfig
x86_64 rhel-8.3
x86_64 rhel-8.3-kbuiltin
x86_64 kexec
clang tested configs:
x86_64 randconfig-a004-20210403
x86_64 randconfig-a005-20210403
x86_64 randconfig-a003-20210403
x86_64 randconfig-a001-20210403
x86_64 randconfig-a002-20210403
x86_64 randconfig-a006-20210403
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply
* [powerpc:fixes-test] BUILD SUCCESS 791f9e36599d94af5a76d3f74d04e16326761aae
From: kernel test robot @ 2021-04-04 0:06 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git fixes-test
branch HEAD: 791f9e36599d94af5a76d3f74d04e16326761aae powerpc/vdso: Make sure vdso_wrapper.o is rebuilt everytime vdso.so is rebuilt
elapsed time: 723m
configs tested: 176
configs skipped: 2
The following configs have been built successfully.
More configs may be tested in the coming days.
gcc tested configs:
arm defconfig
arm64 allyesconfig
arm64 defconfig
arm allyesconfig
arm allmodconfig
riscv allmodconfig
x86_64 allyesconfig
i386 allyesconfig
riscv allyesconfig
powerpc powernv_defconfig
mips malta_kvm_defconfig
m68k mvme16x_defconfig
powerpc ppc40x_defconfig
mips tb0226_defconfig
powerpc mpc8540_ads_defconfig
mips bigsur_defconfig
sh sh03_defconfig
powerpc katmai_defconfig
arm assabet_defconfig
arc axs103_defconfig
ia64 allmodconfig
m68k amcore_defconfig
m68k bvme6000_defconfig
arm spear13xx_defconfig
powerpc ppa8548_defconfig
sh polaris_defconfig
sh ap325rxa_defconfig
sh urquell_defconfig
mips bcm47xx_defconfig
arm mps2_defconfig
powerpc g5_defconfig
arm mini2440_defconfig
sh migor_defconfig
arm eseries_pxa_defconfig
m68k q40_defconfig
um x86_64_defconfig
powerpc acadia_defconfig
sh kfr2r09-romimage_defconfig
sh sdk7780_defconfig
powerpc ep8248e_defconfig
powerpc bluestone_defconfig
sh rsk7269_defconfig
sh se7751_defconfig
mips omega2p_defconfig
arm mvebu_v7_defconfig
um kunit_defconfig
powerpc ppc64e_defconfig
arm lpc32xx_defconfig
m68k m5272c3_defconfig
h8300 alldefconfig
powerpc chrp32_defconfig
arc nsimosci_hs_smp_defconfig
powerpc taishan_defconfig
mips allmodconfig
arm ep93xx_defconfig
nds32 alldefconfig
arm netwinder_defconfig
mips mpc30x_defconfig
powerpc mpc836x_mds_defconfig
xtensa nommu_kc705_defconfig
sh se7712_defconfig
powerpc tqm8555_defconfig
arm mv78xx0_defconfig
xtensa iss_defconfig
arm pxa910_defconfig
sh se7705_defconfig
mips decstation_defconfig
arm multi_v5_defconfig
arm nhk8815_defconfig
powerpc tqm8xx_defconfig
arm rpc_defconfig
sparc64 defconfig
powerpc mpc834x_mds_defconfig
powerpc ep88xc_defconfig
parisc generic-32bit_defconfig
sh sh2007_defconfig
arm hackkit_defconfig
arm moxart_defconfig
arm stm32_defconfig
sh hp6xx_defconfig
mips ip22_defconfig
sh sh7724_generic_defconfig
arm jornada720_defconfig
arc nsim_700_defconfig
arc tb10x_defconfig
ia64 defconfig
ia64 allyesconfig
m68k allmodconfig
m68k defconfig
m68k allyesconfig
nios2 defconfig
arc allyesconfig
nds32 allnoconfig
nds32 defconfig
nios2 allyesconfig
csky defconfig
alpha defconfig
alpha allyesconfig
xtensa allyesconfig
h8300 allyesconfig
arc defconfig
sh allmodconfig
parisc defconfig
s390 allyesconfig
s390 allmodconfig
parisc allyesconfig
s390 defconfig
sparc allyesconfig
sparc defconfig
i386 defconfig
mips allyesconfig
powerpc allyesconfig
powerpc allmodconfig
powerpc allnoconfig
i386 randconfig-a006-20210404
i386 randconfig-a003-20210404
i386 randconfig-a001-20210404
i386 randconfig-a004-20210404
i386 randconfig-a005-20210404
i386 randconfig-a002-20210404
i386 randconfig-a006-20210403
i386 randconfig-a003-20210403
i386 randconfig-a001-20210403
i386 randconfig-a004-20210403
i386 randconfig-a002-20210403
i386 randconfig-a005-20210403
x86_64 randconfig-a014-20210403
x86_64 randconfig-a015-20210403
x86_64 randconfig-a011-20210403
x86_64 randconfig-a013-20210403
x86_64 randconfig-a012-20210403
x86_64 randconfig-a016-20210403
i386 randconfig-a014-20210403
i386 randconfig-a011-20210403
i386 randconfig-a016-20210403
i386 randconfig-a012-20210403
i386 randconfig-a013-20210403
i386 randconfig-a015-20210403
i386 randconfig-a014-20210404
i386 randconfig-a016-20210404
i386 randconfig-a011-20210404
i386 randconfig-a012-20210404
i386 randconfig-a015-20210404
i386 randconfig-a013-20210404
x86_64 randconfig-a004-20210404
x86_64 randconfig-a003-20210404
x86_64 randconfig-a005-20210404
x86_64 randconfig-a001-20210404
x86_64 randconfig-a002-20210404
x86_64 randconfig-a006-20210404
riscv nommu_k210_defconfig
riscv nommu_virt_defconfig
riscv allnoconfig
riscv defconfig
riscv rv32_defconfig
um allmodconfig
um allnoconfig
um allyesconfig
um defconfig
x86_64 rhel-8.3-kselftests
x86_64 defconfig
x86_64 rhel-8.3
x86_64 rhel-8.3-kbuiltin
x86_64 kexec
clang tested configs:
x86_64 randconfig-a004-20210403
x86_64 randconfig-a005-20210403
x86_64 randconfig-a003-20210403
x86_64 randconfig-a001-20210403
x86_64 randconfig-a002-20210403
x86_64 randconfig-a006-20210403
x86_64 randconfig-a014-20210404
x86_64 randconfig-a015-20210404
x86_64 randconfig-a013-20210404
x86_64 randconfig-a011-20210404
x86_64 randconfig-a012-20210404
x86_64 randconfig-a016-20210404
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply
* [powerpc:merge] BUILD SUCCESS 571b0d1ccf5cd3dc1b9866a908769ee23f7d127e
From: kernel test robot @ 2021-04-04 0:06 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git merge
branch HEAD: 571b0d1ccf5cd3dc1b9866a908769ee23f7d127e Automatic merge of 'fixes' into merge (2021-04-03 20:47)
elapsed time: 721m
configs tested: 103
configs skipped: 2
The following configs have been built successfully.
More configs may be tested in the coming days.
gcc tested configs:
arm defconfig
arm64 allyesconfig
arm64 defconfig
arm allyesconfig
arm allmodconfig
x86_64 allyesconfig
riscv allmodconfig
i386 allyesconfig
riscv allyesconfig
sh sh03_defconfig
powerpc g5_defconfig
powerpc katmai_defconfig
arm mini2440_defconfig
sh migor_defconfig
s390 zfcpdump_defconfig
ia64 tiger_defconfig
powerpc storcenter_defconfig
arm s5pv210_defconfig
arm ep93xx_defconfig
sh sdk7780_defconfig
powerpc ppc64e_defconfig
arm lpc32xx_defconfig
m68k m5272c3_defconfig
h8300 alldefconfig
nds32 alldefconfig
arm netwinder_defconfig
mips mpc30x_defconfig
powerpc mpc836x_mds_defconfig
xtensa nommu_kc705_defconfig
powerpc tqm8xx_defconfig
sh kfr2r09-romimage_defconfig
arm rpc_defconfig
sparc64 defconfig
powerpc mpc834x_mds_defconfig
ia64 allmodconfig
ia64 defconfig
ia64 allyesconfig
m68k allmodconfig
m68k defconfig
m68k allyesconfig
nios2 defconfig
arc allyesconfig
nds32 allnoconfig
nds32 defconfig
nios2 allyesconfig
csky defconfig
alpha defconfig
alpha allyesconfig
xtensa allyesconfig
h8300 allyesconfig
arc defconfig
sh allmodconfig
parisc defconfig
s390 allyesconfig
s390 allmodconfig
parisc allyesconfig
s390 defconfig
sparc allyesconfig
sparc defconfig
i386 defconfig
mips allyesconfig
mips allmodconfig
powerpc allyesconfig
powerpc allmodconfig
powerpc allnoconfig
i386 randconfig-a006-20210403
i386 randconfig-a003-20210403
i386 randconfig-a001-20210403
i386 randconfig-a004-20210403
i386 randconfig-a002-20210403
i386 randconfig-a005-20210403
x86_64 randconfig-a014-20210403
x86_64 randconfig-a015-20210403
x86_64 randconfig-a011-20210403
x86_64 randconfig-a013-20210403
x86_64 randconfig-a012-20210403
x86_64 randconfig-a016-20210403
i386 randconfig-a014-20210403
i386 randconfig-a011-20210403
i386 randconfig-a016-20210403
i386 randconfig-a012-20210403
i386 randconfig-a013-20210403
i386 randconfig-a015-20210403
riscv nommu_k210_defconfig
riscv nommu_virt_defconfig
riscv allnoconfig
riscv defconfig
riscv rv32_defconfig
um allmodconfig
um allnoconfig
um allyesconfig
um defconfig
x86_64 rhel-8.3-kselftests
x86_64 defconfig
x86_64 rhel-8.3
x86_64 rhel-8.3-kbuiltin
x86_64 kexec
clang tested configs:
x86_64 randconfig-a003-20210403
x86_64 randconfig-a001-20210403
x86_64 randconfig-a002-20210403
x86_64 randconfig-a004-20210403
x86_64 randconfig-a005-20210403
x86_64 randconfig-a006-20210403
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply
* Re: [PATCH v5 41/48] KVM: PPC: Book3S HV: Remove unused nested HV tests in XICS emulation
From: Nicholas Piggin @ 2021-04-04 0:48 UTC (permalink / raw)
To: Cédric Le Goater, kvm-ppc; +Cc: linuxppc-dev
In-Reply-To: <9a8250f2-72a6-32df-ab01-36f8d16e73df@kaod.org>
Excerpts from Cédric Le Goater's message of April 3, 2021 2:32 am:
> On 4/1/21 5:03 PM, Nicholas Piggin wrote:
>> Commit f3c18e9342a44 ("KVM: PPC: Book3S HV: Use XICS hypercalls when
>> running as a nested hypervisor") added nested HV tests in XICS
>> hypercalls, but not all are required.
>>
>> * icp_eoi is only called by kvmppc_deliver_irq_passthru which is only
>> called by kvmppc_check_passthru which is only caled by
>> kvmppc_read_one_intr.
>>
>> * kvmppc_read_one_intr is only called by kvmppc_read_intr which is only
>> called by the L0 HV rmhandlers code.
>>
>> * kvmhv_rm_send_ipi is called by:
>> - kvmhv_interrupt_vcore which is only called by kvmhv_commence_exit
>> which is only called by the L0 HV rmhandlers code.
>> - icp_send_hcore_msg which is only called by icp_rm_set_vcpu_irq.
>> - icp_rm_set_vcpu_irq which is only called by icp_rm_try_update
>> - icp_rm_set_vcpu_irq is not nested HV safe because it writes to
>> LPCR directly without a kvmhv_on_pseries test. Nested handlers
>> should not in general be using the rm handlers.
>>
>> The important test seems to be in kvmppc_ipi_thread, which sends the
>> virt-mode H_IPI handler kick to use smp_call_function rather than
>> msgsnd.
>>
>> Cc: Cédric Le Goater <clg@kaod.org>
>> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
>> ---
>> arch/powerpc/kvm/book3s_hv_builtin.c | 44 +++++-----------------------
>> arch/powerpc/kvm/book3s_hv_rm_xics.c | 15 ----------
>> 2 files changed, 8 insertions(+), 51 deletions(-)
>
> So, now, the L1 is not limited to XICS anymore and we can use the XIVE
> native interrupt mode with an L2 using XICS in KVM or XIVE in QEMU.
> Is that correct ?
The intention was to only remove dead code and no change.
Perhaps I'm missing something or an earlier patch incorrectly made some
of these paths dead but I don't see it.
> It seems you removed all the XICS hcalls under kvmhv_on_pseries().
From what I could work out, kvmhv_on_pseries can never be true for the
ones I removed.
Thanks,
Nick
>
> C.
>
>
>> diff --git a/arch/powerpc/kvm/book3s_hv_builtin.c b/arch/powerpc/kvm/book3s_hv_builtin.c
>> index 8d669a0e15f8..259492bb4153 100644
>> --- a/arch/powerpc/kvm/book3s_hv_builtin.c
>> +++ b/arch/powerpc/kvm/book3s_hv_builtin.c
>> @@ -199,15 +199,6 @@ void kvmhv_rm_send_ipi(int cpu)
>> void __iomem *xics_phys;
>> unsigned long msg = PPC_DBELL_TYPE(PPC_DBELL_SERVER);
>>
>> - /* For a nested hypervisor, use the XICS via hcall */
>> - if (kvmhv_on_pseries()) {
>> - unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
>> -
>> - plpar_hcall_raw(H_IPI, retbuf, get_hard_smp_processor_id(cpu),
>> - IPI_PRIORITY);
>> - return;
>> - }
>> -
>> /* On POWER9 we can use msgsnd for any destination cpu. */
>> if (cpu_has_feature(CPU_FTR_ARCH_300)) {
>> msg |= get_hard_smp_processor_id(cpu);
>> @@ -420,19 +411,12 @@ static long kvmppc_read_one_intr(bool *again)
>> return 1;
>>
>> /* Now read the interrupt from the ICP */
>> - if (kvmhv_on_pseries()) {
>> - unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
>> -
>> - rc = plpar_hcall_raw(H_XIRR, retbuf, 0xFF);
>> - xirr = cpu_to_be32(retbuf[0]);
>> - } else {
>> - xics_phys = local_paca->kvm_hstate.xics_phys;
>> - rc = 0;
>> - if (!xics_phys)
>> - rc = opal_int_get_xirr(&xirr, false);
>> - else
>> - xirr = __raw_rm_readl(xics_phys + XICS_XIRR);
>> - }
>> + xics_phys = local_paca->kvm_hstate.xics_phys;
>> + rc = 0;
>> + if (!xics_phys)
>> + rc = opal_int_get_xirr(&xirr, false);
>> + else
>> + xirr = __raw_rm_readl(xics_phys + XICS_XIRR);
>> if (rc < 0)
>> return 1;
>>
>> @@ -461,13 +445,7 @@ static long kvmppc_read_one_intr(bool *again)
>> */
>> if (xisr == XICS_IPI) {
>> rc = 0;
>> - if (kvmhv_on_pseries()) {
>> - unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
>> -
>> - plpar_hcall_raw(H_IPI, retbuf,
>> - hard_smp_processor_id(), 0xff);
>> - plpar_hcall_raw(H_EOI, retbuf, h_xirr);
>> - } else if (xics_phys) {
>> + if (xics_phys) {
>> __raw_rm_writeb(0xff, xics_phys + XICS_MFRR);
>> __raw_rm_writel(xirr, xics_phys + XICS_XIRR);
>> } else {
>> @@ -493,13 +471,7 @@ static long kvmppc_read_one_intr(bool *again)
>> /* We raced with the host,
>> * we need to resend that IPI, bummer
>> */
>> - if (kvmhv_on_pseries()) {
>> - unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
>> -
>> - plpar_hcall_raw(H_IPI, retbuf,
>> - hard_smp_processor_id(),
>> - IPI_PRIORITY);
>> - } else if (xics_phys)
>> + if (xics_phys)
>> __raw_rm_writeb(IPI_PRIORITY,
>> xics_phys + XICS_MFRR);
>> else
>> diff --git a/arch/powerpc/kvm/book3s_hv_rm_xics.c b/arch/powerpc/kvm/book3s_hv_rm_xics.c
>> index c2c9c733f359..0a11ec88a0ae 100644
>> --- a/arch/powerpc/kvm/book3s_hv_rm_xics.c
>> +++ b/arch/powerpc/kvm/book3s_hv_rm_xics.c
>> @@ -141,13 +141,6 @@ static void icp_rm_set_vcpu_irq(struct kvm_vcpu *vcpu,
>> return;
>> }
>>
>> - if (xive_enabled() && kvmhv_on_pseries()) {
>> - /* No XICS access or hypercalls available, too hard */
>> - this_icp->rm_action |= XICS_RM_KICK_VCPU;
>> - this_icp->rm_kick_target = vcpu;
>> - return;
>> - }
>> -
>> /*
>> * Check if the core is loaded,
>> * if not, find an available host core to post to wake the VCPU,
>> @@ -771,14 +764,6 @@ static void icp_eoi(struct irq_chip *c, u32 hwirq, __be32 xirr, bool *again)
>> void __iomem *xics_phys;
>> int64_t rc;
>>
>> - if (kvmhv_on_pseries()) {
>> - unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
>> -
>> - iosync();
>> - plpar_hcall_raw(H_EOI, retbuf, hwirq);
>> - return;
>> - }
>> -
>> rc = pnv_opal_pci_msi_eoi(c, hwirq);
>>
>> if (rc)
>>
>
>
^ permalink raw reply
* Re: [PATCH 04/14] powerpc/64s: avoid reloading (H)SRR registers if they are still valid
From: Nicholas Piggin @ 2021-04-04 0:49 UTC (permalink / raw)
To: linuxppc-dev, Michael Ellerman
In-Reply-To: <877dlk1fbg.fsf@mpe.ellerman.id.au>
Excerpts from Michael Ellerman's message of April 3, 2021 8:39 am:
> Nicholas Piggin <npiggin@gmail.com> writes:
>> When an interrupt is taken, the SRR registers are set to return to
>> where it left off. Unless they are modified in the meantime, or the
>> return address or MSR are modified, there is no need to reload these
>> registers when returning from interrupt.
>>
>> Introduce per-CPU flags that track the validity of SRR and HSRR
>> registers, clear them when returning from interrupt, using the registers
>> for something else (e.g., OPAL calls), or adjusting return address or MSR.
>>
>> This improves the performance of interrupt returns.
>>
>> XXX: may not need to invalidate both hsrr and srr all the time
>>
>> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
>> ---
>
> I needed something like below to get 32-bit building.
That looks much better.
Thanks,
Nick
>
> cheers
>
>
> diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h
> index 6d6237e0cbd7..7f9bbd19db10 100644
> --- a/arch/powerpc/include/asm/ptrace.h
> +++ b/arch/powerpc/include/asm/ptrace.h
> @@ -153,15 +153,21 @@ static inline void regs_set_return_value(struct pt_regs *regs, unsigned long rc)
> regs->gpr[3] = rc;
> }
>
> -static inline void regs_set_return_ip(struct pt_regs *regs, unsigned long ip)
> +static inline void invalidate_srrs(void)
> {
> - regs->nip = ip;
> #ifdef CONFIG_PPC_BOOK3S_64
> + // XXX: We may not need to invalidate both hsrr and srr all the time
> local_paca->hsrr_valid = 0;
> local_paca->srr_valid = 0;
> #endif
> }
>
> +static inline void regs_set_return_ip(struct pt_regs *regs, unsigned long ip)
> +{
> + regs->nip = ip;
> + invalidate_srrs();
> +}
> +
> static inline void regs_add_return_ip(struct pt_regs *regs, long offset)
> {
> regs_set_return_ip(regs, regs->nip + offset);
> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
> index 200b4805f999..82623b57e2d6 100644
> --- a/arch/powerpc/kernel/process.c
> +++ b/arch/powerpc/kernel/process.c
> @@ -98,8 +98,7 @@ static void check_if_tm_restore_required(struct task_struct *tsk)
> !test_thread_flag(TIF_RESTORE_TM)) {
> tsk->thread.ckpt_regs.msr = tsk->thread.regs->msr;
> set_thread_flag(TIF_RESTORE_TM);
> - local_paca->hsrr_valid = 0;
> - local_paca->srr_valid = 0;
> + invalidate_srrs();
> }
> }
>
> @@ -164,8 +163,7 @@ static void __giveup_fpu(struct task_struct *tsk)
> if (cpu_has_feature(CPU_FTR_VSX))
> msr &= ~MSR_VSX;
> tsk->thread.regs->msr = msr;
> - local_paca->hsrr_valid = 0;
> - local_paca->srr_valid = 0;
> + invalidate_srrs();
> }
>
> void giveup_fpu(struct task_struct *tsk)
> @@ -249,8 +247,7 @@ static void __giveup_altivec(struct task_struct *tsk)
> if (cpu_has_feature(CPU_FTR_VSX))
> msr &= ~MSR_VSX;
> tsk->thread.regs->msr = msr;
> - local_paca->hsrr_valid = 0;
> - local_paca->srr_valid = 0;
> + invalidate_srrs();
> }
>
> void giveup_altivec(struct task_struct *tsk)
> @@ -566,8 +563,7 @@ void notrace restore_math(struct pt_regs *regs)
> msr_check_and_clear(new_msr);
>
> regs->msr |= new_msr | fpexc_mode;
> - local_paca->hsrr_valid = 0;
> - local_paca->srr_valid = 0;
> + invalidate_srrs();
> }
> }
> #endif /* CONFIG_PPC_BOOK3S_64 */
> @@ -1293,8 +1289,7 @@ struct task_struct *__switch_to(struct task_struct *prev,
> atomic_read(¤t->mm->context.vas_windows)))
> asm volatile(PPC_CP_ABORT);
> }
> - local_paca->hsrr_valid = 0;
> - local_paca->srr_valid = 0;
> + invalidate_srrs();
> #endif /* CONFIG_PPC_BOOK3S_64 */
>
> return last;
> @@ -1884,8 +1879,7 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp)
> current->thread.load_tm = 0;
> #endif /* CONFIG_PPC_TRANSACTIONAL_MEM */
>
> - local_paca->hsrr_valid = 0;
> - local_paca->srr_valid = 0;
> + invalidate_srrs();
> }
> EXPORT_SYMBOL(start_thread);
>
> @@ -1936,8 +1930,7 @@ int set_fpexc_mode(struct task_struct *tsk, unsigned int val)
> if (regs != NULL && (regs->msr & MSR_FP) != 0) {
> regs->msr = (regs->msr & ~(MSR_FE0|MSR_FE1))
> | tsk->thread.fpexc_mode;
> - local_paca->hsrr_valid = 0;
> - local_paca->srr_valid = 0;
> + invalidate_srrs();
> }
> return 0;
> }
> @@ -1990,8 +1983,7 @@ int set_endian(struct task_struct *tsk, unsigned int val)
> else
> return -EINVAL;
>
> - local_paca->hsrr_valid = 0;
> - local_paca->srr_valid = 0;
> + invalidate_srrs();
>
> return 0;
> }
> diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
> index 4cb38afa28a8..9d1d6070a516 100644
> --- a/arch/powerpc/kernel/syscalls.c
> +++ b/arch/powerpc/kernel/syscalls.c
> @@ -115,8 +115,8 @@ SYSCALL_DEFINE0(switch_endian)
> struct thread_info *ti;
>
> current->thread.regs->msr ^= MSR_LE;
> - local_paca->hsrr_valid = 0;
> - local_paca->srr_valid = 0;
> +
> + invalidate_srrs();
>
> /*
> * Set TIF_RESTOREALL so that r3 isn't clobbered on return to
> diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
> index 96505d4bba1c..2b94bf21d6ae 100644
> --- a/arch/powerpc/lib/sstep.c
> +++ b/arch/powerpc/lib/sstep.c
> @@ -3480,8 +3480,7 @@ int emulate_step(struct pt_regs *regs, struct ppc_inst instr)
> unsigned long val;
> unsigned long ea;
>
> - local_paca->hsrr_valid = 0;
> - local_paca->srr_valid = 0;
> + invalidate_srrs();
>
> r = analyse_instr(&op, regs, instr);
> if (r < 0)
>
^ permalink raw reply
* Re: [PATCH 04/14] powerpc/64s: avoid reloading (H)SRR registers if they are still valid
From: Nicholas Piggin @ 2021-04-04 0:51 UTC (permalink / raw)
To: linuxppc-dev, Michael Ellerman
In-Reply-To: <874kgo14qw.fsf@mpe.ellerman.id.au>
Excerpts from Michael Ellerman's message of April 3, 2021 12:28 pm:
> Nicholas Piggin <npiggin@gmail.com> writes:
>> diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
>> index ccf913cedd29..b466b3e1bb3f 100644
>> --- a/arch/powerpc/kernel/entry_64.S
>> +++ b/arch/powerpc/kernel/entry_64.S
>> @@ -64,6 +64,30 @@ exception_marker:
>> .section ".text"
>> .align 7
>>
>> +.macro DEBUG_SRR_VALID srr
>> +#ifdef CONFIG_PPC_RFI_SRR_DEBUG
>> + .ifc \srr,srr
>> + mfspr r11,SPRN_SRR0
>> + ld r12,_NIP(r1)
>> +100: tdne r11,r12
>> + EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE)
>
> This always points at *this* line, not the caller. Works better with the
> patch below.
Good thinking.
Thanks,
Nick
>
> cheers
>
>
> diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
> index b466b3e1bb3f..ada76b1279f9 100644
> --- a/arch/powerpc/kernel/entry_64.S
> +++ b/arch/powerpc/kernel/entry_64.S
> @@ -64,26 +64,26 @@
> .section ".text"
> .align 7
>
> -.macro DEBUG_SRR_VALID srr
> +.macro DEBUG_SRR_VALID srr line
> #ifdef CONFIG_PPC_RFI_SRR_DEBUG
> .ifc \srr,srr
> mfspr r11,SPRN_SRR0
> ld r12,_NIP(r1)
> 100: tdne r11,r12
> - EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE)
> + EMIT_BUG_ENTRY 100b,__FILE__,\line,(BUGFLAG_WARNING | BUGFLAG_ONCE)
> mfspr r11,SPRN_SRR1
> ld r12,_MSR(r1)
> 100: tdne r11,r12
> - EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE)
> + EMIT_BUG_ENTRY 100b,__FILE__,\line,(BUGFLAG_WARNING | BUGFLAG_ONCE)
> .else
> mfspr r11,SPRN_HSRR0
> ld r12,_NIP(r1)
> 100: tdne r11,r12
> - EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE)
> + EMIT_BUG_ENTRY 100b,__FILE__,\line,(BUGFLAG_WARNING | BUGFLAG_ONCE)
> mfspr r11,SPRN_HSRR1
> ld r12,_MSR(r1)
> 100: tdne r11,r12
> - EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE)
> + EMIT_BUG_ENTRY 100b,__FILE__,\line,(BUGFLAG_WARNING | BUGFLAG_ONCE)
> .endif
> #endif
> .endm
> @@ -358,7 +358,7 @@ END_BTB_FLUSH_SECTION
> mtspr SPRN_SRR0,r4
> mtspr SPRN_SRR1,r5
> 1:
> - DEBUG_SRR_VALID srr
> + DEBUG_SRR_VALID srr __LINE__
>
> BEGIN_FTR_SECTION
> stdcx. r0,0,r1 /* to clear the reservation */
> @@ -753,7 +753,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)
> stb r4,PACAHSRR_VALID(r13)
> #endif
> .endif
> - DEBUG_SRR_VALID \srr
> + DEBUG_SRR_VALID \srr __LINE__
>
> BEGIN_FTR_SECTION
> stdcx. r0,0,r1 /* to clear the reservation */
> @@ -825,7 +825,7 @@ ALT_FTR_SECTION_END_IFCLR(CPU_FTR_STCX_CHECKS_ADDRESS)
> stb r4,PACAHSRR_VALID(r13)
> #endif
> .endif
> - DEBUG_SRR_VALID \srr
> + DEBUG_SRR_VALID \srr __LINE__
>
> BEGIN_FTR_SECTION
> stdcx. r0,0,r1 /* to clear the reservation */
>
^ permalink raw reply
* [PATCH] ibmvnic: Use 'skb_frag_address()' instead of hand coding it
From: Christophe JAILLET @ 2021-04-04 8:54 UTC (permalink / raw)
To: mpe, benh, paulus, drt, ljp, sukadev, tlfalcon, davem, kuba
Cc: netdev, kernel-janitors, Christophe JAILLET, linuxppc-dev,
linux-kernel
'page_address(skb_frag_page()) + skb_frag_off()' can be replaced by an
equivalent 'skb_frag_address()' which is less verbose.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/net/ethernet/ibm/ibmvnic.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 9c6438d3b3a5..473411542911 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -1678,9 +1678,8 @@ static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
const skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
- memcpy(dst + cur,
- page_address(skb_frag_page(frag)) +
- skb_frag_off(frag), skb_frag_size(frag));
+ memcpy(dst + cur, skb_frag_address(frag),
+ skb_frag_size(frag));
cur += skb_frag_size(frag);
}
} else {
--
2.27.0
^ permalink raw reply related
* [PATCH v2] powerpc/mm: Add cond_resched() while removing hpte mappings
From: Vaibhav Jain @ 2021-04-04 16:31 UTC (permalink / raw)
To: linuxppc-dev, linux-nvdimm
Cc: Santosh Sivaraj, Aneesh Kumar K . V, Vaibhav Jain, Dan Williams,
Ira Weiny
While removing large number of mappings from hash page tables for
large memory systems as soft-lockup is reported because of the time
spent inside htap_remove_mapping() like one below:
watchdog: BUG: soft lockup - CPU#8 stuck for 23s!
<snip>
NIP plpar_hcall+0x38/0x58
LR pSeries_lpar_hpte_invalidate+0x68/0xb0
Call Trace:
0x1fffffffffff000 (unreliable)
pSeries_lpar_hpte_removebolted+0x9c/0x230
hash__remove_section_mapping+0xec/0x1c0
remove_section_mapping+0x28/0x3c
arch_remove_memory+0xfc/0x150
devm_memremap_pages_release+0x180/0x2f0
devm_action_release+0x30/0x50
release_nodes+0x28c/0x300
device_release_driver_internal+0x16c/0x280
unbind_store+0x124/0x170
drv_attr_store+0x44/0x60
sysfs_kf_write+0x64/0x90
kernfs_fop_write+0x1b0/0x290
__vfs_write+0x3c/0x70
vfs_write+0xd4/0x270
ksys_write+0xdc/0x130
system_call+0x5c/0x70
Fix this by adding a cond_resched() to the loop in
htap_remove_mapping() that issues hcall to remove hpte mapping. The
call to cond_resched() is issued every HZ jiffies which should prevent
the soft-lockup from being reported.
Suggested-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
---
Changelog:
v2: Issue cond_resched() every HZ jiffies instead of each iteration of
the loop. [ Christophe Leroy ]
---
arch/powerpc/mm/book3s64/hash_utils.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/mm/book3s64/hash_utils.c b/arch/powerpc/mm/book3s64/hash_utils.c
index 581b20a2feaf..286e7e8cb919 100644
--- a/arch/powerpc/mm/book3s64/hash_utils.c
+++ b/arch/powerpc/mm/book3s64/hash_utils.c
@@ -338,7 +338,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
int htab_remove_mapping(unsigned long vstart, unsigned long vend,
int psize, int ssize)
{
- unsigned long vaddr;
+ unsigned long vaddr, time_limit;
unsigned int step, shift;
int rc;
int ret = 0;
@@ -351,8 +351,19 @@ int htab_remove_mapping(unsigned long vstart, unsigned long vend,
/* Unmap the full range specificied */
vaddr = ALIGN_DOWN(vstart, step);
+ time_limit = jiffies + HZ;
+
for (;vaddr < vend; vaddr += step) {
rc = mmu_hash_ops.hpte_removebolted(vaddr, psize, ssize);
+
+ /*
+ * For large number of mappings introduce a cond_resched()
+ * to prevent softlockup warnings.
+ */
+ if (time_after(jiffies, time_limit)) {
+ cond_resched();
+ time_limit = jiffies + HZ;
+ }
if (rc == -ENOENT) {
ret = -ENOENT;
continue;
--
2.30.2
^ permalink raw reply related
* Re: [PATCH v2] powerpc/mm: Add cond_resched() while removing hpte mappings
From: Christophe Leroy @ 2021-04-04 17:05 UTC (permalink / raw)
To: Vaibhav Jain, linuxppc-dev, linux-nvdimm
Cc: Aneesh Kumar K . V, Dan Williams, Ira Weiny, Santosh Sivaraj
In-Reply-To: <20210404163148.321346-1-vaibhav@linux.ibm.com>
Le 04/04/2021 à 18:31, Vaibhav Jain a écrit :
> While removing large number of mappings from hash page tables for
> large memory systems as soft-lockup is reported because of the time
> spent inside htap_remove_mapping() like one below:
>
> watchdog: BUG: soft lockup - CPU#8 stuck for 23s!
> <snip>
> NIP plpar_hcall+0x38/0x58
> LR pSeries_lpar_hpte_invalidate+0x68/0xb0
> Call Trace:
> 0x1fffffffffff000 (unreliable)
> pSeries_lpar_hpte_removebolted+0x9c/0x230
> hash__remove_section_mapping+0xec/0x1c0
> remove_section_mapping+0x28/0x3c
> arch_remove_memory+0xfc/0x150
> devm_memremap_pages_release+0x180/0x2f0
> devm_action_release+0x30/0x50
> release_nodes+0x28c/0x300
> device_release_driver_internal+0x16c/0x280
> unbind_store+0x124/0x170
> drv_attr_store+0x44/0x60
> sysfs_kf_write+0x64/0x90
> kernfs_fop_write+0x1b0/0x290
> __vfs_write+0x3c/0x70
> vfs_write+0xd4/0x270
> ksys_write+0xdc/0x130
> system_call+0x5c/0x70
>
> Fix this by adding a cond_resched() to the loop in
> htap_remove_mapping() that issues hcall to remove hpte mapping. The
> call to cond_resched() is issued every HZ jiffies which should prevent
> the soft-lockup from being reported.
>
> Suggested-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>
> ---
> Changelog:
>
> v2: Issue cond_resched() every HZ jiffies instead of each iteration of
> the loop. [ Christophe Leroy ]
> ---
> arch/powerpc/mm/book3s64/hash_utils.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/mm/book3s64/hash_utils.c b/arch/powerpc/mm/book3s64/hash_utils.c
> index 581b20a2feaf..286e7e8cb919 100644
> --- a/arch/powerpc/mm/book3s64/hash_utils.c
> +++ b/arch/powerpc/mm/book3s64/hash_utils.c
> @@ -338,7 +338,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
> int htab_remove_mapping(unsigned long vstart, unsigned long vend,
> int psize, int ssize)
> {
> - unsigned long vaddr;
> + unsigned long vaddr, time_limit;
> unsigned int step, shift;
> int rc;
> int ret = 0;
> @@ -351,8 +351,19 @@ int htab_remove_mapping(unsigned long vstart, unsigned long vend,
>
> /* Unmap the full range specificied */
> vaddr = ALIGN_DOWN(vstart, step);
> + time_limit = jiffies + HZ;
> +
> for (;vaddr < vend; vaddr += step) {
> rc = mmu_hash_ops.hpte_removebolted(vaddr, psize, ssize);
> +
> + /*
> + * For large number of mappings introduce a cond_resched()
> + * to prevent softlockup warnings.
> + */
> + if (time_after(jiffies, time_limit)) {
> + cond_resched();
> + time_limit = jiffies + HZ;
> + }
> if (rc == -ENOENT) {
> ret = -ENOENT;
> continue;
>
^ permalink raw reply
* [RFC PATCH v6 1/1] cmdline: Add capability to both append and prepend at the same time
From: Christophe Leroy @ 2021-04-04 17:20 UTC (permalink / raw)
To: will, danielwa, robh, daniel, arnd, akpm
Cc: linux-arch, devicetree, microblaze, linux-xtensa, linux-sh,
linux-hexagon, x86, linux-kernel, nios2, linux-mips, linux-mm,
openrisc, sparclinux, linux-riscv, linuxppc-dev, linux-arm-kernel
One user has expressed the need to both append and prepend some
built-in parameters to the command line provided by the bootloader.
Allthough it is a corner case, it is easy to implement so let's do it.
When the user chooses to prepend the bootloader provided command line
with the built-in command line, he is offered the possibility to enter
an additionnal built-in command line to be appended after the
bootloader provided command line.
It is a complementary feature which has no impact on the already
existing ones and/or the existing defconfig.
Suggested-by: Daniel Walker <danielwa@cisco.com>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
Sending this out as an RFC, applies on top of the series
("Implement GENERIC_CMDLINE"). I will add it to the series next spin
unless someone is against it.
---
include/linux/cmdline.h | 3 +++
init/Kconfig | 12 +++++++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/include/linux/cmdline.h b/include/linux/cmdline.h
index 020028e2bdf0..fb274a4d5519 100644
--- a/include/linux/cmdline.h
+++ b/include/linux/cmdline.h
@@ -36,6 +36,9 @@ static __always_inline bool __cmdline_build(char *dst, const char *src)
len = cmdline_strlcat(dst, src, COMMAND_LINE_SIZE);
+ if (IS_ENABLED(CONFIG_CMDLINE_PREPEND))
+ len = cmdline_strlcat(dst, " " CONFIG_CMDLINE_MORE, COMMAND_LINE_SIZE);
+
if (IS_ENABLED(CONFIG_CMDLINE_APPEND))
len = cmdline_strlcat(dst, " " CONFIG_CMDLINE, COMMAND_LINE_SIZE);
diff --git a/init/Kconfig b/init/Kconfig
index fa002e3765ab..cd3087ff4f28 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -128,6 +128,14 @@ config CMDLINE
If this string is not empty, additional choices are proposed
below to determine how it will be used by the kernel.
+config CMDLINE_MORE
+ string "Additional default kernel command string" if GENERIC_CMDLINE && CMDLINE_PREPEND
+ default ""
+ help
+ Defines an additional default kernel command string.
+ If this string is not empty, it is appended to the
+ command-line arguments provided by the bootloader
+
choice
prompt "Kernel command line type" if CMDLINE != ""
default CMDLINE_PREPEND if ARCH_WANT_CMDLINE_PREPEND_BY_DEFAULT
@@ -154,7 +162,9 @@ config CMDLINE_PREPEND
bool "Prepend to the bootloader kernel arguments"
help
The default kernel command string will be prepended to the
- command-line arguments provided by the bootloader.
+ command-line arguments provided by the bootloader. When this
+ option is selected, another string can be added which will
+ be appended.
config CMDLINE_FORCE
bool "Always use the default kernel command string"
--
2.25.0
^ permalink raw reply related
* [PATCH v2] powerpc: iommu: fix build when neither PCI or IBMVIO is set
From: Randy Dunlap @ 2021-04-04 19:26 UTC (permalink / raw)
To: linux-kernel
Cc: Randy Dunlap, linuxppc-dev, kernel test robot, Anton Blanchard
When neither CONFIG_PCI nor CONFIG_IBMVIO is set/enabled, iommu.c has a
build error. The fault injection code is not useful in that kernel config,
so make the FAIL_IOMMU option depend on PCI || IBMVIO.
Prevents this build error (warning escalated to error):
../arch/powerpc/kernel/iommu.c:178:30: error: 'fail_iommu_bus_notifier' defined but not used [-Werror=unused-variable]
178 | static struct notifier_block fail_iommu_bus_notifier = {
Fixes: d6b9a81b2a45 ("powerpc: IOMMU fault injection")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: kernel test robot <lkp@intel.com>
Suggested-by: Michael Ellerman <mpe@ellerman.id.au>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: Anton Blanchard <anton@samba.org>
---
I was supposed to update this about one month ago, but then I lost
some email and also took a break for a few weeks, then I remembered,
so here it is.
arch/powerpc/Kconfig.debug | 1 +
1 file changed, 1 insertion(+)
--- lnx-512-rc1.orig/arch/powerpc/Kconfig.debug
+++ lnx-512-rc1/arch/powerpc/Kconfig.debug
@@ -353,6 +353,7 @@ config PPC_EARLY_DEBUG_CPM_ADDR
config FAIL_IOMMU
bool "Fault-injection capability for IOMMU"
depends on FAULT_INJECTION
+ depends on PCI || IBMVIO
help
Provide fault-injection capability for IOMMU. Each device can
be selectively enabled via the fail_iommu property.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox