Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752006AbdJYWfA (ORCPT ); Wed, 25 Oct 2017 18:35:00 -0400 Received: from a2nlsmtp01-03.prod.iad2.secureserver.net ([198.71.225.37]:55442 "EHLO a2nlsmtp01-03.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751753AbdJYWe6 (ORCPT ); Wed, 25 Oct 2017 18:34:58 -0400 x-originating-ip: 107.180.71.197 From: mikelley@exchange.microsoft.com To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, vkuznets@redhat.com, jasowang@redhat.com, leann.ogasawara@canonical.com, marcelo.cerri@canonical.com, sthemmin@microsoft.com, kys@microsoft.com Cc: Michael Kelley Subject: [PATCH char-misc 1/1] Hyper-V: Remove x86-isms from architecture independent Hyper-V drivers Date: Wed, 25 Oct 2017 15:31:25 -0700 Message-Id: <20171025223125.28066-1-mikelley@exchange.microsoft.com> X-Mailer: git-send-email 2.14.1 Reply-To: mikelley@microsoft.com X-CMAE-Envelope: MS4wfNR6F8E4pEBTVb+BaS5R9AsDzkhdQvciK9bIR9CVQFPLrlXf8fPm2YHb0O18eAA0VaYifyybko/S1ShzPU1lVa5QYZ0zw5dW8eqFABb8iw1ZR0gQ9NfG d1HuXYsVpDbc6rwIWhqJgN6wVQbPdEjdkSnWV4K8s4m9mDenN55vKpo5C9Q32eStXlNlHnI501y/jVRE7y/H3sSHvq99p1qcKoAf9CTynyPMFEaU2sIP0ndI aaLt1WSI60Ua7ZHPMUMgjz1FN+XSRt6D2C5acCOrOxAueMpgGClKWaRAEQ0xGQMXTjYRZhdkpxXSzn1K+s+cT9db9WEXJNk0yspXPTcYYuuKhJv9kIfpDJhw u8f+BrASYlSIZL7N9NSvwbLC+YPOdre8rjwkS/HYXNADpOiya9Kk3PsCG/fdkTF8bpJtbAannqI972MQtoqI6QaKlUmHj3qFHK+jQjOlhcNwrZsB1vF10J2q Nc5BvR1Y2UGwZfuHtp57gNU1bCQMZC7En6YYXd1UTN0dqCD/45ycRUz+XIyg8W2U8bTMNhqoATpoRnMjm4SobvKftm3OcnjFkrSS4g== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Kelley hv_is_hypercall_page_setup() is used to check if Hyper-V is initialized, but a 'hypercall page' is an x86 implementation detail that isn't necessarily present on other architectures. Rename to the architecture independent hv_is_hyperv_initialized(). Use this function instead of direct references to x86-specific data structures in vmbus_drv.c, and remove 'x86' from the string name passed to cpuhp_setup_state(). Signed-off-by: Michael Kelley --- arch/x86/hyperv/hv_init.c | 4 ++-- arch/x86/include/asm/mshyperv.h | 4 ++-- drivers/hv/hv.c | 2 +- drivers/hv/vmbus_drv.c | 5 ++--- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c index a5db63f728a2..38310bd091c2 100644 --- a/arch/x86/hyperv/hv_init.c +++ b/arch/x86/hyperv/hv_init.c @@ -236,7 +236,7 @@ void hyperv_report_panic(struct pt_regs *regs) } EXPORT_SYMBOL_GPL(hyperv_report_panic); -bool hv_is_hypercall_page_setup(void) +bool hv_is_hyperv_initialized(void) { union hv_x64_msr_hypercall_contents hypercall_msr; @@ -249,4 +249,4 @@ bool hv_is_hypercall_page_setup(void) return true; } -EXPORT_SYMBOL_GPL(hv_is_hypercall_page_setup); +EXPORT_SYMBOL_GPL(hv_is_hyperv_initialized); diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h index 530f448fddaf..b001f898ccf3 100644 --- a/arch/x86/include/asm/mshyperv.h +++ b/arch/x86/include/asm/mshyperv.h @@ -311,11 +311,11 @@ void hyperv_init(void); void hyperv_setup_mmu_ops(void); void hyper_alloc_mmu(void); void hyperv_report_panic(struct pt_regs *regs); -bool hv_is_hypercall_page_setup(void); +bool hv_is_hyperv_initialized(void); void hyperv_cleanup(void); #else /* CONFIG_HYPERV */ static inline void hyperv_init(void) {} -static inline bool hv_is_hypercall_page_setup(void) { return false; } +static inline bool hv_is_hyperv_initialized(void) { return false; } static inline void hyperv_cleanup(void) {} static inline void hyperv_setup_mmu_ops(void) {} #endif /* CONFIG_HYPERV */ diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c index 8267439dd1ee..ebad26053362 100644 --- a/drivers/hv/hv.c +++ b/drivers/hv/hv.c @@ -49,7 +49,7 @@ struct hv_context hv_context = { */ int hv_init(void) { - if (!hv_is_hypercall_page_setup()) + if (!hv_is_hyperv_initialized()) return -ENOTSUPP; hv_context.cpu_context = alloc_percpu(struct hv_per_cpu_context); diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 1da8e818f4de..12c51dc6bb7b 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -37,7 +37,6 @@ #include #include -#include #include #include #include @@ -1047,7 +1046,7 @@ static int vmbus_bus_init(void) * Initialize the per-cpu interrupt state and * connect to the host. */ - ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "x86/hyperv:online", + ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "hyperv/vmbus:online", hv_synic_init, hv_synic_cleanup); if (ret < 0) goto err_alloc; @@ -1695,7 +1694,7 @@ static int __init hv_acpi_init(void) { int ret, t; - if (x86_hyper != &x86_hyper_ms_hyperv) + if (!hv_is_hyperv_initialized()) return -ENODEV; init_completion(&probe_event); -- 2.14.1