[dpdk-dev] [PATCH] bus/fslmc: use PRIu64 instead of llX in format specifier
Hemant Agrawal
hemant.agrawal at nxp.com
Fri Apr 13 09:37:40 CEST 2018
Hi Gowrishankar,
On 4/13/2018 10:34 AM, Gowrishankar wrote:
> From: Gowrishankar Muthukrishnan <gowrishankar.m at linux.vnet.ibm.com>
>
> Instead of llX, use C99 standard "PRIu64" in format specifier. Former one
> breaks compile in ppc64le.
>
> Fixes: c2c167fdb3 ("bus/fslmc: support memory event callbacks for VFIO")
>
> Signed-off-by: Gowrishankar Muthukrishnan <gowrishankar.m at linux.vnet.ibm.com>
> --
> In file included from dpdk/drivers/bus/fslmc/fslmc_vfio.c:37:0:
> dpdk/drivers/bus/fslmc/fslmc_vfio.c: In function ‘fslmc_map_dma’:
> dpdk/drivers/bus/fslmc/fslmc_logs.h:18:44: error: format ‘%llX’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘__u64 {aka long unsigned int}’ [-Werror=format=]
So, powerpc64LE is taking __u64 as long unsigned int, while x86_64
compiler is taking it as long long unsigned it.
> rte_log(RTE_LOG_DEBUG, dpaa2_logtype_bus, "fslmc: %s(): " fmt "\n", \
> ^
> dpdk/drivers/bus/fslmc/fslmc_vfio.c:272:2: note: in expansion of macro ‘DPAA2_BUS_DEBUG’
> DPAA2_BUS_DEBUG("--> Map address: %llX, size: 0x%llX",
> ^~~~~~~~~~~~~~~
> dpdk/drivers/bus/fslmc/fslmc_vfio.c:272:39: note: format string is defined here
> DPAA2_BUS_DEBUG("--> Map address: %llX, size: 0x%llX",
> ~~~^
> %lX
>
> drivers/bus/fslmc/fslmc_vfio.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
> index 4036e82..a003a7d 100644
> --- a/drivers/bus/fslmc/fslmc_vfio.c
> +++ b/drivers/bus/fslmc/fslmc_vfio.c
> @@ -270,7 +270,7 @@ static int vfio_map_irq_region(struct fslmc_vfio_group *group)
> return -1;
> }
>
> - DPAA2_BUS_DEBUG("--> Map address: %llX, size: 0x%llX",
> + DPAA2_BUS_DEBUG("--> Map address: %"PRIu64", size: 0x%"PRIu64"",
> dma_map.vaddr, dma_map.size);
You should also type cast the variables to avoid compilation issue on x86.
- dma_map.vaddr, dma_map.size);
+ (uint64_t)dma_map.vaddr, uint64_t)dma_map.size);
The same change is to be done at other two places as well in your patch.
Please check compilation for x86_64 and i686, the patchwork compilation
check is running late.
> ret = ioctl(group->container->fd, VFIO_IOMMU_MAP_DMA, &dma_map);
> if (ret) {
> @@ -303,7 +303,7 @@ static int vfio_map_irq_region(struct fslmc_vfio_group *group)
> return -1;
> }
>
> - DPAA2_BUS_DEBUG("--> Unmap address: %llX, size: 0x%llX",
> + DPAA2_BUS_DEBUG("--> Unmap address: %"PRIu64", size: 0x%"PRIu64"",
> dma_unmap.iova, dma_unmap.size);
> ret = ioctl(group->container->fd, VFIO_IOMMU_UNMAP_DMA, &dma_unmap);
> if (ret) {
> @@ -401,7 +401,7 @@ static int64_t vfio_map_mcp_obj(struct fslmc_vfio_group *group, char *mcp_obj)
> goto MC_FAILURE;
> }
>
> - DPAA2_BUS_DEBUG("Region offset = %llx , region size = %llx",
> + DPAA2_BUS_DEBUG("Region offset = %"PRIu64" , region size = %"PRIu64"",
> reg_info.offset, reg_info.size);
>
> v_addr = (size_t)mmap(NULL, reg_info.size,
>
More information about the dev
mailing list