From patchwork Tue Sep 6 22:29:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 9318013 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C1B0360869 for ; Tue, 6 Sep 2016 22:30:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A361B28F01 for ; Tue, 6 Sep 2016 22:30:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 98E2B28F0E; Tue, 6 Sep 2016 22:30:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A04D28F09 for ; Tue, 6 Sep 2016 22:30:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934861AbcIFWaJ (ORCPT ); Tue, 6 Sep 2016 18:30:09 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33479 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934049AbcIFWaG (ORCPT ); Tue, 6 Sep 2016 18:30:06 -0400 Received: by mail-wm0-f68.google.com with SMTP id w207so69952wmw.0; Tue, 06 Sep 2016 15:30:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=E6Hb8LIZ+rnuY5OpNBk1rJ8MzSZFbqYxNHtDxal/wks=; b=lyIQME2qYQPbZUoy+TXXx/2FYS2PXsn5DR94/qFPawTPyhPfPhH70NXXdEPiPoi7fH zPduutPirmlzhL1X53Aksz1Y/N8vHkYjFkQHgiwxUeIKwZZUWOiov/8VkAhBoYxDgoKK Ggji35wqCHZagSe4ceuKyNOnmIf6YX8yhcDtHwKJsILAnm10ENLsbRQ7/jyooa0qTh8K GqYpy6Y4BdloJeE5llU+P85Aj+T4mcyE7n5Ph9jlQAucyaTQxTTGGB7jqy/9uoF0EzO1 IOxR5i7xzWiwiUDDAUvthgiCdFFY0h5e8kcdkUt2ZbZF6ntkKWkv3ote+yObuzV8CApw YfqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=E6Hb8LIZ+rnuY5OpNBk1rJ8MzSZFbqYxNHtDxal/wks=; b=fITzlixvraBaTw9nI3pIWP86bFsLuNMcj1LHo9eMU15CBhK+aQglaLFJ673NDWkbJ7 wtRK4GtjU+6dgwEakkiWVLVSgFm3W5yVPUhcKdcZ/e8Repgr4+FPOk6wcwtHl2wJGN/Q 81Ogp9m8aWkNkgNsv/U0I8/9PDcSw7x8WfhzI8kWtBlC5nuwVMqvXrmCoCDlf/959Jbo 1YA9/tb0+9kR3/IhcvMPwsPJrqpm8f5gscWh0OHeBiBQ42VxKcYFjaV8LBZhOjeUR6Kx yOg6+mz+Peu76DdJvbFl1YBMAti9CElyoAqJtXTKHMTLUcwesgLM9M/p+Gtd/uTvYGvQ YrbA== X-Gm-Message-State: AE9vXwMDI8D8u3E8sCtcXcD2uOVrWTMXRsz66XvSiqvAGgqPbP1W3TVe0L8Qdu9qqIMGhQ== X-Received: by 10.28.230.19 with SMTP id d19mr690865wmh.111.1473201004010; Tue, 06 Sep 2016 15:30:04 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-240-23.clienti.tiscali.it. [78.12.240.23]) by smtp.gmail.com with ESMTPSA id x6sm35438942wjk.26.2016.09.06.15.30.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Sep 2016 15:30:03 -0700 (PDT) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: rkrcmar@redhat.com, dmatlack@google.com, luto@kernel.org, peterhornyack@google.com, x86@kernel.org Subject: [PATCH 1/2] x86: paravirt: add local_apic_timer_interrupt to pv_ops Date: Wed, 7 Sep 2016 00:29:58 +0200 Message-Id: <1473200999-123004-2-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1473200999-123004-1-git-send-email-pbonzini@redhat.com> References: <1473200999-123004-1-git-send-email-pbonzini@redhat.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP local_apic_timer_interrupt refers to a static clockevent in apic.c. Paravirtualized implementations need to check a different clockevent, so allow customizing the guts of the APIC timer interrupt. Signed-off-by: Paolo Bonzini --- arch/x86/include/asm/apic.h | 1 + arch/x86/include/asm/paravirt.h | 5 +++++ arch/x86/include/asm/paravirt_types.h | 1 + arch/x86/kernel/apic/apic.c | 2 +- arch/x86/kernel/paravirt.c | 1 + 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index 124357773ffa..f6e0bad1cde2 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h @@ -109,6 +109,7 @@ extern void native_apic_wait_icr_idle(void); extern u32 native_safe_apic_wait_icr_idle(void); extern void native_apic_icr_write(u32 low, u32 id); extern u64 native_apic_icr_read(void); +extern void native_local_apic_timer_interrupt(void); static inline bool apic_is_x2apic_enabled(void) { diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h index 2970d22d7766..71ec3a73745f 100644 --- a/arch/x86/include/asm/paravirt.h +++ b/arch/x86/include/asm/paravirt.h @@ -197,6 +197,11 @@ static inline u64 paravirt_steal_clock(int cpu) return PVOP_CALL1(u64, pv_time_ops.steal_clock, cpu); } +static inline void local_apic_timer_interrupt(void) +{ + PVOP_VCALL0(pv_time_ops.local_apic_timer_interrupt); +} + static inline unsigned long long paravirt_read_pmc(int counter) { return PVOP_CALL1(u64, pv_cpu_ops.read_pmc, counter); diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h index 7fa9e7740ba3..ea1f27400098 100644 --- a/arch/x86/include/asm/paravirt_types.h +++ b/arch/x86/include/asm/paravirt_types.h @@ -96,6 +96,7 @@ struct pv_lazy_ops { struct pv_time_ops { unsigned long long (*sched_clock)(void); unsigned long long (*steal_clock)(int cpu); + void (*local_apic_timer_interrupt)(void); }; struct pv_cpu_ops { diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index cea4fc19e844..5b63bec7d0af 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -902,7 +902,7 @@ void setup_secondary_APIC_clock(void) /* * The guts of the apic timer interrupt */ -static void local_apic_timer_interrupt(void) +void native_local_apic_timer_interrupt(void) { int cpu = smp_processor_id(); struct clock_event_device *evt = &per_cpu(lapic_events, cpu); diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c index ad5bc9578a73..0e056271d714 100644 --- a/arch/x86/kernel/paravirt.c +++ b/arch/x86/kernel/paravirt.c @@ -310,6 +310,7 @@ struct pv_init_ops pv_init_ops = { struct pv_time_ops pv_time_ops = { .sched_clock = native_sched_clock, .steal_clock = native_steal_clock, + .local_apic_timer_interrupt = native_local_apic_timer_interrupt, }; __visible struct pv_irq_ops pv_irq_ops = {