From patchwork Mon Nov 25 15:19:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1200464 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47M9h25qCkz9sPJ for ; Tue, 26 Nov 2019 02:20:02 +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 47M9h24T8HzDqZb for ; Tue, 26 Nov 2019 02:20:02 +1100 (AEDT) X-Original-To: skiboot-stable@lists.ozlabs.org Delivered-To: skiboot-stable@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) 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 47M9gy5R0mzDq60 for ; Tue, 26 Nov 2019 02:19:58 +1100 (AEDT) Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xAPFJh51041218 for ; Mon, 25 Nov 2019 10:19:55 -0500 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2wfk458dup-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 25 Nov 2019 10:19:49 -0500 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 25 Nov 2019 15:19:23 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 25 Nov 2019 15:19:20 -0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xAPFJJx939190718 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 25 Nov 2019 15:19:19 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 351D2AE045; Mon, 25 Nov 2019 15:19:19 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D86D3AE070; Mon, 25 Nov 2019 15:19:17 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.199.38.111]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 25 Nov 2019 15:19:17 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Mon, 25 Nov 2019 20:49:14 +0530 X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19112515-4275-0000-0000-000003862564 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19112515-4276-0000-0000-00003899ACDB Message-Id: <20191125151914.29168-1-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95, 18.0.572 definitions=2019-11-25_03:2019-11-21, 2019-11-25 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 impostorscore=0 malwarescore=0 lowpriorityscore=0 priorityscore=1501 adultscore=0 mlxscore=0 bulkscore=0 phishscore=0 clxscore=1015 spamscore=0 suspectscore=1 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1911250137 Subject: [Skiboot-stable] [PATCH] FSP/IPMI: Handle FSP reset reload X-BeenThere: skiboot-stable@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Patches, review, and discussion for stable releases of skiboot" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: skiboot-stable@lists.ozlabs.org Errors-To: skiboot-stable-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot-stable" FSP IPMI driver serializes ipmi messages. It sends message to FSP and waits for response before sending new message. It works fine as long as we get response from FSP on time. If we have inflight ipmi message during FSP R/R, we will not get resonse from FSP. So if we initiate inband FSP R/R then all subsequent inband ipmi message gets blocked. Sequence: - ipmitool mc reset cold - - ipmitool <-- gets blocked This patch clears inflight ipmi messages after FSP R/R complete. Signed-off-by: Vasant Hegde Cc: skiboot-stable@lists.ozlabs.org --- hw/fsp/fsp-ipmi.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/hw/fsp/fsp-ipmi.c b/hw/fsp/fsp-ipmi.c index 025dd019f..7b20f3cd5 100644 --- a/hw/fsp/fsp-ipmi.c +++ b/hw/fsp/fsp-ipmi.c @@ -70,6 +70,10 @@ static void fsp_ipmi_cmd_done(uint8_t cmd, uint8_t netfn, uint8_t cc) struct fsp_ipmi_msg *fsp_ipmi_msg = fsp_ipmi.cur_msg; lock(&fsp_ipmi.lock); + if (fsp_ipmi.cur_msg == NULL) { + unlock(&fsp_ipmi.lock); + return; + } list_del(&fsp_ipmi_msg->link); fsp_ipmi.cur_msg = NULL; unlock(&fsp_ipmi.lock); @@ -251,6 +255,35 @@ static struct ipmi_backend fsp_ipmi_backend = { .poll = NULL, }; +static bool fsp_ipmi_rr_notify(uint32_t cmd_sub_mod, + struct fsp_msg *msg __unused) +{ + struct ipmi_msg *ipmi_msg; + + switch (cmd_sub_mod) { + case FSP_RESET_START: + return true; + case FSP_RELOAD_COMPLETE: + /* + * We will not get response for outstanding request. Send error + * message to caller and start sending new ipmi messages. + */ + if (fsp_ipmi.cur_msg) { + ipmi_msg = &fsp_ipmi.cur_msg->ipmi_msg; + fsp_ipmi_cmd_done(ipmi_msg->cmd, + IPMI_NETFN_RETURN_CODE(ipmi_msg->netfn), + IPMI_ERR_UNSPECIFIED); + } + fsp_ipmi_send_request(); + return true; + } + return false; +} + +static struct fsp_client fsp_ipmi_client_rr = { + .message = fsp_ipmi_rr_notify, +}; + static bool fsp_ipmi_send_response(uint32_t cmd) { struct fsp_msg *resp; @@ -364,5 +397,6 @@ void fsp_ipmi_init(void) init_lock(&fsp_ipmi.lock); fsp_register_client(&fsp_ipmi_client, FSP_MCLASS_FETCH_SPDATA); + fsp_register_client(&fsp_ipmi_client_rr, FSP_MCLASS_RR_EVENT); ipmi_register_backend(&fsp_ipmi_backend); }