From patchwork Mon Jun 18 19:36:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 931183 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=deltatee.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 418hG203rMz9s2R for ; Tue, 19 Jun 2018 05:38:02 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936580AbeFRThO (ORCPT ); Mon, 18 Jun 2018 15:37:14 -0400 Received: from ale.deltatee.com ([207.54.116.67]:43748 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936326AbeFRThI (ORCPT ); Mon, 18 Jun 2018 15:37:08 -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 1fUzxX-0001HY-NM; Mon, 18 Jun 2018 13:37:04 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1fUzxR-0004EC-QG; Mon, 18 Jun 2018 13:36:57 -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?b?SsOpcsO0bWUgR2xpc3Nl?= , Benjamin Herrenschmidt , Alex Williamson , =?utf-8?q?Christian_K=C3=B6nig?= , Logan Gunthorpe Date: Mon, 18 Jun 2018 13:36:33 -0600 Message-Id: <20180618193636.16210-1-logang@deltatee.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 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, 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 v3 0/3] 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-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org 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 IOMMU group creating the IOMMU groups will be created correctly based on the bits. Thanks, Logan --- 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 -- Logan Gunthorpe (3): PCI: Make specifying PCI devices in kernel parameters reusable PCI: Allow specifying devices using a base bus and path of devfns PCI: Introduce the disable_acs_redir parameter Documentation/admin-guide/kernel-parameters.txt | 39 ++- drivers/pci/pci.c | 336 ++++++++++++++++++++---- 2 files changed, 314 insertions(+), 61 deletions(-) -- 2.11.0