From nobody Tue Feb 10 15:29:13 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1667578687; cv=none; d=zohomail.com; s=zohoarc; b=Y8xSo7RoxK+1aose+31IoQDbMFyj3BvWiF6s1+NZYRzg3n1xqzppHkfHAJ2HPELYUlzJ7cwilkFDglEw0omcy53LDo5ddr5id1gYcf/wLuWZf2BrX3jfzmrj2gz+BSjO1ntJrrP7IeTv5qgHbG8kDwsRkt1AkNxqas2katLoAnY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667578687; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=DIssiaxZUXp9drHLMQc52wG6/fuhaHC1D5IXSogHJ7w=; b=MrVoZsOFcNR5FNUmFtA0h8m8nKqHeDf1usaaizJawHyjyE+jr/XIEkhiZCByetN1kSHgFqgsseY2IZIc7bC15ZJH6mHGNjtcLjshLk/KDNudnwkgMuXxmepXs6UQk75ZUl4ygx5VGL7XIkssCTN7qwIxVQZj/xkw735ZmhDkfIc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1667578687883548.4435273815972; Fri, 4 Nov 2022 09:18:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oqzMk-00005X-8i; Fri, 04 Nov 2022 12:16:22 -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 1oqzLw-0006UZ-QG for qemu-devel@nongnu.org; Fri, 04 Nov 2022 12:15:38 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oqzLp-0000gb-Ss for qemu-devel@nongnu.org; Fri, 04 Nov 2022 12:15:31 -0400 Received: by mail-wm1-x333.google.com with SMTP id r186-20020a1c44c3000000b003cf4d389c41so5723209wma.3 for ; Fri, 04 Nov 2022 09:15:22 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id ay5-20020a5d6f05000000b0022e57e66824sm4649645wrb.99.2022.11.04.09.15.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 09:15:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DIssiaxZUXp9drHLMQc52wG6/fuhaHC1D5IXSogHJ7w=; b=ufYS2BuzYP8Jzkpt5M+0RiMNbz9d6olyUVYGOpGAPI2iroE7hpTev0qkF9qc4Z1Ngc 4myNvP8LxajOZIScEK9JjCwqHaoezNIVQnrIQu0eiuAb/KdPDRvDRvqLT46vp0LZy4Wr jU1J+41/5SSS9OuwM7nG+i0gizpWzBc5MX6C36LK4xXpPq90018Ruv7i0t/IO2Th9coc old4dPYAfiDJ/ZtjaFF/1GBCZGlmIhl0fIAe6sVME6t53H30sgNLIWlWMgZRM2qAUKsB Ies9pRhASBofBiWieNRYNApARN6rcKbP9WJ8Ud8oTSK0NaUk7pkZbHCe9bI7+0PcxGYx txYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DIssiaxZUXp9drHLMQc52wG6/fuhaHC1D5IXSogHJ7w=; b=7vy7NQuFfCeVcVkIhiBCrnsb0STyzo357VRe8ASKVJLFFDMZ8QowH2GJEqnkKAT79t T4sSADMoSM2eSERk03c/kwOuXtpp6JVj6MKtHmuHUx0nEKc2ac7iGjXX4DFZERi6LsDR YDj4VlIwPB/aW+DPKD8H3+jWli1qT766HhktHs+HOnx802lp3uEGngTIOBFW9GsiUfpq w8KXiCu7t9LOwG/2Fjsf8VVlLLFeVHuhsx6GtmvWEdyNME4IPPRqf0F2qLaKwOKYCkgg 1bcCsph7D+k7+nUcKGC85t158M0fesNAkKOlnvlRh/yqLai+rLrTM9TsE3T26vj8y5Ni ScmQ== X-Gm-Message-State: ACrzQf2MHXVauQpoLzbNB3fft0CnZnwkBHtfpPtHLV7jFp3PO4J3E9Cr AZDUs3/VEGpGzyqDxU1OyMKw53cyOc+MkA== X-Google-Smtp-Source: AMsMyM798tJkPMHvycRkh3rkiei+Kp3C44y4aNR4c8QCxTJvg0D6NP9eS3DmL+CYHK+EMi1XTsj+5w== X-Received: by 2002:a05:600c:3b22:b0:3cf:5eff:c858 with SMTP id m34-20020a05600c3b2200b003cf5effc858mr24416622wms.193.1667578521744; Fri, 04 Nov 2022 09:15:21 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: "Maciej S. Szmigiero" , Gerd Hoffmann , Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Stefano Stabellini , Anthony Perard , Paul Durrant , Mark Cave-Ayland , Matthew Rosato , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org Subject: [PATCH for-8.0 4/9] hw/usb/hcd-xhci: Reset the XHCIState with device_cold_reset() Date: Fri, 4 Nov 2022 16:15:08 +0000 Message-Id: <20221104161513.2455862-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104161513.2455862-1-peter.maydell@linaro.org> References: <20221104161513.2455862-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x333.google.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1667578688290100001 Content-Type: text/plain; charset="utf-8" Currently the hcd-xhci-pci and hcd-xhci-sysbus devices, which are mostly wrappers around the TYPE_XHCI device, which is a direct subclass of TYPE_DEVICE. Since TYPE_DEVICE devices are not on any qbus and do not get automatically reset, the wrapper devices both reset the TYPE_XHCI device in their own reset functions. However, they do this using device_legacy_reset(), which will reset the device itself but not any bus it has. Switch to device_cold_reset(), which avoids using a deprecated function and also propagates reset along any child buses. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- It's possible this might result in USB devices on the bus getting reset more than once (once via the descent-along-qbus and once when xhci_reset() etc manually reset each port), but in my testing with gdb I couldn't get that to happen. It should be harmless anyway. --- hw/usb/hcd-xhci-pci.c | 2 +- hw/usb/hcd-xhci-sysbus.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/usb/hcd-xhci-pci.c b/hw/usb/hcd-xhci-pci.c index e934b1a5b1f..643d4643e4d 100644 --- a/hw/usb/hcd-xhci-pci.c +++ b/hw/usb/hcd-xhci-pci.c @@ -85,7 +85,7 @@ static void xhci_pci_reset(DeviceState *dev) { XHCIPciState *s =3D XHCI_PCI(dev); =20 - device_legacy_reset(DEVICE(&s->xhci)); + device_cold_reset(DEVICE(&s->xhci)); } =20 static int xhci_pci_vmstate_post_load(void *opaque, int version_id) diff --git a/hw/usb/hcd-xhci-sysbus.c b/hw/usb/hcd-xhci-sysbus.c index a14e4381960..faf57b47975 100644 --- a/hw/usb/hcd-xhci-sysbus.c +++ b/hw/usb/hcd-xhci-sysbus.c @@ -29,7 +29,7 @@ void xhci_sysbus_reset(DeviceState *dev) { XHCISysbusState *s =3D XHCI_SYSBUS(dev); =20 - device_legacy_reset(DEVICE(&s->xhci)); + device_cold_reset(DEVICE(&s->xhci)); } =20 static void xhci_sysbus_realize(DeviceState *dev, Error **errp) --=20 2.25.1