From patchwork Thu Nov 4 12:54:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Gardner X-Patchwork-Id: 1550922 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=TAlzDycp; 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 4HlNvJ3j1vz9sPf for ; Thu, 4 Nov 2021 23:57:00 +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 1micIU-0007RB-Rh; Thu, 04 Nov 2021 12:56:50 +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 1micHL-0004nz-Ie for kernel-team@lists.ubuntu.com; Thu, 04 Nov 2021 12:55:39 +0000 Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) (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 4B1163F1C2 for ; Thu, 4 Nov 2021 12:55:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1636030537; bh=+1sTJYpbXVhCYRpXB8+ZpK/6/U8jZMcjFPDTog3cH4I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TAlzDycpEBUBwXyp5D6QhsNbLDtSJ2P3k8CqVbl3gDoThgPZ3HDzvcqMkAR17it71 nesYE22NAJkIeJs5O+25IZm6ugO/xr3xN5lcWoGkewHS1l41ONsP9lIQzjJP/SK4nw k3kmLjh0guZGNBfVNEBZmKbQM8GZNs5+ODtWgBnbOL+3jMuqPgcptD8u8X6TEiWNhS K7s4laW3pmFBHHb25Uji+Ik95KaEB6tN3ISwh98d7C4ml8RGTU7dLq13Z3KA2PHJJF c6vxv4HhKjj7sKA0TIMIM3BehhwNt4QtbK7gBSTG+d4nyWLSqGvhC3ZK+vpw/zwXLU FUnpmvFoJqxiA== Received: by mail-pl1-f199.google.com with SMTP id g20-20020a170902869400b0014002b0f5bcso3137301plo.18 for ; Thu, 04 Nov 2021 05:55:37 -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=+1sTJYpbXVhCYRpXB8+ZpK/6/U8jZMcjFPDTog3cH4I=; b=S4lHYywGGZykpqIlHutybBNxxV5TBKVWcQrnWPL+s1jNYUzG+qQXajtyOqhjDvz+ew 4PzjlChNuIIbNxy+pEsZRef0LkBYqCeSXuCZ7vaCmy2AHpLJlhxt8xic/HZGwORMYXE9 1GMJBiSDWI8A373J3g7JaSmmHHh0C8XS754vAWYPSlHkaItbyPdm7HQBNjq8PwLUGPzA 51YS6X7P8Aa3W78VDquXQWU4YiE23g4az6pC7cBQQYH5FAv8Kdhtglxz5pzleyMhu0d4 9YWB6kOqd7ndIA9sZ4aiglenYejMtEUCcARv8Iwt8SkjNJbV7JvH5mvpQAGz/oZXiMQj TDdw== X-Gm-Message-State: AOAM531vnZHkUfk3v/VVyra6tl6l+k8FnOJ3v7+HNb0XSoQ5Cy4Rz2mH prPpkcxlDprzELOzhovXQVV57eDQbUjFfJFN94oI0ppE58TELJth2kwn5r0ROppSBaWcwjzwyPT KGF7EMakTA0z2ORNTXuNUZ3Ca01iMSBHhKlDVqbMUxg== X-Received: by 2002:a63:d80c:: with SMTP id b12mr38942042pgh.331.1636030535147; Thu, 04 Nov 2021 05:55:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRmVZIxleC1cG9/ZymiJMfQN5aB9OCzePJz3YjseaVsRKFgFRsK832ueL2jwItjckieaFX4w== X-Received: by 2002:a63:d80c:: with SMTP id b12mr38942027pgh.331.1636030534890; Thu, 04 Nov 2021 05:55:34 -0700 (PDT) Received: from localhost.localdomain ([69.163.84.166]) by smtp.gmail.com with ESMTPSA id y4sm5283859pfi.178.2021.11.04.05.55.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 05:55:34 -0700 (PDT) From: Tim Gardner To: kernel-team@lists.ubuntu.com Subject: [PATCH 28/41] Drivers: hv: Add arch independent default functions for some Hyper-V handlers Date: Thu, 4 Nov 2021 06:54:36 -0600 Message-Id: <20211104125449.16540-29-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 Architecture independent Hyper-V code calls various arch-specific handlers when needed. To aid in supporting multiple architectures, provide weak defaults that can be overridden by arch-specific implementations where appropriate. But when arch-specific overrides aren't needed or haven't been implemented yet for a particular architecture, these stubs reduce the amount of clutter under arch/. No functional change. Signed-off-by: Michael Kelley Link: https://lore.kernel.org/r/1626287687-2045-3-git-send-email-mikelley@microsoft.com Signed-off-by: Wei Liu (backported from commit 9d7cf2c9675838c12cd5cf5a4ebe2ba41bd78a44) Signed-off-by: Tim Gardner [rtg - minor context adjustment, added hv_is_isolation_supported() definition to include/asm-generic/mshyperv.h] --- arch/x86/hyperv/hv_init.c | 1 - arch/x86/kernel/cpu/mshyperv.c | 6 ----- drivers/hv/hv_common.c | 49 ++++++++++++++++++++++++++++++++++ include/asm-generic/mshyperv.h | 1 + 4 files changed, 50 insertions(+), 7 deletions(-) diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c index 08284bfca479..4924d8c03228 100644 --- a/arch/x86/hyperv/hv_init.c +++ b/arch/x86/hyperv/hv_init.c @@ -410,7 +410,6 @@ void hyperv_cleanup(void) hypercall_msr.as_uint64 = 0; wrmsrl(HV_X64_MSR_REFERENCE_TSC, hypercall_msr.as_uint64); } -EXPORT_SYMBOL_GPL(hyperv_cleanup); void hyperv_report_panic(struct pt_regs *regs, long err, bool in_die) { diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c index ea7091596d73..44891430ea1c 100644 --- a/arch/x86/kernel/cpu/mshyperv.c +++ b/arch/x86/kernel/cpu/mshyperv.c @@ -60,14 +60,12 @@ void hv_setup_vmbus_handler(void (*handler)(void)) { vmbus_handler = handler; } -EXPORT_SYMBOL_GPL(hv_setup_vmbus_handler); void hv_remove_vmbus_handler(void) { /* We have no way to deallocate the interrupt gate */ vmbus_handler = NULL; } -EXPORT_SYMBOL_GPL(hv_remove_vmbus_handler); /* * Routines to do per-architecture handling of stimer0 @@ -102,25 +100,21 @@ void hv_setup_kexec_handler(void (*handler)(void)) { hv_kexec_handler = handler; } -EXPORT_SYMBOL_GPL(hv_setup_kexec_handler); void hv_remove_kexec_handler(void) { hv_kexec_handler = NULL; } -EXPORT_SYMBOL_GPL(hv_remove_kexec_handler); void hv_setup_crash_handler(void (*handler)(struct pt_regs *regs)) { hv_crash_handler = handler; } -EXPORT_SYMBOL_GPL(hv_setup_crash_handler); void hv_remove_crash_handler(void) { hv_crash_handler = NULL; } -EXPORT_SYMBOL_GPL(hv_remove_crash_handler); #ifdef CONFIG_KEXEC_CORE static void hv_machine_shutdown(void) diff --git a/drivers/hv/hv_common.c b/drivers/hv/hv_common.c index caba4f728987..cac9c6bfc653 100644 --- a/drivers/hv/hv_common.c +++ b/drivers/hv/hv_common.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -202,3 +203,51 @@ bool hv_query_ext_cap(u64 cap_query) return hv_extended_cap & cap_query; } EXPORT_SYMBOL_GPL(hv_query_ext_cap); + +/* These __weak functions provide default "no-op" behavior and + * may be overridden by architecture specific versions. Architectures + * for which the default "no-op" behavior is sufficient can leave + * them unimplemented and not be cluttered with a bunch of stub + * functions in arch-specific code. + */ + +bool __weak hv_is_isolation_supported(void) +{ + return false; +} +EXPORT_SYMBOL_GPL(hv_is_isolation_supported); + +void __weak hv_setup_vmbus_handler(void (*handler)(void)) +{ +} +EXPORT_SYMBOL_GPL(hv_setup_vmbus_handler); + +void __weak hv_remove_vmbus_handler(void) +{ +} +EXPORT_SYMBOL_GPL(hv_remove_vmbus_handler); + +void __weak hv_setup_kexec_handler(void (*handler)(void)) +{ +} +EXPORT_SYMBOL_GPL(hv_setup_kexec_handler); + +void __weak hv_remove_kexec_handler(void) +{ +} +EXPORT_SYMBOL_GPL(hv_remove_kexec_handler); + +void __weak hv_setup_crash_handler(void (*handler)(struct pt_regs *regs)) +{ +} +EXPORT_SYMBOL_GPL(hv_setup_crash_handler); + +void __weak hv_remove_crash_handler(void) +{ +} +EXPORT_SYMBOL_GPL(hv_remove_crash_handler); + +void __weak hyperv_cleanup(void) +{ +} +EXPORT_SYMBOL_GPL(hyperv_cleanup); diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h index f5fd88eedaed..f34a7f7be4e9 100644 --- a/include/asm-generic/mshyperv.h +++ b/include/asm-generic/mshyperv.h @@ -231,6 +231,7 @@ static inline int cpumask_to_vpset(struct hv_vpset *vpset, void hyperv_report_panic(struct pt_regs *regs, long err, bool in_die); bool hv_is_hyperv_initialized(void); bool hv_is_hibernation_supported(void); +bool hv_is_isolation_supported(void); void hyperv_cleanup(void); bool hv_query_ext_cap(u64 cap_query); #else /* CONFIG_HYPERV */