[Skiboot] [PATCH skiboot] npu2: Reset NVLinks on hot reset

Alexey Kardashevskiy aik at ozlabs.ru
Wed Jun 13 16:22:10 AEST 2018


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 at gmail.com>
Signed-off-by: Alexey Kardashevskiy <aik at ozlabs.ru>
---
 hw/npu2.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/hw/npu2.c b/hw/npu2.c
index 238fff4..3ed089f 100644
--- a/hw/npu2.c
+++ b/hw/npu2.c
@@ -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;
 }
 
-- 
2.11.0



More information about the Skiboot mailing list