On Tue, Apr 08, 2025 at 02:47:49PM +0200, Larysa Zaremba wrote:
> From: Phani R Burra <[email protected]>
>
> Add memory related support functions for drivers to access MMIO space and
> allocate/free dma buffers.
>
> Reviewed-by: Maciej Fijalkowski <[email protected]>
> Signed-off-by: Phani R Burra <[email protected]>
> Co-developed-by: Victor Raj <[email protected]>
> Signed-off-by: Victor Raj <[email protected]>
> Co-developed-by: Sridhar Samudrala <[email protected]>
> Signed-off-by: Sridhar Samudrala <[email protected]>
> Co-developed-by: Pavan Kumar Linga <[email protected]>
> Signed-off-by: Pavan Kumar Linga <[email protected]>
> Co-developed-by: Larysa Zaremba <[email protected]>
> Signed-off-by: Larysa Zaremba <[email protected]>
...
> diff --git a/drivers/net/ethernet/intel/libeth/pci.c
> b/drivers/net/ethernet/intel/libeth/pci.c
...
> +/**
> + * __libeth_pci_map_mmio_region - map PCI device MMIO region
> + * @mmio_info: struct to store the mapped MMIO region
> + * @offset: MMIO region start offset
> + * @size: MMIO region size
> + * @num_args: number of additional arguments present
> + *
> + * Return: true on success, false on memory map failure.
> + */
> +bool __libeth_pci_map_mmio_region(struct libeth_mmio_info *mmio_info,
> + resource_size_t offset,
> + resource_size_t size, int num_args, ...)
> +{
> + struct pci_dev *pdev = mmio_info->pdev;
> + struct libeth_pci_mmio_region *mr;
> + resource_size_t pa;
> + void __iomem *va;
> + int bar_idx = 0;
> + va_list args;
> +
> + if (num_args) {
> + va_start(args, num_args);
> + bar_idx = va_arg(args, int);
> + va_end(args);
> + }
> +
> + mr = libeth_find_mmio_region(&mmio_info->mmio_list, offset, bar_idx);
> + if (mr) {
> + pci_warn(pdev, "Mapping of BAR%u with offset %llu already
> exists\n",
> + bar_idx, offset);
Hi Phani, Larysa, all,
I think that the format specifier here should be %zu rather than %llu.
On ARM W=1 builds gcc 14.2.0 flags this as follows:
CALL scripts/checksyscalls.sh
CC drivers/net/ethernet/intel/libeth/pci.o
In file included from ./include/linux/device.h:15,
from ./include/linux/pci.h:37,
from ./include/net/libeth/pci.h:7,
from drivers/net/ethernet/intel/libeth/pci.c:4:
.../pci.c: In function '__libeth_pci_map_mmio_region':
.../pci.c:92:32: warning: format '%llu' expects argument of type 'long long
unsigned int', but argument 4 has type 'resource_size_t' {aka 'unsigned int'}
[-Wformat=]
92 | pci_warn(pdev, "Mapping of BAR%u with offset %llu
already exists\n",
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__);
\
| ^~~
.../dev_printk.h:156:61: note: in expansion of macro 'dev_fmt'
156 | dev_printk_index_wrap(_dev_warn, KERN_WARNING, dev,
dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
.../pci.h:2704:41: note: in expansion of macro 'dev_warn'
2704 | #define pci_warn(pdev, fmt, arg...) dev_warn(&(pdev)->dev, fmt,
##arg)
| ^~~~~~~~
.../pci.c:92:17: note: in expansion of macro 'pci_warn'
92 | pci_warn(pdev, "Mapping of BAR%u with offset %llu
already exists\n",
| ^~~~~~~~
.../pci.c:92:65: note: format string is defined here
92 | pci_warn(pdev, "Mapping of BAR%u with offset %llu
already exists\n",
| ~~~^
| |
| long
long unsigned int
| %u