Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp3095842rdb; Tue, 13 Feb 2024 06:52:20 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV0U214IefxZiVCJQDFEVh2XX0jNhQ5h0h8foltJSzooaZY24VL+N3FeVzvIXQ596OVxXXjjMGmPZ0EJKsyP1DGAkm/v0MOm+6ggiM0cg== X-Google-Smtp-Source: AGHT+IHAi8hr/DFfuswvEZl5N96c/V6FDSiyGHzBecDJilAAeePH9sW5G26/9OrX6NWkT8lJHjc7 X-Received: by 2002:a05:6358:7e07:b0:17a:ec6c:4234 with SMTP id o7-20020a0563587e0700b0017aec6c4234mr3573878rwm.10.1707835940061; Tue, 13 Feb 2024 06:52:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707835940; cv=pass; d=google.com; s=arc-20160816; b=oBN/KsSrUmaiFcVyKJ3+pgmqS7gRHCs3BoVQHEu7dIGJ610BwJZHGuhayTwONELIS1 aP6GfujwKKY7MLCv+pfJqgz7hkB07fL8wXcWBEYSKPFbTnm42eLSAD5gHaGxbNnJVO4k iEB3/ZazpqtHVohbK+ZpH+lfe0jNd6211urnk9PTHOfXBDMB3+l2ZCxHHNIWvc5AHjAM GndPc/zhkr/TJUmpKVAhiydfv2ATu95t5yhQC+tqHz+8KK/IFOO3HveXHruZDxGo227x XGqjcAKIckdgqPf8sPs0fSIYWYGZHvx4Fg21JTuM94lI2qwfQdsXELjVhEdJvKmxnzUm qNBA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=DIriFNrO5RwDl0i8OFgd8O5e6yhYA4cnaSts661zHg4=; fh=7dOZH2aqjSnhqOe9tLwOmQdg/bdePVMUct4KSEeLxmA=; b=KWZ+7EMCRS0MDldpeCU9fTr6WOrIAO6QHZcgXCitoo6d3nQvuNuh+pjgKqg8XjVbON SBdIA8CwOPNoNbEakcRghcM7606Oo2gz0nk/x5nMrgCw+sos72wUjh8BMvmiR3y0rpNS P3w6Zu695oOOYc0Q9N0zop5IpViMqwURxp4X5wDCkNquargWXw+binkz2dLTSV93ya9b Ma3ZaRUMBpND1bYFOLd1nhdpgrMtEEmo9cDq2sbHw3olswtBmzeNaW7t2soE+zGIoBtr ZpEOSDuzUIVRiaH5znRMJGFpnBpKuEukGXV2tztfe9CI/BkCGA9o3phlObaUBGe/cDxd b/eg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mwa.re header.s=google header.b=XltMvdij; arc=pass (i=1 spf=pass spfdomain=mwa.re dkim=pass dkdomain=mwa.re dmarc=pass fromdomain=mwa.re); spf=pass (google.com: domain of linux-kernel+bounces-63716-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63716-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mwa.re X-Forwarded-Encrypted: i=2; AJvYcCW1LTk3dQXFwbZC8RHX2ZOybd7y5hn/Jv5BpapWNHUuqscd8/XRbU5aWQWKA0cNLIoV8CiZM/7TiIWOGToEv0wqISc5gg7ghPH9Dshi4Q== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id r23-20020a638f57000000b005dc42755280si832771pgn.890.2024.02.13.06.52.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 06:52:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63716-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@mwa.re header.s=google header.b=XltMvdij; arc=pass (i=1 spf=pass spfdomain=mwa.re dkim=pass dkdomain=mwa.re dmarc=pass fromdomain=mwa.re); spf=pass (google.com: domain of linux-kernel+bounces-63716-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63716-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mwa.re Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7465028BE78 for ; Tue, 13 Feb 2024 14:51:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1E3295A7B3; Tue, 13 Feb 2024 14:50:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=mwa.re header.i=@mwa.re header.b="XltMvdij" Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63D855EE69 for ; Tue, 13 Feb 2024 14:50:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707835837; cv=none; b=UMvgz2oYagMY6yw3pl8VdObLcqybaWcegCBULoGJhpj9N3W6YH8nZ8LDaI4ktnQa+orYh8RiB27rWiWRW86cXBAenZNce03SoBGUiukkwc7TasUBT/XUlBsqIRBq4MfB5mq3alypglwNxz8n9nzG3S0rC7YwfKpCJHeVV8t1FR4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707835837; c=relaxed/simple; bh=CZoN3i7XJzre4jd4qikn3fslxobuEEEJDNql/BAQ0/Y=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=aAbeqZNGsPBi36Qy7aKl6rSsmhFjJENw9sZBDU3XG/qOH/QcmqGtj2AQ39V47/rttLE4HQizVtzgdvk3dZxtndoI5etOhDuA0Wf6Tlpi8oLm8zUmK4JLRAN5Tpig4fiflniynp6qyvWa+SZsEoAv9lxctJFup+gupuTZfQVx21E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mwa.re; spf=pass smtp.mailfrom=mwa.re; dkim=pass (2048-bit key) header.d=mwa.re header.i=@mwa.re header.b=XltMvdij; arc=none smtp.client-ip=209.85.167.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mwa.re Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mwa.re Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-5114c05806eso7103102e87.1 for ; Tue, 13 Feb 2024 06:50:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mwa.re; s=google; t=1707835833; x=1708440633; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=DIriFNrO5RwDl0i8OFgd8O5e6yhYA4cnaSts661zHg4=; b=XltMvdijGPwlIJbJKI9asq1MbMVkCeNT6bgaLoL9drYtnRSDorpL62fRPTcdXFMK1y ZcGbuaEjW/qqnhxKkWYmU6agO9KzyE14mcAYP8tXhaXytqzeHg1r/YTRAmP4zFd9w1Zf CD9gpTpQ2f72nqCWfoKpO7tQ7j4ly7KQDixtgCkPIdavEpTlaRKCJaYpS8dRs4J+o97B eFXpFVE9SBB7H1L7dp6peC6RpT/CIdfZUDJPu9fRpJqj54V7nPObg2COnUx/w4lbozs1 OU2s9Pl2s+iMeVUA5uLIJE9iNqy0Gc2If3aERiSIyJ0biLuVQ72Ir/AODdmb47T29hJI vRHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707835833; x=1708440633; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DIriFNrO5RwDl0i8OFgd8O5e6yhYA4cnaSts661zHg4=; b=pDrok7hi0dLvQpUwTDHSTE5Phv7O2826kojYlAl9f8jOsHOJkcuvAKAxto6S05Vcli 7WztGPyCuxOogDQmBxA3EPK+y+FgslcntH5qVXkjdbtbMyf7lB1Y3/x3gnL2dhT93JLG txYe5muhQyeUjpNgYbvpza7NlVMP2XXdifBbugcmC2N5pUiZYYOc7OYPEJOD6Pw3/dXs 4rejvtbNw+FGu5PTaN2LB1PrzHxcE7mcuU5EwvTcdgIlnAtbQp4bnuTQRdAaxFWn+IGd WmELZxwtSxyd+shSDyd1ULtKNaKtdpvM9sk+/4uVbXhwwF1yS4EfM+hesREJECT2mKCK +qvg== X-Forwarded-Encrypted: i=1; AJvYcCVHBjIvBGKdCKudRGzSgYG5a2DO4pzoTkvzFWkXJE+TSdzirJftIDnaJ5mVURWmFq6B2oM+7mt4riEnhGNWBoE8N9g0kWDWnDX+QM/4 X-Gm-Message-State: AOJu0Yx5py3xSVSfvIDnfeVLa916azCCGEEnlWrCac+okxnPDgiL2HfC FPL4IItab6CMwLbImUohFELr67AeS+JmcM7NRn7vqSHZGyk5t9PT8gWpuLLDUrnE+vmMPhsy32u 3bdTuqDVQ4UDAcql6t7nqsgofhHzAH/TbkDiiPw== X-Received: by 2002:ac2:41ca:0:b0:511:1ed7:61b8 with SMTP id d10-20020ac241ca000000b005111ed761b8mr6948902lfi.30.1707835833350; Tue, 13 Feb 2024 06:50:33 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <1b2558f7-94ea-123e-dd3f-b43ecd85c2ef@linux.intel.com> In-Reply-To: <1b2558f7-94ea-123e-dd3f-b43ecd85c2ef@linux.intel.com> From: Jan Henrik Weinstock Date: Tue, 13 Feb 2024 15:50:22 +0100 Message-ID: Subject: Re: XHCI without USB2 ports To: Mathias Nyman , mathias.nyman@intel.com, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?Q?Lukas_J=C3=BCnger?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Am Di., 13. Feb. 2024 um 10:58 Uhr schrieb Mathias Nyman : > > On 12.2.2024 20.39, Jan Henrik Weinstock wrote: > > Hi all, > > > > I am currently working on an XHCI platform device simulation model. I > > noticed that the Linux driver (Linux 6.5.6 xhci-hcd) stops working > > when I configure the model without any USB2 ports. During an interrupt > > (TRB_PORT_STATUS), I only get "xhci-hcd 12100000.usb: ignore port > > event for removed USB3 hcd." > > > > During xhci_irq, in handle_port_status, xhci->shared_hcd is NULL [1], > > so the interrupt gets ignored. However, shared_hcd would only ever be > > allocated during xhci_plat_probe [2], if the device has both USB2 and > > USB3 ports, i.e. xhci_has_one_roothub returns false [3]. > > > > Without any USB2 ports, a shared_hcd will never be allocated in the > > first place, and handle_port_status will always exit early. > > This is true. > That port handling code is from a time before xhci driver supported singl= e > roothub setups. > > I think all single roothub cases so far have been xHC hosts with only USB= 2 > ports. This is probably the first one with only USB3 ports. > > I have a vague memory that USB3 specification would require USB3 ports to > be backwards compatible, and support USB2. > > But xhci driver could still support it, does this change help: > > diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c > index f0d8a607ff21..6ef081f5ef05 100644 > --- a/drivers/usb/host/xhci-ring.c > +++ b/drivers/usb/host/xhci-ring.c > @@ -1893,7 +1893,8 @@ static void handle_port_status(struct xhci_hcd *xhc= i, > } > > /* We might get interrupts after shared_hcd is removed */ > - if (port->rhub =3D=3D &xhci->usb3_rhub && xhci->shared_hcd =3D=3D= NULL) { > + if (!xhci_has_one_roothub(xhci) && xhci->shared_hcd =3D=3D NULL &= & > + port->rhub =3D=3D &xhci->usb3_rhub) { > xhci_dbg(xhci, "ignore port event for removed USB3 hcd\n= "); > bogus_port_status =3D true; > goto cleanup; > > Thanks > Mathias > Yes, this patch fixes the problem for me. Thanks! Is it so unusual to have an XHCI that has only USB3 ports? My understanding was that a port can either be USB3 or USB2 (assigned via the Supported Protocol Capability). This would mean that in order to work correctly with Linux, all XHCIs right now would have to support at least one USB2 port in addition to their USB3 ports. Best regards Jan --=20 Dr.-Ing. Jan Henrik Weinstock Managing Director MachineWare GmbH | www.machineware.de H=C3=BChnermarkt 19, 52062 Aachen, Germany Amtsgericht Aachen HRB25734 Gesch=C3=A4ftsf=C3=BChrung Lukas J=C3=BCnger Dr.-Ing. Jan Henrik Weinstock