Received: by 2002:a05:7412:e79e:b0:f3:1519:9f41 with SMTP id o30csp45423rdd; Wed, 22 Nov 2023 09:02:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IEzlqkGaAxyhgpiRd5UZ+xpqiqKMpE79oJ4nHfL7v3+bxeFfaP43k4aUMlj7+t9ORKk91p3 X-Received: by 2002:a05:6830:139a:b0:6bf:12:5189 with SMTP id d26-20020a056830139a00b006bf00125189mr3176634otq.26.1700672560647; Wed, 22 Nov 2023 09:02:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700672560; cv=none; d=google.com; s=arc-20160816; b=NMmCGR9096xCIWhgOcXxXbbvKxYUSfu9fctS+cks/z0Emq380WkE1KAxBLSFlQszGC xh0KXV6cUvkVej2VCbdNnRHAmH1sRlXiMw8MjwCF/VwqN8XmR56q4tYSt1NeMYx+bSjT kAfj4She9dx7r04KR0/jJiPRhqBz23LPjF77I9SR6cUYHrZOd25SQVBWqxYtSfd6Fs2P AI4tfKWVe0Ygd9Hw7PmreyTGq2HtVEyf/gLtAlmiBsE/9nuZSbRuiOhmeOfHMFjo6BD7 gjmXpWc8nUQhr3tKUgfDUWSXyr/23+w1S4vZal7IBo5PDUTpQEVcOzY1sI9t2QyJAE9B 5jgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=9wgjWP/62NvaWRr+CGCSQIegQce2mbkL4aNWuVLLmPI=; fh=E8ULNJBgdDg9an7hIBnyD2FCRjgTqVL5oPJZZj2SaL0=; b=rA3YdYhCYLUxV4sHaQYWQvd4rfQsGkNbH3OZKeRCoudX91Qy5gHrncFemIgby71lag xteaefFh/4BnfRIzWijI+EzmLvc8tDAcdHKVNud9rgpMIJqWEpvb6rGvTMN9xQx/3F7t R7HMFAojb5SnZt28AsZPMNpFjxay63dOTmNGg77JGgRfc4i05sit8tYpk7KlP1l62eWY KdsXxGXPsWv1P2vgxNAK5TV7yP3dZnvwK8ZloxoHPiwawddrc/vL9oc5jHDiiWWgEIJG VBvpyElBBRD7eMErMp/pz5BEcG6VUMrmNEebSHbsTNb0Zv1Q6hv1rDaL++vm3CfOQsy7 PiIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=cQ5qDyv2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id h5-20020a9d7985000000b006cd135dfa5esi13135otm.172.2023.11.22.09.02.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 09:02:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=cQ5qDyv2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 0987B825F1EF; Wed, 22 Nov 2023 09:02:21 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343876AbjKVRBw (ORCPT + 99 others); Wed, 22 Nov 2023 12:01:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232906AbjKVRBu (ORCPT ); Wed, 22 Nov 2023 12:01:50 -0500 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9ABB29F; Wed, 22 Nov 2023 09:01:46 -0800 (PST) Received: from localhost.localdomain (77-166-152-30.fixed.kpn.net [77.166.152.30]) by linux.microsoft.com (Postfix) with ESMTPSA id 3567820B74C2; Wed, 22 Nov 2023 09:01:42 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 3567820B74C2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1700672506; bh=9wgjWP/62NvaWRr+CGCSQIegQce2mbkL4aNWuVLLmPI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cQ5qDyv2Rah3MoXsEFMlU8EIn49kbZ5NPUGql50qiS7Za5mSWv8lv9Vss99FM6i+h BvCUBCqrAoBSX8/lWTVA/wcDN6HGodpQUlCgVH79GAT+bnyrcQhs4ZjDiLXbodRKlb FItHxXC4nnexkyPpElSU/phmqHSIgFxyBu6LjFRg= From: Jeremi Piotrowski To: linux-kernel@vger.kernel.org, Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Ingo Molnar , "Kirill A. Shutemov" , Michael Kelley , Nikolay Borisov , Peter Zijlstra , Thomas Gleixner , Tom Lendacky , x86@kernel.org, Dexuan Cui Cc: Jeremi Piotrowski , linux-hyperv@vger.kernel.org, stefan.bader@canonical.com, tim.gardner@canonical.com, roxana.nicolescu@canonical.com, cascardo@canonical.com, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, sashal@kernel.org, stable@vger.kernel.org Subject: [PATCH v1 3/3] x86/tdx: Provide stub tdx_accept_memory() for non-TDX configs Date: Wed, 22 Nov 2023 18:01:06 +0100 Message-Id: <20231122170106.270266-3-jpiotrowski@linux.microsoft.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231122170106.270266-1-jpiotrowski@linux.microsoft.com> References: <20231122170106.270266-1-jpiotrowski@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 22 Nov 2023 09:02:21 -0800 (PST) When CONFIG_INTEL_TDX_GUEST is not defined but CONFIG_UNACCEPTED_MEMORY=y is, the kernel fails to link with an undefined reference to tdx_accept_memory from arch_accept_memory. Provide a stub for tdx_accept_memory to fix the build for that configuration. CONFIG_UNACCEPTED_MEMORY is also selected by CONFIG_AMD_MEM_ENCRYPT, and there are stubs for snp_accept_memory for when it is not defined. Previously this did not result in an error when CONFIG_INTEL_TDX_GUEST was not defined because the branch that references tdx_accept_memory() was being discarded due to DISABLE_TDX_GUEST being set. Cc: # v6.5+ Fixes: 75d090fd167a ("x86/tdx: Add unaccepted memory support") Signed-off-by: Jeremi Piotrowski --- arch/x86/include/asm/shared/tdx.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/include/asm/shared/tdx.h b/arch/x86/include/asm/shared/tdx.h index 7513b3bb69b7..58cdbaac3d5b 100644 --- a/arch/x86/include/asm/shared/tdx.h +++ b/arch/x86/include/asm/shared/tdx.h @@ -91,7 +91,11 @@ struct tdx_module_output { u64 __tdx_module_call(u64 fn, u64 rcx, u64 rdx, u64 r8, u64 r9, struct tdx_module_output *out); +#ifdef CONFIG_INTEL_TDX_GUEST bool tdx_accept_memory(phys_addr_t start, phys_addr_t end); +#else +static inline bool tdx_accept_memory(phys_addr_t start, phys_addr_t end) { return false; } +#endif /* * The TDG.VP.VMCALL-Instruction-execution sub-functions are defined -- 2.39.2