From patchwork Tue Mar 22 10:19:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mahesh J Salgaonkar X-Patchwork-Id: 600521 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qTpcM1ySjz9s5g for ; Tue, 22 Mar 2016 21:20:35 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3qTpcM17qYzDqF8 for ; Tue, 22 Mar 2016 21:20:35 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from e23smtp07.au.ibm.com (e23smtp07.au.ibm.com [202.81.31.140]) (using TLSv1.2 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3qTpcG45GGzDq71 for ; Tue, 22 Mar 2016 21:20:30 +1100 (AEDT) Received: from localhost by e23smtp07.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 22 Mar 2016 20:20:28 +1000 Received: from d23dlp03.au.ibm.com (202.81.31.214) by e23smtp07.au.ibm.com (202.81.31.204) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 22 Mar 2016 20:20:24 +1000 X-IBM-Helo: d23dlp03.au.ibm.com X-IBM-MailFrom: mahesh@linux.vnet.ibm.com X-IBM-RcptTo: skiboot@lists.ozlabs.org Received: from d23relay07.au.ibm.com (d23relay07.au.ibm.com [9.190.26.37]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id 714623578057 for ; Tue, 22 Mar 2016 21:20:24 +1100 (EST) Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay07.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u2MAKGXK37552168 for ; Tue, 22 Mar 2016 21:20:24 +1100 Received: from d23av04.au.ibm.com (localhost [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u2MAJqQ2015868 for ; Tue, 22 Mar 2016 21:19:52 +1100 Received: from [9.109.222.100] (mars.in.ibm.com [9.124.35.52] (may be forged)) by d23av04.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u2MAJpse015501 for ; Tue, 22 Mar 2016 21:19:51 +1100 From: Mahesh J Salgaonkar To: skiboot list Date: Tue, 22 Mar 2016 15:49:27 +0530 Message-ID: <20160322101839.18759.14744.stgit@mars> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16032210-0025-0000-0000-000003FCA80C Subject: [Skiboot] [PATCH] hmi: Fix a bug where partial hmi event was reported to host. X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" From: Mahesh Salgaonkar The current code sends partial hmi event (4 * 64bits instead of 5 * 64bits) to host. The last 64 bits contains chip id/pir info for reporting checkstop events. This bug affects only checkstop events. Host console o/p without this patch: [ 305.628283] Fatal Hypervisor Maintenance interrupt [Not recovered] [ 305.628341] Error detail: Malfunction Alert [ 305.628388] HMER: 8040000000000000 [ 305.628423] CPU PIR: 00000000 [ 305.628458] [Unit: VSU] Logic core check stop Host console o/p with this patch: [ 200.122883] Fatal Hypervisor Maintenance interrupt [Not recovered] [ 200.122941] Error detail: Malfunction Alert [ 200.122986] HMER: 8040000000000000 [ 200.123021] CPU PIR: 000008e8 [ 200.123055] [Unit: VSU] Logic core check stop Signed-off-by: Mahesh Salgaonkar --- core/hmi.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/core/hmi.c b/core/hmi.c index d2cca90..a934438 100644 --- a/core/hmi.c +++ b/core/hmi.c @@ -217,7 +217,7 @@ static struct lock hmi_lock = LOCK_UNLOCKED; static int queue_hmi_event(struct OpalHMIEvent *hmi_evt, int recover) { - uint64_t *hmi_data; + size_t num_params; /* Don't queue up event if recover == -1 */ if (recover == -1) @@ -230,16 +230,17 @@ static int queue_hmi_event(struct OpalHMIEvent *hmi_evt, int recover) hmi_evt->disposition = OpalHMI_DISPOSITION_NOT_RECOVERED; /* - * V2 of struct OpalHMIEvent is of (4 * 64 bits) size and well packed + * V2 of struct OpalHMIEvent is of (5 * 64 bits) size and well packed * structure. Hence use uint64_t pointer to pass entire structure - * using 4 params in generic message format. + * using 5 params in generic message format. Instead of hard coding + * num_params divide the struct size by 8 bytes to get exact + * num_params value. */ - hmi_data = (uint64_t *)hmi_evt; + num_params = ALIGN_UP(sizeof(*hmi_evt), sizeof(u64)) / sizeof(u64); /* queue up for delivery to host. */ - return opal_queue_msg(OPAL_MSG_HMI_EVT, NULL, NULL, - hmi_data[0], hmi_data[1], hmi_data[2], - hmi_data[3]); + return _opal_queue_msg(OPAL_MSG_HMI_EVT, NULL, NULL, + num_params, (uint64_t *)hmi_evt); } static int is_capp_recoverable(int chip_id)