Initial support for Power
cover Initial support for Power
Hello all,
This patch series adds support for building a minimal image (head.o-only) for Power ISA 2.07B+ (POWER8+) systems. The first patch boots to an infinite loop and the second adds early serial console support on pseries VMs, with bare metal support planned next.
Since Xen previously had support for a much older version of the ISA in version 3.2.3, we were able to carry over some headers and support routines from that version. Unlike that initial port though, this effort focuses solely on POWER8+ CPUs that are capable of running in Little Endian mode.
With an appropriate powerpc64le-linux-gnu cross-toolchain, the minimal image can be built with:
$ make XEN_TARGET_ARCH=ppc64 -C xen openpower_defconfig $ make XEN_TARGET_ARCH=ppc64 SUBSYSTEMS=xen -C xen TARGET=ppc64/head.o
The resulting head.o can then be booted in a standard QEMU/pseries VM:
$ qemu-system-ppc64 -M pseries-5.2 -m 256M -kernel xen/ppc64/head.o \ -vga none -serial mon:stdio -nographic
Thanks,
Shawn
Shawn Anastasio (3):
xen: Add files needed for minimal Power build xen/ppc: Implement early serial printk on PaPR/pseries
maintainers: Add PPC64 maintainer
MAINTAINERS | 3 + config/ppc64.mk | 5 + xen/Makefile | 5 +- xen/arch/ppc/Kconfig | 42 +++++ xen/arch/ppc/Kconfig.debug | 5 + xen/arch/ppc/Makefile | 18 ++ xen/arch/ppc/Rules.mk | 0 xen/arch/ppc/arch.mk | 11 ++ xen/arch/ppc/boot_of.c | 122 +++++++++++++ xen/arch/ppc/configs/openpower_defconfig | 14 ++ xen/arch/ppc/early_printk.c | 36 ++++ xen/arch/ppc/include/asm/boot.h | 31 ++++ xen/arch/ppc/include/asm/bug.h | 6 + xen/arch/ppc/include/asm/byteorder.h | 74 ++++++++ xen/arch/ppc/include/asm/cache.h | 6 + xen/arch/ppc/include/asm/config.h | 66 +++++++ xen/arch/ppc/include/asm/early_printk.h | 14 ++ xen/arch/ppc/include/asm/msr.h | 67 +++++++ xen/arch/ppc/include/asm/page-bits.h | 7 + xen/arch/ppc/include/asm/processor.h | 223 +++++++++++++++++++++++ xen/arch/ppc/include/asm/reg_defs.h | 218 ++++++++++++++++++++++ xen/arch/ppc/include/asm/string.h | 6 + xen/arch/ppc/include/asm/types.h | 64 +++++++ xen/arch/ppc/ppc64/Makefile | 1 + xen/arch/ppc/ppc64/asm-offsets.c | 55 ++++++ xen/arch/ppc/ppc64/head.S | 126 +++++++++++++ xen/arch/ppc/setup.c | 32 ++++ xen/arch/ppc/xen.lds.S | 173 ++++++++++++++++++ 28 files changed, 1428 insertions(+), 2 deletions(-) create mode 100644 config/ppc64.mk create mode 100644 xen/arch/ppc/Kconfig create mode 100644 xen/arch/ppc/Kconfig.debug create mode 100644 xen/arch/ppc/Makefile create mode 100644 xen/arch/ppc/Rules.mk create mode 100644 xen/arch/ppc/arch.mk create mode 100644 xen/arch/ppc/boot_of.c create mode 100644 xen/arch/ppc/configs/openpower_defconfig create mode 100644 xen/arch/ppc/early_printk.c create mode 100644 xen/arch/ppc/include/asm/boot.h create mode 100644 xen/arch/ppc/include/asm/bug.h create mode 100644 xen/arch/ppc/include/asm/byteorder.h create mode 100644 xen/arch/ppc/include/asm/cache.h create mode 100644 xen/arch/ppc/include/asm/config.h create mode 100644 xen/arch/ppc/include/asm/early_printk.h create mode 100644 xen/arch/ppc/include/asm/msr.h create mode 100644 xen/arch/ppc/include/asm/page-bits.h create mode 100644 xen/arch/ppc/include/asm/processor.h create mode 100644 xen/arch/ppc/include/asm/reg_defs.h create mode 100644 xen/arch/ppc/include/asm/string.h create mode 100644 xen/arch/ppc/include/asm/types.h create mode 100644 xen/arch/ppc/ppc64/Makefile create mode 100644 xen/arch/ppc/ppc64/asm-offsets.c create mode 100644 xen/arch/ppc/ppc64/head.S create mode 100644 xen/arch/ppc/setup.c create mode 100644 xen/arch/ppc/xen.lds.S
Signature · 1 line
2.30.2
PATCH 1/3 xen: Add files needed for minimal Power build
Add the build system changes required to build for ppc64le (POWER8+). Following in the footsteps of the initial riscv port, only building the head.o target, which boots to an infinite loop, is supported:
$ make XEN_TARGET_ARCH=ppc64 -C xen openpower_defconfig $ make XEN_TARGET_ARCH=ppc64 SUBSYSTEMS=xen -C xen TARGET=ppc64/head.o
This port targets POWER8+ CPUs running in Little Endian mode specifically, and does not boot on older machines. Additionally, this initial skeleton only implements the PaPR/pseries boot protocol which allows it to be booted in a standard QEMU virtual machine:
$ qemu-system-ppc64 -M pseries-5.2 -m 256M -kernel ppc64/head.o
Where possible, this patch uses header definitions and support routines from the original Xen PowerPC port present in Xen 3.2.3. Though we are targeting a much newer ISA than that original port did, some of the definitions have remained similar enough for reuse.
--- config/ppc64.mk | 5 + xen/Makefile | 5 +- xen/arch/ppc/Kconfig | 42 +++++ xen/arch/ppc/Kconfig.debug | 0 xen/arch/ppc/Makefile | 17 ++ xen/arch/ppc/Rules.mk | 0 xen/arch/ppc/arch.mk | 11 ++ xen/arch/ppc/configs/openpower_defconfig | 13 ++ xen/arch/ppc/include/asm/config.h | 63 +++++++ xen/arch/ppc/include/asm/msr.h | 67 +++++++ xen/arch/ppc/include/asm/page-bits.h | 7 + xen/arch/ppc/include/asm/processor.h | 173 ++++++++++++++++++ xen/arch/ppc/include/asm/reg_defs.h | 218 +++++++++++++++++++++++ xen/arch/ppc/ppc64/Makefile | 1 + xen/arch/ppc/ppc64/asm-offsets.c | 0 xen/arch/ppc/ppc64/head.S | 67 +++++++ xen/arch/ppc/setup.c | 14 ++ xen/arch/ppc/xen.lds.S | 173 ++++++++++++++++++ 18 files changed, 874 insertions(+), 2 deletions(-) create mode 100644 config/ppc64.mk create mode 100644 xen/arch/ppc/Kconfig create mode 100644 xen/arch/ppc/Kconfig.debug create mode 100644 xen/arch/ppc/Makefile create mode 100644 xen/arch/ppc/Rules.mk create mode 100644 xen/arch/ppc/arch.mk create mode 100644 xen/arch/ppc/configs/openpower_defconfig create mode 100644 xen/arch/ppc/include/asm/config.h create mode 100644 xen/arch/ppc/include/asm/msr.h create mode 100644 xen/arch/ppc/include/asm/page-bits.h create mode 100644 xen/arch/ppc/include/asm/processor.h create mode 100644 xen/arch/ppc/include/asm/reg_defs.h create mode 100644 xen/arch/ppc/ppc64/Makefile create mode 100644 xen/arch/ppc/ppc64/asm-offsets.c create mode 100644 xen/arch/ppc/ppc64/head.S create mode 100644 xen/arch/ppc/setup.c create mode 100644 xen/arch/ppc/xen.lds.S
config/ppc64.mk new file +5 -0
@@ -0,0 +1,5 @@ +CONFIG_PPC64 := y +CONFIG_PPC64_64 := y +CONFIG_PPC64_$(XEN_OS) := y + +CONFIG_XEN_INSTALL_SUFFIX :=
xen/Makefile +3 -2
@@ -38,7 +38,7 @@ EFI_MOUNTPOINT ?= $(BOOT_DIR)/efi ARCH=$(XEN_TARGET_ARCH) SRCARCH=$(shell echo $(ARCH) | \ sed -e 's/x86.*/x86/' -e s'/arm\(32\|64\)/arm/g' \ - -e s'/riscv.*/riscv/g') + -e s'/riscv.*/riscv/g' -e s'/ppc.*/ppc/g') export ARCH SRCARCH # Allow someone to change their config file
@@ -244,7 +244,7 @@ include $(XEN_ROOT)/Config.mk export TARGET_SUBARCH := $(XEN_TARGET_ARCH) export TARGET_ARCH := $(shell echo $(XEN_TARGET_ARCH) | \ sed -e 's/x86.*/x86/' -e s'/arm\(32\|64\)/arm/g' \ - -e s'/riscv.*/riscv/g') + -e s'/riscv.*/riscv/g' -e s'/ppc.*/ppc/g') export CONFIG_SHELL := $(SHELL) export CC CXX LD NM OBJCOPY OBJDUMP ADDR2LINE
@@ -563,6 +563,7 @@ _clean: $(Q)$(MAKE) $(clean)=xsm $(Q)$(MAKE) $(clean)=crypto $(Q)$(MAKE) $(clean)=arch/arm + $(Q)$(MAKE) $(clean)=arch/ppc $(Q)$(MAKE) $(clean)=arch/riscv $(Q)$(MAKE) $(clean)=arch/x86 $(Q)$(MAKE) $(clean)=test
xen/arch/ppc/Kconfig new file +42 -0
42 lines not on this page · raw message
xen/arch/ppc/Kconfig.debug new file +0 -0
xen/arch/ppc/Makefile new file +17 -0
@@ -0,0 +1,17 @@ +obj-$(CONFIG_PPC64) += ppc64/ +obj-y += setup.o + +$(TARGET): $(TARGET)-syms + cp -f $< $@ + +$(TARGET)-syms: $(objtree)/prelink.o $(obj)/xen.lds + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) -o $@ + $(NM) -pa --format=sysv $(@D)/$(@F) \ + | $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort \ + >$(@D)/$(@F).map + +$(obj)/xen.lds: $(src)/xen.lds.S FORCE + $(call if_changed_dep,cpp_lds_S) + +.PHONY: include +include:
xen/arch/ppc/Rules.mk new file +0 -0
xen/arch/ppc/arch.mk new file +11 -0
@@ -0,0 +1,11 @@ +######################################## +# Power-specific definitions + +ppc-march-$(CONFIG_POWER_ISA_2_07B) := power8 +ppc-march-$(CONFIG_POWER_ISA_3_00) := power9 + +CFLAGS += -mcpu=$(ppc-march-y) -mstrict-align -mcmodel=large -mabi=elfv2 -mno-altivec -mno-vsx + +# TODO: Drop override when more of the build is working +override ALL_OBJS-y = arch/$(TARGET_ARCH)/built_in.o +override ALL_LIBS-y =
xen/arch/ppc/configs/openpower_defconfig new file +13 -0
@@ -0,0 +1,13 @@ +# CONFIG_SCHED_CREDIT is not set +# CONFIG_SCHED_RTDS is not set +# CONFIG_SCHED_NULL is not set +# CONFIG_SCHED_ARINC653 is not set +# CONFIG_TRACEBUFFER is not set +# CONFIG_HYPFS is not set +# CONFIG_GRANT_TABLE is not set +# CONFIG_SPECULATIVE_HARDEN_ARRAY is not set + +CONFIG_PPC64=y +CONFIG_DEBUG=y +CONFIG_DEBUG_INFO=y +CONFIG_EXPERT=y
xen/arch/ppc/include/asm/config.h new file +63 -0
63 lines not on this page · raw message
xen/arch/ppc/include/asm/msr.h new file +67 -0
67 lines not on this page · raw message
xen/arch/ppc/include/asm/page-bits.h new file +7 -0
@@ -0,0 +1,7 @@ +#ifndef __PPC_PAGE_BITS_H__ +#define __PPC_PAGE_BITS_H__ + +#define PAGE_SHIFT 16/* 64 KiB Pages */ +#define PADDR_BITS 48 + +#endif /* __PPC_PAGE_BITS_H__ */
xen/arch/ppc/include/asm/processor.h new file +173 -0
173 lines not on this page · raw message
xen/arch/ppc/include/asm/reg_defs.h new file +218 -0
218 lines not on this page · raw message
xen/arch/ppc/ppc64/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-y += head.o
xen/arch/ppc/ppc64/asm-offsets.c new file +0 -0
xen/arch/ppc/ppc64/head.S new file +67 -0
67 lines not on this page · raw message
xen/arch/ppc/setup.c new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#include <xen/compile.h> +#include <xen/init.h> + +void __init noreturnstart_xen (void ) +{ +for ( ;; ) + { +// Set current hardware thread to very low priority + asmvolatile ("or 31,31,31" ); + } + +unreachable (); +}
xen/arch/ppc/xen.lds.S new file +173 -0
173 lines not on this page · raw message
Signature · 1 line
2.30.2
Re: [PATCH 1/3] xen: Add files needed for minimal Power build
Quoted 12 lines · Shawn Anastasio
Add the build system changes required to build for ppc64le (POWER8+). Following in the footsteps of the initial riscv port, only building the head.o target, which boots to an infinite loop, is supported:
$ make XEN_TARGET_ARCH=ppc64 -C xen openpower_defconfig $ make XEN_TARGET_ARCH=ppc64 SUBSYSTEMS=xen -C xen TARGET=ppc64/head.oThis port targets POWER8+ CPUs running in Little Endian mode specifically, and does not boot on older machines. Additionally, this initial skeleton only implements the PaPR/pseries boot protocol which allows it to be booted in a standard QEMU virtual machine:
Quoted 8 lines
$ qemu-system-ppc64 -M pseries-5.2 -m 256M -kernel ppc64/head.oWhere possible, this patch uses header definitions and support routines from the original Xen PowerPC port present in Xen 3.2.3. Though we are targeting a much newer ISA than that original port did, some of the definitions have remained similar enough for reuse.
Signed-off-by Shawn Anastasio <[email protected]>
Just a few small remarks, as following Andrew's comments I expect the patch will shrink quite a bit:
config/ppc64.mk line 3
Quoted 6 lines
config/ppc64.mk new file +3
-0@@ -0,0 +1,5 @@ +CONFIG_PPC64 := y +CONFIG_PPC64_64 := y +CONFIG_PPC64_$(XEN_OS) := y
The first of the 64-s here are a little odd; looking at RISC-V's counterpart, wouldn't this want to be
CONFIG_PPC := yCONFIG_PPC_64 := y
CONFIG_PPC_$(XEN_OS) := y
xen/arch/ppc/Kconfig line 2
Quoted 5 lines
xen/arch/ppc/Kconfig new file +2
-0@@ -0,0 +1,42 @@ +config PPC + def_bool y
Is this necessary? Iirc PPC is frequently used as a name for 32-bit PPC (but then also elsewhere as covering both 32- and 64-bit), so I'm not sure we want this without having a need for it.
Quoted 21 lines
xen/arch/ppc/Kconfig new file +21
-0+config PPC64 + def_bool y + select 64BIT + +config ARCH_DEFCONFIG + string + default "arch/ppc/configs/openpower_defconfig" + +menu "Architecture Features" + +source "arch/Kconfig" + +endmenu + +menu "ISA Selection" + +choice + prompt "Base ISA" + default POWER_ISA_2_07B if PPC64 + help + This selects the base ISA version that Xen will target.
xen/arch/ppc/Kconfig line 34
Quoted 10 lines
xen/arch/ppc/Kconfig new file +10
-0+ +config POWER_ISA_2_07B + bool "POWER ISA 2.07B+" + help + Target version 2.07B+ of the POWER ISA (POWER8+) + +config POWER_ISA_3_00 + bool "POWER ISA 3.00+" + help + Target version 3.00+ of the POWER ISA (POWER9+)
What are the + in here meant to indicate? Since this is about a baseline ISA, I find such a use (presumably standing for "or newer") ambiguous.
Jan
Re: [PATCH 1/3] xen: Add files needed for minimal Power build
Quoted 10 lines · Jan Beulich
config/ppc64.mk line 3
Quoted 6 lines
config/ppc64.mk new file +3
-0@@ -0,0 +1,5 @@ +CONFIG_PPC64 := y +CONFIG_PPC64_64 := y +CONFIG_PPC64_$(XEN_OS) := yThe first of the 64-s here are a little odd; looking at RISC-V's counterpart, wouldn't this want to be
Quoted 3 lines
CONFIG_PPC:= yCONFIG_PPC_64:= y
CONFIG_PPC_$(XEN_OS) := y>
Good point, this was definitely an oversight on my part. I'll clean this up in v2.
Quoted 9 lines
xen/arch/ppc/Kconfig line 2
Quoted 5 lines
xen/arch/ppc/Kconfig new file +2
-0@@ -0,0 +1,42 @@ +config PPC + def_bool yIs this necessary? Iirc PPC is frequently used as a name for 32-bit PPC (but then also elsewhere as covering both 32- and 64-bit), so I'm not sure we want this without having a need for it.
This was mostly modeled after riscv/Kconfig. The idea was that this option guards PPC support in general (both 32- and 64-bit) and the subsequent option specifically opts in to 64-bit.
Given that this effort is only targeting 64-bit mode, though, the argument could definitely be made that having the two options is redundant, but I believe that is also the case for the risc-v port.
Quoted 26 lines
Quoted 26 lines
xen/arch/ppc/Kconfig new file +26
-0+config PPC64 + def_bool y + select 64BIT + +config ARCH_DEFCONFIG + string + default "arch/ppc/configs/openpower_defconfig" + +menu "Architecture Features" + +source "arch/Kconfig" + +endmenu + +menu "ISA Selection" + +choice + prompt "Base ISA" + default POWER_ISA_2_07B if PPC64 + help + This selects the base ISA version that Xen will target. + +config POWER_ISA_2_07B + bool "POWER ISA 2.07B+" + help + Target version 2.07B+ of the POWER ISA (POWER8+)
Quoted 8 lines
xen/arch/ppc/Kconfig line 34
Quoted 5 lines
xen/arch/ppc/Kconfig new file +5
-0+ +config POWER_ISA_3_00 + bool "POWER ISA 3.00+" + help + Target version 3.00+ of the POWER ISA (POWER9+)What are the + in here meant to indicate? Since this is about a baseline ISA, I find such a use (presumably standing for "or newer") ambiguous.
Fair point. The + was intended as an "or newer" but I agree that it's ambiguous (for instance, it might be interpreted as a part of the ISA's name). I'll remove it in v2, along with a renaming of "POWER ISA" to "Power ISA" which I originally overlooked.
Quoted 1 line
Jan
Thanks,
Shawn
PATCH 2/3 xen/ppc: Implement early serial printk on PaPR/pseries
In reply to Shawn AnastasioOn typical Power VMs (e.g. QEMU's -M pseries), a variety of services are provided by OpenFirmware, including an early serial console. Implement the required interfaces to call into OpenFirmware and write to the serial console.
Since OpenFirmware runs in 32-bit Big Endian mode and Xen runs in 64-bit Little Endian mode, a thunk is required to save/restore any potentially-clobbered registers as well as to perform the required endianness switch. Thankfully, linux already has such a routine, which was imported into head.S.
Support for bare metal (PowerNV) will be implemented in a future patch.
--- xen/arch/ppc/Kconfig.debug | 5 + xen/arch/ppc/Makefile | 3 +- xen/arch/ppc/boot_of.c | 122 +++++++++++++++++++++++ xen/arch/ppc/configs/openpower_defconfig | 1 + xen/arch/ppc/early_printk.c | 36 +++++++ xen/arch/ppc/include/asm/boot.h | 31 ++++++ xen/arch/ppc/include/asm/bug.h | 6 ++ xen/arch/ppc/include/asm/byteorder.h | 74 ++++++++++++++ xen/arch/ppc/include/asm/cache.h | 6 ++ xen/arch/ppc/include/asm/config.h | 3 + xen/arch/ppc/include/asm/early_printk.h | 14 +++ xen/arch/ppc/include/asm/processor.h | 54 +++++++++- xen/arch/ppc/include/asm/string.h | 6 ++ xen/arch/ppc/include/asm/types.h | 64 ++++++++++++ xen/arch/ppc/ppc64/asm-offsets.c | 55 ++++++++++ xen/arch/ppc/ppc64/head.S | 59 +++++++++++ xen/arch/ppc/setup.c | 20 +++- 17 files changed, 555 insertions(+), 4 deletions(-) create mode 100644 xen/arch/ppc/boot_of.c create mode 100644 xen/arch/ppc/early_printk.c create mode 100644 xen/arch/ppc/include/asm/boot.h create mode 100644 xen/arch/ppc/include/asm/bug.h create mode 100644 xen/arch/ppc/include/asm/byteorder.h create mode 100644 xen/arch/ppc/include/asm/cache.h create mode 100644 xen/arch/ppc/include/asm/early_printk.h create mode 100644 xen/arch/ppc/include/asm/string.h create mode 100644 xen/arch/ppc/include/asm/types.h
xen/arch/ppc/Kconfig.debug +5 -0
@@ -0,0 +1,5 @@ +config EARLY_PRINTK + bool "Enable early printk" + default DEBUG + help + Enables early printk debug messages
xen/arch/ppc/Makefile +2 -1
@@ -1,5 +1,6 @@ obj-$(CONFIG_PPC64) += ppc64/ -obj-y += setup.o +obj-y += setup.o boot_of.o +obj-$(CONFIG_EARLY_PRINTK) += early_printk.o $(TARGET): $(TARGET)-syms cp -f $< $@
xen/arch/ppc/boot_of.c new file +122 -0
123 lines not on this page · raw message
xen/arch/ppc/configs/openpower_defconfig +1 -0
@@ -10,4 +10,5 @@ CONFIG_PPC64=y CONFIG_DEBUG=y CONFIG_DEBUG_INFO=y +CONFIG_EARLY_PRINTK=y CONFIG_EXPERT=y
xen/arch/ppc/early_printk.c new file +36 -0
@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Power early printk using OpenFirmware or OPAL +* +* Copyright Raptor Engineering, LLC +* +* Authors: Shawn Anastasio <[email protected]> +*/ + +#include <xen/lib.h> +#include <asm/boot.h> + +static void (*putchar_func)(char ); + +void early_printk_init (bool is_of) +{ + putchar_func = is_of ? of_putchar :NULL ; +} + +void early_puts (const char *s,size_t nr) +{ +if ( !putchar_func ) +return ; + +while ( nr-- >0 ) +putchar_func (*s++); +} + +void early_printk (const char *s) +{ +if ( !putchar_func ) +return ; + +while ( *s ) +putchar_func (*s++); +}
xen/arch/ppc/include/asm/boot.h new file +31 -0
@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* Copyright Raptor Engineering, LLC +* +* Authors: Shawn Anastasio <@raptorengineering.com> +*/ + +#ifndef _ASM_PPC_BOOT_H +#define _ASM_PPC_BOOT_H + +#include <xen/types.h> + +/* a collection of interfaces used during boot. */ +enum { +OF_FAILURE =-1 , +OF_SUCCESS =0 , +}; + +struct of_service { +__be32 ofs_service; +__be32 ofs_nargs; +__be32 ofs_nrets; +__be32 ofs_args[10 ]; +}; + +extern int enter_prom (struct of_service *args,unsigned long entry); + +void boot_of_init (unsigned long ); +void of_putchar (char c); + +#endif /* _ASM_PPC_BOOT_H */
xen/arch/ppc/include/asm/bug.h new file +6 -0
@@ -0,0 +1,6 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef _ASM_PPC_BUG_H +#define _ASM_PPC_BUG_H + +#endif /* _ASM_PPC_BUG_H */
xen/arch/ppc/include/asm/byteorder.h new file +74 -0
74 lines not on this page · raw message
xen/arch/ppc/include/asm/cache.h new file +6 -0
@@ -0,0 +1,6 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef _ASM_PPC_CACHE_H +#define _ASM_PPC_CACHE_H + +#endif /* _ASM_PPC_CACHE_H */
xen/arch/ppc/include/asm/config.h +3 -0
@@ -52,6 +52,9 @@/* size of minimum stack frame; C code can write into the caller's stack */ #define STACK_FRAME_OVERHEAD 32 +/* size of minimum stack frame that can hold an entire cpu_user_regs struct */ +#define STACK_SWITCH_FRAME_SIZE (UREGS_sizeof + STACK_FRAME_OVERHEAD) +#endif /* __PPC_CONFIG_H__ */ /* * Local variables:
xen/arch/ppc/include/asm/early_printk.h new file +14 -0
@@ -0,0 +1,14 @@ +#ifndef __EARLY_PRINTK_H__ +#define __EARLY_PRINTK_H__ + +#include <xen/early_printk.h> + +#ifdef CONFIG_EARLY_PRINTK +void early_printk_init (bool is_of); +void early_printk (const char *str); +#else +static inline void early_printk_init (bool is_of) {} +static inline void early_printk (const char *s) {} +#endif + +#endif /* __EARLY_PRINTK_H__ */
xen/arch/ppc/include/asm/processor.h +52 -2
72 lines not on this page · raw message
xen/arch/ppc/include/asm/string.h new file +6 -0
@@ -0,0 +1,6 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef _ASM_PPC_STRING_H +#define _ASM_PPC_STRING_H + +#endif /* _ASM_PPC_STRING_H */
xen/arch/ppc/include/asm/types.h new file +64 -0
64 lines not on this page · raw message
xen/arch/ppc/ppc64/asm-offsets.c +55 -0
55 lines not on this page · raw message
xen/arch/ppc/ppc64/head.S +59 -0
62 lines not on this page · raw message
xen/arch/ppc/setup.c +19 -1
@@ -1,9 +1,27 @@/* SPDX-License-Identifier: GPL-2.0-or-later */ #include <xen/compile.h> #include <xen/init.h> +#include <asm/boot.h> +#include <asm/early_printk.h> -void __init noreturnstart_xen (void ) +void __init noreturnstart_xen (unsigned long r3,unsigned long r4, +unsigned long r5,unsigned long r6, +unsigned long r7) { +if ( r5 ) + { +/* OF boot protocol */ +boot_of_init (r5); +early_printk_init (true); + } +else + { +/* kexec boot: Unimplemented */ +__builtin_trap (); + } + +early_printk ("Hello, ppc64le!\n" ); +for ( ;; ) {// Set current hardware thread to very low priority
Signature · 1 line
2.30.2
Re: [PATCH 2/3] xen/ppc: Implement early serial printk on PaPR/pseries
Quoted 11 lines · Shawn Anastasio
On typical Power VMs (e.g. QEMU's -M pseries), a variety of services are provided by OpenFirmware, including an early serial console. Implement the required interfaces to call into OpenFirmware and write to the serial console.
Since OpenFirmware runs in 32-bit Big Endian mode and Xen runs in 64-bit Little Endian mode, a thunk is required to save/restore any potentially-clobbered registers as well as to perform the required endianness switch. Thankfully, linux already has such a routine, which was imported into
head.S.
Quoted 4 lines
Support for bare metal (PowerNV) will be implemented in a future patch.
Signed-off-by Shawn Anastasio <[email protected]>
Just a couple of nits:
Quoted 11 lines
xen/arch/ppc/Kconfig.debug | 5 + xen/arch/ppc/Makefile | 3 +- xen/arch/ppc/boot_of.c | 122 +++++++++++++++++++++++ xen/arch/ppc/configs/openpower_defconfig | 1 + xen/arch/ppc/early_printk.c | 36 +++++++ xen/arch/ppc/include/asm/boot.h | 31 ++++++ xen/arch/ppc/include/asm/bug.h | 6 ++ xen/arch/ppc/include/asm/byteorder.h | 74 ++++++++++++++ xen/arch/ppc/include/asm/cache.h | 6 ++ xen/arch/ppc/include/asm/config.h | 3 + xen/arch/ppc/include/asm/early_printk.h | 14 +++
Quoted 8 lines
xen/arch/ppc/include/asm/processor.h | 54 +++++++++- xen/arch/ppc/include/asm/string.h | 6 ++ xen/arch/ppc/include/asm/types.h | 64 ++++++++++++ xen/arch/ppc/ppc64/asm-offsets.c | 55 ++++++++++ xen/arch/ppc/ppc64/head.S | 59 +++++++++++ xen/arch/ppc/setup.c | 20 +++- 17 files changed, 555 insertions(+), 4 deletions(-) create mode 100644 xen/arch/ppc/boot_of.c
Unless required, in new additions we tend to prefer dashes over underscores. In filenames it is pretty rare that dashes really need avoiding.
xen/arch/ppc/Kconfig.debug line 5
Quoted 9 lines
xen/arch/ppc/Kconfig.debug +5
-0@@ -0,0 +1,5 @@ +config EARLY_PRINTK + bool "Enable early printk" + default DEBUG + help + Enables early printk debug messages
There are many examples of this throughout the patch, which you want to take care of.
xen/arch/ppc/boot_of.c line 1
Quoted 4 lines
xen/arch/ppc/boot_of.c new file +1
-0@@ -0,0 +1,122 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */
By default we mean to use ...
xen/arch/ppc/early_printk.c line 1
Quoted 4 lines
xen/arch/ppc/early_printk.c new file +1
-0@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0 */
... the more modern form of this (GPL-2.0-only). Anything deviating from that may want justifying in the description.
Jan
Re: [PATCH 2/3] xen/ppc: Implement early serial printk on PaPR/pseries
Quoted 6 lines · Jan Beulich
xen/arch/ppc/boot_of.c line 1
Quoted 4 lines
xen/arch/ppc/boot_of.c new file +1
-0@@ -0,0 +1,122 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ By default we mean to use ...
Quoted 6 lines
xen/arch/ppc/early_printk.c line 1
Quoted 4 lines
xen/arch/ppc/early_printk.c new file +1
-0@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0 */ ... the more modern form of this (GPL-2.0-only). Anything deviating from that may want justifying in the description.
GPL-2.0-or-later is fine.
It's only the un-qualified GPL-2.0 form which is deprecated, and should be replaced with an -or-later or -only suffix, as chosen by the copyright holder.
~Andrew
Re: [PATCH 2/3] xen/ppc: Implement early serial printk on PaPR/pseries
Quoted 7 lines · Andrew Cooper
Quoted 6 lines · Jan Beulich
xen/arch/ppc/boot_of.c line 1
Quoted 4 lines
xen/arch/ppc/boot_of.c new file +1
-0@@ -0,0 +1,122 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ By default we mean to use ...
Quoted 8 lines
Quoted 6 lines
xen/arch/ppc/early_printk.c line 1
Quoted 4 lines
xen/arch/ppc/early_printk.c new file +1
-0@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0 */ ... the more modern form of this (GPL-2.0-only). Anything deviating from that may want justifying in the description.
GPL-2.0-or-later is fine.
Hmm, I was merely following
https://lists.xen.org/archives/html/xen-devel/2023-06/msg00415.html.
The text at the top of ./COPYING looks to suggest -only, and I'm unaware of any other place where our default is actually written down.
Jan
Quoted 5 lines
It's only the un-qualified GPL-2.0 form which is deprecated, and should be replaced with an -or-later or -only suffix, as chosen by the copyright holder.
~Andrew
Re: [PATCH 2/3] xen/ppc: Implement early serial printk on PaPR/pseries
Hi,
Quoted 15 lines · Jan Beulich
Quoted 14 lines · Andrew Cooper
Quoted 12 lines · Jan Beulich
xen/arch/ppc/boot_of.c line 1
Quoted 4 lines
xen/arch/ppc/boot_of.c new file +1
-0@@ -0,0 +1,122 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ By default we mean to use ...
xen/arch/ppc/early_printk.c line 1
Quoted 4 lines
xen/arch/ppc/early_printk.c new file +1
-0@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0 */ ... the more modern form of this (GPL-2.0-only). Anything deviating from that may want justifying in the description.
Quoted 6 lines
Quoted 1 line
GPL-2.0-or-later is fine.
Hmm, I was merely following
https://lists.xen.org/archives/html/xen-devel/2023-06/msg00415.html.
The text at the top of ./COPYING looks to suggest -only, and I'm unaware of any other place where our default is actually written down.
We had several discussion in the past about using GPLv2+ license in Xen (see [1], [2]). It has always been unclear what is the impact on contribution with such license. So I think we should stick with GPL-2.0 for new code unless there is a reason to diverge.
Cheers,
[1] https://patchwork.kernel.org/project/xen-devel/patch/[email protected]/#19650817
[2] https://lore.kernel.org/all/alpine.DEB.2.22.394.2208231140140.15247@ubuntu-linux-20-04-desktop/
Signature · 1 line
Julien Grall
Re: [PATCH 2/3] xen/ppc: Implement early serial printk on PaPR/pseries
In reply to Jan BeulichQuoted 14 lines · Jan Beulich
Quoted 13 lines · Andrew Cooper
Quoted 12 lines · Jan Beulich
xen/arch/ppc/boot_of.c line 1
Quoted 4 lines
xen/arch/ppc/boot_of.c new file +1
-0@@ -0,0 +1,122 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ By default we mean to use ...
xen/arch/ppc/early_printk.c line 1
Quoted 4 lines
xen/arch/ppc/early_printk.c new file +1
-0@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0 */ ... the more modern form of this (GPL-2.0-only). Anything deviating from that may want justifying in the description.
Quoted 5 lines
Quoted 1 line
GPL-2.0-or-later is fine.
Hmm, I was merely following
https://lists.xen.org/archives/html/xen-devel/2023-06/msg00415.html.
The text at the top of ./COPYING looks to suggest -only, and I'm unaware of any other place where our default is actually written down.
The license is chosen by the submitter/copyright holder, based on their preferences/wishes.
It's fine for Xen to say "if you've got no vested interest, we recommend GPL-2.0-only", but that is strictly a recommendation and no more.
If the submitter chooses GPL-2.0-or-later, that is their prerogative. We have plenty of GPL-2.0-or-later code in Xen.
~Andrew
Re: [PATCH 2/3] xen/ppc: Implement early serial printk on PaPR/pseries
Hi Andrew,
Quoted 21 lines · Andrew Cooper
Quoted 14 lines · Jan Beulich
Quoted 13 lines · Andrew Cooper
Quoted 12 lines · Jan Beulich
xen/arch/ppc/boot_of.c line 1
Quoted 4 lines
xen/arch/ppc/boot_of.c new file +1
-0@@ -0,0 +1,122 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ By default we mean to use ...
xen/arch/ppc/early_printk.c line 1
Quoted 4 lines
xen/arch/ppc/early_printk.c new file +1
-0@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0 */ ... the more modern form of this (GPL-2.0-only). Anything deviating from that may want justifying in the description.
Quoted 5 lines
Quoted 1 line
GPL-2.0-or-later is fine.
Hmm, I was merely following
https://lists.xen.org/archives/html/xen-devel/2023-06/msg00415.html.
The text at the top of ./COPYING looks to suggest -only, and I'm unaware of any other place where our default is actually written down.
Quoted 8 lines
The license is chosen by the submitter/copyright holder, based on their preferences/wishes.
It's fine for Xen to say "if you've got no vested interest, we recommend GPL-2.0-only", but that is strictly a recommendation and no more.
If the submitter chooses GPL-2.0-or-later, that is their prerogative. We have plenty of GPL-2.0-or-later code in Xen.
From my past experience, the submitters tend to just copy the license from an existing file in Xen rather than explicitly choosing it. So I think it is fair to ask the question because our original and default license is GPLv2 nor GPLv2+.
Cheers,
Signature · 1 line
Julien Grall
Re: [PATCH 2/3] xen/ppc: Implement early serial printk on PaPR/pseries
Quoted 29 lines · Julien Grall
Quoted 28 lines · Andrew Cooper
Quoted 15 lines · Jan Beulich
Quoted 14 lines · Andrew Cooper
Quoted 13 lines · Jan Beulich
xen/arch/ppc/boot_of.c line 1
Quoted 4 lines
xen/arch/ppc/boot_of.c new file +1
-0@@ -0,0 +1,122 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ By default we mean to use ...
xen/arch/ppc/early_printk.c line 1
Quoted 4 lines
xen/arch/ppc/early_printk.c new file +1
-0@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0 */ ... the more modern form of this (GPL-2.0-only). Anything deviating from
that may want justifying in the description.Quoted 5 lines
Quoted 1 line
GPL-2.0-or-later is fine.
Hmm, I was merely following
https://lists.xen.org/archives/html/xen-devel/2023-06/msg00415.html.
The text at the top of ./COPYING looks to suggest -only, and I'm unaware of any other place where our default is actually written down.The license is chosen by the submitter/copyright holder, based on their preferences/wishes.
It's fine for Xen to say "if you've got no vested interest, we recommend GPL-2.0-only", but that is strictly a recommendation and no more.
Quoted 7 lines
Quoted 2 lines
If the submitter chooses GPL-2.0-or-later, that is their prerogative. We have plenty of GPL-2.0-or-later code in Xen.
From my past experience, the submitters tend to just copy the license from an existing file in Xen rather than explicitly choosing it. So I think it is fair to ask the question because our original and default license is GPLv2 nor GPLv2+.
Did you read the bit in the cover letter about part of this code being derived from the out-of-tree port years ago?
You're blindly assuming that there is even a choice of license available to be used.
The submitter chooses the license to use. You can request that they justify it, but you cannot demand that they change it.
~Andrew
Re: [PATCH 2/3] xen/ppc: Implement early serial printk on PaPR/pseries
Hi Andrew,
Quoted 33 lines · Andrew Cooper
Quoted 32 lines · Julien Grall
Quoted 30 lines · Andrew Cooper
Quoted 15 lines · Jan Beulich
Quoted 14 lines · Andrew Cooper
Quoted 13 lines · Jan Beulich
xen/arch/ppc/boot_of.c line 1
Quoted 4 lines
xen/arch/ppc/boot_of.c new file +1
-0@@ -0,0 +1,122 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ By default we mean to use ...
xen/arch/ppc/early_printk.c line 1
Quoted 4 lines
xen/arch/ppc/early_printk.c new file +1
-0@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0 */ ... the more modern form of this (GPL-2.0-only). Anything deviating from
that may want justifying in the description.Quoted 5 lines
Quoted 1 line
GPL-2.0-or-later is fine.
Hmm, I was merely following
https://lists.xen.org/archives/html/xen-devel/2023-06/msg00415.html.
The text at the top of ./COPYING looks to suggest -only, and I'm unaware of any other place where our default is actually written down.The license is chosen by the submitter/copyright holder, based on their preferences/wishes.
It's fine for Xen to say "if you've got no vested interest, we recommend GPL-2.0-only", but that is strictly a recommendation and no more.
If the submitter chooses GPL-2.0-or-later, that is their prerogative. We have plenty of GPL-2.0-or-later code in Xen.
Quoted 7 lines
Quoted 4 lines
From my past experience, the submitters tend to just copy the license
from an existing file in Xen rather than explicitly choosing it. So I think it is fair to ask the question because our original and default license is GPLv2 nor GPLv2+.Did you read the bit in the cover letter about part of this code being derived from the out-of-tree port years ago?
Yes I read it... But I didn't check the original license and ...
Quoted 3 lines
You're blindly assuming that there is even a choice of license available to be used.
... I didn't assume anything here. I made a generic statement because your e-mail lead to think that all the submitter made a conscious decision.
Note that, from past discussion, we agreed that it would be fine to re-license from gplv2+ to gplv2-only without requesting the original author. So technically there is a choice.
As a side note, "blindly" is not very inclusive. We may have different view, but it doesn't mean yours is better than mine (and vice-versa). You could have express your opinion without saying "blindly" and it would have come across less rude.
Quoted 2 lines
The submitter chooses the license to use. You can request that they justify it, but you cannot demand that they change it.
Strictly speaking we can refuse any code. That count for license as well. Anyway, I didn't request a change here. I merely pointed out that any use of GPLv2+ should be justified because on Arm most of the people don't pay attention on the license and pick the one from an existing file.
Cheers,
Signature · 1 line
Julien Grall
Re: [PATCH 2/3] xen/ppc: Implement early serial printk on PaPR/pseries
Quoted 4 lines · Julien Grall
Strictly speaking we can refuse any code. That count for license as well. Anyway, I didn't request a change here. I merely pointed out that any use of GPLv2+ should be justified because on Arm most of the people don't pay attention on the license and pick the one from an existing file.
Hi Julien,
The choice of GPLv2+ for many of the files in this patchset was indeed inherited from old IBM-written Xen code that the files in question were derived from. I did not realize it was permissible or even desirable to relicense those to GPLv2-only.
As for the new files, GPLv2+ was chosen to remain consistent and to open the door for future derivations from GPLv2+ licensed code, either from the older Xen tree or from the Linux ppc tree, much of which is also licensed as GPLv2+. If it would reduce friction, these files could be relicensed to GPLv2-only.
Thanks,
Shawn
Re: [PATCH 2/3] xen/ppc: Implement early serial printk on PaPR/pseries
Hi Shawn,
Quoted 13 lines · Shawn Anastasio
Quoted 4 lines · Julien Grall
Strictly speaking we can refuse any code. That count for license as well. Anyway, I didn't request a change here. I merely pointed out that any use of GPLv2+ should be justified because on Arm most of the people don't pay attention on the license and pick the one from an existing file.
Hi Julien,
The choice of GPLv2+ for many of the files in this patchset was indeed inherited from old IBM-written Xen code that the files in question were derived from. I did not realize it was permissible or even desirable to relicense those to GPLv2-only.
Quoted 5 lines
As for the new files, GPLv2+ was chosen to remain consistent and to open the door for future derivations from GPLv2+ licensed code, either from the older Xen tree or from the Linux ppc tree, much of which is also licensed as GPLv2+. If it would reduce friction, these files could be relicensed to GPLv2-only.
(Before someone points out, I know this is already a problem on other part of Xen. But it would be ideal if we avoid spreading this mess on new architectures :).
Thanks for the explanations. To clarify, are you saying that all the files will be GPLv2+ or just some?
If the latter, then my concern would be that if you need to import GPLv2-only code, then you may need to write your code in a different file. This may become messy to handle and some developer may end up to be confused.
I am not a lawyer though, so you may want to check the implications here.
Cheers,
Signature · 1 line
Julien Grall
Re: [PATCH 2/3] xen/ppc: Implement early serial printk on PaPR/pseries
Quoted 2 lines · Julien Grall
Thanks for the explanations. To clarify, are you saying that all the files will be GPLv2+ or just some?
My idea was to license any file where I expect there to derivations from existing code as GPLv2+, and fall back to GPLv2-only for newly-written files for which I expect there to be no reuse of existing GPLv2+ code.
Quoted 4 lines
If the latter, then my concern would be that if you need to import GPLv2-only code, then you may need to write your code in a different file. This may become messy to handle and some developer may end up to be confused.
Agreed, and I definitely want to minimize confusion. Ultimately I think situations like this will be unavoidable, though, since derivations will likely need to be made from both GPLv2-only and GPLv2+ code.
Quoted 1 line
Cheers,
Thanks,
Shawn
Re: [PATCH 2/3] xen/ppc: Implement early serial printk on PaPR/pseries
In reply to Julien GrallQuoted 30 lines · Julien Grall
Hi Shawn,
Quoted 5 lines · Shawn Anastasio
Quoted 4 lines · Julien Grall
Strictly speaking we can refuse any code. That count for license as well. Anyway, I didn't request a change here. I merely pointed out that any use of GPLv2+ should be justified because on Arm most of the people don't pay attention on the license and pick the one from an existing
file.
Quoted 8 lines
Hi Julien,
The choice of GPLv2+ for many of the files in this patchset was indeed inherited from old IBM-written Xen code that the files in question were derived from. I did not realize it was permissible or even desirable to relicense those to GPLv2-only.
Quoted 5 lines
As for the new files, GPLv2+ was chosen to remain consistent and to open the door for future derivations from GPLv2+ licensed code, either from the older Xen tree or from the Linux ppc tree, much of which is also licensed as GPLv2+. If it would reduce friction, these files could be relicensed to GPLv2-only.
(Before someone points out, I know this is already a problem on other part of Xen. But it would be ideal if we avoid spreading this mess on new architectures :).
Thanks for the explanations. To clarify, are you saying that all the files will be GPLv2+ or just some?
Quoted 7 lines
If the latter, then my concern would be that if you need to import GPLv2-only code, then you may need to write your code in a different file. This may become messy to handle and some developer may end up to be confused.
I am not a lawyer though, so you may want to check the implications here.
Shawn,
Again sorry that you've sort of bumped a hornet's nest here.
Just to clarify, the situation as I understand it is:
1. Large parts of Xen, being inherited from the Linux Kernel, are GPLv2-only; and the documentation clearly states that code is GPLv2-only unless explicitly stated otherwise.
2. Some individual files in Xen are labelled as GPLv2-or-later; but as they rely on the "only" files, Xen as a whole can only be compiled under a GPLv2 license.
3. New contributions to a file assumed to have the same license as the header of the file; i.e., the code contained in patches to GPLv2-or-later files is assumed to be granted according to a GPLv2-or-later license.
4. In the past, the legal teams of some contributors -- namely ARM -- were wary of the GPLv3; specifically the patent grant. Since ARM doesn't make anything themselves, their patents are literally their product; they need to be very careful of not accidentally granting them to the world. I think one thing ARM may have been afraid of at some point is one of their engineers accidentally submitting a patch to a GPLv2-or-later file which would, when taken with a GPLv3 (or GPLv4 license, once it comes out) cause them to lose too much control over their IP.
My understanding is that Julien is afraid that if the "GPLv2-or-later" files start to proliferate, that companies like ARM will start to become more wary of contributing; and so has been generally trying to encourage new files to be labelled "GPLv2-only" unless there's a good reason to do otherwise. (Other issues like copying code from GPLv2-only are potential pitfalls as well, but probably less important.)
HOWEVER, as Andrew says, there is no official policy at this point; all the document say is that GPLv2-only is the default unless explicitly stated otherwise.
Furthermore, the concerns raised by ARM's legal team were nearly a decade ago; it's not clear to me whether they still care that much.
All that to say: If you don't mind and feel that you can do so legally, then consider switching to GPLv2-only; but if you don't want to and/or feel that you can't do so legally, feel free to leave it as-is.
Additionally, I think it would be good if the community *did* have a discussion about whether we want an official policy; so that either we can point people to the relevant doc (with explanation), or stop bothering about it. :-)
-George
Re: [PATCH 2/3] xen/ppc: Implement early serial printk on PaPR/pseries
Hi George,
Thanks for the summary! A couple of comments below.
Quoted 50 lines · George Dunlap
Quoted 30 lines · Julien Grall
Hi Shawn,
Quoted 5 lines · Shawn Anastasio
Quoted 4 lines · Julien Grall
Strictly speaking we can refuse any code. That count for license as well. Anyway, I didn't request a change here. I merely pointed out that any use of GPLv2+ should be justified because on Arm most of the people don't pay attention on the license and pick the one from an existing
file.
Quoted 8 lines
Hi Julien,
The choice of GPLv2+ for many of the files in this patchset was indeed inherited from old IBM-written Xen code that the files in question were derived from. I did not realize it was permissible or even desirable to relicense those to GPLv2-only.
Quoted 5 lines
As for the new files, GPLv2+ was chosen to remain consistent and to open the door for future derivations from GPLv2+ licensed code, either from the older Xen tree or from the Linux ppc tree, much of which is also licensed as GPLv2+. If it would reduce friction, these files could be relicensed to GPLv2-only.
(Before someone points out, I know this is already a problem on other part of Xen. But it would be ideal if we avoid spreading this mess on new architectures :).
Thanks for the explanations. To clarify, are you saying that all the files will be GPLv2+ or just some?
Quoted 7 lines
If the latter, then my concern would be that if you need to import GPLv2-only code, then you may need to write your code in a different file. This may become messy to handle and some developer may end up to be confused.
I am not a lawyer though, so you may want to check the implications here.
Shawn,
Again sorry that you've sort of bumped a hornet's nest here.
Just to clarify, the situation as I understand it is:
1. Large parts of Xen, being inherited from the Linux Kernel, are GPLv2-only; and the documentation clearly states that code is GPLv2-only unless explicitly stated otherwise.
Quoted 7 lines
2. Some individual files in Xen are labelled as GPLv2-or-later; but as they rely on the "only" files, Xen as a whole can only be compiled under a GPLv2 license.
3. New contributions to a file assumed to have the same license as the header of the file; i.e., the code contained in patches to GPLv2-or-later files is assumed to be granted according to a GPLv2-or-later license.
The new contribution here could be code imported from Linux that would be GPLv2-only in GPLv2-or-later file. It is not clear to me what would be the legal implication.
Quoted 10 lines
4. In the past, the legal teams of some contributors -- namely ARM -- were wary of the GPLv3; specifically the patent grant. Since ARM doesn't make anything themselves, their patents are literally their product; they need to be very careful of not accidentally granting them to the world. I think one thing ARM may have been afraid of at some point is one of their engineers accidentally submitting a patch to a GPLv2-or-later file which would, when taken with a GPLv3 (or GPLv4 license, once it comes out) cause them to lose too much control over their IP.
Quoted 6 lines
My understanding is that Julien is afraid that if the "GPLv2-or-later" files start to proliferate, that companies like ARM will start to become more wary of contributing; and so has been generally trying to encourage new files to be labelled "GPLv2-only" unless there's a good reason to do otherwise. (Other issues like copying code from GPLv2-only are potential pitfalls as well, but probably less important.)
There is that and also the fact that we now need to be more careful when importing code from Linux. In Shawn's case this is mitigated by the fact that the license in Xen files should match the one in Linux.
Quoted 4 lines
Additionally, I think it would be good if the community *did* have a discussion about whether we want an official policy; so that either we can point people to the relevant doc (with explanation), or stop bothering about it. :-)
+1. Do you think that would be a good topic for Xen Summit?
Cheers,
Signature · 1 line
Julien Grall
Re: [PATCH 2/3] xen/ppc: Implement early serial printk on PaPR/pseries
In reply to George DunlapQuoted 5 lines · George Dunlap
Shawn,
Again sorry that you've sort of bumped a hornet's nest here.
Just to clarify, the situation as I understand it is:
Hi George,
No problem, and thank you for the detailed explanation.
Quoted 10 lines
HOWEVER, as Andrew says, there is no official policy at this point; all the document say is that GPLv2-only is the default unless explicitly stated otherwise.
Furthermore, the concerns raised by ARM's legal team were nearly a decade ago; it's not clear to me whether they still care that much.
All that to say: If you don't mind and feel that you can do so legally, then consider switching to GPLv2-only; but if you don't want to and/or feel that you can't do so legally, feel free to leave it as-is.
I'll definitely keep this in mind when creating new files that don't need to include GPLv2+ code.
Quoted 1 line
-George
Thanks,
Shawn
Re: [PATCH 2/3] xen/ppc: Implement early serial printk on PaPR/pseries
In reply to Jan BeulichQuoted 20 lines · Jan Beulich
Quoted 11 lines
xen/arch/ppc/Kconfig.debug | 5 + xen/arch/ppc/Makefile | 3 +- xen/arch/ppc/boot_of.c | 122 +++++++++++++++++++++++ xen/arch/ppc/configs/openpower_defconfig | 1 + xen/arch/ppc/early_printk.c | 36 +++++++ xen/arch/ppc/include/asm/boot.h | 31 ++++++ xen/arch/ppc/include/asm/bug.h | 6 ++ xen/arch/ppc/include/asm/byteorder.h | 74 ++++++++++++++ xen/arch/ppc/include/asm/cache.h | 6 ++ xen/arch/ppc/include/asm/config.h | 3 + xen/arch/ppc/include/asm/early_printk.h | 14 +++Quoted 8 lines
xen/arch/ppc/include/asm/processor.h | 54 +++++++++- xen/arch/ppc/include/asm/string.h | 6 ++ xen/arch/ppc/include/asm/types.h | 64 ++++++++++++ xen/arch/ppc/ppc64/asm-offsets.c | 55 ++++++++++ xen/arch/ppc/ppc64/head.S | 59 +++++++++++ xen/arch/ppc/setup.c | 20 +++- 17 files changed, 555 insertions(+), 4 deletions(-) create mode 100644 xen/arch/ppc/boot_of.c
Quoted 3 lines
Unless required, in new additions we tend to prefer dashes over underscores. In filenames it is pretty rare that dashes really need avoiding.
Thanks for pointing that out -- I'll fix this in v2.
Quoted 4 lines
Quoted 4 lines
xen/arch/ppc/Kconfig.debug +1
-0@@ -0,0 +1,5 @@ +config EARLY_PRINTK
Quoted 8 lines
xen/arch/ppc/Kconfig.debug line 5
Quoted 5 lines
xen/arch/ppc/Kconfig.debug +4
-0+ bool "Enable early printk" + default DEBUG + help + Enables early printk debug messagesThere are many examples of this throughout the patch, which you want to take care of.
Ditto.
Quoted 7 lines
xen/arch/ppc/boot_of.c line 1
Quoted 4 lines
xen/arch/ppc/boot_of.c new file +1
-0@@ -0,0 +1,122 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ By default we mean to use ...
Quoted 7 lines
xen/arch/ppc/early_printk.c line 1
Quoted 4 lines
xen/arch/ppc/early_printk.c new file +1
-0@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0 */ ... the more modern form of this (GPL-2.0-only). Anything deviating from that may want justifying in the description.
Got it -- I'll clean this up as well.
Quoted 1 line
Jan
Thanks,
Shawn
PATCH 3/3 maintainers: Add PPC64 maintainer
In reply to Shawn Anastasio--- MAINTAINERS | 3 +++ 1 file changed, 3 insertions(+)
MAINTAINERS +3 -0
@@ -451,6 +451,9 @@ M: Wei Liu <[email protected]> S: Supported T: git https://xenbits.xenproject.org/git-http/ovmf.git +PPC64 +M: Shawn Anastasio <[email protected]> + POWER MANAGEMENT M: Jan Beulich <[email protected]> S: Supported
Signature · 1 line
2.30.2
Re: [PATCH 3/3] maintainers: Add PPC64 maintainer
MAINTAINERS M: Wei Liu <[email protected]> · line 459
Quoted 12 lines · Shawn Anastasio
MAINTAINERS +3
-0@@ -451,6 +451,9 @@ M: Wei Liu <[email protected]> S: Supported T: git https://xenbits.xenproject.org/git-http/ovmf.git +PPC64 +M: Shawn Anastasio <[email protected]> + POWER MANAGEMENT M: Jan Beulich <[email protected]> S: Supported
Nit: You want to move your insertion further down, to maintain alphabetic sorting. You further want at least one F: line; see e.g. RISC-V's entry.
Jan
Re: [PATCH 3/3] maintainers: Add PPC64 maintainer
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Shawn Anastasio
MAINTAINERS +0
-0@@ -451,6 +451,9 @@ M: Wei Liu <[email protected]> S: Supported T: git https://xenbits.xenproject.org/git-http/ovmf.git
Quoted 9 lines
MAINTAINERS M: Wei Liu <[email protected]> · line 459
Quoted 6 lines
MAINTAINERS +3
-0+PPC64 +M: Shawn Anastasio <[email protected]> + POWER MANAGEMENT M: Jan Beulich <[email protected]> S: SupportedNit: You want to move your insertion further down, to maintain alphabetic sorting. You further want at least one F: line; see e.g. RISC-V's entry.
Will fix in v2.
Quoted 1 line
Jan
Thanks,
Shawn
Quoted 24 lines · Shawn Anastasio
Hello all,
This patch series adds support for building a minimal image (head.o-only) for Power ISA 2.07B+ (POWER8+) systems. The first patch boots to an infinite loop and the second adds early serial console support on pseries VMs, with bare metal support planned next.
Since Xen previously had support for a much older version of the ISA in version 3.2.3, we were able to carry over some headers and support routines from that version. Unlike that initial port though, this effort focuses solely on POWER8+ CPUs that are capable of running in Little Endian mode.
With an appropriate powerpc64le-linux-gnu cross-toolchain, the minimal image can be built with:
$ make XEN_TARGET_ARCH=ppc64 -C xen openpower_defconfig $ make XEN_TARGET_ARCH=ppc64 SUBSYSTEMS=xen -C xen TARGET=ppc64/head.oThe resulting head.o can then be booted in a standard QEMU/pseries VM:
$ qemu-system-ppc64 -M pseries-5.2 -m 256M -kernel xen/ppc64/head.o \ -vga none -serial mon:stdio -nographic
Quoted 7 lines
Thanks,
ShawnShawn Anastasio (3):
xen: Add files needed for minimal Power build xen/ppc: Implement early serial printk on PaPR/pseries
maintainers: Add PPC64 maintainer
Oh wow - this is a surprise, but certainly a good one.
We've recently done just a similar exercise with RISCV64, starting with getting cross-compilation and a basic smoke test into our CI.
We use gitlab CI, and one example is
https://gitlab.com/xen-project/xen/-/pipelines/889871648 (search for riscv64 in amongst all the x86 and ARM).
The configuration is all in tree, in the automation/ directory. Relevant files to copy/tweak are:
automation/build/archlinux/current-riscv64.dockerfile (x86 cross compile container)automation/scripts/qemu-smoke-riscv64.sh (smoke test script) automation/gitlab-ci/{build,test}.yaml (wire the jobs up)
The smoke test looks on stdout for "All set up" which can be any string put out via earlyprintk.
If you look around in the Xen tree at bb62c25e3e5c and take the makefile override's in particular, you should be able to get make -C xen build work without any magic TARGET= overrides, and without most of the headers you've added in patch 1. The trick is to have a head.S which doesn't include any files (except the config.h it gets implicitly).
We're still trying to do some re-arranging to the common / arch split to remove unnecessary boilerplate. Having a set of PPC headers too will make it easier to spot the rough edges in the current boundary.
Looking to the future, where could XenProject get some real hardware to put into our CI systems? We'd want to do that in due course.
I see you've nominated yourself as maintainer, which is of course fine. How much time do you have to put towards this? It is some part of a full time job, or just your own free time?
Do you have any suggested reading for those of us who are invariably going to need to learn some of the CPU/platform/architecture details, but aren't really PPC-literate right now?
Thanks, and welcome.
~Andrew
Quoted 1 line · Andrew Cooper
Oh wow - this is a surprise, but certainly a good one.
I'm glad to hear that!
Quoted 2 lines
We've recently done just a similar exercise with RISCV64, starting with getting cross-compilation and a basic smoke test into our CI.
I see. I used the initial RISC-V patch as a model for patch 1, though I didn't realize that the TARGET= override were unnecessary for getting a minimal image building.
Quoted 7 lines
We use gitlab CI, and one example is
https://gitlab.com/xen-project/xen/-/pipelines/889871648 (search for riscv64 in amongst all the x86 and ARM).The configuration is all in tree, in the automation/ directory. Relevant files to copy/tweak are:
Quoted 7 lines
automation/build/archlinux/current-riscv64.dockerfile (x86 cross compile container)
automation/scripts/qemu-smoke-riscv64.sh(smoke test script)automation/gitlab-ci/{build,test}.yaml(wire the jobs up)The smoke test looks on stdout for "All set up" which can be any string put out via earlyprintk.
Thanks for the pointer -- I'll use this as a model to implement a similar smoke test for PPC64.
Quoted 5 lines
If you look around in the Xen tree at
bb62c25e3e5cand take the makefile override's in particular, you should be able to getmake -C xen buildwork without any magic TARGET= overrides, and without most of the headers you've added in patch 1. The trick is to have ahead.Swhich doesn't include any files (except theconfig.hit gets implicitly).
Perfect. I'll start work on a v2 without the TARGET= overrides and without the headers in patch #1.
Quoted 3 lines
We're still trying to do some re-arranging to the common / arch split to remove unnecessary boilerplate. Having a set of PPC headers too will make it easier to spot the rough edges in the current boundary.
Great. I've been using arch/arm and arch/riscv as models for which headers to define (as well as the build errors that inevitably pop up when including xen/lib.h or similar). Is this a reasonable approach for now?
Quoted 2 lines
Looking to the future, where could XenProject get some real hardware to put into our CI systems? We'd want to do that in due course.
As an employee of Raptor Engineering, my recommendation for an OpenPOWER system would definitely be the Talos II or Blackbird families from Raptor Computing Systems: https://www.raptorcs.com/ :)
Quoted 3 lines
I see you've nominated yourself as maintainer, which is of course fine. How much time do you have to put towards this? It is some part of a full time job, or just your own free time?
I'm currently working on the port full-time for Raptor Engineering.
Quoted 3 lines
Do you have any suggested reading for those of us who are invariably going to need to learn some of the CPU/platform/architecture details, but aren't really PPC-literate right now?
We have a pretty extensive library of documentation covering the ISA as well as CPU and platform details available here:
https://wiki.raptorcs.com/wiki/Category:Documentation
Quoted 1 line
Thanks, and welcome.
Thanks!
Shawn
Quoted 7 lines · Shawn Anastasio
Quoted 5 lines
If you look around in the Xen tree at
bb62c25e3e5cand take the makefile override's in particular, you should be able to getmake -C xen buildwork without any magic TARGET= overrides, and without most of the headers you've added in patch 1. The trick is to have ahead.Swhich doesn't include any files (except theconfig.hit gets implicitly).Perfect. I'll start work on a v2 without the TARGET= overrides and without the headers in patch #1.
Ok, in which case you probably want a first patch series doing:
1) New docker container (only - this wants to be taken early and set up in CI)
2) one-or-more initial build system + head.S infinite loop patch. Probably the maintainer patch too.
3) Wiring the build(s) into build.yaml
You'll want to join the https://gitlab.com/xen-project/ and I can set you up with a place to run the full CI (we have a reasonably custom setup which the communal runners don't like). You may also want to hang out on oftc.org #xendevel and/or the matrix bridge thereof.
Then a second patch series doing early printk, and adding the smoke test script and wiring it into test.yaml.
~Andrew
Quoted 8 lines · Andrew Cooper
Ok, in which case you probably want a first patch series doing:
1) New docker container (only - this wants to be taken early and set up in CI)
2) one-or-more initial build system +head.Sinfinite loop patch. Probably the maintainer patch too.
3) Wiring the build(s) intobuild.yaml
Quoted 7 lines
You'll want to join the https://gitlab.com/xen-project/ and I can set you up with a place to run the full CI (we have a reasonably custom setup which the communal runners don't like). You may also want to hang out on oftc.org #xendevel and/or the matrix bridge thereof.
Then a second patch series doing early printk, and adding the smoke test script and wiring it into
test.yaml.
Sounds good. I've gone ahead and requested access to that GitLab organization and will get to work on a series doing the things you've requested.
P.S. It seems mail from my server is getting rejected by your server, so I'm unable to respond to you directly. Once I have access to my corporate email this should be resolved, but until then I'll reach out to you from a personal email address.
Thanks.