Re: git: e602a30bb9fc - main - irdma(4): Fix compile error on powerpc64

From: Eric Joyner <erj_at_freebsd.org>
Date: Wed, 25 May 2022 07:07:57 UTC
Thanks Jessica for the report  -- I went with keeping %p and casting twice
to a void * as in your first suggestion, and remembered to compile test it
on both amd64 and powerpc64 afterwards. :p

- Eric

On Tue, May 24, 2022 at 10:57 PM Konrad Sewiłło-Jopek <kjopek@gmail.com>
wrote:

> Jessica is right.
>
> AMD64 build:
>
> --- all_subdir_irdma ---
> --- irdma_ws.o ---
> ctfconvert -L VERSION -g irdma_ws.o
> --- all_subdir_ispfw ---
> :> export_syms
> awk -f /mass/coding/scanme/scanme/vendor/freebsd/sys/conf/kmod_syms.awk
> isp_2400.ko.full  export_syms | xargs -J% objcopy % isp_2400.ko.full
> --- all_subdir_irdma ---
> --- icrdma.o ---
> /mass/coding/scanme/scanme/vendor/freebsd/sys/modules/irdma/../../dev/irdma/icrdma.c:504:24:
> error: format specifies type 'void *' but the argument has type
> 'bus_space_tag_t' (aka 'unsigned long') [-Werror,-Wformat]
>                       pf_if_d(peer), peer->pci_mem->r_bustag);
>                                      ^~~~~~~~~~~~~~~~~~~~~~~
> /mass/coding/scanme/scanme/vendor/freebsd/sys/modules/irdma/../../dev/irdma/osdep.h:179:74:
> note: expanded from macro 'irdma_pr_info'
> #define irdma_pr_info(fmt, args ...) printf("%s: WARN "fmt, __func__, ##
> args)
>                                                        ~~~
> ^~~~
> Regards,
> Konrad Sewiłło-Jopek
>
>
> śr., 25 maj 2022 o 04:02 Jessica Clarke <jrtc27@freebsd.org> napisał(a):
>
>> On 25 May 2022, at 01:30, Eric Joyner <erj@FreeBSD.org> wrote:
>> >
>> > The branch main has been updated by erj:
>> >
>> > URL:
>> https://cgit.FreeBSD.org/src/commit/?id=e602a30bb9fc7ee041a0e629d0fd2db7933ffa32
>> >
>> > commit e602a30bb9fc7ee041a0e629d0fd2db7933ffa32
>> > Author:     Eric Joyner <erj@FreeBSD.org>
>> > AuthorDate: 2022-05-25 00:27:29 +0000
>> > Commit:     Eric Joyner <erj@FreeBSD.org>
>> > CommitDate: 2022-05-25 00:30:46 +0000
>> >
>> >    irdma(4): Fix compile error on powerpc64
>> >
>> >    Jenkins reports that the type used in a printf() specifier is
>> >    incorrect, so fix it in order to use the appropriate type.
>> >
>> >    Signed-off-by: Eric Joyner <erj@FreeBSD.org>
>> >
>> >    Reported by:    Jenkins CI
>> >    MFC after:      6 days
>> >    MFC-with:       cdcd52d41e246ba1c0fcfad0769bd691487355ef
>> >    Sponsored by:   Intel Corporation
>> > ---
>> > sys/dev/irdma/icrdma.c | 2 +-
>> > 1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/sys/dev/irdma/icrdma.c b/sys/dev/irdma/icrdma.c
>> > index 7cf441b37648..6867274d1cb8 100644
>> > --- a/sys/dev/irdma/icrdma.c
>> > +++ b/sys/dev/irdma/icrdma.c
>> > @@ -499,7 +499,7 @@ irdma_probe(struct ice_rdma_peer *peer)
>> >       struct irdma_handler *hdl;
>> >       int err = 0;
>> >
>> > -     irdma_pr_info("probe: irdma-%s peer=%p, peer->pf_id=%d,
>> peer->ifp=%p, peer->ifp->if_dunit=%d, peer->pci_mem->r_bustag=%lx\n",
>> > +     irdma_pr_info("probe: irdma-%s peer=%p, peer->pf_id=%d,
>> peer->ifp=%p, peer->ifp->if_dunit=%d, peer->pci_mem->r_bustag=%p\n",
>> >                     irdma_driver_version, peer, peer->pf_id, peer->ifp,
>> >                     pf_if_d(peer), peer->pci_mem->r_bustag);
>>
>> It’s an int on i386, a uint64_t on amd64 and a struct bus_space * on
>> all other architectures, so this just trades breaking non-x86 for
>> breaking x86. You probably want something like
>>
>>   (void *)(uintptr_t)peer->pci_mem->r_bustag
>>
>> as something that’ll work everywhere, that or take it the other
>> direction and forcefully cast it down to an integer type and print that
>> like
>>
>>   (uintmax_t)(uintptr_t)peer->pci_mem->r_bustag
>>
>> with %jx or just
>>
>>   (uintptr_t)peer->pci_mem->r_bustag
>>
>> with PRIxPTR, but we rarely use those macros.
>>
>> Jess
>>
>>
>>