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 4D0E2C433EF for ; Thu, 25 Nov 2021 00:25:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353556AbhKYA2J (ORCPT ); Wed, 24 Nov 2021 19:28:09 -0500 Received: from mga14.intel.com ([192.55.52.115]:6408 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352808AbhKYAYU (ORCPT ); Wed, 24 Nov 2021 19:24:20 -0500 X-IronPort-AV: E=McAfee;i="6200,9189,10178"; a="235649686" X-IronPort-AV: E=Sophos;i="5.87,261,1631602800"; d="scan'208";a="235649686" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2021 16:21:09 -0800 X-IronPort-AV: E=Sophos;i="5.87,261,1631602800"; d="scan'208";a="675042171" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2021 16:21:09 -0800 From: isaku.yamahata@intel.com To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , erdemaktas@google.com, Connor Kuehl , Sean Christopherson , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: isaku.yamahata@intel.com, isaku.yamahata@gmail.com, Sean Christopherson , Kai Huang Subject: [RFC PATCH v3 20/59] KVM: Add per-VM flag to disable dirty logging of memslots for TDs Date: Wed, 24 Nov 2021 16:20:03 -0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Christopherson Add a flag for TDX to mark dirty logging as unsupported. Suggested-by: Kai Huang Signed-off-by: Sean Christopherson Signed-off-by: Isaku Yamahata --- include/linux/kvm_host.h | 1 + virt/kvm/kvm_main.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index d59debe99212..08284807d48e 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -624,6 +624,7 @@ struct kvm { struct notifier_block pm_notifier; #endif char stats_id[KVM_STATS_NAME_SIZE]; + bool dirty_log_unsupported; #ifdef __KVM_HAVE_READONLY_MEM bool readonly_mem_unsupported; #endif diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index aaa6d69265ea..5bf456734e7d 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1425,7 +1425,10 @@ static void update_memslots(struct kvm_memslots *slots, static int check_memory_region_flags(struct kvm *kvm, const struct kvm_userspace_memory_region *mem) { - u32 valid_flags = KVM_MEM_LOG_DIRTY_PAGES; + u32 valid_flags = 0; + + if (!kvm->dirty_log_unsupported) + valid_flags |= KVM_MEM_LOG_DIRTY_PAGES; #ifdef __KVM_HAVE_READONLY_MEM if (!kvm->readonly_mem_unsupported) -- 2.25.1