Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp1171848lqb; Thu, 30 May 2024 02:24:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW30yQtFVSCw6AtlzWpfGejkHkb7E1ScJpCshRfkiHWFlWtmz0paoya1IVXjAyzt0Fw0EzlJYcJQbhPMaP+7PZyYA81lolvn41g/KeAtw== X-Google-Smtp-Source: AGHT+IHoLcJhnnoYupn2uwbHDQ1kbjEROhLAg2mR8eTqWnOzqp+7peVqUo6fZToKxlNoKCUJT6vW X-Received: by 2002:a05:6214:5509:b0:6ad:7360:7d4b with SMTP id 6a1803df08f44-6ae0ccaf677mr20265386d6.51.1717061098233; Thu, 30 May 2024 02:24:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717061098; cv=pass; d=google.com; s=arc-20160816; b=GTw4CKa2PzFjJrroi890QW/8BbjfB60kDmxlO+MpusmDCym+1ZOxyZwlMYkbhsnVuc L7NkHILTmvpDiVH0qNHCWXHl8iAvWYitPgcBOxzxweEvXakIQdnz0LuUZlaFBB4VsT6K QKGbji5vSla70VQFvtYIqHF/FedikC3lhnNsOwRQoFvNnjb4oZtBBN3vqFAwD5Ffaf1c JQOasAZvcYjkCOjPpMECY6sXRRADATBzP/QWZ6XmtDmdPLLs7SzCtMCMpu2hEcPmW6n3 +95pmk5D2rh9C0yCo4o7Dr/YucvhnRCogBCXn81MKVJoHSlYxd4wLEAuBzGPbLTSSR1M Oxiw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=aYbB2pi60UoXXErdg/yVR37inV1Y++t0aeMaaumeWnc=; fh=zUElfNwROqSJh+ae2S3BD8V9wsoVYh4Ma43Vtpmcf1E=; b=n5fCig7zIr16EfiyOHLrW+xOFB0lcOjfjl+lRAl+Wjskc3lLBIl6UoOsvTjbv/iJ2h kO0J4qs4q80l5TFZuNEH9xvelxzEWCTIVCwRYy2gjeSH4oXbT3lQJAOEVFcUSCABEVzJ ZgMokvMQu+CAj1IsUukYcMuHRqP1mX745S9kd2OA504WJYyA8J86Da90Nf/ahpME5Bn/ RE4aYEsmfRhYXXFPnOitHkdFXSMDcPiO6DJlCcq64JmyD72k1sPpJgNbmvV7aeYTFAS+ bCzt0b8kD0+vQTaXC7QpkpOKBKSKDD401ZvaVpCqG9fKAATjfVfrgCftYjQR1mAXr9Z/ /B8w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=hDSof6zO; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-195165-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195165-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6ac162b4cccsi148187796d6.487.2024.05.30.02.24.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 02:24:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-195165-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=hDSof6zO; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-195165-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195165-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D015A1C230F0 for ; Thu, 30 May 2024 09:24:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 259A017C7BB; Thu, 30 May 2024 09:22:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="hDSof6zO" Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC95F17E470; Thu, 30 May 2024 09:22:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717060948; cv=none; b=jIFUrq5ohOMrVcJ+nTabUS80nUzmgRezrjv63iXsWOcQZRR5jMPi0m3LVJLP9bWQrrCj70sR52tkiErSte5s/w7cI2G5FEbrys7l0w/ymnBncoA9Gg/+Od0cbBa545G7hdZPdS2OKBAHWNF5puZ5t2S0Q+rxw7ti3LnGGOJNmtc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717060948; c=relaxed/simple; bh=o6on7Ay76lNedf1rgAFZrKGDIJrohSK9WuqeTe+/5Sk=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=d47oVWB0QovVjeZ+AaI1USx/I6xgGepghnOt0niINRiEmmbFQri75MXT3uvrQYup/wOXFTrb/6c+uLMpVb1/TFkzF0xvv37UO54u+DvOxif2trAAkffWSdaDM6j2BOWIvpBMH+TCiZyunXs/sZUKog1hfzW39jCKBJEad7OigR4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=hDSof6zO; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44U8qm6O031447; Thu, 30 May 2024 09:22:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= aYbB2pi60UoXXErdg/yVR37inV1Y++t0aeMaaumeWnc=; b=hDSof6zOEtAWzfJs FExPCzZWURlP7vMRQtdVAQKE1B3dQMcZNJKfTbX3q/M2bUjguOm+ZArb0Y6WeVQG l349vWE34Cm8V8PNn+G2WMOrbUoXDwDzqb4kiZA8duI4vvVDzlo+5/Idj4b5q4JE SFvPVIG+CZ5QHwOvclO9qv7Ol8FcIeVqPT50Q9ubsXpamX7IAn4Tm28xX+Kp8lGo DnNNI6fIA8mUtA3Y3YvkcxgepaIxxsz+4V6YTje5wfH6Vt2PDjVbbDHy7GJVVB2s ppTd8IKLFomD00iX9wLNjdcw4YEXEm0ZW0Fq31/BYArS0kAUTQ/mreJm59UdjeqE XsbmoQ== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3yba0xbjjf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 May 2024 09:22:06 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 44U9M4nO017406 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 May 2024 09:22:04 GMT Received: from [10.214.66.253] (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 30 May 2024 02:21:56 -0700 Message-ID: <9992067e-51c5-4a55-8d66-55a102a001b6@quicinc.com> Date: Thu, 30 May 2024 14:51:56 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v9 3/5] iommu/arm-smmu: introduction of ACTLR for custom prefetcher settings To: Rob Clark , Dmitry Baryshkov CC: Konrad Dybcio , , , , , , , , , , , , , , , , , References: <20240123144543.9405-1-quic_bibekkum@quicinc.com> <20240123144543.9405-4-quic_bibekkum@quicinc.com> <51b2bd40-888d-4ee4-956f-c5239c5be9e9@linaro.org> <0a867cd1-8d99-495e-ae7e-a097fc9c00e9@quicinc.com> <7140cdb8-eda4-4dcd-b5e3-c4acdd01befb@linaro.org> Content-Language: en-US From: Bibek Kumar Patro In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: Zv56DuGmLk9dDdlVJg2xCwqgGbqtk7Ah X-Proofpoint-ORIG-GUID: Zv56DuGmLk9dDdlVJg2xCwqgGbqtk7Ah X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-30_06,2024-05-28_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 impostorscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1015 bulkscore=0 phishscore=0 malwarescore=0 mlxscore=0 adultscore=0 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2405300069 On 5/28/2024 9:38 PM, Rob Clark wrote: > On Tue, May 28, 2024 at 6:06 AM Dmitry Baryshkov > wrote: >> >> On Tue, May 28, 2024 at 02:59:51PM +0200, Konrad Dybcio wrote: >>> >>> >>> On 5/15/24 15:59, Bibek Kumar Patro wrote: >>>> >>>> >>>> On 5/10/2024 6:32 PM, Konrad Dybcio wrote: >>>>> On 10.05.2024 2:52 PM, Bibek Kumar Patro wrote: >>>>>> >>>>>> >>>>>> On 5/1/2024 12:30 AM, Rob Clark wrote: >>>>>>> On Tue, Jan 23, 2024 at 7:00 AM Bibek Kumar Patro >>>>>>> wrote: >>>>>>>> >>>>>>>> Currently in Qualcomm SoCs the default prefetch is set to 1 which allows >>>>>>>> the TLB to fetch just the next page table. MMU-500 features ACTLR >>>>>>>> register which is implementation defined and is used for Qualcomm SoCs >>>>>>>> to have a custom prefetch setting enabling TLB to prefetch the next set >>>>>>>> of page tables accordingly allowing for faster translations. >>>>>>>> >>>>>>>> ACTLR value is unique for each SMR (Stream matching register) and stored >>>>>>>> in a pre-populated table. This value is set to the register during >>>>>>>> context bank initialisation. >>>>>>>> >>>>>>>> Signed-off-by: Bibek Kumar Patro >>>>>>>> --- >>>>> >>>>> [...] >>>>> >>>>>>>> + >>>>>>>> + for_each_cfg_sme(cfg, fwspec, j, idx) { >>>>>>>> + smr = &smmu->smrs[idx]; >>>>>>>> + if (smr_is_subset(smr, id, mask)) { >>>>>>>> + arm_smmu_cb_write(smmu, cbndx, ARM_SMMU_CB_ACTLR, >>>>>>>> + actlrcfg[i].actlr); >>>>>>> >>>>>>> So, this makes ACTLR look like kind of a FIFO. But I'm looking at >>>>>>> downstream kgsl's PRR thing (which we'll need to implement vulkan >>>>>>> sparse residency), and it appears to be wanting to set BIT(5) in ACTLR >>>>>>> to enable PRR. >>>>>>> >>>>>>> val = KGSL_IOMMU_GET_CTX_REG(ctx, KGSL_IOMMU_CTX_ACTLR); >>>>>>> val |= FIELD_PREP(KGSL_IOMMU_ACTLR_PRR_ENABLE, 1); >>>>>>> KGSL_IOMMU_SET_CTX_REG(ctx, KGSL_IOMMU_CTX_ACTLR, val); >>>>>>> >>>>>>> Any idea how this works? And does it need to be done before or after >>>>>>> the ACTLR programming done in this patch? >>>>>>> >>>>>>> BR, >>>>>>> -R >>>>>>> >>>>>> >>>>>> Hi Rob, >>>>>> >>>>>> Can you please help provide some more clarification on the FIFO part? By FIFO are you referring to the storing of ACTLR data in the table? >>>>>> >>>>>> Thanks for pointing to the downstream implementation of kgsl driver for >>>>>> the PRR bit. Since kgsl driver is already handling this PRR bit's >>>>>> setting, this makes setting the PRR BIT(5) by SMMU driver redundant. >>>>> >>>>> The kgsl driver is not present upstream. >>>>> >>>> >>>> Right kgsl is not present upstream, it would be better to avoid configuring the PRR bit and can be handled by kgsl directly in downstream. >>> >>> No! Upstream is not a dumping ground to reduce your technical debt. >>> >>> There is no kgsl driver upstream, so this ought to be handled here, in >>> the iommu driver (as poking at hardware A from driver B is usually not good >>> practice). >> >> I'd second the request here. If another driver has to control the >> behaviour of another driver, please add corresponding API for that. > > We have adreno_smmu_priv for this purpose ;-) > Thanks Rob for pointing to this private interface structure between smmu and gpu. I think it's similar to what you're trying to implement here https://lore.kernel.org/all/CAF6AEGtm-KweFdMFvahH1pWmpOq7dW_p0Xe_13aHGWt0jSbg8w@mail.gmail.com/#t I can add an api "set_actlr_prr()" with smmu_domain cookie, page pointer as two parameters. This api then can be used by drm/msm driver to carry out the prr implementation by simply calling this. Would this be okay Rob,Konrad,Dmitry? Let me know if any other suggestions you have in mind as well regarding parameters and placement. Thanks & regards, Bibek > BR, > -R > >>> >>>> >>>>>> Thanks for bringing up this point. >>>>>> I will send v10 patch series removing this BIT(5) setting from the ACTLR >>>>>> table. >>>>> >>>>> I think it's generally saner to configure the SMMU from the SMMU driver.. >>>> >>>> Yes, agree on this. But since PRR bit is not directly related to SMMU >>>> configuration so I think it would be better to remove this PRR bit >>>> setting from SMMU driver based on my understanding. >>> >>> Why is it not related? We still don't know what it does. >>> >>> Konrad >> >> -- >> With best wishes >> Dmitry