qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4] hw/audio/virtio-snd: Always use little endian audio format
@ 2024-04-22 21:18 Philippe Mathieu-Daudé
  2024-06-02 13:39 ` Michael S. Tsirkin
  2024-06-11  7:15 ` Michael Tokarev
  0 siblings, 2 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-22 21:18 UTC (permalink / raw)
  To: qemu-devel
  Cc: Gerd Hoffmann, Manos Pitsidianakis, Michael S. Tsirkin,
	Philippe Mathieu-Daudé, qemu-stable

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(-)

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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v4] hw/audio/virtio-snd: Always use little endian audio format
  2024-04-22 21:18 [PATCH v4] hw/audio/virtio-snd: Always use little endian audio format Philippe Mathieu-Daudé
@ 2024-06-02 13:39 ` Michael S. Tsirkin
  2024-06-11  7:15 ` Michael Tokarev
  1 sibling, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2024-06-02 13:39 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Gerd Hoffmann, Manos Pitsidianakis, qemu-stable

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v4] hw/audio/virtio-snd: Always use little endian audio format
  2024-04-22 21:18 [PATCH v4] hw/audio/virtio-snd: Always use little endian audio format Philippe Mathieu-Daudé
  2024-06-02 13:39 ` Michael S. Tsirkin
@ 2024-06-11  7:15 ` Michael Tokarev
  2024-06-11 12:17   ` Philippe Mathieu-Daudé
  1 sibling, 1 reply; 4+ messages in thread
From: Michael Tokarev @ 2024-06-11  7:15 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Gerd Hoffmann, Manos Pitsidianakis, Michael S. Tsirkin,
	qemu-stable

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. */
>   }
>   
>   /*

-- 
GPG Key transition (from rsa2048 to rsa4096) since 2024-04-24.
New key: rsa4096/61AD3D98ECDF2C8E  9D8B E14E 3F2A 9DD7 9199  28F1 61AD 3D98 ECDF 2C8E
Old key: rsa2048/457CE0A0804465C5  6EE1 95D1 886E 8FFB 810D  4324 457C E0A0 8044 65C5
Transition statement: http://www.corpit.ru/mjt/gpg-transition-2024.txt



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v4] hw/audio/virtio-snd: Always use little endian audio format
  2024-06-11  7:15 ` Michael Tokarev
@ 2024-06-11 12:17   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-11 12:17 UTC (permalink / raw)
  To: Michael Tokarev, qemu-devel
  Cc: Gerd Hoffmann, Manos Pitsidianakis, Michael S. Tsirkin,
	qemu-stable

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!



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-06-11 12:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-22 21:18 [PATCH v4] hw/audio/virtio-snd: Always use little endian audio format Philippe Mathieu-Daudé
2024-06-02 13:39 ` Michael S. Tsirkin
2024-06-11  7:15 ` Michael Tokarev
2024-06-11 12:17   ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).