From patchwork Thu Nov 4 12:54:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Gardner X-Patchwork-Id: 1550914 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=gR8B3pPI; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HlNtx2THnz9sP7 for ; Thu, 4 Nov 2021 23:56:41 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1micIC-0006Lq-Ox; Thu, 04 Nov 2021 12:56:32 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1micHH-0004gU-4J for kernel-team@lists.ubuntu.com; Thu, 04 Nov 2021 12:55:35 +0000 Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 627043F1C7 for ; Thu, 4 Nov 2021 12:55:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1636030532; bh=ufwB+/f1pUa2uQIJgYclaURci0wAdYSV4zvEdjKOEg0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gR8B3pPI+oGSNhb9tEoZzFRMrlMf/+DJp4P2m8R2rL3Pex6FsaZpQyhi1BH6y+ygg 6KOkqlIxLo/QSOEaSQUlbhm/wLBPmlURedXw7HYM0afYPLfk+hyriKRUUBvXoZAwMj itt0QcjikS+xjHSjSIZTLOIUVw5wGRdqg+8vK1qx+75ckUVeRwUYRMDOtL+qQpx1iq t8Nct7Euz3gob99rjRSqUTcxOg9dHlxybpJ2Pempw58sedgzcwGYrvocIBkFEdPlMo oI+29zecej9vhzp8BGyWECH+dpfhi72nW4AWx7cBrPCJc8ZqjCSRuFXw6arW6Mn0gs 307q1VMX3tq8A== Received: by mail-pg1-f197.google.com with SMTP id e6-20020a637446000000b002993ba24bbaso3652021pgn.12 for ; Thu, 04 Nov 2021 05:55:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ufwB+/f1pUa2uQIJgYclaURci0wAdYSV4zvEdjKOEg0=; b=RFulZrm3LiHYHY4w7Nky4fj+akg4NwE2mcIeD06ZN2O1yr4N5a6IuT+8WrgUYgcasz 41LQtaF11UBJfiXJSuDZmOrBcMBoThGk0U+zsc+d7kIBXgHecjMUJUJQOn8tJno9HQ/k PzsX4dIMnTpoCAxVnI0qcNl8gX3tgMGLrHse0sI1p0CvNoWVh+Q37NqLCXNpIgL8i0wm mCCwvbnq7Ns/BuSnl6WsyU5EoSNYfNkvUk+YoudrJZwBT/T9LeRS74P7m+mUToFpaPWT g1SBP4WxSKdTWYwk0nN9VCod2JPLq6IWIUda0PQgISpbwBxeJJ/K+j/AWabeifnjYAVB 3ORA== X-Gm-Message-State: AOAM533d2vxv02qvLpS6BtXZu6Bu8XipEdaaLH7QtPGUD95mu+lt9GOM Qna4JuPhnwe0iOZW4RX6EyfQj5zH5LHoyGdaHLqM27YQwyki1aZ3HDc28f3pripJ0tCMITysHXp 2FuiN5NNOlb9TVfU8wRfhm3rnf6ykm8k1Lm356O2PoQ== X-Received: by 2002:a05:6a00:1995:b0:47c:1f59:a27a with SMTP id d21-20020a056a00199500b0047c1f59a27amr52052275pfl.36.1636030529940; Thu, 04 Nov 2021 05:55:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwci4qAxo+fP/xC/IPaULOJx3O9p7n4uQFgmf2nSxQgCQuAKcllFxe9b4pEXiboaenvGxGMoQ== X-Received: by 2002:a05:6a00:1995:b0:47c:1f59:a27a with SMTP id d21-20020a056a00199500b0047c1f59a27amr52052248pfl.36.1636030529683; Thu, 04 Nov 2021 05:55:29 -0700 (PDT) Received: from localhost.localdomain ([69.163.84.166]) by smtp.gmail.com with ESMTPSA id y4sm5283859pfi.178.2021.11.04.05.55.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 05:55:29 -0700 (PDT) From: Tim Gardner To: kernel-team@lists.ubuntu.com Subject: [PATCH 22/41] UBUNTU: SAUCE: arm64: hyperv: Add Hyper-V clocksource/clockevent support Date: Thu, 4 Nov 2021 06:54:30 -0600 Message-Id: <20211104125449.16540-23-tim.gardner@canonical.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211104125449.16540-1-tim.gardner@canonical.com> References: <20211104125449.16540-1-tim.gardner@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Michael Kelley BugLink: https://bugs.launchpad.net/bugs/1949770 Add architecture specific definitions and functions needed by the architecture independent Hyper-V clocksource driver. Update the Hyper-V clocksource driver to be initialized on ARM64. Signed-off-by: Michael Kelley Reviewed-by: Sunil Muthuswamy [marcelo.cerri@canonical.com: back ported from https://lore.kernel.org/linux-hyperv/1620841067-46606-4-git-send-email-mikelley@microsoft.com/] Signed-off-by: Marcelo Henrique Cerri --- arch/arm64/include/asm/mshyperv.h | 12 ++++++++++++ drivers/clocksource/hyperv_timer.c | 14 ++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/arch/arm64/include/asm/mshyperv.h b/arch/arm64/include/asm/mshyperv.h index 20070a847304..e1486bf02599 100644 --- a/arch/arm64/include/asm/mshyperv.h +++ b/arch/arm64/include/asm/mshyperv.h @@ -21,6 +21,7 @@ #include #include #include +#include /* * Declare calls to get and set Hyper-V VP register values on ARM64, which @@ -41,6 +42,17 @@ static inline u64 hv_get_register(unsigned int reg) return hv_get_vpreg(reg); } +/* Define the interrupt ID used by STIMER0 Direct Mode interrupts. This + * value can't come from ACPI tables because it is needed before the + * Linux ACPI subsystem is initialized. + */ +#define HYPERV_STIMER0_VECTOR 31 + +static inline u64 hv_get_raw_timer(void) +{ + return arch_timer_read_counter(); +} + /* SMCCC hypercall parameters */ #define HV_SMCCC_FUNC_NUMBER 1 #define HV_FUNC_ID ARM_SMCCC_CALL_VAL( \ diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c index ce94f78eb851..d1510d43211b 100644 --- a/drivers/clocksource/hyperv_timer.c +++ b/drivers/clocksource/hyperv_timer.c @@ -569,3 +569,17 @@ void __init hv_init_clocksource(void) hv_setup_sched_clock(read_hv_sched_clock_msr); } EXPORT_SYMBOL_GPL(hv_init_clocksource); + +/* Initialize everything on ARM64 */ +static int __init hyperv_timer_init(struct acpi_table_header *table) +{ + if (!hv_is_hyperv_initialized()) + return -EINVAL; + + hv_init_clocksource(); + if (hv_stimer_alloc(true)) + return -EINVAL; + + return 0; +} +TIMER_ACPI_DECLARE(hyperv, ACPI_SIG_GTDT, hyperv_timer_init);