Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp588895iog; Fri, 24 Jun 2022 09:46:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tFKcIgOwDF2Rm05kvd0pTN95E9cxj4hwcM2OJtyVlBoQ/3NE20UczWwHHxe5B/C5EroF3F X-Received: by 2002:a05:6a00:f8f:b0:525:537d:69b1 with SMTP id ct15-20020a056a000f8f00b00525537d69b1mr10398332pfb.52.1656089219523; Fri, 24 Jun 2022 09:46:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656089219; cv=none; d=google.com; s=arc-20160816; b=HRjJpYfJiE761KP8qimjAH9qdG2yGud/BQMGaSEXFDa4bSUdICQKympsvZ3RtHJzYf GUqRA+j/JoI4w3hvmuvDzHWawTNOR+Z0EHIifPAO5AWzu6HAgNjoFSKvUBBhPv58GGCL UJ0OC6IRb1ksl6+Lrh3qvhwJFrUUMxb5ZxDdtqUk4ZGgqzphzrWFGI2XN30ZDmuZs3UQ pWtUV54ZhOL2UigGhyHlNvJ55KWGk2YFwQM/4l6feoEdkjLIE+D0lC6VdpErCNfIVoas e8glRQUalY5ABRSBKK/7fyERklAIG0FOeZDNanSHARH4r339lbtqGWH08ugjf4n3Sqmz 2peA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=ZF41qte7gzesVf25/Nk0e0eUISeQXkiG26RFKUrkm7Q=; b=0QOOPdp9FKbCDVeOQzmA6DRwjRV0V0BOWjMd3H1w/0QGwfaf2oaP47zQR+Tsu/WLMH wj92/9tWSc9HE3SvhNNcKaCE25FjhxhCwXRG0lmaVUxDuGfSGz3eWvZy4OqEbuTgu5kV LP6LOoN9H0m5SuW4B0tDjfwZc+9jnHhp0SsC7/pzWKc+Gylbq1jcRydhV+jgbuDffyqE cnDymFm5Eacd9+inE/Do+3uwCGOjBYBPuWUAdy+Se2bTfZpL4Vd096k9K2Crs8lT/fXC kqpem27hrml2ud2dWi6iNXlVJf1H3cSiHcq4qkswLqs6ANA99zvE4BA0WKL0Fbk72j0E zOoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mOVsmCq6; 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 m65-20020a632644000000b0040d5ab9c20csi3457874pgm.254.2022.06.24.09.46.23; Fri, 24 Jun 2022 09:46:59 -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=mOVsmCq6; 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 S231576AbiFXQWl (ORCPT + 99 others); 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 X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 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?