From patchwork Tue Oct 15 03:06:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1176728 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (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 ozlabs.org (Postfix) with ESMTPS id 46sgT91rB4z9sPF for ; Tue, 15 Oct 2019 14:12:13 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="BB8xhpoh"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46sgT90tRVzDqWw for ; Tue, 15 Oct 2019 14:12:13 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::530; helo=mail-pg1-x530.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="BB8xhpoh"; dkim-atps=neutral Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) (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 46sgSy75m9zDqx1 for ; Tue, 15 Oct 2019 14:12:01 +1100 (AEDT) Received: by mail-pg1-x530.google.com with SMTP id r1so10020368pgj.12 for ; Mon, 14 Oct 2019 20:12:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=1bdD+tHW3vKLpx/LuPDQiZVCycIc8HhhFIFRmhDrh2I=; b=BB8xhpohWj6pXjFjL3TjY8QakVHTMZ5oOOGM1G60yH1FS9cmZu2n9zbsjSHyyY9pyq Iw+q6Eaib26a3lR5tTPJ988ew+Rit6oFQxjl8ufE0bZn7GWIHyz4Tn/3OV4vjo3vLseO V5n3SbtXHyHCqQEyAFCVch3l42mhWp5FSq+1fhYXRqZUEPo0gaRHBoD5NgPxSisI98RY TdqkZZOEZ2PcWuPQV3G0FdUyrl+AJHpiobAIQ/Uey0SsGBcPv0Kj27pt/phmOJLxDI5T FD/RqomO3hDpg4U4EKlNMUrRZGM7kLPWR0ywZGQvzSuVCQUnklc9P1eQTa6xxTOoS8En ykRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=1bdD+tHW3vKLpx/LuPDQiZVCycIc8HhhFIFRmhDrh2I=; b=YhKI5pWekisXWMul6BI0yrs9Kn+U7EkyZhLTaP6C0Yk/fY2tLLdLw41NkFIfREwXnV rf3mBXXoalCAr7kG9xIGAH94FCqQlbHWqWzJEXIq0ZCg1WSFR/kSzqpUTS+YnSHN+0jN QgIXreGRfLzSP90cB1v0Yd0vI2rt2rDyY4z5veewhrOSecwbHqV+5bVg1A21BLQ2h298 TYMGi0VZJyWuBX3lvjGLRhGe/Alke0SUYqy5WOGEa2uy84I2uy6+z0kr+MnIeXZbRYji lUgxQjqUJP1aHkYC7b60wKCS7uUkKkG1noLjXyuJYiJ8um3bHuZ2np/P3wdtFNSxee7G AF4A== X-Gm-Message-State: APjAAAVbVgKJYbiKk6mZohFnkP9Jl/i30W3/TRs8kNsRkF8mERkWG5MK XvFtfJR0rzUucCAcAe4XAJXPsigzlh8= X-Google-Smtp-Source: APXvYqypdwmqwC6EsSMDgIbhIlkTAae6qZhF2VTAURy0hsEY2+JOVD7gdHK53FeBDRj0XNvBEUx+eA== X-Received: by 2002:a62:68c1:: with SMTP id d184mr36359161pfc.195.1571109118162; Mon, 14 Oct 2019 20:11:58 -0700 (PDT) Received: from bobo.local0.net (60-240-111-58.tpgi.com.au. [60.240.111.58]) by smtp.gmail.com with ESMTPSA id w6sm23089828pfw.84.2019.10.14.20.11.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 20:11:57 -0700 (PDT) From: Nicholas Piggin To: skiboot@lists.ozlabs.org Date: Tue, 15 Oct 2019 13:06:50 +1000 Message-Id: <20191015030717.15637-1-npiggin@gmail.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Subject: [Skiboot] [PATCH v5 00/27] little endian skiboot 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" A few reasons for this: - The rest of the software is moving (moved) to LE. BE is still supported, but the fact is LE will be better tested from now on in terms of toolchain. - ELFv2 ABI is a smaller image, nicer asm code. We can use ELFv2 with BE but toolchain won't officially support or test it. - Some levels of OpenPOWER ISA allow a conforming implementation to implement LE only. - Less stack usage of ELFv2 facilitates OPAL call convention that uses the host kernel stack (which is a whole different story but has benefits). - Common endian with the host kernel can help with debugging skiboot with host kernel facilities (like BUG, xmon). We could achieve the same by teaching kernel about different endianness, but it's more work. Notably missing from conversion: - PHB3 - NPU and CAPI code - Debug descriptor XICS, XICS-on-XIVE, KVM, VAS, and niche features have not been tested yet, but at this point it's complete enough that it's easy to work on and improve so I think it is ready for proper submission now. For the most part, big endian builds should be minimally impacted. Since v1: - Addressed review comments - Added a missed endian conversion in hw/fsp/fsp.c - Added a patch on the end to tidy up dt access - xive patch is not for merge, (pending Cedric's stuff) but included so the series can boot on real hardware. Since v2: - Remove a few bits of dead POWER7 code Since v3: - Several fixes to cvc code, including a stack trashing bug that would sometimes result in skiboots that failed container verification, depending on where the compiler put things. Since v4: - Converted several more pieces, ELF kernel loading (so LE skiboot can load BE kernel), HMI, IPMI, SBE, MPIPL, FSP, ECC, PRD, etc. - Paid more attention to sparse warnings, folded in some fixes found by sparse, added some larger sparse cleanup patches. - Sparse warnings have gone from 406 to 126 after this series, incorrect type warnings from 296 to 66, and those all come from PHB3 and one HB source file. Thanks, Nick Nicholas Piggin (27): asm/cvc_entry.S: r2 save fix Remove dead POWER7 code capp: fix endian conversion cpu: use dt accessor device tree access opal-api: add endian conversions to most opal calls elf: endian conversions spira: fix endian conversions in spira data structures hdata: endian conversions naca: move naca definition from asm to C io: endian conversions for io accessors hmi: endian conversions cvc: allow BE cvc code to be called from LE context xive: make endian-clean phb4: make endian-clean occ sensors: make endian-clean memconsole: make endian-clean ipmi: endian conversion sbe-p9: endian conversion fsp: endian conversions libflash: ecc endian conversions prd: endian conversions opal-dump: MPIPL endan conversions sfc-ctrl: endian conversions add little endian support dt: assorted cleanups Add more sparse endian annotations Fix simple sparse warnings Makefile.main | 38 ++- asm/asm-offsets.c | 2 - asm/cvc_entry.S | 51 ++- asm/head.S | 126 +++----- core/console.c | 41 ++- core/cpu.c | 26 +- core/device.c | 25 +- core/fdt.c | 6 +- core/flash.c | 36 ++- core/hmi.c | 20 +- core/init.c | 97 +++--- core/interrupts.c | 15 +- core/ipmi-opal.c | 6 +- core/mem_region.c | 2 +- core/opal-dump.c | 80 ++--- core/pci-opal.c | 98 ++++-- core/pci.c | 40 +-- core/platform.c | 2 +- core/powercap.c | 14 +- core/psr.c | 14 +- core/sensor.c | 60 ++-- core/trace.c | 3 +- doc/stb.rst | 2 +- hdata/Makefile.inc | 2 +- hdata/fsp.c | 9 +- hdata/hdata.h | 2 + hdata/iohub.c | 21 +- hdata/memory.c | 18 +- hdata/naca.c | 26 ++ hdata/naca.h | 54 ++++ hdata/paca.c | 82 +---- hdata/spira.c | 74 +++-- hdata/spira.h | 2 + hdata/tpmrel.c | 2 +- hw/ast-bmc/ast-sf-ctrl.c | 5 +- hw/capp.c | 2 +- hw/fake-rtc.c | 11 +- hw/fsp/fsp-codeupdate.c | 4 +- hw/fsp/fsp-codeupdate.h | 86 ++--- hw/fsp/fsp-console.c | 26 +- hw/fsp/fsp-dpo.c | 2 +- hw/fsp/fsp-rtc.c | 25 +- hw/fsp/fsp-sysdump.c | 2 +- hw/fsp/fsp-sysparam.c | 6 +- hw/fsp/fsp.c | 18 +- hw/imc.c | 12 +- hw/ipmi/ipmi-rtc.c | 11 +- hw/ipmi/ipmi-sel.c | 2 +- hw/lpc-rtc.c | 11 +- hw/lpc-uart.c | 16 +- hw/lpc.c | 6 +- hw/npu2-opencapi.c | 12 +- hw/occ-sensor.c | 100 +++--- hw/occ.c | 46 +-- hw/phb4.c | 344 ++++++++++---------- hw/prd.c | 74 ++--- hw/psi.c | 10 +- hw/sbe-p9.c | 2 +- hw/sfc-ctrl.c | 19 +- hw/slw.c | 10 +- hw/vas.c | 8 +- hw/xive.c | 392 ++++++++++++----------- hw/xscom.c | 19 +- include/asm-utils.h | 22 +- include/console.h | 22 +- include/cpu.h | 3 + include/device.h | 4 +- include/elf.h | 235 ++++++++++---- include/io.h | 79 ++++- include/ipmi.h | 2 +- include/mem-map.h | 2 + include/occ.h | 50 +-- include/opal-api.h | 14 +- include/opal-internal.h | 4 +- include/phb4.h | 2 +- include/skiboot.h | 2 +- include/stack.h | 6 + include/types.h | 4 + include/xive.h | 52 +-- libc/stdlib/labs.c | 2 +- libflash/ecc.c | 36 ++- libflash/ecc.h | 8 +- libflash/ipmi-hiomap.c | 20 +- libflash/mbox-flash.c | 28 +- libpore/p9_cpu_reg_restore_instruction.H | 23 +- libstb/cvc.c | 16 +- libstb/cvc.h | 2 +- libstb/secureboot.c | 2 +- platforms/astbmc/common.c | 4 +- platforms/astbmc/p8dtu.c | 2 +- platforms/astbmc/p9dsu.c | 2 +- platforms/astbmc/vesnin.c | 8 +- platforms/astbmc/witherspoon.c | 6 +- platforms/ibm-fsp/common.c | 4 +- platforms/ibm-fsp/hostservices.c | 12 +- platforms/mambo/mambo.c | 9 +- skiboot.lds.S | 5 + 97 files changed, 1753 insertions(+), 1316 deletions(-) create mode 100644 hdata/naca.c create mode 100644 hdata/naca.h