Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp19868910rwd; Wed, 28 Jun 2023 15:53:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6cxkBPI6Ri4Pb6nodd0K7VstI21Yx2SpHM1MdQr0MLNz/Vb8fyd+HC9qNM18PxPfI8SHkU X-Received: by 2002:a17:90a:43e5:b0:25e:d013:c22c with SMTP id r92-20020a17090a43e500b0025ed013c22cmr22006677pjg.47.1687992837549; Wed, 28 Jun 2023 15:53:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687992837; cv=none; d=google.com; s=arc-20160816; b=DrWuDPxzGhX9zzxyvIPbsqYRSX2SKd34XN2S6jucN+ZVn1WEzGlf5qKj7AQ6o7JCkY U/9vlr35h/WitMQe+cqjtMjmZtpOgLCLKFR2cMeqgD0XhFp+2A9c7uGsRtqT6ygxrjNJ pPWRfUKQopsV51vBmAdFRFVyD0HEcazbGyTVLzopXL0eD1zPtGC8Bl2yKvCPlq3t7dNB s4pWsoMNcqeRD4X/7Xx/JGmYRegEiENuVaQY7r4B7FqX5BqMAwK0w5sioGqqpnIlp3MO 9422F2K2TRAvpg8lWM86Amkf3YFLUOLXzYsV7rZLI6b0CidobsVCXtewLn2QngMNQles jtJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Qvpp3ICAHqpAtvu9qMq/H7a8lclFrzVSXLXCBz6MzoM=; fh=CPpRkOwF9GTwy0wtS3lMI/VOqqhYg/hdxkBimukKAqo=; b=wViC9snj7iOusxo1wJflfG9gVWNnD1Y/7xJJFOHa/vWmWz6PxHkwqQu199tB6hdNtS Z/urqjdqD79r4W3lV3Vm3aTLPhyfK2/P0i6dHeDBelKOJyISV2wzaT8Q0TLEtjAWGoXO EniHN6LJ/RJI1zQ1rCPGWK/tnJDPve5XUMaLsuJ60QM/cTPZFJRBBu4eC9WP0au2/qIr wBygpXYihogqG1VBZXDyLhGYjwBBUtJusQTBiFtMy/1QeqhdkRdvx75NDH0qi7hdkDyp ns2lv0FOnY8bh8phOIYZAF0RjOklxPRQv813UFSsYmxQ6AdN1VXYi3JBoM7BDJOqxNJf p0OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=demIm3U0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j3-20020a17090ac48300b00252d84b7af0si9537981pjt.181.2023.06.28.15.53.43; Wed, 28 Jun 2023 15:53:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=demIm3U0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231668AbjF1Wnt (ORCPT + 99 others); Wed, 28 Jun 2023 18:43:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231422AbjF1WnW (ORCPT ); Wed, 28 Jun 2023 18:43:22 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDE841715; Wed, 28 Jun 2023 15:43:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687992200; x=1719528200; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=x+1cfc/xmoFxBnLLgTcKrep1dUoeoXKUxnolji14RNc=; b=demIm3U0Dy3KSwiOehDB1LWzsy0oKoA6oT37rK1wTuFRYalpd3HJGnip UtYR1Zqr+QlIsDirgbARaPBFU1acRu3Iqw5aD5cmH1/W7G/h3jnzyN9vG K6vVbwrKbzIae+O7dA4zWTiv516eaHCeqQcWxHEjZT3C374iSOZCzQlN7 SGfoOpaYNaOnZfkRdZlWb6qD0kYlYu8yPOAtZ0y4HjHWvUlTQzmo62hgx TudevnR1DlXD3WrOguya8EfZ9VPLOUBJWdpsdQ+Rg66ofsN5YbdBwSHqU chEfgWS4sJ1424bYreUruKQTbYC+fZ1xyu/MxTi80FeAwVlu6+RDRZf6B Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10755"; a="392699110" X-IronPort-AV: E=Sophos;i="6.01,166,1684825200"; d="scan'208";a="392699110" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jun 2023 15:43:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10755"; a="830299976" X-IronPort-AV: E=Sophos;i="6.01,166,1684825200"; d="scan'208";a="830299976" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jun 2023 15:43:19 -0700 From: isaku.yamahata@intel.com To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: isaku.yamahata@intel.com, isaku.yamahata@gmail.com, Paolo Bonzini , erdemaktas@google.com, Sean Christopherson , Sagi Shahar , David Matlack , Kai Huang , Zhi Wang , chen.bo@intel.com, linux-coco@lists.linux.dev, Chao Peng , Ackerley Tng , Vishal Annapurve , Michael Roth , Yuan Yao Subject: [RFC PATCH v3 00/11] KVM: guest memory: Misc enhacnement Date: Wed, 28 Jun 2023 15:42:59 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Isaku Yamahata Hello. I've updated the patch series based on the feedback. Here are the discussion points. - 06/11 KVM: x86: Introduce PFERR_GUEST_ENC_MASK to indicate fault is private Michael has his own opinion on how to indicate private fault. - 09/11 KVM: Add new members to struct kvm_gfn_range to operate on - 10/11 KVM: x86: Add gmem hook for initializing private memory SNP needs the callback. TDX won't use this one. - 11/11 KVM: x86: Add gmem hook for invalidating private memory SNP needs the callback. TDX doesn't use this one at the moment, but would use it. - VM type: I didn't rename KVM_X86_PROTECTED_VM to KVM_X86_SW_PROTECTED_VM in this patch series. It's easy to rename it if desired. Thanks, This is an RFC patch series based on KVM gmem [1] and [2] for the common use of TDX and SEV-SNP. [1] KVM gmem patches https://github.com/sean-jc/linux/tree/x86/kvm_gmem_solo [2] Add AMD Secure Nested Paging (SEV-SNP) Hypervisor Support https://lore.kernel.org/lkml/20230612042559.375660-1-michael.roth@amd.com/ --- v3: - Imported common patches from Michael Roth which can be useful for both SNP and TDX. And reorder patches. - Update struct kvm_gfn_range to drop flag, and add add only_private, and only_shared - Update kvm_arch_set_memory_attributes() and added a x86 vendor callback for it. v2: https://lore.kernel.org/all/cover.1687474039.git.isaku.yamahata@intel.com/ v1: https://lore.kernel.org/all/cover.1686858861.git.isaku.yamahata@intel.com/ Brijesh Singh (1): KVM: x86: Export the kvm_zap_gfn_range() for the SNP use Isaku Yamahata (8): KVM: selftests: Fix test_add_overlapping_private_memory_regions() KVM: selftests: Fix guest_memfd() KVM: selftests: x86: typo in private_mem_conversions_test.c KVM: x86: Add is_vm_type_supported callback KVM: x86/mmu: Pass around full 64-bit error code for the KVM page fault KVM: x86: Introduce PFERR_GUEST_ENC_MASK to indicate fault is private KVM: Fix set_mem_attr ioctl when error case KVM: Add new members to struct kvm_gfn_range to operate on Michael Roth (2): KVM: x86: Add gmem hook for initializing private memory KVM: x86: Add gmem hook for invalidating private memory arch/x86/include/asm/kvm-x86-ops.h | 4 ++ arch/x86/include/asm/kvm_host.h | 12 +++++ arch/x86/include/uapi/asm/kvm.h | 1 + arch/x86/kvm/mmu.h | 2 - arch/x86/kvm/mmu/mmu.c | 51 ++++++++++++++----- arch/x86/kvm/mmu/mmu_internal.h | 20 ++++++-- arch/x86/kvm/mmu/mmutrace.h | 2 +- arch/x86/kvm/mmu/paging_tmpl.h | 2 +- arch/x86/kvm/svm/svm.c | 7 +++ arch/x86/kvm/vmx/vmx.c | 6 +++ arch/x86/kvm/x86.c | 16 +++++- arch/x86/kvm/x86.h | 2 + include/linux/kvm_host.h | 16 ++++-- .../testing/selftests/kvm/guest_memfd_test.c | 4 +- .../selftests/kvm/set_memory_region_test.c | 16 +++++- .../kvm/x86_64/private_mem_conversions_test.c | 2 +- virt/kvm/guest_mem.c | 50 +++++++++++++++++- virt/kvm/kvm_main.c | 24 +++++---- 18 files changed, 192 insertions(+), 45 deletions(-) base-commit: be8abcec83c87d4e15ae04816b685fe260c4bcfd -- 2.25.1