[Skiboot] [PATCH] hw/npu2.c: Fix opal_npu_map_lpar to search for existing BDF

Alistair Popple alistair at popple.id.au
Mon Jun 5 12:03:24 AEST 2017


opal_npu_map_lpar is used to setup mappings for a given GPU BDF to handle XTS
address translation requests. This call was incorrectly searching for existing
mappings based on lparid instead of bdf resulting in table entries being
incorrectly overwritten. This call should instead search for existing mappings
to update using the GPU BDF.

Signed-off-by: Alistair Popple <alistair at popple.id.au>
---
 hw/npu2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/npu2.c b/hw/npu2.c
index 4b6573f..73e9841 100644
--- a/hw/npu2.c
+++ b/hw/npu2.c
@@ -1799,11 +1799,11 @@ static int opal_npu_map_lpar(uint64_t phb_id, uint64_t bdf, uint64_t lparid,
 
 	/* Find any existing entries and update them */
 	xts_bdf_lpar = SETFIELD(NPU2_XTS_BDF_MAP_VALID, 0UL, 1);
-	xts_bdf_lpar = SETFIELD(NPU2_XTS_BDF_MAP_LPARID, xts_bdf_lpar, lparid);
+	xts_bdf_lpar = SETFIELD(NPU2_XTS_BDF_MAP_BDF, xts_bdf_lpar, bdf);
 	id = npu_table_search(p, NPU2_XTS_BDF_MAP, 8, NPU2_XTS_BDF_MAP_SIZE,
 			      &xts_bdf_lpar,
 			      NPU2_XTS_BDF_MAP_VALID |
-			      NPU2_XTS_BDF_MAP_LPARID);
+			      NPU2_XTS_BDF_MAP_BDF);
 	if (id < 0) {
 		/* No existing mapping found, find space for a new one */
 		xts_bdf_lpar = 0;
-- 
2.1.4



More information about the Skiboot mailing list