Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp908532lqo; Wed, 8 May 2024 21:09:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVE4I9qQlMX17eoqpytUhoAPAgvpCyPafOWFSGZZuQHRfPjgDDuTiq72HdYer+KhhzfMX/Xo7lal2/NkZ1GPPD6uJ4PJjjVM0OkSxm9nA== X-Google-Smtp-Source: AGHT+IH29vt/ZReucpHrYlaMbS2zRh/8aH9wkkFGfu/G9qGNeIXP6ZAI3ii9yW5diZTmBV8KVHKg X-Received: by 2002:a05:620a:24d5:b0:790:ac28:fc46 with SMTP id af79cd13be357-792b2746074mr654618485a.50.1715227791061; Wed, 08 May 2024 21:09:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715227791; cv=pass; d=google.com; s=arc-20160816; b=yOoEw/Xlft8grKCE9gThii6A03kSCkx3WV/8jRKuV4Lc/cKEANVthnx3M1EcE0bWo+ lMwRZaVg1ubkf8CZrJHaJJbksppZjnVjQ8epOEH/kPBZBTfCzwzYTbZWD+rUEUO0xNq3 mq/Rb0+YEdeMUuMHy0L09MnAMJFfWpmUFHqU9oizS2DV8EMEH0lvFJ12IpyroBuE5gue f79XMc9aqW+klCYGiuO2LaH9o0C/svguQyKUiMtl57vQzSbu3oBoCmkjFUpeJYhRvQH2 oeCcv+RwXbix2AYtN4BqJd0J9Bk7Xga1AXsarjX7KXnJWnMgc0jqFWqKeVMfBmcwja7+ 0slw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Y9sruuI+Av6fzoUWEPO1CK46vHbYhEGu93ccm0253NU=; fh=KtVaB23vt3WvM0NNAAVK6wAHM17mLNDBd1yIKYAVqIs=; b=DBpfdk9icmj/korZRnbEJG9JNv7a++OhpvdQ/UMe9HgUkdJ7QOi8ZwjrxNqu4fnOjr dvKDt9HpFASXErgrcBskWaHqVJLdmRnkqc8pZZSq18oE87shcrh8qFJcMmVwZlUI0X/C gPtzwfJgDj6ejqrqAEWpnIF1YyZnR9SIuTStHo3xToedr4Af4HZJA3AUZHq5qihBRmZu YoyQ+XOLyzlqpNg5ceRMv42XflzT8zkMITJIwauYS3oJeIjsjEtgBlz2O2XMiH31o29a p1QwdYAitujz/CfBhTodb7qA1njvqbQ7OMb2N8c9KGyMa0ZMgqzX4F1/okv6f2NfA6Ds xYMQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=imqr+ZwP; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-174116-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174116-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-792bf277967si51471485a.108.2024.05.08.21.09.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 21:09:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-174116-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=imqr+ZwP; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-174116-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174116-linux.lists.archive=gmail.com@vger.kernel.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id B689B1C2210F for ; Thu, 9 May 2024 04:09:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 78B8813B5A9; Thu, 9 May 2024 04:09:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="imqr+ZwP" Received: from mail-oo1-f43.google.com (mail-oo1-f43.google.com [209.85.161.43]) (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 233B7D26D for ; Thu, 9 May 2024 04:09:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715227785; cv=none; b=EsaxZ/4gRBpcxMUhr6ghioB5Hwe4Ceuk0OERz4drHdb+DK8jgLKu+ZusbUK+I/RgtAB+4wTzWzrnl7x252gYc59Sve9fSQg6VKiaOXtSxEeUDdqqgPASSpKlei+9aHbRHk6cy6fiP1GvhnGTnvm4fdUDNCUdzkXvzvmauCSckcI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715227785; c=relaxed/simple; bh=23vCA1XKs+nRdjU1pvcA/EBdpT4zwEbG7+QpaozbrTM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pdwefKwNMcxnMJk/8fw3X0uCeIP8OWWEHvCtSZEYEduJhHAsahNYzuvS6I3rIhstRgkWTsNBden3Z/pj+m/ZKZb0tOy+HuXM7JyT9bT5ck3qGIVw2Nbcj5mIh/ccxsvf54RqeoggEvX3o5IHZQ5Ye/WcpRuZHubaFtlf/qLzQGk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=imqr+ZwP; arc=none smtp.client-ip=209.85.161.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Received: by mail-oo1-f43.google.com with SMTP id 006d021491bc7-5b2735f217aso79813eaf.2 for ; Wed, 08 May 2024 21:09:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1715227783; x=1715832583; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Y9sruuI+Av6fzoUWEPO1CK46vHbYhEGu93ccm0253NU=; b=imqr+ZwPGLv/6rXFy6q1dYONo6UN0plgd+k6rhDs9cWFQn/9EHDh0YpCu79ABSx7Rp 8wDsol/x35erWf0PQLvL5i3CyNHlsOcjZ19kucCBXw7KeT2YR+DFzfUzvkrYhBCUsuVS TRGcTgi4ZItun3EoiZBApAwV4lraVKjKTfBJIVXQJGXg4lih7nsITigaNNcpTqS0n3LY fRWzPETqKApmlKKPVM0Z14sKTA769bPez5qm7cfCtJEkdtW8m3OBAsuI7kg3bQgjVjwg rO00ZNemshBE2bkyoUicxXXLCXmA5/Y8LXQvU1lJqvt50swSmDkmpvfgHQubnvUQQDPf wR5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715227783; x=1715832583; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Y9sruuI+Av6fzoUWEPO1CK46vHbYhEGu93ccm0253NU=; b=OyN5VsZLoMOpQOSEfJHmtUxRoqdbI25Xx6gXJhLULv8rmjxPGNJ7v/217AvK57aTzQ /9xR8RR9CX1lwhqGJGUFsJY6fCa3ZeEJUmrWU4bLwqSdrCI6OL+OADHXT2stDH0GhdyE nn+YJc3J0PnfmBxbN4f/9PFiOHmq/y3pnqApdi6rYfJWWXGlNns7IxnU4gEDz+mIQ97a eQC7UAelBYrYG6vesMVA6iVSbr32sClTlKDVWRZVNLfjv4xL6Wbi/PaZOvxKpB/ZanWT raUX5ccBe76m9EsXvDgg0ELf0umPN0ZWNnKIfn+E2AKZ0Xc1eCxUoAnNx0jOIbwhrY98 efcw== X-Forwarded-Encrypted: i=1; AJvYcCXqT0gSlNG/CHueNiRHOJDr3Erm3oyJxl7PFIXhDmdEaFL0Og4ZpmWo9Zahbd+A+VrGKC0lt7504DQbFz0tnphcICAQcf1dSHyVfQ1d X-Gm-Message-State: AOJu0Yx7CSbMFvlQiTMefO1D6Z0U8UzNqjmrhiBa7ah0L4TxN0fyEDa7 tB3iV0E0h0DDhI1AHw8M2EjUJgenfx68l7vVjj/uMzmiaMfWjirN94oRmHVQjtE= X-Received: by 2002:a05:6358:c90:b0:18d:9d6a:e484 with SMTP id e5c5f4694b2df-192d290f02emr675633955d.6.1715227783188; Wed, 08 May 2024 21:09:43 -0700 (PDT) Received: from sunil-laptop ([106.51.188.31]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-6340b767b36sm343814a12.32.2024.05.08.21.09.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 21:09:42 -0700 (PDT) Date: Thu, 9 May 2024 09:39:33 +0530 From: Sunil V L To: Yunhui Cui Cc: 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, jeremy.linton@arm.com, john.garry@huawei.com, Jonathan.Cameron@huawei.com, pierre.gondois@arm.com, sudeep.holla@arm.com, tiantao6@huawei.com Subject: Re: [PATCH v4 2/3] riscv: cacheinfo: initialize cacheinfo's level and type from ACPI PPTT Message-ID: References: <20240418034330.84721-1-cuiyunhui@bytedance.com> <20240418034330.84721-2-cuiyunhui@bytedance.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240418034330.84721-2-cuiyunhui@bytedance.com> On Thu, Apr 18, 2024 at 11:43:29AM +0800, 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 NIT: Typo RISC-V > 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 > Can this be added in the order? Like, include acpi.h prior to cpu.h? > 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; > + } > + Other than above nits, it looks good to me. Thanks for the patch! Reviewed-by: Sunil V L