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 5C7E5C433EF for ; Fri, 3 Jun 2022 18:05:17 +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=94IL3RJBYAV4wiMPh7kHUQJDMkO9roock7FE/VKvlSM=; b=QbkzEmiKLHwBZ1 10tWdc++rJP9JD3d3BHJUbgDIGza98NABHSj/p027S3Jch8q5Zs/Q1pkjBopb+aWM5CXAD/rrr0yg VPk4mN3RQ8kwxMHClE+UYZrCOUB3oNW5gAKxuvx7fFideItXanSMzEeKERs41Yajf5lVJcVekMlyq j3BnwvIYDTKwbP3sXkli9zi6ea6cKNmtRD31HASsHTdHQ92xKTMNMeldcGQwjxbslADiIiUXdVuWQ mYt/iFgkRKh+p6+uJJsVTbIzpQN21u1F3XMBlH7XEwUlOpOhUo1AGSg9lCVxesm/0f6cCNBWgOadp lNBS03/HqePhsqUY0IHg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nxBeF-008NeJ-N9; Fri, 03 Jun 2022 18:03:47 +0000 Received: from relay01.th.seeweb.it ([5.144.164.162]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nxBeB-008Nb7-Qd for linux-arm-kernel@lists.infradead.org; Fri, 03 Jun 2022 18:03:46 +0000 Received: from [192.168.1.101] (abxj27.neoplus.adsl.tpnet.pl [83.9.3.27]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by m-r1.th.seeweb.it (Postfix) with ESMTPSA id 7880920521; Fri, 3 Jun 2022 20:03:28 +0200 (CEST) Message-ID: <6efeafbc-d366-bddd-faa4-4359f3a56f4a@somainline.org> Date: Fri, 3 Jun 2022 20:03:27 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH 1/6] iommu/qcom: Use the asid read from device-tree if specified Content-Language: en-US To: Rob Clark , Will Deacon Cc: ~postmarketos/upstreaming@lists.sr.ht, linux-arm-msm , Bjorn Andersson , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , "list@263.net:IOMMU DRIVERS" , Joerg Roedel , iommu@lists.linux-foundation.org, Martin Botka , AngeloGioacchino Del Regno , Marijn Suijten , jamipkettunen@somainline.org, Andy Gross , Joerg Roedel , Rob Herring , Krzysztof Kozlowski , Robin Murphy , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux Kernel Mailing List References: <20220527212901.29268-1-konrad.dybcio@somainline.org> <20220527212901.29268-2-konrad.dybcio@somainline.org> <20220531154631.GA25502@willie-the-truck> <20220531161910.GE25502@willie-the-truck> From: Konrad Dybcio In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220603_110344_071340_131875E0 X-CRM114-Status: GOOD ( 23.98 ) 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 31.05.2022 22:57, Rob Clark wrote: > On Tue, May 31, 2022 at 9:19 AM Will Deacon wrote: >> >> On Tue, May 31, 2022 at 09:15:22AM -0700, Rob Clark wrote: >>> On Tue, May 31, 2022 at 8:46 AM Will Deacon wrote: >>>> >>>> On Fri, May 27, 2022 at 11:28:56PM +0200, Konrad Dybcio wrote: >>>>> From: AngeloGioacchino Del Regno >>>>> >>>>> As specified in this driver, the context banks are 0x1000 apart. >>>>> Problem is that sometimes the context number (our asid) does not >>>>> match this logic and we end up using the wrong one: this starts >>>>> being a problem in the case that we need to send TZ commands >>>>> to do anything on a specific context. >>>> >>>> I don't understand this. The ASID is a software construct, so it shouldn't >>>> matter what we use. If it does matter, then please can you explain why? The >>>> fact that the context banks are 0x1000 apart seems unrelated. >>> >>> I think the connection is that mapping from ctx bank to ASID is 1:1 >> >> But in what sense? How is the ASID used beyond a tag in the TLB? The commit >> message hints at "TZ commands" being a problem. >> >> I'm not doubting that this is needed to make the thing work, I just don't >> understand why. > > (disclaimer, it has been quite a while since I've looked at the smmu > setup with earlier tz, ie. things that use qcom_iommu, but from > memory...) > > We cannot actually assign the context banks ourselves, so in the dt > bindings the "ASID" is actually the context bank index. I think so. I don't > remember exactly if this was a limitation of the tz interface, or > result of not being able to program the smmu's global registers > ourselves. As far as I understand, it's the latter, as changing the defaults is not allowed by the security policy on consumer devices. Qualcomm arbitrarily chose some numbers that may or may have not aligned with their usual index-is-offset-divided-by-0x1000 and hardcoded them in the BSP, and now the secure side (if required, and well, it is..) expects precisely that configuration. Konrad _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel