From mboxrd@z Thu Jan 1 00:00:00 1970 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 9794B69DF9; Wed, 21 Feb 2024 13:17:52 +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=1708521472; cv=none; b=kxDUwCJEKs2xQ74p0kzMkEgN9kOPLTj7mpEdOHeJEoWHfvFjZu7zG+pBjnZLLYu+I6atvLgfPcLY1c0vok9NSVNOeLteZIf46670hAsGKbON7zMu2rbV9ndkbtAkpZYTwXuY/yxB17MM2XadcJ56Uxu2tmhm6eR3aL+/0DxSqVI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708521472; c=relaxed/simple; bh=nujEKVke6HwptxPMhY6oA4ikwei4wzVkDhjPyogWOhA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=p5dhl3UQ8bZ5efo+dpt6h7ww158UXSbrrBr93A/rebeVoYGUxNjRodq+PQ60BM8vJLDj72PIgLJhsqrXGsnF8k1onlU0snG8sXXQkHz1CXUGH0Hn1vAkfEmHRZG0Sa10UmuUA/63oJCTNNpADdK3cV+Devu6JiI1aE6Dfmef/N0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=1qqNUEn8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="1qqNUEn8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04F1CC433F1; Wed, 21 Feb 2024 13:17:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1708521472; bh=nujEKVke6HwptxPMhY6oA4ikwei4wzVkDhjPyogWOhA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1qqNUEn8EApCgaXrQa2Gjuiw4Jtc8GXQh6guPemx/ealJ6pZOWXuaWcU3V2larLa2 /pCFBZdP9rTnQvM7f5tulrn6uqWagDLhtAAzjt3f80v0l/IStE1zt3W0G3xdb0Q20r VEZlqXQnZyrIlDJFcSiz6PXCIZf8SklxU0KBmE2o= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "Guilherme G. Piccoli" , Bjorn Helgaas , Huang Rui , Vicki Pfau , Sasha Levin Subject: [PATCH 4.19 121/202] PCI: Only override AMD USB controller if required Date: Wed, 21 Feb 2024 14:07:02 +0100 Message-ID: <20240221125935.628145830@linuxfoundation.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240221125931.742034354@linuxfoundation.org> References: <20240221125931.742034354@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ 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 a5d49f75e1ac..99a8a24ea79d 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -611,10 +611,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