Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp241765pxb; Mon, 13 Sep 2021 18:07:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTMPxAhKjfBoRmyBrxx5Vxcv2sX3Kgye+DVhUkfY+g8mHXaISMGERRxhEgRjUWkXNdhkjm X-Received: by 2002:a6b:c80f:: with SMTP id y15mr11278414iof.80.1631581641030; Mon, 13 Sep 2021 18:07:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631581641; cv=none; d=google.com; s=arc-20160816; b=diMRBlvHn48YBmj1LQfH0YGawtjaHb4ANdsqv2PBEXlRKhqOQ6Wu8tmKQsnGQTi0/d tH72MvRB/T5mgRwE4AIMP7hllInmHr58QyJ1/WhcIsgJAF5MzyBUbJ6/Ieuxis7Yuujk cPX5vsiS6oP22PZAmmM4ZJmX34fyNQcrmQ7VB6Wxv8nD6JbscZ9ewqm0YQD/v63Nakol mFMzNbYMVyJ2D6oabvzC/Ehxf8Srat9lXhlCDuwypGS0OIGG8sHGFEHp/PlnsF99VY2B Oz60ja7LmBr2Wipcm5yNlv2bbztgNo4g76J4nekF5dlR74iaUnsRiro8qYSwRR/qZ8Tw g1gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:dkim-signature:dkim-signature; bh=PfoyBwEONGeRoetozh4VCrcWNl2WCSyw2EgpFS0D5cI=; b=IyUnyXT9Pn8tdNIgPfdtOy/HnL2jyHYC/8P1G3DV7rUlEGJzf7ZzJOwdXZnIoObNET wvetSJ+tSodTha8mKDzaRWl1+dGZwTOBqalQT2TC8ZzhQl2qbnOI8gsKDpMylZ630zfW uQNYT7/PhqvItIKpyWh56d0swnKv5aUi93e4x8F/fuJ8MY9Vd4ssu6il65tXx9cXbbQq 6FFiaPWg1FVzpkfC58kSuX1RcSzzyz45XAXBPHHQtf+PpUu/aLYEkGBpo2BJJUwQwyl4 sic9MqzQHEwBpBaBlDhoq+X2EV4hvakvCOym52QmjjdYmaLApTdr6K2hyS8orA4QilQ/ m3dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@svenpeter.dev header.s=fm2 header.b=k1mMXwbi; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=YPDQgZUH; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=svenpeter.dev Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b8si8054251ilm.108.2021.09.13.18.07.10; Mon, 13 Sep 2021 18:07:21 -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; dkim=pass header.i=@svenpeter.dev header.s=fm2 header.b=k1mMXwbi; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=YPDQgZUH; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=svenpeter.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243166AbhIMUrV (ORCPT + 99 others); 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: linux-kernel@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