From patchwork Wed Feb 27 19:19:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guilherme G. Piccoli" X-Patchwork-Id: 1049117 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com 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 ozlabs.org (Postfix) with ESMTPS id 448lr91KW6z9sCH; Thu, 28 Feb 2019 06:20:08 +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 1gz4kM-0005OE-EW; Wed, 27 Feb 2019 19:20:02 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1gz4kJ-0005Mq-IY for kernel-team@lists.ubuntu.com; Wed, 27 Feb 2019 19:19:59 +0000 Received: from mail-qk1-f199.google.com ([209.85.222.199]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1gz4kJ-0008It-8c for kernel-team@lists.ubuntu.com; Wed, 27 Feb 2019 19:19:59 +0000 Received: by mail-qk1-f199.google.com with SMTP id h6so13771483qke.18 for ; Wed, 27 Feb 2019 11:19:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2yH35kirFy4QlJE34yqqyEH3YP+HIs+gluHmOA0L3UM=; b=OB4/AtQlxLRgkqkAd6pu1jU3debXybevv8cTYhWCp4ZK3UcPle33hIor/tbQIJplMg NJjVRfhLkvyKKciroiyS/20vN/1bpmU8f2EGwrZ9oGh+L90spHFJaxO4I8TfiFEZVuDI GQPi4eO+hZyQXg4LH7JTRJ/K+jc0cYfjgTS5TJRgYkzbqrt2SkIQLbSOFLVH7Ycbx60Y jpQH3118QJA/F5xl4W8L3FhfL7KBVep69uR5ogV0lWs2k8rPmMu6jo4CqyrY8brQ8nDi QXx7Ku5TdW+4U2suptXmPlaUIt/aGQJjHrXk7eUizCAkT/8ql790RMiN4qV9L1MHKkP4 +TyQ== X-Gm-Message-State: APjAAAVJfdulRZzNvwlOssbuktE8ZHV1pOCy7hnaIaNB6MejLavKBBOP bUgctyxm0o1EWAJxYqbg04b3KlZ3aYcZER6KYNXXi/FfKfYL/dKIEpCjevOMXmJo5J4MPDKu/Ca stV7dCYSSRbQ/7aa3WHYFzHd7JxS+rwAkTtm2C9xMww== X-Received: by 2002:a37:715:: with SMTP id 21mr3526036qkh.141.1551295198159; Wed, 27 Feb 2019 11:19:58 -0800 (PST) X-Google-Smtp-Source: AHgI3IaTUAQCPEKRmliowNFhR54KpcfTrixuwvdjRXn+upeI30PmtXBWHLJUupVbbQEbqdkOG7Grkg== X-Received: by 2002:a37:715:: with SMTP id 21mr3526028qkh.141.1551295197984; Wed, 27 Feb 2019 11:19:57 -0800 (PST) Received: from localhost ([179.110.167.246]) by smtp.gmail.com with ESMTPSA id 132sm8650923qke.0.2019.02.27.11.19.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Feb 2019 11:19:57 -0800 (PST) From: "Guilherme G. Piccoli" To: kernel-team@lists.ubuntu.com Subject: [SRU X] [PATCH 1/2] KVM: x86: move nsec_to_cycles from x86.c to x86.h Date: Wed, 27 Feb 2019 16:19:49 -0300 Message-Id: <20190227191950.12074-2-gpiccoli@canonical.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190227191950.12074-1-gpiccoli@canonical.com> References: <20190227191950.12074-1-gpiccoli@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: , Cc: gpiccoli@canonical.com Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Marcelo Tosatti BugLink: https://bugs.launchpad.net/bugs/1817918 Move the inline function nsec_to_cycles from x86.c to x86.h, as the next patch uses it from lapic.c. Signed-off-by: Marcelo Tosatti Signed-off-by: Paolo Bonzini (backported from commit 8d93c874ac899bfdf0ad3787baef684a0c878c2c) [gpiccoli: context adjustment.] Signed-off-by: Guilherme G. Piccoli --- arch/x86/kvm/x86.c | 6 ------ arch/x86/kvm/x86.h | 8 ++++++++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index c6b7742510ce..254b0a40924a 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1320,12 +1320,6 @@ static atomic_t kvm_guest_has_master_clock = ATOMIC_INIT(0); static DEFINE_PER_CPU(unsigned long, cpu_tsc_khz); static unsigned long max_tsc_khz; -static inline u64 nsec_to_cycles(struct kvm_vcpu *vcpu, u64 nsec) -{ - return pvclock_scale_delta(nsec, vcpu->arch.virtual_tsc_mult, - vcpu->arch.virtual_tsc_shift); -} - static u32 adjust_tsc_khz(u32 khz, s32 ppm) { u64 v = (u64)khz * (1000000 + ppm); diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h index 53a750a10598..de5249b548bd 100644 --- a/arch/x86/kvm/x86.h +++ b/arch/x86/kvm/x86.h @@ -2,6 +2,7 @@ #define ARCH_X86_KVM_X86_H #include +#include #include "kvm_cache_regs.h" #define MSR_IA32_CR_PAT_DEFAULT 0x0007040600070406ULL @@ -192,4 +193,11 @@ extern unsigned int min_timer_period_us; extern unsigned int lapic_timer_advance_ns; extern struct static_key kvm_no_apic_vcpu; + +static inline u64 nsec_to_cycles(struct kvm_vcpu *vcpu, u64 nsec) +{ + return pvclock_scale_delta(nsec, vcpu->arch.virtual_tsc_mult, + vcpu->arch.virtual_tsc_shift); +} + #endif