Skip to contentSkip to conversation

powerpc improvements

RFC PATCH In review Chinmay Rath 3 participants 20 messages Jun 2 – Jul 7

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover powerpc improvements

This series aims to add a couple of new powerpc tests and improve the powerpc build structure.

This is originally Nick's work. The last version (v10) of which can be seen here :
https://lore.kernel.org/linuxppc-dev/[email protected]/

Since it has been 2 years since this series was posted, I am now posting it as a RFC. Couple of patches from the series were already merged. Posting the rest.

I have rebased the patches to the upstream state.
For the patches which did not require any changes in the existing upstream code, I have retained the "Reviewed-by"s and "Acked-by" (patch 3,5 & 6), and have removed the same for the ones which required changes in the existing upstream code during rebase (patch 2). Nick had originally introduced powernv tests as well. Removed it for now since it was causing CI failure in the current upstream.

Link to Gitlab tree with patches :
https://gitlab.com/rathc/kvm-unit-tests/-/tree/ppc64
Link to Gitlab pipeline :
https://gitlab.com/rathc/kvm-unit-tests/-/pipelines/2569132740
Please note that the build-centos8 test is failing due to a recent upstream change unrelated to this patch series.

Nicholas Piggin (6):
powerpc: add pmu tests
configure: Make arch_libdir a first-class entity
powerpc: Remove remnants of ppc64 directory and build structure
powerpc: gitlab CI update
scripts/arch-run.bash: Fix run_panic() success exit status
powerpc: Add a panic test

 .gitlab-ci.yml                             |  53 +-
 MAINTAINERS                                |   1 -
 Makefile                                   |   2 +-
 configure                                  |  21 +-
 lib/{ppc64 => powerpc}/asm-offsets.c       |   0
 lib/{ppc64 => powerpc}/asm/asm-offsets.h   |   0
 lib/{ppc64 => powerpc}/asm/atomic.h        |   0
 lib/{ppc64 => powerpc}/asm/barrier.h       |   4 +-
 lib/{ppc64 => powerpc}/asm/bitops.h        |   4 +-
 lib/{ppc64 => powerpc}/asm/io.h            |   4 +-
 lib/{ppc64 => powerpc}/asm/mmu.h           |   0
 lib/{ppc64 => powerpc}/asm/opal.h          |   4 +-
 lib/{ppc64 => powerpc}/asm/page.h          |   6 +-
 lib/{ppc64 => powerpc}/asm/pgtable-hwdef.h |   6 +-
 lib/{ppc64 => powerpc}/asm/pgtable.h       |   2 +-
 lib/powerpc/asm/processor.h                |   2 +
 lib/{ppc64 => powerpc}/asm/ptrace.h        |   6 +-
 lib/powerpc/asm/reg.h                      |   9 +
 lib/powerpc/asm/rtas.h                     |   1 +
 lib/powerpc/asm/setup.h                    |   1 +
 lib/powerpc/asm/spinlock.h                 |   6 +
 lib/powerpc/asm/stack.h                    |   3 +
 lib/{ppc64 => powerpc}/asm/vpa.h           |   0
 lib/{ppc64 => powerpc}/mmu.c               |   0
 lib/{ppc64 => powerpc}/opal-calls.S        |   0
 lib/{ppc64 => powerpc}/opal.c              |   0
 lib/powerpc/rtas.c                         |  16 +
 lib/powerpc/setup.c                        |  20 +
 lib/{ppc64 => powerpc}/stack.c             |   0
 lib/ppc64/.gitignore                       |   1 -
 lib/ppc64/asm/handlers.h                   |   1 -
 lib/ppc64/asm/hcall.h                      |   1 -
 lib/ppc64/asm/memory_areas.h               |   6 -
 lib/ppc64/asm/ppc_asm.h                    |   1 -
 lib/ppc64/asm/processor.h                  |   1 -
 lib/ppc64/asm/reg.h                        |   1 -
 lib/ppc64/asm/rtas.h                       |   1 -
 lib/ppc64/asm/setup.h                      |   1 -
 lib/ppc64/asm/smp.h                        |   1 -
 lib/ppc64/asm/spinlock.h                   |   6 -
 lib/ppc64/asm/stack.h                      |  11 -
 lib/ppc64/asm/time.h                       |   1 -
 powerpc/Makefile                           | 111 +++-
 powerpc/Makefile.common                    |  94 ----
 powerpc/Makefile.ppc64                     |  31 --
 powerpc/pmu.c                              | 567 +++++++++++++++++++++
 powerpc/run                                |   2 +-
 powerpc/selftest.c                         |  17 +-
 powerpc/unittests.cfg                      |  44 +-
 scripts/arch-run.bash                      |   1 +
 50 files changed, 830 insertions(+), 241 deletions(-)
 rename lib/{ppc64 => powerpc}/asm-offsets.c (100%)
 rename lib/{ppc64 => powerpc}/asm/asm-offsets.h (100%)
 rename lib/{ppc64 => powerpc}/asm/atomic.h (100%)
 rename lib/{ppc64 => powerpc}/asm/barrier.h (83%)
 rename lib/{ppc64 => powerpc}/asm/bitops.h (69%)
 rename lib/{ppc64 => powerpc}/asm/io.h (50%)
 rename lib/{ppc64 => powerpc}/asm/mmu.h (100%)
 rename lib/{ppc64 => powerpc}/asm/opal.h (90%)
 rename lib/{ppc64 => powerpc}/asm/page.h (94%)
 rename lib/{ppc64 => powerpc}/asm/pgtable-hwdef.h (93%)
 rename lib/{ppc64 => powerpc}/asm/pgtable.h (99%)
 rename lib/{ppc64 => powerpc}/asm/ptrace.h (89%)
 create mode 100644 lib/powerpc/asm/spinlock.h
 rename lib/{ppc64 => powerpc}/asm/vpa.h (100%)
 rename lib/{ppc64 => powerpc}/mmu.c (100%)
 rename lib/{ppc64 => powerpc}/opal-calls.S (100%)
 rename lib/{ppc64 => powerpc}/opal.c (100%)
 rename lib/{ppc64 => powerpc}/stack.c (100%)
 delete mode 100644 lib/ppc64/.gitignore
 delete mode 100644 lib/ppc64/asm/handlers.h
 delete mode 100644 lib/ppc64/asm/hcall.h
 delete mode 100644 lib/ppc64/asm/memory_areas.h
 delete mode 100644 lib/ppc64/asm/ppc_asm.h
 delete mode 100644 lib/ppc64/asm/processor.h
 delete mode 100644 lib/ppc64/asm/reg.h
 delete mode 100644 lib/ppc64/asm/rtas.h
 delete mode 100644 lib/ppc64/asm/setup.h
 delete mode 100644 lib/ppc64/asm/smp.h
 delete mode 100644 lib/ppc64/asm/spinlock.h
 delete mode 100644 lib/ppc64/asm/stack.h
 delete mode 100644 lib/ppc64/asm/time.h
 delete mode 100644 powerpc/Makefile.common
 delete mode 100644 powerpc/Makefile.ppc64
 create mode 100644 powerpc/pmu.c
Signature · 1 line
2.53.0
#1 lore raw

RFC PATCH 1/6 powerpc: add pmu tests

From: Nicholas Piggin <[email protected]>

Add some initial PMU testing.

- PMC5/6 tests
- PMAE / PMI test
- BHRB basic tests

---
 lib/powerpc/asm/processor.h |   2 +
 lib/powerpc/asm/reg.h       |   9 +
 lib/powerpc/asm/setup.h     |   1 +
 lib/powerpc/setup.c         |  20 ++
 powerpc/Makefile.common     |   3 +-
 powerpc/pmu.c               | 567 ++++++++++++++++++++++++++++++++++++
 powerpc/unittests.cfg       |   3 +
 7 files changed, 604 insertions(+), 1 deletion(-)
 create mode 100644 powerpc/pmu.c
lib/powerpc/asm/processor.h +2 -0
index 153126fe..08506438 100644
@@ -17,6 +17,8 @@ extern bool cpu_has_hv;
 extern bool cpu_has_power_mce;
 extern bool cpu_has_siar;
 extern bool cpu_has_heai;
+extern bool cpu_has_bhrb;
+extern bool cpu_has_p10_bhrb;
 extern bool cpu_has_radix;
 extern bool cpu_has_prefix;
 extern bool cpu_has_sc_lev;
lib/powerpc/asm/reg.h +9 -0
index 69ef21ad..602fba1b 100644
@@ -40,10 +40,19 @@
 #define SPR_LPIDR	0x13f
 #define SPR_HEIR	0x153
 #define SPR_PTCR	0x1d0
+#define SPR_MMCRA	0x312
+#define   MMCRA_BHRBRD		UL(0x0000002000000000)
+#define   MMCRA_IFM_MASK	UL(0x00000000c0000000)
+#define SPR_PMC5	0x317
+#define SPR_PMC6	0x318
 #define SPR_MMCR0	0x31b
 #define   MMCR0_FC		UL(0x80000000)
+#define   MMCR0_FCP		UL(0x20000000)
 #define   MMCR0_PMAE		UL(0x04000000)
+#define   MMCR0_BHRBA		UL(0x00200000)
+#define   MMCR0_FCPC		UL(0x00001000)
 #define   MMCR0_PMAO		UL(0x00000080)
+#define   MMCR0_FC56		UL(0x00000010)
 #define SPR_SIAR	0x31c
 
 /* Machine State Register definitions: */
lib/powerpc/asm/setup.h +1 -0
index 9ca318ce..8f0b58ed 100644
@@ -10,6 +10,7 @@
 #define NR_CPUS			8	/* arbitrarily set for now */
 
 extern uint64_t tb_hz;
+extern uint64_t cpu_hz;
 
 #define NR_MEM_REGIONS		8
 #define MR_F_PRIMARY		(1U << 0)
lib/powerpc/setup.c +20 -0
index c1f0f9ad..ef4ebdbc 100644
@@ -33,6 +33,7 @@ u32 initrd_size;
 u32 cpu_to_hwid[NR_CPUS] = { [0 ... NR_CPUS-1] = (~0U) };
 int nr_cpus_present;
 uint64_t tb_hz;
+uint64_t cpu_hz;
 
 struct mem_region mem_regions[NR_MEM_REGIONS];
 phys_addr_t __physical_start, __physical_end;
@@ -42,6 +43,7 @@ struct cpu_set_params {
 	unsigned icache_bytes;
 	unsigned dcache_bytes;
 	uint64_t tb_hz;
+	uint64_t cpu_hz;
 };
 
 static void cpu_set(int fdtnode, u64 regval, void *info)
@@ -95,6 +97,19 @@ static void cpu_set(int fdtnode, u64 regval, void *info)
 		data = (u32 *)prop->data;
 		params->tb_hz = fdt32_to_cpu(*data);
 
+		prop = fdt_get_property(dt_fdt(), fdtnode,
+					"ibm,extended-clock-frequency", NULL);
+		if (prop) {
+			u64 *data64 = (u64 *)prop->data;
+			params->cpu_hz = fdt64_to_cpu(*data64);
+		} else {
+			prop = fdt_get_property(dt_fdt(), fdtnode,
+						"clock-frequency", NULL);
+			assert(prop != NULL);
+			data = (u32 *)prop->data;
+			params->cpu_hz = fdt32_to_cpu(*data);
+		}
+
 		read_common_info = true;
 	}
 }
@@ -103,6 +118,8 @@ bool cpu_has_hv;
 bool cpu_has_power_mce; /* POWER CPU machine checks */
 bool cpu_has_siar;
 bool cpu_has_heai;
+bool cpu_has_bhrb;
+bool cpu_has_p10_bhrb;
 bool cpu_has_radix;
 bool cpu_has_prefix;
 bool cpu_has_sc_lev; /* sc interrupt has LEV field in SRR1 */
@@ -119,12 +136,14 @@ static void cpu_init_params(void)
 	__icache_bytes = params.icache_bytes;
 	__dcache_bytes = params.dcache_bytes;
 	tb_hz = params.tb_hz;
+	cpu_hz = params.cpu_hz;
 
 	switch (mfspr(SPR_PVR) & PVR_VERSION_MASK) {
 	case PVR_VER_POWER10:
 		cpu_has_prefix = true;
 		cpu_has_sc_lev = true;
 		cpu_has_pause_short = true;
+		cpu_has_p10_bhrb = true;
 	case PVR_VER_POWER9:
 		cpu_has_radix = true;
 	case PVR_VER_POWER8E:
@@ -133,6 +152,7 @@ static void cpu_init_params(void)
 		cpu_has_power_mce = true;
 		cpu_has_heai = true;
 		cpu_has_siar = true;
+		cpu_has_bhrb = true;
 		break;
 	default:
 		break;
powerpc/Makefile.common +2 -1
index db4a34f2..3b357982 100644
@@ -18,7 +18,8 @@ tests-common = \
 	$(TEST_DIR)/sprs.elf \
 	$(TEST_DIR)/timebase.elf \
 	$(TEST_DIR)/interrupts.elf \
-	$(TEST_DIR)/mmu.elf
+	$(TEST_DIR)/mmu.elf \
+	$(TEST_DIR)/pmu.elf
 
 tests-all = $(tests-common) $(tests)
 all: directories $(TEST_DIR)/boot_rom.bin $(tests-all)
powerpc/pmu.c new file +567 -0

567 lines not on this page · raw message

powerpc/unittests.cfg +3 -0
index 2dd32edf..60c73086 100644
@@ -75,6 +75,9 @@ file = interrupts.elf
 file = mmu.elf
 smp = 2
 
+[pmu]
+file = pmu.elf
+
 [smp]
 file = smp.elf
 smp = 2
Signature · 1 line
2.53.0
#2 lore raw

Re: [kvm-unit-tests RFC PATCH 1/6] powerpc: add pmu tests

Quoted 19 lines · Chinmay Rath

From: Nicholas Piggin <[email protected]>

Add some initial PMU testing.

- PMC5/6 tests
- PMAE / PMI test
- BHRB basic tests

---
  lib/powerpc/asm/processor.h |   2 +
  lib/powerpc/asm/reg.h       |   9 +
  lib/powerpc/asm/setup.h     |   1 +
  lib/powerpc/setup.c         |  20 ++
  powerpc/Makefile.common     |   3 +-
  powerpc/pmu.c               | 567 ++++++++++++++++++++++++++++++++++++
  powerpc/unittests.cfg       |   3 +
  7 files changed, 604 insertions(+), 1 deletion(-)
Quoted 1 line

create mode 100644 powerpc/pmu.c

Hi Chinmay,

the problem with Clang on Travis [*] still seems to persist:

https://app.travis-ci.com/github/huth/kvm-unit-tests/jobs/639614142

Could you please have a look?

Thanks,
Thomas

[*] This already happened with Nicolas' last version:

https://www.spinics.net/lists/kvm/msg351218.html

#3 lore raw

Re: [kvm-unit-tests RFC PATCH 1/6] powerpc: add pmu tests

Quoted 30 lines · Thomas Huth
Quoted 18 lines · Chinmay Rath

From: Nicholas Piggin <[email protected]>

Add some initial PMU testing.

- PMC5/6 tests
- PMAE / PMI test
- BHRB basic tests

---
  lib/powerpc/asm/processor.h |   2 +
  lib/powerpc/asm/reg.h       |   9 + lib/powerpc/asm/setup.h     |   1 +
  lib/powerpc/setup.c         |  20 ++ powerpc/Makefile.common     |   3 +-
  powerpc/pmu.c               | 567 ++++++++++++++++++++++++++++++++++++ powerpc/unittests.cfg       |   3 +

Quoted 2 lines
  7 files changed, 604 insertions(+), 1 deletion(-)

  create mode 100644 powerpc/pmu.c

 Hi Chinmay,

the problem with Clang on Travis [*] still seems to persist:

 https://app.travis-ci.com/github/huth/kvm-unit-tests/jobs/639614142

Could you please have a look?

Quoted 7 lines

 Thanks,
  Thomas

[*] This already happened with Nicolas' last version:

 https://www.spinics.net/lists/kvm/msg351218.html

I managed to get access to a ppc64 machine. The error is:

/tmp/pmu-eab466.s: Assembler messages:
/tmp/pmu-eab466.s:1649: Error: unrecognized opcode: `ldat'
clang: error: assembler command failed with exit code 1 (use -v to see invocation)
make: *** [<builtin>: powerpc/pmu.o] Error 1

HTH,
Thomas

#4 lore raw

Re: [kvm-unit-tests RFC PATCH 1/6] powerpc: add pmu tests

Quoted 42 lines · Thomas Huth
Quoted 31 lines · Thomas Huth
Quoted 19 lines · Chinmay Rath

From: Nicholas Piggin <[email protected]>

Add some initial PMU testing.

- PMC5/6 tests
- PMAE / PMI test
- BHRB basic tests

---
  lib/powerpc/asm/processor.h |   2 +
  lib/powerpc/asm/reg.h       |   9 +
  lib/powerpc/asm/setup.h     |   1 +
  lib/powerpc/setup.c         |  20 ++
  powerpc/Makefile.common     |   3 +-
  powerpc/pmu.c               | 567
++++++++++++++++++++++++++++++++++++
  powerpc/unittests.cfg       |   3 +

Quoted 2 lines
  7 files changed, 604 insertions(+), 1 deletion(-)

  create mode 100644 powerpc/pmu.c

  Hi Chinmay,

the problem with Clang on Travis [*] still seems to persist:

  https://app.travis-ci.com/github/huth/kvm-unit-tests/jobs/639614142

Could you please have a look?

Quoted 7 lines

  Thanks,
   Thomas

[*] This already happened with Nicolas' last version:

  https://www.spinics.net/lists/kvm/msg351218.html

I managed to get access to a ppc64 machine. The error is:

Quoted 7 lines

/tmp/pmu-eab466.s: Assembler messages:
/tmp/pmu-eab466.s:1649: Error: unrecognized opcode: `ldat'
clang: error: assembler command failed with exit code 1 (use -v to see invocation)
make: *** [<builtin>: powerpc/pmu.o] Error 1

 HTH,
  Thomas

Hi Thomas,

Thanks for looking into this and providing the exact error message.

I was looking into this Travis CI job that you pointed to and noticed that the clang version being used was 14. I was wondering, would it be possible to use a newer version of clang for the job since LDAT is a legit PPC insn, that was introduced with Power 9, ISA version 3.0, way back a decade in 2016 !
So I was wondering if using a newer version of clang that recognizes the instruction would be a better approach.

I checked the .travis.yml file (config) for the job, which mentions :
|apt_packages: clang qemu-system-ppc|

Can we change it to something like :
|apt_packages: clang19 qemu-system-ppc |or (clang-19)  ?

In the same config s390x uses a specific version of clang that is 11 in similar manner.

However if you'd still prefer working around LDAT, I could try with LDARX instead, but I am unable to verify if clang-14 will recognize that since the oldest version of clang I could find in ppc64le repo was clang-15 which was able to work with LDAT as well. Hence, could you help me with providing the steps to use Travis-CI so I could verify ? (I had skipped doing the credit card payment while signing up, in case that's mandatory for Travis CI. Pardon me I'm new to it XD)

Thanks,
Chinmay

#5 lore raw

Re: [kvm-unit-tests RFC PATCH 1/6] powerpc: add pmu tests

Quoted 50 lines · Chinmay Rath
Quoted 41 lines · Thomas Huth
Quoted 30 lines · Thomas Huth
Quoted 18 lines · Chinmay Rath

From: Nicholas Piggin <[email protected]>

Add some initial PMU testing.

- PMC5/6 tests
- PMAE / PMI test
- BHRB basic tests

---
  lib/powerpc/asm/processor.h |   2 +
  lib/powerpc/asm/reg.h       |   9 + lib/powerpc/asm/setup.h     |   1 +
  lib/powerpc/setup.c         |  20 ++ powerpc/Makefile.common     |   3 +-
  powerpc/pmu.c               | 567 ++++++++++++++++++++++++++++++++++++ powerpc/unittests.cfg       |   3 +

Quoted 2 lines
  7 files changed, 604 insertions(+), 1 deletion(-)

  create mode 100644 powerpc/pmu.c

  Hi Chinmay,

the problem with Clang on Travis [*] still seems to persist:

  https://app.travis-ci.com/github/huth/kvm-unit-tests/jobs/639614142

Could you please have a look?

Quoted 7 lines

  Thanks,
   Thomas

[*] This already happened with Nicolas' last version:

  https://www.spinics.net/lists/kvm/msg351218.html

I managed to get access to a ppc64 machine. The error is:

Quoted 7 lines

/tmp/pmu-eab466.s: Assembler messages:
/tmp/pmu-eab466.s:1649: Error: unrecognized opcode: `ldat'
clang: error: assembler command failed with exit code 1 (use -v to see invocation)
make: *** [<builtin>: powerpc/pmu.o] Error 1

 HTH,
  Thomas

Quoted 8 lines

Hi Thomas,

Thanks for looking into this and providing the exact error message.

I was looking into this Travis CI job that you pointed to and noticed that the clang version being used was 14. I was wondering, would it be possible to use a newer version of clang for the job since LDAT is a legit PPC insn, that was introduced with Power 9, ISA version 3.0, way back a decade in 2016 !
So I was wondering if using a newer version of clang that recognizes the instruction would be a better approach.

I can reproduce the very same issue on a ppc64le box with Clang 22:

# clang --version
clang version 22.1.6 (Fedora 22.1.6-1.fc44)
Target: ppc64le-redhat-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Configuration file: /etc/clang/ppc64le-redhat-linux-gnu-clang.cfg
# make
clang -no-integrated-as -std=gnu99 -ffreestanding -O2 -msoft-float -mno-altivec  -I /root/kvm-unit-tests/lib -I /root/kvm-unit-tests/lib/libfdt -I lib -Wa,-mregnames -g -MMD -MP -MF powerpc/.pmu.d -fno-strict-aliasing -fno-common -Wall -Wwrite-strings -Wempty-body -Wuninitialized -Wignored-qualifiers -Wno-missing-braces -Werror  -fomit-frame-pointer -fno-stack-protector    -Wno-frame-address   -fno-pic -Wunused-but-set-parameter  -Wno-override-init     -Wmissing-prototypes -Wstrict-prototypes  -mlittle-endian   -c -o powerpc/pmu.o powerpc/pmu.c
/tmp/pmu-f0c247.s: Assembler messages:
/tmp/pmu-f0c247.s:1656: Error: unrecognized opcode: `ldat'
clang: error: assembler command failed with exit code 1 (use -v to see invocation)
make: *** [<builtin>: powerpc/pmu.o] Error 1

Does compiling with Clang work for you? If so, which version?

Thomas

#6 lore raw

Re: [kvm-unit-tests RFC PATCH 1/6] powerpc: add pmu tests

Quoted 83 lines · Thomas Huth
Quoted 51 lines · Chinmay Rath
Quoted 42 lines · Thomas Huth
Quoted 31 lines · Thomas Huth
Quoted 19 lines · Chinmay Rath

From: Nicholas Piggin <[email protected]>

Add some initial PMU testing.

- PMC5/6 tests
- PMAE / PMI test
- BHRB basic tests

---
  lib/powerpc/asm/processor.h |   2 +
  lib/powerpc/asm/reg.h       |   9 +
  lib/powerpc/asm/setup.h     |   1 +
  lib/powerpc/setup.c         |  20 ++
  powerpc/Makefile.common     |   3 +-
  powerpc/pmu.c               | 567
++++++++++++++++++++++++++++++++++++
  powerpc/unittests.cfg       |   3 +

Quoted 2 lines
  7 files changed, 604 insertions(+), 1 deletion(-)

  create mode 100644 powerpc/pmu.c

  Hi Chinmay,

the problem with Clang on Travis [*] still seems to persist:

  https://app.travis-ci.com/github/huth/kvm-unit-tests/jobs/639614142

Could you please have a look?

Quoted 7 lines

  Thanks,
   Thomas

[*] This already happened with Nicolas' last version:

  https://www.spinics.net/lists/kvm/msg351218.html

I managed to get access to a ppc64 machine. The error is:

Quoted 7 lines

/tmp/pmu-eab466.s: Assembler messages:
/tmp/pmu-eab466.s:1649: Error: unrecognized opcode: `ldat'
clang: error: assembler command failed with exit code 1 (use -v to see invocation)
make: *** [<builtin>: powerpc/pmu.o] Error 1

 HTH,
  Thomas

Quoted 8 lines

Hi Thomas,

Thanks for looking into this and providing the exact error message.

I was looking into this Travis CI job that you pointed to and noticed that the clang version being used was 14. I was wondering, would it be possible to use a newer version of clang for the job since LDAT is a legit PPC insn, that was introduced with Power 9, ISA version 3.0, way back a decade in 2016 !
So I was wondering if using a newer version of clang that recognizes the instruction would be a better approach.

I can reproduce the very same issue on a ppc64le box with Clang 22:

# clang --version
clang version 22.1.6 (Fedora 22.1.6-1.fc44)
Target: ppc64le-redhat-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Configuration file: /etc/clang/ppc64le-redhat-linux-gnu-clang.cfg
# make
clang -no-integrated-as -std=gnu99 -ffreestanding -O2 -msoft-float 
-mno-altivec  -I /root/kvm-unit-tests/lib -I 
/root/kvm-unit-tests/lib/libfdt -I lib -Wa,-mregnames -g -MMD -MP -MF powerpc/.pmu.d -fno-strict-aliasing -fno-common -Wall -Wwrite-strings 
(quoted diff) +0 -5
-Wempty-body -Wuninitialized -Wignored-qualifiers -Wno-missing-braces 
-Werror  -fomit-frame-pointer -fno-stack-protector    
-Wno-frame-address   -fno-pic -Wunused-but-set-parameter  
-Wno-override-init -Wmissing-prototypes -Wstrict-prototypes  
-mlittle-endian   -c -o powerpc/pmu.o powerpc/pmu.c

/tmp/pmu-f0c247.s: Assembler messages:
/tmp/pmu-f0c247.s:1656: Error: unrecognized opcode: `ldat'
clang: error: assembler command failed with exit code 1 (use -v to see invocation)
make: *** [<builtin>: powerpc/pmu.o] Error 1

Quoted 5 lines

Does compiling with Clang work for you? If so, which version?

 Thomas

Thanks for sharing this observation Thomas. I did some digging on a ppc64 machine and found the following :

The problem isn't with clang. Clang is able to perfectly identify LDAT insn. This can be verified by writing a small C program using LDAT within a similar asm volatile block and compiling with Clang. Sails smooth. The problem is, the GNU assembler does not identify LDAT, unless "-mpower10" flag is passed to it. Can be verified by writing a small .S program making use of LDAT and passing to 'as', the GNU assembler binary. In your Travis CI log, as I can check, the following config is used :

$ export CONFIG="--arch=ppc64 --endian=little --cc=clang --cflags=-no-integrated-as"
"no-integrated-as" defers the assembling job to GNU assembler, and since no "-mpower10" flag is passed, the compilation fails.
Using the following flag in the config instead, passes -mpower10 to GNU assembler and gets the compilation job done :  --cflags="-no-integrated-as -Wa,-mpower10"

Thanks,
Chinmay

PS: I will be away traveling for a while, will get back to this as soon as I am back. Thanks for understanding   :)

#7 lore raw

RFC PATCH 2/6 configure: Make arch_libdir a first-class entity

In reply to Chinmay Rath

From: Nicholas Piggin <[email protected]>

arch_libdir was brought in to improve the heuristic determination of the lib/ directory based on arch and testdir names, but it did not entirely clean that mess up.

Remove the arch_libdir->arch->testdir heuristic and just require everybody sets arch_libdir correctly. Fail if the lib/arch or lib/arch/asm directories can not be found.

---
 Makefile  |  2 +-
 configure | 20 ++++++++++++--------
 2 files changed, 13 insertions(+), 9 deletions(-)
Makefile +1 -1
index 42ef5826..8e002043 100644
@@ -12,7 +12,7 @@ vpath %.s $(SRCDIR)
 vpath %.S $(SRCDIR)
 
 libdirs-get = $(shell [ -d "lib/$(1)" ] && echo "lib/$(1) lib/$(1)/asm")
-ARCH_LIBDIRS := $(call libdirs-get,$(ARCH_LIBDIR)) $(call libdirs-get,$(TEST_DIR))
+ARCH_LIBDIRS := $(call libdirs-get,$(ARCH_LIBDIR))
 OBJDIRS := $(ARCH_LIBDIRS)
 
 DESTDIR := $(PREFIX)/share/kvm-unit-tests/
configure +12 -8
index 6d549d1e..aeb5570c 100755
@@ -274,7 +274,6 @@ fi
 arch_name=$arch
 [ "$arch" = "aarch64" ] && arch="arm64"
 [ "$arch_name" = "arm64" ] && arch_name="aarch64"
-arch_libdir=$arch
 
 if [ "$arch" = "riscv" ]; then
     echo "riscv32 or riscv64 must be specified"
@@ -373,8 +372,10 @@ fi
 
 if [ "$arch" = "i386" ] || [ "$arch" = "x86_64" ]; then
     testdir=x86
+    arch_libdir=x86
 elif [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then
     testdir=arm
+    arch_libdir=$arch
     if [ "$target" = "qemu" ]; then
         : "${uart_early_addr:=0x9000000}"
     elif [ "$target" = "kvmtool" ]; then
@@ -385,6 +386,7 @@ elif [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then
     fi
 elif [ "$arch" = "ppc64" ]; then
     testdir=powerpc
+    arch_libdir=ppc64
     firmware="$testdir/boot_rom.bin"
     if [ "$endian" != "little" ] && [ "$endian" != "big" ]; then
         echo "You must provide endianness (big or little)!"
@@ -400,6 +402,7 @@ elif [ "$arch" = "riscv32" ] || [ "$arch" = "riscv64" ]; then
     fi
 elif [ "$arch" = "s390x" ]; then
     testdir=s390x
+    arch_libdir=s390x
 else
     echo "arch $arch is not supported!"
     arch=
@@ -409,6 +412,10 @@ if [ ! -d "$srcdir/$testdir" ]; then
     echo "$srcdir/$testdir does not exist!"
     exit 1
 fi
+if [ ! -d "$srcdir/lib/$arch_libdir" ]; then
+    echo "$srcdir/lib/$arch_libdir does not exist!"
+    exit 1
+fi
 
 if [ "$efi" = "y" ] && [ -f "$srcdir/$testdir/efi/run" ]; then
     ln -fs "$srcdir/$testdir/efi/run" $testdir-run
@@ -471,15 +478,12 @@ fi
 # link lib/asm for the architecture
 rm -f lib/asm
 asm="asm-generic"
-if [ -d "$srcdir/lib/$arch/asm" ]; then
-	asm="$srcdir/lib/$arch/asm"
-	mkdir -p "lib/$arch"
-elif [ -d "$srcdir/lib/$arch_libdir/asm" ]; then
+if [ -d "$srcdir/lib/$arch_libdir/asm" ]; then
 	asm="$srcdir/lib/$arch_libdir/asm"
 	mkdir -p "lib/$arch_libdir"
-elif [ -d "$srcdir/lib/$testdir/asm" ]; then
-	asm="$srcdir/lib/$testdir/asm"
-	mkdir -p "lib/$testdir"
+else
+	echo "$srcdir/lib/$arch_libdir/asm does not exist"
+	exit 1
 fi
 ln -sf "$asm" lib/asm
 mkdir -p lib/generated lib/libfdt
Signature · 1 line
2.53.0
Reviewed-by on v1 2/6
#8 lore raw

Re: [kvm-unit-tests RFC PATCH 2/6] configure: Make arch_libdir a first-class entity

Quoted 10 lines · Chinmay Rath

From: Nicholas Piggin <[email protected]>

arch_libdir was brought in to improve the heuristic determination of the lib/ directory based on arch and testdir names, but it did not entirely clean that mess up.

Remove the arch_libdir->arch->testdir heuristic and just require everybody sets arch_libdir correctly. Fail if the lib/arch or lib/arch/asm directories can not be found.

Quoted 7 lines
---
 Makefile  |  2 +-
 configure | 20 ++++++++++++--------
 2 files changed, 13 insertions(+), 9 deletions(-)
#9 lore raw

Re: [kvm-unit-tests RFC PATCH 2/6] configure: Make arch_libdir a first-class entity

Quoted 11 lines · Andrew Jones
Quoted 10 lines · Chinmay Rath

From: Nicholas Piggin <[email protected]>

arch_libdir was brought in to improve the heuristic determination of the lib/ directory based on arch and testdir names, but it did not entirely clean that mess up.

Remove the arch_libdir->arch->testdir heuristic and just require everybody sets arch_libdir correctly. Fail if the lib/arch or lib/arch/asm directories can not be found.

Quoted 8 lines
Quoted 7 lines
---
  Makefile  |  2 +-
  configure | 20 ++++++++++++--------
  2 files changed, 13 insertions(+), 9 deletions(-)

Thank you Andrew !

Hi Thomas, requesting your insight on the un-reviewed patches. TIA.

-Chinmay

#10 lore raw

Re: [kvm-unit-tests RFC PATCH 2/6] configure: Make arch_libdir a first-class entity

In reply to Chinmay Rath
Quoted 10 lines · Chinmay Rath

From: Nicholas Piggin <[email protected]>

arch_libdir was brought in to improve the heuristic determination of the lib/ directory based on arch and testdir names, but it did not entirely clean that mess up.

Remove the arch_libdir->arch->testdir heuristic and just require everybody sets arch_libdir correctly. Fail if the lib/arch or lib/arch/asm directories can not be found.

Quoted 6 lines
---
  Makefile  |  2 +-
  configure | 20 ++++++++++++--------
  2 files changed, 13 insertions(+), 9 deletions(-)

FYI, this patch seems to trigger yet another issue with Clang (I used v21):

clang -no-integrated-as -std=gnu99 -ffreestanding -O2 -msoft-float -mno-altivec -I /root/kvm-unit-tests/lib -I /root/kvm-unit-tests/lib/libfdt -I lib -Wa,-mregnames -fverbose-asm -S -o lib/powerpc/asm-offsets.s lib/powerpc/asm-offsets.c lib/powerpc/asm-offsets.c:10:10: error: 'asm/smp.h' file not found with <angled> include; use
"quotes" instead

   10 | #include <asm/smp.h>
      |          ^~~~~~~~~~~
      |          "asm/smp.h"

In file included from lib/powerpc/asm-offsets.c:10:
lib/powerpc/asm/smp.h:5:10: fatal error: 'asm/processor.h' file not found
5 | #include <asm/processor.h>
| ^~~~~~~~~~~~~~~~~
2 errors generated.

Could you please have a look?

Thanks,
Thomas

#11 lore raw

Re: [kvm-unit-tests RFC PATCH 2/6] configure: Make arch_libdir a first-class entity

Quoted 35 lines · Thomas Huth
Quoted 10 lines · Chinmay Rath

From: Nicholas Piggin <[email protected]>

arch_libdir was brought in to improve the heuristic determination of the lib/ directory based on arch and testdir names, but it did not entirely clean that mess up.

Remove the arch_libdir->arch->testdir heuristic and just require everybody sets arch_libdir correctly. Fail if the lib/arch or lib/arch/asm directories can not be found.

Quoted 6 lines

---
  Makefile  |  2 +-
  configure | 20 ++++++++++++--------

  2 files changed, 13 insertions(+), 9 deletions(-)

FYI, this patch seems to trigger yet another issue with Clang (I used v21):

clang -no-integrated-as -std=gnu99 -ffreestanding -O2 -msoft-float -mno-altivec  -I /root/kvm-unit-tests/lib -I
/root/kvm-unit-tests/lib/libfdt -I lib -Wa,-mregnames -fverbose-asm -S
-o lib/powerpc/asm-offsets.s lib/powerpc/asm-offsets.c lib/powerpc/asm-offsets.c:10:10: error: 'asm/smp.h' file not found with <angled> include; use "quotes" instead
   10 | #include <asm/smp.h>
      |          ^~~~~~~~~~~
      |          "asm/smp.h"
In file included from lib/powerpc/asm-offsets.c:10:
lib/powerpc/asm/smp.h:5:10: fatal error: 'asm/processor.h' file not found
    5 | #include <asm/processor.h>
      |          ^~~~~~~~~~~~~~~~~
2 errors generated.

Quoted 1 line

Could you please have a look?

Hi Thomas, back from traveling and looked into this. I am using Clang v21 as well :

# clang --version
clang version 21.1.8 (Fedora 21.1.8-4.fc43)
Target: ppc64le-redhat-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Configuration file: /etc/clang/ppc64le-redhat-linux-gnu-clang.cfg

I see the above file, asm-offsets.s being generated properly without any error during the make process (used the extra flags for make that I have mentioned in my other reply).
Snippet from make :
cat powerpc/boot_rom.bin.tmp >> powerpc/boot_rom.bin
rm -f powerpc/boot_rom.bin.tmp
clang -no-integrated-as -Wa,-mpower10 -std=gnu99 -ffreestanding -O2 -msoft-float -mno-altivec  -I /root/chins/git/kvm-unit-tests/lib -I /root/chins/git/kvm-unit-tests/lib/libfdt -I lib -Wa,-mregnames -fverbose-asm -S -o lib/powerpc/asm-offsets.s /root/chins/git/kvm-unit-tests/lib/powerpc/asm-offsets.c
(set -e; echo "#ifndef __ASM_OFFSETS_H__"; echo "#define __ASM_OFFSETS_H__"; echo "/*"; echo " * Generated file. DO NOT MODIFY."; echo " *"; echo " */"; echo ""; sed -ne  's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; /^->/{s:->#\(.*\):/* \1 */:; s:^->\([^ ]*\) [\$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}' lib/powerpc/asm-offsets.s; echo ""; echo "#endif" ) > lib/powerpc/asm-offsets.h
cp -f lib/powerpc/asm-offsets.h lib/generated/
clang -no-integrated-as -Wa,-mpower10 -std=gnu99 -ffreestanding -O2 -msoft-float -mno-altivec  -I /root/chins/git/kvm-unit-tests/lib -I /root/chins/git/kvm-unit-tests/lib/libfdt -I lib -Wa,-mregnames -g -MMD -MP -MF powerpc/.selftest.d -fno-strict-aliasing -fno-common -Wall -Wwrite-strings -Wempty-body -Wuninitialized -Wignored-qualifiers -Wno-missing-braces -Werror -fomit-frame-pointer  -fno-stack-protector    -Wno-frame-address  -fno-pic    -Wunused-but-set-parameter  -Wno-override-init  -Wmissing-prototypes -Wstrict-prototypes  -mlittle-endian   -c -o powerpc/selftest.o /root/chins/git/kvm-unit-tests/powerpc/selftest.c

Infact, if I just execute that single command independently to build asm-offsets.s, it works as well.

However, I noticed that if that single command is executed in a directory (build or main directory) where configure command hasn't been executed first, that is when the error you have shared above pops out. It is probably because configure adds some file to ./lib and those are included in the clang command using "-I lib"

Thanks,
Chinmay

Quoted 4 lines

 Thanks,
  Thomas

#12 lore raw

Re: [kvm-unit-tests RFC PATCH 2/6] configure: Make arch_libdir a first-class entity

Quoted 57 lines · Chinmay Rath
Quoted 32 lines · Thomas Huth
Quoted 10 lines · Chinmay Rath

From: Nicholas Piggin <[email protected]>

arch_libdir was brought in to improve the heuristic determination of the lib/ directory based on arch and testdir names, but it did not entirely clean that mess up.

Remove the arch_libdir->arch->testdir heuristic and just require everybody sets arch_libdir correctly. Fail if the lib/arch or lib/arch/asm directories can not be found.

Quoted 6 lines

---
  Makefile  |  2 +-
  configure | 20 ++++++++++++--------

  2 files changed, 13 insertions(+), 9 deletions(-)

FYI, this patch seems to trigger yet another issue with Clang (I used v21):

clang -no-integrated-as -std=gnu99 -ffreestanding -O2 -msoft-float -mno- altivec  -I /root/kvm-unit-tests/lib -I /root/kvm-unit-tests/lib/libfdt -I lib -Wa,-mregnames -fverbose-asm -S -o lib/powerpc/asm-offsets.s lib/ powerpc/asm-offsets.c lib/powerpc/asm-offsets.c:10:10: error: 'asm/smp.h' file not found with <angled> include; use
      "quotes" instead
   10 | #include <asm/smp.h>
      |          ^~~~~~~~~~~
      |          "asm/smp.h"
In file included from lib/powerpc/asm-offsets.c:10:
lib/powerpc/asm/smp.h:5:10: fatal error: 'asm/processor.h' file not found
    5 | #include <asm/processor.h>
      |          ^~~~~~~~~~~~~~~~~
2 errors generated.

Quoted 1 line

Could you please have a look?

Hi Thomas, back from traveling and looked into this. I am using Clang v21 as well :

# clang --version
clang version 21.1.8 (Fedora 21.1.8-4.fc43)
Target: ppc64le-redhat-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Configuration file: /etc/clang/ppc64le-redhat-linux-gnu-clang.cfg

I see the above file, asm-offsets.s being generated properly without any error during the make process (used the extra flags for make that I have mentioned in my other reply).
Snippet from make :
cat powerpc/boot_rom.bin.tmp >> powerpc/boot_rom.bin
rm -f powerpc/boot_rom.bin.tmp
clang -no-integrated-as -Wa,-mpower10 -std=gnu99 -ffreestanding -O2 -msoft- float -mno-altivec  -I /root/chins/git/kvm-unit-tests/lib -I /root/chins/ git/kvm-unit-tests/lib/libfdt -I lib -Wa,-mregnames -fverbose-asm -S -o lib/ powerpc/asm-offsets.s /root/chins/git/kvm-unit-tests/lib/powerpc/asm-offsets.c
(set -e; echo "#ifndef __ASM_OFFSETS_H__"; echo "#define __ASM_OFFSETS_H__"; echo "/*"; echo " * Generated file. DO NOT MODIFY."; echo " *"; echo " */"; echo ""; sed -ne  's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; /^->/ {s:->#\(.*\):/* \1 */:; s:^->\([^ ]*\) [\$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}' lib/powerpc/asm-offsets.s; echo ""; echo "#endif" ) > lib/ powerpc/asm-offsets.h cp -f lib/powerpc/asm-offsets.h lib/generated/
clang -no-integrated-as -Wa,-mpower10 -std=gnu99 -ffreestanding -O2 -msoft- float -mno-altivec  -I /root/chins/git/kvm-unit-tests/lib -I /root/chins/ git/kvm-unit-tests/lib/libfdt -I lib -Wa,-mregnames -g -MMD -MP -MF powerpc/.selftest.d -fno-strict-aliasing -fno-common -Wall -Wwrite-strings - Wempty-body -Wuninitialized -Wignored-qualifiers -Wno-missing-braces -Werror

(quoted diff) +0 -2
-fomit-frame-pointer  -fno-stack-protector   -Wno-frame-address  -fno-pic    
-Wunused-but-set-parameter -Wno-override-init  -Wmissing-prototypes - 

Wstrict-prototypes -mlittle-endian   -c -o powerpc/selftest.o /root/chins/ git/kvm-unit-tests/powerpc/selftest.c

Quoted 1 line

Infact, if I just execute that single command independently to build asm- offsets.s, it works as well.

Ok, I finally got access to a POWER system again and tried to reproduce the issue, but I also cannot reproduce it anymore. No clue how I managed to get into that situation, but looks like it was rather due to a messed up build tree than due to your patch. So sorry for the trouble, and please go ahead and simply ignore my objection here.

Thanks,
Thomas

#13 lore raw

Re: [kvm-unit-tests RFC PATCH 2/6] configure: Make arch_libdir a first-class entity

Quoted 69 lines · Thomas Huth
Quoted 68 lines · Chinmay Rath
Quoted 35 lines · Thomas Huth
Quoted 10 lines · Chinmay Rath

From: Nicholas Piggin <[email protected]>

arch_libdir was brought in to improve the heuristic determination of the lib/ directory based on arch and testdir names, but it did not entirely clean that mess up.

Remove the arch_libdir->arch->testdir heuristic and just require everybody sets arch_libdir correctly. Fail if the lib/arch or lib/arch/asm directories can not be found.

Quoted 6 lines

---
  Makefile  |  2 +-
  configure | 20 ++++++++++++--------

  2 files changed, 13 insertions(+), 9 deletions(-)

FYI, this patch seems to trigger yet another issue with Clang (I used v21):

clang -no-integrated-as -std=gnu99 -ffreestanding -O2 -msoft-float
-mno- altivec  -I /root/kvm-unit-tests/lib -I
/root/kvm-unit-tests/lib/libfdt -I lib -Wa,-mregnames -fverbose-asm
-S -o lib/powerpc/asm-offsets.s lib/ powerpc/asm-offsets.c lib/powerpc/asm-offsets.c:10:10: error: 'asm/smp.h' file not found with <angled> include; use "quotes" instead
   10 | #include <asm/smp.h>
      |          ^~~~~~~~~~~
      |          "asm/smp.h"
In file included from lib/powerpc/asm-offsets.c:10:
lib/powerpc/asm/smp.h:5:10: fatal error: 'asm/processor.h' file not found
    5 | #include <asm/processor.h>
      |          ^~~~~~~~~~~~~~~~~
2 errors generated.

Quoted 1 line

Could you please have a look?

Hi Thomas, back from traveling and looked into this. I am using Clang v21 as well :

# clang --version
clang version 21.1.8 (Fedora 21.1.8-4.fc43)
Target: ppc64le-redhat-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Configuration file: /etc/clang/ppc64le-redhat-linux-gnu-clang.cfg

I see the above file, asm-offsets.s being generated properly without any error during the make process (used the extra flags for make that I have mentioned in my other reply).
Snippet from make :
cat powerpc/boot_rom.bin.tmp >> powerpc/boot_rom.bin
rm -f powerpc/boot_rom.bin.tmp
clang -no-integrated-as -Wa,-mpower10 -std=gnu99 -ffreestanding -O2
-msoft- float -mno-altivec  -I /root/chins/git/kvm-unit-tests/lib -I
/root/chins/ git/kvm-unit-tests/lib/libfdt -I lib -Wa,-mregnames
-fverbose-asm -S -o lib/ powerpc/asm-offsets.s
/root/chins/git/kvm-unit-tests/lib/powerpc/asm-offsets.c
(set -e; echo "#ifndef __ASM_OFFSETS_H__"; echo "#define __ASM_OFFSETS_H__"; echo "/*"; echo " * Generated file. DO NOT MODIFY."; echo " *"; echo " */"; echo ""; sed -ne  's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; /^->/ {s:->#\(.*\):/* \1 */:; s:^->\([^ ]*\) [\$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}' lib/powerpc/asm-offsets.s; echo ""; echo "#endif" ) > lib/ powerpc/asm-offsets.h cp -f lib/powerpc/asm-offsets.h lib/generated/
clang -no-integrated-as -Wa,-mpower10 -std=gnu99 -ffreestanding -O2
-msoft- float -mno-altivec  -I /root/chins/git/kvm-unit-tests/lib -I
/root/chins/ git/kvm-unit-tests/lib/libfdt -I lib -Wa,-mregnames -g

(quoted diff) +0 -4
-MMD -MP -MF powerpc/.selftest.d -fno-strict-aliasing -fno-common 
-Wall -Wwrite-strings - Wempty-body -Wuninitialized 
-Wignored-qualifiers -Wno-missing-braces -Werror 
-fomit-frame-pointer  -fno-stack-protector   -Wno-frame-address 

 -fno-pic    -Wunused-but-set-parameter -Wno-override-init  -Wmissing-prototypes - Wstrict-prototypes -mlittle-endian   -c -o powerpc/selftest.o /root/chins/ git/kvm-unit-tests/powerpc/selftest.c

Quoted 3 lines
Quoted 1 line

Infact, if I just execute that single command independently to build asm- offsets.s, it works as well.

Ok, I finally got access to a POWER system again and tried to reproduce the issue, but I also cannot reproduce it anymore. No clue how I managed to get into that situation, but looks like it was rather due to a messed up build tree than due to your patch. So sorry for the trouble, and please go ahead and simply ignore my objection here.

Not a problem Thomas. Thanks for taking the time to look this up again. Will post the next iteration asap.

Regards,
Chinmay

Quoted 5 lines

 Thanks,
  Thomas

#14 lore raw

RFC PATCH 3/6 powerpc: Remove remnants of ppc64 directory and build structure

In reply to Chinmay Rath

From: Nicholas Piggin <[email protected]>

This moves merges ppc64 directories and files into powerpc, and merges the 3 makefiles into one.

The configure --arch=powerpc option is aliased to ppc64 for good measure.

---
 MAINTAINERS                                |   1 -
 configure                                  |   3 +-
 lib/{ppc64 => powerpc}/asm-offsets.c       |   0
 lib/{ppc64 => powerpc}/asm/asm-offsets.h   |   0
 lib/{ppc64 => powerpc}/asm/atomic.h        |   0
 lib/{ppc64 => powerpc}/asm/barrier.h       |   4 +-
 lib/{ppc64 => powerpc}/asm/bitops.h        |   4 +-
 lib/{ppc64 => powerpc}/asm/io.h            |   4 +-
 lib/{ppc64 => powerpc}/asm/mmu.h           |   0
 lib/{ppc64 => powerpc}/asm/opal.h          |   4 +-
 lib/{ppc64 => powerpc}/asm/page.h          |   6 +-
 lib/{ppc64 => powerpc}/asm/pgtable-hwdef.h |   6 +-
 lib/{ppc64 => powerpc}/asm/pgtable.h       |   2 +-
 lib/{ppc64 => powerpc}/asm/ptrace.h        |   6 +-
 lib/powerpc/asm/spinlock.h                 |   6 ++
 lib/powerpc/asm/stack.h                    |   3 +
 lib/{ppc64 => powerpc}/asm/vpa.h           |   0
 lib/{ppc64 => powerpc}/mmu.c               |   0
 lib/{ppc64 => powerpc}/opal-calls.S        |   0
 lib/{ppc64 => powerpc}/opal.c              |   0
 lib/{ppc64 => powerpc}/stack.c             |   0
 lib/ppc64/.gitignore                       |   1 -
 lib/ppc64/asm/handlers.h                   |   1 -
 lib/ppc64/asm/hcall.h                      |   1 -
 lib/ppc64/asm/memory_areas.h               |   6 --
 lib/ppc64/asm/ppc_asm.h                    |   1 -
 lib/ppc64/asm/processor.h                  |   1 -
 lib/ppc64/asm/reg.h                        |   1 -
 lib/ppc64/asm/rtas.h                       |   1 -
 lib/ppc64/asm/setup.h                      |   1 -
 lib/ppc64/asm/smp.h                        |   1 -
 lib/ppc64/asm/spinlock.h                   |   6 --
 lib/ppc64/asm/stack.h                      |  11 --
 lib/ppc64/asm/time.h                       |   1 -
 powerpc/Makefile                           | 111 ++++++++++++++++++++-
 powerpc/Makefile.common                    |  95 ------------------
 powerpc/Makefile.ppc64                     |  31 ------
 37 files changed, 139 insertions(+), 180 deletions(-)
 rename lib/{ppc64 => powerpc}/asm-offsets.c (100%)
 rename lib/{ppc64 => powerpc}/asm/asm-offsets.h (100%)
 rename lib/{ppc64 => powerpc}/asm/atomic.h (100%)
 rename lib/{ppc64 => powerpc}/asm/barrier.h (83%)
 rename lib/{ppc64 => powerpc}/asm/bitops.h (69%)
 rename lib/{ppc64 => powerpc}/asm/io.h (50%)
 rename lib/{ppc64 => powerpc}/asm/mmu.h (100%)
 rename lib/{ppc64 => powerpc}/asm/opal.h (90%)
 rename lib/{ppc64 => powerpc}/asm/page.h (94%)
 rename lib/{ppc64 => powerpc}/asm/pgtable-hwdef.h (93%)
 rename lib/{ppc64 => powerpc}/asm/pgtable.h (99%)
 rename lib/{ppc64 => powerpc}/asm/ptrace.h (89%)
 create mode 100644 lib/powerpc/asm/spinlock.h
 rename lib/{ppc64 => powerpc}/asm/vpa.h (100%)
 rename lib/{ppc64 => powerpc}/mmu.c (100%)
 rename lib/{ppc64 => powerpc}/opal-calls.S (100%)
 rename lib/{ppc64 => powerpc}/opal.c (100%)
 rename lib/{ppc64 => powerpc}/stack.c (100%)
 delete mode 100644 lib/ppc64/.gitignore
 delete mode 100644 lib/ppc64/asm/handlers.h
 delete mode 100644 lib/ppc64/asm/hcall.h
 delete mode 100644 lib/ppc64/asm/memory_areas.h
 delete mode 100644 lib/ppc64/asm/ppc_asm.h
 delete mode 100644 lib/ppc64/asm/processor.h
 delete mode 100644 lib/ppc64/asm/reg.h
 delete mode 100644 lib/ppc64/asm/rtas.h
 delete mode 100644 lib/ppc64/asm/setup.h
 delete mode 100644 lib/ppc64/asm/smp.h
 delete mode 100644 lib/ppc64/asm/spinlock.h
 delete mode 100644 lib/ppc64/asm/stack.h
 delete mode 100644 lib/ppc64/asm/time.h
 delete mode 100644 powerpc/Makefile.common
 delete mode 100644 powerpc/Makefile.ppc64
MAINTAINERS +0 -1
index b5562e99..00d7d90b 100644
@@ -92,7 +92,6 @@ S: Maintained
 L: [email protected]
 F: powerpc/
 F: lib/powerpc/
-F: lib/ppc64/
 
 RISCV
 M: Andrew Jones <[email protected]>
configure +2 -1
index aeb5570c..974ef4b4 100755
@@ -273,6 +273,7 @@ fi
 
 arch_name=$arch
 [ "$arch" = "aarch64" ] && arch="arm64"
+[ "$arch" = "powerpc" ] && arch="ppc64"
 [ "$arch_name" = "arm64" ] && arch_name="aarch64"
 
 if [ "$arch" = "riscv" ]; then
@@ -386,7 +387,7 @@ elif [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then
     fi
 elif [ "$arch" = "ppc64" ]; then
     testdir=powerpc
-    arch_libdir=ppc64
+    arch_libdir=powerpc
     firmware="$testdir/boot_rom.bin"
     if [ "$endian" != "little" ] && [ "$endian" != "big" ]; then
         echo "You must provide endianness (big or little)!"
lib/powerpc/asm-offsets.c renamed from lib/ppc64/asm-offsets.c +0 -0
similarity index 100%
rename from lib/ppc64/asm-offsets.c
rename to lib/powerpc/asm-offsets.c
lib/powerpc/asm/asm-offsets.h renamed from lib/ppc64/asm/asm-offsets.h +0 -0
similarity index 100%
rename from lib/ppc64/asm/asm-offsets.h
rename to lib/powerpc/asm/asm-offsets.h
lib/powerpc/asm/atomic.h renamed from lib/ppc64/asm/atomic.h +0 -0
similarity index 100%
rename from lib/ppc64/asm/atomic.h
rename to lib/powerpc/asm/atomic.h
lib/powerpc/asm/barrier.h renamed from lib/ppc64/asm/barrier.h +2 -2
similarity index 83%
rename from lib/ppc64/asm/barrier.h
rename to lib/powerpc/asm/barrier.h
index 475434b6..22349d69 100644
@@ -1,5 +1,5 @@
-#ifndef _ASMPPC64_BARRIER_H_
-#define _ASMPPC64_BARRIER_H_
+#ifndef _ASMPOWERPC_BARRIER_H_
+#define _ASMPOWERPC_BARRIER_H_
 
 #define cpu_relax() asm volatile("or 1,1,1 ; or 2,2,2" ::: "memory")
 #define pause_short() asm volatile(".long 0x7c40003c" ::: "memory")
lib/powerpc/asm/bitops.h renamed from lib/ppc64/asm/bitops.h +2 -2
similarity index 69%
rename from lib/ppc64/asm/bitops.h
rename to lib/powerpc/asm/bitops.h
index c93d64bb..dc1b8cd3 100644
@@ -1,5 +1,5 @@
-#ifndef _ASMPPC64_BITOPS_H_
-#define _ASMPPC64_BITOPS_H_
+#ifndef _ASMPOWERPC_BITOPS_H_
+#define _ASMPOWERPC_BITOPS_H_
 
 #ifndef _BITOPS_H_
 #error only <bitops.h> can be included directly
lib/powerpc/asm/io.h renamed from lib/ppc64/asm/io.h +2 -2
similarity index 50%
rename from lib/ppc64/asm/io.h
rename to lib/powerpc/asm/io.h
index 08d7297c..cfe099f0 100644
@@ -1,5 +1,5 @@
-#ifndef _ASMPPC64_IO_H_
-#define _ASMPPC64_IO_H_
+#ifndef _ASMPOWERPC_IO_H_
+#define _ASMPOWERPC_IO_H_
 
 #define __iomem
 
lib/powerpc/asm/mmu.h renamed from lib/ppc64/asm/mmu.h +0 -0
similarity index 100%
rename from lib/ppc64/asm/mmu.h
rename to lib/powerpc/asm/mmu.h
lib/powerpc/asm/opal.h renamed from lib/ppc64/asm/opal.h +2 -2
similarity index 90%
rename from lib/ppc64/asm/opal.h
rename to lib/powerpc/asm/opal.h
index 6c3e9ffe..44e62d80 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
-#ifndef _ASMPPC64_OPAL_H_
-#define _ASMPPC64_OPAL_H_
+#ifndef _ASMPOWERPC_OPAL_H_
+#define _ASMPOWERPC_OPAL_H_
 
 #include <stdint.h>
 
lib/powerpc/asm/page.h renamed from lib/ppc64/asm/page.h +3 -3
similarity index 94%
rename from lib/ppc64/asm/page.h
rename to lib/powerpc/asm/page.h
index 4a7ac9ec..21886c32 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef _ASMPPC64_PAGE_H_
-#define _ASMPPC64_PAGE_H_
+#ifndef _ASMPOWERPC_PAGE_H_
+#define _ASMPOWERPC_PAGE_H_
 /*
  * Adapted from
  *   lib/arm64/asm/page.h and Linux kernel defines.
@@ -62,4 +62,4 @@ extern unsigned long __phys_to_virt(phys_addr_t addr);
 extern void *__ioremap(phys_addr_t phys_addr, size_t size);
 
 #endif /* !__ASSEMBLER__ */
-#endif /* _ASMPPC64_PAGE_H_ */
+#endif /* _ASMPOWERPC_PAGE_H_ */
lib/powerpc/asm/pgtable-hwdef.h renamed from lib/ppc64/asm/pgtable-hwdef.h +3 -3
similarity index 93%
rename from lib/ppc64/asm/pgtable-hwdef.h
rename to lib/powerpc/asm/pgtable-hwdef.h
index 0f4b1068..3f8c6fe3 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef _ASMPPC64_PGTABLE_HWDEF_H_
-#define _ASMPPC64_PGTABLE_HWDEF_H_
+#ifndef _ASMPOWERPC_PGTABLE_HWDEF_H_
+#define _ASMPOWERPC_PGTABLE_HWDEF_H_
 /*
  * Copyright (C) 2024, IBM Inc, Nicholas Piggin <[email protected]>
  *
@@ -63,4 +63,4 @@
 #define PHYS_MASK_SHIFT		(48)
 #define PHYS_MASK		((UL(1) << PHYS_MASK_SHIFT) - 1)
 
-#endif /* _ASMPPC64_PGTABLE_HWDEF_H_ */
+#endif /* _ASMPOWERPC_PGTABLE_HWDEF_H_ */
lib/powerpc/asm/pgtable.h renamed from lib/ppc64/asm/pgtable.h +1 -1
similarity index 99%
rename from lib/ppc64/asm/pgtable.h
rename to lib/powerpc/asm/pgtable.h
index a6ee0d4c..d4f2c826 100644
@@ -122,4 +122,4 @@ static inline pte_t *pte_alloc(pmd_t *pmd, unsigned long addr)
 	return pte_offset(pmd, addr);
 }
 
-#endif /* _ASMPPC64_PGTABLE_H_ */
+#endif /* _ASMPOWERPC_PGTABLE_H_ */
lib/powerpc/asm/ptrace.h renamed from lib/ppc64/asm/ptrace.h +3 -3
similarity index 89%
rename from lib/ppc64/asm/ptrace.h
rename to lib/powerpc/asm/ptrace.h
index 133ad2f9..4d5fc59c 100644
@@ -1,5 +1,5 @@
-#ifndef _ASMPPC64_PTRACE_H_
-#define _ASMPPC64_PTRACE_H_
+#ifndef _ASMPOWERPC_PTRACE_H_
+#define _ASMPOWERPC_PTRACE_H_
 
 #define KERNEL_REDZONE_SIZE	288
 #define STACK_FRAME_OVERHEAD    112     /* size of minimum stack frame */
@@ -38,4 +38,4 @@ static inline void regs_advance_insn(struct pt_regs *regs)
 
 #endif /* __ASSEMBLER__ */
 
-#endif /* _ASMPPC64_PTRACE_H_ */
+#endif /* _ASMPOWERPC_PTRACE_H_ */
lib/powerpc/asm/spinlock.h new file +6 -0
new file mode 100644
index 00000000..da259ff4
@@ -0,0 +1,6 @@
+#ifndef _ASMPOWERPC_SPINLOCK_H_
+#define _ASMPOWERPC_SPINLOCK_H_
+
+#include <asm-generic/spinlock.h>
+
+#endif /* _ASMPOWERPC_SPINLOCK_H_ */
lib/powerpc/asm/stack.h +3 -0
index e1c46ee0..eea139a4 100644
@@ -5,4 +5,7 @@
 #error Do not directly include <asm/stack.h>. Just use <stack.h>.
 #endif
 
+#define HAVE_ARCH_BACKTRACE
+#define HAVE_ARCH_BACKTRACE_FRAME
+
 #endif
lib/powerpc/asm/vpa.h renamed from lib/ppc64/asm/vpa.h +0 -0
similarity index 100%
rename from lib/ppc64/asm/vpa.h
rename to lib/powerpc/asm/vpa.h
lib/powerpc/mmu.c renamed from lib/ppc64/mmu.c +0 -0
similarity index 100%
rename from lib/ppc64/mmu.c
rename to lib/powerpc/mmu.c
lib/powerpc/opal-calls.S renamed from lib/ppc64/opal-calls.S +0 -0
similarity index 100%
rename from lib/ppc64/opal-calls.S
rename to lib/powerpc/opal-calls.S
lib/powerpc/opal.c renamed from lib/ppc64/opal.c +0 -0
similarity index 100%
rename from lib/ppc64/opal.c
rename to lib/powerpc/opal.c
lib/powerpc/stack.c renamed from lib/ppc64/stack.c +0 -0
similarity index 100%
rename from lib/ppc64/stack.c
rename to lib/powerpc/stack.c
lib/ppc64/.gitignore deleted +0 -1
deleted file mode 100644
index 84872bf1..00000000
@@ -1 +0,0 @@
-asm-offsets.[hs]
lib/ppc64/asm/handlers.h deleted +0 -1
deleted file mode 100644
index 92e6fb24..00000000
@@ -1 +0,0 @@
-#include "../../powerpc/asm/handlers.h"
lib/ppc64/asm/hcall.h deleted +0 -1
deleted file mode 100644
index daabaca5..00000000
@@ -1 +0,0 @@
-#include "../../powerpc/asm/hcall.h"
lib/ppc64/asm/memory_areas.h deleted +0 -6
deleted file mode 100644
index b9fd46b9..00000000
@@ -1,6 +0,0 @@
-#ifndef _ASMPPC64_MEMORY_AREAS_H_
-#define _ASMPPC64_MEMORY_AREAS_H_
-
-#include <asm-generic/memory_areas.h>
-
-#endif
lib/ppc64/asm/ppc_asm.h deleted +0 -1
deleted file mode 100644
index e3929eee..00000000
@@ -1 +0,0 @@
-#include "../../powerpc/asm/ppc_asm.h"
lib/ppc64/asm/processor.h deleted +0 -1
deleted file mode 100644
index 066a51a0..00000000
@@ -1 +0,0 @@
-#include "../../powerpc/asm/processor.h"
lib/ppc64/asm/reg.h deleted +0 -1
deleted file mode 100644
index bc407b55..00000000
@@ -1 +0,0 @@
-#include "../../powerpc/asm/reg.h"
lib/ppc64/asm/rtas.h deleted +0 -1
deleted file mode 100644
index fe77f635..00000000
@@ -1 +0,0 @@
-#include "../../powerpc/asm/rtas.h"
lib/ppc64/asm/setup.h deleted +0 -1
deleted file mode 100644
index 20192985..00000000
@@ -1 +0,0 @@
-#include "../../powerpc/asm/setup.h"
lib/ppc64/asm/smp.h deleted +0 -1
deleted file mode 100644
index 67ced756..00000000
@@ -1 +0,0 @@
-#include "../../powerpc/asm/smp.h"
lib/ppc64/asm/spinlock.h deleted +0 -6
deleted file mode 100644
index f59eed19..00000000
@@ -1,6 +0,0 @@
-#ifndef _ASMPPC64_SPINLOCK_H_
-#define _ASMPPC64_SPINLOCK_H_
-
-#include <asm-generic/spinlock.h>
-
-#endif /* _ASMPPC64_SPINLOCK_H_ */
lib/ppc64/asm/stack.h deleted +0 -11
deleted file mode 100644
index 94fd1021..00000000
@@ -1,11 +0,0 @@
-#ifndef _ASMPPC64_STACK_H_
-#define _ASMPPC64_STACK_H_
-
-#ifndef _STACK_H_
-#error Do not directly include <asm/stack.h>. Just use <stack.h>.
-#endif
-
-#define HAVE_ARCH_BACKTRACE
-#define HAVE_ARCH_BACKTRACE_FRAME
-
-#endif
lib/ppc64/asm/time.h deleted +0 -1
deleted file mode 100644
index 326d2887..00000000
@@ -1 +0,0 @@
-#include "../../powerpc/asm/time.h"
powerpc/Makefile +110 -1

111 lines not on this page · raw message

powerpc/Makefile.common deleted +0 -95

95 lines not on this page · raw message

powerpc/Makefile.ppc64 deleted +0 -31
deleted file mode 100644
index 2466471f..00000000
@@ -1,31 +0,0 @@
-#
-# ppc64 makefile
-#
-# Authors: Andrew Jones <[email protected]>
-#
-bits = 64
-
-ifeq ($(ENDIAN),little)
-    arch_CFLAGS = -mlittle-endian
-    arch_LDFLAGS = -EL
-else
-    arch_CFLAGS = -mbig-endian
-    arch_LDFLAGS = -EB
-endif
-
-cstart.o = $(TEST_DIR)/cstart64.o
-reloc.o  = $(TEST_DIR)/reloc64.o
-
-OBJDIRS += lib/ppc64
-cflatobjs += lib/ppc64/stack.o
-cflatobjs += lib/ppc64/mmu.o
-cflatobjs += lib/ppc64/opal.o
-cflatobjs += lib/ppc64/opal-calls.o
-
-# ppc64 specific tests
-tests = $(TEST_DIR)/spapr_vpa.elf
-
-include $(SRCDIR)/$(TEST_DIR)/Makefile.common
-
-arch_clean: powerpc_clean
-	$(RM) lib/ppc64/.*.d
Signature · 1 line
2.53.0
#15 lore raw

RFC PATCH 4/6 powerpc: gitlab CI update

In reply to Chinmay Rath

From: Nicholas Piggin <[email protected]>

Change to using a gitlab-ci test group instead of specifying all tests in .gitlab-ci.yml, and adds a few additional tests (smp, atomics) that are known to work in CI.

To control overhead, ppc64be is used to test 64k page size, ppc64le is used to test 4k page size.

---
 .gitlab-ci.yml        | 53 ++++++++-----------------------------------
 powerpc/unittests.cfg | 36 ++++++++++++++++++++++-------
 2 files changed, 37 insertions(+), 52 deletions(-)
.gitlab-ci.yml +9 -44
index daccdfef..8608219d 100644
@@ -187,32 +187,15 @@ build-arm:
 build-ppc64be:
  extends: .outoftree_template
  script:
- - dnf install -y qemu-system-ppc gcc-powerpc64-linux-gnu nmap-ncat
+ - dnf install -y qemu-system-ppc gcc-powerpc64-linux-gnu
  - mkdir build
  - cd build
- - ../configure --arch=ppc64 --endian=big --cross-prefix=powerpc64-linux-gnu-
+ - ../configure --arch=ppc64 --endian=big --page-size=64k --cross-prefix=powerpc64-linux-gnu-
  - make -j2
- - ACCEL=tcg ./run_tests.sh
-      atomics
-      emulator
-      interrupts
-      mmu
-      rtas-get-time-of-day
-      rtas-get-time-of-day-base
-      rtas-set-time-of-day
-      selftest-migration
-      selftest-migration-skip
-      selftest-setup
-      sieve
-      smp
-      smp-smt
-      spapr_hcall
-      spapr_vpa
-      sprs
-      timebase
-      timebase-icount
-      | tee results.txt
- - if grep -q FAIL results.txt ; then exit 1 ; fi
+ - ACCEL=tcg MAX_SMP=8 ./run_tests.sh -g gitlab-ci
+   | tee results.txt
+ - grep -q PASS results.txt && ! grep -q FAIL results.txt
+
 
 build-ppc64le:
  extends: .intree_template
@@ -220,27 +203,9 @@ build-ppc64le:
  - dnf install -y qemu-system-ppc gcc-powerpc64-linux-gnu nmap-ncat
  - ./configure --arch=ppc64 --endian=little --cross-prefix=powerpc64-linux-gnu-
  - make -j2
- - ACCEL=tcg ./run_tests.sh
-      atomics
-      emulator
-      interrupts
-      mmu
-      rtas-get-time-of-day
-      rtas-get-time-of-day-base
-      rtas-set-time-of-day
-      selftest-migration
-      selftest-migration-skip
-      selftest-setup
-      sieve
-      smp
-      smp-smt
-      spapr_hcall
-      spapr_vpa
-      sprs
-      timebase
-      timebase-icount
-      | tee results.txt
- - if grep -q FAIL results.txt ; then exit 1 ; fi
+ - ACCEL=tcg MAX_SMP=8 ./run_tests.sh -g gitlab-ci
+   | tee results.txt
+ - grep -q PASS results.txt && ! grep -q FAIL results.txt
 
 build-riscv32:
  extends: .outoftree_template
powerpc/unittests.cfg +28 -8
index 60c73086..168af206 100644
@@ -17,17 +17,25 @@ file = selftest.elf
 smp = 2
 test_args = 'setup smp=2 mem=1024'
 qemu_params = -m 1g
-groups = selftest
+groups = selftest gitlab-ci
 
 [selftest-migration]
 file = selftest-migration.elf
 machine = pseries
 groups = selftest migration
 
+# make a kvm-only version for CI for now
+# TCG accel support with Qemu and distro release used in gitlab CI needs to checked.
+[selftest-migration-ci]
+file = selftest-migration.elf
+machine = pseries
+groups = nodefault selftest migration gitlab-ci
+accel = kvm
+
 [selftest-migration-skip]
 file = selftest-migration.elf
 machine = pseries
-groups = selftest migration
+groups = selftest migration gitlab-ci
 test_args = "skip"
 
 [migration-memory]
@@ -38,17 +46,19 @@ groups = migration
 [spapr_hcall]
 file = spapr_hcall.elf
 machine = pseries
+groups = gitlab-ci
 
 [spapr_vpa]
 file = spapr_vpa.elf
 machine = pseries
+groups = gitlab-ci
 
 [rtas-get-time-of-day]
 file = rtas.elf
 machine = pseries
 timeout = 5
 test_args = "get-time-of-day date=$(date +%s)"
-groups = rtas
+groups = rtas gitlab-ci
 
 [rtas-get-time-of-day-base]
 file = rtas.elf
@@ -56,35 +66,41 @@ machine = pseries
 timeout = 5
 test_args = "get-time-of-day date=$(date --date="2006-06-17 UTC" +%s)"
 qemu_params = -rtc base="2006-06-17"
-groups = rtas
+groups = rtas gitlab-ci
 
 [rtas-set-time-of-day]
 file = rtas.elf
 machine = pseries
 test_args = "set-time-of-day"
 timeout = 5
-groups = rtas
+groups = rtas gitlab-ci
 
 [emulator]
 file = emulator.elf
+groups = gitlab-ci
 
 [interrupts]
 file = interrupts.elf
+groups = gitlab-ci
 
 [mmu]
 file = mmu.elf
 smp = 2
+groups = gitlab-ci
 
 [pmu]
 file = pmu.elf
+groups = gitlab-ci
 
 [smp]
 file = smp.elf
 smp = 2
+groups = gitlab-ci
 
 [smp-smt]
 file = smp.elf
 smp = 8,threads=4
+groups = gitlab-ci
 
 # mttcg is the default most places, so add a thread=single test
 [smp-thread-single]
@@ -94,21 +110,23 @@ accel = tcg,thread=single
 
 [atomics]
 file = atomics.elf
-smp = 2
+groups = gitlab-ci
 
 [atomics-migration]
 file = atomics.elf
 machine = pseries
 test_args = "migration -m"
-groups = migration
+groups = migration gitlab-ci
 
 [timebase]
 file = timebase.elf
+groups = gitlab-ci
 
 [timebase-icount]
 file = timebase.elf
 accel = tcg
 qemu_params = -icount shift=5
+groups = gitlab-ci
 
 [h_cede_tm]
 file = tm.elf
@@ -121,12 +139,14 @@ groups = h_cede_tm
 
 [sprs]
 file = sprs.elf
+groups = gitlab-ci
 
 [sprs-migration]
 file = sprs.elf
 machine = pseries
 test_args = '-w'
-groups = migration
+groups = migration gitlab-ci
 
 [sieve]
 file = sieve.elf
+groups = gitlab-ci
Signature · 1 line
2.53.0
#16 lore raw

Re: [kvm-unit-tests RFC PATCH 4/6] powerpc: gitlab CI update

Quoted 9 lines · Chinmay Rath

From: Nicholas Piggin <[email protected]>

Change to using a gitlab-ci test group instead of specifying all tests in .gitlab-ci.yml, and adds a few additional tests (smp, atomics) that are known to work in CI.

To control overhead, ppc64be is used to test 64k page size, ppc64le is used to test 4k page size.

Quoted 6 lines
---
  .gitlab-ci.yml        | 53 ++++++++-----------------------------------
  powerpc/unittests.cfg | 36 ++++++++++++++++++++++-------
  2 files changed, 37 insertions(+), 52 deletions(-)

I don't like the idea of handling this differently for powerpc compared to the other architectures ... so please either also provide (separate) patches for the other architectures, too, or drop this patch.

Thanks
Thomas

#17 lore raw

Re: [kvm-unit-tests RFC PATCH 4/6] powerpc: gitlab CI update

Quoted 17 lines · Thomas Huth
Quoted 9 lines · Chinmay Rath

From: Nicholas Piggin <[email protected]>

Change to using a gitlab-ci test group instead of specifying all tests in .gitlab-ci.yml, and adds a few additional tests (smp, atomics) that are known to work in CI.

To control overhead, ppc64be is used to test 64k page size, ppc64le is used to test 4k page size.

Quoted 6 lines

---
  .gitlab-ci.yml        | 53 ++++++++----------------------------------- powerpc/unittests.cfg | 36 ++++++++++++++++++++++-------

  2 files changed, 37 insertions(+), 52 deletions(-)
Quoted 4 lines

I don't like the idea of handling this differently for powerpc compared to the other architectures ... so please either also provide (separate) patches for the other architectures, too, or drop this patch.

 Thanks
  Thomas

Noted. Thanks,
Chinmay

#18 lore raw

RFC PATCH 5/6 scripts/arch-run.bash: Fix run_panic() success exit status

In reply to Chinmay Rath

From: Nicholas Piggin <[email protected]>

run_qemu_status() looks for "EXIT: STATUS=%d" if the harness command returned 1, to determine the final status of the test. In the case of panic tests, QEMU should terminate before successful exit status is known, so the run_panic() command must produce the "EXIT: STATUS" line.

With this change, running a panic test returns 0 on success (panic), and the run_test.sh unit test correctly displays it as PASS rather than FAIL.

---
 scripts/arch-run.bash | 1 +
 1 file changed, 1 insertion(+)
scripts/arch-run.bash +1 -0
index 01cc1ff2..41a903e4 100644
@@ -313,6 +313,7 @@ run_panic ()
 	else
 		# some QEMU versions report multiple panic events
 		echo "PASS: guest panicked"
+		echo "EXIT: STATUS=1"
 		ret=1
 	fi
 
Signature · 1 line
2.53.0
#19 lore raw

RFC PATCH 6/6 powerpc: Add a panic test

In reply to Chinmay Rath

From: Nicholas Piggin <[email protected]>

This adds a simple panic test for pseries that works with TCG (unlike the s390x panic tests), making it easier to test this part of the harness code.

---
 lib/powerpc/asm/rtas.h |  1 +
 lib/powerpc/rtas.c     | 16 ++++++++++++++++
 powerpc/run            |  2 +-
 powerpc/selftest.c     | 17 ++++++++++++++++-
 powerpc/unittests.cfg  |  5 +++++
 5 files changed, 39 insertions(+), 2 deletions(-)
lib/powerpc/asm/rtas.h +1 -0
index 989b21bd..fdb3c544 100644
@@ -26,6 +26,7 @@ extern int rtas_call(int token, int nargs, int nret, int *outputs, ...);
 extern int rtas_call_unlocked(struct rtas_args *args, int token, int nargs, int nret, int *outputs, ...);
 
 extern void rtas_power_off(void);
+extern void rtas_os_panic(void);
 extern void rtas_stop_self(void);
 #endif /* __ASSEMBLER__ */
 
lib/powerpc/rtas.c +16 -0
index 9c1e0aff..98eee24f 100644
@@ -182,3 +182,19 @@ void rtas_power_off(void)
 	ret = rtas_call_unlocked(&args, token, 2, 1, NULL, -1, -1);
 	printf("RTAS power-off returned %d\n", ret);
 }
+
+void rtas_os_panic(void)
+{
+	struct rtas_args args;
+	uint32_t token;
+	int ret;
+
+	ret = rtas_token("ibm,os-term", &token);
+	if (ret) {
+		puts("RTAS ibm,os-term not available\n");
+		return;
+	}
+
+	ret = rtas_call_unlocked(&args, token, 1, 1, NULL, "rtas_os_panic");
+	printf("RTAS ibm,os-term returned %d\n", ret);
+}
powerpc/run +1 -1
index 06657764..718f08cb 100755
@@ -57,7 +57,7 @@ fi
 
 command="$qemu -nodefaults $A $M $B $D"
 command+=" -display none -serial stdio -kernel"
-command="$(migration_cmd) $(timeout_cmd) $command"
+command="$(panic_cmd) $(migration_cmd) $(timeout_cmd) $command"
 
 # powerpc tests currently exit with rtas-poweroff, which exits with 0.
 # run_test treats that as a failure exit and returns 1, so we need
powerpc/selftest.c +16 -1
index 8d1a2c76..f6f24d6a 100644
@@ -7,6 +7,7 @@
  */
 #include <libcflat.h>
 #include <util.h>
+#include <asm/rtas.h>
 #include <asm/setup.h>
 #include <asm/smp.h>
 
@@ -47,6 +48,17 @@ static void check_setup(int argc, char **argv)
 		report_abort("missing input");
 }
 
+static void do_panic(void)
+{
+	if (machine_is_pseries()) {
+		rtas_os_panic();
+	} else {
+		/* Cause a checkstop with MSR[ME] disabled */
+		*((char *)0x10000000000) = 0;
+	}
+	report_fail("survived panic");
+}
+
 int main(int argc, char **argv)
 {
 	report_prefix_push("selftest");
@@ -60,7 +72,10 @@ int main(int argc, char **argv)
 
 		check_setup(argc-2, &argv[2]);
 
+	} else if (strcmp(argv[1], "panic") == 0) {
+		do_panic();
+	} else {
+		report_abort("unknown test %s", argv[1]);
 	}
-
 	return report_summary();
 }
powerpc/unittests.cfg +5 -0
index 168af206..d1395464 100644
@@ -19,6 +19,11 @@ test_args = 'setup smp=2 mem=1024'
 qemu_params = -m 1g
 groups = selftest gitlab-ci
 
+[selftest-panic]
+file = selftest.elf
+extra_params = -append 'panic'
+groups = selftest panic gitlab-ci
+
 [selftest-migration]
 file = selftest-migration.elf
 machine = pseries
Signature · 1 line
2.53.0