From: Konstantin Shkolnyy <kshk@linux.ibm.com>
To: dtatulea@nvidia.com
Cc: virtualization@lists.linux.dev, linux-kernel@vger.kernel.org,
mjrosato@linux.ibm.com, mst@redhat.com, jasowang@redhat.com,
Konstantin Shkolnyy <kshk@linux.ibm.com>
Subject: [PATCH] vdpa/mlx5: Fix mlx5_vdpa_get_config() endianness on big-endian machines.
Date: Thu, 30 Jan 2025 15:43:37 -0600 [thread overview]
Message-ID: <20250130214337.12881-1-kshk@linux.ibm.com> (raw)
mlx5_vdpa_dev_add() doesn’t initialize mvdev->actual_features. It’s
initialized later by mlx5_vdpa_set_driver_features(). However,
mlx5_vdpa_get_config() depends on the VIRTIO_F_VERSION_1 flag in
actual_features to return data with correct endianness. When it’s called
before mlx5_vdpa_set_driver_features(), the flag is clear, and the data are
returned as big-endian on big-endian machines, while QEMU interprets them
as little-endian.
Signed-off-by: Konstantin Shkolnyy <kshk@linux.ibm.com>
---
drivers/vdpa/mlx5/net/mlx5_vnet.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
index 36099047560d..f9ea240b8145 100644
--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
+++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
@@ -3884,6 +3884,7 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,
ndev->mvdev.max_vqs = max_vqs;
mvdev = &ndev->mvdev;
mvdev->mdev = mdev;
+ mvdev->actual_features = device_features;
ndev->vqs = kcalloc(max_vqs, sizeof(*ndev->vqs), GFP_KERNEL);
ndev->event_cbs = kcalloc(max_vqs + 1, sizeof(*ndev->event_cbs), GFP_KERNEL);
--
2.34.1
next reply other threads:[~2025-01-30 21:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-30 21:43 Konstantin Shkolnyy [this message]
2025-01-31 7:57 ` [PATCH] vdpa/mlx5: Fix mlx5_vdpa_get_config() endianness on big-endian machines Dragos Tatulea
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=20250130214337.12881-1-kshk@linux.ibm.com \
--to=kshk@linux.ibm.com \
--cc=dtatulea@nvidia.com \
--cc=jasowang@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mjrosato@linux.ibm.com \
--cc=mst@redhat.com \
--cc=virtualization@lists.linux.dev \
/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