Received: by 2002:a19:771d:0:0:0:0:0 with SMTP id s29csp1263997lfc; Wed, 1 Jun 2022 13:30:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzyZ1HWRM/f0TG6MXc8LsByzDyLhGOLDXg87w36g1fU+XhmamPBzrcd8+ZYamPEh10IdLi9 X-Received: by 2002:a17:90a:1c1:b0:1e0:788a:ba35 with SMTP id 1-20020a17090a01c100b001e0788aba35mr35941740pjd.13.1654115441610; Wed, 01 Jun 2022 13:30:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654115441; cv=none; d=google.com; s=arc-20160816; b=wcJVuI24lD2bN0QBxI33No6z02go1agQKohw7Zy+N15fC5lfta4w9+mF/LfwX/89IW ur4ICqb+CrgXmE9Qgrz+4CEUjJIaUbRM5J+WQD/HzJAEprM+J36iG2iM9F2nt8IODIZK 3VwmThrWqfviDSnkZ36d5TZG8p12RTpp7WZSAGRFjyL9bIJoqlXxi3Wupvwvl/3n2M0E iomxH5wTfAmRAG+J0FUebo6boRV/E1js6ODPUUUJFX7Yz2rzYTpmm77U3HeisZcNuB8c x1TvlynYL79yoTLsTqhQnY/KLNjTZ7LLARn8mN3CcZhZVmD7IbWivIsEcSSMpkMJq2Ek Ro3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=40PFJ0KLH49o2a7cmdjfg2UDZMZZdNplRaKSZa0P70Q=; b=XIiu3OJ9eHG1pvkJgojiSGXoD/E6yalIAUJJZose+BDvr+ji6qF6yGFGabN6zmqy15 H0VHsf0DfVikopHlQu76UZ8ASqfv3xVvY62+5RU/YBaOcx/t1DvG9dMvwOGRA5lppUV6 1ED3q6U1mHCxrV6DDEgkAcAkPaagWvuzHmUQP/CJfBCGeSF28Qp2HzvsMegXTLkK9LD8 JtpqCbxff0IpjZFJ9DzfvO+BEWz/Hyfi2sQeGvzRZ0c6K60whCAMxYzmbL+tBgDGTNhb CpOitVji2U3EcE+t070Jms+JrtCh2W148OM42+MjkgsJ40IXT3O9rcusbfVV0GamSy9O WCJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=LBlxs6gY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id pl5-20020a17090b268500b001e299f85017si6210992pjb.63.2022.06.01.13.30.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 13:30:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=LBlxs6gY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DF2651203E8; Wed, 1 Jun 2022 12:40:07 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347841AbiEaU5m (ORCPT + 99 others); Tue, 31 May 2022 16:57:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344273AbiEaU5i (ORCPT ); Tue, 31 May 2022 16:57:38 -0400 Received: from mail-yb1-xb2c.google.com (mail-yb1-xb2c.google.com [IPv6:2607:f8b0:4864:20::b2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BBE52180A; Tue, 31 May 2022 13:57:37 -0700 (PDT) Received: by mail-yb1-xb2c.google.com with SMTP id v106so19017104ybi.0; Tue, 31 May 2022 13:57:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=40PFJ0KLH49o2a7cmdjfg2UDZMZZdNplRaKSZa0P70Q=; b=LBlxs6gYEgXpIHzbh/d2m73G/hVo58iw9hM6LSB/n8UZVrLtWmWJcf/Kcknu7MJ9vm VSem7YSJt0MJpSwq27DrpYfJs87MeGMiD8s1bGVpRcg7ChM/HxOIEmrCouq8t3T4GkLy qRPBLVQk+Y8Nmh9lcPFusObbG7vzv07rFgyazbunNxfOYZ7ZpCAgsycDEnDP/TYzMZc2 0Y04REpfMJ1rBdirpsJZ8obMwZJXp67ko/TkIn/YxOaZhlzPR+TRulxC0Iv6bpR4301M mGEp2JR8EDIg7LqW/OzT3eyNzutKNAZBp+VUQuOepprYS6fQLo+ZjaO4z/MDjkqkqLyT B8+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=40PFJ0KLH49o2a7cmdjfg2UDZMZZdNplRaKSZa0P70Q=; b=6r6C2y3MWbMvJKlaf90OdMXdv2GmSGLZR7dfQrGgdCT0Ha1mLZ0XKE2fxiOAThbxFQ xk+D/pGsX/REw1tREJirpL+g6+bIlFLCzVHvYdCONLcjIZ4Sbwgu19OCScA8c1kHixaD TrjBJe3GcXUDNJM8lgjXtA/P3hi8cDoldqR743Uu7VFfV9sTkQkq9rqp1k1datbN6ZdZ mVD8nXxUymQLWSD+U974Z9NDW1Gf6P7EYD6MvhdV7RfUztrW52NIrCihb62/ca+D7rRz b0a1KcodqEw87GfQ+eyR9/07MfqRHx4jvTLW79PwSfAT62XQ8icpxqf4+IDfZiNmG5PX DZ9A== X-Gm-Message-State: AOAM530Mik3Mcm17ivFExQLWYike46z92Go5JSgDpm9RLHmNUJ2X5++m YmIfprikvWQDuNVoumkC2WCXSH8B68y9lmSaYuMSRZ5J X-Received: by 2002:a05:6902:1003:b0:64f:2e69:c97d with SMTP id w3-20020a056902100300b0064f2e69c97dmr59688647ybt.605.1654030656439; Tue, 31 May 2022 13:57:36 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: <20220531161910.GE25502@willie-the-truck> From: Rob Clark Date: Tue, 31 May 2022 13:57:37 -0700 Message-ID: Subject: Re: [PATCH 1/6] iommu/qcom: Use the asid read from device-tree if specified To: Will Deacon Cc: Konrad Dybcio , ~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 ," , 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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. BR, -R