From patchwork Wed Oct 9 23:49:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1174199 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46pWJD15L4z9sCJ for ; Thu, 10 Oct 2019 10:53:32 +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="aqV1n+gb"; 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 46pWJ94zTSzDqZB for ; Thu, 10 Oct 2019 10:53:29 +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::535; helo=mail-pg1-x535.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="aqV1n+gb"; dkim-atps=neutral Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) (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 46pWHd1ns9zDqY5 for ; Thu, 10 Oct 2019 10:52:58 +1100 (AEDT) Received: by mail-pg1-x535.google.com with SMTP id d26so2442393pgl.7 for ; Wed, 09 Oct 2019 16:52:58 -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=n5a3Dp9w+OlZAVgTWxQsM1bTkkvawYYFPgnjK4hpPcE=; b=aqV1n+gbISybxzvk7JEa8ZUFFSonYmLK11K7mesG+V0YVbJ6VrlQ82D8LOZ9EsVhNs BdUsoun5quOaEsOBCrcpoIkRjBbDVB7DzhsbI9djcwsl4BarsD/mNnMTL/FX0CO1f7sL RyjhX4pzvSvGc1q23CBmsTckSws806LpIi0E8shABrJjQAWvYIPAEB7AHxSGHjLQjzWP 1pSG5pdI5WfhhWxZOgY5LYqKtb1rGQeObNkmXfCMb/JRnjYXM+5A2T+v1OdoXcDZW3wK 9D2xuldF2VezSKo12b/9pZI+jxBQJ5yDMEyihRlXyoVrb9CVHLK21KBZDqNnjV9T5aHn Meew== 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=n5a3Dp9w+OlZAVgTWxQsM1bTkkvawYYFPgnjK4hpPcE=; b=JmpFfPqArePT6GCrhCRwre1ANems7c0x/nP6nCl5GZyPF2sHneSt0IZZc1bKDG6t1U HJImup6M9pnoJEnsTko0I246KZR3gOjZWAASv88wh8CbCW6yq8X4vI9z7EfGblMXsjSJ D8HKpw/vyNwAUoFfPNVIxUNv32kpXKnqwHNz5inVkWNWrNjbgQkiSu1NRpWxT6ydy7cy 1iI1R8h9jPSgIRMVMBZaj33l3fB0Ge0j5+TPfiPH0RgL5CzoA4i6lbDDz+Lt5XTqzzee BErrKsfjc8iID+aEbJ+BFMIXMr+0cjAEomQS8BUzYRJIeMlPye1NW0+ssOHSdnvU5Ru5 y2EA== X-Gm-Message-State: APjAAAUYgkJiVY+dcg0FQKo1Ewxw+vsY1L1I7aXM13IDxJwDoSQI6vum mNXL/YmJZ9g5djeeV6tUji9+nwmd X-Google-Smtp-Source: APXvYqy/H7pnK7sb9dJ9YsfyEE/xnjjJK0C7H7KhHDTOtKumc+npcU1RcmTmA29qDoLhdmxNaV1Rjg== X-Received: by 2002:a65:614e:: with SMTP id o14mr7109039pgv.237.1570665171588; Wed, 09 Oct 2019 16:52:51 -0700 (PDT) Received: from bobo.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id y144sm4015675pfb.188.2019.10.09.16.52.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2019 16:52:50 -0700 (PDT) From: Nicholas Piggin To: skiboot@lists.ozlabs.org Date: Thu, 10 Oct 2019 09:49:36 +1000 Message-Id: <20191009234951.2850-1-npiggin@gmail.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Subject: [Skiboot] [PATCH v4 00/15] 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. Mostly missing from conversion: - PHB3 - NPU and CAPI code 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. 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. Nicholas Piggin (15): 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 spira: fix endian conversions in spira data structures fixup_spira remove incorrect endian conversion naca: move naca definition from asm to C io: endian conversions for io accessors xive: make endian-clean phb4: make endian-clean occ sensors: make endian-clean memconsole: make endian-clean add little endian support dt: assorted cleanups 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 | 8 + core/fdt.c | 4 +- core/init.c | 1 + core/interrupts.c | 12 +- core/ipmi-opal.c | 6 +- core/pci-opal.c | 98 ++++-- core/pci.c | 36 +-- core/powercap.c | 14 +- core/psr.c | 14 +- core/sensor.c | 36 ++- doc/stb.rst | 2 +- hdata/Makefile.inc | 2 +- hdata/fsp.c | 7 +- hdata/hdata.h | 2 + hdata/iohub.c | 21 +- hdata/memory.c | 10 +- hdata/naca.c | 26 ++ hdata/naca.h | 54 ++++ hdata/paca.c | 82 +---- hdata/spira.c | 68 ++-- hdata/spira.h | 2 + hw/capp.c | 2 +- hw/fake-rtc.c | 11 +- hw/fsp/fsp-console.c | 26 +- hw/fsp/fsp-rtc.c | 26 +- hw/fsp/fsp-sysparam.c | 4 +- hw/fsp/fsp.c | 2 +- hw/imc.c | 4 +- hw/ipmi/ipmi-rtc.c | 12 +- hw/lpc-rtc.c | 12 +- hw/lpc-uart.c | 16 +- hw/lpc.c | 6 +- hw/npu2-opencapi.c | 12 +- hw/occ-sensor.c | 100 +++--- hw/occ.c | 24 +- hw/phb4.c | 323 +++++++++---------- hw/psi.c | 8 +- hw/vas.c | 9 +- hw/xive.c | 386 ++++++++++++----------- hw/xscom.c | 19 +- include/asm-utils.h | 22 +- include/console.h | 22 +- include/cpu.h | 3 + include/device.h | 1 + include/elf.h | 4 + include/io.h | 72 ++++- include/mem-map.h | 2 + include/occ.h | 50 +-- include/phb4.h | 2 +- include/stack.h | 6 + include/xive.h | 50 +-- libflash/ipmi-hiomap.c | 18 +- libflash/mbox-flash.c | 18 +- libpore/p9_cpu_reg_restore_instruction.H | 23 +- libstb/cvc.c | 16 +- libstb/cvc.h | 2 +- platforms/ibm-fsp/common.c | 4 +- platforms/ibm-fsp/hostservices.c | 12 +- platforms/mambo/mambo.c | 7 +- skiboot.lds.S | 5 + 66 files changed, 1217 insertions(+), 913 deletions(-) create mode 100644 hdata/naca.c create mode 100644 hdata/naca.h