[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] hw/audio/virtio-snd: Use device endianness instead of target
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH] hw/audio/virtio-snd: Use device endianness instead of target one |
Date: |
Mon, 22 Apr 2024 15:09:30 +0200 |
User-agent: |
Mozilla Thunderbird |
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-stable@nongnu.org
Fixes: eb9ad377bb ("virtio-sound: handle control messages and streams")
Signed-off-by: Philippe Mathieu-Daudé <philmd@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 :/
}