From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85C06C433F5 for ; Mon, 13 Sep 2021 20:46:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 63A5D610D1 for ; Mon, 13 Sep 2021 20:46:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242988AbhIMUrV (ORCPT ); Mon, 13 Sep 2021 16:47:21 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:34997 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242818AbhIMUrU (ORCPT ); Mon, 13 Sep 2021 16:47:20 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id 19635580DFD; Mon, 13 Sep 2021 16:46:04 -0400 (EDT) Received: from imap21 ([10.202.2.71]) by compute1.internal (MEProxy); Mon, 13 Sep 2021 16:46:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=mime-version:message-id:in-reply-to:references:date:from:to :cc:subject:content-type; s=fm2; bh=PfoyBwEONGeRoetozh4VCrcWNl2W CSyw2EgpFS0D5cI=; b=k1mMXwbiYYKILsn2bMLbgszknQRsbYl8plnufj6LOySp 6HazilS3iMP4mdZKQUXl7NGkrndHiaMXO5DmyPwjsX3Sd9EE603ZfkJK9RD5neY0 1PIzm9otjEK9m1PgswIfeCK1O/oNTY9dpuao00737PgzxbICzd9ydM2WMKULAMNf +ALlHEsWBS1DTz+9Ng5Bgmqk0ScWxm6eGaKaI5bh6fDKZCf3JEzM1D+2l04wDJhw LU7CPAYHz0Dy0WcJX84EczLugcJxQZVcdQTrvgrC8lc3x6/NnaG3EanVyxuqWMkv 0i5X2AmYBg2SN9MCk7751leNtahKNwRIZdrW/MXthg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=PfoyBw EONGeRoetozh4VCrcWNl2WCSyw2EgpFS0D5cI=; b=YPDQgZUHQ2A5ycPuflPU0j fNjm9aVJkyyeL8n0G0WbCTqBwGzlOJLUO06HjHM24+Rn8GdDDussHZ/Edi8UZdcd cmM59uhX/D6rpIVRxvc0fvs9VIp7x2+hPIgRTjX50CubSnfDEPkWkLXTlM6lb1+p b+AkJ2cy/XE3yheGu9kY1lRqVuAKDRWKoELlws6FzHceLVeyBR7jrH4JAd6AQJ2b nkrRjnf4TRNBnE7GCjnYsV/AiJznhv7R6oQOLFVOzfJpQpBNroHtFr2mU7cm3rAO tbdK/Cg24AL3filKekCBKZ4R9MWwQ+NkwAUvfa2bcw33cm+eivqAycXRTsfUwArw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudegjedgudehtdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtsehttdertderreejnecuhfhrohhmpedfufhv vghnucfrvghtvghrfdcuoehsvhgvnhesshhvvghnphgvthgvrhdruggvvheqnecuggftrf grthhtvghrnhepheejgfdttdefleefteejieefudeuheelkedtgedtjeehieetueelheeu hfegheegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epshhvvghnsehsvhgvnhhpvghtvghrrdguvghv X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 9509A51C0060; Mon, 13 Sep 2021 16:46:02 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-1229-g7ca81dfce5-fm-20210908.005-g7ca81dfc Mime-Version: 1.0 Message-Id: In-Reply-To: <20210913182550.264165-11-maz@kernel.org> References: <20210913182550.264165-1-maz@kernel.org> <20210913182550.264165-11-maz@kernel.org> Date: Mon, 13 Sep 2021 22:45:13 +0200 From: "Sven Peter" To: "Marc Zyngier" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Cc: "Bjorn Helgaas" , "Rob Herring" , "Lorenzo Pieralisi" , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , "Alyssa Rosenzweig" , "Stan Skowronek" , "Mark Kettenis" , "Hector Martin" , "Robin Murphy" , kernel-team@android.com Subject: =?UTF-8?Q?Re:_[PATCH_v3_10/10]_PCI:_apple:_Configure_RID_to_SID_mapper_o?= =?UTF-8?Q?n_device_addition?= Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Mon, Sep 13, 2021, at 20:25, Marc Zyngier wrote: > The Apple PCIe controller doesn't directly feed the endpoint's > Requester ID to the IOMMU (DART), but instead maps RIDs onto > Stream IDs (SIDs). The DART and the PCIe controller must thus > agree on the SIDs that are used for translation (by using > the 'iommu-map' property). > > For this purpose, parse the 'iommu-map' property each time a > device gets added, and use the resulting translation to configure > the PCIe RID-to-SID mapper. Similarily, remove the translation > if/when the device gets removed. > > This is all driven from a bus notifier which gets registered at > probe time. Hopefully this is the only PCI controller driver > in the whole system. > > Signed-off-by: Marc Zyngier > --- > drivers/pci/controller/pcie-apple.c | 158 +++++++++++++++++++++++++++- > 1 file changed, 156 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/controller/pcie-apple.c > b/drivers/pci/controller/pcie-apple.c > index 76344223245d..68d71eabe708 100644 > --- a/drivers/pci/controller/pcie-apple.c > +++ b/drivers/pci/controller/pcie-apple.c > @@ -23,8 +23,10 @@ > #include > #include > #include > +#include > #include > #include > +#include > #include > #include > > @@ -116,6 +118,8 @@ > #define PORT_TUNSTAT_PERST_ACK_PEND BIT(1) > #define PORT_PREFMEM_ENABLE 0x00994 > > +#define MAX_RID2SID 64 Do these actually have 64 slots? I thought that was only for the Thunderbolt controllers and that these only had 16. I never checked it myself though and it doesn't make much of a difference for now since only four different RIDs will ever be connected anyway. Sven