[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251022013753-mutt-send-email-mst@kernel.org>
Date: Wed, 22 Oct 2025 01:38:39 -0400
From: "Michael S. Tsirkin" <mst@...hat.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
Paolo Abeni <pabeni@...hat.com>, Jason Wang <jasowang@...hat.com>,
Eugenio Pérez <eperezma@...hat.com>,
Xuan Zhuo <xuanzhuo@...ux.alibaba.com>,
Jonathan Corbet <corbet@....net>, kvm@...r.kernel.org,
virtualization@...ts.linux.dev, linux-doc@...r.kernel.org
Subject: Re: [PATCH v2 1/2] virtio: clean up features qword/dword terms
On Wed, Oct 22, 2025 at 04:20:52AM +0200, Andrew Lunn wrote:
> > @@ -1752,7 +1752,7 @@ static long vhost_net_ioctl(struct file *f, unsigned int ioctl,
> >
> > /* Copy the net features, up to the user-provided buffer size */
> > argp += sizeof(u64);
> > - copied = min(count, VIRTIO_FEATURES_DWORDS);
> > + copied = min(count, (u64)VIRTIO_FEATURES_ARRAY_SIZE);
>
> Why is the cast needed? Why was 2 O.K, but (128 >> 6) needs a cast?
It's not - a leftover from one of the approaches I tried, thanks!
> > -#define VIRTIO_FEATURES_DWORDS 2
> > -#define VIRTIO_FEATURES_MAX (VIRTIO_FEATURES_DWORDS * 64)
> > -#define VIRTIO_FEATURES_WORDS (VIRTIO_FEATURES_DWORDS * 2)
> > +#define VIRTIO_FEATURES_BITS (128)
> > #define VIRTIO_BIT(b) BIT_ULL((b) & 0x3f)
> > -#define VIRTIO_DWORD(b) ((b) >> 6)
> > +#define VIRTIO_U64(b) ((b) >> 6)
> > +
> > +#define VIRTIO_FEATURES_ARRAY_SIZE VIRTIO_U64(VIRTIO_FEATURES_BITS)
>
> Andrew
Powered by blists - more mailing lists