Received: by 2002:a05:6a10:144:0:0:0:0 with SMTP id 4csp16666pxw; Thu, 7 Apr 2022 23:05:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywaAxA5ncCG6uXPrGsV4DRoroBUf+7/gWRCJ4aFnX5ng/uY9sTdJFAI2X9lpvDabwC4XvT X-Received: by 2002:a17:902:ee83:b0:156:96c7:74ae with SMTP id a3-20020a170902ee8300b0015696c774aemr17630411pld.114.1649397931731; Thu, 07 Apr 2022 23:05:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649397931; cv=none; d=google.com; s=arc-20160816; b=tcZj61Kw0sjuiRidp8tWDoyEiPxX0o5tZuU9XqJNsEiaigZpfpF/bv6ovK4Thd7Kdn 7Brw8QAkq0aif8lVKByDY79HhMIFS69AtW/627ULVqI7MTzlYgOzgomKTbgtrCQ/ieXm B4NJWE+HGzKMzk/YWrKNn/T4A+V2v4/XUPjEtOlzJTkfO5rDFkmPxFkmFKvnCp1S5nu4 92L1gNEe95v2AfAWuxeP84u3lkBVGwkGGkJyrcENZOjRPTKkyqPuUBLGXrOzRr0zCxF0 K9ZcciXz+IaQkv0dyULt86tX0ThbOUg7uZuzz33rGKUoUF6e81Tmo8tclbohsuvvBLs/ DMSA== 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=M9GeHxOMMEsAW0gA0HYTOdLUoDAu3ektn3I3+ONaQ78=; b=l4xnLoRJnfkyLtkiaNWNQxgvoRUnfiN+NcgXB+TnDWuuS+49OQwnCw9dLeXY8OgIH9 W2+bAyHTfbqMjnpeVI/p4JWYqzAK8EKtz1f3t3pSzdeIB2TQbyzicW1BdzFMbMH1f5ah +dCbVfMAC/r8k7WzObDjfiILLcnO+D8/t0CGQbfslQxcjwiHtUm+/e5ZA8xbwrCwwoOU SGGtI/h9BnySplBX0y7XKZ/7lsMbEl4vYMAlcxfbH34W1gDyh1DznfJDmi0fxPRh4FxM x+GKJY0Q0jaC7E+efpzXBacWbnqOBE1SU0Vsd6Dqx+Zc/nUP8Uiy7fT/QLhyF+1sNdkB UXfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iuN+YiAn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id h11-20020a170902748b00b00153b2d16465si31036pll.109.2022.04.07.23.05.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 23:05:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iuN+YiAn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B0F3F17ECC8; Thu, 7 Apr 2022 22:35:10 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234705AbiDHFhG (ORCPT + 99 others); Fri, 8 Apr 2022 01:37:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229933AbiDHFhC (ORCPT ); Fri, 8 Apr 2022 01:37:02 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D956E13D64; Thu, 7 Apr 2022 22:35:00 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id y8so2326824pfw.0; Thu, 07 Apr 2022 22:35:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=M9GeHxOMMEsAW0gA0HYTOdLUoDAu3ektn3I3+ONaQ78=; b=iuN+YiAnhi4v1/0R0HOX4xh70eB3YiaK4mxf9D7VrRedSnKBVG1bPI7e4hBhLMyn6I EP3EQVc/c5XXRpoPZtxAE2grPFYBMXYm7VW9IRGucH2ZOw05Fjx80ms4gqWQ8Xc26/0s fQZB77ggqAr09i7Wp9zGWuKbn4kOkwahgb60gOXZyJ/XBilId/BGRSM1zycYTKbSbwTr qD1V4F5S3rTVl7krq0UmV0+3GZwKggtIYpUfJZfjrh6Xl/ySynO2lhELXWTIsXdpS315 EVw2et4gxvLGuHtWUQjO53grE4n9TMzO0jefdg/9oT477pbO6U95H57vJNKRzo+z9qgj bCpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=M9GeHxOMMEsAW0gA0HYTOdLUoDAu3ektn3I3+ONaQ78=; b=1ewk4cbqiYgq+cHV0C8xTIx1bU6lSYUugLd2J4cjT6nJNhoDCvUo465sLFUZRqc0p/ DQMyJuuVePiiS+cxCZHvTsI8UX8yOb6St2QSPYDQwoSFzWiNTVsQdo3JoqmVY3hB2R9Q GKAV12DC2bi+cZz5gI4tgQSdHX2WhLkgsFH7naD/NYSIinATOaNzYacHdrePFIpkWXa4 eTPFCx9pnUUyz0gWB5U0mZsEf6tB4BXkk1w9li0Xxgxv+10WMyDQ2Ye/Y04LPRnqnNpJ jkK+/hsybQXWZw6p9lxyI/iTqXn01FYwi/6daFW9h8ZfZWIt3gexnLHvMsVFlQtpC/7o yEfg== X-Gm-Message-State: AOAM5301ZYkSCQkwinWwcsXHm0s6SgudrRR1gnqifzh4bG/pnnHRuI6I mKAM1jL1i6jAnMOD/5eJuyyzIewA1JA= X-Received: by 2002:a62:1e03:0:b0:505:64c1:3e19 with SMTP id e3-20020a621e03000000b0050564c13e19mr7824024pfe.32.1649396100336; Thu, 07 Apr 2022 22:35:00 -0700 (PDT) Received: from localhost ([192.55.54.52]) by smtp.gmail.com with ESMTPSA id mn18-20020a17090b189200b001cac1781bb4sm10718776pjb.35.2022.04.07.22.34.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 22:34:59 -0700 (PDT) Date: Thu, 7 Apr 2022 22:34:57 -0700 From: Isaku Yamahata To: Paolo Bonzini Cc: Sagi Shahar , "Yamahata, Isaku" , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, isaku.yamahata@gmail.com, Jim Mattson , Erdem Aktas , Connor Kuehl , Sean Christopherson Subject: Re: [RFC PATCH v5 083/104] KVM: x86: Split core of hypercall emulation to helper function Message-ID: <20220408053457.GA857847@ls.amr.corp.intel.com> References: <1eac9040-f75f-8838-bd75-521cb666c61a@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1eac9040-f75f-8838-bd75-521cb666c61a@redhat.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no 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 Thu, Apr 07, 2022 at 03:12:57PM +0200, Paolo Bonzini wrote: > > > + if (static_call(kvm_x86_get_cpl)(vcpu) != 0) { > > > + ret = -KVM_EPERM; > > > + goto out; > > > + } > > Is this guaranteed by TDG.VP.VMCALL? Yes. TDCALL instruction in TD results in #GP(0) if CPL > 0. It's documented in trust domain CPU architectural extensions spec. https://www.intel.com/content/dam/develop/external/us/en/documents-tps/intel-tdx-cpu-architectural-specification.pdf Anyway VMM can't know TD guest CPL (or other CPU state). -- Isaku Yamahata