From patchwork Mon Sep 6 12:00:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jane Malalane X-Patchwork-Id: 12476865 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=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham 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 7352FC433EF for ; Mon, 6 Sep 2021 12:03:01 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2AFB961004 for ; Mon, 6 Sep 2021 12:03:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2AFB961004 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.179710.326112 (Exim 4.92) (envelope-from ) id 1mNDKt-0003wp-Qh; Mon, 06 Sep 2021 12:02:51 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 179710.326112; Mon, 06 Sep 2021 12:02:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mNDKt-0003wi-Nb; Mon, 06 Sep 2021 12:02:51 +0000 Received: by outflank-mailman (input) for mailman id 179710; Mon, 06 Sep 2021 12:02:51 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mNDKs-0003wa-VD for xen-devel@lists.xenproject.org; Mon, 06 Sep 2021 12:02:50 +0000 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 5b13c8b2-0f0a-11ec-b0a0-12813bfff9fa; Mon, 06 Sep 2021 12:02:50 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 5b13c8b2-0f0a-11ec-b0a0-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1630929769; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FkKh25/O7W8PkkcqGWWAdNe03OfrUwvjmG6W/c0Qi7s=; b=W3ElB7tmteFnCQuGFTx74y3yUz8GDGPgoB9yFCsFHVPo9mQGLNc07aPW XymkO45suNTqXWM6cuc6MP4JmgndwHhebvaJYr0vE0siNTBYdWHGmtbN8 G7zOkDZV09Mee+UbftjgiqVP6ONVyX1hTSk6wM4uIJqrApVHAxj6vWIWN M=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: qrKOgZfF7Ems9LLXxm7kvfpwSlebblNmSCRhZv7CySQmC/DPOy38zO5mE/RFli4ZnmRNtzZr9x BWqzRjpQ5BRE+CSMLG6ubqdb+fH+OUZ8fP/RHhoTO+xaQ/ILxhOpSWjm4TuB7jIgZWOBsNJA+c oScgX0tH+LlH1e7V+z0Lh6axejXU7MInsGQ7xpNUr6fb61bjKl31Hp9DRyWvcL0oMNxqC6dsif +doS5jx0t+ejYRH6WwxbbUBcDN72QmFRYnXB2ZPpBc7fadylWDko9p00pVuySuBsTOjV1iYgS3 g2oAW0DYiQQcU71Rb75DvvAs X-SBRS: 5.1 X-MesageID: 51690423 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-HdrOrdr: A9a23:B/PZD6/oXBQEQxBtr7Fuk+DgI+orL9Y04lQ7vn2YSXRuHPBw8P re5cjztCWE7gr5N0tBpTntAsW9qDbnhPtICOoqTNCftWvdyQiVxehZhOOIqVDd8m/Fh4pgPM 9bAtBD4bbLbGSS4/yU3ODBKadD/OW6 X-IronPort-AV: E=Sophos;i="5.85,272,1624334400"; d="scan'208";a="51690423" From: Jane Malalane To: Xen-devel CC: Jane Malalane , Wei Liu , "Jan Beulich" , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Pu Wen , Andy Lutomirski Subject: [PATCH v1 1/2] x86/cpuid: Expose NullSelectorClearsBase CPUID bit to guests Date: Mon, 6 Sep 2021 13:00:03 +0100 Message-ID: <239f7624f3ac3793993dc045d451079aa555b90d.1630929059.git.jane.malalane@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: MIME-Version: 1.0 AMD Zen3 adds the NullSelectorClearsBase bit to indicate that loading a NULL segment selector zeroes the base and limit fields, as well as just attributes. Expose bit to all guests. Suggested-by: Andrew Cooper Signed-off-by: Jane Malalane Reviewed-by: Jan Beulich --- CC: Wei Liu CC: Jan Beulich CC: Andrew Cooper CC: "Roger Pau Monné" CC: Pu Wen CC: Andy Lutomirski --- tools/libs/light/libxl_cpuid.c | 1 + tools/misc/xen-cpuid.c | 1 + xen/include/public/arch-x86/cpufeatureset.h | 1 + 3 files changed, 3 insertions(+) diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c index b2c673841a..d667c36f31 100644 --- a/tools/libs/light/libxl_cpuid.c +++ b/tools/libs/light/libxl_cpuid.c @@ -289,6 +289,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str) {"svm_pausefilt",0x8000000a, NA, CPUID_REG_EDX, 10, 1}, {"lfence+", 0x80000021, NA, CPUID_REG_EAX, 2, 1}, + {"nscb", 0x80000021, NA, CPUID_REG_EAX, 6, 1}, {"maxhvleaf", 0x40000000, NA, CPUID_REG_EAX, 0, 8}, diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c index 735bcf8f0e..d79e67ecfb 100644 --- a/tools/misc/xen-cpuid.c +++ b/tools/misc/xen-cpuid.c @@ -185,6 +185,7 @@ static const char *const str_7a1[32] = static const char *const str_e21a[32] = { [ 2] = "lfence+", + [ 6] = "nscb", }; static const struct { diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h index 380b51b1b3..e5a7c94c78 100644 --- a/xen/include/public/arch-x86/cpufeatureset.h +++ b/xen/include/public/arch-x86/cpufeatureset.h @@ -285,6 +285,7 @@ XEN_CPUFEATURE(FSRCS, 10*32+12) /*A Fast Short REP CMPSB/SCASB */ /* AMD-defined CPU features, CPUID level 0x80000021.eax, word 11 */ XEN_CPUFEATURE(LFENCE_DISPATCH, 11*32+ 2) /*A LFENCE always serializing */ +XEN_CPUFEATURE(NSCB, 11*32+ 6) /*A Null Selector Clears Base */ #endif /* XEN_CPUFEATURE */