From 627e76402b06779db2c6cda94ff2af354a704bce Mon Sep 17 00:00:00 2001 From: Zhuo Zhi Date: Tue, 13 Aug 2024 20:14:11 +0800 Subject: [PATCH] prov/opx: use page_sizes[OFI_PAGE_SIZE] instead of PAGE_SIZE Some arch like riscv does not have a standard defined PAGE_SIZE in sys/user.h. Signed-off-by: Zhuo Zhi --- prov/opx/include/opa_user_gen1.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/prov/opx/include/opa_user_gen1.h b/prov/opx/include/opa_user_gen1.h index 99b4c141146..ed1ff675eb4 100644 --- a/prov/opx/include/opa_user_gen1.h +++ b/prov/opx/include/opa_user_gen1.h @@ -83,6 +83,7 @@ #include "opa_udebug.h" #include "opa_service.h" #include "opa_user.h" +#include "ofi_mem.h" #define HFI_RHF_USE_EGRBFR_MASK 0x1 #define HFI_RHF_USE_EGRBFR_SHIFT 15 @@ -570,7 +571,7 @@ static __inline__ int32_t opx_hfi_update_tid(struct _hfi_ctrl *ctrl, #endif FI_DBG(&fi_opx_provider, FI_LOG_MR, "OPX_DEBUG_ENTRY update [%p - %p], length %u (pages %lu)\n", - (void*)vaddr, (void*) (vaddr + *length), *length, (*length) / PAGE_SIZE); + (void*)vaddr, (void*) (vaddr + *length), *length, (*length) / page_sizes[OFI_PAGE_SIZE]); cmd.len = sizeof(tidinfo); cmd.addr = (__u64) &tidinfo; @@ -589,9 +590,9 @@ static __inline__ int32_t opx_hfi_update_tid(struct _hfi_ctrl *ctrl, FI_WARN(&fi_opx_provider, FI_LOG_MR, "PARTIAL UPDATE errno %d \"%s\" INPUTS vaddr [%p - %p] length %u (pages %lu), OUTPUTS vaddr [%p - %p] length %u (pages %lu), tidcnt %u\n", errno, strerror(errno), (void*)vaddr, - (void*)(vaddr + *length), *length, (*length) / PAGE_SIZE, + (void*)(vaddr + *length), *length, (*length) / page_sizes[OFI_PAGE_SIZE], (void*)rettidinfo->vaddr,(void*)(rettidinfo->vaddr + rettidinfo->length), - rettidinfo->length, rettidinfo->length / PAGE_SIZE, + rettidinfo->length, rettidinfo->length / page_sizes[OFI_PAGE_SIZE], rettidinfo->tidcnt); } /* Always update outputs, even on soft errors */ @@ -601,7 +602,7 @@ static __inline__ int32_t opx_hfi_update_tid(struct _hfi_ctrl *ctrl, FI_DBG(&fi_opx_provider, FI_LOG_MR, "TID UPDATE IOCTL returned %d errno %d \"%s\" vaddr [%p - %p] length %u (pages %lu), tidcnt %u\n", err, errno, strerror(errno), (void*)vaddr, - (void*)(vaddr + *length), *length, (*length) / PAGE_SIZE, *tidcnt); + (void*)(vaddr + *length), *length, (*length) / page_sizes[OFI_PAGE_SIZE], *tidcnt); return 0; } @@ -609,13 +610,13 @@ static __inline__ int32_t opx_hfi_update_tid(struct _hfi_ctrl *ctrl, if (errno == ENOSPC) { FI_DBG(&fi_opx_provider, FI_LOG_MR, "IOCTL FAILED : No TIDs available, requested range=%p-%p (%u bytes, %lu pages)\n", - (void*)vaddr, (void*) (vaddr + *length), *length, (*length) / PAGE_SIZE); + (void*)vaddr, (void*) (vaddr + *length), *length, (*length) / page_sizes[OFI_PAGE_SIZE]); err = -FI_ENOSPC; } else { FI_WARN(&fi_opx_provider, FI_LOG_MR, "IOCTL FAILED ERR %d errno %d \"%s\" requested range=%p-%p (%u bytes, %lu pages)\n", err, errno, strerror(errno), - (void*)vaddr, (void*) (vaddr + *length), *length, (*length) / PAGE_SIZE); + (void*)vaddr, (void*) (vaddr + *length), *length, (*length) / page_sizes[OFI_PAGE_SIZE]); } /* Hard error, we can't trust these */