From patchwork Mon Oct 16 16:49:58 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: 153662 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3595149vqb; Mon, 16 Oct 2023 09:55:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEq4hEcKPbSsh/0vzGwFABDU08u5nsv2QmhGSxKI8TtAYdLQhzmiCY7o1G0YPhHGpbqkMZa X-Received: by 2002:a05:6870:ab13:b0:1e9:9f9b:eb7a with SMTP id gu19-20020a056870ab1300b001e99f9beb7amr15266875oab.4.1697475349899; Mon, 16 Oct 2023 09:55:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697475349; cv=none; d=google.com; s=arc-20160816; b=w3/tZ4nnPF2CeJzeXsskTYFRaNpJzFScFaKPQBFdXWsxvEl4VNK6J7pz1TTZpqGjOr Dr+OhlFAd7JoGf1eSo6qJN/udDuvrLLLHs+/Py5SGnAuNSeRDn6Ql9LlkHBurdVH29Ys e+AbqO728XXAjewncJkQ11xQySAuzwAyDX+No9GbnYhEr1UKJxBRRy1y8ALmcP9pQG67 QCXuVxgIFJkQ2l/1QtihWBom/v9KcP6T4UZVZTI+fEBNHJ58dFN0QFUth4DljmTEh0lA Zie2/JhiaEBDS4DZSrtpi1jJ9JkHDBrqaWOwXKyjWvcze/HZdmTKuqBJUOOHLL4x/9yG 2DPw== 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=ZZ0vGD2+BKy40gDZpkmDGFYSfDE+/JpanTOV3I4/UO0=; fh=GSUzFmVoxnIYRJr2qxP5oVP2HvI7gxdu+Sv/xWUv4xo=; b=NxR1KTki5DZW3mYLGwPTGjP+2+P5K/boKtDsjeHZNnfliI6sJcrhtCWO274wvZu7lM Uii4U6uW7h9XQPshedkAs5k0TWeVYs1BwompnOD91YyZx51I/35tPFu7VwWijIxA3+qQ EG/UWOkJp+5ZyTqE77LMBU6+onK3pM8MSl7wnAikMzy1XMYHdtHcwOEk45FlHLzGBn1y Qqsx/JqJmsDBxITbaOc/Ha4PJMKrXZ6J+GPsNChpO/3jqfWvq4Lr2Zqncg2gWsuOd39J Rd5EcXfuA/Td4Lre+8LlxBoJVB2u5OPSV+PUz5JMJ6MJrEb1ctWA9ikgOBtobTpfCNWr Wx4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=gQArJ88m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id t189-20020a6381c6000000b005ac13270364si7638021pgd.732.2023.10.16.09.55.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 09:55:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=gQArJ88m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id 604FB80A4ADF; Mon, 16 Oct 2023 09:55:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234470AbjJPQzY (ORCPT + 18 others); Mon, 16 Oct 2023 12:55:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234328AbjJPQzJ (ORCPT ); Mon, 16 Oct 2023 12:55:09 -0400 Received: from mail-ot1-x32e.google.com (mail-ot1-x32e.google.com [IPv6:2607:f8b0:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79CC0385E for ; Mon, 16 Oct 2023 09:50:20 -0700 (PDT) Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-6c4b9e09528so3241746a34.3 for ; Mon, 16 Oct 2023 09:50:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1697475019; x=1698079819; 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=ZZ0vGD2+BKy40gDZpkmDGFYSfDE+/JpanTOV3I4/UO0=; b=gQArJ88mZHl4FZCcgOndCz7jWFnjzhzDkmv73hirutORkdAvF/uryfkl4E7orGhVAq vFZVFGowdwMfpS4bbJu+2TDe/YtN+1O31HgopAffcByIEX1EKA0gJQlPQVTquhalTXJh 8Q0cPjouu+tU6EhjLWB+9F5VzXNW9DgPqN3o6LOV+L0qj+lcoF3M7X79KHEruRIDTtTr qGYMPbJgcRn7/B7roaTjuThQEz0590Cx82ZgRcivNXKc9ftOMF/PU2mEdLBEfQvq+Ocw Y8Dt+8f8yURcAuTAPPH8DdLCVlTPOYkA5Le5TTibEcTP9p6OJVt99sgSgu4cLBdJe4pv iuxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697475019; x=1698079819; 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=ZZ0vGD2+BKy40gDZpkmDGFYSfDE+/JpanTOV3I4/UO0=; b=GtwRwQU83wJdS3ovf40CDTQq3PCLIHGi+inkHeP70eNHDGQCb94HswZuUu3wj05fsg LwwpTPMLy/Owe5erYPwoUDlMSUsF2vpqc9jaahLAU+Bf/SwJrLhrboF6VfU96qaK8hLZ i+cAtg2PQq8OufZnAxdziZOj/TpC2yrJG/ySZrdo/Juz+AGvTGB4WR3WumsJTVbf2pFw edCOXbarOi1RqtF1V9jLrbEsU2toE3RwpJOidFXMP1qA8oHIlPK3PYk2Ah7xIXJVwUB0 OXVHu1SkvpEKJ/wDeFIjZC4K/jFD5HOsyZPKeb3cn/N2cNhc17XAoxSZTbWIkPcH1CBw u94g== X-Gm-Message-State: AOJu0YzNeuxQQ+3bI9m1OOb93mXB175isstIpRVvqjiklOf34dVu9UeJ T//A+g1MXbur5HtRhtyhe1X8pw== X-Received: by 2002:a05:6830:4ae:b0:6c4:9ca1:f13a with SMTP id l14-20020a05683004ae00b006c49ca1f13amr35003337otd.35.1697475019591; Mon, 16 Oct 2023 09:50:19 -0700 (PDT) Received: from sunil-pc.Dlink ([106.51.188.78]) by smtp.gmail.com with ESMTPSA id t21-20020a056a0021d500b006b1e8f17b85sm111252pfj.201.2023.10.16.09.50.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 09:50:18 -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 , Andrew Jones , Conor Dooley , Anup Patel , Ard Biesheuvel , Atish Kumar Patra , Sunil V L Subject: [PATCH v3 -next 3/3] RISC-V: cacheflush: Initialize CBO variables on ACPI systems Date: Mon, 16 Oct 2023 22:19:58 +0530 Message-Id: <20231016164958.1191529-4-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231016164958.1191529-1-sunilvl@ventanamicro.com> References: <20231016164958.1191529-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email 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 (fry.vger.email [0.0.0.0]); Mon, 16 Oct 2023 09:55:43 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779931912426823062 X-GMAIL-MSGID: 1779931912426823062 Initialize the CBO variables on ACPI based systems using information in RHCT. Signed-off-by: Sunil V L Reviewed-by: Andrew Jones Reviewed-by: Samuel Holland --- arch/riscv/mm/cacheflush.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/arch/riscv/mm/cacheflush.c b/arch/riscv/mm/cacheflush.c index f1387272a551..55a34f2020a8 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,13 +126,24 @@ 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; + + if (acpi_disabled) { + 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); + } + } else { + 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); + acpi_get_cbo_block_size(rhct, &cbom_block_size, &cboz_block_size, NULL); + acpi_put_table((struct acpi_table_header *)rhct); } if (cbom_block_size)