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=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 3F229C433E7 for ; Mon, 12 Oct 2020 07:33:18 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 BA3BE2080D for ; Mon, 12 Oct 2020 07:33:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="wYyfk56j"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="b0UFofGe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BA3BE2080D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=54Kq94NLsZgl6/A/pqKpX/IpdjDQIVMLq2oCP+nAKqM=; b=wYyfk56j6P4mUKyd/Q0IDNsk+ GftuPa/apA9sQtMdN/5LmNAcReEw5+TD1VqpOT4KQIeAQodHKUDAbOj/K+WLhCnPWctTbP7ZDyJOT gHKuTiqkFtSYSWNwcu7nNg+tAMbNvlCyDXhfWzT/XHtI7lYSJuBEJ1FUaHOQ1dFc/7ERey9ZZIiDR e1D8S0GUQb8rBuV1auXkf7rcdnvZ5ySwEyzgVz6gTp1IKrkMsK/NlYDDj221QwbFGeNEqff0l5gDh +Ht171oQt5iGELBZGwryqdspeS08+r7wDNcN9nqh0/Es/dlaqpHkeJAgADc43u72EH6zpJUbWgN9L 5094lGBNg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kRsJM-0006N9-JT; Mon, 12 Oct 2020 07:32:00 +0000 Received: from mail-ed1-x543.google.com ([2a00:1450:4864:20::543]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kRsJJ-0006M0-KC for linux-arm-kernel@lists.infradead.org; Mon, 12 Oct 2020 07:31:59 +0000 Received: by mail-ed1-x543.google.com with SMTP id o18so15858810edq.4 for ; Mon, 12 Oct 2020 00:31:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=CzDxLaDLFJzWcap/ARMkfpBesRsQ6cFDLsAfzEHhwNg=; b=b0UFofGey9MHN4SSKeWJne/jISh0kZ4rKs08Umat1GtUhptcnknv3VsZFMe74YDxK8 +JFbEMLjSb3QLuIDhnLOtzA8nFoFEAtB07cpzErKshtf7030J2/yyB2L8QDfIJM6IFMG wOgjFRhEoC0PoIJ1v5e52Av5WQBBAKNAChPIDSvM3CHvCIEEA1uWvjmJ9cXZJvrc70R2 DbQR1JXv2jr8nGlgyMO1cZ1JtR6tayglpD8EwubGrKVXQgUgRCvptXMtyhJBm+3VbHFc qPo/L0Y73MO+zXoSQ+VKiA4TKFVoReqFKJE9CBqM6095iH22+gT3A2xMNboe/ZQxGfxl uF3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=CzDxLaDLFJzWcap/ARMkfpBesRsQ6cFDLsAfzEHhwNg=; b=m5czKTI55dTZtlo2Xcx5mWga0P/u/FIYhWqraTlb4FRr2Cll2qxKcxp89xgHgTqqlr JhZC4Lf8FaQYn5TylIOUpNbmLKzgAk/zTgjwU+z18O07XzPrtTPBRtngu8hJMw7+3dK3 P+aZ5GdY5R7gyXFwubOAQzcTFSYIMHpOmMyKDiTWtbmn1j6sWB+om4rQA9zfIsHyU+v1 JUafCKMILZbd9rqvyM0kBlwD5CLYxB/AdiJ6MIzr2fDhozDHTT4UD8ENO6cVx5U5U1qf nqDiRQPciHnV/GtjmJ05LjIRN8ylh+3NYFzO68mKuHOoleWKhk4+cm49U7lixVRFJHhO aeXQ== X-Gm-Message-State: AOAM533EeQwg5sH8jzWhpRLTifchUdl6EX8hI73S+l6DD1rFNdLR/NWN RRTV22t4tDQ14s5mpO7ratjcbg== X-Google-Smtp-Source: ABdhPJxaZ45/LGCB6zLJp30ygGXXJGsXRsI9tcD8xqo9itEMOS9n1yfi201ECa1UI9OmrMS8rBHpBg== X-Received: by 2002:aa7:dcc7:: with SMTP id w7mr12914876edu.80.1602487914471; Mon, 12 Oct 2020 00:31:54 -0700 (PDT) Received: from yoga ([194.182.8.81]) by smtp.gmail.com with ESMTPSA id n22sm10021525eji.106.2020.10.12.00.31.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 00:31:53 -0700 (PDT) Date: Mon, 12 Oct 2020 09:31:52 +0200 From: Bjorn Andersson To: Will Deacon Subject: Re: [PATCH v3 6/8] iommu/arm-smmu: Add impl hook for inherit boot mappings Message-ID: <20201012073152.GA2998@yoga> References: <20200904155513.282067-1-bjorn.andersson@linaro.org> <20200904155513.282067-7-bjorn.andersson@linaro.org> <0bfcc8f7-d054-616b-834b-319461b1ecb9@arm.com> <20200913032559.GT3715@yoga> <20200921210814.GE3811@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200921210814.GE3811@willie-the-truck> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201012_033158_032958_E43FEDDA X-CRM114-Status: GOOD ( 33.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Clark , Sai Prakash Ranjan , linux-arm-msm@vger.kernel.org, Joerg Roedel , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Jordan Crouse , Sibi Sankar , Robin Murphy , linux-arm-kernel@lists.infradead.org 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 Mon 21 Sep 23:08 CEST 2020, Will Deacon wrote: > On Sat, Sep 12, 2020 at 10:25:59PM -0500, Bjorn Andersson wrote: > > On Fri 11 Sep 12:13 CDT 2020, Robin Murphy wrote: > > > On 2020-09-04 16:55, Bjorn Andersson wrote: > > > > Add a new operation to allow platform implementations to inherit any > > > > stream mappings from the boot loader. > > > > > > Is there a reason we need an explicit step for this? The aim of the > > > cfg_probe hook is that the SMMU software state should all be set up by then, > > > and you can mess about with it however you like before arm_smmu_reset() > > > actually commits anything to hardware. I would have thought you could > > > permanently steal a context bank, configure it as your bypass hole, read out > > > the previous SME configuration and tweak smmu->smrs and smmu->s2crs > > > appropriately all together "invisibly" at that point. > > > > I did this because as of 6a79a5a3842b ("iommu/arm-smmu: Call > > configuration impl hook before consuming features") we no longer have > > setup pgsize_bitmap as we hit cfg_probe, which means that I need to > > replicate this logic to set up the iommu_domain. > > > > If I avoid setting up an iommu_domain for the identity context, as you > > request in patch 8, this shouldn't be needed anymore. > > > > > If that can't work, I'm very curious as to what I've overlooked. > > > > > > > I believe that will work, I will rework the patches and try it out. > > Did you get a chance to rework this? > Finally got a chance to dig through this properly. Initial results where positive and with an implementation of cfg_probe in qcom_smmu_impl I'm able to probe the arm-smmu driver just fine - and display (e.g. efifb) stays alive. Unfortunately as the display driver (drivers/gpu/drm/msm) is about to probe a new iommu domain is created, which due to its match against qcom_smmu_client_of_match[] becomes of type IOMMU_DOMAIN_IDENTITY. This results in a S2CR of BYPASS type, which the firmware intercepts and turns the stream into a type FAULT. So while the cfg_probe looks very reasonable we're still in need of a mechanism to use the fake identity context for the iommu domain associated with the display controller. The workings of the display driver is that it gets the iommu domain setup for byass and then after that creates a translation context for this same stream where it maps the framebuffer. For testing purposes I made def_domain_type always return 0 in the qcom impl and the result is that we get a few page faults while probing the display driver, but these are handled somewhat gracefully and the initialization did proceed and the system comes up nicely (but in the case that the display driver would probe defer this leads to an storm of faults as the screen continues to be refreshed). TL;DR I think we still need to have a way to get the arm-smmu driver to allow the qcom implementation to configure identity domains to use translation - but we can make the setup of the identity context a detail of the qcom driver. Regards, Bjorn _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel