From patchwork Thu Aug 16 08:57:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 958196 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 41rgMf0WJnz9s3C for ; Thu, 16 Aug 2018 19:02:38 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41rgMd5lXRzDrHP for ; Thu, 16 Aug 2018 19:02:37 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41rgH534cJzDr4h for ; Thu, 16 Aug 2018 18:58:41 +1000 (AEST) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w7G8wab5128335 for ; Thu, 16 Aug 2018 04:58:39 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2kw3s6ws92-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 16 Aug 2018 04:58:38 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 16 Aug 2018 09:58:36 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 16 Aug 2018 09:58:34 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w7G8wXoP33882274 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 16 Aug 2018 08:58:33 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 112914C05C; Thu, 16 Aug 2018 11:58:38 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AD29B4C044; Thu, 16 Aug 2018 11:58:36 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.199.177.112]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 16 Aug 2018 11:58:36 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Thu, 16 Aug 2018 14:27:20 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180816085721.11703-1-hegdevasant@linux.vnet.ibm.com> References: <20180816085721.11703-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18081608-0008-0000-0000-00000262988A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18081608-0009-0000-0000-000021CAC2CA Message-Id: <20180816085721.11703-18-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-08-16_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808160096 Subject: [Skiboot] [PATCH v5 17/18] fadump: Add documentation X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: stewart@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Document fadump device tree and OPAL APIs. Signed-off-by: Vasant Hegde Signed-off-by: Ananth N Mavinakayanahalli --- doc/device-tree/ibm,dump.rst | 33 +++++++++++++++ doc/fadump.rst | 51 +++++++++++++++++++++++ doc/index.rst | 1 + doc/opal-api/opal-cec-reboot-6-116.rst | 2 + doc/opal-api/opal-fadump-manage-167.rst | 72 +++++++++++++++++++++++++++++++++ 5 files changed, 159 insertions(+) create mode 100644 doc/device-tree/ibm,dump.rst create mode 100644 doc/fadump.rst create mode 100644 doc/opal-api/opal-fadump-manage-167.rst diff --git a/doc/device-tree/ibm,dump.rst b/doc/device-tree/ibm,dump.rst new file mode 100644 index 000000000..01fb9c4b6 --- /dev/null +++ b/doc/device-tree/ibm,dump.rst @@ -0,0 +1,33 @@ +.. _device-tree/ibm,opal/dump: + +Fadump Device Tree Binding +========================== + +See :ref:`fadump` for general fadump information. + +dump node +--------- +.. code-block:: dts + + dump { + /* Architected register data format version */ + cpu-data-version = <0x10>; + /* + * This property tells memory reserved by OPAL for OPAL dump. + * We use `fadump` structure to pass reservation details to + * Linux kernel. + */ + fw-source-table = <0x280001 0x0 0x3000000 0x0 0x0 0x30000000 0x0 0x5f10000 0x0 0x71e10000 0x0 0x5f10000>; + /* Memory used by OPAL to load skiroot images */ + fw-load-area = <0x0 0x20000000 0x0 0x8000000 0x0 0x28000000 0x0 0x8000000>; + /* Compatible property */ + compatible = "ibm,opal-dump-v1"; + phandle = <0x98>; + /* + * This property contains captured dump details. This property + * exists only when we have dump. + */ + result-table = <0x280002 0x0 0x3000000 0x0 0x0 0x30000000 0x0 0x5f10000 0x0 0x71e10000 0x0 0x5f10000 0x0 0x0 0x0 0x3165a558 0x0 0x34800 0x0 0x3165a558 0x0 0x34800>; + /* Each thread architected register data size */ + cpu-data-size = <0x20>; + }; diff --git a/doc/fadump.rst b/doc/fadump.rst new file mode 100644 index 000000000..93a0f588a --- /dev/null +++ b/doc/fadump.rst @@ -0,0 +1,51 @@ +.. _fadump: + +FADUMP (aka MPIPL) Overview +=========================== + +Memory Preserving Initial Program Load (MPIPL) is a Power feature where the +contents of memory are preserved while the system reboots after a failure. +This is accomplished by the firmware/OS publishing ranges of memory to be +preserved across boots. + +Registration +------------ +In the OPAL context, OPAL and host Linux communicate the memory ranges to be +preserved via source descriptor tables in the HDAT (MDST and MDDT table inside +SPIRAH). Host Linux can register/unregister using OPAL_FADUMP_MANAGE API (see +:ref:`opal-api-fadump-manage`). + +Early OPAL crash +---------------- +We hardcode OPAL memory ranges and destination memory in the HDAT. So that we +can capture early OPAL crash dump. + +Initiating dump +--------------- +Whenever Linux crashes, it makes reboot2 OPAL call with type as MPIPL. (see +:ref:`opal-api-cec-reboot`). Depending on sevice processor type OPAL makes +appropriate call to initiate MPIPL. On FSP system we call `attn` instruction +(see ``__trigger_attn``) and on BMC system we call SBE `S0 interrupt` +(see ``p9_sbe_terminate()``). + +Dump collection +--------------- +Hostboot then re-IPLs the machine taking care to copy over contents of the +source memory to a alternate memory locations as specified in descriptor table. +Hostboot publishes this information in the destination descriptor tables (MDRT +table inside SPIRAH structure). The success/failure of the copy is indicated +by a results table. + +SBE/Hostboot also does the requisite procedures to gather hardware register +states for all active threads at the time of the crash. + +MPIPL boot +---------- +On an MPIPL boot, OPAL exports the results information to the host Linux kernel, +which then uses its existing logic (kdump/fadump) to write out a core dump of +OPAL and Linux kernel in a format that GDB and crash can understand. + +Device tree +----------- +We create new device tree node (``/ibm,opal/dump``) to pass dump details to Linux +kernel from OPAL (see :ref:`device-tree/ibm,opal/dump`). diff --git a/doc/index.rst b/doc/index.rst index b7a868c96..9f154a275 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -46,6 +46,7 @@ Developer Guide and Internals xscom-node-bindings xive imc + fadump OPAL ABI diff --git a/doc/opal-api/opal-cec-reboot-6-116.rst b/doc/opal-api/opal-cec-reboot-6-116.rst index 9ac7f9f69..8b332c880 100644 --- a/doc/opal-api/opal-cec-reboot-6-116.rst +++ b/doc/opal-api/opal-cec-reboot-6-116.rst @@ -1,3 +1,5 @@ +.. _opal-api-cec-reboot: + OPAL_CEC_REBOOT and OPAL_CEC_REBOOT2 ==================================== :: diff --git a/doc/opal-api/opal-fadump-manage-167.rst b/doc/opal-api/opal-fadump-manage-167.rst new file mode 100644 index 000000000..cf0fc77cd --- /dev/null +++ b/doc/opal-api/opal-fadump-manage-167.rst @@ -0,0 +1,72 @@ +.. _opal-api-fadump-manage: + +OPAL fadump manage call +======================= +:: + + #define OPAL_FADUMP_MANAGE 170 + +This call is used to manage FADUMP (aka MPIPL) on OPAL platform. +Linux kernel will use this call to register/unregister FADUMP. + +Parameters +---------- +:: + + uint64_t command + void *data + uint64_t dsize + +``command`` + ``command`` parameter supports below values: + +:: + + 0x01 - Register for fadump + 0x02 - Unregister fadump + 0x03 - Invalidate existing fadump + +``data`` + ``data`` is valid when ``command`` is 0x01 (registration). + We use fadump structure (see below) to pass Linux kernel + memory reservation details. + +:: + + + struct fadump_section { + u8 source_type; + u8 reserved[7]; + u64 source_addr; + u64 source_size; + u64 dest_addr; + u64 dest_size; + } __packed; + + struct fadump { + u16 fadump_section_size; + u16 section_count; + u32 reserved; + struct fadump_section section[]; + }; + +``dsize`` + Size of the data + +Return Values +------------- + +``OPAL_SUCCESS`` + Operation success + +``OPAL_PARAMETER`` + Invalid ``command`` or ``data`` or ``dsize`` + +``OPAL_RESOURCE`` + Ran out of space in MDST/MDDT table to add new entry + +``OPAL_PERMISSION`` + Already registered + +``OPAL_HARDWARE`` + Platform does not support fadump