From patchwork Wed Nov 28 11:02:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1004438 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 434dFv0XZQz9s55 for ; Wed, 28 Nov 2018 22:09:23 +1100 (AEDT) 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 434dFt5tyjzDqhn for ; Wed, 28 Nov 2018 22:09:22 +1100 (AEDT) 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 434d7T3cXDzDqgS for ; Wed, 28 Nov 2018 22:03:49 +1100 (AEDT) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wASB0djc098040 for ; Wed, 28 Nov 2018 06:03:47 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2p1ps2qhyf-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 28 Nov 2018 06:03:47 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Nov 2018 11:03:44 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 28 Nov 2018 11:03:43 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wASB3fbS60227702 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 28 Nov 2018 11:03:41 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B2A78A4057; Wed, 28 Nov 2018 11:03:41 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 768E4A4055; Wed, 28 Nov 2018 11:03:40 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.143]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 28 Nov 2018 11:03:40 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Wed, 28 Nov 2018 16:32:40 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> References: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112811-0020-0000-0000-000002EEF239 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112811-0021-0000-0000-0000213E4B64 Message-Id: <20181128110244.17664-19-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-28_07:, , 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-1810050000 definitions=main-1811280100 Subject: [Skiboot] [PATCH v6 18/22] fadump: Add documentation 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: , Cc: stewart@linux.vnet.ibm.com, hbathini@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,opal/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 | 73 +++++++++++++++++++++++++++++++++ 5 files changed, 160 insertions(+) create mode 100644 doc/device-tree/ibm,opal/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,opal/dump.rst b/doc/device-tree/ibm,opal/dump.rst new file mode 100644 index 000000000..a5145cf73 --- /dev/null +++ b/doc/device-tree/ibm,opal/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 = <0x1>; + /* + * 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"; + 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 = <0x600>; + }; diff --git a/doc/fadump.rst b/doc/fadump.rst new file mode 100644 index 000000000..a704c72cd --- /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..06e05861d --- /dev/null +++ b/doc/opal-api/opal-fadump-manage-167.rst @@ -0,0 +1,73 @@ +.. _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 crashing_cpu; + u64 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