From owner-svn-src-all@freebsd.org Mon Jun 10 03:24:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9996215B24B9; Mon, 10 Jun 2019 03:24:39 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2AFE19041F; Mon, 10 Jun 2019 03:24:39 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 08E56C908; Mon, 10 Jun 2019 03:24:39 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5A3OcVR010493; Mon, 10 Jun 2019 03:24:38 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5A3OcM4010492; Mon, 10 Jun 2019 03:24:38 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201906100324.x5A3OcM4010492@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Mon, 10 Jun 2019 03:24:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r348845 - head/sys/powerpc/powernv X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powernv X-SVN-Commit-Revision: 348845 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2AFE19041F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.968,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jun 2019 03:24:40 -0000 Author: jhibbits Date: Mon Jun 10 03:24:38 2019 New Revision: 348845 URL: https://svnweb.freebsd.org/changeset/base/348845 Log: powernv: Port HMI handler to use the message framework When an HMI occurs a message event also gets created with the details of the exception. Hook into the messaging framework to retrieve the HMI message. Nothing is done with it yet, except to panic on unhandled exception. Modified: head/sys/powerpc/powernv/opal_hmi.c Modified: head/sys/powerpc/powernv/opal_hmi.c ============================================================================== --- head/sys/powerpc/powernv/opal_hmi.c Mon Jun 10 03:16:55 2019 (r348844) +++ head/sys/powerpc/powernv/opal_hmi.c Mon Jun 10 03:24:38 2019 (r348845) @@ -28,8 +28,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include +#include #include #include @@ -38,6 +40,47 @@ __FBSDID("$FreeBSD$"); #include #include "opal.h" +struct opal_hmi_event { + uint8_t version; + uint8_t severity; + uint8_t type; + uint8_t disposition; + uint8_t rsvd_1[4]; + uint64_t hmer; + uint64_t tfmr; + union { + struct { + uint8_t xstop_type; + uint8_t rsvd_2[3]; + uint32_t xstop_reason; + union { + uint32_t pir; + uint32_t chip_id; + }; + }; + }; +}; + +#define HMI_DISP_RECOVERED 0 +#define HMI_DISP_NOT_RECOVERED 1 + +static void +opal_hmi_event_handler(void *unused, struct opal_msg *msg) +{ + struct opal_hmi_event evt; + + memcpy(&evt, &msg->params, sizeof(evt)); + printf("Hypervisor Maintenance Event received" + "(Severity %d, type %d, HMER: %016lx).\n", + evt.severity, evt.type, evt.hmer); + + if (evt.disposition == HMI_DISP_NOT_RECOVERED) + panic("Unrecoverable hypervisor maintenance exception on CPU %d", + evt.pir); + + return; +} + static int opal_hmi_handler(struct trapframe *frame) { @@ -69,8 +112,11 @@ opal_setup_hmi(void *data) return; } + EVENTHANDLER_REGISTER(OPAL_HMI_EVT, opal_hmi_event_handler, NULL, + EVENTHANDLER_PRI_ANY); + if (bootverbose) printf("Installed OPAL HMI handler.\n"); } -SYSINIT(opal_setup_hmi, SI_SUB_HYPERVISOR, SI_ORDER_ANY, opal_setup_hmi, NULL); +SYSINIT(opal_setup_hmi, SI_SUB_CPU, SI_ORDER_ANY, opal_setup_hmi, NULL);