From nobody Tue Feb 10 06:08:26 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1632834276201157.05062882558536; Tue, 28 Sep 2021 06:04:36 -0700 (PDT) Received: from localhost ([::1]:56716 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVCmg-00055k-9u for importer@patchew.org; Tue, 28 Sep 2021 09:04:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38596) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVCa5-0006Oq-Vq for qemu-devel@nongnu.org; Tue, 28 Sep 2021 08:51:34 -0400 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]:37538) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVCa3-0001OO-Js for qemu-devel@nongnu.org; Tue, 28 Sep 2021 08:51:32 -0400 Received: by mail-ed1-x52d.google.com with SMTP id ba1so24896014edb.4 for ; Tue, 28 Sep 2021 05:51:31 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id p24sm12641685edq.27.2021.09.28.05.51.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Sep 2021 05:51:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vIZhtxRfpLD3As3rA5Gn2uhFgwLP60EEjiPbzW6gvTs=; b=fIuyGEC+290iYNf+wnJdzfIkdgk1+FG+6JUqcJPb9pC2gfoAe7r+AGma0XCSlxV9gw SnS+jEPmk0Of6h/LaPz9LA5eKuMwNeIFWpe1yUNn1rN3/ozijHdyVuCDsyyOGl37qkZ7 1zd8ZdyTewiAyOI9JQZJ2MPLosBPPHQZyPc4HKli8voWHOfFVOVaOUdnOZWMQAZt8I+a u4sVx/hDYV+CO1oQt6MrCfA4q7h20Ur6f8sCRUNsvG5znrRGPWD6Tzhhz2waCTjUHXnl cNvR+KAryF/vvVD45C4HuIB3H3R/97+8UZKxW4aq7PXoLkqoQgRsDYoyxi6qlG6NDCgS OGkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=vIZhtxRfpLD3As3rA5Gn2uhFgwLP60EEjiPbzW6gvTs=; b=3eznOxOdgOJfYZfLleoJLQawU/zGxpPAR7szuYuPhQ/ER/bjK3311XVGETHeb1rF/+ tJ9L+gToJ/9BcHns/hqTtXVsdyYSvceEvVTlVgkPAmzqw5RD5Y8dpE3Bta8mBv3PYHbI TnToZNB8EJ8/ikY0hyehG1Qf3DmBFWmsfzEoETZ8fMaUQq846XnK53/R6ENs/9tg9i9u Uq9iiM2fLjYouSnWJsMvMD1sPZJqnlV/CMRTgLiotRFDQkV3xaHDxClUiIP0/nNbjOEu l37Yx9J5jMbh1w55LfYFKoA98Gc5UgQWzZWDVZODbtoCuDcJ82YSZeGFte7c5KqqGdXR R4mQ== X-Gm-Message-State: AOAM531xtwFHhibM5QIUG7LkaUN9e3FA4Ucye7bhwkwkU0RyElPTDRUx 9wWhLToEafS2+JbQ0I3Ppkdj64OqQWE= X-Google-Smtp-Source: ABdhPJzDqUvSWnTkHHa4jOwxrYjgMIsj443eWJ5kY8enoGInCWd1f6eJumUFFu6JOfeT3EtoQqOYVQ== X-Received: by 2002:a17:906:9742:: with SMTP id o2mr6586851ejy.532.1632833485339; Tue, 28 Sep 2021 05:51:25 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 08/33] i386: Add SGX CPUID leaf FEAT_SGX_12_0_EAX Date: Tue, 28 Sep 2021 14:50:51 +0200 Message-Id: <20210928125116.183620-9-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210928125116.183620-1-pbonzini@redhat.com> References: <20210928125116.183620-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::52d; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x52d.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yang Zhong , Sean Christopherson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1632834284220100001 Content-Type: text/plain; charset="utf-8" From: Sean Christopherson CPUID leaf 12_0_EAX is an Intel-defined feature bits leaf enumerating the CPU's SGX capabilities, e.g. supported SGX instruction sets. Currently there are four enumerated capabilities: - SGX1 instruction set, i.e. "base" SGX - SGX2 instruction set for dynamic EPC management - ENCLV instruction set for VMM oversubscription of EPC - ENCLS-C instruction set for thread safe variants of ENCLS Signed-off-by: Sean Christopherson Signed-off-by: Yang Zhong Message-Id: <20210719112136.57018-8-yang.zhong@intel.com> Signed-off-by: Paolo Bonzini --- target/i386/cpu.c | 20 ++++++++++++++++++++ target/i386/cpu.h | 1 + 2 files changed, 21 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 21d2a325ea..2cd1487bae 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -654,6 +654,7 @@ void x86_cpu_vendor_words2str(char *dst, uint32_t vendo= r1, /* missing: CPUID_XSAVE_XSAVEC, CPUID_XSAVE_XSAVES */ #define TCG_14_0_ECX_FEATURES 0 +#define TCG_SGX_12_0_EAX_FEATURES 0 =20 FeatureWordInfo feature_word_info[FEATURE_WORDS] =3D { [FEAT_1_EDX] =3D { @@ -1182,6 +1183,25 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] =3D= { .tcg_features =3D TCG_14_0_ECX_FEATURES, }, =20 + [FEAT_SGX_12_0_EAX] =3D { + .type =3D CPUID_FEATURE_WORD, + .feat_names =3D { + "sgx1", "sgx2", NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + }, + .cpuid =3D { + .eax =3D 0x12, + .needs_ecx =3D true, .ecx =3D 0, + .reg =3D R_EAX, + }, + .tcg_features =3D TCG_SGX_12_0_EAX_FEATURES, + }, }; =20 typedef struct FeatureMask { diff --git a/target/i386/cpu.h b/target/i386/cpu.h index b6491df0f5..2b199102ef 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -578,6 +578,7 @@ typedef enum FeatureWord { FEAT_VMX_BASIC, FEAT_VMX_VMFUNC, FEAT_14_0_ECX, + FEAT_SGX_12_0_EAX, /* CPUID[EAX=3D0x12,ECX=3D0].EAX (SGX) */ FEATURE_WORDS, } FeatureWord; =20 --=20 2.31.1