From patchwork Fri Feb 3 03:41:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li RongQing X-Patchwork-Id: 13126948 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0E36C636CC for ; Fri, 3 Feb 2023 03:41:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230454AbjBCDlx (ORCPT ); Thu, 2 Feb 2023 22:41:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229575AbjBCDlx (ORCPT ); Thu, 2 Feb 2023 22:41:53 -0500 Received: from njjs-sys-mailin01.njjs.baidu.com (mx316.baidu.com [180.101.52.236]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0BCABEF94 for ; Thu, 2 Feb 2023 19:41:52 -0800 (PST) Received: from localhost (bjhw-sys-rpm015653cc5.bjhw.baidu.com [10.227.53.39]) by njjs-sys-mailin01.njjs.baidu.com (Postfix) with ESMTP id 6A5407F00047; Fri, 3 Feb 2023 11:41:50 +0800 (CST) From: lirongqing@baidu.com To: kvm@vger.kernel.org, x86@kernel.org Subject: [PATCH] KVM: x86: Enable PIT shutdown quirk Date: Fri, 3 Feb 2023 11:41:50 +0800 Message-Id: <1675395710-37220-1-git-send-email-lirongqing@baidu.com> X-Mailer: git-send-email 1.7.1 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Li RongQing KVM emulation of the PIT has a quirk such that the normal PIT shutdown path doesn't work, because clearing the counter register restarts the timer. Disable the counter clearing on PIT shutdown as in Hyper-V Signed-off-by: Li RongQing --- arch/x86/kernel/kvm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index 1cceac5..14411b6 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c @@ -43,6 +43,7 @@ #include #include #include +#include DEFINE_STATIC_KEY_FALSE(kvm_async_pf_enabled); @@ -978,6 +979,9 @@ static void __init kvm_init_platform(void) wrmsrl(MSR_KVM_MIGRATION_CONTROL, KVM_MIGRATION_READY); } + + i8253_clear_counter_on_shutdown = false; + kvmclock_init(); x86_platform.apic_post_init = kvm_apic_init; }