[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <53242a04-ef11-4d5b-9c7e-7a34f7ad4274@redhat.com>
Date: Mon, 26 May 2025 12:53:22 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Jason Wang <jasowang@...hat.com>
Cc: netdev@...r.kernel.org, Willem de Bruijn
<willemdebruijn.kernel@...il.com>, Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, "Michael S. Tsirkin" <mst@...hat.com>,
Xuan Zhuo <xuanzhuo@...ux.alibaba.com>, Eugenio Pérez
<eperezma@...hat.com>
Subject: Re: [PATCH net-next 2/8] virtio_pci_modern: allow setting configuring
extended features
On 5/26/25 2:49 AM, Jason Wang wrote:
> On Wed, May 21, 2025 at 6:33 PM Paolo Abeni <pabeni@...hat.com> wrote:
>>
>> The virtio specifications allows for up to 128 bits for the
>> device features. Soon we are going to use some of the 'extended'
>> bits features (above 64) for the virtio_net driver.
>>
>> Extend the virtio pci modern driver to support configuring the full
>> virtio features range, replacing the unrolled loops reading and
>> writing the features space with explicit one bounded to the actual
>> features space size in word.
>>
>> Signed-off-by: Paolo Abeni <pabeni@...hat.com>
>> ---
>> drivers/virtio/virtio_pci_modern_dev.c | 39 +++++++++++++++++---------
>> 1 file changed, 25 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/virtio/virtio_pci_modern_dev.c b/drivers/virtio/virtio_pci_modern_dev.c
>> index 1d34655f6b658..e3025b6fa8540 100644
>> --- a/drivers/virtio/virtio_pci_modern_dev.c
>> +++ b/drivers/virtio/virtio_pci_modern_dev.c
>> @@ -396,12 +396,16 @@ EXPORT_SYMBOL_GPL(vp_modern_remove);
>> virtio_features_t vp_modern_get_features(struct virtio_pci_modern_device *mdev)
>> {
>> struct virtio_pci_common_cfg __iomem *cfg = mdev->common;
>> - virtio_features_t features;
>> + virtio_features_t features = 0;
>> + int i;
>>
>> - vp_iowrite32(0, &cfg->device_feature_select);
>> - features = vp_ioread32(&cfg->device_feature);
>> - vp_iowrite32(1, &cfg->device_feature_select);
>> - features |= ((u64)vp_ioread32(&cfg->device_feature) << 32);
>> + for (i = 0; i < VIRTIO_FEATURES_WORDS; i++) {
>> + virtio_features_t cur;
>> +
>> + vp_iowrite32(i, &cfg->device_feature_select);
>> + cur = vp_ioread32(&cfg->device_feature);
>> + features |= cur << (32 * i);
>> + }
>
> No matter if we decide to go with 128bit or not. I think at the lower
> layer like this, it's time to allow arbitrary length of the features
> as the spec supports.
Is that useful if the vhost interface is not going to support it?
Note that the above code is independent from the feature-space. Defining
larger value of VIRTIO_FEATURES_WORDS it will deal with larger number of
features.
/P
Powered by blists - more mailing lists