Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp700498pxb; Tue, 14 Sep 2021 06:58:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTaRyrgwPc2u9g11A9eIHSvzYJf0rL/RCQG+iEZphg7ROee/RmJtZgzOR14uVO/eCs42b/ X-Received: by 2002:a02:90d0:: with SMTP id c16mr14981588jag.106.1631627908762; Tue, 14 Sep 2021 06:58:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631627908; cv=none; d=google.com; s=arc-20160816; b=aC4Sl6oIYYAlTR4wSf35FCshe/of2AL8n3IqiU/hgFKcX/XY3be5Ug5S/mcL6XosWM Eo8A1H7GZVh61bT9UcnVn3IvOvIzsOxp5OqkhjWkr6azPr0CyIt5ZQVFdNAvTbjsshIE lFq9QDWwV+C50JB6ykaZX9xDukBRfVmaaB4XEGupOk0NGqezd6WCNJ9TGsuidrUtoPVt 6qNGN63Fvfa1XgDxYGtRUuFLkoHGMeLqn5wpMbq+jqSx/jDZxzjAertmRWnRMfSEQI6O mUlm7d+/v1wEvz3V6B1Deo90u4vDcybidnct8CEEU7RXnJriWLCHLVGOesoMGQ2rytDq 9DHw== 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=/qfI0kR2c2R9EpdH6XC5khZEU1GdsF66gEmUDSo9p/A=; b=UgBNn4eafpL5neJ8pDYjoVQ5XmVEdtmY7IoAxz7MBARZiN6vuN11Pj1JnS3FoBZ8NJ WP1X0VdDj1jJHI0/4RN3sxG91jlU0ds8zD2q+HDv5qtkshgAt2Aw8eiJ77GFB8iQV8Bj 6T8zOnziZOcWFOIG23ffIdX6bJRE7R10V90YgbCGWZyNAuzFMu2Ln+HId6AxWVYsbrUb 3N/12Ts1diR3UmHX9K80Ta+MeMrT4k1zwWy2xiTEtM+0tvFpYUmWp499spvNDy1QbWs6 4PQkn6npkFMVk3v2qwGyUCw9Ai7qOXY7haiJk6NF9h0vVKREUERXiXzSh7d9c434Q6iX 7XBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@svenpeter.dev header.s=fm2 header.b=p6wHtTji; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=ObmLpvpS; 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 z9si10666907ile.8.2021.09.14.06.58.17; Tue, 14 Sep 2021 06:58:28 -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=p6wHtTji; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=ObmLpvpS; 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 S233349AbhINN6y (ORCPT + 99 others); Tue, 14 Sep 2021 09:58:54 -0400 Received: from new1-smtp.messagingengine.com ([66.111.4.221]:46201 "EHLO new1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233337AbhINN6t (ORCPT ); Tue, 14 Sep 2021 09:58:49 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id 9DF1B5805AB; Tue, 14 Sep 2021 09:57:31 -0400 (EDT) Received: from imap21 ([10.202.2.71]) by compute1.internal (MEProxy); Tue, 14 Sep 2021 09:57:31 -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=/qfI0kR2c2R9EpdH6XC5khZEU1Gd sF66gEmUDSo9p/A=; b=p6wHtTjiRf96SdEIECnw2JMg3xosSsAID4XSdD66rNlF CRMi3Vv74l8ByIFgm9xTCWSYpeiWi3PwKZVRzPJ5j5NjE3kIUg2lyqv249BDPmDK HHoTDWMhEuhxEZjQw7Cfo5arwx9bpJ+ugQ2kdTOxaS9vOAH4rZ+hHYsQtnYa0M3k 9ECSbfibkn7fDt30DhgHe0rlYk0NnGamf+l0t6wY44OKT0P213GfMXg6UdavNmY1 UV2Pfni/60nfz6ZZ0SphMClLj2S4SFehFv4PXCL0G/uDhPZqvDwjQ/+KBmVR8XvY uAp+hcQefXSa7Y7H2SpV+h2x+eGRHJWKg9x5ev3vtQ== 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=/qfI0k R2c2R9EpdH6XC5khZEU1GdsF66gEmUDSo9p/A=; b=ObmLpvpSpZfGpQpcnl5YxO 2bkGlWscTyRSRJD/0KgvU3cpLJhoM1bk8gn1/rzSYqBmC40jrsILJTtgaHeFABIo L1gbQJ/sV55CRS6bPSXX5URC1Zv9pQ16r8/+smPaeV3ox0laG5ISLGjTEQN3Tpz0 M+ifqKc/x4Zkw42DIVGQDkV1AdOxM/7oA/ieMm6G2dC2ZnzZPyaLQgvgGyP6BB8t cEi1GHm/MtvRkld5M2vcgQ+w+MbQlAT6YF3zuh6jydumvJiYXSgn/SF93TrtxMJ2 qV3QDweFuQmFr6aevXBlUbYfzaNgWEtOXjFiaMX8m3YdNgibDPi1zhrECNxGL6CQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudegledgieekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreerjeenucfhrhhomhepfdfuvhgv nhcurfgvthgvrhdfuceoshhvvghnsehsvhgvnhhpvghtvghrrdguvghvqeenucggtffrrg htthgvrhhnpeehjefgtddtfeelfeetjeeifeduueehleektdegtdejheeiteeuleehuefh geehgeenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpe hsvhgvnhesshhvvghnphgvthgvrhdruggvvh X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id A09D051C0060; Tue, 14 Sep 2021 09:57:30 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-1291-gc66fc0a3a2-fm-20210913.001-gc66fc0a3 Mime-Version: 1.0 Message-Id: <06263cbc-70f1-4484-86f3-3735137b3a8f@www.fastmail.com> In-Reply-To: <87y27zbiu3.wl-maz@kernel.org> References: <20210913182550.264165-1-maz@kernel.org> <20210913182550.264165-11-maz@kernel.org> <87y27zbiu3.wl-maz@kernel.org> Date: Tue, 14 Sep 2021 15:56:55 +0200 From: "Sven Peter" To: "Marc Zyngier" Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, "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 Tue, Sep 14, 2021, at 11:35, Marc Zyngier wrote: > On Mon, 13 Sep 2021 21:45:13 +0100, > "Sven Peter" wrote: > > > > > > > > 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. > > You are indeed right, and I blindly used the limit used in the > Correlium driver. Using entries from 16 onward result in a non booting > system. The registers do not fault though, and simply ignore writes. I > came up with an simple fix for this, see below. Looks good to me and at least I prefer that to an additional property in the device tree. Reviewed-by: Sven Peter Thanks, Sven