Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4897241pxb; Mon, 15 Feb 2021 04:22:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJxI4zXNQQCdgzJRDEHhdqPyS+deQzdkt4lYYx5KzwXQf2aPMbQZDOAgCOpslSwglTn8MOOm X-Received: by 2002:a05:6402:1bc7:: with SMTP id ch7mr15511735edb.124.1613391731079; Mon, 15 Feb 2021 04:22:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613391731; cv=none; d=google.com; s=arc-20160816; b=MRn6tRBtZAG8voq2zEwphQG3YwAD0mrtcO2UXGOW50rDC4Ej0RD4HdH+VLXF0wezcM 37TI+g1EDih7bdqqD7lRFAhLg+OGZq9TxmndMK7OeOzifWGcCi68T3hsv3UnZg5MF6Wp bzhy7iwguGuuGZrgfwe6Q8Hi8ZAVbz1PdxY9G9hgZpPZxHAgScHfr4ZB0msE6Zz3VNWy MRrV0DNhWB21OEukrFXxLwvavnOBAUXrh+u+M77Ype3lbBdu891m1/ZAx+3FYcsEsBUX TmnOe4zTumDaeY7THCQHl7y8Oyo2ym6QnjIUhO0NnKWKK/99Cioz+UyPhFjs/L6CBnk/ Powg== 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; bh=OuBAKETgprz3A20uVK65uuuO1VM685MbDCU0s7H3XX8=; b=L56zCZ3Q9PSebHAA+ijPHNRlfEiC5FTIm1Xz/R+CZd9tMgXHemhF9nSqGkK96L1cBN a2SLVyNX/guF6r1bTfEWSIHu8KPuatWCH2Q/7oXl2IFfncNOV48+iPo3bhCGgo4sGhsA tGGwdhsdATrU9MWveIR4wq52NB+2iw2JU+4uAr1gKm+SBNFFe3/j4o+v0dTs9PJtwC71 xcD/KETj2d2bgGGH9QoMSiCUFhJgw4jHIZcFek6zXKTa/UWrwhDnZlFAv0rqsjVYa5si sE6OsMfwatIZbIHsRFdiUkC8/m/XUpw/AQ469OSS1vkDds63TnqYbvhxWQHIp037N18W ak6w== 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=marcan.st Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a42si15995255edf.469.2021.02.15.04.21.48; Mon, 15 Feb 2021 04:22:11 -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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=marcan.st Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230234AbhBOMUD (ORCPT + 99 others); Mon, 15 Feb 2021 07:20:03 -0500 Received: from marcansoft.com ([212.63.210.85]:42528 "EHLO mail.marcansoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230152AbhBOMTD (ORCPT ); Mon, 15 Feb 2021 07:19:03 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hector@marcansoft.com) by mail.marcansoft.com (Postfix) with ESMTPSA id 1EE6D4249C; Mon, 15 Feb 2021 12:18:03 +0000 (UTC) From: Hector Martin To: linux-arm-kernel@lists.infradead.org Cc: Hector Martin , Marc Zyngier , 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: [PATCH v2 06/25] arm64: arch_timer: implement support for interrupt-names Date: Mon, 15 Feb 2021 21:16:54 +0900 Message-Id: <20210215121713.57687-7-marcan@marcan.st> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210215121713.57687-1-marcan@marcan.st> References: <20210215121713.57687-1-marcan@marcan.st> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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", +}; + 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; - 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 }; -- 2.30.0