From mboxrd@z Thu Jan 1 00:00:00 1970 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2DD9C43334 for ; Tue, 19 Jul 2022 20:45:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D8B2C6B0071; Tue, 19 Jul 2022 16:45:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D114C6B0073; Tue, 19 Jul 2022 16:45:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B8B6A6B0074; Tue, 19 Jul 2022 16:45:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A43816B0071 for ; Tue, 19 Jul 2022 16:45:21 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 72A4A1A0391 for ; Tue, 19 Jul 2022 20:45:21 +0000 (UTC) X-FDA: 79705029642.03.A966E9C Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf07.hostedemail.com (Postfix) with ESMTP id EB83D4005D for ; Tue, 19 Jul 2022 20:45:20 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A1F7661983 for ; Tue, 19 Jul 2022 20:45:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D95AFC341CE for ; Tue, 19 Jul 2022 20:45:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658263518; bh=is8+ILmv9PejEMf4YjQ/EARYt+ria3kqCNvGVtOmbyg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=EowHTKcabU5Y6iY9imocdt412ApdERqmzizE+EI4KudFJguFmk+GRKrJhurPVeI8Z nSMF39slLkIxdhwyrPXu/UpTO89iu74EMBbzaxDO2v5U3T2Pb9mqjfE4A0rVmO2qoP vdknq1ifx1jSFjAMBmeepNuGo+6slBs9WtmwqFEcIjuu0WPMImNZjNDLhvir24LDTW AmW93T2YxdJCuDHNGDUeKh8XdTUfGQxc6igy9M5o5dIEBTFPB1X9iWyRvY+OzIZs/u 8U/+RYkwFJc+Opl5SL12tfpCzdRgDP/mdKMEu3Bk059Tz7wIDMus7l46G5BUrmGbRz z+sDng4OgPnhA== Received: by mail-oa1-f52.google.com with SMTP id 586e51a60fabf-10d6ddda695so5659514fac.0 for ; Tue, 19 Jul 2022 13:45:18 -0700 (PDT) X-Gm-Message-State: AJIora+weztiQcLfaJiNidMvnXJPUfB9O6CC5I/a5myfHz+AhSBWz+CZ t8MfgvaiPm2WUV4mindfqHkr/+aPXJeUqOeKsPk= X-Google-Smtp-Source: AGRyM1sICwjAXSPoZhvHV3Kl2TfNBu9m6a+FLzUR2NSmzL9dkb7rG0rM0A03qKW8n7Vjdtf9rfc5bQfPyzgPrD82OAc= X-Received: by 2002:a05:6870:5b91:b0:108:374a:96b0 with SMTP id em17-20020a0568705b9100b00108374a96b0mr766142oab.126.1658263517968; Tue, 19 Jul 2022 13:45:17 -0700 (PDT) MIME-Version: 1.0 References: <20220627122230.7eetepoufd5w3lxd@black.fi.intel.com> <20220627223808.ihgy3epdx6ofll43@black.fi.intel.com> <20220718172159.4vwjzrfthelovcty@black.fi.intel.com> In-Reply-To: From: Ard Biesheuvel Date: Tue, 19 Jul 2022 22:45:06 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCHv7 00/14] mm, x86/cc: Implement support for unaccepted memory To: Borislav Petkov Cc: Dionna Amalie Glaze , "Kirill A. Shutemov" , Peter Gonda , Andy Lutomirski , Sean Christopherson , Andrew Morton , Joerg Roedel , Andi Kleen , Kuppuswamy Sathyanarayanan , David Rientjes , Vlastimil Babka , Tom Lendacky , Thomas Gleixner , Peter Zijlstra , Paolo Bonzini , Ingo Molnar , Varad Gautam , Dario Faggioli , Dave Hansen , Mike Rapoport , David Hildenbrand , Marcelo Cerri , tim.gardner@canonical.com, Khalid ElMously , philip.cox@canonical.com, "the arch/x86 maintainers" , Linux Memory Management List , linux-coco@lists.linux.dev, linux-efi , LKML , "Yao, Jiewen" Content-Type: text/plain; charset="UTF-8" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1658263521; a=rsa-sha256; cv=none; b=QaJAES448ug9rczqNpvmfkBtsu5nd8aqeZLSI9LOVG3+TzVgczXbJ+vISyzlYbQQIRDMd9 dNODoFgpB8/x5azY4tjaSE3LY8A7F86ao/dgIvwaFTGqnZ0ekfm3R2SHuVchGWDHqMND/R PQLpXXD/aA7cmIa0Jb02/4AnKTxxUHY= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=EowHTKca; spf=pass (imf07.hostedemail.com: domain of ardb@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=ardb@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1658263521; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=is8+ILmv9PejEMf4YjQ/EARYt+ria3kqCNvGVtOmbyg=; b=Ce+JI/vXsqaSEowRWAd2E0BK+6duwe8HVyE3x9JXfq28in7sUTTqowPJJzl/h00ff3DwDF kM6qPV767rgxVZbdJx/QbB0tsycA1VZlqBHqED0RqoLgPJeNlx4cwuc7XaR+S7oyETCH8k 9COj7+PpVdwg1B1dn7HadPsaK/WZemU= X-Stat-Signature: 6btbgcc8nzdi364f9qh3ci47whz7kgsb X-Rspamd-Queue-Id: EB83D4005D Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=EowHTKca; spf=pass (imf07.hostedemail.com: domain of ardb@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=ardb@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1658263520-255469 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, 19 Jul 2022 at 21:14, Borislav Petkov wrote: > > On Tue, Jul 19, 2022 at 11:29:32AM -0700, Dionna Amalie Glaze wrote: > > How about instead of the limited resource of UTS_VERSION, we add a > > SETUP_BOOT_FEATURES enum for setup_data in the boot header? That would > > be easier to parse out and more extensible in the future. > > https://www.kernel.org/doc/html/latest/x86/boot.html?highlight=boot > > > > This can contain a bitmap of a number of features that we currently > > need manual tagging for, such as SEV guest support, SEV-SNP guest > > support, TDX guest support, and (CONFIG_UNACCEPTED_MEMORY, TDX) or > > (CONFIG_UNACCEPTED_MEMORY, SEV-SNP). > > The VMM, UEFI, or boot loader can read these from the images/kernels > > and have the appropriate behavior. > > I think for stuff like that you want loadflags or xloadflags in the > setup header. > Please, no. Let's not invent Linux/x86 specific hacks to infer whether or not the kernel is capable of accepting memory when it is perfectly capable of telling us directly. We will surely need something analogous on other architectures in the future as well, so the setup header is definitely not the right place for this. The 'bootloader that calls EBS()' case does not apply to Linux, and given that we are talking specifically about confidential computing VMs here, we can afford to be normative and define something generic that works well for us. So let's define a way for the EFI stub to signal to the firmware (before EBS()) that it will take control of accepting memory. The 'bootloader that calls EBS()' case can invent something along the lines of what has been proposed in this thread to infer the capabilities of the kernel (and decide what to signal to the firmware). But we have no need for this additional complexity on Linux.