Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1278429pxb; Sun, 22 Aug 2021 11:29:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXMHGg+xT2aJTn7WtmzrjscE95kOrW4CHzG6TpaZgfPc+VsmilZ8VaUcf8V7lId76Y2xuY X-Received: by 2002:a6b:b44f:: with SMTP id d76mr23972855iof.189.1629656991964; Sun, 22 Aug 2021 11:29:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629656991; cv=none; d=google.com; s=arc-20160816; b=I2hP+zXB7yuyFI3hbkkmuRjX20bmKvJuTtQf3R8hk5/ZkufbGAr4yBVIeXprqufAa9 6mPxkbbD6EYz2QzZVUeOGc/6CHqZTfvgRbz5bOOpMELEGrHLePfdzpUoAfueuBtkzRPx BtIrbdmB+R0Vrp4kW2Zy+a8sY5yGQyRDxQ6Xsg1ogaq0VLOYpQDigBAI/zgBILtEDA+o +mesKmchV9VM3e+ZTaVg6/BqulBcplYjweJrx43PcSCAQJsWZx26Laua2nmNu8CtNixT esC84smQ6xKtX02CKcDow0gX8+1h93run878aLHxqzGd1D2kOklxkFuOW2xfDQjpNWjh qeKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:references:subject:in-reply-to:cc:to :from:date; bh=hIDL2Ozgzgz553aPqfxQdt3RU6SmpKtvnY+wRl3O6/0=; b=eg2sZAGThQ0JsXUoNh5M1reWJ4NjAh4Uh/Ng2xwP5BnfliGwzWO07hPb7RJuvqfT5r yQfhluLpN+flgTZ11VcTaF4mv74IIotfUrmmIgHbzCnQFxl1LM87s9YFCSCLrD9o3W3E q8XG8NqejMbiB0Hvs7n9eWBGhfi6IsfSAoS25EAziYiDXXG8abMEaEu0hrqNsyOZH6rP kZBPqKSKn3aPYfJG3+eURN3uNETrjstJmO8VOld1/uqevVk6QrQdDfrTOBH/fA15HQIX AK72tJpzot9ti/yyO2uul+yRuYaanXTSINzdCQjw0lms+CkxplqifPDmYoChkpT9+SwQ 93ww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 15si12681988ilz.158.2021.08.22.11.29.40; Sun, 22 Aug 2021 11:29:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231970AbhHVS3Z (ORCPT + 99 others); Sun, 22 Aug 2021 14:29:25 -0400 Received: from sibelius.xs4all.nl ([83.163.83.176]:50940 "EHLO sibelius.xs4all.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230245AbhHVS3Y (ORCPT ); Sun, 22 Aug 2021 14:29:24 -0400 Received: from localhost (bloch.sibelius.xs4all.nl [local]) by bloch.sibelius.xs4all.nl (OpenSMTPD) with ESMTPA id 28f884f6; Sun, 22 Aug 2021 20:28:41 +0200 (CEST) Date: Sun, 22 Aug 2021 20:28:41 +0200 (CEST) From: Mark Kettenis To: Alyssa Rosenzweig Cc: linux-pci@vger.kernel.org, bhelgaas@google.com, robh+dt@kernel.org, lorenzo.pieralisi@arm.com, kw@linux.com, alyssa@rosenzweig.io, stan@corellium.com, maz@kernel.org, kettenis@openbsd.org, sven@svenpeter.dev, marcan@marcan.st, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20210816031621.240268-7-alyssa@rosenzweig.io> (message from Alyssa Rosenzweig on Sun, 15 Aug 2021 23:16:21 -0400) Subject: Re: [PATCH v2 6/6] arm64: apple: Add PCIe node References: <20210816031621.240268-1-alyssa@rosenzweig.io> <20210816031621.240268-7-alyssa@rosenzweig.io> Message-ID: <56140c9183a8d1c2@bloch.sibelius.xs4all.nl> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Alyssa Rosenzweig > Date: Sun, 15 Aug 2021 23:16:21 -0400 > > From: Mark Kettenis > > Add node corresponding to the apcie,t8103 node in the Apple device tree > for the Mac mini (M1, 2020). > > Clock references are left out at the moment and will be added once the > appropriate bindings have been settled on. > > Signed-off-by: Mark Kettenis > Signed-off-by: Alyssa Rosenzweig > --- > arch/arm64/boot/dts/apple/t8103.dtsi | 124 +++++++++++++++++++++++++++ > 1 file changed, 124 insertions(+) > > diff --git a/arch/arm64/boot/dts/apple/t8103.dtsi b/arch/arm64/boot/dts/apple/t8103.dtsi > index 342e01c6098e..c0d3b2fb0366 100644 > --- a/arch/arm64/boot/dts/apple/t8103.dtsi > +++ b/arch/arm64/boot/dts/apple/t8103.dtsi > @@ -214,5 +214,129 @@ pinctrl_aop: pinctrl@24a820000 { > , > ; > }; > + > + pcie0_dart_0: dart@681008000 { > + compatible = "apple,t8103-dart"; > + reg = <0x6 0x81008000 0x0 0x4000>; > + #iommu-cells = <1>; > + interrupt-parent = <&aic>; > + interrupts = ; > + }; > + > + pcie0_dart_1: dart@682008000 { > + compatible = "apple,t8103-dart"; > + reg = <0x6 0x82008000 0x0 0x4000>; > + #iommu-cells = <1>; > + interrupt-parent = <&aic>; > + interrupts = ; > + }; > + > + pcie0_dart_2: dart@683008000 { > + compatible = "apple,t8103-dart"; > + reg = <0x6 0x83008000 0x0 0x4000>; > + #iommu-cells = <1>; > + interrupt-parent = <&aic>; > + interrupts = ; > + }; > + > + pcie0: pcie@690000000 { > + compatible = "apple,t8103-pcie", "apple,pcie"; > + device_type = "pci"; > + > + reg = <0x6 0x90000000 0x0 0x1000000>, > + <0x6 0x80000000 0x0 0x100000>, > + <0x6 0x81000000 0x0 0x4000>, > + <0x6 0x82000000 0x0 0x4000>, > + <0x6 0x83000000 0x0 0x4000>; > + reg-names = "config", "rc", "port0", "port1", "port2"; > + > + interrupt-parent = <&aic>; > + interrupts = , > + , > + , > + , > + , > + , > + , > + , > + , > + , > + , > + , > + , > + , > + , > + , > + , > + , > + , > + , > + , > + , > + , > + , > + , > + , > + , > + , > + , > + , > + , > + , > + , > + , > + ; > + > + msi-controller; > + msi-parent = <&pcie0>; > + msi-ranges = <704 32>; > + > + iommu-map = <0x100 &pcie0_dart_0 0 1>, > + <0x200 &pcie0_dart_1 0 1>, > + <0x300 &pcie0_dart_2 0 1>; > + iommu-map-mask = <0xff00>; So this will need a little bit more thought. The PCIe bridge hardware has logic to map a PCIe Requester ID (RID) to an IOMMU Stream ID (SID). The RID is basically just the PCI bus/device/function number of the PCI device that initiates the DMA. As far as I can tell if the RID isn't matched by the PCIe bridge RID-to-SID mapping hardware it will be mapped to SID 0. Your driver doesn't program the RID-to-SID hardware so using 0 as the SID in your device tree makes some sense. However, since SID 0 is the default used when there is no match for an RID, we should probably avoid it if we can. That's why in my apple,pcie DT binding series I used SID 1. But this would require additional code in the driver to parse the iommu-map property and program the RID-to-SID hardware accordingly. Now until we support the Tunderbolt ports, this isn't all that important and we can go with your current driver and DT. I can adjust the U-Boot DT accordingly. > + > + bus-range = <0 3>; > + #address-cells = <3>; > + #size-cells = <2>; > + ranges = <0x43000000 0x6 0xa0000000 0x6 0xa0000000 0x0 0x20000000>, > + <0x02000000 0x0 0xc0000000 0x6 0xc0000000 0x0 0x40000000>; > + > + pinctrl-0 = <&pcie_pins>; > + pinctrl-names = "default"; > + > + pci@0,0 { > + device_type = "pci"; > + reg = <0x0 0x0 0x0 0x0 0x0>; > + reset-gpios = <&pinctrl_ap 152 0>; > + max-link-speed = <2>; > + > + #address-cells = <3>; > + #size-cells = <2>; > + ranges; > + }; > + > + pci@1,0 { > + device_type = "pci"; > + reg = <0x800 0x0 0x0 0x0 0x0>; > + reset-gpios = <&pinctrl_ap 153 0>; > + max-link-speed = <2>; > + > + #address-cells = <3>; > + #size-cells = <2>; > + ranges; > + }; > + > + pci@2,0 { > + device_type = "pci"; > + reg = <0x1000 0x0 0x0 0x0 0x0>; > + reset-gpios = <&pinctrl_ap 33 0>; > + max-link-speed = <1>; > + > + #address-cells = <3>; > + #size-cells = <2>; > + ranges; > + }; > + }; > }; > }; > -- > 2.30.2 > >