atomic64 on 32-bit vs 64-bit (was: Re: Add virtio gpu driver.)

From: Geert Uytterhoeven
Date: Sun Jun 28 2015 - 05:24:37 EST


On Fri, Jun 26, 2015 at 10:52 PM, Linux Kernel Mailing List
<linux-kernel@xxxxxxxxxxxxxxx> wrote:
> Gitweb: http://git.kernel.org/linus/;a=commit;h=dc5698e80cf724770283e10414054662bdf6ccfa
> Commit: dc5698e80cf724770283e10414054662bdf6ccfa
> Parent: 16e3247da7f71f8c31f4330f739f6192a00c8b51
> Refname: refs/heads/master
> Author: Dave Airlie <airlied@xxxxxxxxx>
> AuthorDate: Mon Sep 9 10:02:56 2013 +1000
> Committer: Gerd Hoffmann <kraxel@xxxxxxxxxx>
> CommitDate: Wed Jun 3 14:17:38 2015 +0200
>
> Add virtio gpu driver.
>
> This patch adds a kms driver for the virtio gpu. The xorg modesetting
> driver can handle the device just fine, the framebuffer for fbcon is
> there too.
>
> Qemu patches for the host side are under review currently.
>
> The pci version of the device comes in two variants: with and without
> vga compatibility. The former has a extra memory bar for the vga
> framebuffer, the later is a pure virtio device. The only concern for
> this driver is that in the virtio-vga case we have to kick out the
> firmware framebuffer.
>
> Initial revision has only 2d support, 3d (virgl) support requires
> some more work on the qemu side and will be added later.
>
> Signed-off-by: Dave Airlie <airlied@xxxxxxxxxx>
> Signed-off-by: Gerd Hoffmann <kraxel@xxxxxxxxxx>
> Acked-by: Michael S. Tsirkin <mst@xxxxxxxxxx>

> --- /dev/null
> +++ b/drivers/gpu/drm/virtio/virtgpu_debugfs.c

> +static int
> +virtio_gpu_debugfs_irq_info(struct seq_file *m, void *data)
> +{
> + struct drm_info_node *node = (struct drm_info_node *) m->private;
> + struct virtio_gpu_device *vgdev = node->minor->dev->dev_private;
> +
> + seq_printf(m, "fence %ld %lld\n",
> + atomic64_read(&vgdev->fence_drv.last_seq),
> + vgdev->fence_drv.sync_seq);

On m68k (32-bit):

drivers/gpu/drm/virtio/virtgpu_debugfs.c: In function
âvirtio_gpu_debugfs_irq_infoâ:
drivers/gpu/drm/virtio/virtgpu_debugfs.c:39: warning: format â%ldâ
expects type âlong intâ, but argument 3 has type âlong long intâ

> --- /dev/null
> +++ b/drivers/gpu/drm/virtio/virtgpu_fence.c

> +static bool virtio_signaled(struct fence *f)
> +{
> + struct virtio_gpu_fence *fence = to_virtio_fence(f);
> +
> + if (atomic64_read(&fence->drv->last_seq) >= fence->seq)
> + return true;

drivers/gpu/drm/virtio/virtgpu_fence.c: In function âvirtio_timeline_value_strâ:
drivers/gpu/drm/virtio/virtgpu_fence.c:64: warning: format â%luâ
expects type âlong unsigned intâ, but argument 4 has type âlong long
intâ

interestingly, this was reported almost one year ago:
https://lists.01.org/pipermail/kbuild-all/2014-September/006409.html

Instead of sprinkling casts, is there any good reason why atomic64_read()
and atomic64_t aren't "long long" everywhere, cfr. u64?

Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/