Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4938487pxb; Mon, 15 Feb 2021 05:30:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJwxRd9W90BlDkER2Ca7NZ+DkjlRlHE3vqElJtAGGR2vEbZETa92pQPquE28JJE/0NZ0Q5aW X-Received: by 2002:aa7:d9cb:: with SMTP id v11mr1744525eds.153.1613395850949; Mon, 15 Feb 2021 05:30:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613395850; cv=none; d=google.com; s=arc-20160816; b=P1pfFtA49DIOVC3znQde3/+5e3BJOdfTHQ+67PPaemL1ZpMp6KsOnoE7IdRXIoPRjH sotkYyyByyYt2A3l+rS7cLm/rFq2RQoXyPNAG/jZclTKU/ITNWpOCi7MOFrJTWZSajOo r3bZa/mLo45G7KkZ0nR2Setw9YExFtK8hMvxrKj1yygSgLF/GRnTGuyTiLpc9/yLlJJu WXPYcKO7rJM5Mf0FqIZF+/fJJDyTfCmY+aUAqaKEYk5TPeNz4tRmbrzlxGca9BarqHtJ gq5QwinxcPSnELbNjNR73RXX/+Jqp7moG9sMP4oglQOysVwsLZwIkn7fAk5EtzyeAfR7 A/dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date; bh=+2uAfQlwDr2Iy2r5ZO+CkNcvLnsAUKeLLNRSHixU66M=; b=P78ZaZJJon6pV1Kb872WgTutpGLaWYntr3iqqhzLlsnAsqXjSTuFAIl8YkxsZvb5TR 2EXX36atABSJrgG7lHKoM9N4Rcg5Gs0L/O7M6cqhFi0QQAtLNBq1W+21s8OwK8r1wwIC ZYFvAHr/R9Popo64SVyevRf3DYPDKy7Dp2tXV1Apm/LcDzfYwTdYxOetcrXoVN5kIVj2 otYcKIUby7ocs8KFePnsxDoeUgkaAaUbmMMBj51TDV0S43EeZE9NGtMCPn7oJ6zNgxCV avDx3bu0TYnD5Y48pk89pl6f64ShwVfdZJKTxF1iq7nG0blZwwRAxaWdBLEfzvoBb7Hy 1bNA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bd14si9066176edb.174.2021.02.15.05.30.28; Mon, 15 Feb 2021 05:30:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229816AbhBON3p (ORCPT + 99 others); Mon, 15 Feb 2021 08:29:45 -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.