Message ID | 20171005090859.9234-1-hegdevasant@linux.vnet.ibm.com |
---|---|
State | Accepted |
Headers | show |
Series | FSP/NVRAM: Handle "get vNVRAM statistics" command | expand |
On 2017-10-05 14:38, Vasant Hegde wrote: > 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@linux.vnet.ibm.com> > Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> > --- Hi Tested this patch with elog stress test(1Lakh of elogs from fsp to host). And this fixes the unhandled message. Tested-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com> Thanks Pridhiviraj > 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();
Vasant Hegde <hegdevasant@linux.vnet.ibm.com> writes: > 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@linux.vnet.ibm.com> > Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> > --- > hw/fsp/fsp-nvram.c | 41 +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 41 insertions(+) thanks, merged to master as of 19d4f98e9483e4c1cae1d5a59491d8ab4f9a6e7f and cherry-picked back to 5.4.x as of c17cec0fe9242689b888d50430ad9ed2abfe6529
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();
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@linux.vnet.ibm.com> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> --- hw/fsp/fsp-nvram.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)