Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3776617imm; Tue, 17 Jul 2018 10:04:23 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfX7tHyw6HM6ns/XZqo8HOw53cruGuq6OWHJffv6yj+Y7Eu6wRxyKBV+iQUjFT1M6ub8J8Z X-Received: by 2002:a17:902:a5cb:: with SMTP id t11-v6mr2395796plq.71.1531847063150; Tue, 17 Jul 2018 10:04:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531847063; cv=none; d=google.com; s=arc-20160816; b=AQeEG2TPiEOu0lKrBxZhJtpQh3JJff9gNrr9V9jakkrFB6bXZ33/JPSx1RyB7dwPG3 nU9csK762sB6W88fNw6MyewCLrdH47Pp0PgVFRJc3f1Kl4FF7x+6HGXrx2R0n2KJvsCD mJh/pfa/6AkU5qRcElec1C04uvigLgtvsZcUMo3QjTf1Tb4UBEyk/wS87abUOlyUTU3I SGeHgRmbZP7SiA3glyweh6dQXK8oC9S3ocskHaqdppf1PEfhjVvo663oMS9J4JzbC8dK HmnQxEzIG4mzsyFdCf6QA5MbMPaFHHXCPJGNHnfUnoRUbVNMOHHBNeOv1Gtr/SWuJH2v 1bkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:content-transfer-encoding :mime-version:message-id:date:cc:to:from:arc-authentication-results; bh=LwZ+W8qUBZ5iaTK5lT67csDYPojN52aX5GYRf0ouRHA=; b=q/aUAvUlbstMDJjD7g0EPWU2DKjTx4Iq1MIpmxODLEuAX9F4T39x8VSFQr/sqj8ySJ hdjtzem457dUK/WEBzgHhPL/OpEYJVw+qs1XDKrAN2ktyF3b945RmAJlMinwNFZly9/P XhZIfuQl0xvKum39Mpfc1fjpZIeYMu/s7H9raXgEwM3X57vm2BEKD1xwlcreeI0MqUhK L4FSvmvVE068n3jzzlO7t7axjbkRmf33GCzq9qv3iOKohDF/BThTqDLLPvF7lpJTQIKZ O678F4c9R+t0dlxb7SQW0nG+3jG4Yze7m+xRFI/ozyt60go+w5bZ+an/Qcr3G7/3Qe4e MApw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j67-v6si1377396pfg.34.2018.07.17.10.04.08; Tue, 17 Jul 2018 10:04:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729838AbeGQRf4 (ORCPT + 99 others); Tue, 17 Jul 2018 13:35:56 -0400 Received: from ale.deltatee.com ([207.54.116.67]:44588 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729689AbeGQRf4 (ORCPT ); Tue, 17 Jul 2018 13:35:56 -0400 Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ffTMh-0006bv-TU; Tue, 17 Jul 2018 11:02:20 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1ffTMT-0007wD-Le; Tue, 17 Jul 2018 11:02:05 -0600 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-doc@vger.kernel.org Cc: Stephen Bates , Christoph Hellwig , Bjorn Helgaas , Jonathan Corbet , Ingo Molnar , Thomas Gleixner , "Paul E. McKenney" , Marc Zyngier , Kai-Heng Feng , Frederic Weisbecker , Dan Williams , =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , Benjamin Herrenschmidt , Alex Williamson , =?UTF-8?q?Christian=20K=C3=B6nig?= , Matthew Wilcox , Logan Gunthorpe Date: Tue, 17 Jul 2018 11:02:00 -0600 Message-Id: <20180717170204.30470-1-logang@deltatee.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-doc@vger.kernel.org, sbates@raithlin.com, hch@lst.de, bhelgaas@google.com, corbet@lwn.net, tglx@linutronix.de, paulmck@linux.vnet.ibm.com, marc.zyngier@arm.com, kai.heng.feng@canonical.com, mingo@kernel.org, frederic@kernel.org, dan.j.williams@intel.com, benh@kernel.crashing.org, jglisse@redhat.com, alex.williamson@redhat.com, christian.koenig@amd.com, willy@infradead.org, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-8.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, GREYLIST_ISWHITE autolearn=ham autolearn_force=no version=3.4.1 Subject: [PATCH v7 0/4] Add parameter for disabling ACS redirection for P2P X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Changes since v6: * Fixed order of operations for device specific disable function as noticed by Alex * Rebased onto v4.18-rc5 (no conflicts) Changes since v5: * Add a quirk to handle the Intel SPT PCH case (as pointed out by Alex) * Warn in the case that we try to disable ACS redirect on a device that doesn't have the ACS capability (also suggested by Alex) * Collect reviewed-by tag from Alex * Rebased onto v4.18-rc4 (no conflicts) Changes since v4: * Fixed a couple documentation mistakes spotted by Randy Changes since v3: * Removed some of the cruft that was copied from the resource_alignment paramater (per Alex) * A number of docuemntation fixes as noticed by Alex and Willy Changes since v2: * Rebased onto v4.18-rc1 (no conflicts) * Minor tweaks to the documentation per Andy * Removed the "path:" prefix and use the path parsing code for simple devices (as it works the same). Per a suggestion from Alex Changes since v1: * Reworked pci_dev_str_match_path using strrchr as suggested by Alex * Collected Christian's Acks -- Hi, As discussed in our PCI P2PDMA series, we'd like to add a kernel parameter for selectively disabling ACS redirection for select bridges. Seeing this turned out to be a small series in itself, we've decided to send this separately from the P2P work. This series generalizes the code already done for the resource_alignment option that already exists. The first patch creates a helper function to match PCI devices against strings based on the code that already existed in pci_specified_resource_alignment(). The second patch expands the new helper to optionally take a path of PCI devfns. This is to address Alex's renumbering concern when using simple bus-devfns. The implementation is essentially how he described it and similar to the Intel VT-d spec (Section 8.3.1). The final patch adds the disable_acs_redir kernel parameter which takes a list of PCI devices and will disable the ACS P2P Request Redirect, ACS P2P Completion Redirect and ACS P2P Egress Control bits for the selected devices. This allows P2P traffic between selected bridges and seeing it's done at boot, before the IOMMU groups will be created, the groups will match the security provided by ACS. Thanks, Logan -- Logan Gunthorpe (4): PCI: Make specifying PCI devices in kernel parameters reusable PCI: Allow specifying devices using a base bus and path of devfns PCI: Introduce disable_acs_redir quirk PCI: Introduce the disable_acs_redir parameter Documentation/admin-guide/kernel-parameters.txt | 41 +++- drivers/pci/pci.c | 310 +++++++++++++++++++----- drivers/pci/quirks.c | 78 +++++- include/linux/pci.h | 5 + 4 files changed, 361 insertions(+), 73 deletions(-) -- 2.11.0