Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp4247544rwr; Mon, 8 May 2023 05:17:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5JYuwM66JnPo+RyzBq1gPZjnwkM8sPNBdhhTby4pdad11qpaL+SghNvO/poo0tTYMJo/ro X-Received: by 2002:a05:6a00:2ea9:b0:63b:8963:d952 with SMTP id fd41-20020a056a002ea900b0063b8963d952mr11601554pfb.17.1683548223911; Mon, 08 May 2023 05:17:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683548223; cv=none; d=google.com; s=arc-20160816; b=tN3dzeqtKC+yboR1H/2tWydoDiEpv1lO8oWMVIifGaweFPl+meS+2KVGExySbtu5l8 Y5kGrNdm4U0cYLvAM3WsIhQzXnyniozbsX8Z/DDbpexlu1f6VwvkAlle6e1qWOgO3LPb Nbns8Lv2VYj0KjEMYHQ5tgQGQz0h2gnN5P3jvJcjuOuMvt+Xz5J9BdiPJmlGP2CbyGeZ H67extRR458bLjRsUcqXDRIkFqb7iviJ8qNHgOfzxp2hiB9oI67xC9mu3Vz4zQXrz08n Tkg1lmVzNwN+rXJI8GW1LkpO0f6BygZwjVwbba+BwVtFCw4xxjUTUbo/1Vzu5GTT5Ir9 jsIQ== 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=yRIRI8aArNgE1fextAvbnFu2fBTu5X0gP4d56RcrLtU=; b=QPLBAQMqTFDDTlfz7L3tpt1PRUF5Y45d+CJ++GJLX6BdyTatMCkkfjeYBCuKBI9hRj vGD2oSyGFAl7GjbjOBApxdMiUkUGa/voll5WwS2i6pPiuJe9ZVnTU2a9as5EsT9Qbvjx rmYWUwB0NX3JGnt/tPGcc+48NR8HNx5U7Qi9C/9HpO+rfoYnf1Z1hhw4YgT7usuzoBBW mH/xB2DHOOM+gVNEIpWaFgdcTHVLqXBIcbXHcDXiBBw3/8oQ4apldCXvLpUfFUMpt82k I41aqgNGVSfk/Ps++/Pag5NYis4sVOoUkYv9YmkTyJw/n3NhSTcw3OkSA8keNn5CNHAW SlDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=dPMbOuJs; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 73-20020a63004c000000b0051bb433f5bbsi8535963pga.386.2023.05.08.05.16.49; Mon, 08 May 2023 05:17:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=dPMbOuJs; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233483AbjEHL6K (ORCPT + 99 others); Mon, 8 May 2023 07:58:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234094AbjEHL5e (ORCPT ); Mon, 8 May 2023 07:57:34 -0400 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55BA54641E for ; Mon, 8 May 2023 04:55:25 -0700 (PDT) Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-64115e652eeso33927756b3a.0 for ; Mon, 08 May 2023 04:55:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1683546924; x=1686138924; 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=yRIRI8aArNgE1fextAvbnFu2fBTu5X0gP4d56RcrLtU=; b=dPMbOuJszGZR9AahCXbvkNUwii+U9QMTSbyX/g4rgl2Q6FpYBFAPcbDw395JVWTi3S E6urCy+MpwA2mwwR1jCyAvffT1l31W8/LPIcJGeeFTD5aLYHDEquT54qiJ2PiGwewAK/ 7/al2D5PTVEakeiZsNEdWqALf2XkQL0K7k9aFb+4iJxePbBgZXZVkfp8vW4aBTIcs+SD +bz/l9nW3Yjj7WFv+zwFHYEfdt26tbRHLOQXJbw4w/Xh1zaR7Z1ODfJ0Z4leFb0BXw7C UqtjGgxhDIEAThPM+W99EdZymdIczjmy/IDVSEpiG7tDS91x79zJImn26Sq77ax+bOHo zOIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683546924; x=1686138924; 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=yRIRI8aArNgE1fextAvbnFu2fBTu5X0gP4d56RcrLtU=; b=BL58L/SI+lxouHybwIMCOSo5X7ty08O+Nc7r7C2m5mP6u1p+ar1K0VGkmP9NpjZTwm Ao50uKqWrGXvtcjvf9dM4WGSfwtqY3q46nYQpWNoNkFjbRzMbkGerDWQ8GscNIUox4n6 T5UGlUyYHqW/jkumQx/2J3H6gu0w7gwNi8g6XBJxzNBtVgF0yVXqsd5cMGc35TuJiGP1 aldt6jslYBYB0e7+JAldsBrW1+JOn0rK5JgU13iih5ibSyK5GZDmm1Nwqkyi0+QYPxv/ GdEfx+1F6a2P8Q2MUui3fG5OGN5LUC65z5RJghfVbyh7ADkAVszGNisETuN2WQsOWmDS phIg== X-Gm-Message-State: AC+VfDw9P4MW0yj1hJaSK3HrQDYkaKLHD+cPD7TH+PIwCZAfJGnao20P 2Lo5hacVYquKhse3uGnVSwcOAg== X-Received: by 2002:a17:902:e550:b0:1a6:e564:6044 with SMTP id n16-20020a170902e55000b001a6e5646044mr12627890plf.7.1683546924015; Mon, 08 May 2023 04:55:24 -0700 (PDT) Received: from sunil-laptop.. ([106.51.189.144]) by smtp.gmail.com with ESMTPSA id w9-20020a170902904900b001aaed524541sm7015149plz.227.2023.05.08.04.55.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 May 2023 04:55:23 -0700 (PDT) From: Sunil V L To: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-acpi@vger.kernel.org, linux-crypto@vger.kernel.org, platform-driver-x86@vger.kernel.org, llvm@lists.linux.dev Cc: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , "Rafael J . Wysocki" , Len Brown , Daniel Lezcano , Thomas Gleixner , Weili Qian , Zhou Wang , Herbert Xu , "David S . Miller" , Marc Zyngier , Maximilian Luz , Hans de Goede , Mark Gross , Nathan Chancellor , Nick Desaulniers , Tom Rix , Sunil V L , "Rafael J . Wysocki" , Andrew Jones , Conor Dooley Subject: [PATCH V5 18/21] RISC-V: time.c: Add ACPI support for time_init() Date: Mon, 8 May 2023 17:22:34 +0530 Message-Id: <20230508115237.216337-19-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230508115237.216337-1-sunilvl@ventanamicro.com> References: <20230508115237.216337-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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-crypto@vger.kernel.org On ACPI based platforms, timer related information is available in RHCT. Add ACPI based probe support to the timer initialization. Signed-off-by: Sunil V L Acked-by: Rafael J. Wysocki Reviewed-by: Andrew Jones Reviewed-by: Conor Dooley --- arch/riscv/kernel/time.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/arch/riscv/kernel/time.c b/arch/riscv/kernel/time.c index babaf3b48ba8..23641e82a9df 100644 --- a/arch/riscv/kernel/time.c +++ b/arch/riscv/kernel/time.c @@ -4,6 +4,7 @@ * Copyright (C) 2017 SiFive */ +#include #include #include #include @@ -18,17 +19,29 @@ EXPORT_SYMBOL_GPL(riscv_timebase); void __init time_init(void) { struct device_node *cpu; + struct acpi_table_rhct *rhct; + acpi_status status; u32 prop; - cpu = of_find_node_by_path("/cpus"); - if (!cpu || of_property_read_u32(cpu, "timebase-frequency", &prop)) - panic(KERN_WARNING "RISC-V system with no 'timebase-frequency' in DTS\n"); - of_node_put(cpu); - riscv_timebase = prop; + if (acpi_disabled) { + cpu = of_find_node_by_path("/cpus"); + if (!cpu || of_property_read_u32(cpu, "timebase-frequency", &prop)) + panic("RISC-V system with no 'timebase-frequency' in DTS\n"); + + of_node_put(cpu); + riscv_timebase = prop; + of_clk_init(NULL); + } else { + status = acpi_get_table(ACPI_SIG_RHCT, 0, (struct acpi_table_header **)&rhct); + if (ACPI_FAILURE(status)) + panic("RISC-V ACPI system with no RHCT table\n"); + + riscv_timebase = rhct->time_base_freq; + acpi_put_table((struct acpi_table_header *)rhct); + } lpj_fine = riscv_timebase / HZ; - of_clk_init(NULL); timer_probe(); tick_setup_hrtimer_broadcast(); -- 2.34.1