From patchwork Mon Feb 27 21:05:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takahiro Itazuri X-Patchwork-Id: 62144 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2651925wrd; Mon, 27 Feb 2023 13:18:51 -0800 (PST) X-Google-Smtp-Source: AK7set9UBLv1lpNwOf/blaoDmE4938KT6L8dApzee1EL7v27K1WofLh1czsVhamlSWy7uw+wYD74 X-Received: by 2002:aa7:d490:0:b0:4ac:746e:2edf with SMTP id b16-20020aa7d490000000b004ac746e2edfmr1044779edr.9.1677532731739; Mon, 27 Feb 2023 13:18:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677532731; cv=none; d=google.com; s=arc-20160816; b=fsgvWFnEQii6f/b6vLCYepw7iwtOSADfc+S71O2d6yKcASFU5BrbN3mLATrTVtOOVv D+BNPrLvOs9WFxdKQMKJrmt5veXgV92l8PtmcR3gRP6S+beWOETr2SVxHPnelXmCHMO8 52DIWTdFX6E48zlsYrxYIZYrOm7mR+KUEHpWQlyX0nAnXSjhC6pyjhuUZihLBntEHscw /oshT4Nj+0qgN7h/ZNTcaX+jwUGNWWStlHe6PwTp9rzsZdyk9JEVjimzC+kYI9jKaNtc Xg0Hoaj9YkHR6H5tHWZ6/3ZHhBGM+qnU5DM2TGAM+shz4Ql7MWcDwzsDcIq368Tqbn1N RCjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QTDsYLHvG7I09WLI5isIEq1xwFB/a+7VTMu/FzazcPQ=; b=PUNkl8WU4/i7UtG6jx9hxTLcdztXaArWccG5nCFSK6sNOrxTE4dSmxTafN3E+yVBk+ +vYTGLLH9zL5zAm9IVeoxqOwuACQrS8os7QXhLsGxIUtAbYhcaogBhSSeby9KVNI4AEW q8DXFUChpkhON7FJFyaFU9ZdjAOrZ1gzX+SdhoRCBYRf4ZYOre8HWerv2wMalpeAZZ0u sftdyoAL1EklZpfSuaBkNkPpc2fQENVmYvdRTdY9jhPIVL/3ciOgMtQxrKf89cLIBwYX XVh+CeklIpWCfsrCqlvhNx2vrvj95XbnXOmmOM5p68iBXgFSuH4fVOhN1Dpzruhzn+0y UPrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=QMNY+mPa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f22-20020a170906495600b008d8476ffb06si10074213ejt.318.2023.02.27.13.18.28; Mon, 27 Feb 2023 13:18:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=QMNY+mPa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229759AbjB0VPM (ORCPT + 99 others); Mon, 27 Feb 2023 16:15:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229921AbjB0VPI (ORCPT ); Mon, 27 Feb 2023 16:15:08 -0500 Received: from smtp-fw-80006.amazon.com (smtp-fw-80006.amazon.com [99.78.197.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62984265AB; Mon, 27 Feb 2023 13:14:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1677532499; x=1709068499; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QTDsYLHvG7I09WLI5isIEq1xwFB/a+7VTMu/FzazcPQ=; b=QMNY+mPaCro/3XU/eJC6hABwXYObObyL1pUr/qyvAdSScUJnF7W2Wt2U CENwEZ7yMpvb+f86WsO0HDoM4rPn/QzX88GrerBVyyDrjofdU3aJEuVSU ducnUzPKrECZ85quSlQDWh+G0xjEeyas7A5GSHAF8lPFhPf+d0axcUclv M=; X-IronPort-AV: E=Sophos;i="5.98,220,1673913600"; d="scan'208";a="187220989" Received: from pdx4-co-svc-p1-lb2-vlan2.amazon.com (HELO email-inbound-relay-iad-1d-m6i4x-b404fda3.us-east-1.amazon.com) ([10.25.36.210]) by smtp-border-fw-80006.pdx80.corp.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2023 21:05:58 +0000 Received: from EX13MTAUWB001.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan3.iad.amazon.com [10.40.163.38]) by email-inbound-relay-iad-1d-m6i4x-b404fda3.us-east-1.amazon.com (Postfix) with ESMTPS id 9AB1A839DB; Mon, 27 Feb 2023 21:05:52 +0000 (UTC) Received: from EX19D002ANA003.ant.amazon.com (10.37.240.141) by EX13MTAUWB001.ant.amazon.com (10.43.161.207) with Microsoft SMTP Server (TLS) id 15.0.1497.45; Mon, 27 Feb 2023 21:05:51 +0000 Received: from b0f1d8753182.ant.amazon.com (10.95.130.142) by EX19D002ANA003.ant.amazon.com (10.37.240.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.24; Mon, 27 Feb 2023 21:05:47 +0000 From: Takahiro Itazuri To: , CC: Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , , "Takahiro Itazuri" , Takahiro Itazuri Subject: [PATCH 1/2] x86/cpufeatures: Add AMD-specific IBRS bits Date: Mon, 27 Feb 2023 21:05:25 +0000 Message-ID: <20230227210526.83182-2-itazur@amazon.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20230227210526.83182-1-itazur@amazon.com> References: <20230227210526.83182-1-itazur@amazon.com> MIME-Version: 1.0 X-Originating-IP: [10.95.130.142] X-ClientProxiedBy: EX19D031UWC001.ant.amazon.com (10.13.139.241) To EX19D002ANA003.ant.amazon.com (10.37.240.141) X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759020561823337958?= X-GMAIL-MSGID: =?utf-8?q?1759020561823337958?= AMD processors have some AMD-specific IBRS related bits in CPUID Fn8000_0008_EBX (ref: AMD64 Architecture Programmer's Manual, Volume 3: General-Purpose and System Instructions). Signed-off-by: Takahiro Itazuri --- arch/x86/include/asm/cpufeatures.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index 8f39c46197b8..cd7245507745 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -324,7 +324,10 @@ #define X86_FEATURE_AMD_IBPB (13*32+12) /* "" Indirect Branch Prediction Barrier */ #define X86_FEATURE_AMD_IBRS (13*32+14) /* "" Indirect Branch Restricted Speculation */ #define X86_FEATURE_AMD_STIBP (13*32+15) /* "" Single Thread Indirect Branch Predictors */ +#define X86_FEATURE_AMD_IBRS_ALWAYS_ON (13*32+16) /* "" Indirect Branch Restricted Speculation always-on preferred */ #define X86_FEATURE_AMD_STIBP_ALWAYS_ON (13*32+17) /* "" Single Thread Indirect Branch Predictors always-on preferred */ +#define X86_FEATURE_AMD_IBRS_PREFERRED (13*32+18) /* "" Indirect Branch Restricted Speculation preferred over software */ +#define X86_FEATURE_AMD_IBRS_SAME_MODE (13*32+19) /* "" Indirect Branch Restricted Speculation provides same mode protection */ #define X86_FEATURE_AMD_PPIN (13*32+23) /* Protected Processor Inventory Number */ #define X86_FEATURE_AMD_SSBD (13*32+24) /* "" Speculative Store Bypass Disable */ #define X86_FEATURE_VIRT_SSBD (13*32+25) /* Virtualized Speculative Store Bypass Disable */