Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1045952pxb; Thu, 21 Oct 2021 14:46:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZrZIiLTKZU5tRaNLBKrGSi0m3/EqLUwyl8/2xyLbQ9LNnhHMyewaBPv6OrwDauc5yEaF7 X-Received: by 2002:a17:90a:e547:: with SMTP id ei7mr9791582pjb.169.1634852809861; Thu, 21 Oct 2021 14:46:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634852809; cv=none; d=google.com; s=arc-20160816; b=qS4Ebp0uuwy0uG04AN07nEXgn6rioq8X9xm7j5/OC5TryhRpPhNxBfu177xwH5LLDp x0W6feRwkWM7s6JK/kY+g5V0rg5mrp0Xr5cKyPZVb4cq2bmSYE9dfJ4KxINqVb3S1d8U PzsAYFndlSFE2g8UDs1pyjX6ZPo5ffEPlhLqupy57MszvxR7+krMt2tDhiEGGU3X8ACo b/AQT/+JXpIlmYyWih6MtgFNrVbBvr9bzVZaK6wS4aJAWnmY8hp5MTavth76A6BY9GUM zGjZ289CZXigzmbKNyCxiZRl/NWLHSEdhtwVbOa3cGRaWeclJ5L9oXA+h6OszGeK5S7s 7uyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Mymsjt3IaF1en1RXeUqLwvBY1YQnaGAGlUG+m084SWc=; b=k88hABh8h2XossQZCoR2ZIw5JxTulA/eeQfRoPqyP2251Xj42fEkhxcYNpCz0TCGOk UCIxU68ew2fAkoaNqxNt4TdsoQ6nbLFLMOb2m+VymoTOAk6N82FDf/jHFk8LOK515a5u 0nxq4ksZt8pbkFWaNOPm3mwtwlpaGBoq7LnSipsS54WIleG24wOChQaBmkVLZQRyt0i9 RUzwwJPgGJ8rCriDCRP/9riIjRPKp39oTTQ9SaYJuwOi1wDNdiQk8IiJjybeW8qCID+c 9FKv3srliyL3sJ8f7lwf3qBHWlupTw4IE9ifrj5jN8j+92VtrIKDy8pzCf9xaWze8OYB KC2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=qQhqVoSd; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 125si8385587pgb.570.2021.10.21.14.46.36; Thu, 21 Oct 2021 14:46:49 -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; dkim=pass header.i=@google.com header.s=20210112 header.b=qQhqVoSd; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232290AbhJUVqm (ORCPT + 99 others); Thu, 21 Oct 2021 17:46:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231607AbhJUVql (ORCPT ); Thu, 21 Oct 2021 17:46:41 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D63B2C061764 for ; Thu, 21 Oct 2021 14:44:24 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id y26so618924lfa.11 for ; Thu, 21 Oct 2021 14:44:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Mymsjt3IaF1en1RXeUqLwvBY1YQnaGAGlUG+m084SWc=; b=qQhqVoSdEtJuPajOvdfoq4/zKjo9wDMZqOKgOF4nOQL7fa/7uK4HKjrubqGLx1jiMy I75yrFSWzVGue8mBSbRHRzXi9gwKqLbWt9CRDQJS5e3osuMmfKqpv2Drn0dEeZrMbxx8 hmgfrmqzmOzlPnPKsBSREWVRMQo7HuVX1crSSO0qCceio3WhQnpsJr61UpVKNxd+w5ES S62W3mqlisibwvdCoRNOu0/wP9oP7Z8O3qTk3fgHGp16gqNRGQXCf2nLix9vIKbrxTJj k+n9vOMzkGTG+krc+bMRQMpgjlhBMLkxhYNhQaDJZT1TQqZJpsSNtzKOcUw8x/WOaTme lKew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Mymsjt3IaF1en1RXeUqLwvBY1YQnaGAGlUG+m084SWc=; b=VBLKhXkVjvuwJ8ar74deI9Kp2ZBlIDMWNtWP17HIU0D6wXpA/PDcllwj+4TmUA7LLi kZHn0VkhSD2xFRM8mZOaG4lMhed8ZpaQC5W5ykKYkvQkfUMZBq4kj/lhBZ/xXLgpEDyb 5nNcXzrdQBfO+aN7rsff8Gh4zkoHBydktWT7VF8yVs4qXTSdseghiO9ooHGpgSQV9tar K04vLHukynmO4PiJsakwrDkW4SkSvKi+vqtF6eMzY9Zwca7+Hszn9z///ldkiYcb7iw7 uwgxWAPGMKGiR/rCy2ejgYdHSV/qLtBc6E1GRR6ZtS13eeXS8DLzLdgcBktkmQUQQB2t +6xA== X-Gm-Message-State: AOAM5308IozBqbEG+wLXFMV/gE/GRRQfHu48kvnFqifv01nw8QIQQfbc kI/lD70DaRhH4BdvAUuuqoXDTdPDV++VDSiRVaWHLg== X-Received: by 2002:a05:6512:a8d:: with SMTP id m13mr8064660lfu.305.1634852662938; Thu, 21 Oct 2021 14:44:22 -0700 (PDT) MIME-Version: 1.0 References: <75afef2cdfc3166b2ef78ad13e3a4b1c16900578.1625186503.git.isaku.yamahata@intel.com> In-Reply-To: From: Sagi Shahar Date: Thu, 21 Oct 2021 14:44:11 -0700 Message-ID: Subject: Re: [RFC PATCH v2 66/69] KVM: TDX: Add "basic" support for building and running Trust Domains To: 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, Sean Christopherson , Xiaoyao Li , Kai Huang , Chao Gao , Isaku Yamahata , Yuan Yao Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?