Received: by 2002:a9a:4c47:0:b029:116:c383:538 with SMTP id u7csp960522lko; Tue, 13 Jul 2021 13:57:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytzeXURZ5wxFf2A3yDQU3z80RsKYenYBi1xu9xpV5kAzsWFOIl7RFP2YbKSDloYkcr13LI X-Received: by 2002:a02:6382:: with SMTP id j124mr5746495jac.72.1626209872471; Tue, 13 Jul 2021 13:57:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626209872; cv=none; d=google.com; s=arc-20160816; b=V2hGpjYQPrzeF4U3bY3UE4g4BNzbBPaEnKIMzGyAZWcOv2tkgpN68MB0KI1MwRVVuJ zGGcg3X1+EwZxH6wxLBrbQPKxGKI1vPB+iIseSjXTR89hdhTzqv1TH743XPzQxnDV6w2 qfL4QJtiKrgl9KJICLZB2F2chiFLh45utpenqgQfTzGXrq4ZcFh37BTMsG4pxYjxoVRX Mg0bsNA6YVFY26wsJKtoOQahX858+5yUNAuVXl8Rn1OC68Cff1OUSki1sUagRNGxLyzj DWPWRRvZyNe17Xcxo59cCO/kGvv0IP59/5yi5r8nViAYTYRC+wp4QX56fdlHYTTkEdbl n0xg== 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=LMLZw+7kP17xj8iob4CnXRS8mLPc06HVwcScbSpgmog=; b=krTPWB5Q/RNAsd9OpGl39rq52PDtuW0lS5IJkaEf8sfYvewAN6elhbPsQnmLfK7dTA MlHoENlUF8tQnBXkQU2E3hNu1XsIAURSBgPpTOllUr8xLIC/3rlRIQvr7Lr/oaMOAxZb lwN5KPexDwpOu2df+50ZLelxqhbRTCOA/4JtoLCMBBGOiYEjaFq3J35IeTWxRYluAF+T 1tYsG9zLaMK6RzJ5N9UKhDw+nEy2nMpKCgoLkW4P4pP+qSc2gHiBG/MopOlqD5jWVCir /VOtSHOUrHUUtspnU2nwIex3A/Gdf8gA+umPuYEWd4YED+HKw48ZI5YGcZNSHl9+geGj WaAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=DbhUnema; 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 e16si420iom.90.2021.07.13.13.57.39; Tue, 13 Jul 2021 13:57:52 -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=20161025 header.b=DbhUnema; 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 S235060AbhGMU7J (ORCPT + 99 others); Tue, 13 Jul 2021 16:59:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234172AbhGMU7I (ORCPT ); Tue, 13 Jul 2021 16:59:08 -0400 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86607C0613DD for ; Tue, 13 Jul 2021 13:56:17 -0700 (PDT) Received: by mail-pl1-x633.google.com with SMTP id u3so68416plf.5 for ; Tue, 13 Jul 2021 13:56:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=LMLZw+7kP17xj8iob4CnXRS8mLPc06HVwcScbSpgmog=; b=DbhUnemaxXAYoclSgYPqjmzCgDcfvbTt0Fp2D3iAma0zwBxS/PVN+wOVRPnC4yPEXP 56fAdE8DeC5XAmFGZI1M6jOscQOIWAOLas285nt9xvjZiSVQsc5VDJtd9ZQHTOk5EVvx 9Z6DqQtUPkBOCvJd+rRYaB0zDlhvhs8VX82lgwiPf6AYDwItMgV6UFfcd9tmSMQuI85f 92mxF8FyStxwL5H2rKfLi7cakA6gtrS9QZU11Ty6YAj4rXYy1YX0fzHhNSN8xukw81EC sZ1dBuH25Jl8vnQek1/rexfaZYFIKrcC34oedX3HJOdABtebYdwYWXEIfeMuMY0SdkA8 v6ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=LMLZw+7kP17xj8iob4CnXRS8mLPc06HVwcScbSpgmog=; b=maCZTCtvjZuMRG/LtXd4rCNSUnGolevy0sprStSb1/0tGWhB+io6EudSwQAFpsQjD6 9gLmUYjcKePu5rsjrXhIVSaharGZqk/DptXppBlq5Za8w4aiw6cFukFX29MYsrPWrm7W XmMxKhG+fKa4MfYSStzUS6Gin4Nd55/qh0/m0+W7h6R1I792JibA7kZ8ztSiNJNwDgIO VbtavqLpxHZW+R352ezIKSfbGGbg7vF3cuJlc3CbD2iafOjSEOlVixeh6iXwD/vDLTla 0UpH6bpwrWny7D9+XXX93SOgR/2fjhmZQ9aI3xECFFn6pGpOY7GYcdsHQ2Ijx5oCk0Tt 56FA== X-Gm-Message-State: AOAM533MAqHWDmDpazI6ba3Z4SLDkGM8RqYMzORiliYzXrcs0mcSEoj/ dAu5XYo2BlV7+DUNu2ZdMDUGVw== X-Received: by 2002:a17:90a:510b:: with SMTP id t11mr135413pjh.178.1626209776872; Tue, 13 Jul 2021 13:56:16 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id j21sm57759pjz.26.2021.07.13.13.56.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jul 2021 13:56:16 -0700 (PDT) Date: Tue, 13 Jul 2021 20:56:12 +0000 From: Sean Christopherson To: Paolo Bonzini Cc: isaku.yamahata@intel.com, Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , erdemaktas@google.com, Connor Kuehl , x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, isaku.yamahata@gmail.com, Sean Christopherson Subject: Re: [RFC PATCH v2 60/69] KVM: VMX: Add macro framework to read/write VMCS for VMs and TDs Message-ID: References: <5735bf9268130a70b49bc32ff4b68ffc53ee788c.1625186503.git.isaku.yamahata@intel.com> <71ee8575-bd72-f51e-38c5-4e8411b8aedd@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <71ee8575-bd72-f51e-38c5-4e8411b8aedd@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 06, 2021, Paolo Bonzini wrote: > On 03/07/21 00:05, isaku.yamahata@intel.com wrote: > > From: Sean Christopherson > > > > Add a macro framework to hide VMX vs. TDX details of VMREAD and VMWRITE > > so the VMX and TDX can shared common flows, e.g. accessing DTs. > > > > Note, the TDX paths are dead code at this time. There is no great way > > to deal with the chicken-and-egg scenario of having things in place for > > TDX without first having TDX. > > > > Signed-off-by: Sean Christopherson > > Signed-off-by: Isaku Yamahata > > --- > > arch/x86/kvm/vmx/common.h | 41 +++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 41 insertions(+) > > > > diff --git a/arch/x86/kvm/vmx/common.h b/arch/x86/kvm/vmx/common.h > > index 9e5865b05d47..aa6a569b87d1 100644 > > --- a/arch/x86/kvm/vmx/common.h > > +++ b/arch/x86/kvm/vmx/common.h > > @@ -11,6 +11,47 @@ > > #include "vmcs.h" > > #include "vmx.h" > > #include "x86.h" > > +#include "tdx.h" > > + > > +#ifdef CONFIG_KVM_INTEL_TDX > > Is this #ifdef needed at all if tdx.h properly stubs is_td_vcpu (to return > false) and possibly declares a dummy version of td_vmcs_read/td_vmcs_write? IIRC, it requires dummy versions of is_debug_td() and all the ##bits variants of td_vmcs_read/write(). I'm not sure if I ever actually tried that, e.g. to see if the compiler completely elided the TDX crud when CONFIG_KVM_INTEL_TDX=n.