From patchwork Wed Oct 18 12:40:07 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: 154869 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4759428vqb; Wed, 18 Oct 2023 05:41:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHFzbagejAVmenBhv3oJR8gksTtSmnizkEcHxZpK2K3wyCTGBp+hvRYMbwMYaHrLzcEYLoS X-Received: by 2002:a17:90b:3906:b0:27d:1593:2b0b with SMTP id ob6-20020a17090b390600b0027d15932b0bmr5415229pjb.0.1697632863264; Wed, 18 Oct 2023 05:41:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697632863; cv=none; d=google.com; s=arc-20160816; b=Prv2JgDdlX3Ia5K7ucLPW8GehDdph9h7fVcCcucFM0IGFBzG/VP5P2ysBZW5JaSKrM S5MNlGSvr2rkYOOBzZmtc3e1bFgSzFwUP+EyCknL4eQ1Y8XtRambdLNh7H3+ycz2VbMu al41/KlBKmMcFuZayKhuIvsgpA/dX/QzRg5ntTGowqjfk48uv9ClV2pOqg8kbULVKOmA MAQ40CuHOXcFv9AC29yKtNs/Hf7IbcJvzlkMAsmDl/mZyLyhXtZcW5xhabD9jCbaCrft t2Hp2buEVO0QPrBRW9cQefSBHZHmChH+S9Op3/U11+jIo8UGFEsgL38R4ngS8I9Sj+dG s73A== 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=k2bhvVS+iGlODYrs0fN0iTmfeOWSVXnmMmj0GHdCTAk=; fh=ntJUqQGzMIuqmyWQQ8d4Jkq23YGfZjt7+jvx8Q8XaNQ=; b=BDUVWLDhf9W7HEjVWY/DKhj/WRc1h3P5uzbBmUFUUuIkJt0qTl4fNULUB+BigncQpi b7ICsG6XxUhYTx3UDC7MWVlXtK2xRS8K+43m9Sie7LnVdLizOqzWffIAVDwyOT9V/U/u U8aJVj+wNhfT+1CGmcz9oH7hgE3oEoUjHJtsx03CUV/TLXaE/SGM5F6EAKMbNFE+t7Ua YpB+S7kLKzQd/kX4kfB56iejt9bortxw3vxJzTOuNMvqDxCfu3BN1LAikuhvo8uicC8R Kjyk27VWH2MQz2mE2JawBAFM1BSK3XYO3xpc59QAJiyH0hvrW/teHWArAzecKX17h9tY EwaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=RMQSb1h6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id nn2-20020a17090b38c200b0027da14d150esi1427465pjb.187.2023.10.18.05.41.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 05:41:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=RMQSb1h6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 4FA64817C3F1; Wed, 18 Oct 2023 05:41:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230384AbjJRMkk (ORCPT + 23 others); Wed, 18 Oct 2023 08:40:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230398AbjJRMke (ORCPT ); Wed, 18 Oct 2023 08:40:34 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BABCE119 for ; Wed, 18 Oct 2023 05:40:29 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6b5af4662b7so4011916b3a.3 for ; Wed, 18 Oct 2023 05:40:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1697632829; x=1698237629; 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=k2bhvVS+iGlODYrs0fN0iTmfeOWSVXnmMmj0GHdCTAk=; b=RMQSb1h6l1sL1msEixO2AlPtG+ceNrqLKD+J9chAAIqvWVPv7Eb751LaOTMkTCLTFP hJq5svk5+oR8wN2nbhnu0nEt7arFTX72RTvTK87SlgmjpVQRfS2fmddWUzHyd0GhlJIY +Znjd1gxhk60K1UvfOCostA82wC3oExu9kvO+64zWbpoMLa5wGJshBXNKx+t6LGtskyH MFAKmqp2hsxpPSHFzc2fpKl1cVicZdjN83tHjMVhyGTbG2ZP/YnqEQlYuYUYUjfKJxb6 gZRgAZfm06S5t9XWsJi09a/6xoezJHrLpjoq3qW+FT6/Ap6FcIhszMeWUIfmTmJW315O oeJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697632829; x=1698237629; 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=k2bhvVS+iGlODYrs0fN0iTmfeOWSVXnmMmj0GHdCTAk=; b=uxHY4jOpSRh0jrGxNpfo2i9e+BNB4wrjwkYSwLD47x85Q+WjRD/3FLYErEtVwtgcZ9 +JxwtNeQB3YouOn7S+3yPPGbK/Qrfavkc138FgxLl9orHOREB1XqO29AntWByxNi6/Un pkPv72mNvFQf6CHge3nkCmeZwc+AX/ZnUIgUmH35XQxP95aRdfeHFeGfLBElCRv1UDgH K3O4VnuwjUK3GxPLXxpQ/0bEfebZIgsz7xptytNbl4K7xaROEsfOCLJZH+/IY3j7afOG 5Ec2Z34K0+58t5DKAw8dGR7FkFn/1qR8MG0CkD+kyn26SQFeImf1ZIo85Y2P9lo9l5yF 5XsA== X-Gm-Message-State: AOJu0Ywek/sSZR8kIJS0uHWz9/4xqbyqENXUw38vKdoO7C0XOONwUxKX SjpuOrewNnWRuxbJu2yU+fQa9A== X-Received: by 2002:a05:6a21:6da8:b0:17b:4b61:a907 with SMTP id wl40-20020a056a216da800b0017b4b61a907mr1493643pzb.50.1697632829272; Wed, 18 Oct 2023 05:40:29 -0700 (PDT) Received: from sunil-pc.Dlink ([106.51.188.78]) by smtp.gmail.com with ESMTPSA id w190-20020a6382c7000000b005891f3af36asm1599267pgd.87.2023.10.18.05.40.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 05:40:28 -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 , Sunil V L , Samuel Holland Subject: [PATCH v4 -next 4/4] RISC-V: cacheflush: Initialize CBO variables on ACPI systems Date: Wed, 18 Oct 2023 18:10:07 +0530 Message-Id: <20231018124007.1306159-5-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231018124007.1306159-1-sunilvl@ventanamicro.com> References: <20231018124007.1306159-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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Wed, 18 Oct 2023 05:41:01 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780097077303307754 X-GMAIL-MSGID: 1780097077303307754 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)