Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp8967imm; Tue, 17 Jul 2018 19:26:18 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeCoA2GuIbIhRR6h1bWVRgPFcCU7lfksKVZUUWEg+YsbLcmv51jKOcfCNRE66BcxBPcLlQ2 X-Received: by 2002:a17:902:8f96:: with SMTP id z22-v6mr4012303plo.190.1531880778477; Tue, 17 Jul 2018 19:26:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531880778; cv=none; d=google.com; s=arc-20160816; b=bvbx2d+35jHPPyQVLKAxT2F20Lo/rEyS7OobZkq7rYavy4mvC4Dp5FjjTxT1cHh7I4 getjbvyTl7qBf7NSrM060VBYIpgnaVKfdWkjjgfjySPrg+YaXbhQsqYg79pee3bBnnv/ EUucx5UXaNwpke/KyMPyYFsVSQbN8nP+wxoMTA6t/UxS7SZkbcU24tvyVOxsF4hZ5FRs IRzFWrSV3CGZSDrvufaKfk0Ff2s8fdsRaX8i02POfUAgwza3mcOGdpwg5yRR60UgRbyd yNBZVQgDUT1RqNVxUJDk1+WvklKpHaJS/JXSRrN7kyUaKVqpztqMobrx5JmtdsS5zA5o 4dZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:arc-authentication-results; bh=HrI13El2AtYGFL9hjq2GqC4989/C5RtLOAFVm8r8nOY=; b=QpeV+Cx29byJseKbN/J0j0Zbd5cRlk2FUjMCAjzoUdF5CG7hb1KOFLq4yYvN1ALIf5 lexQ6apjf2CR0VoyzeNkMOXgCkoPRtll2zaWRpmxR9oykvFyITD8ET4evFbKF3uiF7Ru nGJhpuk1xq2xq+rzx8D/dxOfnwuTQpwe7nbEUciTabBRnsFjkjzNRrzmUKxQtRqZtUj1 rfSkfbHO2ugti5wYN5xAP+iZiEH7fQzJKv2N7JWcE/UkMypwh7oA8LdZI20QhbGh+QLw zyKrHSQZXLaAgNqZ6Hn3dpV6CJr0Rr/Fg2Glaklu+ZygAodwcaleZSy+YgphRN2ZPndS QlHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=zS9vN5LB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y191-v6si2361743pfg.246.2018.07.17.19.26.03; Tue, 17 Jul 2018 19:26:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=zS9vN5LB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732028AbeGRDA3 (ORCPT + 99 others); Tue, 17 Jul 2018 23:00:29 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:45084 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731893AbeGRC7n (ORCPT ); Tue, 17 Jul 2018 22:59:43 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w6I2Jtr8001052; Wed, 18 Jul 2018 02:22:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=HrI13El2AtYGFL9hjq2GqC4989/C5RtLOAFVm8r8nOY=; b=zS9vN5LBz62xGmbTscYLBJHMgVize0LCLOxNxBbTF4WEG0kcbYuvTbf4UdkHghMu7pae gO4em74tgPsJeG7/80rtyotw1/qyhtP9d35yNg9e5rTEWgz9t9P2Vbgc72CVzPyDwuCW jLUZd/Ec5UQNoaeqcuxPeNP475jT4KRJbrjSC1wzd4ofclPLE2hjK8g/JMtms5/AUizQ JbOkxi+eGHAtGjaYkEVMUAbofT3BP41fEYY3VlLNujJXNv1FuDBEAAelKY2Wv+azHZFe +G470FTqlSsh1xsXkmTJmWTddlXTCoWy+kE9CEqTLrlUZPHkVkKSaT9R56J9aKFSCbAi Mg== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2k7a3t34cy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Jul 2018 02:22:36 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w6I2MZjt027614 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Jul 2018 02:22:35 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w6I2MYNc013474; Wed, 18 Jul 2018 02:22:34 GMT Received: from localhost.localdomain (/73.69.118.222) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 17 Jul 2018 19:22:33 -0700 From: Pavel Tatashin To: steven.sistare@oracle.com, daniel.m.jordan@oracle.com, linux@armlinux.org.uk, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, john.stultz@linaro.org, sboyd@codeaurora.org, x86@kernel.org, linux-kernel@vger.kernel.org, mingo@redhat.com, tglx@linutronix.de, hpa@zytor.com, douly.fnst@cn.fujitsu.com, peterz@infradead.org, prarit@redhat.com, feng.tang@intel.com, pmladek@suse.com, gnomes@lxorguk.ukuu.org.uk, linux-s390@vger.kernel.org, pasha.tatashin@oracle.com, boris.ostrovsky@oracle.com, jgross@suse.com, pbonzini@redhat.com Subject: [PATCH v14 06/25] x86/kvmclock: Move kvmclock vsyscall param and init to kvmclock Date: Tue, 17 Jul 2018 22:21:52 -0400 Message-Id: <20180718022211.6259-7-pasha.tatashin@oracle.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180718022211.6259-1-pasha.tatashin@oracle.com> References: <20180718022211.6259-1-pasha.tatashin@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8957 signatures=668706 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807180026 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Gleixner There is no point to have this in the kvm code itself and call it from there. This can be called from an initcall and the parameter is cleared when the hypervisor is not KVM. Signed-off-by: Thomas Gleixner Signed-off-by: Pavel Tatashin Acked-by: Paolo Bonzini --- arch/x86/include/asm/kvm_guest.h | 7 ----- arch/x86/kernel/kvm.c | 13 --------- arch/x86/kernel/kvmclock.c | 46 +++++++++++++++++++------------- 3 files changed, 28 insertions(+), 38 deletions(-) delete mode 100644 arch/x86/include/asm/kvm_guest.h diff --git a/arch/x86/include/asm/kvm_guest.h b/arch/x86/include/asm/kvm_guest.h deleted file mode 100644 index 46185263d9c2..000000000000 --- a/arch/x86/include/asm/kvm_guest.h +++ /dev/null @@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_X86_KVM_GUEST_H -#define _ASM_X86_KVM_GUEST_H - -int kvm_setup_vsyscall_timeinfo(void); - -#endif /* _ASM_X86_KVM_GUEST_H */ diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index c65c232d3ddd..a560750cc76f 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c @@ -45,7 +45,6 @@ #include #include #include -#include static int kvmapf = 1; @@ -66,15 +65,6 @@ static int __init parse_no_stealacc(char *arg) early_param("no-steal-acc", parse_no_stealacc); -static int kvmclock_vsyscall = 1; -static int __init parse_no_kvmclock_vsyscall(char *arg) -{ - kvmclock_vsyscall = 0; - return 0; -} - -early_param("no-kvmclock-vsyscall", parse_no_kvmclock_vsyscall); - static DEFINE_PER_CPU_DECRYPTED(struct kvm_vcpu_pv_apf_data, apf_reason) __aligned(64); static DEFINE_PER_CPU_DECRYPTED(struct kvm_steal_time, steal_time) __aligned(64); static int has_steal_clock = 0; @@ -560,9 +550,6 @@ static void __init kvm_guest_init(void) if (kvm_para_has_feature(KVM_FEATURE_PV_EOI)) apic_set_eoi_write(kvm_guest_apic_eoi_write); - if (kvmclock_vsyscall) - kvm_setup_vsyscall_timeinfo(); - #ifdef CONFIG_SMP smp_ops.smp_prepare_cpus = kvm_smp_prepare_cpus; smp_ops.smp_prepare_boot_cpu = kvm_smp_prepare_boot_cpu; diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index f312d7f6de57..08e7726a5e62 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c @@ -27,12 +27,14 @@ #include #include +#include #include #include #include #include static int kvmclock __initdata = 1; +static int kvmclock_vsyscall __initdata = 1; static int msr_kvm_system_time __ro_after_init = MSR_KVM_SYSTEM_TIME; static int msr_kvm_wall_clock __ro_after_init = MSR_KVM_WALL_CLOCK; static u64 kvm_sched_clock_offset __ro_after_init; @@ -44,6 +46,13 @@ static int __init parse_no_kvmclock(char *arg) } early_param("no-kvmclock", parse_no_kvmclock); +static int __init parse_no_kvmclock_vsyscall(char *arg) +{ + kvmclock_vsyscall = 0; + return 0; +} +early_param("no-kvmclock-vsyscall", parse_no_kvmclock_vsyscall); + /* Aligned to page sizes to match whats mapped via vsyscalls to userspace */ #define HV_CLOCK_SIZE (sizeof(struct pvclock_vsyscall_time_info) * NR_CPUS) @@ -227,6 +236,25 @@ static void kvm_shutdown(void) native_machine_shutdown(); } +static int __init kvm_setup_vsyscall_timeinfo(void) +{ +#ifdef CONFIG_X86_64 + u8 flags; + + if (!hv_clock || !kvmclock_vsyscall) + return 0; + + flags = pvclock_read_flags(&hv_clock[0].pvti); + if (!(flags & PVCLOCK_TSC_STABLE_BIT)) + return 1; + + pvclock_set_pvti_cpu0_va(hv_clock); + kvm_clock.archdata.vclock_mode = VCLOCK_PVCLOCK; +#endif + return 0; +} +early_initcall(kvm_setup_vsyscall_timeinfo); + void __init kvmclock_init(void) { u8 flags; @@ -270,21 +298,3 @@ void __init kvmclock_init(void) clocksource_register_hz(&kvm_clock, NSEC_PER_SEC); pv_info.name = "KVM"; } - -int __init kvm_setup_vsyscall_timeinfo(void) -{ -#ifdef CONFIG_X86_64 - u8 flags; - - if (!hv_clock) - return 0; - - flags = pvclock_read_flags(&hv_clock[0].pvti); - if (!(flags & PVCLOCK_TSC_STABLE_BIT)) - return 1; - - pvclock_set_pvti_cpu0_va(hv_clock); - kvm_clock.archdata.vclock_mode = VCLOCK_PVCLOCK; -#endif - return 0; -} -- 2.18.0