From patchwork Tue Apr 2 13:15:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 10881693 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DD019922 for ; Tue, 2 Apr 2019 13:21:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0E68287C8 for ; Tue, 2 Apr 2019 13:21:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1E71288D3; Tue, 2 Apr 2019 13:21:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6B4DA287C8 for ; Tue, 2 Apr 2019 13:21:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PMNE9dHPoP4aPd0NRZf2LRQ0pkhPwk/D1hTfQeldS9I=; b=Li8ZM58BmP2jXo PbUTIQnvrtnLcf1pC4A/mMsYAWR2dg7oYd8kCgclSYUF9Vf5Hx/klu0vlgKPzsrL5URvxls7vCO5l 1D04BS9rmfJ7RHjBuvW95xGpH2ij1MzhIB+Jt7In2ojr2uvmi01oA+NnxtrYFw1vplAUggBX5FJZ/ x/gdQMNH3sPYwddfpB+S3rUAfeKa1fPdhCLDo/jaDi/6dDrTfUurWNZWogsGFHvibrwZL0PVOEXFh QiYRFft0n+leZfbz787ozVpnxUllX6sheLNI4V6lGbmv8FbKnXh33nTtj6O3TSA5NolnrYbmdoz/d b0b2qt4oUYZIKeLcwNYw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBJM8-00010n-MG; Tue, 02 Apr 2019 13:21:36 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBJLp-0000a5-Pb for linux-arm-kernel@lists.infradead.org; Tue, 02 Apr 2019 13:21:18 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DD12119F6; Tue, 2 Apr 2019 06:21:16 -0700 (PDT) Received: from ostrya.cambridge.arm.com (ostrya.cambridge.arm.com [10.1.196.129]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 365ED3F690; Tue, 2 Apr 2019 06:21:15 -0700 (PDT) From: Jean-Philippe Brucker To: bhelgaas@google.com, robh+dt@kernel.org, mark.rutland@arm.com Subject: [PATCH v2 2/2] PCI: OF: Support external-facing property Date: Tue, 2 Apr 2019 14:15:48 +0100 Message-Id: <20190402131548.41949-3-jean-philippe.brucker@arm.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190402131548.41949-1-jean-philippe.brucker@arm.com> References: <20190402131548.41949-1-jean-philippe.brucker@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190402_062117_883470_66047EDE X-CRM114-Status: UNSURE ( 9.30 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-pci@vger.kernel.org, Jeremy.Linton@arm.com, Grant.Likely@arm.com, Robin.Murphy@arm.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Set the "untrusted" attribute to any PCIe port that has an "external-facing" device tree property. Any device downstream of this port will inherit the attribute and have only the strictest IOMMU protection. Signed-off-by: Jean-Philippe Brucker Acked-by: Bjorn Helgaas Reviewed-by: Robin Murphy --- drivers/pci/of.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/pci/of.c b/drivers/pci/of.c index 3d32da15c215..3e7ac7748d90 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -35,6 +35,9 @@ void pci_set_bus_of_node(struct pci_bus *bus) bus->dev.of_node = pcibios_get_phb_of_node(bus); else bus->dev.of_node = of_node_get(bus->self->dev.of_node); + + if (of_get_property(bus->dev.of_node, "external-facing", NULL)) + bus->self->untrusted = true; } void pci_release_bus_of_node(struct pci_bus *bus)