From patchwork Sat Jun 22 07:40:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Wendland X-Patchwork-Id: 13708320 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9CBF5C27C53 for ; Sat, 22 Jun 2024 12:57:32 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sL0I0-0004Ja-P0; Sat, 22 Jun 2024 08:56:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKvSR-00087m-Au for qemu-devel@nongnu.org; Sat, 22 Jun 2024 03:46:48 -0400 Received: from mail-mw2nam12olkn2099.outbound.protection.outlook.com ([40.92.23.99] helo=NAM12-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKvSP-0004DW-Kq for qemu-devel@nongnu.org; Sat, 22 Jun 2024 03:46:47 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AdZddKEMhqZvYEu+r0mf5fWqWqdHTeA6TFm7MPOSiq3JFyEPMZ3j5eKPUY8qQIo9l55iMngPoyypKKRdy6PNHpJ8gOdLdnUcg9pumwWI4uS01PM4b2Iq2yqtvRq7XZUfryFvMMb69rKgh5jSpjvszJBmTnIS+L1r5eRajNjWsjEesKUx1ShtrhlCVCVHrK5ITCldW+lDNG2lyo0Qx1Ao68/FyF5zJ6ZUIZ8budzS3lCqj5GvD7ObgJWOS3wYwQ6j8DeL2PpmMrJd4y0IYFThK3NwveYLhZQl85WTWRh64M4XY+3OeHCoJ/FigNR1Q0XXbb6LJeZ1wsmkoINZMtxlIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mmXQ+Op3WrTaHYmcHws2XBqeNaH/0dqs+mSMStfK3XQ=; b=Kp3IX5eXTkjDKS0RgRFwG/YvXkJvnaGDn+4kWXGY5sZMd9J8Y7GwnGMQb/j242mFp5bC+qkULzB4uqi0JbQyKk1koYyOS7FB2Df74Js4Lq2GRr0YzRpXyvA/4gYKHwuiT8oox+tdgjMilz9JzwpRi1Kx8snIL24MAJJwqvOO3EyNX+DBLHkwsCSF4iaqyuyNKCivYBTZsiL+/FOXdS6MPg6aS1vbYWjHnf3bGBcN/NZPdnZOvGE0ahDjcGs+wp4bldg5DqXC9wPr/+y0Z0Z1YcoG6n/xevglRJBMWWC8yZMdflhVCJyI32Ukhxyytpq37/0Xr0/t6zt8GKVoWGefTw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=LIVE.COM.AU; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mmXQ+Op3WrTaHYmcHws2XBqeNaH/0dqs+mSMStfK3XQ=; b=HvJsBOmh81KCVbrGQKLmOSZzdVV1RCn9twmWQwfnBGqwrSHpIFstB3F7pPE9Et8Ab36WRzneUlImRGs6qedtlMLB2OO/xSvaQWC2VESxJ0aV5cjbmJiUM/gI9M5i4syOg7AQmiPI8SqsDtqny+5iLoEnmyaLxtWD7g5Q3T0m6qZMat4wkDm+CzZ2g3N0/RX1seeWXTr1yjARvl0oajuNiDeRwe0QCYsLrc4Ku3kqFUsKg+qKXyLhMSW2mcU3vvvg1BALXed50ZXOXhfDCNdgW5ihOfnN1JGJJ9m7FLXcrqEX38rBGOFP/36tvGEWTkjRFi1gkUJVguoByvr7IEQcmg== Received: from LV3P220MB1868.NAMP220.PROD.OUTLOOK.COM (2603:10b6:408:1d7::7) by PH7P220MB1534.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:321::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.26; Sat, 22 Jun 2024 07:41:38 +0000 Received: from LV3P220MB1868.NAMP220.PROD.OUTLOOK.COM ([fe80::f559:6351:749f:b7fb]) by LV3P220MB1868.NAMP220.PROD.OUTLOOK.COM ([fe80::f559:6351:749f:b7fb%6]) with mapi id 15.20.7698.017; Sat, 22 Jun 2024 07:41:38 +0000 From: Ryan Wendland To: qemu-devel@nongnu.org Cc: Ryan Wendland Subject: [PATCH] hw/usb/hcd-ohci: Set transfer error code with no dev Date: Sat, 22 Jun 2024 17:10:38 +0930 Message-ID: X-Mailer: git-send-email 2.34.1 X-TMN: [r6V9/W9nYR7aRexWS5h6rf4X4+TN+ZB0] X-ClientProxiedBy: MEWP282CA0176.AUSP282.PROD.OUTLOOK.COM (2603:10c6:220:1cd::13) To LV3P220MB1868.NAMP220.PROD.OUTLOOK.COM (2603:10b6:408:1d7::7) X-Microsoft-Original-Message-ID: <20240622074038.62758-1-wendland@live.com.au> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV3P220MB1868:EE_|PH7P220MB1534:EE_ X-MS-Office365-Filtering-Correlation-Id: 4302ff5f-6851-4e9f-f48d-08dc928ebfcb X-Microsoft-Antispam: BCL:0; ARA:14566002|461199025|4302099010|440099025|3412199022|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exchange-CrossTenant-Network-Message-Id: 4302ff5f-6851-4e9f-f48d-08dc928ebfcb X-MS-Exchange-CrossTenant-AuthSource: LV3P220MB1868.NAMP220.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2024 07:41:38.5203 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7P220MB1534 Received-SPF: pass client-ip=40.92.23.99; envelope-from=wendland@live.com.au; helo=NAM12-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 22 Jun 2024 08:56:19 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org When a usb device is disconnected the transfer service functions bails before appropraite transfer error flags are set. This patch sets the appropriate condition code OHCI_CC_DEVICENOTRESPONDING when a device is disconnected and consequently has no response on the USB bus. Fixes: https://gitlab.com/qemu-project/qemu/-/issues/2081 Signed-off-by: Ryan Wendland --- hw/usb/hcd-ohci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c index acd6016980..8cd25d74af 100644 --- a/hw/usb/hcd-ohci.c +++ b/hw/usb/hcd-ohci.c @@ -980,7 +980,8 @@ static int ohci_service_td(OHCIState *ohci, struct ohci_ed *ed) dev = ohci_find_device(ohci, OHCI_BM(ed->flags, ED_FA)); if (dev == NULL) { trace_usb_ohci_td_dev_error(); - return 1; + OHCI_SET_BM(td.flags, TD_CC, OHCI_CC_DEVICENOTRESPONDING); + goto exit_and_retire; } ep = usb_ep_get(dev, pid, OHCI_BM(ed->flags, ED_EN)); if (ohci->async_td) { @@ -1087,6 +1088,7 @@ static int ohci_service_td(OHCIState *ohci, struct ohci_ed *ed) ed->head |= OHCI_ED_H; } +exit_and_retire: /* Retire this TD */ ed->head &= ~OHCI_DPTR_MASK; ed->head |= td.next & OHCI_DPTR_MASK;