From patchwork Fri Nov 4 16:15:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 621376 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp360179pvb; Fri, 4 Nov 2022 09:18:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4x840hRsDCT8y/iBv1f9ATiE8yW+JZS9DxDBLqB+9rDjqBzn2avlCblTgkj4AQj1hES2Hl X-Received: by 2002:ac8:7353:0:b0:3a5:22f5:1f56 with SMTP id q19-20020ac87353000000b003a522f51f56mr23790875qtp.328.1667578693297; Fri, 04 Nov 2022 09:18:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667578693; cv=none; d=google.com; s=arc-20160816; b=oesYXmTqxcKTsaYT5s4vVzsJ8hoe9LI3FsuLCoOC66B4Usls4ws1OdU5a9AFT4HwGm NXTzf/cMSoT5cc2w0VxCAhuwReTq9i+/ypF99G8k8VF2j0gCTRJmkfUffJ/Dbf4/a1fT KAGuYPjlyqQhKjgqn2NCUBBRZH+S+D6qv4mckkLS8EglX/9l5d2mqpqr5q24mAAylfJ7 z0a0pnL/G7uzBAe/eT+DkHRJbtviXgrjdRg86H6Xmxe2og6VA0SErugJDk2eArYinRee VBicEiiYT6/3HYrvPnHAEZmny4EFoIXC6J9x01LYlSwBAO+HHt0kr42VS0pDqa6pRlPl mVkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DIssiaxZUXp9drHLMQc52wG6/fuhaHC1D5IXSogHJ7w=; b=vWHtLcxyTF9SAHgMFVYOebIPcy/MmaeAeouD3MKeezaO19PiTebssmYNsGRxHvVF0p z7a9SWonEWmzHmTGTZMbT0YlTeMCLjTDwrFrlj3wJltuMCTnW+Aw6EE3KaHMkhRGV+0i Rmd9LvjEq3UYR/oZsgn9mX0yEPp8QDFHNoDpJ+VsaO6kqc4OP7NxPts7Tlf+69b2VTz7 aEozNLMTqp5Vvaz2Gfc0nwdR2hdfA+CiePVYEAeq7l+sV6UxrEu2uz9GQnErE9ZAKkKs 5Xp/QBEVve544iPzC84BkVC6kYimmYOOuLjkGsXn6j2GBMzgxowNjolNwWuspX1BKGnr MVsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ufYS2Buz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id fv8-20020a056214240800b004b40ccfe68bsi3078554qvb.105.2022.11.04.09.18.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Nov 2022 09:18:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ufYS2Buz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: Peter Maydell To: qemu-devel@nongnu.org Cc: "Maciej S. Szmigiero" , Gerd Hoffmann , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=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 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+patch=linaro.org@nongnu.org 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é --- 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 = XHCI_PCI(dev); - device_legacy_reset(DEVICE(&s->xhci)); + device_cold_reset(DEVICE(&s->xhci)); } 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 = XHCI_SYSBUS(dev); - device_legacy_reset(DEVICE(&s->xhci)); + device_cold_reset(DEVICE(&s->xhci)); } static void xhci_sysbus_realize(DeviceState *dev, Error **errp)