From 9d5faafc56f5cac7ba848bc684835353e039f048 Mon Sep 17 00:00:00 2001 From: Frederic Barrat Date: Wed, 9 Oct 2019 21:38:10 +0200 Subject: [PATCH] npu2-opencapi: Handle OPAL_UNMAP_PE operation on set_pe() callback In a hot-unplug scenario, the OS will try to unmap the PE. Skiboot doesn't do anything with the linux PE for opencapi other than being a mailbox, but at least let's be consistent. Signed-off-by: Frederic Barrat Reviewed-by: Christophe Lombard Signed-off-by: Oliver O'Halloran --- hw/npu2-opencapi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/npu2-opencapi.c b/hw/npu2-opencapi.c index f5c821d9a939..5658ec6b12b6 100644 --- a/hw/npu2-opencapi.c +++ b/hw/npu2-opencapi.c @@ -1489,7 +1489,7 @@ static int64_t npu2_opencapi_set_pe(struct phb *phb, uint8_t __unused bcompare, uint8_t __unused dcompare, uint8_t __unused fcompare, - uint8_t __unused action) + uint8_t action) { struct npu2_dev *dev = phb_to_npu2_dev_ocapi(phb); /* @@ -1501,6 +1501,11 @@ static int64_t npu2_opencapi_set_pe(struct phb *phb, * functions on the device, the OS can define many PEs, we * only keep one, the OS will handle it. */ + if (action != OPAL_MAP_PE && action != OPAL_UNMAP_PE) + return OPAL_PARAMETER; + + if (action == OPAL_UNMAP_PE) + pe_num = -1; dev->linux_pe = pe_num; return OPAL_SUCCESS; }