Message ID | 20231121183643.249006-8-helgaas@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp836743vqb; Tue, 21 Nov 2023 10:38:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IEkxtwz3f+NYiGqElFdTkVu99Q7tEKgBG2OAimQ76yadESUyBDP3v12r/XPW6fDmee7xbQU X-Received: by 2002:a17:902:ead1:b0:1cc:21f1:c05c with SMTP id p17-20020a170902ead100b001cc21f1c05cmr9791041pld.11.1700591903337; Tue, 21 Nov 2023 10:38:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700591903; cv=none; d=google.com; s=arc-20160816; b=YU1W70LkhFFYdWfw1fwWUBnuS3WXzgsRL+eHYQqJ5Fhl7lAOV1ovBlTGyg75Oy6bkM Ga6A7C7RpxYwJgwgA7qshBkQtFkuR/6lt2I2d5Y+FATsmAX9RuV99AWMgwgWnBGd4+dT lixy3tnEiKRDr2M92wpgZ7LPHF9sY1irNHXng+awijGOQSj+yCjG8SmlBUbbk9Dxs9SX rofZ4yOoM/qgpt57JSWzvsLPtqJvpVhtRAiWJwQJ8bmqwA6BDopAPo8ZXI+gY88Y7DOb nuP7A34Q8K4FB/M4DL6ZcWcTVfkPJefMX+d42q0ZWxux3MKUEEVGbEfYbHum/0ARYhe8 IjyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bfwMmXVUsyiIS4QFeDywQ2UUYXOQLDrFqJadcOtV+VE=; fh=KVY+YYgWJTdaCaCkMOn84+9OqSlvR5lnFCfeohFAf40=; b=ikaMbrI71wSumONyph6eZep2g/+rWFsAdLQehsv5wJ7oII/4mPVKQtu2PGgBqWUu+O sVaHNzvPRl2TjG+ABg70pKceMvedUfBbUlQzVufQ9r23PwgLGMZcHlmbRDyccAdFMi6K c00m+L0FT7f73EbjTuOExEkQqrVHqn6LlatFjlJDarOs2Nq2m0Rsm4TSVMSQM538XNZv ua41Xx/zkzX8LzYhpvsOwGlrSC0Duyq9PAsgkQ1nBW9Eh+VP11pSYlgz2VYbneeWi3aE hlIBxNu2WHfbj/FSkvsHJCFwV92vIKYaHGcVIOEiZCI8vAjr/4gKqTGlap1zX+uBTR70 QKbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XW+n6C08; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id a21-20020a170902ee9500b001cb02e6f149si10536228pld.538.2023.11.21.10.38.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 10:38:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XW+n6C08; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id EB6E98031E87; Tue, 21 Nov 2023 10:38:15 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234619AbjKUShU (ORCPT <rfc822;ouuuleilei@gmail.com> + 99 others); Tue, 21 Nov 2023 13:37:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234561AbjKUShM (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 21 Nov 2023 13:37:12 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB6E710CF for <linux-kernel@vger.kernel.org>; Tue, 21 Nov 2023 10:37:03 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15255C433C9; Tue, 21 Nov 2023 18:37:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700591823; bh=xBeqzteKzjRFD7AK4f9XGIWZHMzDuTSTe3bPhMPVydE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XW+n6C08SNh+kInRoEGKqDrPEzsmS4/A230SA1t1ygBldR47hQJaz0mYmCkCFf3p0 VrlzzKWr2unKQkxS6rU6CxyBKOq0P0Lp5flZeYXdFimOWl4kV+FpiFji8iVt8Rt+8A cHtXR8Vb+F6VjpGZI3o8NDdtV8Igl4BtI5oHyRVrP7milTrTWKXU8xJuavzoe3gjzL RuIxdCWCnwiUlQhcZQK62gh3kKt95dBx1SBBZSOyt+BIfFDbGN5z/+GheND+w3YSzi FlGBrovDFtly2OWiWeSgTl3voaQ5JsTVvHXdlOm8Z0MuYaezO9iYSPqUKozVF5kscx wvJh13DDHuRbA== From: Bjorn Helgaas <helgaas@kernel.org> To: linux-pci@vger.kernel.org Cc: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>, x86@kernel.org, "H . Peter Anvin" <hpa@zytor.com>, "Rafael J . Wysocki" <rjw@rjwysocki.net>, Dan Williams <dan.j.williams@intel.com>, Kan Liang <kan.liang@linux.intel.com>, Tony Luck <tony.luck@intel.com>, Giovanni Cabiddu <giovanni.cabiddu@intel.com>, Yunying Sun <yunying.sun@intel.com>, Tomasz Pala <gotar@polanet.pl>, Sebastian Manciulea <manciuleas@protonmail.com>, linux-kernel@vger.kernel.org, Bjorn Helgaas <bhelgaas@google.com> Subject: [PATCH 7/9] x86/pci: Comment pci_mmconfig_insert() obscure MCFG dependency Date: Tue, 21 Nov 2023 12:36:41 -0600 Message-Id: <20231121183643.249006-8-helgaas@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231121183643.249006-1-helgaas@kernel.org> References: <20231121183643.249006-1-helgaas@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 21 Nov 2023 10:38:16 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783199855625225652 X-GMAIL-MSGID: 1783199855625225652 |
Series |
x86/pci: Work around lack of ECAM space reservation
|
|
Commit Message
Bjorn Helgaas
Nov. 21, 2023, 6:36 p.m. UTC
From: Bjorn Helgaas <bhelgaas@google.com> In pci_mmconfig_insert(), there's no reference to "addr" between locking pci_mmcfg_lock and testing "addr", so it *looks* like we should move the test before the lock. But 07f9b61c3915 ("x86/PCI: MMCONFIG: Check earlier for MMCONFIG region at address zero") did that, which broke things by returning -EINVAL when "addr" is zero instead of -EEXIST. So 07f9b61c3915 was reverted by 67d470e0e171 ("Revert "x86/PCI: MMCONFIG: Check earlier for MMCONFIG region at address zero""). Add a comment about this issue to prevent it from happening again. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> --- arch/x86/pci/mmconfig-shared.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c index b36c10e86505..459e95782bb1 100644 --- a/arch/x86/pci/mmconfig-shared.c +++ b/arch/x86/pci/mmconfig-shared.c @@ -786,6 +786,10 @@ int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end, return -EEXIST; } + /* + * Don't move earlier; we must return -EEXIST, not -EINVAL, if + * pci_mmconfig_lookup() finds something + */ if (!addr) { mutex_unlock(&pci_mmcfg_lock); return -EINVAL;