Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2278045rdb; Fri, 8 Dec 2023 03:49:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IH8dMhu2QmI95Cn0JNSiRcI3lPKi7o5h/JCi4Z10WzvIWY5HyyQ7gSxMmmxHvk/3XHunYBH X-Received: by 2002:a05:6358:640b:b0:170:40e5:c420 with SMTP id f11-20020a056358640b00b0017040e5c420mr5026839rwh.45.1702036193195; Fri, 08 Dec 2023 03:49:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702036193; cv=none; d=google.com; s=arc-20160816; b=IhcOnLG7F/pgG4JIYsbxwhSU5bRAUW0VSquZvl2SrcIy9G0jWgx4a0JyHv/8QokTj3 Mi4ZBHrEsYIYKfRZfVrxQBrM6VTJ23uPMV+eXpmB2iyl8g1nxDPlbcF+DrVFORguJA3G LloQ8S+pI713ZFmoa7C5UsbdGceRY3yMBbMd6H9sTCXIrElaOg7ObTOw1rblDxO7sXNc rnIJyHV6kESsRgOMA8VMQR09QTIewANllyTkKC50JlR/g9hXQX8kPEua0fzX3kSJzhDv uTnhC4wcEnswhUA7y9AODfRSTzWQjpnxRV2biegL9h/ahuiIHdVviPrKgtmOJploJLY5 Y4Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=95XtuzcT9GBtV2Ka5YZYTGyBDLiyt3cFTtzCGgWTmzc=; fh=mldm7qgTGOyoYeFAoD0w8t/K4lowQGWgTs3m6a/KMn0=; b=i91QDjkA6JUMFTzFCZsBpd+xMFDYRBbYP5AWjTwY1xc14keIAmqUE/C/ptJoz7a/m2 0JkDsGnqw7E3iiAbvfRGb8BWgu1sHPCav93h61k83l4U/eRbYDdR73GOHpyYn+k4qk/x HLbkh/Ov3hiDyzN7SrMSeBs1Emz6TgKNkrCGOUVay/3MX60OySDdb8mFVcNscz/JW+QX VKbUFzW3f9YmmSxmOtTkC7C5e7KbNwZUBk0uT1Y44JPejFW+FiibbaVMCiD+PbNx7qWo 6NW36giLovjfll147A98k52H50+z1AusS0RX/e4f6jDAAdJuwh7XEibFyeu8Lof+yxkx QaKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id a190-20020a6390c7000000b005c6969f57ddsi1404165pge.859.2023.12.08.03.49.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 03:49:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id DEE848374BB9; Fri, 8 Dec 2023 03:49:50 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573540AbjLHLtL (ORCPT + 99 others); Fri, 8 Dec 2023 06:49:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232873AbjLHLtI (ORCPT ); Fri, 8 Dec 2023 06:49:08 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B6A0D1723; Fri, 8 Dec 2023 03:49:14 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 221FB1063; Fri, 8 Dec 2023 03:50:00 -0800 (PST) Received: from [10.1.196.40] (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 294493F762; Fri, 8 Dec 2023 03:49:12 -0800 (PST) Message-ID: <8e4b3c92-f2e4-48f3-848e-776a64fe1d31@arm.com> Date: Fri, 8 Dec 2023 11:49:10 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] iommu/arm-smmu-qcom: Add missing GMU entry to match table Content-Language: en-GB To: Rob Clark , iommu@lists.linux-foundation.org Cc: freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, Rob Clark , Will Deacon , Joerg Roedel , Konrad Dybcio , Dmitry Baryshkov , Bjorn Andersson , Elliot Berman , Richard Acayan , Manivannan Sadhasivam , "moderated list:ARM SMMU DRIVERS" , "open list:IOMMU SUBSYSTEM" , open list References: <20231207212441.6199-1-robdclark@gmail.com> From: Robin Murphy In-Reply-To: <20231207212441.6199-1-robdclark@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 08 Dec 2023 03:49:51 -0800 (PST) On 07/12/2023 9:24 pm, Rob Clark wrote: > From: Rob Clark > > We also want the default domain for the GMU to be an identy domain, > so it does not get a context bank assigned. Without this, both > of_dma_configure() and drm/msm's iommu_domain_attach() will trigger > allocating and configuring a context bank. So GMU ends up attached > to both cbndx 1 and cbndx 2. I can't help but read this as implying that it gets attached to both *at the same time*, which would be indicative of a far more serious problem in the main driver and/or IOMMU core code. However, from what we discussed on IRC last night, it sounds like the key point here is more straightforwardly that firmware expects the GMU to be using context bank 1, in a vaguely similar fashion to how context bank 0 is special for the GPU. Clarifying that would help explain why we're just doing this as a trick to influence the allocator (i.e. unlike some of the other devices in this list we don't actually need the properties of the identity domain itself). In future it might be nice to reserve this explicitly on platforms which need it and extend qcom_adreno_smmu_alloc_context_bank() to handle the GMU as well, but I don't object to this patch as an immediate quick fix for now, especially as something nice and easy for stable (I'd agree with Johan in that regard). Thanks, Robin. > This arrangement seemingly confounds > and surprises the firmware if the GPU later triggers a translation > fault, resulting (on sc8280xp / lenovo x13s, at least) in the SMMU > getting wedged and the GPU stuck without memory access. > > Signed-off-by: Rob Clark > --- > drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c > index 549ae4dba3a6..d326fa230b96 100644 > --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c > +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c > @@ -243,6 +243,7 @@ static int qcom_adreno_smmu_init_context(struct arm_smmu_domain *smmu_domain, > > static const struct of_device_id qcom_smmu_client_of_match[] __maybe_unused = { > { .compatible = "qcom,adreno" }, > + { .compatible = "qcom,adreno-gmu" }, > { .compatible = "qcom,mdp4" }, > { .compatible = "qcom,mdss" }, > { .compatible = "qcom,sc7180-mdss" },