On 22/4/24 15:04, Philippe Mathieu-Daudé wrote:
Since VirtIO devices can change endianness at runtime,
we need to use the device endianness, not the target
one.

Cc: qemu-sta...@nongnu.org
Fixes: eb9ad377bb ("virtio-sound: handle control messages and streams")
Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
---
  hw/audio/virtio-snd.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)


-static void virtio_snd_get_qemu_audsettings(audsettings *as,
+static void virtio_snd_get_qemu_audsettings(VirtIOSound *s, audsettings *as,
                                              virtio_snd_pcm_set_params *params)
  {
+    VirtIODevice *vdev = VIRTIO_DEVICE(s);
+
      as->nchannels = MIN(AUDIO_MAX_CHANNELS, params->channels);
      as->fmt = virtio_snd_get_qemu_format(params->format);
      as->freq = virtio_snd_get_qemu_freq(params->rate);
-    as->endianness = target_words_bigendian() ? 1 : 0;
+    as->endianness = vdev->device_endian ? 1 : 0;

Err, I neglected to consider VIRTIO_DEVICE_ENDIAN_UNKNOWN :/

  }


Reply via email to