From a2554a334a92db72547a8d15e9d00dc3d37dd3a1 Mon Sep 17 00:00:00 2001 From: Stanislav Vorobiov Date: Tue, 29 Apr 2014 16:48:47 +0400 Subject: [PATCH 1/2] audio/intel-hda: support FIFORDY linux kernel 3.12 has changed intel-hda driver to always check for FIFORDY, this causes long hangs in guest since QEMU always has this bit set to 0. We now simply set it to 1 always, since we're synchronous anyway and always ready to receive the stream Signed-off-by: Stanislav Vorobiov Signed-off-by: Gerd Hoffmann --- hw/audio/intel-hda.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c index d41f82cec4..9e075c0137 100644 --- a/hw/audio/intel-hda.c +++ b/hw/audio/intel-hda.c @@ -574,7 +574,7 @@ static void intel_hda_set_st_ctl(IntelHDAState *d, const IntelHDAReg *reg, uint3 if (st->ctl & 0x01) { /* reset */ dprint(d, 1, "st #%d: reset\n", reg->stream); - st->ctl = 0; + st->ctl = SD_STS_FIFO_READY << 24; } if ((st->ctl & 0x02) != (old & 0x02)) { uint32_t stnr = (st->ctl >> 20) & 0x0f; @@ -829,6 +829,7 @@ static const struct IntelHDAReg regtab[] = { .wclear = 0x1c000000, \ .offset = offsetof(IntelHDAState, st[_i].ctl), \ .whandler = intel_hda_set_st_ctl, \ + .reset = SD_STS_FIFO_READY << 24 \ }, \ [ ST_REG(_i, ICH6_REG_SD_LPIB) ] = { \ .stream = _i, \ From b1fe60cd3525871a4c593ad8c2b39b89c19c00d0 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Fri, 9 May 2014 14:22:53 +0100 Subject: [PATCH 2/2] hw/audio/intel-hda: Avoid shift into sign bit Add a U suffix to avoid shifting into the sign bit (which is undefined behaviour in C). Signed-off-by: Peter Maydell Signed-off-by: Gerd Hoffmann --- hw/audio/intel-hda.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c index 9e075c0137..3cfb66c5d8 100644 --- a/hw/audio/intel-hda.c +++ b/hw/audio/intel-hda.c @@ -245,7 +245,7 @@ static void intel_hda_update_int_sts(IntelHDAState *d) /* update global status */ if (sts & d->int_ctl) { - sts |= (1 << 31); + sts |= (1U << 31); } d->int_sts = sts; @@ -257,7 +257,7 @@ static void intel_hda_update_irq(IntelHDAState *d) int level; intel_hda_update_int_sts(d); - if (d->int_sts & (1 << 31) && d->int_ctl & (1 << 31)) { + if (d->int_sts & (1U << 31) && d->int_ctl & (1U << 31)) { level = 1; } else { level = 0;