From patchwork Mon Jul 31 23:48:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Jaroslav_Jindr=C3=A1k?= X-Patchwork-Id: 9873601 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6F85F60224 for ; Tue, 1 Aug 2017 02:59:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59DF328609 for ; Tue, 1 Aug 2017 02:59:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B5962860D; Tue, 1 Aug 2017 02:59:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C641928609 for ; Tue, 1 Aug 2017 02:59:55 +0000 (UTC) Received: from localhost ([::1]:34186 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcNPV-0004cZ-Cp for patchwork-qemu-devel@patchwork.kernel.org; Mon, 31 Jul 2017 22:59:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55864) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcKQE-0005D3-32 for qemu-devel@nongnu.org; Mon, 31 Jul 2017 19:48:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcKQD-0000Ne-5Y for qemu-devel@nongnu.org; Mon, 31 Jul 2017 19:48:26 -0400 Received: from mail-ua0-x22f.google.com ([2607:f8b0:400c:c08::22f]:37944) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dcKQC-0000N7-Vo for qemu-devel@nongnu.org; Mon, 31 Jul 2017 19:48:25 -0400 Received: by mail-ua0-x22f.google.com with SMTP id w45so333457uac.5 for ; Mon, 31 Jul 2017 16:48:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=FW/zy0Mn8IURL+BEQKFh7p/pQfZZR7MJCgq1x90klCI=; b=d+5Ir0XHZcfh889R62lQ9+mz8F4xw6X9Tw0eDxa4T4qzBMgHuiD9WFFYxcR7sTAavR 1k+tVSrBGq8R2cLOyPEBaGMVQlLDmIYpVxr90iutj3FkshjChHbIrcTkfF/F+xrWZVlQ +LtoxC4eKtudx40461TvM3Fr5Nss/ToNIZ0GCQjKketbcGuWQ4xBs9sixuPKZcISQ1U9 y4gPmuHQ3NOJsOAlGwpxDqQOu5Pt+Qjjxxm4i4VLEZRnarB9LX0rVKqD5rNXv19I93ZB eLMwVSPYe3inuhCEdzycWt8bVQK0Wba0zKU+gLw7jlXoW0G7BPSQ6l4Yo2YcXdMIQDDJ 7zoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=FW/zy0Mn8IURL+BEQKFh7p/pQfZZR7MJCgq1x90klCI=; b=RhyPx412UQTrlPCb5bUWFkB/QfZXUFeFs1+b2NJ2HHyUmKTcHCn2BCa3zV17+AenaY hr/f6klYW7deYHceoNfbT7z0OXbqAomvpnpj3CpFGns1I10XyZ/zyVagLcMgjukpqQO6 kq6CKoAdBxoFcvy+aVPFIW7/4ygBRhkDYGYSl6enMO6ZJs7tkD2Jvgxiz7UaMcP6op8h XcRSUHe7n/Pbs2nTwu9JnUVprLrGDgldMyiOsH6SlSVdWbq/Am7PxjfWtRO12oJtoBGS O+v9RlsMsTnMSHlsNBC2EuldBLo2BwCjkamcieR5/NZndmDR2ardvsjcdjk14ETeuSnK MFiQ== X-Gm-Message-State: AIVw113ROGt0tKd8bvtZmNs8aJ/u29ohnc5dg3NooQm4tYe98ve8b+sy KZm0ZHp7W8ImzG/L1H+94shCRkZjCw== X-Received: by 10.176.77.96 with SMTP id k32mr10251947uag.39.1501544902341; Mon, 31 Jul 2017 16:48:22 -0700 (PDT) MIME-Version: 1.0 Received: by 10.31.221.71 with HTTP; Mon, 31 Jul 2017 16:48:21 -0700 (PDT) From: =?UTF-8?Q?Jaroslav_Jindr=C3=A1k?= Date: Tue, 1 Aug 2017 01:48:21 +0200 Message-ID: To: qemu-devel@nongnu.org X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400c:c08::22f X-Mailman-Approved-At: Mon, 31 Jul 2017 22:59:06 -0400 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: [Qemu-devel] xhci: move command stop and command abort flag check to the case when the crcr_low register is set X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kraxel@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Hello, I'd like to submit a patch to the xhci subsystem of QEMU. Currently, when the command stop or command abort flags in the crcr_low register are set, nothing happens. This is because the part of the code that tests those two flags (and performs command ring abort/stop) is in the crcr_high case. This error has a simple workaround - after writing to the crcr_low register with either of these two flags set, one can write the value of crcr_high to crcr_high, so I assume this fix does not have that big of a priority, but a driver that follows the specification strictly would misbehave in this kind of situation (stopping/aborting the command ring). The patch is contained in the attachement. ​Kind​ regards, Jaroslav Jindrak From b18a165f3c70c6154944706bd096fb002a9b4461 Mon Sep 17 00:00:00 2001 From: Dzejrou Date: Tue, 1 Aug 2017 01:30:49 +0200 Subject: [PATCH 1/1] xhci: move command stop and command abort flag check to the case when the crcr_low register is set Signed-off-by: Dzejrou --- hw/usb/hcd-xhci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index 204ea69..9eb3c83 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -2937,9 +2937,6 @@ static void xhci_oper_write(void *ptr, hwaddr reg, break; case 0x18: /* CRCR low */ xhci->crcr_low = (val & 0xffffffcf) | (xhci->crcr_low & CRCR_CRR); - break; - case 0x1c: /* CRCR high */ - xhci->crcr_high = val; if (xhci->crcr_low & (CRCR_CA|CRCR_CS) && (xhci->crcr_low & CRCR_CRR)) { XHCIEvent event = {ER_COMMAND_COMPLETE, CC_COMMAND_RING_STOPPED}; xhci->crcr_low &= ~CRCR_CRR; @@ -2951,6 +2948,9 @@ static void xhci_oper_write(void *ptr, hwaddr reg, } xhci->crcr_low &= ~(CRCR_CA | CRCR_CS); break; + case 0x1c: /* CRCR high */ + xhci->crcr_high = val; + break; case 0x30: /* DCBAAP low */ xhci->dcbaap_low = val & 0xffffffc0; break; -- 2.4.11