Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp698803pxb; Tue, 14 Sep 2021 06:55:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUfqhFURATNylA/8XPEx8zEWK++DCr/OA1SBAAKYpT2D+txpM7lZOU6n6zWzvV/3sd2qSP X-Received: by 2002:a92:444e:: with SMTP id a14mr12527387ilm.152.1631627750178; Tue, 14 Sep 2021 06:55:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631627750; cv=none; d=google.com; s=arc-20160816; b=xUV54D20/y7l4y7Gp8F2inhVv+zBKalp+rntuOwtup1T0Q7xzw+8r0LhW5bL1MiFFA kXiQnqFBYyOAyzH4JchsVFwr3SK6A3IcWIaJIyCuycMQe+iKQFD/+JmXEUFhILSOZRFx 7SoBIMHQE1+likiA3mQDywnZQtEe07gkLsgjFGAm9qIo4FaOlIsUCfU4Ax6uUcYj4tPP nvLet5gGJRO5koQjAS4icf2HdCGsbigAsS/2itMFWieeBG86+qNx38qyETLj+huBba2h 6CjtcAgGyZGtjjw4XUmdna6Uv6A4y0gEsWXyCaGhuBacIldhsm0pgxk06TJ4x/IRK6C8 4nyA== 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=o1rdGWrst3yz3l9o6PKhZvLFS00YbNnCxVpsc8+ZQ0Q=; b=QN2k1gXY3AVOeR9gQShmiOyeDq9f4YZ8irsuGPf6PRf0JKuum74nlBWt3WaktO75wC ZN13tdnntFUHkVQrm3Z4gKZ1HRnZdclRS8XvMWQQYwyAeDxjsa/pbB0DcPJedKWIu7Vc ITNDys7inLLAwq/cEcYZixaUZRVvZyzmHtYMOKVkhGWRZ+7VqAhlv+d0PxdzWltIZgOH VCtkbETLdIDuS1bSECr2toED59c+bnH5MBQBIgKWy9rVwtzSZX3qWzIOR36PoM0YwtcN f0LB68FsuYxtP39NUSkKlTgLBk/x8zKkZYUvbauJsFwKKsgDsFR89f8i0umz1LhDuPmc ig9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@svenpeter.dev header.s=fm2 header.b=Tkq2hX5S; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b="OTd+/B8/"; 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 a10si9348688jaa.15.2021.09.14.06.55.38; Tue, 14 Sep 2021 06:55:50 -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=Tkq2hX5S; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b="OTd+/B8/"; 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 S233354AbhINNzt (ORCPT + 99 others); Tue, 14 Sep 2021 09:55:49 -0400 Received: from new1-smtp.messagingengine.com ([66.111.4.221]:35097 "EHLO new1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233217AbhINNzr (ORCPT ); Tue, 14 Sep 2021 09:55:47 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id E3E1D580339; Tue, 14 Sep 2021 09:54:29 -0400 (EDT) Received: from imap21 ([10.202.2.71]) by compute1.internal (MEProxy); Tue, 14 Sep 2021 09:54:29 -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=o1rdGWrst3yz3l9o6PKhZvLFS00Y bNnCxVpsc8+ZQ0Q=; b=Tkq2hX5SCFOnZrVbkgcBZ6C6zgNZnqwDeKDEAjc0NlUx tw5bG6yUexZ4EiHLAk4a4XRv0dUTjluL6jp62KFZR+yzY5+2da7QpDhWFfra0FHZ hx+JqOyJ2RaarqAY0q7ysbF7dQH0E7nAspoMq1+jKJhdON/rPKJeS8FKPjXvYN7p AXx0GqctvFlNzuJFcACMJpAZdGaFX/neNQvEwM4Y7+OEuNSI0uiqQY+Xy7u/f/GW gBtxBoQl9Yc5AQWZVZnQ8pFbgvs8ZJnXMm6Lz418NB7BpuS7knvr+VoZlNnBosJK O2Uiwp3kLDlmYZSVbIXabkhOTb5T3gfAAwtD13h6xA== 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=o1rdGW rst3yz3l9o6PKhZvLFS00YbNnCxVpsc8+ZQ0Q=; b=OTd+/B8/GhaKtCl5w+ORGZ V1Sy7PpckAAeRXVr8xCe8GPuN9wSnI3MjtEPqP43BGveZZaRGDxpad8//sZ7YxFM lO8caKEhcnCAtUsY2d+wzz4gAjlfF9HfvbkrCgdBlzg/VxsvXxmVPS5WO/d63i+f 51PPUsBAXUoEtCFNClwnWx7krafITnQN78kI+5gwiN0wvJvQWtNL5rHjDyKNcqMH tuOGqLjWZ/tzYbxPiLelmUNlYMm6lDYh/7eWwP3LXbnjuftEZL7nOlBJdxrGtJcG HVwCMP9cplCcwho7HNWCBbPFd/yDV3lfI/ttXy8RN5176rbt2H6h7v3qpnVXp8pg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudegledgieekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreerjeenucfhrhhomhepfdfuvhgv nhcurfgvthgvrhdfuceoshhvvghnsehsvhgvnhhpvghtvghrrdguvghvqeenucggtffrrg htthgvrhhnpeehjefgtddtfeelfeetjeeifeduueehleektdegtdejheeiteeuleehuefh geehgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hsvhgvnhesshhvvghnphgvthgvrhdruggvvh X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id C241151C0060; Tue, 14 Sep 2021 09:54:27 -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: <479322ce-b0e4-40e4-831e-387415b4e310@www.fastmail.com> In-Reply-To: <20210913182550.264165-10-maz@kernel.org> References: <20210913182550.264165-1-maz@kernel.org> <20210913182550.264165-10-maz@kernel.org> Date: Tue, 14 Sep 2021 15:54:07 +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_09/10]_iommu/dart:_Exclude_MSI_doorbell_from_PCI?= =?UTF-8?Q?e_device_IOVA_range?= 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 MSI doorbell on Apple HW can be any address in the low 4GB > range. However, the MSI write is matched by the PCIe block before > hitting the iommu. It must thus be excluded from the IOVA range > that is assigned to any PCIe device. > > Signed-off-by: Marc Zyngier It's not pretty but I'm not aware of any better solution and this should work as long as these two are always paired. With the small nit below addressed: Reviewed-by: Sven Peter > --- > drivers/iommu/apple-dart.c | 25 +++++++++++++++++++++++++ > drivers/pci/controller/Kconfig | 5 +++++ > drivers/pci/controller/pcie-apple.c | 4 +++- > 3 files changed, 33 insertions(+), 1 deletion(-) > > diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c > index 559db9259e65..d1456663688e 100644 > --- a/drivers/iommu/apple-dart.c > +++ b/drivers/iommu/apple-dart.c > @@ -721,6 +721,29 @@ static int apple_dart_def_domain_type(struct device *dev) > return 0; > } > > +#define DOORBELL_ADDR (CONFIG_PCIE_APPLE_MSI_DOORBELL_ADDR & PAGE_MASK) > + > +static void apple_dart_get_resv_regions(struct device *dev, > + struct list_head *head) > +{ > +#ifdef CONFIG_PCIE_APPLE I think using IS_ENABLED would be better here in case the pcie driver is built as a module which would then only define CONFIG_PCIE_APPLE_MODULE AIUI. Thanks, Sven