Received: by 2002:a05:7412:9c07:b0:fa:6e18:a558 with SMTP id lr7csp779396rdb; Sun, 28 Jan 2024 08:33:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IGGP+vHsjoWKWBf2Osr3KYJ/rh0aOBOR55fQja0HOwnnYQmMecPkx5BM5TbAHJMeZENJS5h X-Received: by 2002:aa7:d1d5:0:b0:55e:eb81:30bd with SMTP id g21-20020aa7d1d5000000b0055eeb8130bdmr898982edp.37.1706459634907; Sun, 28 Jan 2024 08:33:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706459634; cv=pass; d=google.com; s=arc-20160816; b=cT8Xh4Sb7uUhpV8fJi1qFnfImxp8A5jCODN0Dunv/fyHToZqmMFGMmc694sYWurwlc bMLIbPKRrZioCwxu1JRkh4rzCfYHNuHQoaty42maXWx9up8WHS4B2WMER4zM3A2FXGW2 VY7/0awGelOgkrc5/9yGLn6ML7f46GKqPnx3xQOxipKBC5VHGK49eqndFgNL+Foczuvm 2Eb8qzM5rLyK/P2JGz60jyEA4JchOSw6jlfQnp80ivlpHaOUZV7azCgerUlaPVPkDAOC gcuH0mpTCQ8ZQQpIUdzBmOQHrNhRkjMeV1R80e440AkYBlhNOKZY9oM9gdpmLzJkozEd puUw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=+G0SLdPXMUER7ETbVB4gypI1y9IFQYLSwoPzEFc9MQo=; fh=snqNY9V/woeHJpP1WEcY4Rm09/+2B9Os6w2f9I3c1Cg=; b=YJEc9KkqW6+WDT1FuVh5JXwLZxD6yhqXbV6K6xYO74zMNj+9iwZ1zj9VwzuIIC8Iob SCng9nkcTyi1tw+/MSHzSEjcq+B40YwnwUl30WBbY+slMpfvhf2ZYgHB/nITdLfHHUPF dWm4xF3iDZx+D223DRnD7X0zyTmxIbg8VyL9v04bqB+Rx2GP44hH/z51ZGvI9dPoX2Mn 2cPxMD3mZxCHkv3z4+/xytlC+De336+Bjrfs/6Q8O446AE3G4i6kf+BEEF5z6Jg+k5GD E+nx7cYQNlQNhGpCBYVHhkixDQxhzGvg2YM5oD+QLvgFBymh0qIH5WniNuDs0R9YM7Vl unjQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IZ4OA2zO; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-41756-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41756-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a9-20020a509b49000000b0055ec32431efsi1264830edj.13.2024.01.28.08.33.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 08:33:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-41756-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IZ4OA2zO; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-41756-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41756-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id A6D9F1F238B4 for ; Sun, 28 Jan 2024 16:31:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BF7284597A; Sun, 28 Jan 2024 16:14:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="IZ4OA2zO" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E45FA67E80; Sun, 28 Jan 2024 16:14:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706458467; cv=none; b=bhUZqYTc+WDjN5EuBTKbre08crjObeKKyFIxl5/OzveaZNITknm0Iat2hjGx3g1DschCaJhdJJ1RjmgyrIteXwAsd5JJb7fD5RX5VWorp62T01n07V6VmFKYkxFxNe/16mjzZvkXbKs0YuqWjgmpct0drbX/PCs8KB7BLv/drsY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706458467; c=relaxed/simple; bh=BHTcqvUgtPvztzSo0fBhW5ml0BE2+RcAl3Xy4aZ74bM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=h4mZqM+U56llu1ictYc2cFh0JkeX/+cU+UJzS71UsbYGKNPyXOuPAWUm+OnyIHrMGTGESp9OdeiIm6TwlC6p2oywkSHPWFlRVhmkW1ZtZ6FmklsN9yEcs/YGZxDGexEc4X9LlkQeZvXoO4gYrxXF2N/2AdJ+c6OgtqmexD3k2aM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IZ4OA2zO; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5C14C433F1; Sun, 28 Jan 2024 16:14:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706458466; bh=BHTcqvUgtPvztzSo0fBhW5ml0BE2+RcAl3Xy4aZ74bM=; h=From:To:Cc:Subject:Date:From; b=IZ4OA2zO+7E4DAjQaOOutnG9oJxLE8l3SIiSdMhiCYmCwEI5yLMrZd//uPz/x15Zv pBa3TBVtZq5fegssTRkqzJBSy0Yp6J7sOl6LQ1yVeT/ZcTc+v5sjLCu93A2m4U0dW9 umBfwRfkcWy5oPGUf6t+U5hxbAQ9piFBZRmVCWteHyd0ubTFEdKWTtPzF9Plxa0uQh DieMLFP5+efhOkwNT3fZJ8PErO2f5T8M8gxF/ubjcPSOYevuwL70vidunCoBrMYaAz nWV7RPFJ/ugtN4CzRcOFiK32aN9K2fMVMdSR68snHjkZiqqFUBfgtvWVEI0CGfsJ4S wIswfcJ2i5Vdw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: "Guilherme G. Piccoli" , Bjorn Helgaas , Huang Rui , Vicki Pfau , Sasha Levin , linux-pci@vger.kernel.org Subject: [PATCH AUTOSEL 6.1 01/27] PCI: Only override AMD USB controller if required Date: Sun, 28 Jan 2024 11:13:46 -0500 Message-ID: <20240128161424.203600-1-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.1.75 Content-Transfer-Encoding: 8bit From: "Guilherme G. Piccoli" [ Upstream commit e585a37e5061f6d5060517aed1ca4ccb2e56a34c ] By running a Van Gogh device (Steam Deck), the following message was noticed in the kernel log: pci 0000:04:00.3: PCI class overridden (0x0c03fe -> 0x0c03fe) so dwc3 driver can claim this instead of xhci Effectively this means the quirk executed but changed nothing, since the class of this device was already the proper one (likely adjusted by newer firmware versions). Check and perform the override only if necessary. Link: https://lore.kernel.org/r/20231120160531.361552-1-gpiccoli@igalia.com Signed-off-by: Guilherme G. Piccoli Signed-off-by: Bjorn Helgaas Cc: Huang Rui Cc: Vicki Pfau Signed-off-by: Sasha Levin --- drivers/pci/quirks.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 8765544bac35..75b297c15cf5 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -607,10 +607,13 @@ static void quirk_amd_dwc_class(struct pci_dev *pdev) { u32 class = pdev->class; - /* Use "USB Device (not host controller)" class */ - pdev->class = PCI_CLASS_SERIAL_USB_DEVICE; - pci_info(pdev, "PCI class overridden (%#08x -> %#08x) so dwc3 driver can claim this instead of xhci\n", - class, pdev->class); + if (class != PCI_CLASS_SERIAL_USB_DEVICE) { + /* Use "USB Device (not host controller)" class */ + pdev->class = PCI_CLASS_SERIAL_USB_DEVICE; + pci_info(pdev, + "PCI class overridden (%#08x -> %#08x) so dwc3 driver can claim this instead of xhci\n", + class, pdev->class); + } } DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB, quirk_amd_dwc_class); -- 2.43.0