Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB668C74A5B for ; Fri, 17 Mar 2023 18:07:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230457AbjCQSHi (ORCPT ); Fri, 17 Mar 2023 14:07:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230378AbjCQSHf (ORCPT ); Fri, 17 Mar 2023 14:07:35 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2088.outbound.protection.outlook.com [40.107.223.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D084EB4210; Fri, 17 Mar 2023 11:07:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C2ULpo+busEXxVnGuFIOY9gXIglmgtKyxzJ+eRUACrXIaCbyrNJkw6JDiuWR4leiJSscWSIUJgRv8HmsEHvmlY8VYvVZASnZSq6bMznyIFwzjAZlEGXkNqHkhcTkLC/wN9gBrUg0bpRWFMVHQ+Ke6lIBgL007zFrefnYyMmfdt+OS95XMQNJVw3CZj3jPB7mSz44PAW/jkLoHL7WOpMos2ve+Y/+a1lXfzUCAaX/5TFvQThWcVHE5RP/gVesoojRAt8eMM2JS36mLRZ/Kr9j1FAw3TPTHXht5ViSOG5TNAvGXV00w/4OlqseTjbJ+09ppI+RNdqo0Z/WhNtCquk62w== 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=3rv1/Yha0iQPYcOelk7B4mjzryJLb5l0YBYSRgG/rL4=; b=K0Q953+yp3ti6I9xRLPTJxZxc8E1A3/a6M87kv1WSTT7KP6qVL90r29CL0PR6+b3jtoCw5xxJR7yGGVf8M5UXf7NZrN5FT3UDGxK2P8VrxTSkhPtO8FwKoQq78sr5CRcOomdzW8lT24/hykoEpjOBI+xR3LwuDHjZd4DFaOmIVXrWDhL9MoIoTLS9H7kDAoPl6LNpodE57A45hB6Pe3jcqVujtN0e574n8k42fWolc3DuFaflUrnbseo5i0l+4y35QIbPY4/FbkGuTYRiJ0iHsCf1R3vfD9w3ZWNu/D0Llaa0PDTHmFMQCNB1uvpY/aKglDGDu1O/DsAiwWpzQVhVw== 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=3rv1/Yha0iQPYcOelk7B4mjzryJLb5l0YBYSRgG/rL4=; b=2C9Tmh/cwNZdwZttW7PH+qMDsoa5V0rzKY/IG61847k0xX+V9bhYpVtpAkYWiYiZSuF+XqywZOHnWzm4zMKP6at3bmfnCJCS56dx/HWAgu+yEU790k+duE7q8/Lv53NNH9cEbI2gbY7u6oCpA0yshPoXAYkIi54q+yR1r0HBJno= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) by CH3PR12MB8583.namprd12.prod.outlook.com (2603:10b6:610:15f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.35; Fri, 17 Mar 2023 18:07:04 +0000 Received: from DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::5b56:bf13:70be:ea60]) by DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::5b56:bf13:70be:ea60%5]) with mapi id 15.20.6178.035; Fri, 17 Mar 2023 18:07:04 +0000 Message-ID: <54a4ca2e-3389-dd48-1d1f-8b385fbfc0cf@amd.com> Date: Fri, 17 Mar 2023 13:07:01 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: Does earlyprintk=ttyS0 work for an AMD SNP guest on KVM? Content-Language: en-US To: Dexuan Cui , Jeremi Piotrowski Cc: Borislav Petkov , "sandipan.das@amd.com" , "Gupta, Pankaj" , "ray.huang@amd.com" , "brijesh.singh@amd.com" , "michael.roth@amd.com" , "kvm@vger.kernel.org" , "x86@kernel.org" , Tianyu Lan , "linux-hyperv@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <20230216091431.GA10166@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> From: Tom Lendacky In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: BN0PR04CA0024.namprd04.prod.outlook.com (2603:10b6:408:ee::29) To DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR12MB5229:EE_|CH3PR12MB8583:EE_ X-MS-Office365-Filtering-Correlation-Id: c160acbc-64bc-48e6-48b6-08db271269dd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: o/LBoUYkz3kd+Sgm/OoIdxu/vSAY+a9LTo76DUDwe2LJ6C7cJpyWVuooiVGX8jmcC6p/P5V8oml/RmTAWaOBRFzK1dPhtLn44BrBSK1gmWGpHg7t/ZIRVekoMsKt9SMEZgmakgY4hvz3JNwk6e3EXiKzI+FeYFyW+Pi7a8oeZqN2o1EE0Rt4gIUa8ZTmkvBMHneQ543sHwRvTDzQ6XoZlhahGHhsuNqRgxXNklsJtm07gPxkH4mWnKcGgZpgyUj2XRJmASMALvD4CRRJASWTvIlgxWg0BsgvjNdzCqtK5Gm8CoZUoyjdZlZ2tmkt96H6//30YhDXW8RRYCmVkMR/rcwJqFaZumDBK8abqwB1MLZJ5ChbaAcb0mxNRUBGsqZQk50WbgmAaGYZolZVa1LyoTtwqvMrd60ijE2yD45Rj1p6i+1eaAXRzD8sbhEmvQoz2C4kuYngo1t5oQvesO7i2KMfVJKqkY8Wpr3KY3lPmleJEwlkSV7sCv/FL/tsGciK3FBqZS432Wt/VyqdP2dlaHomAKHhM9sfE2wj4MekI/3W7gsAM3I05Y3NoLVqEoadNATsKopWjVb8buE23XpTUEPHAGpPCPM+0JHJtO1OCyY4MngBKQsQNph35COGqQl7LXC+pFIIAjZ7wLjWKkz55j5dXt39puMGRLUpMqRmryybgifg2qT0SBnUFUYW9kUqF1nlFC04so8MVRz7Rzwx76hVzJZE1x1beAonFLiG0ls= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR12MB5229.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(366004)(136003)(396003)(39860400002)(346002)(376002)(451199018)(38100700002)(6666004)(5660300002)(8676002)(66946007)(66476007)(4326008)(316002)(478600001)(45080400002)(83380400001)(110136005)(66556008)(54906003)(8936002)(31696002)(86362001)(41300700001)(2906002)(36756003)(6486002)(53546011)(2616005)(186003)(31686004)(26005)(6512007)(6506007)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?TzI5Yk4xa3NyTjFaKzQzZU5NNXJ2SUNPNm0wNXpyelZuZzlRRU0zUXBrZFg3?= =?utf-8?B?VzhFV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cyUm00RFN0aHJibDJX?= =?utf-8?B?UWtaUWpYODhmdHlROUR6UmR3YkgrU25FWE1tM0FaNXBEU3RQaC9IVVhZdVdn?= =?utf-8?B?NlBGeFRnOU13eGRSM29YTGNBc0R3TXc1QkJEMzBTYXI1WmxkQTJMTHhqazdZ?= =?utf-8?B?Z0l0QmRlQ0NJYUFZamJUakhwZnhHNkdCbVcweXUxV2NpckllZzczZnlyZlp2?= =?utf-8?B?d0xMeHc5ZVppQncxZkJqeWJtUHZQNXVJMWlsWVIzVkE5K3JoOS9KR2J6YWxC?= =?utf-8?Q?VGmAx1X8joemJd3JVT9EdqdVH?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: c160acbc-64bc-48e6-48b6-08db271269dd X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5229.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2023 18:07:04.3779 (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: 6cx9CT3ZlU5kyQI2DXNfdBLEifiI+8dvcg9rTXZ5IH8MYZLyI2d8D3ITwBMf6A9eM0b6W3gK54eu+U1ifUN8OA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8583 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/17/23 20:54, Dexuan Cui wrote: >> From: Jeremi Piotrowski >> Sent: Friday, February 17, 2023 4:51 AM >> To: Dexuan Cui >>> [...] >>> The comment before the first branch says: >>> On 4-level paging, p4d_offset(top_level_pgt, 0) is equal to 'top_level_pgt'. >>> >>> IIUC this means 'top_level_pgt' is equal to '_pgtable'? i.e. without >>> CONFIG_RANDOMIZE_BASE, pgt_data.pgt_buf_size should be 0. >>> >>> Not sure why it's not getting into the first branch for you. >> >> Sorry, I got two things confused here. The relevant part of the comment is this: >> "If we came here via startup_32(), cr3 will be _pgtable already". >> >> Booting a (non-SNP) guest via BIOS I end up in the first branch. Upstream SNP >> support requires OVMF (UEFI) so we'll always reach the kernel in 64-bit mode >> (startup_64?), and end up in the second branch. >> >> Jeremi > > Here I'm running a C-bit mode SNP guest on Hyper-V via "direct-boot" (i.e. > I run Set-VMFirmware to tell Hyper-V to boot the kernel directly without > UEFI). Looks like arch/x86/boot/compressed/head_64.S: startup_32 runs > first and calls startup_64 later (?) This might explain why I'm getting into > the first branch, which I hope could be fixed by someone... It sounds like there aren't enough pages available to satisfy the page split in order to make the GHCB shared. Have you tried changing BOOT_INIT_PGT_SIZE to increase it by 1 page. Splitting the page will require an additional page table, I think that is all that would be needed. Thanks, Tom