Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1630910pxb; Thu, 4 Mar 2021 16:59:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJyCv4VMoZaEaMPUVMN1jO3DlzBMzbIYxVw1WFC3b9gcZh+7zZ+n2l3+sHATL1oWGj9H3K23 X-Received: by 2002:a5d:8d03:: with SMTP id p3mr5663741ioj.64.1614905954678; Thu, 04 Mar 2021 16:59:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614905954; cv=none; d=google.com; s=arc-20160816; b=e6KKtTZTggy4+n7HnMyA5bEkAyPLOeIkVV3py8y3JjO2ToFGZpCLaPm9mgqwwtf+JU hOGW0/T9HvYRyKR6GX6Kubs5C5YxFS7WRdOPXgxy+7wsbQowRNYY6R8ZYU6KfNG6LzY9 FnFD49A5G33OYVgQ5NegMQveRdUR96dKMXPN4BowZFvpItPxqJ64CVZZbKpspp4mUM9Z ahOAZpx5J4UuRpxeDzfjm99E8MjO8pL8aL+TLecTelxu101pAJDI9BaFwdYHiSFRFD3O tvXDt7ITUHRyRGnNo5A2sB0QK90SCLoG72q1WkgQF0qI7NhBpR+qXF+AoGEbZTA4p0NK NivQ== 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=kD0VLAvFh+xA2Fe3HiTrydzH33l6LpuubSmGnm0Q2oY=; b=DMPguRJzIndqup9hY53hP4mVMym1MiOF0PKy0DV+8UDHsKphvLFuNyPj9IDqhv+hnH a2KsrDb3kL1Y8RHnnanlPUCmj65RKO5spTUvryKYIGhqItJmNwcRdFxQz7FfhN/UDhln q9vnZKGYRnm94ArbdyQpzMxcyqi7ldYbWZ14Dt0HnHV5XMExBnRc6JZMyz89nvPaLUNH tqMYFefWq1w9Y2JLD7q1+6/S9GRlIggMyPbYwmGQW3EOyO8wvDb7Go2E+Mbl1Ojo3sZQ NTi55svHI/FWZbN/7/bqpGRRXG0Q9vJu/M5wXLpSKSmIQ8pT/nOFCmK+80ODaLrVXQBY Nl6Q== 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 k9si780500ilv.123.2021.03.04.16.59.01; Thu, 04 Mar 2021 16:59:14 -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 S240275AbhCDVla (ORCPT + 99 others); Thu, 4 Mar 2021 16:41:30 -0500 Received: from marcansoft.com ([212.63.210.85]:33680 "EHLO mail.marcansoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239995AbhCDVlA (ORCPT ); Thu, 4 Mar 2021 16:41:00 -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 EA1C0425B5; Thu, 4 Mar 2021 21:40:09 +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 , Andy Shevchenko , Greg Kroah-Hartman , Jonathan Corbet , Catalin Marinas , Christoph Hellwig , "David S. Miller" , devicetree@vger.kernel.org, linux-serial@vger.kernel.org, linux-doc@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFT PATCH v3 07/27] arm64: arch_timer: implement support for interrupt-names Date: Fri, 5 Mar 2021 06:38:42 +0900 Message-Id: <20210304213902.83903-8-marcan@marcan.st> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210304213902.83903-1-marcan@marcan.st> References: <20210304213902.83903-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 Reviewed-by: Tony Lindgren --- drivers/clocksource/arm_arch_timer.c | 24 +++++++++++++++++++++--- include/clocksource/arm_arch_timer.h | 1 + 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index d0177824c518..ee2501a17697 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] = { + [ARCH_TIMER_PHYS_SECURE_PPI] = "phys-secure", + [ARCH_TIMER_PHYS_NONSECURE_PPI] = "phys", + [ARCH_TIMER_VIRT_PPI] = "virt", + [ARCH_TIMER_HYP_PPI] = "hyp-phys", + [ARCH_TIMER_HYP_VIRT_PPI] = "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,8 +1288,9 @@ 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"); @@ -1289,8 +1298,17 @@ static int __init arch_timer_of_init(struct device_node *np) } 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