From patchwork Mon Dec 20 12:22:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1571012 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=HTMsSfU6; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JHdzP43KKz9s3q for ; Mon, 20 Dec 2021 23:23:29 +1100 (AEDT) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4JHdzP3Lcpz305W for ; Mon, 20 Dec 2021 23:23:29 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=HTMsSfU6; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::629; helo=mail-pl1-x629.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=HTMsSfU6; dkim-atps=neutral Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4JHdz41mwPz2ymg for ; Mon, 20 Dec 2021 23:23:12 +1100 (AEDT) Received: by mail-pl1-x629.google.com with SMTP id z6so7961125plk.6 for ; Mon, 20 Dec 2021 04:23:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pmkLKaONKy/HV+DBDsMMDwv2fCAgDrrjDs+XeBgNlYw=; b=HTMsSfU6M+zVHFKeNnkiJtzAd9LWnN64tg4fvb+Ul3ZHmxQDc+5CSFAQSSSSG7Ri6f 4qIOjwDbh6spR5BJhQTT5e/jsMLcZViYYXDk9q0RY4O+7azpuKcml6DEJn3iDDjJi8v6 NZN5NPbHofMmyYNHLOtnEs4onDhcPai3vFf3UcTr/b1AAUodRbMvE2lLlEXLticaifja 3mNkkpt/QP+AYdU1T35yz6BJNVEXl7MeLe4hLtayDN11KkJdYWh91wLbVGr8sFXUWpPR UXRijyFW8CuvixSF7RBN6+U801zJWzKDmjqTz1huVyr5bzdw5k74W+++DK24DyaaCvuU +YKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pmkLKaONKy/HV+DBDsMMDwv2fCAgDrrjDs+XeBgNlYw=; b=IOHqJlHxJZFAwxesyNOwsYVPFZmRUoXZCuNWb3egVFWkunBnvC8oZdrfuX9/j35S+z 9d0R/cb37kvxRSZuvqxNgj7WycOf+Vrh+uVXyaR32UKcqgWRIqS3X24flMJuEIKSX8ng rZQB0znqW52cdgp8BHeNqoERljfnK5FgEOWT0ZXr8jakPbbLuDLXmYbuo/1CqDen18Qi EEhA2gmZ45zXb6mQkEd03AgvImf5n8u8T77EJNr42Z03lT84IggahzpxRfgoN98UTV6K IVBJH16Mq5sCiq7iazwoRLpoJyo30hoQ24N/qO27B3bBo7xS/n2wun/9HLDpuv4wHea9 gEow== X-Gm-Message-State: AOAM530V+a6Lf5D+azNhQ85tE07ugz6jJJE7n7IPAgp+lL0Dj+snweSd oCQhQHiD+mb+eXG3urPtZGYFVWL4eUw= X-Google-Smtp-Source: ABdhPJzyChnM/hU+OVILvQ5xiGSo89YdsrrQDuveMia7DAZcoJsXX/ax4s25yrzwh0SztrudF7JZ9Q== X-Received: by 2002:a17:902:d682:b0:148:c928:1fa1 with SMTP id v2-20020a170902d68200b00148c9281fa1mr16741175ply.155.1640002990086; Mon, 20 Dec 2021 04:23:10 -0800 (PST) Received: from bobo.ozlabs.ibm.com (121-44-67-22.tpgi.com.au. [121.44.67.22]) by smtp.gmail.com with ESMTPSA id p17sm20661731pfh.86.2021.12.20.04.23.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Dec 2021 04:23:09 -0800 (PST) From: Nicholas Piggin To: skiboot@lists.ozlabs.org Date: Mon, 20 Dec 2021 22:22:46 +1000 Message-Id: <20211220122252.986542-4-npiggin@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20211220122252.986542-1-npiggin@gmail.com> References: <20211220122252.986542-1-npiggin@gmail.com> MIME-Version: 1.0 Subject: [Skiboot] [PATCH v5 3/9] Add CONFIG_P8 with PHB3 behind it X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" From: Stewart Smith 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: Dan HorĂ¡k [npiggin: add cpp define, fail gracefully on P8] Signed-off-by: Stewart Smith --- Makefile | 2 ++ Makefile.main | 15 ++++++++++++++- core/cpu.c | 11 +++++++++-- hw/Makefile.inc | 5 ++++- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index d236df9ec..625f212ea 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 c8a63e8b1..2a346a6c9 100644 --- a/Makefile.main +++ b/Makefile.main @@ -96,7 +96,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 @@ -156,6 +160,10 @@ else CFLAGS += -fno-stack-protector endif +# Add preprocessor defines for CONFIG_ options here +ifeq ($(CONFIG_P8),1) +CFLAGS += -DCONFIG_P8=1 +endif CFLAGS += $(call try-cflag,$(CC),-Wjump-misses-init) \ $(call try-cflag,$(CC),-Wsuggest-attribute=const) \ @@ -173,7 +181,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/core/cpu.c b/core/cpu.c index 6756ab164..f0be58059 100644 --- a/core/cpu.c +++ b/core/cpu.c @@ -1066,9 +1066,16 @@ void init_boot_cpu(void) cpu_thread_count = 1; } - if (proc_gen == proc_gen_p8 && (PVR_VERS_MAJ(mfspr(SPR_PVR)) == 1)) { - prerror("CPU: POWER8 DD1 is not supported\n"); + if (proc_gen == proc_gen_p8) { +#ifdef CONFIG_P8 + if (PVR_VERS_MAJ(mfspr(SPR_PVR)) == 1) { + prerror("CPU: POWER8 DD1 is not supported\n"); + abort(); + } +#else + prerror("CPU: POWER8 detected but CONFIG_P8 not set\n"); abort(); +#endif } if (is_power9n(pvr) && (PVR_VERS_MAJ(pvr) == 1)) { diff --git a/hw/Makefile.inc b/hw/Makefile.inc index 9fcbb63be..e273e898c 100644 --- a/hw/Makefile.inc +++ b/hw/Makefile.inc @@ -3,12 +3,15 @@ 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 += 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 += 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 ocmb.o xive2.o pau.o pau-hw-procedures.o +ifeq ($(CONFIG_P8),1) +HW_OBJS += phb3.o +endif HW=hw/built-in.a include $(SRC)/hw/fsp/Makefile.inc