Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3596278imw; Mon, 18 Jul 2022 10:55:12 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uanIKhBbi/2uameKXRzP1wyWMJ99VV+oQk+oLstBOPHOl7P4TknFSq2AsHHT3Ou8ni7FMa X-Received: by 2002:a17:907:a0c7:b0:72e:dc8f:ad2b with SMTP id hw7-20020a170907a0c700b0072edc8fad2bmr21294194ejc.163.1658166912339; Mon, 18 Jul 2022 10:55:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658166912; cv=none; d=google.com; s=arc-20160816; b=yJ/48cJkCWo+sdZvHPN9q2kpf7ep21E/kbqS6xbKdBBo/AyHeH9dAwPY19V/HqysfD zglkWIc/9ezAUe+LOwQeIXaYKl1FoiI23wpk1x/IRfOnDdQwC5vzlzgpbAbolsduUxn9 LtB4z5piQcQBF7FwTjQCF6FkD15tu2RGmlek9PF9cR2t1Go+tu1TyJlSC+Mom9IrDYOW HBgAICMeKfkotOHhbdElwZoP1KG8cAhKGUOXoVb5OknKq03EgR37mibLG7a0U39ZCAv5 /Tuciaqc+99EkkP5pFkiWud9z3ZZabExLEcjsUvVTTnAHiL+uVWIXPq2wA1wMoR58JDN TTnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=upYxRyCl4Dv8rb0L1QrfbwkXi78vbU1ziRE0ttlUg4o=; b=ivziGFrdrfn4JN3+kSxK70tGXcucv69ICBA1AjQSI+TaEUdY0JMuFeafRJEX27wwY3 GlOEroQhTGMbnqr2yqz7XjMNrbHqz7HoxJtdFIeKzWXPdjRFv2wzeNq653t8saWijrdh FwyA2enWT6CM6tUFEhq77e24x4IqYVMKr4Aq4WK/H0CYwuX8vga//tEYvZsge1aXiarH QMCTU7VFJDdjjLLHCK8PnEeNXGycZmdYeOTqSMCFdPy4newyLnHIyTwlSwZGfiuViuZL EQZ7iEs2A//jmKeCluA6JlSUhJmB2dkPHh+4nD4ixfc0BoU0aE0u6wL+mSwDeq3/W9ox ylDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=frHo065U; 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=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr21-20020a170907721500b0072f25c0af5dsi6763026ejc.135.2022.07.18.10.54.47; Mon, 18 Jul 2022 10:55:12 -0700 (PDT) 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=@intel.com header.s=Intel header.b=frHo065U; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235139AbiGRRWA (ORCPT + 99 others); Mon, 18 Jul 2022 13:22:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235078AbiGRRV6 (ORCPT ); Mon, 18 Jul 2022 13:21:58 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0A2F20188; Mon, 18 Jul 2022 10:21:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658164917; x=1689700917; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=XQ2y1/VlwCd334Ie2B6PhFqb8Le129sl7rpEk9foass=; b=frHo065UwpAQkSQjfVbMyWLapZKBCBIWzErg1qnew1r9jSq6OBJu/NT8 GCP5oAPLEFKLpQcVhZuBg1VBat5Xgj2HPRiQKpH4GzPzJfW+m5k+j84h6 QpSee1HOGnYPVZ4avO9yVYdqg7YGqCncwJTmRxUTvuuo9ScpQ8UPdslLH kLahsxJAidAOR9LhsdXNo73w10Zh5DSDQjSXcM5Ib2LznGz9Lr8EA+75r Fmnp+0V74HuH0koBPNAayThKDln7HYFr35RZQVlq9fxi30hS7XYWaJIaK DJE9LoeNnSIwY+/Y10ZFmnjbcFX+oUJ1bHNIlAciW+j1ldJgZDhpQbpsT A==; X-IronPort-AV: E=McAfee;i="6400,9594,10412"; a="350235845" X-IronPort-AV: E=Sophos;i="5.92,281,1650956400"; d="scan'208";a="350235845" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jul 2022 10:21:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,281,1650956400"; d="scan'208";a="655374923" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 18 Jul 2022 10:21:50 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id 4FE9410E; Mon, 18 Jul 2022 20:21:59 +0300 (EEST) Date: Mon, 18 Jul 2022 20:21:59 +0300 From: "Kirill A. Shutemov" To: Ard Biesheuvel Cc: Peter Gonda , Borislav Petkov , 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 Subject: Re: [PATCHv7 00/14] mm, x86/cc: Implement support for unaccepted memory Message-ID: <20220718172159.4vwjzrfthelovcty@black.fi.intel.com> References: <20220614120231.48165-1-kirill.shutemov@linux.intel.com> <20220627113019.3q62luiay7izhehr@black.fi.intel.com> <20220627122230.7eetepoufd5w3lxd@black.fi.intel.com> <20220627223808.ihgy3epdx6ofll43@black.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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 Tue, Jun 28, 2022 at 07:17:00PM +0200, Ard Biesheuvel wrote: > On Tue, 28 Jun 2022 at 00:38, Kirill A. Shutemov > wrote: > > > > On Mon, Jun 27, 2022 at 06:33:51PM +0200, Ard Biesheuvel wrote: > > > > > > > > > > > > > > Just as an idea, we can put info into UTS_VERSION which can be read from > > > > > > > the built bzImage. We have info on SMP and preeption there already. > > > > > > > > > > > > > > > > > > > Instead of hacking this into the binary, couldn't we define a protocol > > > > > > that the kernel will call from the EFI stub (before EBS()) to identify > > > > > > itself as an image that understands unaccepted memory, and knows how > > > > > > to deal with it? > > > > > > > > > > > > That way, the firmware can accept all the memory on behalf of the OS > > > > > > at ExitBootServices() time, unless the OS has indicated there is no > > > > > > need to do so. > > > > > > > > > > I agree it would be better. But I think it would require change to EFI > > > > > spec, no? > > > > > > > > Could this somehow be amended on to the UEFI Specification version 2.9 > > > > change which added all of the unaccepted memory features? > > > > > > > > > > Why would this need a change in the EFI spec? Not every EFI protocol > > > needs to be in the spec. > > > > My EFI knowledge is shallow. Do we do this in other cases? > > > > The E in EFI means 'extensible' and the whole design of a protocol > database using GUIDs as identifiers (which will not collide and > therefore need no a priori coordination when defining them) is > intended to allow extensions to be defined and implemented in a > distributed manner. > > Of course, it would be fantastic if we can converge on a protocol that > all flavors of confidential compute can use, across different OSes, so > it is generally good if a protocol is defined in *some* shared > specification. But this doesn't have to be the EFI spec. I've talked with our firmware expert today and I think we have a problem with the approach when kernel declaries support of unaccepted memory. This apporach doesn't work if we include bootloader into the picture: if EBS() called by bootloader we still cannot know if target kernel supports unaccepted memory and we return to the square 1. I think we should make it obvious from a kernel image if it supports unaccepted memory (with UTS_VERSION or other way). Any comments? -- Kirill A. Shutemov