Early serial on Power
v2 cover Early serial on Power
Hello all,
This series adds support for early serial printing on Power, as well as a simple CI smoke test modeled after the riscv one.
The first patch is responsible for setting up a basic C environment with an initial stack and a cleared .bss while the second sets up an Open Firmware serial console and primitive early_printk infrastructure.
Of note is that this series is currently based on the following series from Andrew Cooper: '[PATCH 0/2] xen/types: Cleanup'
(https://lists.xenproject.org/archives/html/xen-devel/2023-06/msg01601.html)
This will currently only run on QEMU pseries VMs, since the firmware interface on bare metal differs significantly. Support for bare metal will be added in a future series.
Thanks,
Shawn
--
Changes in v2:
- Split main patch into two - one for basic C environment setup and one for serial
- Mark OpenFirmware functions and early_printk functions as __init and change boot-of.o to boot-of.init.o in Makefile
- Change <xen/lib.h> include to <xen/stdarg.h> and drop skeleton headers that are no longer necessary for build as a result
- Add loop to clear .bss before jumping to C environment that was accidentally excluded from the first series
- Move common asm macros from processor.h to asm-defns.h
- Change note in head.S about preserved registers to a multi-line comment so it's more noticeable
- Drop reg-defs.h and use '%'-prefixed register names in assembly
- This is necessary since -mregnames, which allows standard non-prefixed register names without manual macro definitions, is not supported by LLVM's assembler.
- Drop inline asm swab routines in favor of __builtin_bswap family
- Fix up types.h in accordance with (as of now, unmerged) 'xen/types: Rework stdint vs __{u,s}$N types'
- Remove unnecessary braces for single-line statements
- Remove unnecessary license text when SPDX header is present
- Fix alphabetical ordering of object declarations in Makefile
- Drop 'extern' from enter_of prototype, ensure prototypes have argument names
Shawn Anastasio (3):
xen/ppc: Set up a basic C environment xen/ppc: Implement early serial printk on pseries
automation: Add smoke test for ppc64le
automation/gitlab-ci/test.yaml | 20 ++++ automation/scripts/qemu-smoke-ppc64le.sh | 27 +++++ xen/arch/ppc/Kconfig.debug | 5 + xen/arch/ppc/Makefile | 3 + xen/arch/ppc/boot-of.c | 100 +++++++++++++++++ xen/arch/ppc/configs/ppc64_defconfig | 1 + xen/arch/ppc/early_printk.c | 28 +++++ xen/arch/ppc/include/asm/asm-defns.h | 53 +++++++++ xen/arch/ppc/include/asm/boot.h | 23 ++++ xen/arch/ppc/include/asm/byteorder.h | 12 ++ xen/arch/ppc/include/asm/early_printk.h | 15 +++ xen/arch/ppc/include/asm/msr.h | 51 +++++++++ xen/arch/ppc/include/asm/processor.h | 136 +++++++++++++++++++++++ xen/arch/ppc/include/asm/types.h | 21 ++++ xen/arch/ppc/ppc64/Makefile | 1 + xen/arch/ppc/ppc64/asm-offsets.c | 55 +++++++++ xen/arch/ppc/ppc64/head.S | 55 +++++---- xen/arch/ppc/ppc64/of-call.S | 83 ++++++++++++++ xen/arch/ppc/setup.c | 28 +++++ 19 files changed, 697 insertions(+), 20 deletions(-) create mode 100755 automation/scripts/qemu-smoke-ppc64le.sh 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/asm-defns.h create mode 100644 xen/arch/ppc/include/asm/boot.h create mode 100644 xen/arch/ppc/include/asm/byteorder.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/processor.h create mode 100644 xen/arch/ppc/include/asm/types.h create mode 100644 xen/arch/ppc/ppc64/of-call.S create mode 100644 xen/arch/ppc/setup.c
--
2.30.2
PATCH v2 1/3 xen/ppc: Set up a basic C environment
Update ppc64/head.S to set up an initial boot stack, zero the .bss section, and jump to C.
Also refactor the endian fixup trampoline into its own macro, since it will need to be used in multiple places, including every time we make a call into firmware (see next commit).
--- xen/arch/ppc/Makefile | 1 + xen/arch/ppc/include/asm/asm-defns.h | 36 ++++++++++++++++++ xen/arch/ppc/ppc64/head.S | 55 ++++++++++++++++++---------- xen/arch/ppc/setup.c | 13 +++++++ 4 files changed, 85 insertions(+), 20 deletions(-) create mode 100644 xen/arch/ppc/include/asm/asm-defns.h create mode 100644 xen/arch/ppc/setup.c
xen/arch/ppc/Makefile +1 -0
@@ -1,4 +1,5 @@ obj-$(CONFIG_PPC64) += ppc64/ +obj-y += setup.o $(TARGET): $(TARGET)-syms cp -f $< $@
xen/arch/ppc/include/asm/asm-defns.h new file +36 -0
@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifndef _ASM_PPC_ASM_DEFNS_H +#define _ASM_PPC_ASM_DEFNS_H + +/* +* Load a 64-bit immediate value into the specified GPR. +*/ +#define LOAD_IMM64 (reg, val) \ + lis reg, (val) @highest; \ + ori reg, reg, (val) @higher; \ + rldicr reg, reg, 32, 31; \ + oris reg, reg, (val) @h; \ + ori reg, reg, (val) @l; + +/* +* 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. +*/ +#define FIXUP_ENDIAN \ + 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 */ + +#endif /* _ASM_PPC_ASM_DEFNS_H */
xen/arch/ppc/ppc64/head.S +35 -20
65 lines not on this page · raw message
xen/arch/ppc/setup.c new file +13 -0
@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#include <xen/init.h> + +void __init noreturnstart_xen (unsigned long r3,unsigned long r4, +unsigned long r5,unsigned long r6, +unsigned long r7) +{ +for ( ;; ) +/* Set current hardware thread to very low priority */ + asmvolatile ("or %r31, %r31, %r31" ); + +unreachable (); +}
Signature · 1 line
2.30.2
Re: [PATCH v2 1/3] xen/ppc: Set up a basic C environment
Quoted 8 lines · Shawn Anastasio
Update
ppc64/head.Sto set up an initial boot stack, zero the .bss section, and jump to C.Also refactor the endian fixup trampoline into its own macro, since it will need to be used in multiple places, including every time we make a call into firmware (see next commit).
Signed-off-by Shawn Anastasio <[email protected]>
Thankyou for making this change - it definitely simplifies things.
Quoted 92 lines
--- xen/arch/ppc/Makefile | 1 + xen/arch/ppc/include/asm/asm-defns.h | 36 ++++++++++++++++++ xen/arch/ppc/ppc64/head.S | 55 ++++++++++++++++++---------- xen/arch/ppc/setup.c | 13 +++++++ 4 files changed, 85 insertions(+), 20 deletions(-) create mode 100644 xen/arch/ppc/include/asm/asm-defns.h create mode 100644 xen/arch/ppc/setup.cxen/arch/ppc/Makefile +1
-0@@ -1,4 +1,5 @@ obj-$(CONFIG_PPC64) += ppc64/ +obj-y += setup.o $(TARGET): $(TARGET)-syms cp -f $< $@xen/arch/ppc/include/asm/asm-defns.h new file +36
-0@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifndef _ASM_PPC_ASM_DEFNS_H +#define _ASM_PPC_ASM_DEFNS_H + +/* +* Load a 64-bit immediate value into the specified GPR. +*/ +#define LOAD_IMM64 (reg, val) \ + lis reg, (val) @highest; \ + ori reg, reg, (val) @higher; \ + rldicr reg, reg, 32, 31; \ + oris reg, reg, (val) @h; \ + ori reg, reg, (val) @l; + +/* +* 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. +*/ +#define FIXUP_ENDIAN \ + 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 */ + +#endif /* _ASM_PPC_ASM_DEFNS_H */ xen/arch/ppc/ppc64/head.S +3
-16@@ -1,30 +1,45 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ +#include <asm/asm-defns.h> + .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. + * NOTE: argument registers (r3-r9) must be preserved until the C entrypoint */ - 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 */
xen/arch/ppc/ppc64/head.S line 16
Quoted 10 lines
xen/arch/ppc/ppc64/head.S +6
-4- .long 0x2400004c /* rfid */ - - /* Now that the endianness is confirmed, continue */ -1: b 1b + FIXUP_ENDIAN + + /* set up the initial stack */ + LOAD_IMM64(%r1, cpu0_boot_stack) + li %r11, 0 + std %r11, 0(%r1)
I've done a bit of reading around, and it's rather sad that things prior to Power10 don't have PC-relative addressing. So the LOAD_IMM64()'s do look necessary for the stack and bss. I guess that means we can't be sensibly be position independent in head.S?
Also, why store 0 onto the stack ?
xen/arch/ppc/ppc64/head.S line 25
Quoted 9 lines
xen/arch/ppc/ppc64/head.S +9
-0+ + /* clear .bss */ + LOAD_IMM64(%r14, __bss_start) + LOAD_IMM64(%r15, __bss_end) +1: + std %r11, 0(%r14) + addi %r14, %r14, 8 + cmpld %r14, %r15 + blt 1b
This loop is correct, except for the corner case of this patch alone, where the BSS is empty and this will write one word out-of-bounds.
For RISC-V, we put a temporary "char bss_tmp;" in setup.c, and I suggest you do the same here, deleting it at a later point when there's real data in the bss.
xen/arch/ppc/ppc64/head.S line 30
Quoted 5 lines
xen/arch/ppc/ppc64/head.S +5
-0+ + /* call the C entrypoint */ + LOAD_IMM64(%r12, start_xen) + mtctr %r12 + bctrl
Why is this a LOAD_IMM64(), and not just:
b start_xen
? From the same reading around, PPC64 seems to have +/- 32M addressing for branches, and the entire x86 hypervisor (.init included) is within 3M.
Quoted 5 lines
xen/arch/ppc/ppc64/head.S +3
-0+ + /* should never return */ + trap .size start, . - start
xen/arch/ppc/ppc64/head.S line 45
Quoted 10 lines
xen/arch/ppc/ppc64/head.S +9
-0.type start, %function + + .section .init.data, "aw", @progbits + + /* Early init stack */ + .p2align 4 +cpu0_boot_stack_bottom: + .space STACK_SIZE +cpu0_boot_stack: + .space STACK_FRAME_OVERHEAD
Why the extra space beyond the stack?
Also, I'd put cpu0_boot_stack in C, and just LOAD_IMM64(x, cpu0_boot_stack + STACK_SIZE)
Quoted 6 lines
xen/arch/ppc/setup.c new file +0
-0
xen/arch/ppc/setup.c line 10
Quoted 10 lines
xen/arch/ppc/setup.c new file +10
-0@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#include <xen/init.h> + +void __init noreturnstart_xen (unsigned long r3,unsigned long r4, +unsigned long r5,unsigned long r6, +unsigned long r7) +{ +for ( ;; ) +/* Set current hardware thread to very low priority */ + asmvolatile ("or %r31, %r31, %r31" );
Is there something magic about the OR instruction, or something magic about %r31?
For a RISC architecture, this seems subtle.
~Andrew
Re: [PATCH v2 1/3] xen/ppc: Set up a basic C environment
Quoted 11 lines · Andrew Cooper
Quoted 8 lines · Shawn Anastasio
Update
ppc64/head.Sto set up an initial boot stack, zero the .bss section, and jump to C.Also refactor the endian fixup trampoline into its own macro, since it will need to be used in multiple places, including every time we make a call into firmware (see next commit).
Signed-off-by Shawn Anastasio <[email protected]>Thankyou for making this change - it definitely simplifies things.
No problem.
Quoted 4 lines
I've done a bit of reading around, and it's rather sad that things prior to Power10 don't have PC-relative addressing. So the LOAD_IMM64()'s do look necessary for the stack and bss. I guess that means we can't be sensibly be position independent in
head.S?
Prior to the introduction of pcrel loads/stores in P10, PIC is achieved using a Table of Contents (TOC) whose base address is kept in r2 and can be used as a relative base to address other symbols. I don't have -fPIC enabled in this series yet (it's in the series I was hoping to submit after this one), so for now I'm just loading the addresses as immediates directly.
Quoted 1 line
Also, why store 0 onto the stack ?
On the ELFv2 ABI which we're using here, sp+0 is reserved for the "back chain" pointer which is used to store the address of the caller's stack frame and is used to support backtraces.
At the top of the stack, we need to make sure the first back chain pointer is zero to ensure that anything walking the stack via these pointers eventually terminates.
Quoted 10 lines
xen/arch/ppc/ppc64/head.S line 25
Quoted 9 lines
xen/arch/ppc/ppc64/head.S +9
-0+ + /* clear .bss */ + LOAD_IMM64(%r14, __bss_start) + LOAD_IMM64(%r15, __bss_end) +1: + std %r11, 0(%r14) + addi %r14, %r14, 8 + cmpld %r14, %r15 + blt 1b
Quoted 6 lines
This loop is correct, except for the corner case of this patch alone, where the BSS is empty and this will write one word out-of-bounds.
For RISC-V, we put a temporary "char
bss_tmp;" insetup.c, and I suggest you do the same here, deleting it at a later point when there's real data in the bss.
Good catch. I actually introduce a .bss variable in patch 2 of this series, so perhaps it would make the most sense for me to move this loop to that patch?
Also it might make sense to have an assert in the linker script checking that sizeof(.bss) > 0, though past early bring-up an empty .bss is probably a pretty unlikely scenario...
Quoted 6 lines
xen/arch/ppc/ppc64/head.S line 30
Quoted 5 lines
xen/arch/ppc/ppc64/head.S +5
-0+ + /* call the C entrypoint */ + LOAD_IMM64(%r12, start_xen) + mtctr %r12 + bctrl
Quoted 6 lines
Why is this a
LOAD_IMM64(), and not just:b
start_xen? From the same reading around, PPC64 seems to have +/- 32M addressing for branches, and the entire x86 hypervisor (.init included) is within 3M.
Good question. You're right that here it's entirely unnecessary. Once we enable -fPIC, though, the calling convention for functions changes a bit and necessitates that in certain scenarios r12 contains the entrypoint of the function being called.
For reference, the reason this is needed is because each function contains a prologue that calculates the base address of its aforementioned TOC as a relative offset from its entrypoint, and for that to work, the entrypoint needs to be contained in r12.
There is a short path that can be taken if the TOC pointer in r2 is already set up and the calling function is in the same module as the function being called (and thus they are known to share a TOC), but for head.S simply taking the long path is an easy way to ensure the callee has a valid TOC pointer.
In any case, its inclusion in this patch before -fPIC is enabled was an oversight on my part and I'll change it to a bl start_xen.
Quoted 4 lines
Quoted 4 lines
xen/arch/ppc/ppc64/head.S +3
-0+ + /* should never return */ + trap
Quoted 13 lines
xen/arch/ppc/ppc64/head.S line 45
Quoted 11 lines
.size start, . - start
.type start, %functionxen/arch/ppc/ppc64/head.S +9
-0+ + .section .init.data, "aw", @progbits + + /* Early init stack */ + .p2align 4 +cpu0_boot_stack_bottom: + .space STACK_SIZE +cpu0_boot_stack: + .space STACK_FRAME_OVERHEADWhy the extra space beyond the stack?
It's space for the aforementioned back chain pointer as well as a few other things that callees are allowed to store in their caller's stack frame. For example, routines are allowed to store the return address from their caller at sp+16 (unlike x86, our "call" instruction doesn't do that for you).
The ELFv2 specification contains a nice diagram of the stack frame on page 31 (figure 2.18, section 2.2.2.1):
https://wiki.raptorcs.com/w/images/7/70/Leabi-20170510.pdf
Quoted 2 lines
Also, I'd put
cpu0_boot_stackin C, and justLOAD_IMM64(x, cpu0_boot_stack + STACK_SIZE)
Sure, I can do that.
Quoted 11 lines
Quoted 11 lines
xen/arch/ppc/setup.c new file +5
-0@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#include <xen/init.h> + +void __init noreturn start_xen(unsigned long r3, unsigned long r4, + unsigned long r5, unsigned long r6,
Quoted 8 lines
xen/arch/ppc/setup.c line 10
Quoted 5 lines
xen/arch/ppc/setup.c new file +5
-0+ unsigned long r7) +{ +for ( ;; ) +/* Set current hardware thread to very low priority */ + asmvolatile ("or %r31, %r31, %r31" );Is there something magic about the OR instruction, or something magic about %r31?
Using the OR instruction with all three operands equal is of course a no-op, but when using certain registers it can have a separate magic side effect.
or r31,31,31 is one such form that sets the Program Priority Register to "very low" priority. Of course here where we don't have SMP going there's not much point in using this over the standard side effect-less no-op (or r0,r0,r0 or just nop).
For a table of these magic OR forms, you can see page 836 of the Power ISA 3.0B:
https://wiki.raptorcs.com/w/images/c/cb/PowerISA_public.v3.0B.pdf
Quoted 1 line
~Andrew
Thanks,
Shawn
Re: [PATCH v2 1/3] xen/ppc: Set up a basic C environment
Quoted 23 lines · Shawn Anastasio
Quoted 17 lines · Andrew Cooper
xen/arch/ppc/setup.c line 10
Quoted 13 lines · Shawn Anastasio
xen/arch/ppc/setup.c new file +10
-0@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#include <xen/init.h> + +void __init noreturnstart_xen (unsigned long r3,unsigned long r4, +unsigned long r5,unsigned long r6, +unsigned long r7) +{ +for ( ;; ) +/* Set current hardware thread to very low priority */ + asmvolatile ("or %r31, %r31, %r31" );Is there something magic about the OR instruction, or something magic about %r31?
Using the OR instruction with all three operands equal is of course a no-op, but when using certain registers it can have a separate magic side effect.
Quoted 8 lines
or r31,31,31is one such form that sets the Program Priority Register to "very low" priority. Of course here where we don't have SMP going there's not much point in using this over the standard side effect-less no-op (or r0,r0,r0or justnop).For a table of these magic OR forms, you can see page 836 of the Power ISA 3.0B:
https://wiki.raptorcs.com/w/images/c/cb/PowerISA_public.v3.0B.pdf
I have 3.1 to hand, and it looks like they were dropped from there? Otherwise I was meaning to say that it's a shame gas doesn't support these.
Anyway - I think you want to put this behind a macro named after the pseudo.
Finally, as a nit: Style above is lacking several blanks. One between the two semicolons, and a total of three in the asm().
Jan
Re: [PATCH v2 1/3] xen/ppc: Set up a basic C environment
Quoted 29 lines · Jan Beulich
Quoted 28 lines · Shawn Anastasio
Quoted 17 lines · Andrew Cooper
xen/arch/ppc/setup.c line 10
Quoted 13 lines · Shawn Anastasio
xen/arch/ppc/setup.c new file +10
-0@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#include <xen/init.h> + +void __init noreturnstart_xen (unsigned long r3,unsigned long r4, +unsigned long r5,unsigned long r6, +unsigned long r7) +{ +for ( ;; ) +/* Set current hardware thread to very low priority */ + asmvolatile ("or %r31, %r31, %r31" );Is there something magic about the OR instruction, or something magic about %r31?
Using the OR instruction with all three operands equal is of course a no-op, but when using certain registers it can have a separate magic side effect.
or r31,31,31is one such form that sets the Program Priority Register to "very low" priority. Of course here where we don't have SMP going there's not much point in using this over the standard side effect-less no-op (or r0,r0,r0or justnop).
Quoted 7 lines
Quoted 3 lines
For a table of these magic OR forms, you can see page 836 of the Power ISA 3.0B:
https://wiki.raptorcs.com/w/images/c/cb/PowerISA_public.v3.0B.pdfI have 3.1 to hand, and it looks like they were dropped from there? Otherwise I was meaning to say that it's a shame gas doesn't support these.
No, they're still present in ISA 3.1B. See page 1084, Book II Chapter 3 Section 2.
Quoted 2 lines
Anyway - I think you want to put this behind a macro named after the pseudo.
Sure, that makes sense to me.
Quoted 2 lines
Finally, as a nit: Style above is lacking several blanks. One between the two semicolons, and a total of three in the
asm().
Just to be sure, would the following be correct?
for ( ; ; )
/* Set current hardware thread to very low priority */
asm volatile ( "or %r31, %r31, %r31" );Not including the refactor of that instruction to a macro, of course.
Quoted 1 line
Jan
Thanks,
Shawn
Re: [PATCH v2 1/3] xen/ppc: Set up a basic C environment
Quoted 34 lines · Shawn Anastasio
Quoted 33 lines · Jan Beulich
Quoted 31 lines · Shawn Anastasio
Quoted 17 lines · Andrew Cooper
xen/arch/ppc/setup.c line 10
Quoted 13 lines · Shawn Anastasio
xen/arch/ppc/setup.c new file +10
-0@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#include <xen/init.h> + +void __init noreturnstart_xen (unsigned long r3,unsigned long r4, +unsigned long r5,unsigned long r6, +unsigned long r7) +{ +for ( ;; ) +/* Set current hardware thread to very low priority */ + asmvolatile ("or %r31, %r31, %r31" );Is there something magic about the OR instruction, or something magic about %r31?
Using the OR instruction with all three operands equal is of course a no-op, but when using certain registers it can have a separate magic side effect.
or r31,31,31is one such form that sets the Program Priority Register to "very low" priority. Of course here where we don't have SMP going there's not much point in using this over the standard side effect-less no-op (or r0,r0,r0or justnop).For a table of these magic OR forms, you can see page 836 of the Power ISA 3.0B:
https://wiki.raptorcs.com/w/images/c/cb/PowerISA_public.v3.0B.pdf
Quoted 6 lines
Quoted 3 lines
I have 3.1 to hand, and it looks like they were dropped from there? Otherwise I was meaning to say that it's a shame gas doesn't support these.
No, they're still present in ISA 3.1B. See page 1084, Book II Chapter 3 Section 2.
Ah, I see. I was searching for the pseudo mnemonics that I had found elsewhere at some point (which are what I would hope gas could support, but then of course they first need to be mentioned in the doc).
Quoted 10 lines
Quoted 2 lines
Finally, as a nit: Style above is lacking several blanks. One between the two semicolons, and a total of three in the
asm().Just to be sure, would the following be correct?
for ( ; ; ) /* Set current hardware thread to very low priority */ asm volatile ( "or %r31, %r31, %r31" );Not including the refactor of that instruction to a macro, of course.
Yes, this looks correct now. Our style is perhaps a little unusual; at least I'm not aware of another project using the same, although I have the vague feeling that someone once mentioned a possible origin.
Jan
Re: [PATCH v2 1/3] xen/ppc: Set up a basic C environment
In reply to Shawn AnastasioQuoted 72 lines · Shawn Anastasio
Quoted 11 lines · Andrew Cooper
Quoted 8 lines · Shawn Anastasio
Update
ppc64/head.Sto set up an initial boot stack, zero the .bss section, and jump to C.Also refactor the endian fixup trampoline into its own macro, since it will need to be used in multiple places, including every time we make a call into firmware (see next commit).
Signed-off-by Shawn Anastasio <[email protected]>Thankyou for making this change - it definitely simplifies things.
No problem.
Quoted 4 lines
I've done a bit of reading around, and it's rather sad that things prior to Power10 don't have PC-relative addressing. So the LOAD_IMM64()'s do look necessary for the stack and bss. I guess that means we can't be sensibly be position independent in
head.S?Prior to the introduction of pcrel loads/stores in P10, PIC is achieved using a Table of Contents (TOC) whose base address is kept in r2 and can be used as a relative base to address other symbols. I don't have -fPIC enabled in this series yet (it's in the series I was hoping to submit after this one), so for now I'm just loading the addresses as immediates directly.
Quoted 1 line
Also, why store 0 onto the stack ?
On the ELFv2 ABI which we're using here, sp+0 is reserved for the "back chain" pointer which is used to store the address of the caller's stack frame and is used to support backtraces.
At the top of the stack, we need to make sure the first back chain pointer is zero to ensure that anything walking the stack via these pointers eventually terminates.
Quoted 10 lines
xen/arch/ppc/ppc64/head.S line 25
Quoted 9 lines
xen/arch/ppc/ppc64/head.S +9
-0+ + /* clear .bss */ + LOAD_IMM64(%r14, __bss_start) + LOAD_IMM64(%r15, __bss_end) +1: + std %r11, 0(%r14) + addi %r14, %r14, 8 + cmpld %r14, %r15 + blt 1bQuoted 6 lines
This loop is correct, except for the corner case of this patch alone, where the BSS is empty and this will write one word out-of-bounds.
For RISC-V, we put a temporary "char
bss_tmp;" insetup.c, and I suggest you do the same here, deleting it at a later point when there's real data in the bss.Good catch. I actually introduce a .bss variable in patch 2 of this series, so perhaps it would make the most sense for me to move this loop to that patch?
Also it might make sense to have an assert in the linker script checking that sizeof(.bss) > 0, though past early bring-up an empty .bss is probably a pretty unlikely scenario...
Quoted 10 lines
xen/arch/ppc/ppc64/head.S line 30
Quoted 5 lines
xen/arch/ppc/ppc64/head.S +5
-0+ + /* call the C entrypoint */ + LOAD_IMM64(%r12, start_xen) + mtctr %r12 + bctrlWhy is this a
LOAD_IMM64(), and not just:b
start_xen
Quoted 7 lines
Quoted 2 lines
? From the same reading around, PPC64 seems to have +/- 32M addressing for branches, and the entire x86 hypervisor (.init included) is within 3M.
Good question. You're right that here it's entirely unnecessary. Once we enable -fPIC, though, the calling convention for functions changes a bit and necessitates that in certain scenarios r12 contains the entrypoint of the function being called.
Turns out I was actually wrong here -- changing the indirect load + branch to a direct branch does actually break the code here, but for a reason other than what I anticipated. Even with PIC disabled, r2 needs to contain a valid TOC pointer. The function address doesn't need to be contained in r12 to calculate it since it's an absolute address rather than function-relative, but using a simple direct branch here causes the linker to skip past the TOC calculation prologue in start_xen as an optimization, since it assumes that r2 is already set up. Since we haven't set up r2, though, this results in the program using a garbage TOC pointer at run-time.
I'll just set up the TOC before making the call in start to fix this.
Thanks,
Shawn
PATCH v2 2/3 xen/ppc: Implement early serial printk on pseries
In reply to Shawn AnastasioOn typical Power VMs (e.g. QEMU's -M pseries), a variety of services including an early serial console are provided by Open Firmware. Implement the required interfaces to call into Open Firmware and write to the serial console.
Since Open Firmware 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 ppc64/of-call.S.
Support for bare metal (PowerNV) will be implemented in a future patch.
--- xen/arch/ppc/Kconfig.debug | 5 + xen/arch/ppc/Makefile | 2 + xen/arch/ppc/boot-of.c | 100 +++++++++++++++++ xen/arch/ppc/configs/ppc64_defconfig | 1 + xen/arch/ppc/early_printk.c | 28 +++++ xen/arch/ppc/include/asm/asm-defns.h | 17 +++ xen/arch/ppc/include/asm/boot.h | 23 ++++ xen/arch/ppc/include/asm/byteorder.h | 12 +++ xen/arch/ppc/include/asm/early_printk.h | 15 +++ xen/arch/ppc/include/asm/msr.h | 51 +++++++++ xen/arch/ppc/include/asm/processor.h | 136 ++++++++++++++++++++++++ xen/arch/ppc/include/asm/types.h | 21 ++++ xen/arch/ppc/ppc64/Makefile | 1 + xen/arch/ppc/ppc64/asm-offsets.c | 55 ++++++++++ xen/arch/ppc/ppc64/of-call.S | 83 +++++++++++++++ xen/arch/ppc/setup.c | 15 +++ 16 files changed, 565 insertions(+) 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/byteorder.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/processor.h create mode 100644 xen/arch/ppc/include/asm/types.h create mode 100644 xen/arch/ppc/ppc64/of-call.S
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 -0
@@ -1,4 +1,6 @@ obj-$(CONFIG_PPC64) += ppc64/ +obj-y += boot-of.init.o +obj-$(CONFIG_EARLY_PRINTK) += early_printk.o obj-y += setup.o $(TARGET): $(TARGET)-syms
xen/arch/ppc/boot-of.c new file +100 -0
100 lines not on this page · raw message
xen/arch/ppc/configs/ppc64_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 +28 -0
@@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#include <xen/init.h> +#include <asm/boot.h> + +static void (*putchar_func)(char ); + +void __init early_printk_init (void (*putchar)(char )) +{ + putchar_func = putchar; +} + +void __init early_puts (const char *s,size_t nr) +{ +if ( !putchar_func ) +return ; + +while ( nr-- >0 ) +putchar_func (*s++); +} + +void __init early_printk (const char *s) +{ +if ( !putchar_func ) +return ; + +while ( *s ) +putchar_func (*s++); +}
xen/arch/ppc/include/asm/asm-defns.h +17 -0
@@ -33,4 +33,21 @@ .long 0xa6037b7d; /* mtsrr1 r11 */ \ .long 0x2400004c /* rfid */ + +/* Taken from Linux kernel source (arch/powerpc/boot/crt0.S) */ +.macro OP_REGS op, width, start, end, base, offset + .Lreg=\start + .rept (\end - \start + 1) + \op .Lreg,\offset+\width*.Lreg(\base) + .Lreg=.Lreg+1 + .endr +.endm + +#define SAVE_GPRS(start, end, base) OP_REGS std, 8, start, end, base, 0 +#define REST_GPRS (start, end, base) OP_REGS ld, 8, start, end, base, 0 +#define SAVE_GPR (n, base) SAVE_GPRS(n, n, base) +#define REST_GPR (n, base) REST_GPRS(n, n, base) +#define SAVE_NVGPRS (base) SAVE_GPRS(14, 31, base) +#define REST_NVGPRS (base) REST_GPRS(14, 31, base) +#endif /* _ASM_PPC_ASM_DEFNS_H */
xen/arch/ppc/include/asm/boot.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#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 ]; +}; + +int enter_of (struct of_service *args,unsigned long entry); +void boot_of_init (unsigned long vec); + +#endif /* _ASM_PPC_BOOT_H */
xen/arch/ppc/include/asm/byteorder.h new file +12 -0
@@ -0,0 +1,12 @@ +#ifndef _ASM_PPC_BYTEORDER_H +#define _ASM_PPC_BYTEORDER_H + +#define __arch__swab16 __builtin_bswap16 +#define __arch__swab32 __builtin_bswap32 +#define __arch__swab64 __builtin_bswap64 + +#define __BYTEORDER_HAS_U64__ + +#include <xen/byteorder/little_endian.h> + +#endif /* _ASM_PPC_BYTEORDER_H */
xen/arch/ppc/include/asm/early_printk.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef _ASM_PPC_EARLY_PRINTK_H +#define _ASM_PPC_EARLY_PRINTK_H + +#include <xen/early_printk.h> + +#ifdef CONFIG_EARLY_PRINTK +void early_printk_init (void (*putchar)(char )); +void early_printk (const char *s); +#else +static inline void early_printk_init (void (*putchar)(char )) {} +static inline void early_printk (const char *s) {} +#endif + +#endif /* _ASM_PPC_EARLY_PRINTK_H */
xen/arch/ppc/include/asm/msr.h new file +51 -0
51 lines not on this page · raw message
xen/arch/ppc/include/asm/processor.h new file +136 -0
136 lines not on this page · raw message
xen/arch/ppc/include/asm/types.h new file +21 -0
@@ -0,0 +1,21 @@ +/* from xen/arch/x86/include/asm/types.h */ + +#ifndef _ASM_PPC_TYPES_H +#define _ASM_PPC_TYPES_H + +typedef signed char s8 ; +typedef unsigned char u8 ; + +typedef signed short s16 ; +typedef unsigned short u16 ; + +typedef signed int s32 ; +typedef unsigned int u32 ; + +typedef signed long s64 ; +typedef unsigned long u64 ; +typedef unsigned long paddr_t ; +#define INVALID_PADDR (~0UL) +#define PRIpaddr "016lx" + +#endif /* _ASM_PPC_TYPES_H */
xen/arch/ppc/ppc64/Makefile +1 -0
@@ -1 +1,2 @@ obj-y += head.o +obj-y += of-call.o
xen/arch/ppc/ppc64/asm-offsets.c +55 -0
55 lines not on this page · raw message
xen/arch/ppc/ppc64/of-call.S new file +83 -0
83 lines not on this page · raw message
xen/arch/ppc/setup.c +15 -0
@@ -1,10 +1,25 @@/* SPDX-License-Identifier: GPL-2.0-or-later */ #include <xen/init.h> +#include <asm/boot.h> +#include <asm/early_printk.h> void __init noreturnstart_xen (unsigned long r3,unsigned long r4,unsigned long r5,unsigned long r6,unsigned long r7) { +if ( r5 ) + { +/* OpenFirmware boot protocol */ +boot_of_init (r5); + } +else + { +/* kexec boot: Unimplemented */ +__builtin_trap (); + } + +early_printk ("Hello, ppc64le!\n" ); +for ( ;; )/* Set current hardware thread to very low priority */ asmvolatile ("or %r31, %r31, %r31" );
Signature · 1 line
2.30.2
Re: [PATCH v2 2/3] xen/ppc: Implement early serial printk on pseries
Quoted 11 lines · Shawn Anastasio
On typical Power VMs (e.g. QEMU's -M pseries), a variety of services including an early serial console are provided by Open Firmware. Implement the required interfaces to call into Open Firmware and write to the serial console.
Since Open Firmware 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
ppc64/of-call.S.
Quoted 4 lines
Support for bare metal (PowerNV) will be implemented in a future patch.
Signed-off-by Shawn Anastasio <[email protected]>
Just two minor remarks; I can't really review most of this for lack of knowledge.
xen/arch/ppc/Makefile line 4
Quoted 7 lines
xen/arch/ppc/Makefile +2
-0@@ -1,4 +1,6 @@ obj-$(CONFIG_PPC64) += ppc64/ +obj-y += boot-of.init.o +obj-$(CONFIG_EARLY_PRINTK) += early_printk.o obj-y += setup.o
While you've followed Julien's earlier comment partly, I think, sorting still isn't alphabetical. If you mean ppc64/ to explicitly be first, you will want to introduce a separating blank line.
Quoted 50 lines
xen/arch/ppc/ppc64/of-call.S new file +47
-0@@ -0,0 +1,83 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Adapted from Linux's arch/powerpc/kernel/entry_64.S, with the + * following copyright notice: + * + * PowerPC version + * Copyright (C) 1995-1996 Gary Thomas ([email protected]) + * Rewritten by Cort Dougan ([email protected]) for PReP + * Copyright (C) 1996 Cort Dougan <[email protected]> + * Adapted for Power Macintosh by Paul Mackerras. + * Low-level exception handlers and MMU support + * rewritten by Paul Mackerras. + * Copyright (C) 1996 Paul Mackerras. + * MPC8xx modifications Copyright (C) 1997 Dan Malek ([email protected]). + */ + +#include <asm/asm-offsets.h> +#include <asm/asm-defns.h> +#include <asm/msr.h> + +/* size of minimum stack frame that can hold an entire cpu_user_regs struct */ +#define STACK_SWITCH_FRAME_SIZE (UREGS_sizeof + STACK_FRAME_OVERHEAD) + + .section .init.text, "ax", @progbits + +ENTRY(enter_of) + mflr %r0 + std %r0, 16(%r1) + stdu %r1,-STACK_SWITCH_FRAME_SIZE(%r1) /* Save SP and create stack space */ + + /* + * Because PROM is running in 32b mode, it clobbers the high order half + * of all registers that it saves. We therefore save those registers + * PROM might touch to the stack. (%r0, %r3-%r13 are caller saved) + */ + SAVE_GPR(2, %r1) + SAVE_GPR(13, %r1) + SAVE_NVGPRS(%r1) + mfcr %r10 + mfmsr %r11 + std %r10, UREGS_cr(%r1) + std %r11, UREGS_msr(%r1) + + /* Put PROM address in SRR0 */ + mtsrr0 %r4 + + /* Setup our trampoline return addr in LR */
xen/arch/ppc/ppc64/of-call.S line 57
Quoted 10 lines
xen/arch/ppc/ppc64/of-call.S new file +10
-0+ bcl 20, 31,.+4 +0: mflr %r4 + addi %r4, %r4,(1f - 0b) + mtlr %r4 + + /* Prepare a 32-bit mode big endian MSR */ + LOAD_IMM64(%r12, MSR_SF | MSR_LE) + andc %r11, %r11, %r12 + mtsrr1 %r11 + rfid
I think readability would improve if you reserved a minimum number of characters (6?) for the mnemonics, padding with blanks when they're shorter. (This, if you'd be willing to switch, would then also apply to patch 1, iirc.)
Jan
PATCH v2 3/3 automation: Add smoke test for ppc64le
In reply to Shawn AnastasioAdd an initial smoke test that boots xen on a ppc64/pseries machine and checks for a magic string. Based on the riscv smoke test.
Eventually the powernv9 (POWER9 bare metal) machine type will want to be tested as well, but for now we only boot on pseries.
--- automation/gitlab-ci/test.yaml | 20 ++++++++++++++++++ automation/scripts/qemu-smoke-ppc64le.sh | 27 ++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100755 automation/scripts/qemu-smoke-ppc64le.sh
automation/gitlab-ci/test.yaml +20 -0
@@ -71,6 +71,19 @@ tags: - x86_64 +.qemu-ppc64le: + extends: .test-jobs-common + variables: + CONTAINER: debian:bullseye-ppc64le + LOGFILE: qemu-smoke-ppc64le.log + artifacts: + paths: + - smoke.serial + - '*.log' + when: always + tags: + - x86_64 + .xilinx-arm64: extends: .test-jobs-common variables:
@@ -444,3 +457,10 @@ qemu-smoke-riscv64-gcc: - ./automation/scripts/qemu-smoke-riscv64.sh 2>&1 | tee ${LOGFILE} needs: - archlinux-current-gcc-riscv64-debug + +qemu-smoke-ppc64le-pseries-gcc: + extends: .qemu-ppc64le + script: + - ./automation/scripts/qemu-smoke-ppc64le.sh pseries-5.2 2>&1 | tee ${LOGFILE} + needs: + - debian-bullseye-gcc-ppc64le-debug
automation/scripts/qemu-smoke-ppc64le.sh new file +27 -0
@@ -0,0 +1,27 @@ +#!/bin/bash + +set -ex + +# machine type from first arg passed directly to qemu -M +machine=$1 + +# Run the test +rm -f smoke.serial +set +e + +touch smoke.serial + +timeout -k 1 20 \ +qemu-system-ppc64 \ + -M $machine \ + -m 2g \ + -smp 1 \ + -vga none \ + -monitor none \ + -nographic \ + -serial file:smoke.serial \ + -kernel binaries/xen + +set -e +(grep -q "Hello, ppc64le!" smoke.serial) || exit 1 +exit 0
Signature · 1 line
2.30.2
Re: [PATCH v2 3/3] automation: Add smoke test for ppc64le
Quoted 7 lines · Shawn Anastasio
Add an initial smoke test that boots xen on a ppc64/pseries machine and checks for a magic string. Based on the riscv smoke test.
Eventually the powernv9 (POWER9 bare metal) machine type will want to be tested as well, but for now we only boot on pseries.
Signed-off-by Shawn Anastasio <[email protected]>
Quoted 77 lines
--- automation/gitlab-ci/test.yaml | 20 ++++++++++++++++++ automation/scripts/qemu-smoke-ppc64le.sh | 27 ++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100755 automation/scripts/qemu-smoke-ppc64le.shautomation/gitlab-ci/test.yaml +20
-0@@ -71,6 +71,19 @@ tags: - x86_64 +.qemu-ppc64le: + extends: .test-jobs-common + variables: + CONTAINER: debian:bullseye-ppc64le + LOGFILE: qemu-smoke-ppc64le.log + artifacts: + paths: + - smoke.serial + - '*.log' + when: always + tags: + - x86_64 + .xilinx-arm64: extends: .test-jobs-common variables:@@ -444,3 +457,10 @@ qemu-smoke-riscv64-gcc: - ./automation/scripts/qemu-smoke-riscv64.sh 2>&1 | tee ${LOGFILE} needs: - archlinux-current-gcc-riscv64-debug + +qemu-smoke-ppc64le-pseries-gcc: + extends: .qemu-ppc64le + script: + - ./automation/scripts/qemu-smoke-ppc64le.sh pseries-5.2 2>&1 | tee ${LOGFILE} + needs: + - debian-bullseye-gcc-ppc64le-debugautomation/scripts/qemu-smoke-ppc64le.sh new file +27
-0@@ -0,0 +1,27 @@ +#!/bin/bash + +set -ex + +# machine type from first arg passed directly to qemu -M +machine=$1 + +# Run the test +rm -f smoke.serial +set +e + +touch smoke.serial + +timeout -k 1 20 \ +qemu-system-ppc64 \ + -M $machine \ + -m 2g \ + -smp 1 \ + -vga none \ + -monitor none \ + -nographic \ + -serial file:smoke.serial \ + -kernel binaries/xen + +set -e +(grep -q "Hello, ppc64le!" smoke.serial) || exit 1 +exit 0Signature · 1 line
2.30.2
Quoted 7 lines · Shawn Anastasio
Changes in v2:
- Split main patch into two - one for basic C environment setup and one for serial
- Mark OpenFirmware functions andearly_printkfunctions as__initand change boot-of.o to boot-of.init.o inMakefile
- Change <xen/lib.h> include to <xen/stdarg.h> and drop skeleton headers that are no longer necessary for build as a result
What is this about? There's no change to non-ppc files here according to ...
Quoted 12 lines
automation/gitlab-ci/test.yaml | 20 ++++ automation/scripts/qemu-smoke-ppc64le.sh | 27 +++++ xen/arch/ppc/Kconfig.debug | 5 + xen/arch/ppc/Makefile | 3 + xen/arch/ppc/boot-of.c | 100 +++++++++++++++++ xen/arch/ppc/configs/ppc64_defconfig | 1 + xen/arch/ppc/early_printk.c | 28 +++++ xen/arch/ppc/include/asm/asm-defns.h | 53 +++++++++ xen/arch/ppc/include/asm/boot.h | 23 ++++ xen/arch/ppc/include/asm/byteorder.h | 12 ++ xen/arch/ppc/include/asm/early_printk.h | 15 +++ xen/arch/ppc/include/asm/msr.h | 51 +++++++++
Quoted 8 lines
xen/arch/ppc/include/asm/processor.h | 136 +++++++++++++++++++++++ xen/arch/ppc/include/asm/types.h | 21 ++++ xen/arch/ppc/ppc64/Makefile | 1 + xen/arch/ppc/ppc64/asm-offsets.c | 55 +++++++++ xen/arch/ppc/ppc64/head.S | 55 +++++---- xen/arch/ppc/ppc64/of-call.S | 83 ++++++++++++++ xen/arch/ppc/setup.c | 28 +++++ 19 files changed, 697 insertions(+), 20 deletions(-)
... this. Plus lib.h already includes stdarg.h.
Jan
Quoted 33 lines · Jan Beulich
Quoted 7 lines · Shawn Anastasio
Changes in v2:
- Split main patch into two - one for basic C environment setup and one for serial
- Mark OpenFirmware functions andearly_printkfunctions as__initand change boot-of.o to boot-of.init.o inMakefile
- Change <xen/lib.h> include to <xen/stdarg.h> and drop skeleton headers that are no longer necessary for build as a resultWhat is this about? There's no change to non-ppc files here according to ...
Quoted 12 lines
automation/gitlab-ci/test.yaml | 20 ++++ automation/scripts/qemu-smoke-ppc64le.sh | 27 +++++ xen/arch/ppc/Kconfig.debug | 5 + xen/arch/ppc/Makefile | 3 + xen/arch/ppc/boot-of.c | 100 +++++++++++++++++ xen/arch/ppc/configs/ppc64_defconfig | 1 + xen/arch/ppc/early_printk.c | 28 +++++ xen/arch/ppc/include/asm/asm-defns.h | 53 +++++++++ xen/arch/ppc/include/asm/boot.h | 23 ++++ xen/arch/ppc/include/asm/byteorder.h | 12 ++ xen/arch/ppc/include/asm/early_printk.h | 15 +++ xen/arch/ppc/include/asm/msr.h | 51 +++++++++Quoted 8 lines
xen/arch/ppc/include/asm/processor.h | 136 +++++++++++++++++++++++ xen/arch/ppc/include/asm/types.h | 21 ++++ xen/arch/ppc/ppc64/Makefile | 1 + xen/arch/ppc/ppc64/asm-offsets.c | 55 +++++++++ xen/arch/ppc/ppc64/head.S | 55 +++++---- xen/arch/ppc/ppc64/of-call.S | 83 ++++++++++++++ xen/arch/ppc/setup.c | 28 +++++ 19 files changed, 697 insertions(+), 20 deletions(-)
Quoted 1 line
... this. Plus
lib.halready includesstdarg.h.
Sorry, that was a bit ambiguous on my part. I meant that I changed
#include <xen/lib.h>
to
#include <xen/stdarg.h>
in arch/ppc/boot-of.c to reduce the number of headers
that I needed to create in arch/ppc/include/asm in order for the build to work. lib.h includes (directly and indirectly) many things from asm/ but stdarg.h is mostly standalone.
Quoted 1 line
Jan
Thanks,
Shawn