From patchwork Fri Sep 30 08:24:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 1684758 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=KPJCYbk/; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Mf3Dv44FMz20Zh for ; Fri, 30 Sep 2022 18:24:47 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1oeBK2-0003uH-C6; Fri, 30 Sep 2022 08:24:38 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1oeBK0-0003t9-G0 for kernel-team@lists.ubuntu.com; Fri, 30 Sep 2022 08:24:36 +0000 Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id B07363FFE0 for ; Fri, 30 Sep 2022 08:24:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1664526275; bh=S7OysODRyK5LC/BVJp0/3YhYJKzAWWWEShpyB3TT08o=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KPJCYbk/zzYSDDCFM6OPd8Kbk4DwZdKFBQnGizIorWTxjhV75QcwApJKTPAr7/9kL yHPHkUW77gRjnLKPg2GhtJtiI1C0tCBfdvtOcUj4Bhl+L2qmzx8Uwh6dPlOexPCKza +/9HkO+C7Eyw17PsxuRgs4akyylMhlgB/nkw6FevIilwJA9lke+9ChwOCG1UI3MAiX 6xD4twFR0c/fA6OO8EfniO4wl4Z7050sN4My7Lk/mnATVIyvpB0E0C7FYP2f/R+F3N 3V6A8BhEsN86cKDhrVymFenYMJPsCjz8vQmphF7Hytix0DzP3ucf1RJjLxdpUOJvXN OZAo7r80PLVZw== Received: by mail-pg1-f197.google.com with SMTP id q8-20020a632a08000000b0043cab9c7de9so2477195pgq.3 for ; Fri, 30 Sep 2022 01:24:35 -0700 (PDT) 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:to:from:x-gm-message-state:from:to:cc :subject:date; bh=S7OysODRyK5LC/BVJp0/3YhYJKzAWWWEShpyB3TT08o=; b=FXY8ihhs8TivXFYzszXJvGxGf95zhJi6NE2ntpHhQ0IaWdxrdNKz0tGIo5ZEUD/rB9 g5wjKp28m9CE5smfnJgzmWayiFqh3IvRqBD1JIE4axmobL5UzcKd+g4S9dqLa8l1tk7b yiLZ2k1IkeXyiTYncwG+JZ5lM/JToNvh9y/4nP3euW5x7yweFVC0SecK64moDAFM6f/u w0gpcOfZDBwTDjnUv70IU7n+7lY5hQS3cTIuaTFlq5SU+CSGBkAeRUzK87FqBcAENakr sZY0RfzSnSLhT74QEOUtsCTSeiT9OCw5r6v9JtSLwRNdoJpkGxL6FELWah1o3qY+7NJR VdVA== X-Gm-Message-State: ACrzQf2JPypzj6Qa6YRxXOtfshchI1eMYt5O7EoBRlaeLqIV2ymUSZVo CH90xMMuYjoWeT5UPUv8RnTxlmv2h5JRMGG9L5ZudIUePegSwdo78/KCOg5a9V5C0APNuDhakm3 5ObyHkZfaD9jp0/OPm3Z2g5wQ5If/4B5AgF1JCHbnYg== X-Received: by 2002:a17:90a:72ca:b0:20a:37a7:70fb with SMTP id l10-20020a17090a72ca00b0020a37a770fbmr1109063pjk.35.1664526273818; Fri, 30 Sep 2022 01:24:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6d31A+dO6+os9cv6uKsjw2c9Rs1zrYdjUbwCE9X5fz+PhZYiFssOhSpNhxDoOFG6LvFIw50g== X-Received: by 2002:a17:90a:72ca:b0:20a:37a7:70fb with SMTP id l10-20020a17090a72ca00b0020a37a770fbmr1109029pjk.35.1664526273379; Fri, 30 Sep 2022 01:24:33 -0700 (PDT) Received: from localhost.localdomain (2001-b400-e280-1894-87db-41a8-13c0-2b41.emome-ip6.hinet.net. [2001:b400:e280:1894:87db:41a8:13c0:2b41]) by smtp.gmail.com with ESMTPSA id g8-20020aa79f08000000b00537daf64e8esm1115560pfr.188.2022.09.30.01.24.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Sep 2022 01:24:33 -0700 (PDT) From: Chris Chiu To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/6][SRU][OEM-5.17/OEM-6.0] PCI: Fix used_buses calculation in pci_scan_child_bus_extend() Date: Fri, 30 Sep 2022 16:24:23 +0800 Message-Id: <20220930082428.142684-2-chris.chiu@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220930082428.142684-1-chris.chiu@canonical.com> References: <20220930082428.142684-1-chris.chiu@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Mika Westerberg BugLink: https://bugs.launchpad.net/bugs/1991366 pci_scan_bridge_extend() returns the subordinate bus number needed to cover all the buses below a bridge. pci_scan_child_bus_extend() computes the number of buses to reserve by comparing that with the current max bus number. Previously it did the subtraction in the wrong order, so 'used_buses' was nonsense. Subtract 'max' from 'cmax' as is done for the similar pci_scan_bridge_extend() call in the following block. Link: https://bugzilla.kernel.org/show_bug.cgi?id=216000 Fixes: 3374c545c27c ("PCI: Account for all bridges on bus when distributing bus numbers") Link: https://lore.kernel.org/r/20220905080232.36087-2-mika.westerberg@linux.intel.com Reported-by: Chris Chiu Tested-by: Chris Chiu Signed-off-by: Mika Westerberg Signed-off-by: Bjorn Helgaas Reviewed-by: Andy Shevchenko (cherry picked from commit 8066cc86b7aaaf6b4b38a81932459c6450440daa linux-next) Signed-off-by: Chris Chiu --- drivers/pci/probe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 414f659dc873..d9b42cbaf22a 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -2925,8 +2925,8 @@ static unsigned int pci_scan_child_bus_extend(struct pci_bus *bus, * hotplug bridges too much during the second scan below. */ used_buses++; - if (cmax - max > 1) - used_buses += cmax - max - 1; + if (max - cmax > 1) + used_buses += max - cmax - 1; } /* Scan bridges that need to be reconfigured */