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 83859C433EF for ; Fri, 24 Jun 2022 16:22:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DAC718E0232; Fri, 24 Jun 2022 12:22:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D5C8A8E020E; Fri, 24 Jun 2022 12:22:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C23AA8E0232; Fri, 24 Jun 2022 12:22:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id B307D8E020E for ; Fri, 24 Jun 2022 12:22:41 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 8574F20C4C for ; Fri, 24 Jun 2022 16:22:41 +0000 (UTC) X-FDA: 79613647722.23.FE9E9E2 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by imf26.hostedemail.com (Postfix) with ESMTP id 71136140014 for ; Fri, 24 Jun 2022 16:22:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656087760; x=1687623760; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=xL3KlmHGWviM8HJoLAyDTXeAYfhn8TtCOi1g2QYm2Bw=; b=Fjcg4FAUciPYgVm0faLFE9cZER/pskoj/98fo2tqsLHivFWSTTA7Pjkc VIgxnWIr18ea1aw/N8IUz/fYrs0AD1b3dP3EZ+oy0YSZJjLGhxby1N8i1 xvnllVtxom7XC7SUMEjJ/p+bs9HWAzZ17hXDMzdvdamRndroMLmTF7551 c1PKll5lGTfrRuDhXk2ZOKMbv23yY+IQvpVw5UWnHgr9lrv3DFtP771Q4 H+v/K0ta/w06zMJ25YGWgA4oNvVuwKfCld7wAg/+FnpYLmshoiih1+pmw tfnMk7Rf8X0hiS5fMlMlPLSd6f0iwSx0IM5hx5oHq7ROhSDHhQCLhFSQA Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10388"; a="261457697" X-IronPort-AV: E=Sophos;i="5.92,218,1650956400"; d="scan'208";a="261457697" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jun 2022 09:22:39 -0700 X-IronPort-AV: E=Sophos;i="5.92,218,1650956400"; d="scan'208";a="731380192" Received: from mdedeogl-mobl.amr.corp.intel.com (HELO [10.209.126.186]) ([10.209.126.186]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jun 2022 09:22:37 -0700 Message-ID: <7c74e86e-295f-0958-cbdf-b54b4ca688dd@intel.com> Date: Fri, 24 Jun 2022 09:22:03 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCHv7 14/14] x86/tdx: Add unaccepted memory support Content-Language: en-US To: "Kirill A. Shutemov" , Borislav Petkov , Andy Lutomirski , Sean Christopherson , Andrew Morton , Joerg Roedel , Ard Biesheuvel Cc: Andi Kleen , Kuppuswamy Sathyanarayanan , David Rientjes , Vlastimil Babka , Tom Lendacky , Thomas Gleixner , Peter Zijlstra , Paolo Bonzini , Ingo Molnar , Varad Gautam , Dario Faggioli , Mike Rapoport , David Hildenbrand , marcelo.cerri@canonical.com, tim.gardner@canonical.com, khalid.elmously@canonical.com, philip.cox@canonical.com, x86@kernel.org, linux-mm@kvack.org, linux-coco@lists.linux.dev, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220614120231.48165-1-kirill.shutemov@linux.intel.com> <20220614120231.48165-15-kirill.shutemov@linux.intel.com> From: Dave Hansen In-Reply-To: <20220614120231.48165-15-kirill.shutemov@linux.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656087761; a=rsa-sha256; cv=none; b=uhkiSLKY3PEdIismHbhzHR76E+ctWAJo4UcOJ2q7ZY2hTny1kqfSEwnhBq3jlLFsbpCZTS 9yRj0rdfsNYBkh7SkrlNLowiu5HrVSvrKbZ4BS3fvhtw6jzfZ8CticqRjIMbxlWiJ+s0+f XPiNI4NNfsiVsKR7ijpO6BW0CAJEE64= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=Fjcg4FAU; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf26.hostedemail.com: domain of dave.hansen@intel.com has no SPF policy when checking 192.55.52.151) smtp.mailfrom=dave.hansen@intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656087761; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ZF41qte7gzesVf25/Nk0e0eUISeQXkiG26RFKUrkm7Q=; b=4iyiun+1B0RYk7dayzc5eZwnn0nKLL5J4AD+eHROzmo44/QRjICUnk0Zl4gNH62AsJa00e D1P0xUoma31V+X6befKVFiB727+axlNOi3qJJ+iySt7lSTHBbOoiMYpFXtwy+k1yDDM1Qz 2gxmRCtJnhtLZFCc++gIowhE0WXMcpA= X-Stat-Signature: bbwoin1ab7j514w4y889paojtpnqg9i7 X-Rspamd-Queue-Id: 71136140014 Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=Fjcg4FAU; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf26.hostedemail.com: domain of dave.hansen@intel.com has no SPF policy when checking 192.55.52.151) smtp.mailfrom=dave.hansen@intel.com X-Rspamd-Server: rspam10 X-Rspam-User: X-HE-Tag: 1656087760-722365 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 6/14/22 05:02, Kirill A. Shutemov wrote: > static inline void __accept_memory(phys_addr_t start, phys_addr_t end) > { > /* Platform-specific memory-acceptance call goes here */ > - error("Cannot accept memory"); > + if (is_tdx_guest()) > + tdx_accept_memory(start, end); > + else > + error("Cannot accept memory: unknown platform\n"); > } There are quite a few of these if (tdx()) ... conditions in common code here. Shouldn't this be something like a CC_ATTR_MEM_ACCEPT? if (cc_platform_has(CC_ATTR_MEM_ACCEPT)) cc_accept_memory(...); else error("Cannot accept memory: unknown platform\n"); I understand that TDX is the first one to the party. Is this the time to add the cc_ infrastructure?