From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.marcansoft.com (marcansoft.com [212.63.210.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1DC647FD; Thu, 5 Jan 2023 04:44:02 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: marcan@marcan.st) by mail.marcansoft.com (Postfix) with ESMTPSA id B287E3FB17; Thu, 5 Jan 2023 04:43:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=marcan.st; s=default; t=1672893840; bh=DJFwNUoKB/UR71s75mzuMGeNsfe9rog8IsGcCazIn0s=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=Hg3L7LNtuu+NUhRLVJ1RsE1pg5d1trRhwcI9TNMjpYeAYGE09jrE4aM6ev/6H7hWF tR/YtI8q0N77OvjKGREUfiR4MzeYWzLUfW8tNqpu+kEnM2bjkKDGDJ2FU/dt2fTDab KDq5SvZDAP+NWKXSNQgtHecvp1/yZ7LBQSeaICQLCJzy+N2TS59lhuJIb135hF+4Sx GOeKYptu8Rz+yciSmqqC3Jrhg/7Iv2Njqp+H2bgD+wOxSr3PF0tN0s+EzVaMBLs3KF vqgoDQmyPwhDDPmXWgfkBbNV0hfCXc9yUcDhzCiGzmG4S7HVuM+tMbiPA6kgQ/ZtWZ s2U+Vme/xBL4g== Message-ID: <3af091e9-09b4-53a0-da2d-5b2640040b9d@marcan.st> Date: Thu, 5 Jan 2023 13:43:54 +0900 Precedence: bulk X-Mailing-List: asahi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH 3/7] iommu: dart: Support >64 stream IDs Content-Language: en-US To: Sven Peter , Joerg Roedel , Will Deacon , Robin Murphy Cc: Alyssa Rosenzweig , Janne Grunau , Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org, iommu@lists.linux.dev, asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20230104110013.24738-1-marcan@marcan.st> <20230104110013.24738-4-marcan@marcan.st> <71bffbd4-f8b0-4201-b2eb-7a15847ac2c6@app.fastmail.com> From: Hector Martin In-Reply-To: <71bffbd4-f8b0-4201-b2eb-7a15847ac2c6@app.fastmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 2023/01/04 22:37, Sven Peter wrote: >> #include "dma-iommu.h" >> >> -#define DART_MAX_STREAMS 16 >> +#define DART_MAX_STREAMS 256 > > Feels a bit wasteful to allocate 256-wide sid2group and save_{tcr,ttbr} > arrays even for the M1 where 16 are enough. But then again, that's still <100 KiB > for all DARTs combined and these machine have >8 GiB of RAM so it probably won't > make a difference Yeah, I don't think this is worth the extra fumbling around with dynamic allocation. >> /* enable all streams globally since TCR is used to control isolation */ >> - writel(DART_STREAM_ALL, dart->regs + DART_STREAMS_ENABLE); >> + for (i = 0; i < BITS_TO_U32(dart->num_streams); i++) >> + writel(U32_MAX, dart->regs + DART_STREAMS_ENABLE); > > This seems weird: this code writes U32_MAX to the same register > again and again. Whoops, that was supposed to have a `+ 4 * i` in there. Fixed for v2. - Hector 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 8B919C4708E for ; Thu, 5 Jan 2023 19:01:36 +0000 (UTC) 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:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7gXi/bv47OiU+HHBcJBl6b2ZLjPkR9NdQOjtoBKiBBI=; b=yB/Qvkddunp+YO mE1xPffXJEX0VuGsNSJU7Ho7joOMZs9eVX49kOmw7YVuYRA6CtFm4+R7QV9qMDJzVhHR2YO0YXPgT 7UzxGFfrI9JRCKQ4JH38gLWdJnLJnF/LBg0qnY7LCvsxqMXkVxt6iIovFkZ2gnDdUVegEgJ74G1Df bid/epr7tHAgaeUqiop8nLgk6y9APoQ2D5MC1f7zGTuEONDq9dMT783AQm6LDB++Ispq3xNLf7ExC NsZRGXua5GCJTf9R0TugqU1psKmQGhMicNrosMG0IqwjPPi/yU9wSz80uCdBMJlCayiefoxV6yrBr LUuLOO8OnOVJ35+uUTVw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDVTF-00Dv0d-Go; Thu, 05 Jan 2023 19:00:10 +0000 Received: from marcansoft.com ([212.63.210.85] helo=mail.marcansoft.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDI6s-002xtw-Jx for linux-arm-kernel@lists.infradead.org; Thu, 05 Jan 2023 04:44:12 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: marcan@marcan.st) by mail.marcansoft.com (Postfix) with ESMTPSA id B287E3FB17; Thu, 5 Jan 2023 04:43:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=marcan.st; s=default; t=1672893840; bh=DJFwNUoKB/UR71s75mzuMGeNsfe9rog8IsGcCazIn0s=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=Hg3L7LNtuu+NUhRLVJ1RsE1pg5d1trRhwcI9TNMjpYeAYGE09jrE4aM6ev/6H7hWF tR/YtI8q0N77OvjKGREUfiR4MzeYWzLUfW8tNqpu+kEnM2bjkKDGDJ2FU/dt2fTDab KDq5SvZDAP+NWKXSNQgtHecvp1/yZ7LBQSeaICQLCJzy+N2TS59lhuJIb135hF+4Sx GOeKYptu8Rz+yciSmqqC3Jrhg/7Iv2Njqp+H2bgD+wOxSr3PF0tN0s+EzVaMBLs3KF vqgoDQmyPwhDDPmXWgfkBbNV0hfCXc9yUcDhzCiGzmG4S7HVuM+tMbiPA6kgQ/ZtWZ s2U+Vme/xBL4g== Message-ID: <3af091e9-09b4-53a0-da2d-5b2640040b9d@marcan.st> Date: Thu, 5 Jan 2023 13:43:54 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH 3/7] iommu: dart: Support >64 stream IDs Content-Language: en-US To: Sven Peter , Joerg Roedel , Will Deacon , Robin Murphy Cc: Alyssa Rosenzweig , Janne Grunau , Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org, iommu@lists.linux.dev, asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20230104110013.24738-1-marcan@marcan.st> <20230104110013.24738-4-marcan@marcan.st> <71bffbd4-f8b0-4201-b2eb-7a15847ac2c6@app.fastmail.com> From: Hector Martin In-Reply-To: <71bffbd4-f8b0-4201-b2eb-7a15847ac2c6@app.fastmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230104_204411_063191_719041E3 X-CRM114-Status: GOOD ( 11.31 ) 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 On 2023/01/04 22:37, Sven Peter wrote: >> #include "dma-iommu.h" >> >> -#define DART_MAX_STREAMS 16 >> +#define DART_MAX_STREAMS 256 > > Feels a bit wasteful to allocate 256-wide sid2group and save_{tcr,ttbr} > arrays even for the M1 where 16 are enough. But then again, that's still <100 KiB > for all DARTs combined and these machine have >8 GiB of RAM so it probably won't > make a difference Yeah, I don't think this is worth the extra fumbling around with dynamic allocation. >> /* enable all streams globally since TCR is used to control isolation */ >> - writel(DART_STREAM_ALL, dart->regs + DART_STREAMS_ENABLE); >> + for (i = 0; i < BITS_TO_U32(dart->num_streams); i++) >> + writel(U32_MAX, dart->regs + DART_STREAMS_ENABLE); > > This seems weird: this code writes U32_MAX to the same register > again and again. Whoops, that was supposed to have a `+ 4 * i` in there. Fixed for v2. - Hector _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel