diff mbox series

[v4] hw/audio/virtio-snd: Always use little endian audio format

Message ID 20240422211830.25606-1-philmd@linaro.org
State New
Headers show
Series [v4] hw/audio/virtio-snd: Always use little endian audio format | expand

Commit Message

Philippe Mathieu-Daudé April 22, 2024, 9:18 p.m. UTC
The VIRTIO Sound Device conforms with the Virtio spec v1.2,
thus only use little endianness.

Remove the suspicious target_words_bigendian() noticed during
code review.

Cc: qemu-stable@nongnu.org
Fixes: eb9ad377bb ("virtio-sound: handle control messages and streams")
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
Supersedes: <20240422142056.3023-1-philmd@linaro.org>
v4: always LE (MST)
---
 hw/audio/virtio-snd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Michael S. Tsirkin June 2, 2024, 1:39 p.m. UTC | #1
On Mon, Apr 22, 2024 at 11:18:30PM +0200, Philippe Mathieu-Daudé wrote:
> The VIRTIO Sound Device conforms with the Virtio spec v1.2,
> thus only use little endianness.
> 
> Remove the suspicious target_words_bigendian() noticed during
> code review.
> 
> Cc: qemu-stable@nongnu.org
> Fixes: eb9ad377bb ("virtio-sound: handle control messages and streams")
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>


Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

> ---
> Supersedes: <20240422142056.3023-1-philmd@linaro.org>
> v4: always LE (MST)
> ---
>  hw/audio/virtio-snd.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/hw/audio/virtio-snd.c b/hw/audio/virtio-snd.c
> index c80b58bf5d..ba4fff7302 100644
> --- a/hw/audio/virtio-snd.c
> +++ b/hw/audio/virtio-snd.c
> @@ -24,7 +24,6 @@
>  #include "trace.h"
>  #include "qapi/error.h"
>  #include "hw/audio/virtio-snd.h"
> -#include "hw/core/cpu.h"
>  
>  #define VIRTIO_SOUND_VM_VERSION 1
>  #define VIRTIO_SOUND_JACK_DEFAULT 0
> @@ -401,7 +400,7 @@ static void virtio_snd_get_qemu_audsettings(audsettings *as,
>      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 = 0; /* Conforming to VIRTIO 1.0: always little endian. */
>  }
>  
>  /*
> -- 
> 2.41.0
Michael Tokarev June 11, 2024, 7:15 a.m. UTC | #2
23.04.2024 00:18, Philippe Mathieu-Daudé wrote:
> The VIRTIO Sound Device conforms with the Virtio spec v1.2,
> thus only use little endianness.
> 
> Remove the suspicious target_words_bigendian() noticed during
> code review.
> 
> Cc: qemu-stable@nongnu.org
> Fixes: eb9ad377bb ("virtio-sound: handle control messages and streams")
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Ping?  Is this change still needed?

Thanks,

/mjt

> diff --git a/hw/audio/virtio-snd.c b/hw/audio/virtio-snd.c
> index c80b58bf5d..ba4fff7302 100644
> --- a/hw/audio/virtio-snd.c
> +++ b/hw/audio/virtio-snd.c
> @@ -24,7 +24,6 @@
>   #include "trace.h"
>   #include "qapi/error.h"
>   #include "hw/audio/virtio-snd.h"
> -#include "hw/core/cpu.h"
>   
>   #define VIRTIO_SOUND_VM_VERSION 1
>   #define VIRTIO_SOUND_JACK_DEFAULT 0
> @@ -401,7 +400,7 @@ static void virtio_snd_get_qemu_audsettings(audsettings *as,
>       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 = 0; /* Conforming to VIRTIO 1.0: always little endian. */
>   }
>   
>   /*
Philippe Mathieu-Daudé June 11, 2024, 12:17 p.m. UTC | #3
On 11/6/24 09:15, Michael Tokarev wrote:
> 23.04.2024 00:18, Philippe Mathieu-Daudé wrote:
>> The VIRTIO Sound Device conforms with the Virtio spec v1.2,
>> thus only use little endianness.
>>
>> Remove the suspicious target_words_bigendian() noticed during
>> code review.
>>
>> Cc: qemu-stable@nongnu.org
>> Fixes: eb9ad377bb ("virtio-sound: handle control messages and streams")
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> 
> Ping?  Is this change still needed?

Since Michael reviewed the patch, I'll queue it via the hw-misc tree.

Thanks!
diff mbox series

Patch

diff --git a/hw/audio/virtio-snd.c b/hw/audio/virtio-snd.c
index c80b58bf5d..ba4fff7302 100644
--- a/hw/audio/virtio-snd.c
+++ b/hw/audio/virtio-snd.c
@@ -24,7 +24,6 @@ 
 #include "trace.h"
 #include "qapi/error.h"
 #include "hw/audio/virtio-snd.h"
-#include "hw/core/cpu.h"
 
 #define VIRTIO_SOUND_VM_VERSION 1
 #define VIRTIO_SOUND_JACK_DEFAULT 0
@@ -401,7 +400,7 @@  static void virtio_snd_get_qemu_audsettings(audsettings *as,
     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 = 0; /* Conforming to VIRTIO 1.0: always little endian. */
 }
 
 /*