Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751782AbbLJAjG (ORCPT ); Wed, 9 Dec 2015 19:39:06 -0500 Received: from e19.ny.us.ibm.com ([129.33.205.209]:51122 "EHLO e19.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750906AbbLJAjE (ORCPT ); Wed, 9 Dec 2015 19:39:04 -0500 X-IBM-Helo: d01dlp02.pok.ibm.com X-IBM-MailFrom: stewart@linux.vnet.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org From: Stewart Smith To: Daniel Axtens , Denis Kirjanov Cc: linuxppc-dev@ozlabs.org, Linux Kernel Mailing List , Mahesh J Salgaonkar Subject: Re: [PATCH] selftests/powerpc: Add script to test HMI functionality In-Reply-To: <87h9jrxkg0.fsf@gamma.ozlabs.ibm.com> References: <1447821827-17876-1-git-send-email-dja@axtens.net> <87h9jrxkg0.fsf@gamma.ozlabs.ibm.com> User-Agent: Notmuch/0.21+24~gbceb651 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-redhat-linux-gnu) Date: Thu, 10 Dec 2015 11:38:47 +1100 Message-ID: <87vb87b0iw.fsf@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15121000-0057-0000-0000-000002C3220B Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3277 Lines: 64 Daniel Axtens writes: > I just realised I sent my reply to Denis not the list - apologies. This > info goes for v2 as well. > > > Could you explain why it's useful, and what it's useful for. Moreover, > > it's POWER8 feature, right? > > I'm not sure whether you're asking about the script or HMIs. Explaining > HMIs helps make sense of the script, so I'll start there. > > HMIs are a class of interrupt or exception that, broadly speaking, > require the hypervisor to intervene to 'do something'. They are (very > lightly) documented in the POWER ISA, which is available on the > OpenPOWER website. That file doesn't do a particuarly good job of > explaining what can trigger an HMI, because that's a Book IV question. > > So, while I can't point you to documentation about what might cause an > HMI, I can point you to some source code. Here goes: > > An HMI will (per the ISA) cause execution to jump to > 0x0000 0000 0000 0E60. Through some asm and C you end up calling > ppc_md.hmi_exception_early() and then possibly > ppc_md.handle_hmi_expection(). This is only defined on PowerNV, where > they point to opal_hmi_exception_early() and > opal_handle_hmi_exception() respectively. > > The early exception calls into opal through opal_handle_hmi, which is an > OPAL call (OPAL_HANDLE_HMI). skiboot/core/hmi.c lists the contents of > the HMER (Hypervisor Maintenance Exception Register), which identifies > the actual cause of the HMI. You can find the list in the skiboot repo > on github, including the action that will be taken: > https://github.com/open-power/skiboot/blob/master/core/hmi.c > The rest of the file fleshes out the mechanics of HMIs: for example, > where they are caused by the failure of a POWER8 co-processor such as > CAPI or NX. > > Some HMIs are relayed by Skiboot to Linux by sending an OPAL_MSG_HMI_EVT > to Linux. This triggers off some further processing which causes a > message to be printed in dmesg. The relevant file here is > platforms/powernv/opal-hmi.c > > The script, therefore, is useful because: > - HMIs are an exceptional/error condition that is not hit in normal > operation. Indeed, without the xscom commands in this script > (or a CAPI card), it's almost impossible to hit them. > - HMIs involve communications between Skiboot and Linux, involve > touching the PACA, and generally work in an area that is prone to > bugs, so testing them is especially valuable. > - The script is carefully calibrated to send HMIs that trigger a > message in dmesg but which don't checkstop the machine. > > To answer your final question, I'm not entirely sure if HMIs are POWER8 > specific. I suspect they've been around for a lot longer, but maybe > someone who's been around IBM chips for longer than me could clarify this. Adding this to doc/ somewhere in kernel and/or skiboot would be great. There's a skiboot doc/hmi.txt that's begging for a patch, you know, creating it :) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/