All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: qemu-devel@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>,
	Manos Pitsidianakis <manos.pitsidianakis@linaro.org>,
	qemu-stable@nongnu.org
Subject: Re: [PATCH v3] hw/audio/virtio-snd: Use device endianness instead of target one
Date: Mon, 22 Apr 2024 17:02:35 -0400	[thread overview]
Message-ID: <20240422170056-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20240422142056.3023-1-philmd@linaro.org>

On Mon, Apr 22, 2024 at 04:20:56PM +0200, 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>



This is all completely bogus. Virtio SND is from Virtio 1.0 only.
It is unconditionally little endian.
If it's not it's a guest bug pls just fix it there.


> ---
> v2: Use virtio_is_big_endian()
> v3: Remove "hw/core/cpu.h
> ---
>  hw/audio/virtio-snd.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/audio/virtio-snd.c b/hw/audio/virtio-snd.c
> index c80b58bf5d..939cd78026 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
> @@ -395,13 +394,15 @@ static uint32_t virtio_snd_get_qemu_freq(uint32_t rate)
>   * Get QEMU Audiosystem compatible audsettings from virtio based pcm stream
>   * params.
>   */
> -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 = virtio_is_big_endian(vdev) ? 1 : 0;
>  }
>  
>  /*
> @@ -464,7 +465,7 @@ static uint32_t virtio_snd_pcm_prepare(VirtIOSound *s, uint32_t stream_id)
>          s->pcm->streams[stream_id] = stream;
>      }
>  
> -    virtio_snd_get_qemu_audsettings(&as, params);
> +    virtio_snd_get_qemu_audsettings(s, &as, params);
>      stream->info.direction = stream_id < s->snd_conf.streams / 2 +
>          (s->snd_conf.streams & 1) ? VIRTIO_SND_D_OUTPUT : VIRTIO_SND_D_INPUT;
>      stream->info.hdr.hda_fn_nid = VIRTIO_SOUND_HDA_FN_NID;
> -- 
> 2.41.0



  parent reply	other threads:[~2024-04-22 21:03 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-22 14:20 [PATCH v3] hw/audio/virtio-snd: Use device endianness instead of target one Philippe Mathieu-Daudé
2024-04-22 20:10 ` Manos Pitsidianakis
2024-04-22 21:02 ` Michael S. Tsirkin [this message]
2024-04-22 21:07   ` Philippe Mathieu-Daudé
2024-04-22 21:11     ` Michael S. Tsirkin
2024-04-23  8:47       ` Manos Pitsidianakis
2024-04-23  9:18         ` Manos Pitsidianakis
2024-04-23 11:05           ` Philippe Mathieu-Daudé
2024-04-24 10:31             ` Mark Cave-Ayland
2024-04-25  6:30               ` Manos Pitsidianakis
2024-04-25  7:49                 ` Mark Cave-Ayland
2024-04-25 10:04                   ` Manos Pitsidianakis
2024-04-25 10:24                     ` Michael S. Tsirkin
2024-04-25 10:26                       ` Manos Pitsidianakis
2024-04-25 10:31                         ` Michael S. Tsirkin
2024-04-25 10:40                         ` Mark Cave-Ayland
2024-04-25 11:15                           ` Philippe Mathieu-Daudé
2024-04-25 11:46                             ` Michael S. Tsirkin
2024-04-25 10:35                     ` Mark Cave-Ayland

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=20240422170056-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=manos.pitsidianakis@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.