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 7A8CFC3DA61 for ; Tue, 30 Jul 2024 10:12:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type: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=FLs6knT+yc6n2ZqGkxmqymu+J0NdNUGZwUaLewO79ks=; b=cs9aMZaSg28cII4zUkfuqiZY09 WeMrbxZgOML/gUNK7ISWxM19Fwo81H9pAweeQbYv4XObI1QCwI/16PmxVIP1AoK1rp5PnpXvrdv0l jD3+qQ8hvX6Dt842UgnQzcXK992LgPSza0JAsFtUhFfWV2oCWij11ccnlc4n90RwQpqzClFnsFF0B HbX/36NMtTGlDUt1E2SI54jZNbDDMjes3wAFrsuB4HQVEQOj9V03cuHVmFcLAeLwoRGJmf92Rryfh 8YRd7TOt8eCc3r/VwkI+u5xVxCfFPMxgUUs7X8dqKgQ3eIx120WpsAYm3BUzvtX2Px+27emv+fdO4 j4fyLzyQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYjqP-0000000Eg4B-08Ou; Tue, 30 Jul 2024 10:12:37 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYjpx-0000000Efxo-2K6r for linux-arm-kernel@lists.infradead.org; Tue, 30 Jul 2024 10:12:11 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 997CC61E79; Tue, 30 Jul 2024 10:12:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A35EC4AF0B; Tue, 30 Jul 2024 10:12:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722334328; bh=ZvLJ7/SCtIJfceG7grSTidcofEdpC9aUrnISK46Oynk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=TzAkECY4JNH4TLHCFfcsFDcb5DKrTkXbLmxGBDeyy9sggTlAlbXVWZxCEQOF5LaHk OYMT2h/VZy297tSeX2CHiotuYPJQAxVUrKil0NKFe/ElEDSzIfWiZKa32gWNDOpgNU DzEWtU5nQ8rvJSxMrAiRio1DmnVSzAFS1Mn2B0BJbVZ9UcI2zwRRt8MlOnYdJclLrW 8VyEDJIZO49Kldu0UVtR9ERik+1hQLn0NqYXva40Wg5M2q+2ZOVJVPcajAFTHF2wJs 1hKdOQQM7zvUPdykgB/UhRddR/3NgWkRA162NSnsujO5BhAraLFigbbLGboDC4JBTj I/u8oC/78F/iQ== Message-ID: <691ee925-b214-4b68-8d7b-ecb54f865cfc@kernel.org> Date: Tue, 30 Jul 2024 12:12:01 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] iommu/arm-smmu-qcom: Work around SDM845 Adreno SMMU w/ 16K pages To: Dmitry Baryshkov Cc: Rob Clark , Konrad Dybcio , Bjorn Andersson , Will Deacon , Robin Murphy , Joerg Roedel , Marijn Suijten , iommu@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Konrad Dybcio , Sumit Semwal References: <20240729-topic-845_gpu_smmu-v1-1-8e372abbde41@kernel.org> <3332c732-4555-46bf-af75-aa36ce2d58df@gmail.com> Content-Language: en-US From: Konrad Dybcio In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240730_031209_701508_F08F276A X-CRM114-Status: GOOD ( 17.34 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 30.07.2024 10:50 AM, Dmitry Baryshkov wrote: > On Tue, 30 Jul 2024 at 11:08, Konrad Dybcio wrote: >> >> On 29.07.2024 11:21 PM, Dmitry Baryshkov wrote: >>> On Tue, 30 Jul 2024 at 00:08, Rob Clark wrote: >>>> >>>> On Mon, Jul 29, 2024 at 1:14 PM Dmitry Baryshkov >>>> wrote: >>>>> >>>>> On Mon, Jul 29, 2024 at 10:37:48AM GMT, Konrad Dybcio wrote: >>>>>> From: Konrad Dybcio >>>>>> >>>>>> SDM845's Adreno SMMU is unique in that it actually advertizes support >>>>>> for 16K (and 32M) pages, which doesn't hold for newer SoCs. >>>>>> >>>>>> This however, seems either broken in the hardware implementation, the >>>>>> hypervisor middleware that abstracts the SMMU, or there's a bug in the >>>>>> Linux kernel somewhere down the line that nobody managed to track down. >>>>>> >>>>>> Booting SDM845 with 16K page sizes and drm/msm results in: >>>>>> >>>>>> *** gpu fault: ttbr0=0000000000000000 iova=000100000000c000 dir=READ >>>>>> type=TRANSLATION source=CP (0,0,0,0) >>>>>> >>>>>> right after loading the firmware. The GPU then starts spitting out >>>>>> illegal intstruction errors, as it's quite obvious that it got a >>>>>> bogus pointer. >>>>>> >>>>>> Hide 16K support on SDM845's Adreno SMMU to work around this. >>>>>> >>>>>> Reported-by: Sumit Semwal >>>>>> Signed-off-by: Konrad Dybcio >>>>>> --- >>>>>> There's a mismatch in sender/committer addresses but that's "fine": >>>>>> https://lore.kernel.org/linux-usb/2024072734-scenic-unwilling-71ea@gregkh/ >>>>>> --- >>>>>> drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 10 ++++++++++ >>>>>> 1 file changed, 10 insertions(+) >>>>>> >>>>>> diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c >>>>>> index 36c6b36ad4ff..d25825c05817 100644 >>>>>> --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c >>>>>> +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c >>>>>> @@ -338,6 +338,15 @@ static int qcom_smmu_cfg_probe(struct arm_smmu_device *smmu) >>>>>> return 0; >>>>>> } >>>>>> >>>>>> +static int qcom_adreno_smmuv2_cfg_probe(struct arm_smmu_device *smmu) >>>>>> +{ >>>>>> + /* SDM845 Adreno SMMU advertizes 16K pages support, but something is broken */ >>>>>> + if (of_device_is_compatible(smmu->dev->of_node, "qcom,sdm845-smmu-v2")) >>>>>> + smmu->features &= ~ARM_SMMU_FEAT_FMT_AARCH64_16K; >>>>> >>>>> Shouldn't we hide that uncoditionally as it's likely that none of v2 >>>>> Adreno SMMUs support 16k pages? >>>> >>>> Hmm, that would be unfortunate to have the GPU not supporting the CPU >>>> page size. I guess we could still map 16k pages as multiple 4k pages, >>>> but that is a bit sad.. >>> >>> For now this might be limited to older platforms (v2 vs -500) >> >> In the commit message: >> >>>>>> SDM845's Adreno SMMU is unique in that it actually advertizes support >>>>>> for 16K (and 32M) pages, which doesn't hold for newer SoCs. > > My question is about forbidding 16k pages for sdm845 only or for other > chips too. I'd assume that it shouldn't also work for other smmu-v2 > platforms. I'd say we shouldn't cause trouble unless we know it's an issue Konrad