Initial support for Power
PATCH v3 3/4 automation: Add ppc64le cross-build jobs
In reply to Shawn AnastasioAdd build jobs to cross-compile Xen for ppc64le.
--- automation/gitlab-ci/build.yaml | 60 +++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+)
automation/gitlab-ci/build.yaml +60 -0
@@ -183,6 +183,33 @@ variables: <<: *gcc +.ppc64le-cross-build-tmpl: + <<: *build + variables: + XEN_TARGET_ARCH: ppc64 + tags: + - x86_64 + +.ppc64le-cross-build: + extends: .ppc64le-cross-build-tmpl + variables: + debug: n + +.ppc64le-cross-build-debug: + extends: .ppc64le-cross-build-tmpl + variables: + debug: y + +.gcc-ppc64le-cross-build: + extends: .ppc64le-cross-build + variables: + <<: *gcc + +.gcc-ppc64le-cross-build-debug: + extends: .ppc64le-cross-build-debug + variables: + <<: *gcc + .yocto-test: stage: build image: registry.gitlab.com/xen-project/xen/${CONTAINER}
@@ -516,6 +543,39 @@ archlinux-current-gcc-riscv64-debug-randconfig: EXTRA_FIXED_RANDCONFIG: CONFIG_COVERAGE=n +# Power cross-build +debian-bullseye-gcc-ppc64le: + extends: .gcc-ppc64le-cross-build + variables: + CONTAINER: debian:bullseye-ppc64le + KBUILD_DEFCONFIG: openpower_defconfig + HYPERVISOR_ONLY: y + +debian-bullseye-gcc-ppc64le-debug: + extends: .gcc-ppc64le-cross-build-debug + variables: + CONTAINER: debian:bullseye-ppc64le + KBUILD_DEFCONFIG: openpower_defconfig + HYPERVISOR_ONLY: y + +debian-bullseye-gcc-ppc64le-randconfig: + extends: .gcc-ppc64le-cross-build + variables: + CONTAINER: debian:bullseye-ppc64le + KBUILD_DEFCONFIG: openpower_defconfig + RANDCONFIG: y + EXTRA_FIXED_RANDCONFIG: + CONFIG_COVERAGE=n + +debian-bullseye-gcc-ppc64le-debug-randconfig: + extends: .gcc-ppc64le-cross-build-debug + variables: + CONTAINER: debian:bullseye-ppc64le + KBUILD_DEFCONFIG: openpower_defconfig + RANDCONFIG: y + EXTRA_FIXED_RANDCONFIG: + CONFIG_COVERAGE=n + # Yocto test jobs yocto-qemuarm64: extends: .yocto-test-arm64
Signature · 1 line
2.30.2
PATCH v3 4/4 maintainers: Add ppc64 maintainer
In reply to Shawn Anastasio--- MAINTAINERS | 4 ++++ 1 file changed, 4 insertions(+)
MAINTAINERS +4 -0
@@ -460,6 +460,10 @@ X: xen/arch/x86/acpi/lib.c F: xen/drivers/cpufreq/ F: xen/include/acpi/cpufreq/ +PPC64 +M: Shawn Anastasio <[email protected]> +F: xen/arch/ppc/ + PUBLIC I/O INTERFACES AND PV DRIVERS DESIGNS M: Juergen Gross <[email protected]> S: Supported
Signature · 1 line
2.30.2
v3 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 build
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/xen \ -vga none -serial mon:stdio -nographic
Thanks,
Shawn
--
Changes from v3:
- Fix formatting of MAINTAINERS patch
Changes from v2:
- Add ppc64le cross-build container patch
- Add ppc64le cross build CI job patch
- Drop serial output patch (will be in future patch series)
- Drop setup.c and unneeded headers from minimal build patch
- Fixed ordering of MAINTAINERS patch + add F: line
- Fix config/ppc64.mk option names
- Clarify Kconfig Baseline ISA option help strings
Shawn Anastasio (4):
automation: Add container for ppc64le builds
xen: Add files needed for minimal ppc64le build
automation: Add ppc64le cross-build jobs
maintainers: Add ppc64 maintainer
MAINTAINERS | 4 + .../build/debian/bullseye-ppc64le.dockerfile | 28 +++ automation/gitlab-ci/build.yaml | 60 ++++++ automation/scripts/containerize | 1 + config/ppc64.mk | 5 + xen/Makefile | 5 +- xen/arch/ppc/Kconfig | 42 +++++ xen/arch/ppc/Kconfig.debug | 0 xen/arch/ppc/Makefile | 16 ++ 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/page-bits.h | 7 + xen/arch/ppc/ppc64/Makefile | 1 + xen/arch/ppc/ppc64/asm-offsets.c | 0 xen/arch/ppc/ppc64/head.S | 27 +++ xen/arch/ppc/xen.lds.S | 173 ++++++++++++++++++ 18 files changed, 454 insertions(+), 2 deletions(-) create mode 100644 automation/build/debian/bullseye-ppc64le.dockerfile 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/page-bits.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/xen.lds.S
Signature · 1 line
2.30.2
PATCH v3 1/4 automation: Add container for ppc64le builds
Add a container for cross-compiling xen for ppc64le.
--- .../build/debian/bullseye-ppc64le.dockerfile | 28 +++++++++++++++++++ automation/scripts/containerize | 1 + 2 files changed, 29 insertions(+) create mode 100644 automation/build/debian/bullseye-ppc64le.dockerfile
automation/build/debian/bullseye-ppc64le.dockerfile new file +28 -0
@@ -0,0 +1,28 @@ +FROM debian:bullseye-slim +LABEL maintainer.name="The Xen Project" \ + maintainer.email="[email protected]" + +ENV DEBIAN_FRONTEND=noninteractive +ENV USER root + +# Add compiler path +ENV CROSS_COMPILE powerpc64le-linux-gnu- + +RUN mkdir /build +WORKDIR /build + +# build depends +RUN apt-get update && \ + apt-get --quiet --yes --no-install-recommends install \ + bison \ + build-essential \ + checkpolicy \ + flex \ + gawk \ + gcc-powerpc64le-linux-gnu \ + make \ + python3-minimal \ + && \ + apt-get autoremove -y && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
automation/scripts/containerize +1 -0
@@ -33,6 +33,7 @@ case "_${CONTAINER}" in _focal) CONTAINER="${BASE}/ubuntu:focal" ;; _jessie) CONTAINER="${BASE}/debian:jessie" ;; _jessie-i386) CONTAINER="${BASE}/debian:jessie-i386" ;; + _bullseye-ppc64le) CONTAINER="${BASE}/debian:bullseye-ppc64le" ;; _stretch|_) CONTAINER="${BASE}/debian:stretch" ;; _stretch-i386) CONTAINER="${BASE}/debian:stretch-i386" ;; _buster-gcc-ibt) CONTAINER="${BASE}/debian:buster-gcc-ibt" ;;
Signature · 1 line
2.30.2
PATCH v3 2/4 xen: Add files needed for minimal ppc64le build
In reply to Shawn AnastasioAdd the build system changes required to build for ppc64le (POWER8+). As of now the resulting image simply boots to an infinite loop.
$ make XEN_TARGET_ARCH=ppc64 -C xen openpower_defconfig $ make XEN_TARGET_ARCH=ppc64 SUBSYSTEMS=xen -C xen build
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 xen/xen
--- config/ppc64.mk | 5 + xen/Makefile | 5 +- xen/arch/ppc/Kconfig | 42 ++++++ xen/arch/ppc/Kconfig.debug | 0 xen/arch/ppc/Makefile | 16 +++ 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/page-bits.h | 7 + xen/arch/ppc/ppc64/Makefile | 1 + xen/arch/ppc/ppc64/asm-offsets.c | 0 xen/arch/ppc/ppc64/head.S | 27 ++++ xen/arch/ppc/xen.lds.S | 173 +++++++++++++++++++++++ 14 files changed, 361 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/page-bits.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/xen.lds.S
config/ppc64.mk new file +5 -0
@@ -0,0 +1,5 @@ +CONFIG_PPC := y +CONFIG_PPC64 := y +CONFIG_PPC_$(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 +16 -0
@@ -0,0 +1,16 @@ +obj-$(CONFIG_PPC64) += ppc64/ + +$(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/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/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 +27 -0
@@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +.section .text.header, "ax", %progbits + +ENTRY(start) + /* + * Depending on how we were booted, the CPU could be running in either + * Little Endian or Big Endian mode. The following trampoline from Linux + * cleverly uses an instruction that encodes to a NOP if the CPU's + * endianness matches the assumption of the assembler (LE, in our case) + * or a branch to code that performs the endian switch in the other case. + */ + tdi 0, 0, 0x48 /* Reverse endian of b . + 8 */ + b $ + 44 /* Skip trampoline if endian is good */ + .long 0xa600607d /* mfmsr r11 */ + .long 0x01006b69 /* xori r11,r11,1 */ + .long 0x00004039 /* li r10,0 */ + .long 0x6401417d /* mtmsrd r10,1 */ + .long 0x05009f42 /* bcl 20,31,$+4 */ + .long 0xa602487d /* mflr r10 */ + .long 0x14004a39 /* addi r10,r10,20 */ + .long 0xa6035a7d /* mtsrr0 r10 */ + .long 0xa6037b7d /* mtsrr1 r11 */ + .long 0x2400004c /* rfid */ + + /* Now that the endianness is confirmed, continue */ +1: b 1b
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 v3 2/4] xen: Add files needed for minimal ppc64le build
xen/arch/ppc/Makefile line 10
Quoted 13 lines · Shawn Anastasio
xen/arch/ppc/Makefile new file +10
-0@@ -0,0 +1,16 @@ +obj-$(CONFIG_PPC64) += ppc64/ + +$(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
Elsewhere we recently switched these uses of $(@D)/$(@F) to just $@. Please can you do so here as well?
xen/arch/ppc/arch.mk line 7
Quoted 10 lines
xen/arch/ppc/arch.mk new file +7
-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
Wouldn't it make sense to also pass -mlittle here, such that a tool chain defaulting to big-endian can still be used?
Quoted 7 lines
xen/arch/ppc/ppc64/head.S new file +4
-0@@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +.section .text.header, "ax", %progbits +
xen/arch/ppc/ppc64/head.S line 14
Quoted 10 lines
xen/arch/ppc/ppc64/head.S new file +10
-0+ENTRY(start) + /* + * Depending on how we were booted, the CPU could be running in either + * Little Endian or Big Endian mode. The following trampoline from Linux + * cleverly uses an instruction that encodes to a NOP if the CPU's + * endianness matches the assumption of the assembler (LE, in our case) + * or a branch to code that performs the endian switch in the other case. + */ + tdi 0, 0, 0x48 /* Reverse endian of b . + 8 */ + b $ + 44 /* Skip trampoline if endian is good */
If I get this right, $ and . are interchangable on Power? If not, then all is fine and there likely is a reason to use . in the comment but $ in the code. But if so, it would be nice if both could match, and I guess with other architectures in mind . would be preferable.
Quoted 135 lines
xen/arch/ppc/xen.lds.S new file +132
-0@@ -0,0 +1,173 @@ +#include <xen/xen.lds.h> + +#undef ENTRY +#undef ALIGN + +OUTPUT_ARCH(powerpc:common64) +ENTRY(start) + +PHDRS +{ + text PT_LOAD ; +#if defined(BUILD_ID) + note PT_NOTE ; +#endif +} + +/** + * OF's base load address is 0x400000 (XEN_VIRT_START). + * By defining sections this way, we can keep our virtual address base at 0x400000 + * while keeping the physical base at 0x0. + * + * Without this, OF incorrectly loads .text at 0x400000 + 0x400000 = 0x800000. + * Taken from x86/xen.lds.S + */ +#ifdef CONFIG_LD_IS_GNU +# define DECL_SECTION(x) x : AT(ADDR(#x) - XEN_VIRT_START) +#else +# define DECL_SECTION(x) x : AT(ADDR(x) - XEN_VIRT_START) +#endif + +SECTIONS +{ + . = XEN_VIRT_START; + + DECL_SECTION(.text) { + _stext = .; /* Text section */ + *(.text.header) + + *(.text.cold) + *(.text.unlikely .text.*_unlikely .text.unlikely.*) + + *(.text) +#ifdef CONFIG_CC_SPLIT_SECTIONS + *(.text.*) +#endif + + *(.fixup) + *(.gnu.warning) + . = ALIGN(POINTER_ALIGN); + _etext = .; /* End of text section */ + } :text + + . = ALIGN(PAGE_SIZE); + DECL_SECTION(.rodata) { + _srodata = .; /* Read-only data */ + *(.rodata) + *(.rodata.*) + *(.data.rel.ro) + *(.data.rel.ro.*) + + VPCI_ARRAY + + . = ALIGN(POINTER_ALIGN); + _erodata = .; /* End of read-only data */ + } :text + + #if defined(BUILD_ID) + . = ALIGN(4); + DECL_SECTION(.note.gnu.build-id) { + __note_gnu_build_id_start = .; + *(.note.gnu.build-id) + __note_gnu_build_id_end = .; + } :note :text + #endif + _erodata = .; /* End of read-only data */ + + . = ALIGN(PAGE_SIZE); + DECL_SECTION(.data.ro_after_init) { + __ro_after_init_start = .; + *(.data.ro_after_init) + . = ALIGN(PAGE_SIZE); + __ro_after_init_end = .; + } : text + + DECL_SECTION(.data.read_mostly) { + *(.data.read_mostly) + } :text + + . = ALIGN(PAGE_SIZE); + DECL_SECTION(.data) { /* Data */ + *(.data.page_aligned) + . = ALIGN(8); + __start_schedulers_array = .; + *(.data.schedulers) + __end_schedulers_array = .; + + HYPFS_PARAM + + *(.data .data.*) + CONSTRUCTORS + } :text + + . = ALIGN(PAGE_SIZE); /* Init code and data */ + __init_begin = .; + DECL_SECTION(.init.text) { + _sinittext = .; + *(.init.text) + _einittext = .; + . = ALIGN(PAGE_SIZE); /* Avoid mapping alt insns executable */ + } :text + + . = ALIGN(PAGE_SIZE); + DECL_SECTION(.init.data) { + *(.init.rodata) + *(.init.rodata.*) + + . = ALIGN(POINTER_ALIGN); + __setup_start = .; + *(.init.setup) + __setup_end = .; + + __initcall_start = .; + *(.initcallpresmp.init) + __presmp_initcall_end = .; + *(.initcall1.init) + __initcall_end = .; + + LOCK_PROFILE_DATA + + *(.init.data) + *(.init.data.rel) + *(.init.data.rel.*)
xen/arch/ppc/xen.lds.S line 142
Quoted 10 lines
xen/arch/ppc/xen.lds.S new file +10
-0+ + . = ALIGN(8); + __ctors_start = .; + *(.ctors) + *(.init_array) + *(SORT(.init_array.*)) + __ctors_end = .; + } :text + . = ALIGN(POINTER_ALIGN); + __init_end = .;
Up to here I think I agree with all uses of ALIGN(), but ...
xen/arch/ppc/xen.lds.S line 148
Quoted 5 lines
xen/arch/ppc/xen.lds.S new file +5
-0+ DECL_SECTION(.bss) { /* BSS */ + __bss_start = .; + *(.bss.stack_aligned) + . = ALIGN(PAGE_SIZE); + *(.bss.page_aligned)
... the one between the two .bss parts looks unmotivated. Within a section definition ALIGN() typically only makes sense when followed by a label definition, like ...
xen/arch/ppc/xen.lds.S line 149
Quoted 2 lines
xen/arch/ppc/xen.lds.S new file +2
-0+ . = ALIGN(PAGE_SIZE); + __per_cpu_start = .;
... here.
xen/arch/ppc/xen.lds.S line 153
Quoted 3 lines
xen/arch/ppc/xen.lds.S new file +3
-0+ *(.bss.percpu.page_aligned) + *(.bss.percpu) + . = ALIGN(SMP_CACHE_BYTES);
This one is an exception, as it is intended to separate the read-mostly part such that there's no shared cache line.
Jan
Quoted 20 lines
xen/arch/ppc/xen.lds.S new file +20
-0+ *(.bss.percpu.read_mostly) + . = ALIGN(SMP_CACHE_BYTES); + __per_cpu_data_end = .; + *(.bss .bss.*) + . = ALIGN(POINTER_ALIGN); + __bss_end = .; + } :text + _end = . ; + + /* Section for the device tree blob (if any). */ + DECL_SECTION(.dtb) { *(.dtb) } :text + + DWARF2_DEBUG_SECTIONS + + DISCARD_SECTIONS + + STABS_DEBUG_SECTIONS + + ELF_DETAILS_SECTIONS +}
Re: [PATCH v3 2/4] xen: Add files needed for minimal ppc64le build
Quoted 17 lines · Jan Beulich
xen/arch/ppc/Makefile line 10
Quoted 13 lines · Shawn Anastasio
xen/arch/ppc/Makefile new file +10
-0@@ -0,0 +1,16 @@ +obj-$(CONFIG_PPC64) += ppc64/ + +$(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).mapElsewhere we recently switched these uses of $(@D)/$(@F) to just $@. Please can you do so here as well?
Sure, will fix in v4.
Quoted 5 lines
Quoted 5 lines
xen/arch/ppc/arch.mk new file +2
-0@@ -0,0 +1,11 @@ +######################################## +# Power-specific definitions
Quoted 8 lines
xen/arch/ppc/arch.mk line 7
Quoted 5 lines
xen/arch/ppc/arch.mk new file +5
-0+ +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-vsxWouldn't it make sense to also pass -mlittle here, such that a tool chain defaulting to big-endian can still be used?
Good call. On this topic, I suppose I'll also add -m64 to allow 32-bit toolchains to be used as well.
Quoted 15 lines
Quoted 15 lines
xen/arch/ppc/ppc64/head.S new file +12
-0@@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +.section .text.header, "ax", %progbits + +ENTRY(start) + /* + * Depending on how we were booted, the CPU could be running in either + * Little Endian or Big Endian mode. The following trampoline from Linux + * cleverly uses an instruction that encodes to a NOP if the CPU's + * endianness matches the assumption of the assembler (LE, in our case) + * or a branch to code that performs the endian switch in the other case. + */
Quoted 8 lines
xen/arch/ppc/ppc64/head.S line 14
Quoted 2 lines
xen/arch/ppc/ppc64/head.S new file +2
-0+ tdi 0, 0, 0x48 /* Reverse endian of b . + 8 */ + b $ + 44 /* Skip trampoline if endian is good */If I get this right, $ and . are interchangable on Power? If not, then all is fine and there likely is a reason to use . in the comment but $ in the code. But if so, it would be nice if both could match, and I guess with other architectures in mind . would be preferable.
As hinted by the comment, this code was directly inherited from Linux and I'm not sure why the original author chose '$' instead of '.'. That said, as far as I can tell you are correct about the two being interchangeable, and changing the $ to . results in the exact same machine code.
I can go ahead and make the change for consistency in v4.
Quoted 9 lines
xen/arch/ppc/ppc64/head.S line 19
Quoted 5 lines
xen/arch/ppc/ppc64/head.S new file +5
-0+ DECL_SECTION(.bss) { /* BSS */ + __bss_start = .; + *(.bss.stack_aligned) + . = ALIGN(PAGE_SIZE); + *(.bss.page_aligned)... the one between the two .bss parts looks unmotivated. Within a section definition
ALIGN()typically only makes sense when followed by a label definition, like ...
Correct me if I'm wrong, but wouldn't the ALIGN here serve to ensure that the subsequent '.bss.page_aligned' section has the correct alignment that its name implies?
Quoted 1 line
Jan
Thanks,
Shawn
Re: [PATCH v3 2/4] xen: Add files needed for minimal ppc64le build
Quoted 8 lines · Shawn Anastasio
Quoted 7 lines · Jan Beulich
Quoted 5 lines · Shawn Anastasio
xen/arch/ppc/xen.lds.S new file +5
-0+ DECL_SECTION(.bss) { /* BSS */ + __bss_start = .; + *(.bss.stack_aligned) + . = ALIGN(PAGE_SIZE); + *(.bss.page_aligned)
Quoted 7 lines
Quoted 3 lines
... the one between the two .bss parts looks unmotivated. Within a section definition
ALIGN()typically only makes sense when followed by a label definition, like ...Correct me if I'm wrong, but wouldn't the ALIGN here serve to ensure that the subsequent '.bss.page_aligned' section has the correct alignment that its name implies?
Yes and no. Thing is that every contribution to .bss.page_aligned already needs to specify page alignment itself, or else it may break if any earlier contribution was page-aligned, but not a full page in size (which I think the compiler wouldn't allow to happen, but assembly code can result in such). Note how this very ALIGN() was recently dropped from RISC-V code, and my respective Arm side patch is also about to go in.
Jan
Re: [PATCH v3 1/4] automation: Add container for ppc64le builds
In reply to Shawn AnastasioQuoted 3 lines · Shawn Anastasio
Add a container for cross-compiling xen for ppc64le.
Signed-off-by Shawn Anastasio <[email protected]>
I've built and deployed this container properly, replacing the prototype from earlier.
Re: [PATCH v3 2/4] xen: Add files needed for minimal ppc64le build
In reply to Jan BeulichQuoted 17 lines · Jan Beulich
Quoted 8 lines · Shawn Anastasio
Quoted 7 lines · Jan Beulich
Quoted 5 lines · Shawn Anastasio
xen/arch/ppc/xen.lds.S new file +5
-0+ DECL_SECTION(.bss) { /* BSS */ + __bss_start = .; + *(.bss.stack_aligned) + . = ALIGN(PAGE_SIZE); + *(.bss.page_aligned)Quoted 7 lines
Quoted 3 lines
... the one between the two .bss parts looks unmotivated. Within a section definition
ALIGN()typically only makes sense when followed by a label definition, like ...Correct me if I'm wrong, but wouldn't the ALIGN here serve to ensure that the subsequent '.bss.page_aligned' section has the correct alignment that its name implies?
Quoted 6 lines
Yes and no. Thing is that every contribution to .bss.page_aligned already needs to specify page alignment itself, or else it may break if any earlier contribution was page-aligned, but not a full page in size (which I think the compiler wouldn't allow to happen, but assembly code can result in such). Note how this very
ALIGN()was recently dropped from RISC-V code, and my respective Arm side patch is also about to go in.
That makes sense, thanks. I'll get rid of the ALIGN here in v4.
Quoted 1 line
Jan
Thanks,
Shawn
Re: [PATCH v3 2/4] xen: Add files needed for minimal ppc64le build
In reply to Shawn AnastasioQuoted 16 lines · Shawn Anastasio
Quoted 14 lines · Jan Beulich
xen/arch/ppc/arch.mk line 7
Quoted 10 lines · Shawn Anastasio
xen/arch/ppc/arch.mk new file +7
-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-vsxWouldn't it make sense to also pass -mlittle here, such that a tool chain defaulting to big-endian can still be used?
Quoted 2 lines
Good call. On this topic, I suppose I'll also add -m64 to allow 32-bit toolchains to be used as well.
Turns out this isn't quite enough. When trying to test my little bit of re-basing of Anthony's series, I ran into ld complaining about little endian input when the target format is big endian (like for the compiler I'm using a default configured, i.e. big-endian, binutils build). Looks like we need to pass "-m elf64lppc" to the linker; I'll see if that helps (and where exactly to put it).
Jan