From patchwork Mon Oct 17 10:58:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 120158 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id EBDBEB6F9F for ; Mon, 17 Oct 2011 21:58:24 +1100 (EST) Received: from localhost ([::1]:48131 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFkti-0005Xj-21 for incoming@patchwork.ozlabs.org; Mon, 17 Oct 2011 06:58:22 -0400 Received: from eggs.gnu.org ([140.186.70.92]:43756) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFktc-0005X9-KF for qemu-devel@nongnu.org; Mon, 17 Oct 2011 06:58:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RFktb-0005z9-Me for qemu-devel@nongnu.org; Mon, 17 Oct 2011 06:58:16 -0400 Received: from mail-ww0-f53.google.com ([74.125.82.53]:50164) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFktb-0005yv-FZ for qemu-devel@nongnu.org; Mon, 17 Oct 2011 06:58:15 -0400 Received: by wwi36 with SMTP id 36so1112750wwi.10 for ; Mon, 17 Oct 2011 03:58:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:mime-version :content-type:content-transfer-encoding; bh=/74dzp0a3t4E3s+o4LFdlEMAS8H9urmUq9MRc6WWVP8=; b=n3ULypHHDUDiyY0VZsf+eBntn26Xsr/Eel2QlS142OllZTrt7uEBYAzYTIWVW75q1m LzwsGbLb3Ts+d2mavhKq8ggEhde9ozngHtBbPebUP+hjrmVa6miEWbqW3QB28OrOHZq2 V1KO+X8mfstFEyfzVQiB6qQu7shHdV4Bbkl3A= Received: by 10.216.230.142 with SMTP id j14mr3692541weq.50.1318849093796; Mon, 17 Oct 2011 03:58:13 -0700 (PDT) Received: from localhost (APoitiers-651-1-241-71.w83-193.abo.wanadoo.fr. [83.193.248.71]) by mx.google.com with ESMTPS id j18sm30416731wbo.6.2011.10.17.03.58.12 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 17 Oct 2011 03:58:12 -0700 (PDT) From: "=?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=" To: qemu-devel@nongnu.org Date: Mon, 17 Oct 2011 12:58:07 +0200 Message-Id: <1318849088-12230-1-git-send-email-marcandre.lureau@redhat.com> X-Mailer: git-send-email 1.7.6.2 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 74.125.82.53 Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Subject: [Qemu-devel] [PATCH 1/2] hda: do not mix output and input streams, RHBZ #740493 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Windows 7 may use the same stream number for input and output. That will result in lot of garbage on playback. The hardcoded value of 4 needs to be in sync with GCAP streams description and IN/OUT registers. Signed-off-by: Marc-André Lureau --- hw/intel-hda.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/intel-hda.c b/hw/intel-hda.c index 4272204..c6a3fec 100644 --- a/hw/intel-hda.c +++ b/hw/intel-hda.c @@ -389,14 +389,15 @@ static bool intel_hda_xfer(HDACodecDevice *dev, uint32_t stnr, bool output, { HDACodecBus *bus = DO_UPCAST(HDACodecBus, qbus, dev->qdev.parent_bus); IntelHDAState *d = container_of(bus, IntelHDAState, codecs); - IntelHDAStream *st = NULL; target_phys_addr_t addr; uint32_t s, copy, left; + IntelHDAStream *st; bool irq = false; - for (s = 0; s < ARRAY_SIZE(d->st); s++) { - if (stnr == ((d->st[s].ctl >> 20) & 0x0f)) { - st = d->st + s; + st = output ? d->st + 4 : d->st; + for (s = 0; s < 4; s++) { + if (stnr == ((st[s].ctl >> 20) & 0x0f)) { + st = st + s; break; } }