Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp176667pxb; Tue, 31 Aug 2021 18:22:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9ODpMkwKX3ZOIuhSJHsEJ7ECwTHzg1CNy2x4GHpd+XB6WEmwnlau/U67Tadc85ZQ7Kz2s X-Received: by 2002:a17:906:bc89:: with SMTP id lv9mr30245383ejb.110.1630459347688; Tue, 31 Aug 2021 18:22:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1630459347; cv=pass; d=google.com; s=arc-20160816; b=hB/5MAol9I44bhJ9twLq6SZFlqQBfxzVC/GLszgHlqGKnis97pDawoP5HiuOZYRhEf DpTY9vbIOfYY6fVDDMKOMauBJNVa5ekb3e15koqWEdMS2+MjqjlmHwyx8hZBQnyYG00n x+jUuL9K1LMWTlHAGRBvrfespnaLWX/Jr8DOc7bUvaNr5wjq9xANLj7Qjz6mNTbLqkWq aCI4k+RsvYVUi6fBQ95O/r45qL2BMGeUGBXTms8xN96LtxNYBcJkDy5RopCXK2Sbs1sf xmaONwwN6a3ZUVR3bYGizbd5QLuz9BGCXKcvAM2blNqYjDg3VlLc47gzxwrxHEbIU5pe Vj8w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1yelLIWaMCkgIfaz4DqO6DMFkOWziwSNxaALSIEaMLY=; b=CbiNb4b9USNMYSklXZ+xzeyxN2spXftDDVW+6wMEUqZkSfHtMXNsXGjz7pmkoLyfZp sHVjDXj7oT33/1hI/x3ENdS5UbtDwfimSVKux8KJWjMVBcxOZ4o2y5hiAtt5MGEKKltJ fFQMfs5zFMZn+bIMfdRm4CWTbigUM1/Ht3BoMduWSG6Ujnvhbab5RrHQqDRExFdqRH/E w52YnDz2OnaWAU99Bwcr5kVAfSr8rL7Ya3ZsMK1BG31kiOpLoII2ymuLFa0jiGCmEk6J x+jNcBdV11g9vnYyc1K5BE9Z4NEDU8U1enWoPBvHsph4fR4eUJRT7PUri870GU6UYIQs H4aQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="coTwRjk/"; 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 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hk6si18098943ejb.587.2021.08.31.18.22.02; Tue, 31 Aug 2021 18:22:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="coTwRjk/"; 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 23.128.96.18 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 S241577AbhIABSI (ORCPT + 99 others); Tue, 31 Aug 2021 21:18:08 -0400 Received: from mail-bn7nam10on2061.outbound.protection.outlook.com ([40.107.92.61]:22525 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S241207AbhIABSH (ORCPT ); Tue, 31 Aug 2021 21:18:07 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OqABQwOT56ilksc1BhxYT44RxmWqtvuqg/b31fpOI81o+tRprPNk73L6gBMofiKpUE2bbJ0b+LloFFfIUrnzx586RRjhKEzYQb1gXJhDQxaXgps8OuSss001mYWRkSdErLS0CdlgfXbhNxf6+iPUc5cfOJ/V3Mg/uON6pVc5mPuBkckb68xyjHByElUgJCh6uldkvJLRjCmGf72aF6i+pOBE7VSrs92JmLYj7s4xi5dprgfVMLeMx79x3PqPF9R2BH+i7KdT1TiiNKc0KhPpuYOqpqPwKd2pktC57iCP/3VIiDURUj5rthv9GP/CHFgjQ0bRo/St6i4uc364E08OfA== 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=1yelLIWaMCkgIfaz4DqO6DMFkOWziwSNxaALSIEaMLY=; b=YntwTCVlDt1LuzKs8w4uRtj0aI6vQbD5Pd29E+e8sYRpU47cReakihlrZaU5WpASyxyq4oPu7BqC22tte74UYFHj4YqghRR0leAHhKoHwiBvR8ajdpdYZAst0krb83NuBzJjvCugMdH/FV4rS7+S3LCgWfrWxzUUintKz/O7S/2enjCX4K6cYrV/eCex/YnthHhVg4SjsZXWtEQv/54j7RlKnUaMI5Iufj7e3lc/u2j/T50eMyiAvVwXFihWBIlemNgpwXTnxnD9VwBP40jL7iTgXCWQjmpqGPMF65YNg5GYDBzAJU+bmkuCcAJ2V2h1zk+7zyJ26rqBdTqc1wMaDg== 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=1yelLIWaMCkgIfaz4DqO6DMFkOWziwSNxaALSIEaMLY=; b=coTwRjk/raNWdXUrFaIGJHfuj7bxChPWg1ZcsiS5cd6zf+CHHy5l/dPns0EModNyxzTZKOBq+EhY+hr0ESsZfbjKP6WX4nghR7wxBZEAfk+8XVvFp11W6xVyUxks+BjMnHQZbsVSoeLzxT5xgqZILNIPwjm4Tvk94e11tbf/SM4= Authentication-Results: alien8.de; dkim=none (message not signed) header.d=none;alien8.de; dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4133.namprd12.prod.outlook.com (2603:10b6:610:7a::13) by CH2PR12MB3959.namprd12.prod.outlook.com (2603:10b6:610:28::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.17; Wed, 1 Sep 2021 01:17:07 +0000 Received: from CH2PR12MB4133.namprd12.prod.outlook.com ([fe80::f5af:373a:5a75:c353]) by CH2PR12MB4133.namprd12.prod.outlook.com ([fe80::f5af:373a:5a75:c353%6]) with mapi id 15.20.4457.024; Wed, 1 Sep 2021 01:17:07 +0000 Date: Tue, 31 Aug 2021 20:16:58 -0500 From: Michael Roth To: Borislav Petkov Cc: Brijesh Singh , x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org, Thomas Gleixner , Ingo Molnar , Joerg Roedel , Tom Lendacky , "H. Peter Anvin" , Ard Biesheuvel , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Andy Lutomirski , Dave Hansen , Sergio Lopez , Peter Gonda , Peter Zijlstra , Srinivas Pandruvada , David Rientjes , Dov Murik , Tobin Feldman-Fitzthum , Vlastimil Babka , "Kirill A . Shutemov" , Andi Kleen , tony.luck@intel.com, marcorr@google.com, sathyanarayanan.kuppuswamy@linux.intel.com Subject: Re: [PATCH Part1 v5 32/38] x86/sev: enable SEV-SNP-validated CPUID in #VC handlers Message-ID: <20210901011658.s4hgmvbptgseqcm3@amd.com> References: <20210820151933.22401-1-brijesh.singh@amd.com> <20210820151933.22401-33-brijesh.singh@amd.com> <20210827183240.f7zvo3ujkeohmlrt@amd.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: SN6PR01CA0031.prod.exchangelabs.com (2603:10b6:805:b6::44) To CH2PR12MB4133.namprd12.prod.outlook.com (2603:10b6:610:7a::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost (165.204.77.1) by SN6PR01CA0031.prod.exchangelabs.com (2603:10b6:805:b6::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.19 via Frontend Transport; Wed, 1 Sep 2021 01:17:06 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cefba45e-34cf-4c81-0dff-08d96ce636c5 X-MS-TrafficTypeDiagnostic: CH2PR12MB3959: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: t7TX3NCRV+ATbmgQaGqaaq9dXFxLUvt9u3o6/PQQ5V/9SErHr+sw9kUmxOgcMErJH/Cbc3++qiRyEfC6sJ6Q02XapSazQp1es8xLZqQ+f188Jm7F8Z7v4IafO29r7437ZmhEwYLpTluuaRcKi/BXZqN3T5uK27YivGnBsafO+aLobvGt19W43d+E8hEGqYw4gGRwAbohLfhoRVjMYavMFVe8nb9c/RQwswqSo4osIG24EwFJIPLo5cSZYMfubn3P8rhD+dGmRe1M2AlHf/e0gIfnTDUPHL+ffqQcqtXbxUhAhrgAmk6F3S+0nWbbv61EPZ5z1+fnC/0KoD8q+0DIQAWgrW9mTW3eT8MEhIdM6mWgcFudGxqnunaf1laAoOvDlqyGmpAZvff/APAGVZTrmhWr5lorPsShrlhQSZYjRS+OmYWi2wUVsrpTAZaGc6KnoHCT418MEfjx+DWz9PtNpM18K/M4rtppG7wlJkyK6pQaPRZE3yTLn6UMaAux5ynbFhEIkllT686PjcXx0OQ9GHjT7/Bz1XqczKWbLeH/vWcNi4Vvd5YBtUt6LLxVYm/fCUUEGpxzYtfsw8I0A8o1HjGDLeSJ306ZCgYZ6GYKClb3VJtBbTfZv1rjE77x/lSUPMoV8KQM6rWxQ+db/GE55hRfFoFAxfQVLQsoBIqHbmwt2NLnXJgQPwi0UhbE8zto1RNxxC/P+TxT0izdRrKQ+52bbBCOXT8jDaaL/pem8RLuvSfMFv5eezNb0s4hk0SNMFQ+xTbsS+raP0sLzMclxw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH2PR12MB4133.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(39860400002)(136003)(346002)(366004)(376002)(36756003)(66946007)(66476007)(54906003)(6496006)(44832011)(45080400002)(52116002)(8676002)(1076003)(4326008)(26005)(186003)(83380400001)(6666004)(478600001)(956004)(6486002)(86362001)(2616005)(38350700002)(2906002)(966005)(7416002)(7406005)(5660300002)(8936002)(38100700002)(66556008)(316002)(6916009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?9ekcKrei8q6JG5V9Q+w0zYk2jLj9ZHBVYI3E6glVzu5H87g7A6coir5XqqRu?= =?us-ascii?Q?1Xodn6T7SoBIfvLEKnyPx7HfA6sOndQl+j4+3uq8HH/cXJn/Ca8GdiHUMTAi?= =?us-ascii?Q?HXcviPwBxInoWHNKNU/vqqF2kaE538VBA30rCbyY6vrZFoH9l314nVMIkkf0?= =?us-ascii?Q?arfl4e6RCTNdlkeeA09XFZXBwC0pIaa8sMHxNoIloPoj4LSpdYjQ6iYkygQ3?= =?us-ascii?Q?1M8OPJ9VxtrlA+F1YV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Q?VyFAbHLmOa7eo5hYmIdDT2vRezsgXy7ZewBy9PNjE9ThePlivrqJVhTXOWlF?= =?us-ascii?Q?5jK+A+Shzvcjo8rhd1nh+GKohHAESMsdpbMsVXO1dRAuDxhSMNrk9jMQAMgg?= =?us-ascii?Q?azsv+g9yUIsQ7pExkcVeC+tS+jUAwHYLKkeofU8Ad+fZ80unh65S/3S6/uyh?= =?us-ascii?Q?V+gXu0+DZZZaXei5mJg5HB8C?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: cefba45e-34cf-4c81-0dff-08d96ce636c5 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4133.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2021 01:17:06.9047 (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: /98pKlYnxJxdyxazVQ0oysgGsstB19EgXyYso3eABL7e8exl/r4LEQHkeD62y3eTBdvLAf7kJujpa+gcZuOtTw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB3959 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 31, 2021 at 06:22:44PM +0200, Borislav Petkov wrote: > On Fri, Aug 27, 2021 at 01:32:40PM -0500, Michael Roth wrote: > > If the memory is allocated in boot/compressed/mem_encrypt.S, wouldn't > > kernel proper still need to create a static buffer for its copy? > > Just like the other variables like sme_me_mask etc that file allocates > at the bottom. Or do you have a better idea? What did you think of the suggestion of defining it in sev-shared.c as a static buffer/struct as __ro_after_init? It would be nice to declare/reserve the memory in one place. Another benefit is it doesn't need to be exported, and could just be local with all the other snp_cpuid* helpers that access it in sev-shared.c > > > Would that be a reasonable approach for v6? > > I don't like the ifdeffery one bit, TBH. I guess you should split it > and have a boot/compressed page and a kernel proper one and keep 'em > separate. That should make everything nice and clean at the cost of 2*4K > which is nothing nowadays. I think I can address the ifdeffery by splitting the boot/proper routines into separate self-contained routines (and maybe move them out into boot/compressed/sev.c and kernel/sev.c, respectively), then having them just initialize the table pointer and create the copy using a common setter function, e.g. snp_cpuid_table_create(cc_blob, fixup_offset) and for boot/compressed.c fixup_offset would just be passed in as 0. > > Thx. > > -- > Regards/Gruss, > Boris. > > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpeople.kernel.org%2Ftglx%2Fnotes-about-netiquette&data=04%7C01%7CMichael.Roth%40amd.com%7Cb4adf700d33e42ffe4be08d96c9b7fe6%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637660237404006013%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=nVGIpG0WAcqcHZWXK1%2BQoaPBoeCLwtkqgs8Mfgz%2Fr04%3D&reserved=0