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=-9.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 681E8C07E99 for ; Mon, 12 Jul 2021 11:04:42 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 26D1660FEB for ; Mon, 12 Jul 2021 11:04:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 26D1660FEB Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=svenpeter.dev Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:Cc:To:From:Date:References: In-Reply-To:Message-Id:Mime-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=yyXfkkjE1Nmba8Q9VNcrbK6yqkQ9G04+vlm9MNy2lso=; b=ccoAt7PnZw5c28 dxSFcciSiNi98YTu1lwRN9Z2hnpu8X/Y/OoYOP6ubvMfSVpaUutIOlMSLIzzllxtNhf/2J3A0RgG9 tqqntzSWL5ly1RVWQueCxGSS2d8XZS3Hrew2/qh85CMxY32jk9hY4W239EQF0xT/ZqmydAmS3XS9O LXOVu3gjpCgXgOLJBNbjx6BaxSv9g6l15Y5X2y1ySq2GVeuAo8fbOBLiEiv1Jpay46P0mymDHpYfN Qkj7dwYto2v6UDBo9tO7YurNMYiTUlsHkgGJDIQjX/8s6FQT6i64biL3kIQaSJ8e+5KUS0o9wm8ca rK6dPCqo7ChBIyf66DPg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2tiB-0075Gb-3n; Mon, 12 Jul 2021 11:02:55 +0000 Received: from new2-smtp.messagingengine.com ([66.111.4.224]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2ti7-0075F9-R0 for linux-arm-kernel@lists.infradead.org; Mon, 12 Jul 2021 11:02:53 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id 91254580AF9; Mon, 12 Jul 2021 07:02:46 -0400 (EDT) Received: from imap21 ([10.202.2.71]) by compute1.internal (MEProxy); Mon, 12 Jul 2021 07:02:46 -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=fm1; bh=7XyyQqaPm43E+iSA6HEfleHFR36O XWaTALDg2LKUkgk=; b=xwjCPhQd0xWBFg4xsAE2OGMHZIACEIN1AJC4/+P1tGFa zFL9zncOUF+88bPV4qC+v3E7iAk/B35NTHUyEOSkRgG7DSSWNVNPahmq1x1xIyt8 4izt0VYsxKGG+T46UjGfpIaKfZZ8Es+pEE3BrhqUGS7NrwHItHj7ziHDqLCk5yO5 BX+j+ak2TQILZEpGSnmaTz8D8iZNqvD9hKOGjsXr++0eL8e/9vH9MZhsMLb6F3Lm b1N5B6ApWbQAr81c0TUy+atLA/e2NCg0RhEgz+5avim4jRUbr/EbCUjk7N5e5VHr LbbySTBnDLc9v/AOt3UjWzA4FeKCRsE0CDoOLA5yng== 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=7XyyQq aPm43E+iSA6HEfleHFR36OXWaTALDg2LKUkgk=; b=ouodfEzeihWXi3YKhCGJZb 3fslL+cRjTPE3SGqWePpDDraM1i8uBW7MNNt9ObldK51+CKThOEA+xoBsIwyrEOz rjcnOgpxvNKQlv3ZRKmqJFQk48dBEDdlzgnevSfYpdfNy6aEMRDbWeKHZsSjAQ6s zzOs35CsOfDIQkV0yIVkYU8lancSJLXt1Ih04iiN0+jJUGDELJWZBt2U3SEPFpVo CPYkW1LNkeKgY7ToNMwfWrbrZ7m+FSW29OqJsbsh/fVculWVsWOuhOxU/YTQEct2 twiAkhSj+LxuB5iSs4FrpVv5wg5e+fzmMcb2oa8D/lNbjtCQkPA9oAJmqPF1Zu5Q == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddvgdeffecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvufgtsehttdertderredtnecuhfhrohhmpedfufhvvghn ucfrvghtvghrfdcuoehsvhgvnhesshhvvghnphgvthgvrhdruggvvheqnecuggftrfgrth htvghrnhepgfeigeeiffeuhfettdejgfetjeetfeelfefgfefgvddvtdfghfffudehvdef keffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepsh hvvghnsehsvhgvnhhpvghtvghrrdguvghv X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id D489951C0060; Mon, 12 Jul 2021 07:02:44 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-531-g1160beca77-fm-20210705.001-g1160beca Mime-Version: 1.0 Message-Id: <16ffb4ec-86a4-4300-b175-5d7a1fcbf994@www.fastmail.com> In-Reply-To: References: <20210627143405.77298-1-sven@svenpeter.dev> <20210627143405.77298-4-sven@svenpeter.dev> Date: Mon, 12 Jul 2021 13:02:24 +0200 From: "Sven Peter" To: "Alyssa Rosenzweig" Cc: "Will Deacon" , "Robin Murphy" , "Joerg Roedel" , "Arnd Bergmann" , devicetree@vger.kernel.org, "Hector Martin" , linux-kernel@vger.kernel.org, "Marc Zyngier" , "Mohamed Mediouni" , "Stan Skowronek" , linux-arm-kernel@lists.infradead.org, "Mark Kettenis" , "Petr Mladek via iommu" , "Alexander Graf" , "Alyssa Rosenzweig" , "Rob Herring" , "Rouven Czerwinski" Subject: Re: [PATCH v4 3/3] iommu: dart: Add DART iommu driver X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210712_040251_988607_7458884C X-CRM114-Status: GOOD ( 20.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, On Wed, Jun 30, 2021, at 15:49, Alyssa Rosenzweig wrote: > Looks really good! Just a few minor comments. With them addressed, > > Reviewed-by: Alyssa Rosenzweig Thanks! > > > + Say Y here if you are using an Apple SoC with a DART IOMMU. > > Nit: Do we need to spell out "with a DART IOMMU"? Don't all the apple > socs need DART? Good point, I'll remove it. > > > +/* > > + * This structure is used to identify a single stream attached to a domain. > > + * It's used as a list inside that domain to be able to attach multiple > > + * streams to a single domain. Since multiple devices can use a single stream > > + * it additionally keeps track of how many devices are represented by this > > + * stream. Once that number reaches zero it is detached from the IOMMU domain > > + * and all translations from this stream are disabled. > > + * > > + * @dart: DART instance to which this stream belongs > > + * @sid: stream id within the DART instance > > + * @num_devices: count of devices attached to this stream > > + * @stream_head: list head for the next stream > > + */ > > +struct apple_dart_stream { > > + struct apple_dart *dart; > > + u32 sid; > > + > > + u32 num_devices; > > + > > + struct list_head stream_head; > > +}; > > It wasn't obvious to me why we can get away without reference counting. > Looking ahead it looks like we assert locks in each case. Maybe add > that to the comment? Sure, I'll add that to the comment. > > ``` > > +static void apple_dart_hw_set_ttbr(struct apple_dart *dart, u16 sid, u16 idx, > > + phys_addr_t paddr) > > +{ > > + writel(DART_TTBR_VALID | (paddr >> DART_TTBR_SHIFT), > > + dart->regs + DART_TTBR(sid, idx)); > > +} > ``` > > Should we be checking alignment here? Something like > > BUG_ON(paddr & ((1 << DART_TTBR_SHIFT) - 1)); > Sure, right now paddr will always be aligned but adding that BUG_ON doesn't hurt :) Best, Sven _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel