Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1146399rdd; Wed, 10 Jan 2024 09:58:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IE4GpFOgsGnKPE8WR3yIImcNYw7/c/dAapUUzdEkJlMcKeDKMkf2CEOH6jmP95Yvjsu+cCW X-Received: by 2002:a05:6e02:1a07:b0:35f:f01e:bb35 with SMTP id s7-20020a056e021a0700b0035ff01ebb35mr1698683ild.28.1704909520539; Wed, 10 Jan 2024 09:58:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704909520; cv=none; d=google.com; s=arc-20160816; b=M/WtFxUimvmZJusHjSdbQUvGP0vI2rOeBxuHMgQ6OqF67xl5rtxACJFGND1OJixBMV jBInbIzBLfnCYT1ekDZc73jWvzSXery5O1rd4j8uM57n1I43SpgPe0gVKGO0v5BBz/V9 dfPdI+Up8L7JZDmC7j9GOu9tunlddNViic+ZS416/35qxQBbV7VN51CQlgK+D2Clm4wJ lBiC6P90imsrHoRcXz6e3UFAdmxGNOIUGilniEPhHrNzpJpg3OjaD6bHkPX7INYILooQ F1/Xzz3jxB2kerfHsb/5ASBatniWGKZW93Wbi3VTAWp1gSb2gWdO5ZGpfDqqW8Ku74RC c2cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=YPUG8wGHjUncLfJR9e1hMbIghHR8x5XwILqQc+Upn/A=; fh=SJcwSryOBsCDEt0O7NKWT1cOZaUBSBkdmoJ49TUW13Y=; b=W/u9s/+SRGg3Pej2cEnmWvTSHYWpMzko293bF2S3HlMR0ZtQ1GmDdn4M3if0thREuh UvigcafPo2U40AO7NLE1ica3uZa8UE5+royLcaBGck2zfAx4LOpdHbHJDkLJF6T+4zDS QHfhEsBar0bLmWfrvyzoUA9sCOTstigXxm6FKwDNN4tIJi3pZEYNxIocZl3Ztd6nao0m tBY3H/P3GfxZwYGXoA9sWCAKf2coy0w/RltzZvPw7H8FJ2ASJ2JoBvD/nrtLEp46is0X d/v+uX7jyuR8+fxQ6fqaufF0hG7tgUsNP2/cKhICKHgU1qOGpuDElokDP7JufhL6vrKK Uu5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O4d8NFhA; spf=pass (google.com: domain of linux-kernel+bounces-22578-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22578-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id a66-20020a636645000000b005ce0474353csi4006038pgc.238.2024.01.10.09.58.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 09:58:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22578-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O4d8NFhA; spf=pass (google.com: domain of linux-kernel+bounces-22578-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22578-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 1B28D2885F7 for ; Wed, 10 Jan 2024 17:57:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 60FE94D593; Wed, 10 Jan 2024 17:56:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="O4d8NFhA" Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D84554D587 for ; Wed, 10 Jan 2024 17:56:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2cd5c55d6b8so35752581fa.3 for ; Wed, 10 Jan 2024 09:56:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704909414; x=1705514214; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=YPUG8wGHjUncLfJR9e1hMbIghHR8x5XwILqQc+Upn/A=; b=O4d8NFhAWvFdco7lDdy84yi5s557ETyKeOojaijEXSRSt6geSkN8tMRkuCugnl0BCE EXufD6OHOXkF60uPjjXUgQY64cKUc4m5x3PU3Sq1UooB4NWttp3D9SJw4YR4JXB12sDr wBQdcB0sHidI0z9tVmzv3O14PJZtB6+ZuqN7w3Oo1UT5H8BQQQsnXg/hjxuwROaGazWz 4G8R+Kk8jNMCYGNKY8n5QC4iGxt7oLJDrwmnMsna20ETSBPsGYX/LpW+m2A9IcA2KfhV w1jXBcoNKOhWRSBk7mL9ARRktmkcIiV2UyDm1xkk7rI6O1rV4IIcOMh2i1MgFE4rso62 J83w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704909414; x=1705514214; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YPUG8wGHjUncLfJR9e1hMbIghHR8x5XwILqQc+Upn/A=; b=W4ybTHj50cHq4c4XFutRom6p17vmLvJBd7xq/h++kB0h+A6xTdspfMI2tejYWdkAjL 1P/vcYqQMz58tx1Wn40ZT90YQvQ1aTAPwCZKz/Zh1ArC4xbcoLtjJhHd5WC4qQ6md6MU hTxkhsEVYAqQoMcuv/IaqCv6BhA1+DzRlCeeKilMUSpfbq1PZ1aqd0zb3wzP1eb73Qe5 1Q5zrB3/GujFQDjTSwVT0SkTgIIlRRo33/+hhPQVf8eG71C94eDiM10kCyAjj98ZLXXF zskxYXcNLlHvkMn7hQvq0cB010j/UVK22XZTEyZgJX/YG8/tZ2AgM2FT+akuAM/usoFh z8Cw== X-Gm-Message-State: AOJu0YxIep0xo8+LAqaFkg+H37F07lKKD4Z7MVR5iC7n/V/WIU78txPV 5Ab1adJUtO+SrgYDRyeIfK+N8W3o9wu7xw== X-Received: by 2002:a05:651c:b23:b0:2cd:7fe1:39c with SMTP id b35-20020a05651c0b2300b002cd7fe1039cmr334267ljr.72.1704909413963; Wed, 10 Jan 2024 09:56:53 -0800 (PST) Received: from [172.30.205.123] (UNUSED.212-182-62-129.lubman.net.pl. [212.182.62.129]) by smtp.gmail.com with ESMTPSA id v17-20020a2ea451000000b002cd1a3bdecbsm829614ljn.22.2024.01.10.09.56.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 Jan 2024 09:56:53 -0800 (PST) Message-ID: <492aeca3-a4df-47a3-9c77-02ea4235d736@linaro.org> Date: Wed, 10 Jan 2024 18:56:51 +0100 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 v7 3/5] iommu/arm-smmu: introduction of ACTLR for custom prefetcher settings Content-Language: en-US To: Bibek Kumar Patro , Pavan Kondeti Cc: will@kernel.org, robin.murphy@arm.com, joro@8bytes.org, dmitry.baryshkov@linaro.org, jsnitsel@redhat.com, quic_bjorande@quicinc.com, mani@kernel.org, quic_eberman@quicinc.com, robdclark@chromium.org, u.kleine-koenig@pengutronix.de, robh@kernel.org, vladimir.oltean@nxp.com, quic_molvera@quicinc.com, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, qipl.kernel.upstream@quicinc.com References: <20240109114220.30243-1-quic_bibekkum@quicinc.com> <20240109114220.30243-4-quic_bibekkum@quicinc.com> <2ad70157-27d1-41df-8866-c226af690cf6@quicinc.com> <4a595815-7fcc-47e2-b22c-dac349af6d79@quicinc.com> From: Konrad Dybcio In-Reply-To: <4a595815-7fcc-47e2-b22c-dac349af6d79@quicinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 1/10/24 13:55, Bibek Kumar Patro wrote: > > > On 1/10/2024 4:46 PM, Bibek Kumar Patro wrote: >> >> >> On 1/10/2024 9:36 AM, Pavan Kondeti wrote: > > [...] > >>>> @@ -274,6 +321,21 @@ static const struct of_device_id qcom_smmu_client_of_match[] __maybe_unused = { >>>>   static int qcom_smmu_init_context(struct arm_smmu_domain *smmu_domain, >>>>           struct io_pgtable_cfg *pgtbl_cfg, struct device *dev) >>>>   { >>>> +    struct arm_smmu_device *smmu = smmu_domain->smmu; >>>> +    struct qcom_smmu *qsmmu = to_qcom_smmu(smmu); >>>> +    const struct actlr_variant *actlrvar; >>>> +    int cbndx = smmu_domain->cfg.cbndx; >>>> + >>>> +    if (qsmmu->data->actlrvar) { >>>> +        actlrvar = qsmmu->data->actlrvar; >>>> +        for (; actlrvar->io_start; actlrvar++) { >>>> +            if (actlrvar->io_start == smmu->ioaddr) { >>>> +                qcom_smmu_set_actlr(dev, smmu, cbndx, actlrvar->actlrcfg); >>>> +                break; >>>> +            } >>>> +        } >>>> +    } >>>> + >>> >>> This block and the one in qcom_adreno_smmu_init_context() are exactly >>> the same. Possible to do some refactoring? >>> >> >> I will check if this repeated blocks can be accomodated this into qcom_smmu_set_actlr function if that would be fine. >> > > Also adding to this, this might increase the number of indentation inside qcom_smmu_set_actlr as well, to around 5. So wouldn't this > be an issue? By the way, we can refactor this: if (qsmmu->data->actlrvar) { actlrvar = qsmmu->data->actlrvar; for (; actlrvar->io_start; actlrvar++) { if (actlrvar->io_start == smmu->ioaddr) { qcom_smmu_set_actlr(dev, smmu, cbndx, actlrvar->actlrcfg); break; } } } into // add const u8 num_actlrcfgs to struct actrl_variant to // save on sentinel space: // sizeof(u8) < sizeof(ptr) + sizeof(resource_size_t) [declarations] const struct actlr_variant *actlrvar = qsmmu->data->actlrvar; int i; [rest of the functions] if (!actlrvar) return 0; for (i = 0; i < actrlvar->num_actrlcfgs; i++) { if (actlrvar[i].io_start == smmu->ioaddr) { qcom_smmu_set_actlr(dev, smmu, cbndx, actlrvar->actlrcfg); break; } } Saving both on .TEXT size and indentation levels :) Konrad