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 40A45C3DA61 for ; Tue, 30 Jul 2024 08:09:10 +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=QZF+Pz2AhcQY27YBc6J2Fo4eWNRZZfKHCgf0Gc2Vi6o=; b=XL4PCaJTPb82l7a3bMw5+3LmDz y5JNyw8D1qrWqd/Hxboun2IGjkJdup49ZIhB+DP9lv52lPlySB4kMATzPUYSbSRQJlOekOcDMn2vA 379wQ6AKBv8Qg/73twNYVGSXhkBQKmMnLIIqLQXefoU8coNEQ4xwAgR4UgRKb+jLrKSmgdKxcKHVI Z9bEJd3y7J5qMAnkdR5QJ/5+4OlR647tLzIJk9HQL0iOMklmjUymiFi8kHWiLNoT95nfS9yMBrpVC 2N6wwGt9I2SDe7HJrKIVNOcDTIx6qxlq7u54ext+GhLWTwPRNZ2WX03DsDzGQwokzC2MlE8JPGWT4 AI4ZxXrA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYhuj-0000000EAkC-35ZJ; Tue, 30 Jul 2024 08:08:57 +0000 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYhuI-0000000EAg6-1vw5 for linux-arm-kernel@lists.infradead.org; Tue, 30 Jul 2024 08:08:32 +0000 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-a7a94478a4eso885537566b.1 for ; Tue, 30 Jul 2024 01:08:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722326908; x=1722931708; darn=lists.infradead.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=QZF+Pz2AhcQY27YBc6J2Fo4eWNRZZfKHCgf0Gc2Vi6o=; b=TPn2xykJKeKinGXkt0CzK86wu8Jfg2R+h7cEr0fZZIKX+yAPQiJozWMVB39Jdc6zIM Dmxy8eaWvVrq7NJu6tbYR4UlDmbuFQzJXVr3Ontq+HpoYkcqGtzWF7KQHbVSXflUbZfe Wg26Pj/kzwXzK9xQXrEO7ZVwXxAVhRww4ETtWNzyDHgFuniv3cP5cDVsoltsnpYjm3Ml /isjr/9qJeULKetlvttArEVTN1EwWoGvEXvaHjnkOpn6qddv2dZMtNYCBH8fhFH/tx9E 8NMyKA5rmAhlylqsXZ5Z+p5YrtMrKqlR0YqZAQzOGLsR9K50flSakNwxgzVA9MZ/n/EU goSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722326908; x=1722931708; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=QZF+Pz2AhcQY27YBc6J2Fo4eWNRZZfKHCgf0Gc2Vi6o=; b=gMvqdUJe96c2IpHrYJSkkEBIli2lSkvVsHlZuT2iSIcyprdoBD86sPFY2XgWBLo52/ ao29UMGzo94T/Pftf9zAbYqvl1/agYDOD7eP+TcDvmPK8EHR9oCj91GT0asvCHG92ifQ xPinsYH7b1EErB9mxT/J9xREWIhOV+1VJl4l/yGfbqtqx/J8dBTRsLpEwvmSR6W4rOe0 Xj8YAX6x8DoRbLetwgjXnHb+zOdkd3xNdRAXaLhbHLtsnc7zm096uFrtnDQbhbqMMQwt 05yuJ/xopIJRDFInLfYgPcNNtFTWWbo9BCtRBN8jKb4znCpDlkztZRyVDh9Eryme4y9q Huow== X-Forwarded-Encrypted: i=1; AJvYcCVVCFla8jOSp/GJ0O5tWurBk85AtlPc1S/NtKsbUzbd8ChYVYjF2KjkuhaYVLpUX1vGfSNenAtKl1Pp4yEmujVIK3TWCI4oxkDz4Z6VHeqXdwfxIk8= X-Gm-Message-State: AOJu0YzWHhI8n2B2Zv7O81EHqyRXkppmE6yjno6EjvNUsjKkJ/MNxI/y BrWFstIRd9u5Jz/EkVMWk6bxTSk327lUnsLVJ3Vv+0/Xh7bVpbK5 X-Google-Smtp-Source: AGHT+IHmcD8TT/OjORJf5+HJTjExUKx41HXrJqoDLKcAwWWZieiprfgJ7DuRrTHke21Hmw0S4rjPuA== X-Received: by 2002:a17:906:bc20:b0:a73:9037:fdf5 with SMTP id a640c23a62f3a-a7d858b3d5fmr129857466b.6.1722326907671; Tue, 30 Jul 2024 01:08:27 -0700 (PDT) Received: from [192.168.105.194] (078088045245.garwolin.vectranet.pl. [78.88.45.245]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7acad90130sm620226666b.144.2024.07.30.01.08.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 30 Jul 2024 01:08:26 -0700 (PDT) Message-ID: <3332c732-4555-46bf-af75-aa36ce2d58df@gmail.com> Date: Tue, 30 Jul 2024 10:08:24 +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 , Rob Clark Cc: 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> 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_010830_526288_556FE3BD X-CRM114-Status: GOOD ( 17.35 ) 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 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. Konrad