Skip to content

Commit

Permalink
npu2-opencapi: Handle OPAL_UNMAP_PE operation on set_pe() callback
Browse files Browse the repository at this point in the history
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 <fbarrat@linux.ibm.com>
Reviewed-by: Christophe Lombard <clombard@linux.vnet.ibm.com>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
  • Loading branch information
fbarrat authored and oohal committed Oct 22, 2019
1 parent 6299d3e commit 9d5faaf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion hw/npu2-opencapi.c
Expand Up @@ -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);
/*
Expand All @@ -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;
}
Expand Down

0 comments on commit 9d5faaf

Please sign in to comment.