Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp41806pxv; Fri, 30 Jul 2021 18:06:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtdYaMcLZ+krl3oyQYMUaC7ICP6sgHm1CsIh3aVJqQH6vona701ovcYRHOeZ+Om4lM/CFr X-Received: by 2002:a6b:c90f:: with SMTP id z15mr3589944iof.183.1627693583477; Fri, 30 Jul 2021 18:06:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627693583; cv=none; d=google.com; s=arc-20160816; b=Q/iSgWI0qO/0I5bRSgJ3YBg+nXGPhIFHqK2XfZOSPFjJtQ4jbd/AQFGtKAjX7hdl6E 7kwlXEAb7A5ps/UiGwXMfKlcpYob8oWjX5avgkoPXCrnWrvARttSoQ7Tb6nL5ubB2d5o d62VODiFfTHQiqfJhknlZfpNqah3xLrxPxxInu9y5lPt8xRCso492jJcBrS9cz9TkzUt UWdiD8uWCGPuI545PfDSJcBMMgmHkNdENTKFfUzkMa1MQYqAQDosL/Ewcz9D6Zyiy+JL pSHL3phLyTGSBoKNWlRGyy2Zi4cSfCuVmDzf5eoIpUDmQdbDi6SM+oa0IdMMSyS83Jvo DaUA== 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=7fCQsCvI2ERSkc9ox+/XNf66aLFSxrAJ6Aab87hhw0s=; b=HhLt1ZjyULPKSinapDDRGlFHhf4M9EVis4QvTypwN8sO+lmxk08kOa/0X8Gx8kBVn5 9R4mc2vJHyrG7e2RlRJPPGJsI6hBEZyCofca/N3EuA4PWO3BPhmknCEeOuJNPFz1/yKh h5cUsq/e0hlE+tC3WjO9Y8RD47IQIzkOj3MK1o4p0DTlwISs/oyQnQ/lP23fkQUDZDig GCgG4tsMm9GtLS9FVOfx1q2NbUUJt6NvO9rp4P9k9+ysb6pIKxPKuLLbGQ4upy22Kn3y 64HdVJYsOL5Z4AaVc99gznrZL7xNCTiRxxd+OFkf2pr2VH10mS7RCza1KurI/n60s6e2 VbCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=X1ZVq0hp; 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 c15si3577782ioa.59.2021.07.30.18.06.07; Fri, 30 Jul 2021 18:06:23 -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=X1ZVq0hp; 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 S235199AbhGaBFP (ORCPT + 99 others); Fri, 30 Jul 2021 21:05:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234862AbhGaBFO (ORCPT ); Fri, 30 Jul 2021 21:05:14 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7B29C06175F for ; Fri, 30 Jul 2021 18:05:08 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id nh14so5851169pjb.2 for ; Fri, 30 Jul 2021 18:05:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7fCQsCvI2ERSkc9ox+/XNf66aLFSxrAJ6Aab87hhw0s=; b=X1ZVq0hpPSO5/Yd2KoFffT1sCZrD4/KqJLWniSqAunDAunqotTFNmgTlYx8KUSGe8m fPxlVyLQg40Wmttm/FuH4QmQ7tP+M366QBmOpPijlSr+alouiYwFqy6hq1pJWWjsmOA/ SmemNq1syXjJlBEzTC3ubhKa1Pgs2IvjsWnLiso57YSoLYU8wZn3Hg/yXPwQf6h0RpaN GHJPFsm79AznsUpLJSXojUVdKaGrKvdZQcB0RBSUNbJwxuTPuJRuc6uDpsEgP22Qjhh2 UD//jD0LgenwhRmsgQ7665zxDIsWvWtiiNvlB5W7XaTQwq68EQXW1Xa46KueX38SzbVT dd1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7fCQsCvI2ERSkc9ox+/XNf66aLFSxrAJ6Aab87hhw0s=; b=fKy7PLSCx3uih4MgvEcMDHPVPTmG7uDR6zauL+bF5qVmhyhyNtQhAejYVxBfCd/t9w XfpGoDBndpQsI1f0wojvFRcrqWWZiRgVbr38FHQmyRDU4nHIRpjdJr2bhVODj8HaV+3N hJE07rKNYmC2brxfbU2vQMxniy+w4xL3lBRGrOziNwMRtl7fOa6OtQQsV/tzBjzUJt6k wgLsrzLQ7+Tngz8nhoBSpMOLDAWGeIaqY15Zsa5MAqJo+Ni4wyfm+5vSmrZLcLQtzbUD WUhbw2vmEVs9R7t7aNlY9V2VElkc1/OZ1IxqV5VmLU9k+1h+G67D9N5WPZIyHrY3Fe4l 6QzA== X-Gm-Message-State: AOAM533U779GHBuhhsx7F6VBP66DzYattoF6Xz8tMZhnqhi4snAwwpna mehmNjMTJOwfl5qW1OA/BP7zsiE7Gj8f0+SgsvmLzg== X-Received: by 2002:a17:90a:1b01:: with SMTP id q1mr5854899pjq.162.1627693508091; Fri, 30 Jul 2021 18:05:08 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Erdem Aktas Date: Fri, 30 Jul 2021 18:04:57 -0700 Message-ID: Subject: Re: [RFC PATCH v2 05/69] KVM: TDX: Add architectural definitions for structures and values To: "Yamahata, Isaku" Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Connor Kuehl , Sean Christopherson , x86 , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, isaku.yamahata@gmail.com, Sean Christopherson , Kai Huang , Xiaoyao Li , Chao Gao 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:05 PM wrote: > +/* Management class fields */ > +enum tdx_guest_management { > + TD_VCPU_PEND_NMI = 11, > +}; > + > +/* @field is any of enum tdx_guest_management */ > +#define TDVPS_MANAGEMENT(field) BUILD_TDX_FIELD(32, (field)) I am a little confused with this. According to the spec, PEND_NMI has a field code of 0x200000000000000B I can understand that 0x20 is the class code and the PEND_NMI field code is 0xB. On the other hand, for the LAST_EXIT_TSC the field code is 0xA00000000000000A. Based on your code and the table in the spec, I can see that there is an additional mask (1ULL<<63) for readonly fields. Is this information correct and is this included in the spec? I tried to find it but somehow I do not see it clearly defined. > +#define TDX1_NR_TDCX_PAGES 4 > +#define TDX1_NR_TDVPX_PAGES 5 > + > +#define TDX1_MAX_NR_CPUID_CONFIGS 6 Why is this just 6? I am looking at the CPUID table in the spec and there are already more than 6 CPUID leaves there. > +#define TDX1_MAX_NR_CMRS 32 > +#define TDX1_MAX_NR_TDMRS 64 > +#define TDX1_MAX_NR_RSVD_AREAS 16 > +#define TDX1_PAMT_ENTRY_SIZE 16 > +#define TDX1_EXTENDMR_CHUNKSIZE 256 I believe all of the defined variables above need to be enumerated with TDH.SYS.INFO. > +#define TDX_TDMR_ADDR_ALIGNMENT 512 Is TDX_TDMR_ADDR_ALIGNMENT used anywhere or is it just for completeness? > +#define TDX_TDMR_INFO_ALIGNMENT 512 Why do we have alignment of 512, I am assuming to make it cache line size aligned for efficiency? > +#define TDX_TDSYSINFO_STRUCT_ALIGNEMNT 1024 typo: ALIGNEMNT -> ALIGNMENT -Erdem