Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp173126rwd; Tue, 30 May 2023 18:14:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6/glR3wm96aymp5yO7TfDTZrYgpvZf5dzhAnlR2l7ionbqIQUtdTyUoRov0ILM/hbOjAQs X-Received: by 2002:a17:90b:30c3:b0:255:3ca1:d620 with SMTP id hi3-20020a17090b30c300b002553ca1d620mr3992278pjb.29.1685495685493; Tue, 30 May 2023 18:14:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685495685; cv=none; d=google.com; s=arc-20160816; b=KHaYu6gBtg9ldJ2appd0KzSVu6OLf0AzNpCMeeke0omAXzAldmImNS5I8OmXcyC/Cq axNp5bU32OqqQ/C5bRz1FGNMG5jcpgWKGJRljLxi+1u0g+8IVQJcf71IHwMlnjO9lsLG 5wPI1HmqbXXKQmqG8lBDmCSNkFVZvEEONtNOg0DnwjUsgYh2B7dw8S7x7rDxmEp39Bv8 bDZrxCtBqMCzwzpKmnFcN73oS7R8qmEohqg9vMA0RJbwEGYLx0PJu71pHB4/h6rn9QGt 0Z8RAPtmq/vV8GszVS9+HZwj/wWJLc1iKO7bss5awEInR7Y63V6eATwnAehUl8BMERXL 3sgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=nWKTx1C1busGH1n86mFA2gXYIdrkaqudVwHZXoCwcUY=; b=pBXASoGCEAGoCiZBaxnV0hBHGwjwPFOCWCZvWVXLLW7m6VDnqy94w30J1lgpMdcBRs tD7x48dXIEJ5rFfMt+092/+2ZbEmIgAZ4AcdK+bHcIGi6L4KoIR4c1/mFUGmSOTWA7TM IFbXRSELxDflcXloN39RdHJ/bovpPCGW1lhFm6brCqIIKrZDTarxGct5NfOhT+XPUvGS H68BFcKU29AGy4tSJKCiD6UrbRZnitKDm+h0wzO59oaH2lnMYg1VnhsADphSvmq/wjGb g8rg5GzAemX6wfLcVgYVOHrR7FmdBnzNEFJa+IUFBiWxe2Dfb9NLKal5OCYAoGDuDcc1 E7pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Wc8Dk4to; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv19-20020a17090ae41300b0025871888e79si18924pjb.107.2023.05.30.18.14.31; Tue, 30 May 2023 18:14:45 -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=@gmail.com header.s=20221208 header.b=Wc8Dk4to; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233770AbjEaA6n (ORCPT + 99 others); Tue, 30 May 2023 20:58:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230148AbjEaA6l (ORCPT ); Tue, 30 May 2023 20:58:41 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50E23F3; Tue, 30 May 2023 17:58:40 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-256e1d87998so679547a91.3; Tue, 30 May 2023 17:58:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685494720; x=1688086720; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=nWKTx1C1busGH1n86mFA2gXYIdrkaqudVwHZXoCwcUY=; b=Wc8Dk4toURb+GT/VEX8u/ZPyAeWW0viHsBDstcpqO7X3e2/blZHuN1+hmZJS+cl5oP bRV1ZSAobyuH/GVbroK8S5fQ+vcSsXZtyyGF8PtrVyS3KWmhtC1e/0pN2yyqrrKmWMyu oyrXQNAbInrdlWmPC7t4wsa0BwtX1ssd5sd32idOI2cuL0f0ICybsuPNZtKjqh1bZ5RY Cn5aeyib36tc1wO52dckv/VhJAkwJAU4er9DdKf+rKkyJMjoS0A2vE8hEGZy2foKKvNi Y2szGXUSLGg3gc5Z1VFH+/PmXsrKxsxJvM31zTpEEfhsQcMnM3P84P2Tw3Sx5ZCnvEEO /5GA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685494720; x=1688086720; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=nWKTx1C1busGH1n86mFA2gXYIdrkaqudVwHZXoCwcUY=; b=ay1zfR3ccXVOpfwI/DWn1Ae11kppVbc9oQ+yXyZg29W0BysY/jwti/aVQ+KZdhLAan gYS7bKmBhYLhiRxbSGCj7FrUnGMEvfvyb+rhoe0n6+WNpTQCT1nVftNNtapiOFzhBvCc TeKKQ6AG5bf76YLqTIk4kbPFy4SZbzIaYnCOpnV2C45W33sOg508TLgLwvOq27v1tfD2 lVYhSx63tS2yHon6fjvIShPSS4uye5PYBaNB8ZUGgQXtS8qcXAf6sT38/jhQujS9Cfte Gi6QhFzzLBaibXgAm+KUL0j3gKU8aTjtnj1g/QaDRtYJrrr4d71d3wUKs9BlFGavY3oP tWiA== X-Gm-Message-State: AC+VfDzeQS+b/cP3/56EYpMBQbJ5Vdy3Nd5tE2opZIpEXxGSCikjmI67 OKgDIHnCvDFjJM2X8tN2oUE= X-Received: by 2002:a17:90b:2301:b0:256:797b:5039 with SMTP id mt1-20020a17090b230100b00256797b5039mr4202403pjb.9.1685494719614; Tue, 30 May 2023 17:58:39 -0700 (PDT) Received: from localhost ([192.55.54.50]) by smtp.gmail.com with ESMTPSA id fs19-20020a17090af29300b0024744818bc5sm22404pjb.9.2023.05.30.17.58.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 17:58:39 -0700 (PDT) Date: Tue, 30 May 2023 17:58:37 -0700 From: Isaku Yamahata To: "Kirill A. Shutemov" Cc: Borislav Petkov , Andy Lutomirski , Dave Hansen , Sean Christopherson , Andrew Morton , Joerg Roedel , Ard Biesheuvel , Andi Kleen , Kuppuswamy Sathyanarayanan , David Rientjes , Vlastimil Babka , Tom Lendacky , Thomas Gleixner , Peter Zijlstra , Paolo Bonzini , Ingo Molnar , Dario Faggioli , Mike Rapoport , David Hildenbrand , Mel Gorman , marcelo.cerri@canonical.com, tim.gardner@canonical.com, khalid.elmously@canonical.com, philip.cox@canonical.com, aarcange@redhat.com, peterx@redhat.com, x86@kernel.org, linux-mm@kvack.org, linux-coco@lists.linux.dev, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, isaku.yamahata@gmail.com Subject: Re: [PATCHv12 9/9] x86/tdx: Add unaccepted memory support Message-ID: <20230531005837.GA1808127@ls.amr.corp.intel.com> References: <20230518231434.26080-1-kirill.shutemov@linux.intel.com> <20230518231434.26080-10-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230518231434.26080-10-kirill.shutemov@linux.intel.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Fri, May 19, 2023 at 02:14:34AM +0300, "Kirill A. Shutemov" wrote: > Hookup TDX-specific code to accept memory. > > Accepting the memory is the same process as converting memory from > shared to private: kernel notifies VMM with MAP_GPA hypercall and then > accept pages with ACCEPT_PAGE module call. > > THE implementation in core kernel uses tdx_enc_status_changed(). It > already used for converting memory to shared and back for I/O > transactions. Because unaccepted memory reported in e820 means private[1], MAP_GPA isn't needed to accept memory. (Or are you seeing TDX KVM/qemu issue?) [1]TDX Virtual Firmware Design Guide. 7.2.1 Memroy Type in TD Resrouce HOB. Table 7-1: Mmeory Typein TD Resource HOB. -- Isaku Yamahata