Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp720126lqt; Fri, 19 Apr 2024 08:29:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVC3cmBOVgLIxsOE0Owsq82YKxY22KLQEZiXEG0SqeaqnG3j/8wYono+tlOm2PupjDRt5erkoexfAmiSsVYDatbhNUNIRHG3EmCBtGwVw== X-Google-Smtp-Source: AGHT+IHAjY8TYFRsFKVHoRkDIjfPd4rOs9mhDgN/QgcSLTaUkOZy9QlerU/SwzQ/ikPhyqAq028h X-Received: by 2002:a05:6a00:a0e:b0:6eb:6:6b72 with SMTP id p14-20020a056a000a0e00b006eb00066b72mr2553446pfh.25.1713540539955; Fri, 19 Apr 2024 08:28:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713540539; cv=pass; d=google.com; s=arc-20160816; b=wy9ueVI32ORp4Pl6F39fq/cJjiteiNksGPObRWCp5MbJVIbjK+EMnYT7SbMcCIdOGs 3X6J+gbiczbl5jtuzrANsoOpNsUo0aDKjdOD8vRbjxQBPyZuUKA0L+LPYDAWrblHCj2k xantrjPGAYubhffdJeocjOwI2Vm9WXVUyYmHBd97JfJrVpHV2BO6sKm+Xwx060t0I1+p Pw+SGXNBWRboTT67YQITUZpNrwXlQFnBwfWAovWzWSKpZdnNWNGH5Af1Is8pUoBypxUu +w4XvHD1dqDZXmrwfnUtAWmTfCYaeQHdR+SR6PrSWC2FdrrOzUViJXyW3Jqhf8maakF6 Gy1w== 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:references:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=Cqo+Csi/XSIrRLlolycnzCnh667ghIhyG93X/jD1Udw=; fh=wuqZP5JbAVo6SKWP7iEIjnMMoqRj4uZ/o/T6vqmA+30=; b=0+gF9hMQtTncsJu4wUtxQ85lCUNB4BoGrA1HET+Dawm1d4B4t9jalBI4sW2evDefmy RDYNTnge7a9P3ZKEBFROGHiwuoi0GMWZidtQukLULFvgGS+x66smAchwEiV3D55HassO oJn5qnJP998VZKEJJZ/Q0Xhv9lj6Nyg37IgSU/AaoDu89F89aBM/mIU10iwTYyVG0/r1 05GFVE2VtFXSCiY7HagBgKmwrnShXgPcTfmrRcz2MI52GQZY9mwzFC+ShfBx3OImahIR P2i4DswUFTrNcIlT2mvIn5Jr7Q2UFqPqH5t3cxo9j3nY7i1ej4v1XsvDL94U0hK9u77y c9LA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-151665-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151665-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id l27-20020a635b5b000000b005f0bc72594esi1310507pgm.468.2024.04.19.08.28.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 08:28:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-151665-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-151665-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151665-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 802942820C7 for ; Fri, 19 Apr 2024 15:28:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2090712FB0E; Fri, 19 Apr 2024 15:28:53 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7C77F184E; Fri, 19 Apr 2024 15:28:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713540532; cv=none; b=oTdC26vYckLwB8irVTA0Tc+Tc8Z+YihI1iAqJKup78XNwQ0TdY39XU16gfZjKSTUkuBvNfA8RsyvQrngldRLSOI+eCXxm0fWmvvCn87HCg/7Cwe/Moflnq1ZHVxuU3M8lptxVBOWnr2gZ9eDmegpMAzH97xK7VGurSVmRHShzbM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713540532; c=relaxed/simple; bh=bfF74m4I4t9XPTgeXN2m67auBjU4qnUvI02BEMhTbY4=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=RtA20W5bwm24gxh526StNTeDN5ZgGNOJp8TWb+9m8VAJUt5PJGWFQwHij+Yq6aPcT26Shwbt4WLlITkgnYUnE6D8qIyG0knrxMAmBHVaijmq9R8k9SLJdGkOnqJpHIuLgBsZ1wBq90zrcbcN+6VtXeItt0QT+DIeQHATU/TIv8g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 E4FEF2F; Fri, 19 Apr 2024 08:29:17 -0700 (PDT) Received: from [192.168.20.58] (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6820C3F64C; Fri, 19 Apr 2024 08:28:46 -0700 (PDT) Message-ID: Date: Fri, 19 Apr 2024 10:28:45 -0500 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 v4 2/3] riscv: cacheinfo: initialize cacheinfo's level and type from ACPI PPTT Content-Language: en-US To: Yunhui Cui , rafael@kernel.org, lenb@kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, linux-riscv@lists.infradead.org, bhelgaas@google.com, james.morse@arm.com, jhugo@codeaurora.org, john.garry@huawei.com, Jonathan.Cameron@huawei.com, pierre.gondois@arm.com, sudeep.holla@arm.com, tiantao6@huawei.com References: <20240418034330.84721-1-cuiyunhui@bytedance.com> <20240418034330.84721-2-cuiyunhui@bytedance.com> From: Jeremy Linton In-Reply-To: <20240418034330.84721-2-cuiyunhui@bytedance.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi, On 4/17/24 22:43, Yunhui Cui wrote: > Before cacheinfo can be built correctly, we need to initialize level > and type. Since RSIC-V currently does not have a register group that > describes cache-related attributes like ARM64, we cannot obtain them > directly, so now we obtain cache leaves from the ACPI PPTT table > (acpi_get_cache_info()) and set the cache type through split_levels. > > Suggested-by: Jeremy Linton > Suggested-by: Sudeep Holla > Signed-off-by: Yunhui Cui > --- > arch/riscv/kernel/cacheinfo.c | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > > diff --git a/arch/riscv/kernel/cacheinfo.c b/arch/riscv/kernel/cacheinfo.c > index 30a6878287ad..e47a1e6bd3fe 100644 > --- a/arch/riscv/kernel/cacheinfo.c > +++ b/arch/riscv/kernel/cacheinfo.c > @@ -6,6 +6,7 @@ > #include > #include > #include > +#include > > static struct riscv_cacheinfo_ops *rv_cache_ops; > > @@ -78,6 +79,27 @@ int populate_cache_leaves(unsigned int cpu) > struct device_node *prev = NULL; > int levels = 1, level = 1; > > + if (!acpi_disabled) { > + int ret, fw_levels, split_levels; > + > + ret = acpi_get_cache_info(cpu, &fw_levels, &split_levels); > + if (ret) > + return ret; > + > + BUG_ON((split_levels > fw_levels) || > + (split_levels + fw_levels > this_cpu_ci->num_leaves)); > + > + for (; level <= this_cpu_ci->num_levels; level++) { > + if (level <= split_levels) { > + ci_leaf_init(this_leaf++, CACHE_TYPE_DATA, level); > + ci_leaf_init(this_leaf++, CACHE_TYPE_INST, level); > + } else { > + ci_leaf_init(this_leaf++, CACHE_TYPE_UNIFIED, level); > + } > + } > + return 0; > + } > + > if (of_property_read_bool(np, "cache-size")) > ci_leaf_init(this_leaf++, CACHE_TYPE_UNIFIED, level); > if (of_property_read_bool(np, "i-cache-size")) Yes, looks good. Reviewed-by: Jeremy Linton Thanks,