diff mbox series

[2/7] Add CONFIG_P8 with phb3 behind it

Message ID 20210125005807.3019715-4-stewart@flamingspork.com
State Under Review
Headers show
Series Modularize hardware probing | expand

Commit Message

Stewart Smith Jan. 25, 2021, 12:58 a.m. UTC
We can use a base CPU of POWER9 if we don't have P8.
We can also hide PHB3 code behind this,
and shave 12kb off skiboot.lid.xz

Signed-off-by: Stewart Smith <stewart@flamingspork.com>
---
 Makefile        |  2 ++
 Makefile.main   | 11 ++++++++++-
 hw/Makefile.inc |  8 ++++++--
 3 files changed, 18 insertions(+), 3 deletions(-)

Comments

Nicholas Piggin Feb. 2, 2021, 8:15 a.m. UTC | #1
Excerpts from Stewart Smith's message of January 25, 2021 10:58 am:
> We can use a base CPU of POWER9 if we don't have P8.
> We can also hide PHB3 code behind this,
> and shave 12kb off skiboot.lid.xz

Reviewed-by: Nicholas Piggin <npiggin@gmail.com>

> 
> Signed-off-by: Stewart Smith <stewart@flamingspork.com>
> ---
>  Makefile        |  2 ++
>  Makefile.main   | 11 ++++++++++-
>  hw/Makefile.inc |  8 ++++++--
>  3 files changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index d236df9e..625f212e 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -59,6 +59,8 @@ ELF_ABI_v2 ?= $(LITTLE_ENDIAN)
>  DEAD_CODE_ELIMINATION ?= 0
>  # Try to build without FSP code
>  CONFIG_FSP?=1
> +# Try to build without POWER8 support
> +CONFIG_P8?=1
>  
>  #
>  # Where is the source directory, must be a full path (no ~)
> diff --git a/Makefile.main b/Makefile.main
> index c429bf1d..3e84ddba 100644
> --- a/Makefile.main
> +++ b/Makefile.main
> @@ -99,7 +99,11 @@ CPPFLAGS += -DDEBUG -DCCAN_LIST_DEBUG
>  endif
>  
>  CFLAGS := -fno-strict-aliasing -pie -fpie -fno-pic -m64 -fno-asynchronous-unwind-tables
> +ifeq ($(CONFIG_P8),1)
>  CFLAGS += -mcpu=power8
> +else
> +CFLAGS += -mcpu=power9
> +endif
>  CFLAGS += -Wl,--oformat,elf64-powerpc -ggdb
>  # r13,r14,r15 are preserved for OS to use as fixed registers.
>  # These could be saved and restored in and out of skiboot, but it's more
> @@ -174,7 +178,12 @@ LDFLAGS := -m64 -static -nostdlib -pie
>  LDFLAGS += -Wl,-pie
>  LDFLAGS += -Wl,-Ttext-segment,$(LD_TEXT) -Wl,-N -Wl,--build-id=none
>  LDFLAGS += -Wl,--no-multi-toc
> -LDFLAGS += -mcpu=power8 -Wl,--oformat,elf64-powerpc
> +ifeq ($(CONFIG_P8),1)
> +LDFLAGS += -mcpu=power8
> +else
> +LDFLAGS += -mcpu=power9
> +endif
> +LDFLAGS += -Wl,--oformat,elf64-powerpc
>  LDFLAGS_FINAL = -m elf64lppc --no-multi-toc -N --build-id=none --whole-archive
>  LDFLAGS_FINAL += -static -nostdlib -pie -Ttext-segment=$(LD_TEXT) --oformat=elf64-powerpc
>  LDFLAGS_FINAL += --orphan-handling=warn
> diff --git a/hw/Makefile.inc b/hw/Makefile.inc
> index a7f450cf..1f042c23 100644
> --- a/hw/Makefile.inc
> +++ b/hw/Makefile.inc
> @@ -3,13 +3,17 @@ SUBDIRS += hw
>  HW_OBJS  = xscom.o chiptod.o lpc.o lpc-uart.o psi.o
>  HW_OBJS += homer.o slw.o occ.o fsi-master.o centaur.o imc.o
>  HW_OBJS += nx.o nx-rng.o nx-crypto.o nx-compress.o nx-842.o nx-gzip.o
> -HW_OBJS += phb3.o sfc-ctrl.o fake-rtc.o bt.o p8-i2c.o prd.o
> -HW_OBJS += dts.o lpc-rtc.o npu.o npu-hw-procedures.o xive.o phb4.o
> +HW_OBJS += sfc-ctrl.o fake-rtc.o bt.o p8-i2c.o prd.o
> +HW_OBJS += dts.o lpc-rtc.o xive.o phb4.o
>  HW_OBJS += fake-nvram.o lpc-mbox.o npu2.o npu2-hw-procedures.o
>  HW_OBJS += npu2-common.o npu2-opencapi.o phys-map.o sbe-p9.o capp.o
>  HW_OBJS += occ-sensor.o vas.o sbe-p8.o dio-p9.o lpc-port80h.o cache-p9.o
>  HW_OBJS += npu-opal.o npu3.o npu3-nvlink.o npu3-hw-procedures.o
>  HW_OBJS += ocmb.o

Looks like a bit more p8 stuff to go, I assume that's coming in later 
patches and/or too hard to rip out or used by p9 as well.

> +HW_OBJS += npu.o npu-hw-procedures.o
> +ifeq ($(CONFIG_P8),1)
> +HW_OBJS += phb3.o
> +endif
>  HW=hw/built-in.a
>  
>  include $(SRC)/hw/fsp/Makefile.inc
> -- 
> 2.29.2
> 
> _______________________________________________
> Skiboot mailing list
> Skiboot@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot
>
Stewart Smith Feb. 3, 2021, 3:51 p.m. UTC | #2
On Tue, Feb 2, 2021, at 12:15 AM, Nicholas Piggin wrote: 
> Looks like a bit more p8 stuff to go, I assume that's coming in later 
> patches and/or too hard to rip out or used by p9 as well.

Yep. I just started with the chunks that were easy until I had to go do something else on a Sunday (the best algorithm for deciding when to send a patchset!).

There's a lot of thing behind switch and if statements too, which would necessitate an actual config.h and not just doing everything at link time.
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index d236df9e..625f212e 100644
--- a/Makefile
+++ b/Makefile
@@ -59,6 +59,8 @@  ELF_ABI_v2 ?= $(LITTLE_ENDIAN)
 DEAD_CODE_ELIMINATION ?= 0
 # Try to build without FSP code
 CONFIG_FSP?=1
+# Try to build without POWER8 support
+CONFIG_P8?=1
 
 #
 # Where is the source directory, must be a full path (no ~)
diff --git a/Makefile.main b/Makefile.main
index c429bf1d..3e84ddba 100644
--- a/Makefile.main
+++ b/Makefile.main
@@ -99,7 +99,11 @@  CPPFLAGS += -DDEBUG -DCCAN_LIST_DEBUG
 endif
 
 CFLAGS := -fno-strict-aliasing -pie -fpie -fno-pic -m64 -fno-asynchronous-unwind-tables
+ifeq ($(CONFIG_P8),1)
 CFLAGS += -mcpu=power8
+else
+CFLAGS += -mcpu=power9
+endif
 CFLAGS += -Wl,--oformat,elf64-powerpc -ggdb
 # r13,r14,r15 are preserved for OS to use as fixed registers.
 # These could be saved and restored in and out of skiboot, but it's more
@@ -174,7 +178,12 @@  LDFLAGS := -m64 -static -nostdlib -pie
 LDFLAGS += -Wl,-pie
 LDFLAGS += -Wl,-Ttext-segment,$(LD_TEXT) -Wl,-N -Wl,--build-id=none
 LDFLAGS += -Wl,--no-multi-toc
-LDFLAGS += -mcpu=power8 -Wl,--oformat,elf64-powerpc
+ifeq ($(CONFIG_P8),1)
+LDFLAGS += -mcpu=power8
+else
+LDFLAGS += -mcpu=power9
+endif
+LDFLAGS += -Wl,--oformat,elf64-powerpc
 LDFLAGS_FINAL = -m elf64lppc --no-multi-toc -N --build-id=none --whole-archive
 LDFLAGS_FINAL += -static -nostdlib -pie -Ttext-segment=$(LD_TEXT) --oformat=elf64-powerpc
 LDFLAGS_FINAL += --orphan-handling=warn
diff --git a/hw/Makefile.inc b/hw/Makefile.inc
index a7f450cf..1f042c23 100644
--- a/hw/Makefile.inc
+++ b/hw/Makefile.inc
@@ -3,13 +3,17 @@  SUBDIRS += hw
 HW_OBJS  = xscom.o chiptod.o lpc.o lpc-uart.o psi.o
 HW_OBJS += homer.o slw.o occ.o fsi-master.o centaur.o imc.o
 HW_OBJS += nx.o nx-rng.o nx-crypto.o nx-compress.o nx-842.o nx-gzip.o
-HW_OBJS += phb3.o sfc-ctrl.o fake-rtc.o bt.o p8-i2c.o prd.o
-HW_OBJS += dts.o lpc-rtc.o npu.o npu-hw-procedures.o xive.o phb4.o
+HW_OBJS += sfc-ctrl.o fake-rtc.o bt.o p8-i2c.o prd.o
+HW_OBJS += dts.o lpc-rtc.o xive.o phb4.o
 HW_OBJS += fake-nvram.o lpc-mbox.o npu2.o npu2-hw-procedures.o
 HW_OBJS += npu2-common.o npu2-opencapi.o phys-map.o sbe-p9.o capp.o
 HW_OBJS += occ-sensor.o vas.o sbe-p8.o dio-p9.o lpc-port80h.o cache-p9.o
 HW_OBJS += npu-opal.o npu3.o npu3-nvlink.o npu3-hw-procedures.o
 HW_OBJS += ocmb.o
+HW_OBJS += npu.o npu-hw-procedures.o
+ifeq ($(CONFIG_P8),1)
+HW_OBJS += phb3.o
+endif
 HW=hw/built-in.a
 
 include $(SRC)/hw/fsp/Makefile.inc