From patchwork Wed Sep 27 17:00:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil V L X-Patchwork-Id: 145521 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp2824853vqu; Wed, 27 Sep 2023 11:38:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEPzUxqUpVn0zMT1y7LBJVYyW3UcyrfN+6EkwJxfmYiYCao28h4VDLhL4YylVOTqwUNZmMx X-Received: by 2002:a17:90a:c790:b0:278:f907:719d with SMTP id gn16-20020a17090ac79000b00278f907719dmr2121574pjb.48.1695839909319; Wed, 27 Sep 2023 11:38:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695839909; cv=none; d=google.com; s=arc-20160816; b=gU3C1GtDFZ/x4TtlZJeKAgDAyhBk+r00wrluPJF82kZ6a6RRlO0pnyTQTjam1iaUE5 psFREo0n/5dLK0LrWa7/HzwxKHiFeD9GvVjElw6Lx8ypX2vkH3gzU8XICJ6ITuSn2tjQ fN3aueUuTbvPwX73UEtaalZacjZMVvj4w6ATtZ1cpz4ZuO+KQspDXqG6Yo0z4K1uYjEl eH0nVkKmaMFq6FsVOy66jDO8wx5CPe2J5rVM0HubFYh1sBRVXzPqkYU6o6OWmsLdZPlz eOdN6jnwPfBeYsDkOcZQUsW8u54xrPvMm9C+yc0O1ISE5bt6iQlhnLlyYELw9shfAgfn kk2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EMRAaYbpAL9AMr/u9386eJc3P6IZIKKW5n+xTVSQNsU=; fh=sfgdT0UZ8CYMELEEedGcAjPKookfa29m+O/tEazxSkQ=; b=r0QywTwCDXlRCE2OCOqg6l+xXjZsZTGBvbnr6mtCmh6kzKr7uNFM1fhwAu5KWEXUHe rXCL8f89/0J5GGDnEqHk4pGVjqB/UNbMDZA7g878WsdEg0NkdDS2asUYGzzdyYHuvP9V qoUpOVyeBZkyN7C6vKBFMX0b3h8pP7YujZ+2mEznDttkoztauezLI7ph9ZKwqU0CCo0q Vm6dTImbmytxn5jCekhCVoHnMtQNrRzA1v7IBPjGtUkYnkPIvS8qTOzH7EBAOvUDLVpZ FErRBzV7scr4t3nq4dluCngihpqTR7TiCuzx5pJyvOtDKjWnYq2ZryTNGuM2TbK+N0QH QVUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=Mh7SszRt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id w9-20020a17090aaf8900b0026f3395cd7fsi17333225pjq.184.2023.09.27.11.38.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 11:38:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=Mh7SszRt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 5FAAA8213F0C; Wed, 27 Sep 2023 10:01:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229629AbjI0RAq (ORCPT + 19 others); Wed, 27 Sep 2023 13:00:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229563AbjI0RAk (ORCPT ); Wed, 27 Sep 2023 13:00:40 -0400 Received: from mail-yb1-xb33.google.com (mail-yb1-xb33.google.com [IPv6:2607:f8b0:4864:20::b33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1374B136 for ; Wed, 27 Sep 2023 10:00:39 -0700 (PDT) Received: by mail-yb1-xb33.google.com with SMTP id 3f1490d57ef6-d8198ca891fso12986713276.1 for ; Wed, 27 Sep 2023 10:00:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1695834038; x=1696438838; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EMRAaYbpAL9AMr/u9386eJc3P6IZIKKW5n+xTVSQNsU=; b=Mh7SszRtl5oB5ZhDY6oUv6VoramUgJr2e6VFqqApdiB7mY3jrbUk0r5giPalv0LK1X BhtZGFJGBG6U8IrVy1k6A0XyGeBFuNK72SnWSZVHcVWac+UwW08PqcN4vXXMhX24MDoC uZU56FE6kvWc7c4GWGhKlpfY9RdY1S+2g4tDmOPiJ50zpGzZQ7siUvK82YvN+vUBjGM+ ZnRjDPH8w6ZFx1yUEDKOLq4wUOmmhGaWBQmG4+8Gvd4eJ0646t4ZVEhR7EFoUFTJ/yf8 naQPTgTe6+fUsYrtmdoxCPsYu4gAIuIFoMhpepV4AsmZKvoYRjxNI4+XBEvlVzTXJ/VZ vYDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695834038; x=1696438838; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EMRAaYbpAL9AMr/u9386eJc3P6IZIKKW5n+xTVSQNsU=; b=odeT8SOIekmjZJzylw9IuQQZPeVkF/7xYhAitiTkDNwzRCq9xOPgnvmeSLvTQwJQBT F7KKgk9u2yNFXwPq5PemLZGJP+HDoCjV1uvCxfNyeiN42bM41jdTfJhCgjZ/mPeyWkXO kdW/29iZyV74OgtHfGT2ErBU85XhbGYT9fgLdzC12NC611AMy7vQu8+f6GxD2mjN7CBj NdKeYOmxsKVUsDw3fqC9NqQO21jwM95WpYnXbNXICOgWprNrKAcxdAPOYTgDA2MCBfAV ahgtKpT9wK1s4gXxeJnwu/rJCdGZu2fOm6G49M2/ZYcvPwGjG08u75/AlQMu52c489nR izig== X-Gm-Message-State: AOJu0YzQUTYLNnPc2t1w0hbv5qBXn+1+PLdUZ+BIqhNx2MnerppRudvZ esHRMfW5F8M35oyz5zp2vrZcKQ== X-Received: by 2002:a25:6b4e:0:b0:d86:a964:a47e with SMTP id o14-20020a256b4e000000b00d86a964a47emr2382069ybm.63.1695834038194; Wed, 27 Sep 2023 10:00:38 -0700 (PDT) Received: from sunil-pc.Dlink ([106.51.190.42]) by smtp.gmail.com with ESMTPSA id u7-20020a637907000000b00584b293d157sm3279396pgc.80.2023.09.27.10.00.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 10:00:37 -0700 (PDT) From: Sunil V L To: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , "Rafael J . Wysocki" , Len Brown , Daniel Lezcano , Thomas Gleixner , Andrew Jones , Conor Dooley , Anup Patel , Ard Biesheuvel , Alexandre Ghiti , Andy Shevchenko , Atish Kumar Patra , Sunil V L Subject: [PATCH v2 -next 3/4] RISC-V: cacheflush: Initialize CBO variables on ACPI systems Date: Wed, 27 Sep 2023 22:30:14 +0530 Message-Id: <20230927170015.295232-4-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230927170015.295232-1-sunilvl@ventanamicro.com> References: <20230927170015.295232-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 27 Sep 2023 10:01:47 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778217028563321592 X-GMAIL-MSGID: 1778217028563321592 Using new interface to get the CBO block size information in RHCT, initialize the variables on ACPI platforms. Signed-off-by: Sunil V L Reviewed-by: Conor Dooley --- arch/riscv/mm/cacheflush.c | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/arch/riscv/mm/cacheflush.c b/arch/riscv/mm/cacheflush.c index f1387272a551..8e59644e473c 100644 --- a/arch/riscv/mm/cacheflush.c +++ b/arch/riscv/mm/cacheflush.c @@ -3,7 +3,9 @@ * Copyright (C) 2017 SiFive */ +#include #include +#include #include #ifdef CONFIG_SMP @@ -124,15 +126,38 @@ void __init riscv_init_cbo_blocksizes(void) unsigned long cbom_hartid, cboz_hartid; u32 cbom_block_size = 0, cboz_block_size = 0; struct device_node *node; + struct acpi_table_header *rhct; + acpi_status status; + unsigned int cpu; + + if (!acpi_disabled) { + status = acpi_get_table(ACPI_SIG_RHCT, 0, &rhct); + if (ACPI_FAILURE(status)) + return; + } - for_each_of_cpu_node(node) { - /* set block-size for cbom and/or cboz extension if available */ - cbo_get_block_size(node, "riscv,cbom-block-size", - &cbom_block_size, &cbom_hartid); - cbo_get_block_size(node, "riscv,cboz-block-size", - &cboz_block_size, &cboz_hartid); + for_each_possible_cpu(cpu) { + if (acpi_disabled) { + node = of_cpu_device_node_get(cpu); + if (!node) { + pr_warn("Unable to find cpu node\n"); + continue; + } + + /* set block-size for cbom and/or cboz extension if available */ + cbo_get_block_size(node, "riscv,cbom-block-size", + &cbom_block_size, &cbom_hartid); + cbo_get_block_size(node, "riscv,cboz-block-size", + &cboz_block_size, &cboz_hartid); + } else { + acpi_get_cbo_block_size(rhct, cpu, &cbom_block_size, + &cboz_block_size, NULL); + } } + if (!acpi_disabled && rhct) + acpi_put_table((struct acpi_table_header *)rhct); + if (cbom_block_size) riscv_cbom_block_size = cbom_block_size;