From patchwork Thu May 31 04:29:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 923153 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.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40xDyx2f0tz9s1B for ; Thu, 31 May 2018 14:30:17 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="UlTMDGXJ"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40xDyx152QzDrYj for ; Thu, 31 May 2018 14:30:17 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="UlTMDGXJ"; dkim-atps=neutral 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:400e:c01::243; helo=mail-pl0-x243.google.com; envelope-from=joel.stan@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="UlTMDGXJ"; dkim-atps=neutral Received: from mail-pl0-x243.google.com (mail-pl0-x243.google.com [IPv6:2607:f8b0:400e:c01::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40xDyd4ZPwzDr30 for ; Thu, 31 May 2018 14:30:01 +1000 (AEST) Received: by mail-pl0-x243.google.com with SMTP id c41-v6so12408457plj.10 for ; Wed, 30 May 2018 21:30:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=LD9BGBti5v2sKkgVm9iKiv6vvaj3QpeYV3qH0m/hmco=; b=UlTMDGXJzA1ej3U7frSA+oryDpcY9FsDPtlrDGtwa8TkmqRKExgfA8rseqSa76iBE0 M7skxX8cPiDubUFsri2N+p34aGex7Y6otxwvZLp7TIl7JfqMiUvYimFehjF5ALfcWzx9 gjr/U2hh9ObqPPfqqfExreDWVbnBTN2V7qIeyzJCj2mmvh2v6Eo7IhyJZ2TF49k1y10B 3CIuLEDI1mR1JJKoZT+OF4FYy7UTu6Lr4rpxImMuRZwKrR3YFkpHBx+p+YdiZ6V3IawK 7rKJBO7bCfKnad1UQto9Ypz10aD5RWXNkbfSkykSUnFu9R1UPeUcLdcPZ6i2neFAd/VV aE9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=LD9BGBti5v2sKkgVm9iKiv6vvaj3QpeYV3qH0m/hmco=; b=dKNY6+EbXlgBZcVWgJZZ/tOYz/sP3U6QhuI62TOJZNpSdtSFl1ZxrscSykRiBvSg16 sm7GSHY+RBlN6bORQV5j1KGwoMSBjiqOyA/1uVAEVGeCvqfANxdlOs85uRWUBBWGe6VT PdWcEfuP3EYNDgNstZtfn7qMOz+nH48VgGuLcQ8ng5y0ys6tMNPkXJyz7XyTRKQrjj8g 1Zz1Bh5K2ge7N1f2OjKMb4UNn9EENYF8ILIyYNcav+tM/tJK+U751Y/51GhKGA2YkCdJ U9fB8hJvroij9DEpy+ZIuNSfdsOR28ghDDAb80kRZw1kErYOaCfuL9x/a/xlhP2Jnfr/ KYhg== X-Gm-Message-State: ALKqPwcQbIAsj6AVLzIAfHOD450tG+VVK/35Dh6oCpmuJ+Thd2dr9ioE NCOvjVGioQCBxf4CtUe/DyPaYXHQ X-Google-Smtp-Source: ADUXVKLeIbnYHg0bNnKQp/pvx8564kBqrd0296jsuq04yukpPcwzhtn1ShgWAHh/ytM53SiocPCjgg== X-Received: by 2002:a17:902:9883:: with SMTP id s3-v6mr5526343plp.179.1527740999128; Wed, 30 May 2018 21:29:59 -0700 (PDT) Received: from aurora.jms.id.au ([45.124.203.19]) by smtp.gmail.com with ESMTPSA id f189-v6sm36472434pgc.51.2018.05.30.21.29.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 May 2018 21:29:58 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Thu, 31 May 2018 13:59:52 +0930 From: Joel Stanley To: skiboot@lists.ozlabs.org Date: Thu, 31 May 2018 13:59:41 +0930 Message-Id: <20180531042943.15804-2-joel@jms.id.au> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180531042943.15804-1-joel@jms.id.au> References: <20180531042943.15804-1-joel@jms.id.au> Subject: [Skiboot] [PATCH v3 1/3] core: Implement generic dump region opal call X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" This provides an implementation of the OPAL_REGISTER_DUMP_REGION and OPAL_UNREGISTER_DUMP_REGION calls that can be used by all systems. It enables the callbacks for the ibm-fsp machine, preserving the existing behaviour. Signed-off-by: Joel Stanley --- core/Makefile.inc | 2 +- core/dump-region.c | 39 +++++++++++++++++++++++++++++++++++++++ hw/fsp/fsp-mdst-table.c | 8 +++----- include/platform.h | 12 ++++++++++++ 4 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 core/dump-region.c diff --git a/core/Makefile.inc b/core/Makefile.inc index d36350590edb..2d2f74778f4c 100644 --- a/core/Makefile.inc +++ b/core/Makefile.inc @@ -9,7 +9,7 @@ CORE_OBJS += vpd.o hostservices.o platform.o nvram.o nvram-format.o hmi.o CORE_OBJS += console-log.o ipmi.o time-utils.o pel.o pool.o errorlog.o CORE_OBJS += timer.o i2c.o rtc.o flash.o sensor.o ipmi-opal.o CORE_OBJS += flash-subpartition.o bitmap.o buddy.o pci-quirk.o powercap.o psr.o -CORE_OBJS += pci-dt-slot.o direct-controls.o cpufeatures.o +CORE_OBJS += pci-dt-slot.o direct-controls.o cpufeatures.o dump-region.o ifeq ($(SKIBOOT_GCOV),1) CORE_OBJS += gcov-profiling.o diff --git a/core/dump-region.c b/core/dump-region.c new file mode 100644 index 000000000000..afa4c2685b89 --- /dev/null +++ b/core/dump-region.c @@ -0,0 +1,39 @@ +/* Copyright 2018 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define pr_fmt(fmt) "DUMP: " fmt + +#include +#include + +static int64_t opal_register_dump_region(uint32_t id, uint64_t addr, + uint64_t size) +{ + if (platform.register_dump_region) + return platform.register_dump_region(id, addr, size); + + return OPAL_UNSUPPORTED; +} +opal_call(OPAL_REGISTER_DUMP_REGION, opal_register_dump_region, 3); + +static int64_t opal_unregister_dump_region(uint32_t id) +{ + if (platform.unregister_dump_region) + return platform.unregister_dump_region(id); + + return OPAL_UNSUPPORTED; +} +opal_call(OPAL_UNREGISTER_DUMP_REGION, opal_unregister_dump_region, 1); diff --git a/hw/fsp/fsp-mdst-table.c b/hw/fsp/fsp-mdst-table.c index 0f145ba5551a..54d3c0613687 100644 --- a/hw/fsp/fsp-mdst-table.c +++ b/hw/fsp/fsp-mdst-table.c @@ -415,11 +415,9 @@ void fsp_mdst_table_init(void) if (!fsp_present()) return; - /* OPAL interface */ - opal_register(OPAL_REGISTER_DUMP_REGION, - fsp_opal_register_dump_region, 3); - opal_register(OPAL_UNREGISTER_DUMP_REGION, - fsp_opal_unregister_dump_region, 1); + /* Register callbacks */ + platform.register_dump_region = fsp_opal_register_dump_region; + platform.unregister_dump_region = fsp_opal_unregister_dump_region; if (!fsp_mdst_supported()) return; diff --git a/include/platform.h b/include/platform.h index a77764464001..c9b2dd88e4f6 100644 --- a/include/platform.h +++ b/include/platform.h @@ -207,6 +207,18 @@ struct platform { * OPAL terminate */ void __attribute__((noreturn)) (*terminate)(const char *msg); + + /* + * Dump region registration + * + * Allows machine specific actions to be taken when + * OPAL_REGISTER_DUMP_REGION and OPAL_UNREGISTER_DUMP_REGION + * are called. + */ + int64_t (*register_dump_region)(uint32_t id, + uint64_t addr, + uint64_t size); + int64_t (*unregister_dump_region)(uint32_t id); }; extern struct platform __platforms_start; From patchwork Thu May 31 04:29:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 923154 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.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40xDzQ1qLyz9s1B for ; Thu, 31 May 2018 14:30:42 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="TxJi3TuG"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40xDzP6zyxzF0S2 for ; Thu, 31 May 2018 14:30:41 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="TxJi3TuG"; dkim-atps=neutral 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:400e:c00::242; helo=mail-pf0-x242.google.com; envelope-from=joel.stan@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="TxJi3TuG"; dkim-atps=neutral Received: from mail-pf0-x242.google.com (mail-pf0-x242.google.com [IPv6:2607:f8b0:400e:c00::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40xDym16DbzDrZD for ; Thu, 31 May 2018 14:30:08 +1000 (AEST) Received: by mail-pf0-x242.google.com with SMTP id b74-v6so6661692pfl.5 for ; Wed, 30 May 2018 21:30:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=m0mhRnbbrZdeU9LHFgARIb6MLZ2XMDu4bV2ErUYi2rM=; b=TxJi3TuG8Ii6ucms9zZ6Whw7b0v4DSTptk8599nrhlAOjqLwb4/A949frqjApE31u8 DFUNwtgqKCcXp2nZmROSxF0Z4pkmBD2s9xJ8Qa4W9rjFkIWwgV3yl1tLi3xpFhT+ES3H VjmqKaLpsFjy+6athRUo8jpw3TJD5oQ/6VaArOwR+wriQYS/F9IehTomTPPDTtOx3F+U VYe7FPvjX5+OB/uvxawGHGS0szsxBFd2SpeZYWouPfLOrLcfX2yj80rHgup85UgtLjVA iVB+DLS6B/JoAAr32njWb8M6UcLs2D75HHSap0m1xukLy+WY5xXMi56th482WJLnUeB1 jsdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=m0mhRnbbrZdeU9LHFgARIb6MLZ2XMDu4bV2ErUYi2rM=; b=ONxGfK4dTUGOzoiEtKrOewFKFy+1p7A9lqxYKQK0wxtyHvnTQ2cVqqtJjVWpLVKs5X In5BoCY3FeDD+kdDfHf3m1kWZDunpUF+2BMMF8BKkPyef1THc/K0XDQ7XIGn42lS1xod skyoqre8vGRPUTS59CPbJjnPC/XN1sQL51bQwtFS9vIa8poT+XEuR8VReadQRpyyk/hB MgKyXplk2edfYRo1N+8PrdZSGme0sNFuI6sAGAV8SC6A1VVHX4+MHcZuJ0fs3lDW7yIF sgFqNxYLP3OMzqibF9Y1dD+/7VlYuSOiEMuiwzvHfrk/A9Q0jq+RMmT1DIeYr32zCQSX ge8g== X-Gm-Message-State: ALKqPwcPNoVTWrLTdxC7h6W/0qcN/gdPrzNuL/XpYKixIcDvRrWpLFPR F/skgq3Q0Di/9nJ6+Th0qMy0s6hd X-Google-Smtp-Source: ADUXVKLSk8l3rmXeNci7qOI/bIYHG8JXmfQlbh7IarBGYEPj43VB0p4YRD6QBbB3sDNB3ssXUWmOZg== X-Received: by 2002:a63:4383:: with SMTP id q125-v6mr4378586pga.412.1527741005939; Wed, 30 May 2018 21:30:05 -0700 (PDT) Received: from aurora.jms.id.au ([45.124.203.19]) by smtp.gmail.com with ESMTPSA id h23-v6sm59865944pfi.175.2018.05.30.21.30.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 May 2018 21:30:05 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Thu, 31 May 2018 13:59:59 +0930 From: Joel Stanley To: skiboot@lists.ozlabs.org Date: Thu, 31 May 2018 13:59:42 +0930 Message-Id: <20180531042943.15804-3-joel@jms.id.au> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180531042943.15804-1-joel@jms.id.au> References: <20180531042943.15804-1-joel@jms.id.au> Subject: [Skiboot] [PATCH v3 2/3] debug_descriptor: Claim reserved field for host kernel log buffer X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" This will be used by the dump region opal call. This bumps the version of the debug descriptor to indicate this field is now in use. However, any users of the descriptor should remain compatible as the non-reserved fields behave in the same way as previously. Signed-off-by: Joel Stanley --- include/skiboot.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/skiboot.h b/include/skiboot.h index b4bdf37795dd..9a49bfca74a5 100644 --- a/include/skiboot.h +++ b/include/skiboot.h @@ -69,13 +69,13 @@ static inline bool is_rodata(const void *p) */ struct debug_descriptor { u8 eye_catcher[8]; /* "OPALdbug" */ -#define DEBUG_DESC_VERSION 1 +#define DEBUG_DESC_VERSION 2 u32 version; u8 console_log_levels; /* high 4 bits in memory, * low 4 bits driver (e.g. uart). */ u8 state_flags; /* various state flags - OPAL_BOOT_COMPLETE etc */ - u16 reserved2; - u32 reserved[2]; + u16 reserved; + u64 log_buf_phys; /* Pointer to kernel log buffer */ /* Memory console */ u64 memcons_phys; @@ -90,7 +90,7 @@ struct debug_descriptor { u64 trace_phys[DEBUG_DESC_MAX_TRACES]; u32 trace_size[DEBUG_DESC_MAX_TRACES]; u32 trace_tce[DEBUG_DESC_MAX_TRACES]; -}; +} __packed; extern struct debug_descriptor debug_descriptor; static inline bool opal_booting(void) From patchwork Thu May 31 04:29:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 923155 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.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40xF1w5qpwz9s1B for ; Thu, 31 May 2018 14:32:52 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Tm7eMD5/"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40xF1w4HgczF0S0 for ; Thu, 31 May 2018 14:32:52 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Tm7eMD5/"; dkim-atps=neutral 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:400e:c05::242; helo=mail-pg0-x242.google.com; envelope-from=joel.stan@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Tm7eMD5/"; dkim-atps=neutral Received: from mail-pg0-x242.google.com (mail-pg0-x242.google.com [IPv6:2607:f8b0:400e:c05::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40xDyv407TzDrpY for ; Thu, 31 May 2018 14:30:15 +1000 (AEST) Received: by mail-pg0-x242.google.com with SMTP id a13-v6so9113901pgu.4 for ; Wed, 30 May 2018 21:30:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=+pQq2+uJG3Eb1rOZUaLaURa2sHu1p5Z8KmRaM5uSUN4=; b=Tm7eMD5/BDL7Ev9VoAYPTU59LG1I1F9n84tJ0hwyWILQhMZAg1lqKYVneQY2c8caBu p0tJQPcEZNTWlLYH+CGAxAYvJlQsUabeTnd4gM6OURmUPHIo90KNZRqksFERrKkl4NNs kpvsAJVneO8Vbxx/lY8GtohHRp1+NKXJ5261SXL10yN/RVJ1YGEHhmKFwuOCsY3uAUMq euYaW2Wb/DKaR7BVynFw4O4PJWytyO0M4iMO8zEOQgUkeyURW/8W/p1KGdJiqgQ4CA0V 03bV1lzazXvWCE6RAwTgSA18+66ePdQO2rbT6u3g7gXrGQW/3s/msF5DX6fG7J5HL7ul 40mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=+pQq2+uJG3Eb1rOZUaLaURa2sHu1p5Z8KmRaM5uSUN4=; b=nd1tT46B26d1HeCr5tdzlFSpLygtQnuEwnaHNkH+NYdfryMyxG9Y3yy3rhrwfkdgz/ 48EUSrs2By8PN0rMe1oaJp+QDizjO2cgZnziIkMnoJGFEAdqIT2SYT9o3vi09QhHZ/+T UG+jEdGggM+qb65g0enp5sjBCYxrezuPSPEQceG9uHASS5xW1pInjMuAXxLJGqKFDdnY 6aZk1T1Hyxn6YhON2zLMgpkD/unaYLhwaSsPcg+aiM1ml55Ww1IwDR9PJjD0Pg5gSWEE jhvjvBzzRnlK8sjKp4Iwnnl5gesNeAlhNqZ+McGjJuyu1Jt6l0rTE2L8WJt+vdym6dR4 72ww== X-Gm-Message-State: ALKqPwclF3PbSLzZMGEFV449bFwgI4bSxGWiCJ+H7iXMJ5iOrTCo/CkI WxvXE6+VD3+WKz+rClQpc6ENTi3+ X-Google-Smtp-Source: ADUXVKIwYj0C+EiB+DDv6gq5vDurc2Pd/y3/MZ6dw+GryKKoVbWsoQb/umDIEIySSEg+VBW9vkvFYw== X-Received: by 2002:a63:42c7:: with SMTP id p190-v6mr1818140pga.142.1527741012981; Wed, 30 May 2018 21:30:12 -0700 (PDT) Received: from aurora.jms.id.au ([45.124.203.19]) by smtp.gmail.com with ESMTPSA id w1-v6sm49652044pgp.3.2018.05.30.21.30.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 May 2018 21:30:12 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Thu, 31 May 2018 14:00:06 +0930 From: Joel Stanley To: skiboot@lists.ozlabs.org Date: Thu, 31 May 2018 13:59:43 +0930 Message-Id: <20180531042943.15804-4-joel@jms.id.au> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180531042943.15804-1-joel@jms.id.au> References: <20180531042943.15804-1-joel@jms.id.au> Subject: [Skiboot] [PATCH v3 3/3] dump: Always store kernel log buffer location X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" When the OPAL_REGISTER_DUMP_REGION call is made to register the kernel's log buffer, store that address in the debug descriptor. This address will be used by eg. pdbg to fetch the host kernel's log buffer over FSI. We unconditionally clear the value on a reboot (both fast-reboot and reliable reboot) to reduce the chance of debug tools getting the wrong buffer. Signed-off-by: Joel Stanley --- core/dump-region.c | 14 ++++++++++++-- core/init.c | 4 ++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/core/dump-region.c b/core/dump-region.c index afa4c2685b89..2917276a4097 100644 --- a/core/dump-region.c +++ b/core/dump-region.c @@ -22,18 +22,28 @@ static int64_t opal_register_dump_region(uint32_t id, uint64_t addr, uint64_t size) { + if (id == OPAL_DUMP_REGION_LOG_BUF) { + prlog(PR_INFO, "Registered log buf at 0x%016llx\n", addr); + debug_descriptor.log_buf_phys = addr; + } + if (platform.register_dump_region) return platform.register_dump_region(id, addr, size); - return OPAL_UNSUPPORTED; + return OPAL_SUCCESS; } opal_call(OPAL_REGISTER_DUMP_REGION, opal_register_dump_region, 3); static int64_t opal_unregister_dump_region(uint32_t id) { + if (id == OPAL_DUMP_REGION_LOG_BUF) { + prlog(PR_INFO, "Unregistered log buf\n"); + debug_descriptor.log_buf_phys = 0; + } + if (platform.unregister_dump_region) return platform.unregister_dump_region(id); - return OPAL_UNSUPPORTED; + return OPAL_SUCCESS; } opal_call(OPAL_UNREGISTER_DUMP_REGION, opal_unregister_dump_region, 1); diff --git a/core/init.c b/core/init.c index 3b887a24d11c..6caf0ba6913d 100644 --- a/core/init.c +++ b/core/init.c @@ -563,6 +563,10 @@ void __noreturn load_and_boot_kernel(bool is_reboot) mem_dump_free(); + /* Zero out memory location before the next kernel starts, + * in case the previous kernel did not unregister */ + debug_descriptor.log_buf_phys = 0; + /* Take processours out of nap */ cpu_set_sreset_enable(false); cpu_set_ipi_enable(false);