Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1762568lqa; Mon, 29 Apr 2024 20:16:54 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU1tv76eSvCbVIBWJcMhu7ooJgAP7+2XtcLMqsh4pg90a5TeAGan5tkgzxyontus/Y3Tt6VqQ7lpWV6+nc6czjylipb1HorvsRkasi81w== X-Google-Smtp-Source: AGHT+IG4aWY8z+f45cASoHUjd1odWkjzw+oL6bF00LB0EaxM3bI7Z1V7Rjqv2jYgOm80jsH7i8cw X-Received: by 2002:a17:90a:4615:b0:2b2:1919:dda3 with SMTP id w21-20020a17090a461500b002b21919dda3mr2827769pjg.12.1714447014118; Mon, 29 Apr 2024 20:16:54 -0700 (PDT) Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id g5-20020a17090a67c500b002ab3a65d8a6si21178975pjm.6.2024.04.29.20.16.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 20:16:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163284-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@bytedance.com header.s=google header.b=dZcj1YtF; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-163284-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163284-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 7B28AB21798 for ; Tue, 30 Apr 2024 03:16:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5298DF9D6; Tue, 30 Apr 2024 03:16:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="dZcj1YtF" Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) (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 D530C8480 for ; Tue, 30 Apr 2024 03:16:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714446989; cv=none; b=t6hTuGK/3qvWZUEPRCJWN7l4fPtIHkPqa2paSpFkj9PrgKS458aD73AbPUzWm1kulPCCMMj72X3XM37hE2mRgQ777ZJtfdyXu8wllklouYqbJZ/vT4jmAxBfb7bwabMFPq3E8XYamGkAKW4x4GNukaspbxhiiFjl7NQLTRkAEFU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714446989; c=relaxed/simple; bh=J9Uks/wSVBDMZDqvqL821ZvLl/AHfaZ2zTTwqy+dauc=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=aiYRlNKYIBNKYVXEBzLurSdFg9uqpvzBpHzJzDePWgzx73Ysp2ojuoPeWyYVwZxItDlwsj8UeYjO0O0T7Df/0QAvemyldwFTgxULB6snuECvAZESRM/AJOdKMJnDkOEToEeBjgbxUnkW9QnMIVYQziN7V87UK2dm9X8NdVMLr1I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=dZcj1YtF; arc=none smtp.client-ip=209.85.210.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Received: by mail-ot1-f49.google.com with SMTP id 46e09a7af769-6ee3042cb98so1060761a34.0 for ; Mon, 29 Apr 2024 20:16:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1714446987; x=1715051787; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ewLuAUPPP39X0HCkRHtN2NHvevZusHejI+aydV0tNX4=; b=dZcj1YtFnMMluykz4azkZGm9/O7ZO7Q5DPepNAohogxeowhN4VBCqIe+qz789KDMU9 +ry426yB4YDDXoOlqvjbCkmiK/n5ODyq7nhWkxrSKvwilm/FTIL4kmkGt2NFEaWlKk9J R9wJkjNwADkJQPNb/5SeC1Gqv+tTS9FVRHFxh/ryki7uuW3N1++2+MtO8x+kvuRXwxvK 05ZWMl/yy9NOIIgGKliQIuxIwBpyQvNBY23zxS5B8YDqqof/WkFvt6FohflLkeJ/hVPy 7ReQ1vpO3c/bci5tQpDAOA+bNgJZQS7pEQg0tmumsq8oZlMvoi3x+x7/xMKeNASZ8SKG OOMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714446987; x=1715051787; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ewLuAUPPP39X0HCkRHtN2NHvevZusHejI+aydV0tNX4=; b=BiuqqYHhy4tvApbOpayP6Gb1aV/3QlydC0oHfAazxhkCAxAgZofYd7tmVDVNS82O8b 6w9a8dWu3Sop+YBpCzqQ+klUiUkS2g/Q5sRbvh+ZMn8t8l6yGNboJfj46dYAjFXvsy4t eJ4LwpFg1IBgtCN9uvv5eIvuCHxOejD8fXornlMKMMu8hXjdZaG4Zuw1vzaOKoIKNI+y MrTt245clqWXI5v6qm+TdQ14Y7KgLmFKxUTdHbx8luI+7DlsaslRwRNZXVFn0Xk1iOU9 mGJ3VZypgHqoV5A2r6ikU2zVAxnAeziUcgeAzUuvt/i7Z3xbB+ePLZopku2DA4DauuMx XE2A== X-Forwarded-Encrypted: i=1; AJvYcCVV3cn/Itpin7UqUXw+MoPutsALHgzkV+6L6CAw8vdztEfuiQJgVJrjWKtd4KlInFqSOZ+VQHCrIv1c44XNdfMHuipS3o36djOoMh/7 X-Gm-Message-State: AOJu0YyYC57dFSodCf+2NCCm39+l46SVkAUWH/z/hpZafvWdLBiwOAmB yT+l1/PGSDTUlaHDoWcX2zrznFCj8jLy3DuWkp/SUC+AU0KdW7tOqqB6O3qEkKO/6e8oSwN8d8Q 6eoJQOvx0t8XAaGsYQoJv3eL2rc2YQR7GszqtjA== X-Received: by 2002:a05:6871:8912:b0:23c:2554:d8b7 with SMTP id ti18-20020a056871891200b0023c2554d8b7mr8543686oab.20.1714446986897; Mon, 29 Apr 2024 20:16:26 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240418034330.84721-1-cuiyunhui@bytedance.com> <20240418034330.84721-2-cuiyunhui@bytedance.com> In-Reply-To: From: yunhui cui Date: Tue, 30 Apr 2024 11:16:15 +0800 Message-ID: Subject: Re: [External] Re: [PATCH v4 2/3] riscv: cacheinfo: initialize cacheinfo's level and type from ACPI PPTT To: Jeremy Linton , Palmer Dabbelt , Palmer Dabbelt Cc: rafael@kernel.org, lenb@kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, paul.walmsley@sifive.com, aou@eecs.berkeley.edu, linux-riscv@lists.infradead.org, bhelgaas@google.com, james.morse@arm.com, john.garry@huawei.com, Jonathan.Cameron@huawei.com, pierre.gondois@arm.com, sudeep.holla@arm.com, tiantao6@huawei.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Palmer, Gentle ping... On Tue, Apr 23, 2024 at 7:03=E2=80=AFPM yunhui cui wrote: > > Hi Palmer, > > On Fri, Apr 19, 2024 at 11:29=E2=80=AFPM Jeremy Linton wrote: > > > > 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/cachei= nfo.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 =3D NULL; > > > int levels =3D 1, level =3D 1; > > > > > > + if (!acpi_disabled) { > > > + int ret, fw_levels, split_levels; > > > + > > > + ret =3D acpi_get_cache_info(cpu, &fw_levels, &split_lev= els); > > > + if (ret) > > > + return ret; > > > + > > > + BUG_ON((split_levels > fw_levels) || > > > + (split_levels + fw_levels > this_cpu_ci->num_lea= ves)); > > > + > > > + for (; level <=3D this_cpu_ci->num_levels; level++) { > > > + if (level <=3D split_levels) { > > > + ci_leaf_init(this_leaf++, CACHE_TYPE_DA= TA, level); > > > + ci_leaf_init(this_leaf++, CACHE_TYPE_IN= ST, level); > > > + } else { > > > + ci_leaf_init(this_leaf++, CACHE_TYPE_UN= IFIED, 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, > > Could you help review this patchset? Thanks. > > Thanks, > Yunhui Thanks, Yunhui