From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: kvm@suse.de, qemu-stable@nongnu.org,
"Bruce Rogers" <brogers@suse.com>,
"Marc-Andr? Lureau" <marcandre.lureau@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@gmail.com>,
"Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [PATCH stable-0.15 20/36] hda: do not mix output and input stream states, RHBZ #740493
Date: Wed, 28 Mar 2012 14:52:23 +0200 [thread overview]
Message-ID: <1332939159-16434-21-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1332939159-16434-1-git-send-email-afaerber@suse.de>
From: Marc-André Lureau <marcandre.lureau@gmail.com>
Windows 7 may use the same stream number for input and output.
Current code will confuse streams.
Changes since v1:
- keep running_compat[] for migration version 1
- add running_real[] for migration version 2
Signed-off-by: Marc-Andr? Lureau <marcandre.lureau@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
(cherry picked from commit ba43d28916c4f51c19bd7366089155ce81bee058)
Signed-off-by: Bruce Rogers <brogers@suse.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
hw/hda-audio.c | 26 +++++++++++++++++++-------
hw/intel-hda.c | 9 +++++----
hw/intel-hda.h | 2 +-
3 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/hw/hda-audio.c b/hw/hda-audio.c
index c699d6f..9b089e6 100644
--- a/hw/hda-audio.c
+++ b/hw/hda-audio.c
@@ -466,7 +466,8 @@ struct HDAAudioState {
QEMUSoundCard card;
const desc_codec *desc;
HDAAudioStream st[4];
- bool running[16];
+ bool running_compat[16];
+ bool running_real[2 * 16];
/* properties */
uint32_t debug;
@@ -663,7 +664,7 @@ static void hda_audio_command(HDACodecDevice *hda, uint32_t nid, uint32_t data)
st->channel = payload & 0x0f;
dprint(a, 2, "%s: stream %d, channel %d\n",
st->node->name, st->stream, st->channel);
- hda_audio_set_running(st, a->running[st->stream]);
+ hda_audio_set_running(st, a->running_real[st->output * 16 + st->stream]);
hda_codec_response(hda, true, 0);
break;
case AC_VERB_GET_CONV:
@@ -746,16 +747,20 @@ fail:
hda_codec_response(hda, true, 0);
}
-static void hda_audio_stream(HDACodecDevice *hda, uint32_t stnr, bool running)
+static void hda_audio_stream(HDACodecDevice *hda, uint32_t stnr, bool running, bool output)
{
HDAAudioState *a = DO_UPCAST(HDAAudioState, hda, hda);
int s;
- a->running[stnr] = running;
+ a->running_compat[stnr] = running;
+ a->running_real[output * 16 + stnr] = running;
for (s = 0; s < ARRAY_SIZE(a->st); s++) {
if (a->st[s].node == NULL) {
continue;
}
+ if (a->st[s].output != output) {
+ continue;
+ }
if (a->st[s].stream != stnr) {
continue;
}
@@ -837,6 +842,12 @@ static int hda_audio_post_load(void *opaque, int version)
int i;
dprint(a, 1, "%s\n", __FUNCTION__);
+ if (version == 1) {
+ /* assume running_compat[] is for output streams */
+ for (i = 0; i < ARRAY_SIZE(a->running_compat); i++)
+ a->running_real[16 + i] = a->running_compat[i];
+ }
+
for (i = 0; i < ARRAY_SIZE(a->st); i++) {
st = a->st + i;
if (st->node == NULL)
@@ -844,7 +855,7 @@ static int hda_audio_post_load(void *opaque, int version)
hda_codec_parse_fmt(st->format, &st->as);
hda_audio_setup(st);
hda_audio_set_amp(st);
- hda_audio_set_running(st, a->running[st->stream]);
+ hda_audio_set_running(st, a->running_real[st->output * 16 + st->stream]);
}
return 0;
}
@@ -868,13 +879,14 @@ static const VMStateDescription vmstate_hda_audio_stream = {
static const VMStateDescription vmstate_hda_audio = {
.name = "hda-audio",
- .version_id = 1,
+ .version_id = 2,
.post_load = hda_audio_post_load,
.fields = (VMStateField []) {
VMSTATE_STRUCT_ARRAY(st, HDAAudioState, 4, 0,
vmstate_hda_audio_stream,
HDAAudioStream),
- VMSTATE_BOOL_ARRAY(running, HDAAudioState, 16),
+ VMSTATE_BOOL_ARRAY(running_compat, HDAAudioState, 16),
+ VMSTATE_BOOL_ARRAY_V(running_real, HDAAudioState, 2 * 16, 2),
VMSTATE_END_OF_LIST()
}
};
diff --git a/hw/intel-hda.c b/hw/intel-hda.c
index 7d02558..904e4fc 100644
--- a/hw/intel-hda.c
+++ b/hw/intel-hda.c
@@ -485,7 +485,7 @@ static void intel_hda_parse_bdl(IntelHDAState *d, IntelHDAStream *st)
st->bp = 0;
}
-static void intel_hda_notify_codecs(IntelHDAState *d, uint32_t stream, bool running)
+static void intel_hda_notify_codecs(IntelHDAState *d, uint32_t stream, bool running, bool output)
{
DeviceState *qdev;
HDACodecDevice *cdev;
@@ -493,7 +493,7 @@ static void intel_hda_notify_codecs(IntelHDAState *d, uint32_t stream, bool runn
QLIST_FOREACH(qdev, &d->codecs.qbus.children, sibling) {
cdev = DO_UPCAST(HDACodecDevice, qdev, qdev);
if (cdev->info->stream) {
- cdev->info->stream(cdev, stream, running);
+ cdev->info->stream(cdev, stream, running, output);
}
}
}
@@ -567,6 +567,7 @@ static void intel_hda_set_ics(IntelHDAState *d, const IntelHDAReg *reg, uint32_t
static void intel_hda_set_st_ctl(IntelHDAState *d, const IntelHDAReg *reg, uint32_t old)
{
+ bool output = reg->stream >= 4;
IntelHDAStream *st = d->st + reg->stream;
if (st->ctl & 0x01) {
@@ -582,11 +583,11 @@ static void intel_hda_set_st_ctl(IntelHDAState *d, const IntelHDAReg *reg, uint3
dprint(d, 1, "st #%d: start %d (ring buf %d bytes)\n",
reg->stream, stnr, st->cbl);
intel_hda_parse_bdl(d, st);
- intel_hda_notify_codecs(d, stnr, true);
+ intel_hda_notify_codecs(d, stnr, true, output);
} else {
/* stop */
dprint(d, 1, "st #%d: stop %d\n", reg->stream, stnr);
- intel_hda_notify_codecs(d, stnr, false);
+ intel_hda_notify_codecs(d, stnr, false, output);
}
}
intel_hda_update_irq(d);
diff --git a/hw/intel-hda.h b/hw/intel-hda.h
index 4e44e38..65fd2a8 100644
--- a/hw/intel-hda.h
+++ b/hw/intel-hda.h
@@ -34,7 +34,7 @@ struct HDACodecDeviceInfo {
int (*init)(HDACodecDevice *dev);
int (*exit)(HDACodecDevice *dev);
void (*command)(HDACodecDevice *dev, uint32_t nid, uint32_t data);
- void (*stream)(HDACodecDevice *dev, uint32_t stnr, bool running);
+ void (*stream)(HDACodecDevice *dev, uint32_t stnr, bool running, bool output);
};
void hda_codec_bus_init(DeviceState *dev, HDACodecBus *bus,
--
1.7.7
next prev parent reply other threads:[~2012-03-28 12:53 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-28 12:52 [Qemu-devel] [PATCH stable-0.15 00/36] Preparing 0.15.2 Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 01/36] ccid: Fix buffer overrun in handling of VSC_ATR message Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 02/36] qdev: Reset hot-plugged devices Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 03/36] e1000: use MII status register for link up/down Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 04/36] e1000: Don't set the Capabilities List bit Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 05/36] e1000: bounds packet size against buffer size Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 06/36] compatfd.c: Don't pass NULL pointer to SYS_signalfd Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 07/36] kvm: avoid reentring kvm_flush_coalesced_mmio_buffer() Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 08/36] vmdk: vmdk_read_cid returns garbage if p_name is NULL Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 09/36] block: Fix bdrv_open use after free Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 10/36] ide: Fix off-by-one error in array index check Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 11/36] acl: Fix use after free in qemu_acl_reset() Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 12/36] migration: flush migration data to disk Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 13/36] Fix X86 CPU topology in KVM mode Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 14/36] hw/lan9118.c: Add missing 'break' to fix buffer overrun Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 15/36] ac97: don't override the pci subsystem id Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 16/36] vvfat: Fix potential buffer overflow Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 17/36] vns/tls: don't use depricated gnutls functions Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 18/36] block/curl: Implement a flush function on the fd handlers Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 19/36] hda: do not mix output and input streams, RHBZ #740493 Andreas Färber
2012-03-28 12:52 ` Andreas Färber [this message]
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 21/36] Teach block/vdi about "discarded" (no longer allocated) blocks Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 22/36] vmdk: Improve error handling Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 23/36] block: set bs->read_only before .bdrv_open() Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 24/36] console: Fix rendering of VGA underline Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 25/36] block: Fix vpc initialization of the Dynamic Disk Header Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 26/36] qcow: Fix bdrv_write_compressed error handling Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 27/36] block: reinitialize across bdrv_close()/bdrv_open() Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 28/36] qxl: stride fixup Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 29/36] vmdk: Fix possible segfaults Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 30/36] pc: Fix floppy drives with if=none Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 31/36] cpu-common: Have a ram_addr_t of uint64 with Xen Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 32/36] Error check find_ram_offset Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 33/36] pc: add pc-0.15 Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 34/36] pc: fix event_idx compatibility for virtio devices Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 35/36] Add missing trace call to oslib-posix.c:qemu_vmalloc() Andreas Färber
2012-03-28 12:52 ` [Qemu-devel] [PATCH stable-0.15 36/36] qemu_vmalloc: align properly for transparent hugepages and KVM Andreas Färber
2012-03-28 17:06 ` [Qemu-devel] [PATCH stable-0.15 00/36] Preparing 0.15.2 Stefan Weil
2012-06-10 22:11 ` Andreas Färber
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=1332939159-16434-21-git-send-email-afaerber@suse.de \
--to=afaerber@suse.de \
--cc=brogers@suse.com \
--cc=kvm@suse.de \
--cc=marcandre.lureau@gmail.com \
--cc=marcandre.lureau@redhat.com \
--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 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).