Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5522884rwb; Tue, 22 Nov 2022 00:53:26 -0800 (PST) X-Google-Smtp-Source: AA0mqf67ByoOazq+EenJYKjAMP//y75PKyvJyr4wRokIwAcX7md3a4agbE0qX8aqDcVERx3qmArk X-Received: by 2002:aa7:cad5:0:b0:461:948e:55db with SMTP id l21-20020aa7cad5000000b00461948e55dbmr20438212edt.131.1669107206361; Tue, 22 Nov 2022 00:53:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669107206; cv=none; d=google.com; s=arc-20160816; b=pVHGYLkUcmzZO8c0VneX74AbXE/8vomKBXsh1aoKO03GVbu+RNBSCYp8JTThdD8ORp qSJ9x2P+FbgBs4kERXmjHT/gaAke6CKWkVQe7i2r5CAKG14w/s8mwEuGgqNl7iaSeZ/P 0JxzfVUNgVZHYlpTwo8tYIDyN3bb8o6G8FbnUq4Hk5cQeT5gqOMqp5I8QjQ8gKHQ347J sNcIjUlCPoI3eWzL4Ao4g61RE4RQ9PNYBAudNWORRQi86T4TpaTiAb8Bw0nNTN72F2oZ WLkKbqO8KOachws6Gf9Uk7wMoVGx6/0+i6rg/V2UpmiH75OQ0yjGvg153F9y1OH+eAoL aZkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=OY+9/FsSVPjrCIz1EAOYbkpH1XPopVUhct8C05ymtyI=; b=nNQtEhglt27VEYTL5XVi85YbbTrsSGxjK53/pNQCi2uc4CEErcq1uYJM8L+OLr/KAC 8BJwWSv6nQJYqoxM/37CLiFEk07IWhXs9cNdT7Fa2E2K0GUn9qdEfsrmPhBrr15KCwhf S7MB/YPLHjmeursU2V/ciTUdWJPx2ksF6lIzFGdrGWXb6Rf4qmt5v7sMfnUcTGeB9f17 02jMmwBq6B1e1QTvvRQr8vYMdDYLVrOA1wnpjQdXlFZc2Qj6JRlJc/6XU8qH41LuJHcO HiW9y2ktgSl7oa9SQ2So79SbV/tSFzc5gJfLSiuORUMFGfmy+bEuUYOuo37DnEHYxBAW HZaw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dz12-20020a0564021d4c00b0046107f9520csi13073717edb.210.2022.11.22.00.53.04; Tue, 22 Nov 2022 00:53:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232675AbiKVIFO (ORCPT + 91 others); Tue, 22 Nov 2022 03:05:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230242AbiKVIFB (ORCPT ); Tue, 22 Nov 2022 03:05:01 -0500 Received: from bmailout2.hostsharing.net (bmailout2.hostsharing.net [83.223.78.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8429621E12; Tue, 22 Nov 2022 00:04:59 -0800 (PST) Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL TLS DV RSA Mixed SHA256 2020 CA-1" (verified OK)) by bmailout2.hostsharing.net (Postfix) with ESMTPS id 4F23D28011610; Tue, 22 Nov 2022 09:04:55 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 40428196CA; Tue, 22 Nov 2022 09:04:55 +0100 (CET) Date: Tue, 22 Nov 2022 09:04:55 +0100 From: Lukas Wunner To: "Rafael J. Wysocki" Cc: Bjorn Helgaas , Rodrigo Vivi , LKML , Linux ACPI , Linux PCI , Linux PM , Mika Westerberg Subject: Re: [PATCH v1 0/2] PCI: hotplug: Add checks to avoid doing hotplug on PCIe Upstream Ports Message-ID: <20221122080455.GA27182@wunner.de> References: <5623410.DvuYhMxLoT@kreacher> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5623410.DvuYhMxLoT@kreacher> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 21, 2022 at 07:13:15PM +0100, Rafael J. Wysocki wrote: > PCIe Upstream Ports are not hotplug-capable by definition, but it turns out > that in some cases, if the system is configured in a particularly interesting > way, the kernel may be made attempt to operate an Upstream Port as a hotplug > one which causes functional issues to appear. > > The following 2 patches amend the code to prevent this behavior from occurring. Both patches LGTM. The spec reference for this change is PCIe r6.0.1 sec 7.5.3.2: The Slot Implemented bit in the PCI Express Capabilities register is only valid for Downstream Ports and undefined on Upstream Ports. The Slot Capabilities / Control / Status registers are only operable if the Slot Implemented bit is valid and set. PCIe hotplug depends on those registers. (pcie_capability_reg_implemented() in drivers/pci/access.c returns false for the Slot Capabilities / Control / Status registers unless the port is a Root or Downstream Port. Reads of those registers thus always return 0.) (Root Ports are Downstream Ports per the definition of "Downstream" on page 94 of the PCIe r6.0.1 Base Spec.) Thanks, Lukas