From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 235F6C433DB for ; Mon, 15 Feb 2021 13:30:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E496E64E2C for ; Mon, 15 Feb 2021 13:30:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229666AbhBONaY (ORCPT ); Mon, 15 Feb 2021 08:30:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:38654 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230384AbhBON26 (ORCPT ); Mon, 15 Feb 2021 08:28:58 -0500 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9D02264E29; Mon, 15 Feb 2021 13:28:08 +0000 (UTC) Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1lBdv4-00EGun-Ec; Mon, 15 Feb 2021 13:28:06 +0000 Date: Mon, 15 Feb 2021 13:28:05 +0000 Message-ID: <87tuqdpije.wl-maz@kernel.org> From: Marc Zyngier To: Hector Martin Cc: linux-arm-kernel@lists.infradead.org, Rob Herring , Arnd Bergmann , Olof Johansson , Krzysztof Kozlowski , Mark Kettenis , Tony Lindgren , Mohamed Mediouni , Stan Skowronek , Alexander Graf , Will Deacon , Linus Walleij , Mark Rutland , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 06/25] arm64: arch_timer: implement support for interrupt-names In-Reply-To: <20210215121713.57687-7-marcan@marcan.st> References: <20210215121713.57687-1-marcan@marcan.st> <20210215121713.57687-7-marcan@marcan.st> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: marcan@marcan.st, linux-arm-kernel@lists.infradead.org, robh@kernel.org, arnd@kernel.org, olof@lixom.net, krzk@kernel.org, mark.kettenis@xs4all.nl, tony@atomide.com, mohamed.mediouni@caramail.com, stan@corellium.com, graf@amazon.com, will@kernel.org, linus.walleij@linaro.org, mark.rutland@arm.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 15 Feb 2021 12:16:54 +0000, Hector Martin wrote: > > This allows the devicetree to correctly represent the available set of > timers, which varies from device to device, without the need for fake > dummy interrupts for unavailable slots. > > Also add the hyp-virt timer/PPI, which is not currently used, but worth > representing. > > Signed-off-by: Hector Martin > --- > drivers/clocksource/arm_arch_timer.c | 25 +++++++++++++++++++++---- > include/clocksource/arm_arch_timer.h | 1 + > 2 files changed, 22 insertions(+), 4 deletions(-) > > diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c > index d0177824c518..0e87b6d1ce97 100644 > --- a/drivers/clocksource/arm_arch_timer.c > +++ b/drivers/clocksource/arm_arch_timer.c > @@ -63,6 +63,14 @@ struct arch_timer { > static u32 arch_timer_rate; > static int arch_timer_ppi[ARCH_TIMER_MAX_TIMER_PPI]; > > +static const char *arch_timer_ppi_names[ARCH_TIMER_MAX_TIMER_PPI] = { > + "phys-secure", > + "phys", > + "virt", > + "hyp-phys", > + "hyp-virt", nit: I'd prefer it if the array was described as: [ARCH_TIMER_PHYS_SECURE_PPI] = "phys-secure", [...] just to avoid that the two get out of sync. > +}; > + > static struct clock_event_device __percpu *arch_timer_evt; > > static enum arch_timer_ppi_nr arch_timer_uses_ppi = ARCH_TIMER_VIRT_PPI; > @@ -1280,17 +1288,26 @@ static void __init arch_timer_populate_kvm_info(void) > > static int __init arch_timer_of_init(struct device_node *np) > { > - int i, ret; > + int i, irq, ret; > u32 rate; > + bool has_names; > > if (arch_timers_present & ARCH_TIMER_TYPE_CP15) { > pr_warn("multiple nodes in dt, skipping\n"); > return 0; > } > > - arch_timers_present |= ARCH_TIMER_TYPE_CP15; You probably didn't want to drop this line, did you? > - for (i = ARCH_TIMER_PHYS_SECURE_PPI; i < ARCH_TIMER_MAX_TIMER_PPI; i++) > - arch_timer_ppi[i] = irq_of_parse_and_map(np, i); > + > + has_names = of_property_read_bool(np, "interrupt-names"); > + > + for (i = ARCH_TIMER_PHYS_SECURE_PPI; i < ARCH_TIMER_MAX_TIMER_PPI; i++) { > + if (has_names) > + irq = of_irq_get_byname(np, arch_timer_ppi_names[i]); > + else > + irq = of_irq_get(np, i); > + if (irq > 0) > + arch_timer_ppi[i] = irq; > + } > > arch_timer_populate_kvm_info(); > > diff --git a/include/clocksource/arm_arch_timer.h b/include/clocksource/arm_arch_timer.h > index 1d68d5613dae..73c7139c866f 100644 > --- a/include/clocksource/arm_arch_timer.h > +++ b/include/clocksource/arm_arch_timer.h > @@ -32,6 +32,7 @@ enum arch_timer_ppi_nr { > ARCH_TIMER_PHYS_NONSECURE_PPI, > ARCH_TIMER_VIRT_PPI, > ARCH_TIMER_HYP_PPI, > + ARCH_TIMER_HYP_VIRT_PPI, > ARCH_TIMER_MAX_TIMER_PPI > }; Otherwise looks OK to me. Thanks, M. -- Without deviation from the norm, progress is not possible.