From: "Michael S. Tsirkin" <mst@redhat.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
"Paolo Abeni" <pabeni@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"Eugenio Pérez" <eperezma@redhat.com>,
"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
"Jonathan Corbet" <corbet@lwn.net>,
kvm@vger.kernel.org, virtualization@lists.linux.dev,
linux-doc@vger.kernel.org
Subject: Re: [PATCH v2 1/2] virtio: clean up features qword/dword terms
Date: Wed, 22 Oct 2025 01:38:39 -0400 [thread overview]
Message-ID: <20251022013753-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <8138fb02-f7c5-4c83-a4cb-d86412d8c048@lunn.ch>
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
prev parent reply other threads:[~2025-10-22 5:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-21 14:56 [PATCH v2 0/2] virtio: feature related cleanups Michael S. Tsirkin
2025-10-21 14:56 ` [PATCH v2 1/2] virtio: clean up features qword/dword terms Michael S. Tsirkin
2025-10-21 14:56 ` [PATCH v2 2/2] vhost: use checked versions of VIRTIO_BIT Michael S. Tsirkin
2025-10-22 2:20 ` [PATCH v2 1/2] virtio: clean up features qword/dword terms Andrew Lunn
2025-10-22 5:38 ` Michael S. Tsirkin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251022013753-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=andrew@lunn.ch \
--cc=corbet@lwn.net \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).