From patchwork Tue Dec 19 06:14:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stewart Smith X-Patchwork-Id: 850623 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 ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3z171F65J6z9s81 for ; Tue, 19 Dec 2017 17:15:13 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3z171F2H3BzDsSh for ; Tue, 19 Dec 2017 17:15:13 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=stewart@linux.vnet.ibm.com; receiver=) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 3z17171FnZzDsSd for ; Tue, 19 Dec 2017 17:15:06 +1100 (AEDT) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vBJ6EfKs048754 for ; Tue, 19 Dec 2017 01:15:04 -0500 Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.153]) by mx0a-001b2d01.pphosted.com with ESMTP id 2exr22tk0p-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 19 Dec 2017 01:15:03 -0500 Received: from localhost by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 18 Dec 2017 23:15:02 -0700 Received: from b03cxnp08026.gho.boulder.ibm.com (9.17.130.18) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 18 Dec 2017 23:14:59 -0700 Received: from b03ledav003.gho.boulder.ibm.com (b03ledav003.gho.boulder.ibm.com [9.17.130.234]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vBJ6ExGY5964188; Mon, 18 Dec 2017 23:14:59 -0700 Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6D6C96A03D; Mon, 18 Dec 2017 23:14:59 -0700 (MST) Received: from birb.localdomain (unknown [9.102.32.27]) by b03ledav003.gho.boulder.ibm.com (Postfix) with SMTP id 8C5606A03B; Mon, 18 Dec 2017 23:14:58 -0700 (MST) Received: by birb.localdomain (Postfix, from userid 1000) id A8CEA4EC6A3; Tue, 19 Dec 2017 17:14:53 +1100 (AEDT) From: Stewart Smith To: skiboot@lists.ozlabs.org Date: Tue, 19 Dec 2017 17:14:53 +1100 X-Mailer: git-send-email 2.14.3 X-TM-AS-GCONF: 00 x-cbid: 17121906-0012-0000-0000-0000157B8DB9 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008226; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000244; SDB=6.00962352; UDB=6.00486759; IPR=6.00742347; BA=6.00005752; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00018621; XFM=3.00000015; UTC=2017-12-19 06:15:01 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17121906-0013-0000-0000-000050B7DDE1 Message-Id: <20171219061453.19941-1-stewart@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-12-19_04:, , 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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1712190092 Subject: [Skiboot] [PATCH] libflash/mbox-flash: fallback to requesting lower MBOX versions from BMC X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Some BMC mbox implementations seem to sometimes mysteriously fail when trying to negotiate v3 when they only support v2. To work around this, we can fall back to requesting lower mbox protocol versions until we find one that works. In theory, this should already "just work", but we have a counter example, which this patch fixes. Signed-off-by: Stewart Smith --- libflash/mbox-flash.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libflash/mbox-flash.c b/libflash/mbox-flash.c index d33a52c0ebf0..4a3c53f5957f 100644 --- a/libflash/mbox-flash.c +++ b/libflash/mbox-flash.c @@ -1018,6 +1018,7 @@ static int protocol_init(struct mbox_flash_data *mbox_flash, uint8_t shift) */ mbox_flash->version = 3; +negotiate_version: msg_put_u8(&msg, 0, mbox_flash->version); msg_put_u8(&msg, 1, shift); rc = msg_send(mbox_flash, &msg, mbox_flash->timeout); @@ -1029,6 +1030,12 @@ static int protocol_init(struct mbox_flash_data *mbox_flash, uint8_t shift) rc = wait_for_bmc(mbox_flash, mbox_flash->timeout); if (rc) { prlog(PR_ERR, "Error waiting for BMC\n"); + if (mbox_flash->version > 1) { + mbox_flash->version--; + prlog(PR_INFO, "Retrying MBOX negotiation with BMC" + " with MBOXv%d\n", mbox_flash->version); + goto negotiate_version; + } return rc; }