Skip to content

Commit 2a7ad14

Browse files
committed
Trace MMIO mappings
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
1 parent 43a7b34 commit 2a7ad14

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

src/mmio.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ static ocxl_err register_mmio(ocxl_afu *afu, void *addr, size_t size, ocxl_mmio_
8080

8181
*handle = (ocxl_mmio_h)&afu->mmios[available_mmio];
8282

83+
TRACE(afu, "Mapped %ld bytes of %s MMIO at %p",
84+
size, type == OCXL_GLOBAL_MMIO ? "Global" : "Per-PASID", addr);
85+
8386
return OCXL_OK;
8487
}
8588

@@ -278,7 +281,7 @@ ocxl_err ocxl_mmio_map_advanced(ocxl_afu_h afu, ocxl_mmio_type type, size_t size
278281
if (offset + size > my_afu->global_mmio.length) {
279282
rc = OCXL_NO_MEM;
280283
errmsg(my_afu, rc, "Offset(%x) + size(%x) of global MMIO map request exceeds available size of %x",
281-
offset, size, my_afu->global_mmio.length);
284+
offset, size, my_afu->global_mmio.length);
282285
return rc;
283286
}
284287
return global_mmio_map(my_afu, size, prot, flags, offset, region);
@@ -288,7 +291,7 @@ ocxl_err ocxl_mmio_map_advanced(ocxl_afu_h afu, ocxl_mmio_type type, size_t size
288291
if (offset + size > my_afu->global_mmio.length) {
289292
rc = OCXL_NO_MEM;
290293
errmsg(my_afu, rc, "Offset(%x) + size(%x) of global MMIO map request exceeds available size of %x",
291-
offset, size, my_afu->global_mmio.length);
294+
offset, size, my_afu->global_mmio.length);
292295
return rc;
293296
}
294297
return mmio_map(my_afu, size, prot, flags, offset, region);
@@ -305,7 +308,9 @@ ocxl_err ocxl_mmio_map_advanced(ocxl_afu_h afu, ocxl_mmio_type type, size_t size
305308
*
306309
* Maps the entire global/per-PASID region of MMIO memory on the AFU with read/write access granted.
307310
*
308-
* @pre the AFU has been opened
311+
* @pre the AFU has been opened, and if a per-PASID region is to be mapped, the AFU has been attached
312+
*
313+
* @see ocxl_afu_attach()
309314
*
310315
* @param afu the AFU to operate on
311316
* @param type the type of MMIO area to map
@@ -575,7 +580,7 @@ inline static ocxl_err mmio_write32_native(ocxl_mmio_h region, off_t offset, uin
575580
mmio->type == OCXL_GLOBAL_MMIO ? "Global" : "Per-PASID",
576581
offset, value);
577582

578-
volatile uint32_t * addr = (uint32_t *)(mmio->start + offset);
583+
volatile uint32_t *addr = (uint32_t *)(mmio->start + offset);
579584

580585
__sync_synchronize();
581586
*addr = value;
@@ -615,7 +620,7 @@ inline static ocxl_err mmio_write64_native(ocxl_mmio_h region, off_t offset, uin
615620
mmio->type == OCXL_GLOBAL_MMIO ? "Global" : "Per-PASID",
616621
offset, value);
617622

618-
volatile uint64_t * addr = (uint64_t *)(mmio->start + offset);
623+
volatile uint64_t *addr = (uint64_t *)(mmio->start + offset);
619624

620625
__sync_synchronize();
621626
*addr = value;

0 commit comments

Comments
 (0)