From patchwork Mon Dec 7 22:37:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 11957005 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=-13.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 4CBCEC1B0D9 for ; Mon, 7 Dec 2020 22:39:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 04C56238E3 for ; Mon, 7 Dec 2020 22:39:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728039AbgLGWiv (ORCPT ); Mon, 7 Dec 2020 17:38:51 -0500 Received: from mail-bn8nam12on2086.outbound.protection.outlook.com ([40.107.237.86]:2913 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725917AbgLGWiv (ORCPT ); Mon, 7 Dec 2020 17:38:51 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f0JO43OQEYOwSsJ53fEgMAl/tyAv3gjeLdiuVmKUs2WX7iqHV8vlzhccVFXQvCzaI662RVCQHVye8IrQqJgMi9tZq6ZgjJ952thVtAHXWEYA3QvWGNtSfR4EH6mc6R04dQF2l+TNoD8pxbXJg8VRCDTVcwjRAn0iCymo6UOZsIK9f/zTCrEHEK4djVMYnAXe/NXkw7CgQxf2JwcM/sxF2rkPWU43eNIVFzE1lOita0MVGX4ZU5HT72s/Pjy1h+3wmiaj2/Y5tjgXsZQ5kS7srAfiJAigpqbYLvgNf/AECVMQXMoexNqhDrM1FAK6gM90HNE9y892baatw3QRSBJ2bA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KoQYyh6yGJCrZs5BesxAmBbidfZrsBZzhpoIav534RY=; b=JGI26UA5PJ/KbF2UoqQYv1IsNZUCzeu3tlMO1k1M6woDVwhW5/Pbzs/yzNFqnWiDcn4Eoen0AvCkUyZmSzJgL260c3AEk4j7ajG5gFL4Ye9EFqVFWTOZYGH5EU5Im580Mf3mVCxBfhR/9YjzDswI99PkX/ZyKpHNihyTEclEk1ePay+O3vk/0bFC+WZyGGktd92A6pxbVswhnOCb2S2krBIVL8xSJbT74LOXpAXHrWhLESTSo7U5tR9MzGsHWfSU5X0eq8qbTYOcznfgIttQsw+ShW8BPsxKMzVWvEnxXbRlmRO7P9wCBcHl9AJXTG5zGR+G7ifBAYK9wA0YyiiO2Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KoQYyh6yGJCrZs5BesxAmBbidfZrsBZzhpoIav534RY=; b=j8L1uFLsgE0k1/zNFGoIm/tdh7tUOSsU3R9K9mqtW0zuL54m0U3TLg6sN0lEz3jEiKiKDkvtJ0KGepj9+X9EWQo52trYf5zeJsOVrwlz+yVvPOAovYD4TfptA5iu8ezuKxFhCwd+uJh3bfW6S7JEPq/veVEyckkMzwa8UzE+CdA= Authentication-Results: tencent.com; dkim=none (message not signed) header.d=none;tencent.com; dmarc=none action=none header.from=amd.com; Received: from SN1PR12MB2560.namprd12.prod.outlook.com (2603:10b6:802:26::19) by SN1PR12MB2384.namprd12.prod.outlook.com (2603:10b6:802:25::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.22; Mon, 7 Dec 2020 22:37:55 +0000 Received: from SN1PR12MB2560.namprd12.prod.outlook.com ([fe80::d877:baf6:9425:ece]) by SN1PR12MB2560.namprd12.prod.outlook.com ([fe80::d877:baf6:9425:ece%3]) with mapi id 15.20.3632.023; Mon, 7 Dec 2020 22:37:54 +0000 Subject: [PATCH 1/2] x86/cpufeatures: Add the Virtual SPEC_CTRL feature From: Babu Moger To: pbonzini@redhat.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de Cc: fenghua.yu@intel.com, tony.luck@intel.com, wanpengli@tencent.com, kvm@vger.kernel.org, thomas.lendacky@amd.com, peterz@infradead.org, seanjc@google.com, joro@8bytes.org, x86@kernel.org, kyung.min.park@intel.com, linux-kernel@vger.kernel.org, krish.sadhukhan@oracle.com, hpa@zytor.com, mgross@linux.intel.com, vkuznets@redhat.com, kim.phillips@amd.com, wei.huang2@amd.com, jmattson@google.com Date: Mon, 07 Dec 2020 16:37:51 -0600 Message-ID: <160738067105.28590.10158084163761735153.stgit@bmoger-ubuntu> In-Reply-To: <160738054169.28590.5171339079028237631.stgit@bmoger-ubuntu> References: <160738054169.28590.5171339079028237631.stgit@bmoger-ubuntu> User-Agent: StGit/0.17.1-dirty X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: CH2PR03CA0021.namprd03.prod.outlook.com (2603:10b6:610:59::31) To SN1PR12MB2560.namprd12.prod.outlook.com (2603:10b6:802:26::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [127.0.1.1] (165.204.77.1) by CH2PR03CA0021.namprd03.prod.outlook.com (2603:10b6:610:59::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend Transport; Mon, 7 Dec 2020 22:37:52 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 2abbbe8a-3ef4-4531-6b6b-08d89b00bd39 X-MS-TrafficTypeDiagnostic: SN1PR12MB2384: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1227; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZbvmMG1b9VXHlo1Bar6PU5RPeVRGgeP6CTYV13eJcdpPFPYEC5u7ckMUhRRyXn/3ymWLdB3Y3gScnlSMHTrDcsmrS/mDYG5GRM21Fm+Gp8gmyqHUsDPGCOxltDmNhVsPtpQ3oNm/vyqb/iv5eZkMY2DgtWx0kikm8CWNLnHiUxZVTFNs3juzrkuQF4r64YP/bL62klGMHTu6tHQ22kEdRzCf2qVftCgkt9kg1KsM1WwOp04339wDmal5oFrETs1WK9D/b85I8OKwmtYmJa7PS8WuGGz0Lb9b+hA9F6NW+2eHap87MOHP5+VCiiMRnVDdiaGSkNlGUVhKT6nz+8I3Cw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN1PR12MB2560.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(7916004)(346002)(396003)(39860400002)(376002)(366004)(136003)(2906002)(7416002)(9686003)(478600001)(8676002)(103116003)(16576012)(956004)(8936002)(186003)(86362001)(44832011)(66476007)(6486002)(52116002)(26005)(33716001)(66946007)(5660300002)(16526019)(66556008)(4326008)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?q?y6Q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vtGPTW7elyesBiOG5kVr61hZwFaS5MhHqGrJw?= =?utf-8?q?zUZhu8QUMjjywywdevhjhLlc54IWe3YvTHEFgKG89Se8WBvVrVTi94bTMwmdKjRkx?= =?utf-8?q?bgdbpKhkQ3zafU0ER4T?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthSource: SN1PR12MB2560.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2020 22:37:54.4660 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-Network-Message-Id: 2abbbe8a-3ef4-4531-6b6b-08d89b00bd39 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: K6puj/OVV5ncsIarbv+aklFDXmN72WKI14Zk6WxMum8IJtcA0sV8utCmbSY8q1B9 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2384 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Newer AMD processors have a feature to virtualize the use of the SPEC_CTRL MSR. This feature is identified via CPUID 0x8000000A_EDX[20]. When present, the SPEC_CTRL MSR is automatically virtualized and no longer requires hypervisor intervention. Signed-off-by: Babu Moger --- arch/x86/include/asm/cpufeatures.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index dad350d42ecf..d649ac5ed7c7 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -335,6 +335,7 @@ #define X86_FEATURE_AVIC (15*32+13) /* Virtual Interrupt Controller */ #define X86_FEATURE_V_VMSAVE_VMLOAD (15*32+15) /* Virtual VMSAVE VMLOAD */ #define X86_FEATURE_VGIF (15*32+16) /* Virtual GIF */ +#define X86_FEATURE_V_SPEC_CTRL (15*32+20) /* Virtual SPEC_CTRL */ /* Intel-defined CPU features, CPUID level 0x00000007:0 (ECX), word 16 */ #define X86_FEATURE_AVX512VBMI (16*32+ 1) /* AVX512 Vector Bit Manipulation instructions*/