Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3582273pxb; Sun, 24 Oct 2021 06:00:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJPqy7M0j5YFocDlSLuETbXeyd/vAJfRhlIzPx/nlpO4i3rUm8H8UMO/trncwYGrCFwoCH X-Received: by 2002:a63:9554:: with SMTP id t20mr2983366pgn.255.1635080448285; Sun, 24 Oct 2021 06:00:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635080448; cv=none; d=google.com; s=arc-20160816; b=nv+A9Yk0HR31dvvOaHd/k2xLdsVemVOUm+e6fxUpme6I290cRX0TwBQUa+mLvRGzfe qivOJ/Gwq/NJ+z1jRqdc6zK5NRU0xy+jF/0e8rVbgtHqAHvZdhBq50/XRyE3tf7mdDYZ O52J1DBQTmjOYDZ0L2X9Kyg55B72r0o91TB/tX3y5IIDVx0SyBIFiVCjzo2IEwE2J34Z NeCwOJl3kcyh7LMOgi6jDZtvl0cqDcLiV9JzE1l7aw99mtXzXEzJ7ekyUcMrmEfzhFdL 4faDUW0yTNyFK6MRHiroEF6M2VM7E+HkYLHFk5GcpSOQrhKxUimIA+NBw5RtxBaUtMwy g0Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=WeYJDyGgiDCagtT6VWbkgHdysoFrEbpxRA5aFCv/AlI=; b=ZcCk5A2IT8aSjXmTMD1hdEjreTjJ0QqZEU3p9L1Brt4iGzkeodslDUDf15lPEdijK/ q+nMNWDG4WbMOdZeDzEduUCOal65bstylRtf98irKSS4wixhYl9Fm5fkvPzg0rEDn6lX AJ4rf6vWQT6zxlGgG8Q8/lQGfGiG17ElhiSIgNrT1rpzjwO3mx9Zxe6vC48cj3ZTsLHS bk6JaBBrDlRhuEVt/IBkpBymYeXcUMIzgkuNo1TKZpRcuPqJRHhfbOk/xx5WX2B968wJ HpsWu9qdI+xY8obBJUAOzqRTftcJQMxZSeKbASYR9Jc7a72zrxQFbNsizCnuOp0kz0NP g8rA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p23si20932694plr.150.2021.10.24.06.00.35; Sun, 24 Oct 2021 06:00:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230435AbhJXNCB (ORCPT + 99 others); Sun, 24 Oct 2021 09:02:01 -0400 Received: from mga12.intel.com ([192.55.52.136]:8375 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230301AbhJXNB7 (ORCPT ); Sun, 24 Oct 2021 09:01:59 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10146"; a="209611243" X-IronPort-AV: E=Sophos;i="5.87,178,1631602800"; d="scan'208";a="209611243" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2021 05:59:38 -0700 X-IronPort-AV: E=Sophos;i="5.87,178,1631602800"; d="scan'208";a="496400624" Received: from dluan-mobl2.ccr.corp.intel.com (HELO [10.255.31.184]) ([10.255.31.184]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2021 05:59:33 -0700 Message-ID: Date: Sun, 24 Oct 2021 20:59:30 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.2.0 Subject: Re: [RFC PATCH v2 66/69] KVM: TDX: Add "basic" support for building and running Trust Domains Content-Language: en-US To: Sagi Shahar , Isaku Yamahata , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Erdem Aktas , Connor Kuehl , Sean Christopherson , x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: isaku.yamahata@gmail.com, Kai Huang , Chao Gao , Isaku Yamahata , Yuan Yao References: <75afef2cdfc3166b2ef78ad13e3a4b1c16900578.1625186503.git.isaku.yamahata@intel.com> From: Xiaoyao Li In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/22/2021 5:44 AM, Sagi Shahar wrote: > On Fri, Jul 2, 2021 at 3:06 PM, Isaku Yamahata > wrote: >> Subject: [RFC PATCH v2 66/69] KVM: TDX: Add "basic" support for >> building and running Trust Domains >> >> >> +static int tdx_map_gpa(struct kvm_vcpu *vcpu) >> +{ >> + gpa_t gpa = tdvmcall_p1_read(vcpu); >> + gpa_t size = tdvmcall_p2_read(vcpu); >> + >> + if (!IS_ALIGNED(gpa, 4096) || !IS_ALIGNED(size, 4096) || >> + (gpa + size) < gpa || >> + (gpa + size) > vcpu->kvm->arch.gfn_shared_mask << (PAGE_SHIFT + 1)) >> + tdvmcall_set_return_code(vcpu, TDG_VP_VMCALL_INVALID_OPERAND); >> + else >> + tdvmcall_set_return_code(vcpu, TDG_VP_VMCALL_SUCCESS); >> + >> + return 1; >> +} > > This function looks like a no op in case of success. Is this > intentional? Is this mapping handled somewhere else later on? > Yes, it's intentional. The mapping will be exactly set up in EPT violation handler when the GPA is really accessed.