[Skiboot] [PATCH] FSP/NVRAM: Handle "get vNVRAM statistics" command

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Thu Oct 5 20:08:59 AEDT 2017


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 <ppaidipe at linux.vnet.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
 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();
 
-- 
2.9.3



More information about the Skiboot mailing list