Received: by 10.223.164.202 with SMTP id h10csp1295211wrb; Mon, 27 Nov 2017 00:13:42 -0800 (PST) X-Google-Smtp-Source: AGs4zMaU4q8FmYqN4QbKgIJ9DFJq2AfYweytAQKWW66kkoiNhB3CDo4uujM3s9db3ouOOlJ5FqS6 X-Received: by 10.98.21.17 with SMTP id 17mr35966751pfv.120.1511770422329; Mon, 27 Nov 2017 00:13:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511770422; cv=none; d=google.com; s=arc-20160816; b=fXvbHrmnmHjHxg48Q4CLCLyoBAR9GFd2KcHsJbbTx1M4uOBqBfat8IVPLDChoS8Y8s xASI1HTFY+IAU4gJ4J+VraBRrqKUMzZ0bmgcngM4rEOIf9VD5j3f1YyHqY4SsbmFWB66 xLLxy5ggBrE/xQ8+n0CJcRGh4O6i5/+DYmpQCp3LdejHYjW/s5N8sg17gaJ/LxthstDY l1YXkn0UK1uOlFmwGPXELH93tMAP2jm0JFXnPElTU9b6s8XGn9nnIsTechzBF0YUIvXi I4yiuArtrmnkjhXAI5eMGah1oaiZcQ54P3AsOk5/wBn0yiFV5Wl+8zxl0vQVPuFMRh4N s3vQ== 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:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=KZFgzURppHwStZLwpMo8T4PbC/PrUEM0rhOnJbylaoA=; b=GhazAeVqVsaxOWT2fH/DzlDmW5tW6GLfIfKMW2Myxs4btoYn81ftb1aEtsF1glKG2C bRQnueAHfmkqUbwAulOAoz5+mW7472HKWK+LHpMDuo+jMoZqk3jQWtF92Q9Ya9Lb1R/2 rxM6BGXhBrfK2QcXT/+Ngk8iaKsQP9FnmYh6LNlVbbcsKilPR9jgu6WdSoguub5MYnx1 pcSJ5Pwd74ggOfkIAH8eZxXr2j7F5oWYmcSxOza/idzga4RTxvJ3XqO3lbH4vs7fPLyn WEGrFtNMWCYo8mkwp26jf5SOL1xLVhiFccxkiv1YY3wAL+vOphBHXijpbq3ZF8wyMRI2 HD/w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x8si20595657plv.554.2017.11.27.00.13.30; Mon, 27 Nov 2017 00:13:42 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751467AbdK0IMJ (ORCPT + 78 others); Mon, 27 Nov 2017 03:12:09 -0500 Received: from david.siemens.de ([192.35.17.14]:44091 "EHLO david.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751311AbdK0IMH (ORCPT ); Mon, 27 Nov 2017 03:12:07 -0500 Received: from mail3.siemens.de (mail3.siemens.de [139.25.208.14]) by david.siemens.de (8.15.2/8.15.2) with ESMTPS id vAR8C0AR018869 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Nov 2017 09:12:00 +0100 Received: from md1f2u6c.ww002.siemens.net ([167.87.32.153]) by mail3.siemens.de (8.15.2/8.15.2) with ESMTP id vAR8BtEZ021016; Mon, 27 Nov 2017 09:11:59 +0100 From: Jan Kiszka To: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" Cc: x86@kernel.org, Linux Kernel Mailing List , jailhouse-dev@googlegroups.com Subject: [PATCH v2 07/12] x86/jailhouse: Set up timekeeping Date: Mon, 27 Nov 2017 09:11:49 +0100 Message-Id: X-Mailer: git-send-email 2.12.3 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jan Kiszka Get the precalibrated frequencies for the TSC and the APIC timer from the Jailhouse platform info and set the kernel values accordingly. Signed-off-by: Jan Kiszka --- arch/x86/kernel/jailhouse.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/arch/x86/kernel/jailhouse.c b/arch/x86/kernel/jailhouse.c index 267547162a2c..effec7d2b480 100644 --- a/arch/x86/kernel/jailhouse.c +++ b/arch/x86/kernel/jailhouse.c @@ -18,6 +18,7 @@ #include static __initdata struct jailhouse_setup_data setup_data; +static unsigned int precalibrated_tsc_khz; static uint32_t jailhouse_cpuid_base(void) { @@ -33,6 +34,16 @@ static uint32_t __init jailhouse_detect(void) return jailhouse_cpuid_base(); } +static void __init jailhouse_timer_init(void) +{ + lapic_timer_frequency = setup_data.apic_khz * (1000 / HZ); +} + +static unsigned long jailhouse_get_tsc(void) +{ + return precalibrated_tsc_khz; +} + static void __init jailhouse_get_smp_config(unsigned int early) { unsigned int cpu; @@ -68,8 +79,12 @@ static void __init jailhouse_init_platform(void) struct setup_data header; void *mapping; + x86_init.timers.timer_init = jailhouse_timer_init; x86_init.mpparse.get_smp_config = jailhouse_get_smp_config; + x86_platform.calibrate_cpu = jailhouse_get_tsc; + x86_platform.calibrate_tsc = jailhouse_get_tsc; + while (pa_data) { mapping = early_memremap(pa_data, sizeof(header)); memcpy(&header, mapping, sizeof(header)); @@ -97,6 +112,8 @@ static void __init jailhouse_init_platform(void) pmtmr_ioport = setup_data.pm_timer_address; pr_debug("Jailhouse: PM-Timer IO Port: %#x\n", pmtmr_ioport); + + precalibrated_tsc_khz = setup_data.tsc_khz; } bool jailhouse_paravirt(void) -- 2.12.3 From 1585262596344296996@xxx Mon Nov 27 23:10:22 +0000 2017 X-GM-THRID: 1585262596344296996 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread