From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FSL_HELO_FAKE, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A005DC07E96 for ; Tue, 13 Jul 2021 20:56:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8548360FED for ; Tue, 13 Jul 2021 20:56:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231499AbhGMU7K (ORCPT ); Tue, 13 Jul 2021 16:59:10 -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-Google-Smtp-Source: ABdhPJwppbUt2eHS1spdEOKVMbf1fSzhtbIwYnWe8xIFSfLd75nFK+mE2w4E+UrVxpXtbpNpKe9XHg== 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.