lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <699dcc4f-dd49-43cb-a998-87eeee15b676@redhat.com>
Date: Thu, 19 Jun 2025 16:56:31 +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>, Yuri Benditovich <yuri.benditovich@...nix.com>,
 Akihiko Odaki <akihiko.odaki@...nix.com>
Subject: Re: [PATCH v4 net-next 2/8] virtio_pci_modern: allow configuring
 extended features

On 6/18/25 4:27 AM, Jason Wang wrote:
> On Wed, Jun 18, 2025 at 12:12 AM Paolo Abeni <pabeni@...hat.com> wrote:
>> /*
>> - * vp_modern_get_features - get features from device
>> + * vp_modern_get_extended_features - get features from device
>>   * @mdev: the modern virtio-pci device
>> + * @features: the features array to be filled
>>   *
>> - * Returns the features read from the device
>> + * Fill the specified features array with the features read from the device
>>   */
>> -u64 vp_modern_get_features(struct virtio_pci_modern_device *mdev)
>> +void vp_modern_get_extended_features(struct virtio_pci_modern_device *mdev,
>> +                                    u64 *features)
>>  {
>>         struct virtio_pci_common_cfg __iomem *cfg = mdev->common;
>> +       int i;
>>
>> -       u64 features;
>> +       virtio_features_zero(features);
>> +       for (i = 0; i < VIRTIO_FEATURES_WORDS; i++) {
>> +               u64 cur;
>>
>> -       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);
>> -
>> -       return features;
>> +               vp_iowrite32(i, &cfg->device_feature_select);
>> +               cur = vp_ioread32(&cfg->device_feature);
>> +               features[i >> 1] |= cur << (32 * (i & 1));
> 
> Nit: why not simply cast features to u32 * then everything is simplified.

I can be (and usually I am) low on coffee, but I think that will work
only for BE architectures.

/P


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ