Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2553310rwb; Mon, 7 Nov 2022 14:55:42 -0800 (PST) X-Google-Smtp-Source: AMsMyM7gKmJY6rB8/q8Wp+zOWzSN1Q0JvdmEuxNTsIa2APlIJckMH4ILGBusfTKUNC0gUtyut/uB X-Received: by 2002:aa7:c504:0:b0:461:122b:882b with SMTP id o4-20020aa7c504000000b00461122b882bmr53648729edq.14.1667861742637; Mon, 07 Nov 2022 14:55:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1667861742; cv=pass; d=google.com; s=arc-20160816; b=DDbOeaw4Njyk1c8gGHqeQp+gDnpprVq6ZDiu6bXYhpAmyf2xGm8cDmOF7OB6TUk8pf qoKzhKUjU9Byp2hUclDBkRS0Ipl8nITHyBd/KqnORZmAfkx0YaTTVSVd69jekZTklB9V fyQEz5LRW0FBJSlh3AludhTZoGaJKp656UiepGrTEAzYidI7WlqLUocdvmQtbYPPTz75 bjxnHPYtSDAcA6oYTm3rXbpIDZR8/6qRrucA5PkzaeKKH9pLqOC5G36a4XLOiOYRxJGX kxTCnJGbrTpn7vIVeT0R1ZOfcuxztAiraHp2+BjhYCX99NzPWVywCqToXjz9RRBr6IFx RsrQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:subject:from:references:cc:to:content-language :user-agent:date:message-id:dkim-signature; bh=ZLrFr57HupA6O5T8cpvT38WQofxfu8AoxEQNbqZIasQ=; b=hCGmyTNWy9YPFXleTU3aH3lw7g4g96xyHWs3+pHjuqPvmB8OBHdHXaB2yZulh2MRWl 6F0R9yYKSPXmFLlI4UvmLmDsPieMDlZuVCz2le9Q9/KgdaFmmiJK4CGIbjSSrgq7o1wV vMHtn1W9ML/tmc770OCT4glxx1gh2W1K44T+bnhulELDp4Mpu08CNTlPfZx0vui3iTKa xfhUKUtYNJJt+rZUsFdYd8WXTUv5WaLKs8kvZu3AWce0EmPRosvirm03tYTHX0yqN/kv OGKYfMpFpzFZ6FQuhUO/LnaAFkAkAfvDwNLnhyPwuRX6yB+WxQonUiiUC3mXmyrtBW7c FG3g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=REAvmaZf; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); 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=amd.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b26-20020a170906151a00b007ae1874c142si7609773ejd.446.2022.11.07.14.55.20; Mon, 07 Nov 2022 14:55:42 -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=@amd.com header.s=selector1 header.b=REAvmaZf; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); 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=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232141AbiKGW3w (ORCPT + 91 others); Mon, 7 Nov 2022 17:29:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230186AbiKGW3u (ORCPT ); Mon, 7 Nov 2022 17:29:50 -0500 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1480821262; Mon, 7 Nov 2022 14:29:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h/kfQ6cy/R03CdfnN0bIFLNbh+IN8PbV+0TueqXAKfelYoyA2u/D8M+RQAXHNZKEnBC0oEjrVQvXiFZxrwkCErlJ3/AjXMg/7esjmnSZeyiLxR2WCmUYF/Cmxuo5bvFzMzrzMX/8iia7rO+ta1T9zVHbzs/dn6OL+Ubi5dlS/TyfomIiV6FbH+bTGPm7YtjxLvQkGG5VY5PwM/rd9EkBR9bRSeALm2Uu3mYIzI6cJGgRcwaqPgdrmnC0EhYqArcPwg2BdflxHL18iF1Xt6W7kTeJ+td4gQnr3iG1PVzzQ8PtF8DXPZCDB2PQPMVn3ALIomfwl9AW893B/czUpBQ7bQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZLrFr57HupA6O5T8cpvT38WQofxfu8AoxEQNbqZIasQ=; b=WkRjQg6EcvzHqxG/suHzH7PYb6T6raUeDk8HtQ8bUGIAjx465Y8b4QFuliiqlBPQUEUs5SLQAVyNDUaRmaix7N2vJ2QExfEwCb8LMYPDuEO0pFklkhvSTix5ugXON/gPnX+qeyOQHwnScHiUHsXwPSCYTzVDAmNplxgYnqIqlu0ytwGhBiYn5juVelDKKwrI125hDQkKLT/lFufyXtHRlDteSUDpvUjVG1+FQ+pkvKqxTugfPDj+L5gpFwXnFGjQYdYlzG3YK22PaDQlD+faTuFh1yTK38pO6BSb+w0IWJVCEokMX5xqYmlVN+bTkAGUPNb7KkGdt5I0vsvMmYtlsg== 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=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZLrFr57HupA6O5T8cpvT38WQofxfu8AoxEQNbqZIasQ=; b=REAvmaZfZ9uggjWVJmkjHU5XLBs/t7i6NRelmx/kS2tGlZPhwWahjBLeM0McBqS0RceMFPcKRjV3AuELTOB8Eq4FOp1yps1V4PqHEELuop5f871MofICFa15cOCvv/wL6vaCbBaJhHdvFClklh7t0jiTvbIno3dx738ZvV7rFKo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from DS7PR12MB6263.namprd12.prod.outlook.com (2603:10b6:8:95::17) by IA1PR12MB6164.namprd12.prod.outlook.com (2603:10b6:208:3e8::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.26; Mon, 7 Nov 2022 22:29:46 +0000 Received: from DS7PR12MB6263.namprd12.prod.outlook.com ([fe80::6f5:7c8f:32d9:e72c]) by DS7PR12MB6263.namprd12.prod.outlook.com ([fe80::6f5:7c8f:32d9:e72c%3]) with mapi id 15.20.5791.026; Mon, 7 Nov 2022 22:29:46 +0000 Message-ID: Date: Mon, 7 Nov 2022 16:29:44 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Content-Language: en-US To: Jim Mattson Cc: x86@kernel.org, Borislav Petkov , Boris Ostrovsky , Dave Hansen , "H. Peter Anvin" , Ingo Molnar , Joao Martins , Jonathan Corbet , Konrad Rzeszutek Wilk , Paolo Bonzini , Sean Christopherson , Thomas Gleixner , David Woodhouse , Greg Kroah-Hartman , Juergen Gross , Peter Zijlstra , Tony Luck , Babu Moger , Tom Lendacky , kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20221104213651.141057-1-kim.phillips@amd.com> <20221104213651.141057-4-kim.phillips@amd.com> From: Kim Phillips Subject: Re: [PATCH 3/3] x86/speculation: Support Automatic IBRS under virtualization In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: CH2PR12CA0017.namprd12.prod.outlook.com (2603:10b6:610:57::27) To DS7PR12MB6263.namprd12.prod.outlook.com (2603:10b6:8:95::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR12MB6263:EE_|IA1PR12MB6164:EE_ X-MS-Office365-Filtering-Correlation-Id: 3d6ae764-1082-4103-7d38-08dac10f9315 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HGmnFqxxW2f8Z9l4Z91BOxYOY7n1LzbBu+5+BCUd62/sJEl58r6jaQCqpwDfqc2bMcVuIseBSW2n/Y+iUxTTYXE6qmzh+11EERRNH4yFG+h5HEYGthP32ciySDIeMDvCl9d1gK3DMXlYBV59+bl/E19KJA5RDQfilVJ46LxCc3j5pli0062Xa59/+OMV25ARcRpkysBaf3JEwrbj1cK2ZWil7WztduQLV8zrZjqnqloOEY7wIGhQQf+heBl6Fc/t7+BFycK+mIU5k7fJJF/p/cmUnFaoorSnf/G7o2gci+X/RGd08PVBb/w9qegd83pwv0ORV9e1to6BodK+vLBBFbq5izbIUEzEzERvU95EHumE7rYOttgxMNDoTWQWegjJ3B5GluSp19j2TZJKmeTGmMeI3v7Tb0qAadNH3bz9yc3X84Xhz7vENq5F5GYOD9apwvvhK21xJpMe4SSkBv6E0M5F7sAQ+MXMcXimkwwpFYW3ge/hvF7Q4ofC4ApZaYtC+oTlMFXWp6PH1jvM0zSESJi2xt5JEI+ZT0ToBRMTNx6dyT2DXF/3pfASP+hxRN42ztrmc9qN5hEnIcYu8PYrP8NUvGheISpAi0MCfmT6lEUm3JWz4QP7dYylpkOAjsImPLnanDTxgV8PvlaFeRh/84z7xLQkYyrAbEjC5s/FgAQm7+05xtFaAuOQzqAlS79ovPEqofZml55m4yLefSC8GQSGGjj1b51uIdz+okRrCrGrIZhenTMmTROuyGt6Jro+qVw4aOhabnWBpRTRHcMlbaFUugKy+UMK/i6qpwUlTEg= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR12MB6263.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(346002)(39860400002)(366004)(136003)(396003)(376002)(451199015)(6916009)(2616005)(186003)(41300700001)(38100700002)(8936002)(4326008)(8676002)(66556008)(66476007)(5660300002)(2906002)(44832011)(7416002)(54906003)(6506007)(6512007)(53546011)(26005)(316002)(478600001)(6486002)(66946007)(31686004)(86362001)(31696002)(36756003)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?SkQyb3V3YWZoWmZ1bXNOZUNLZUd0U2xLcEI5QXJtSURVbDlXZmw4Y3RLWXhI?= =?utf-8?B?NXQ5ZzY3YUVKU08yVjZZTVB2NGR5clpybXNnWDRlY0g0a1huaUxydGpQZk04?= =?utf-8?B?MWpRb3htcGExVEkyYTcrVTM3ZW40NWRaM3c5VHR0SS81b1BwVVRVaTIxRUI4?= =?utf-8?B?YUZkWkxDRE03cmNkYktqd1B0THkxblAxaytLU25hRUZKSUJGdlhuYlNScHlV?= =?utf-8?B?Sk51SldyanY3UlVodWlYRVdGSFBYdE43aUZCQ2hINGZQS1RkTXFGWndBTzEr?= =?utf-8?B?czdwOHNFVnNBRm1LQlRuUkY2bWt1UFJDMVZnM2R0dit3U2V0dFdQdzYvZllE?= =?utf-8?B?c0dRVGJIdGt1MmN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enant-Network-Message-Id: 3d6ae764-1082-4103-7d38-08dac10f9315 X-MS-Exchange-CrossTenant-AuthSource: DS7PR12MB6263.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2022 22:29:46.4227 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /MBCb2txAiCiPaQKNryHxI3t5I0Jc+IS3q6nrLFIPlxOOsQVj1BNuTXDulqg/xT+IpeDZ9+ocWDNZYVAWvAqTQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6164 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS 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 On 11/4/22 5:00 PM, Jim Mattson wrote: > On Fri, Nov 4, 2022 at 2:38 PM Kim Phillips wrote: >> >> VM Guests may want to use Auto IBRS, so propagate the CPUID to them. >> >> Co-developed-by: Babu Moger >> Signed-off-by: Kim Phillips > > The APM says that, under AutoIBRS, CPL0 processes "have IBRS > protection." I'm taking this to mean only that indirect branches in > CPL0 are not subject to steering from a less privileged predictor > mode. This would imply that indirect branches executed at CPL0 in L1 > could potentially be subject to steering by code running at CPL0 in > L2, since L1 and L2 share hardware predictor modes. That's true for AMD processors that don't support Same Mode IBRS, also documented in the APM. Processors that support AutoIBRS also support Same Mode IBRS (see CPUID Fn8000_0008_EBX[IbrsSameMode] (bit 19)). > Fortunately, there is an IBPB when switching VMCBs in svm_vcpu_load(). > But it might be worth noting that this is necessary for AutoIBRS to > work (unless it actually isn't). It is needed, but not for kernel/CPL0 code, rather to protect one guest's user-space code from another's. Kim