From patchwork Thu Oct 5 09:08:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 821659 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y76Qn0Cs7z9t3v for ; Thu, 5 Oct 2017 20:09:21 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3y76Qm5p7QzDr5x for ; Thu, 5 Oct 2017 20:09:20 +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=hegdevasant@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 3y76Qh404DzDr5L for ; Thu, 5 Oct 2017 20:09:16 +1100 (AEDT) Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9598jmB034057 for ; Thu, 5 Oct 2017 05:09:13 -0400 Received: from e23smtp03.au.ibm.com (e23smtp03.au.ibm.com [202.81.31.145]) by mx0b-001b2d01.pphosted.com with ESMTP id 2ddeebhyw0-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 05 Oct 2017 05:09:13 -0400 Received: from localhost by e23smtp03.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 5 Oct 2017 19:09:10 +1000 Received: from d23relay07.au.ibm.com (202.81.31.226) by e23smtp03.au.ibm.com (202.81.31.209) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 5 Oct 2017 19:09:09 +1000 Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay07.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v95998Wt44499106 for ; Thu, 5 Oct 2017 20:09:08 +1100 Received: from d23av02.au.ibm.com (localhost [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v9598xXc004508 for ; Thu, 5 Oct 2017 20:08:59 +1100 Received: from hegdevasant.in.ibm.com ([9.202.58.205]) by d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v9598vxO004473; Thu, 5 Oct 2017 20:08:57 +1100 From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Thu, 5 Oct 2017 14:38:59 +0530 X-Mailer: git-send-email 2.9.3 X-TM-AS-MML: disable x-cbid: 17100509-0008-0000-0000-000001595510 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17100509-0009-0000-0000-0000098F25B4 Message-Id: <20171005090859.9234-1-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-05_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=3 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710050130 Subject: [Skiboot] [PATCH] FSP/NVRAM: Handle "get vNVRAM statistics" command 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" FSP sends MBOX command (cmd : 0xEB, subcmd : 0x05, mod : 0x00) to get vNVRAM statistics. OPAL doesn't maintain any such statistics. Hence return FSP_STATUS_INVALID_SUBCMD. Sample OPAL log: [16944.384670488,3] FSP: Unhandled message eb0500 [16944.474110465,3] FSP: Unhandled message eb0500 [16945.111280784,3] FSP: Unhandled message eb0500 [16945.293393485,3] FSP: Unhandled message eb0500 With this patch, I don't think FSP will ever call "free vNVRAM" MBOX command. But to be safer side lets return FSP_STATUS_INVALID_SUBCMD for this MBOX command as well. Reported-by: Pridhiviraj Paidipeddi Signed-off-by: Vasant Hegde Tested-by: Pridhiviraj Paidipeddi --- hw/fsp/fsp-nvram.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/hw/fsp/fsp-nvram.c b/hw/fsp/fsp-nvram.c index 85b7e81..1b4990f 100644 --- a/hw/fsp/fsp-nvram.c +++ b/hw/fsp/fsp-nvram.c @@ -310,6 +310,44 @@ static struct fsp_client fsp_nvram_client_rr = { .message = fsp_nvram_msg_rr, }; +static bool fsp_vnvram_msg(u32 cmd_sub_mod, struct fsp_msg *msg) +{ + u32 cmd; + struct fsp_msg *resp; + + assert(msg == NULL); + switch (cmd_sub_mod) { + case FSP_CMD_GET_VNV_STATS: + prlog(PR_DEBUG, + "FSP NVRAM: Get vNVRAM statistics not supported\n"); + cmd = FSP_RSP_GET_VNV_STATS | FSP_STATUS_INVALID_SUBCMD; + break; + case FSP_CMD_FREE_VNV_STATS: + prlog(PR_DEBUG, + "FSP NVRAM: Free vNVRAM statistics buffer not supported\n"); + cmd = FSP_RSP_FREE_VNV_STATS | FSP_STATUS_INVALID_SUBCMD; + break; + default: + return false; + } + + resp = fsp_mkmsg(cmd, 0); + if (!resp) { + prerror("FSP NVRAM: Failed to allocate resp message\n"); + return false; + } + if (fsp_queue_msg(resp, fsp_freemsg)) { + prerror("FSP NVRAM: Failed to queue resp message\n"); + fsp_freemsg(resp); + return false; + } + return true; +} + +static struct fsp_client fsp_vnvram_client = { + .message = fsp_vnvram_msg, +}; + int fsp_nvram_info(uint32_t *total_size) { if (!fsp_present()) { @@ -354,6 +392,9 @@ int fsp_nvram_start_read(void *dst, uint32_t src, uint32_t len) /* Register for the reset/reload event */ fsp_register_client(&fsp_nvram_client_rr, FSP_MCLASS_RR_EVENT); + /* Register for virtual NVRAM interface events */ + fsp_register_client(&fsp_vnvram_client, FSP_MCLASS_VIRTUAL_NVRAM); + /* Open and load the nvram from the FSP */ fsp_nvram_send_open();