From patchwork Mon May 28 03:55:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 921291 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 40vNMT2sxfz9s08 for ; Mon, 28 May 2018 13:56:37 +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="BauKt4AB"; 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 40vNMT17r7zF0jM for ; Mon, 28 May 2018 13:56:37 +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="BauKt4AB"; 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::242; helo=mail-pl0-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="BauKt4AB"; dkim-atps=neutral Received: from mail-pl0-x242.google.com (mail-pl0-x242.google.com [IPv6:2607:f8b0:400e:c01::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 40vNM70DrfzF0S2 for ; Mon, 28 May 2018 13:56:18 +1000 (AEST) Received: by mail-pl0-x242.google.com with SMTP id f1-v6so5963783plt.6 for ; Sun, 27 May 2018 20:56:18 -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=Uh08nGp+RKAulGDF0/zvpPTBo5gfBKJ3nJEtllql8ms=; b=BauKt4ABgY6KYOHBMjtTKsgayWIkdv/tYGLLWkxOFXWrtizQ86RBzr/njBTFUlwcwd 3c18KUzE0LW6rW9RQTppfpzQZXuUIbg1oyWhRmDgU33XqNVL4u1E85tlFmxOp8oOgtXF kFgx7zLS1WxjWFDhK2Alq0WOvfTx2MYwFd9jqcTUd3RTZ160L+HiGLqbPk/poFtlIRKR z1p7/NJtjP2tSV8K38/NZbn/pO7chRy2ZVu1LPVK7HLuPI0m0SiKjCzD5M02bXGpswz3 X3BPRNOnyTL0SCB41sGq4eWB6hcutchgxr1igPzPqjmOyUDccTBvipSck1wQ/L3Ci+yz KfjA== 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=Uh08nGp+RKAulGDF0/zvpPTBo5gfBKJ3nJEtllql8ms=; b=NOFij9hISPYjV4Sh/h8WAsBk32zVNbS7jy3bnlDcuCiCkcNPAaTL4pxRbJV8hPGtsj MJDGolGFl9zc5kFtP7A255UEv+mNLH1mtPKCbFFhQXUVoIhFh+brbcbsy//MUqmvTTQ2 V0lW66kiUZaN9ng2khonTg1waoh2Mk0JdnzGcAjGLPeCDI4J5LkXSnbaC1quAB5MVifk et6u6s3tedjSPEZBcguM7p+W1jfUbxLnTSxRmLW1nk9AnKNqakrJ1Ip7MA7TofPfLpug BjLHQgbpUEz8RfoROvslFjTUyN/5dn+lgZFvtEYbWV1UEWX6BOQY6RjBg6OJtKfN35wc OJoA== X-Gm-Message-State: ALKqPweSuSNbfArMideiVkgfFPqvgPBmSGSMC0eXwzGbsRVrZ4C1d852 mmzdzqY81v3TOBo/92dto7sC0eiy X-Google-Smtp-Source: AB8JxZopkqdOZevTkvbnD+/KNyZ8Cy8iKytBRa+BgkBWqdgMHtIld+Rza3DT8DYHZbvikHxHdMeG5w== X-Received: by 2002:a17:902:3181:: with SMTP id x1-v6mr12099917plb.198.1527479776372; Sun, 27 May 2018 20:56:16 -0700 (PDT) Received: from aurora.jms.id.au ([203.0.153.9]) by smtp.gmail.com with ESMTPSA id v16-v6sm88033306pfk.164.2018.05.27.20.56.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 27 May 2018 20:56:15 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Mon, 28 May 2018 13:26:10 +0930 From: Joel Stanley To: skiboot@lists.ozlabs.org Date: Mon, 28 May 2018 13:25:58 +0930 Message-Id: <20180528035559.13422-2-joel@jms.id.au> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528035559.13422-1-joel@jms.id.au> References: <20180528035559.13422-1-joel@jms.id.au> Subject: [Skiboot] [PATCH v2 1/2] 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" Signed-off-by: Joel Stanley --- We could bump the version instead, but I don't think there's any call for that. Another option would be to re-use some of the memcons fields that are currently only used by FSP. A third option would be to use this field to link to yet another debug structure to allow for future flexibility. --- include/skiboot.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/skiboot.h b/include/skiboot.h index b4bdf37795dd..7f3740965412 100644 --- a/include/skiboot.h +++ b/include/skiboot.h @@ -75,7 +75,7 @@ struct debug_descriptor { * low 4 bits driver (e.g. uart). */ u8 state_flags; /* various state flags - OPAL_BOOT_COMPLETE etc */ u16 reserved2; - u32 reserved[2]; + u64 log_buf_phys; /* Pointer to kernel log buffer */ /* Memory console */ u64 memcons_phys; From patchwork Mon May 28 03:55:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 921292 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 40vNMs6rpWz9s08 for ; Mon, 28 May 2018 13:56:57 +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="kgkymJzI"; 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 40vNMs52c0zF0kx for ; Mon, 28 May 2018 13:56:57 +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="kgkymJzI"; 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::242; helo=mail-pl0-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="kgkymJzI"; dkim-atps=neutral Received: from mail-pl0-x242.google.com (mail-pl0-x242.google.com [IPv6:2607:f8b0:400e:c01::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 40vNMD3NnSzF0lV for ; Mon, 28 May 2018 13:56:24 +1000 (AEST) Received: by mail-pl0-x242.google.com with SMTP id v24-v6so6412638plo.3 for ; Sun, 27 May 2018 20:56:24 -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=qFKtZgN2SMAzdW4fasUcCV6lujcsgGv/6ZUowyNfxUs=; b=kgkymJzIZ2XgDjhHS5Oag4e9rLqgi2j6413Yt0e6OI5GH76xBTESJy3qCNA+/z7Jzb trPGYGS1+gq6nP6mUaNZXJKUCkBkfwKytGkQJC2Msio9enyutuDV4AAlwsiBJlmnfyRc iMvk95yVSZ2AhkT/ajmbPRdy58nECL9Et7iwjEtVDkFpX/AcWO00m5mtFlerNsDBfveU l087MWkbqEjimVr9x/eVrBXAGWDe4fQN+ZqYPJArrL5vYa8CtMrG78w11oA/b/NpseoL 8vUI7xpa05Ytx67e3ghC8sqSrWwYJO1Rabfb+iVw8zXVpXzyhaxjGWyWyiZbAChEEXNt 7tuQ== 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=qFKtZgN2SMAzdW4fasUcCV6lujcsgGv/6ZUowyNfxUs=; b=s9gr/UeUSbWQvYV7ZTHC+zM/30eIQ4tF4GM1pXxgKJAx3nR7jramXRVAkPnxbHT+DL WOUpQqd5OXatRA6STLZn4Q9zxXo22dQyCbUC17UXEhRD+FuUCcEtHwAq1ewoC8ptpRBU FQwDGry3TsGCADpmwRzPuLy6MNIDooC6wTGAyqO39BvkqNe1r4HP8HhMvCWowXFAOlmG Cx4tctpB/zUwOvNQpkCrnX9rUCkXmouQP0ZInKJY5YLmqFrkBCQ4tgu6fzbsX2IH/+8V YeIuGZJ1D2Uk+KZI7Z5ypekc8j1E+sKBFxvud0V63q5UAFP7DbYJHw1ryaAEKQLXjoQg zqsQ== X-Gm-Message-State: ALKqPwdvIGhfD2ROWDQRBx83IGwA9Gfo7UhYRfIy2aRzVc/5jM0aC+F5 cNGwpRENxeH4wqT6klkK9rFMfiIP X-Google-Smtp-Source: AB8JxZpbvffkimRvJh71Mk9FwOgqpkFx3bws1G7UziI3eMe57O7YcTbk8/gqdGwMvo5l1MEKgMUVTw== X-Received: by 2002:a17:902:6b44:: with SMTP id g4-v6mr11913684plt.390.1527479782328; Sun, 27 May 2018 20:56:22 -0700 (PDT) Received: from aurora.jms.id.au ([203.0.153.9]) by smtp.gmail.com with ESMTPSA id z25-v6sm56227809pfi.171.2018.05.27.20.56.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 27 May 2018 20:56:21 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Mon, 28 May 2018 13:26:16 +0930 From: Joel Stanley To: skiboot@lists.ozlabs.org Date: Mon, 28 May 2018 13:25:59 +0930 Message-Id: <20180528035559.13422-3-joel@jms.id.au> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528035559.13422-1-joel@jms.id.au> References: <20180528035559.13422-1-joel@jms.id.au> Subject: [Skiboot] [PATCH v2 2/2] core: Implement non-FSP 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 non-FSP systems, and performs that registration for all astbmc platforms. This pointer 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 Reviewed-by: Vasant Hegde --- v2: Rename dump.h to dump-region.h Add comment to init.c --- core/Makefile.inc | 2 +- core/dump-region.c | 61 +++++++++++++++++++++++++++++++++++++++ core/init.c | 4 +++ include/dump-region.h | 26 +++++++++++++++++ platforms/astbmc/common.c | 4 +++ 5 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 core/dump-region.c create mode 100644 include/dump-region.h 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..e42486f99ebf --- /dev/null +++ b/core/dump-region.c @@ -0,0 +1,61 @@ +/* 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 + +#include + +static int64_t bmc_opal_register_dump_region(uint32_t id, + uint64_t addr, uint64_t size) +{ + if (id != OPAL_DUMP_REGION_LOG_BUF) { + prerror("Unsupported log region id %02x\n", id); + return OPAL_UNSUPPORTED; + } + + if (size <= 0) { + prerror("Invalid log size %lld\n", size); + return OPAL_PARAMETER; + } + + prlog(PR_INFO, "Registered log buf at 0x%016llx\n", addr); + debug_descriptor.log_buf_phys = addr; + + return OPAL_SUCCESS; +} + +static int64_t bmc_opal_unregister_dump_region(uint32_t id) +{ + if (id != OPAL_DUMP_REGION_LOG_BUF) { + prlog(PR_DEBUG, "Unsupported log region id %02x\n", id); + return OPAL_UNSUPPORTED; + } + prlog(PR_INFO, "Unregistered log buf\n"); + debug_descriptor.log_buf_phys = 0; + + return OPAL_SUCCESS; +} + +void bmc_dump_region_init(void) +{ + opal_register(OPAL_REGISTER_DUMP_REGION, + bmc_opal_register_dump_region, 3); + opal_register(OPAL_UNREGISTER_DUMP_REGION, + bmc_opal_unregister_dump_region, 1); +}; diff --git a/core/init.c b/core/init.c index 3b887a24d11c..c1c352858e06 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); diff --git a/include/dump-region.h b/include/dump-region.h new file mode 100644 index 000000000000..b629e66a85e6 --- /dev/null +++ b/include/dump-region.h @@ -0,0 +1,26 @@ +/* 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. + */ + +#ifndef __DUMP_H +#define __DUMP_H + +/* + * Initialise dump region registration OPAL calls for bmc systems. + */ +void bmc_dump_region_init(void); + +#endif + diff --git a/platforms/astbmc/common.c b/platforms/astbmc/common.c index 30c2714f94b9..ca8ec7e8c0ce 100644 --- a/platforms/astbmc/common.c +++ b/platforms/astbmc/common.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "astbmc.h" @@ -156,6 +157,9 @@ void astbmc_init(void) /* Add BMC firmware info to device tree */ ipmi_dt_add_bmc_info(); + + /* Enable dump region OPAL calls */ + bmc_dump_region_init(); } int64_t astbmc_ipmi_power_down(uint64_t request)