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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7199CCA47E for ; Fri, 24 Jun 2022 16:22:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231583AbiFXQWl (ORCPT ); Fri, 24 Jun 2022 12:22:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230053AbiFXQWj (ORCPT ); Fri, 24 Jun 2022 12:22:39 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C5A356768; Fri, 24 Jun 2022 09:22:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656087759; x=1687623759; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=xL3KlmHGWviM8HJoLAyDTXeAYfhn8TtCOi1g2QYm2Bw=; b=mOVsmCq6Gy6VfiVn2S9ChCt7X4y1H28ogG+na2fu4Sa8WUeFv59Q82zt IsRdVhb4dOKvY7ik9XMsWKyWNfr+JlsjFCft7+9SLrJV0S15eTPuDgvnC Sc8wVVy1dWRWlrqQmt45w+yfrmLbciljnXruFMM3mp84VYDQ9RS2sAxmo YOTqzyCvvtTmatxdA593EWpBJB4Ks9BKv9pZc2xxdR6iBerQhQc8YHzwI GihPLrzxtmB/d5DiqIlua81J/4d5gSjbEYpW5XAhjVr84eF4BLqETzwnF bU6KNQ1ATLkgUWWlkLPGjyroEbDEsHoOcLiLTrI6Wl+VKKYs2EReLUxMW A==; X-IronPort-AV: E=McAfee;i="6400,9594,10388"; a="278580770" X-IronPort-AV: E=Sophos;i="5.92,218,1650956400"; d="scan'208";a="278580770" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?