Skip to content

Commit

Permalink
npu2: Reset NVLinks on hot reset
Browse files Browse the repository at this point in the history
This effectively fences GPU RAM on GPU reset so the host system
does not have to crash every time we stop a KVM guest with a GPU
passed through.

Suggested-by: Balbir Singh <bsingharora@gmail.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Acked-by: Balbir Singh <bsingharora@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
  • Loading branch information
aik authored and stewartsmith committed Jun 19, 2018
1 parent 35cd7a3 commit fca2b2b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions hw/npu2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,20 @@ static int64_t npu2_get_power_state(struct pci_slot *slot __unused, uint8_t *val

static int64_t npu2_hreset(struct pci_slot *slot __unused)
{
struct npu2 *p;
int i;
struct npu2_dev *ndev;

p = phb_to_npu2_nvlink(slot->phb);
NPU2INF(p, "Hreset PHB state\n");

for (i = 0; i < p->total_devices; i++) {
ndev = &p->devices[i];
if (ndev) {
NPU2DEVINF(ndev, "Resetting device\n");
reset_ntl(ndev);
}
}
return OPAL_SUCCESS;
}

Expand Down

0 comments on commit fca2b2b

Please sign in to comment.