Received: by 2002:a05:7412:1492:b0:e2:908c:2ebd with SMTP id s18csp406538rdh; Wed, 23 Aug 2023 03:46:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGnEAcWQXcg5INCgYDm3TB4UZGXDfefpcxAv0kWu931tdts8sAoF53ZsTPmFkSNaCXfFbjJ X-Received: by 2002:a05:620a:24d6:b0:767:3b7d:687c with SMTP id m22-20020a05620a24d600b007673b7d687cmr16873287qkn.15.1692787608667; Wed, 23 Aug 2023 03:46:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692787608; cv=none; d=google.com; s=arc-20160816; b=i0WhG+YOwrMaVv60S2nQ0TPCKFqYuNCbARw2VOy+5iHvmgeRUR7KNEsErJQq4fqZDa uyPOytr2enGgkoCyhbMcf8ZtovsDLQAPVs0bkYnO9DuQBAI4NZTYctbwrZPAunbuis71 BcZYE27wUSJhbabZ5G9MJ2WOljSvubslf7zd/g7XvjyhyrgRyD3t6K8UlORCXOtBr4KC ZmVa8qq/DFUH7D4qWCxMC60714sqUbRDWwlglA+DohIoxZBIONdr6DaGf/6upJcnZvCC lDLFdQzRj00UM7MhtfGH7Yvrp3DqxMCkyk/suKoPECfFsPLbmPinyws6raMGtU+7kIsv btCg== 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; bh=B7SuHeADhiwKqTmvuzAw3dFizq+0uKLvXLc6/Gr+tX4=; fh=rz9cQbhvgeyjJU3vCb7tcPnuUtcj1yM9aa6IveVaVTE=; b=L1rM/qj2aUBxCBtdigmYuM3aqgJkPLYFPZnHdHQPAme6483jjbsBJc6070qSaaXX6K 8TxQy38CXdIiHF6iJNIvunVRqVJ+XYpChi5LPqMjxFXOIEElc9oDkCGJIsPyYxcpnNol WNEmkXtn6LOt9nQkw4J5Gf7EBK2JueY8e6AvMPkTceJxkWEoT9OOpFKV28g0D+Qo2mp7 XfexcKyFjlwVdH61n5NK1n3EXVXVnOiTJBL74F2bcWUqqc9uzLyO04SIdfQ3T86RFWdQ NHjl14vHZJjdA70LLMFytXWY5kxBFpCDN9EJGFOwghNyU+1Ko1LtigfR2ckQV0qWtzdB kj1g== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k130-20020a636f88000000b00565e56713c7si8865058pgc.91.2023.08.23.03.46.36; Wed, 23 Aug 2023 03:46:48 -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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232698AbjHWFm4 (ORCPT + 99 others); Wed, 23 Aug 2023 01:42:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230354AbjHWFmz (ORCPT ); Wed, 23 Aug 2023 01:42:55 -0400 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6A5D10B; Tue, 22 Aug 2023 22:42:53 -0700 (PDT) Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1bf0b24d925so34362485ad.3; Tue, 22 Aug 2023 22:42:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692769373; x=1693374173; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=B7SuHeADhiwKqTmvuzAw3dFizq+0uKLvXLc6/Gr+tX4=; b=NdhmuQgXNpHBll0NW0kyJ4/UKl5jw6jedfnIbLRry44aw3Ik2MgEeZQLUCWaE/8GQO 1JgNJ6b31f9AXbcqFDNlfT0e9GbydonJrfWWB1Fvwc84Nn7wnvQ2aFfXTD6JAIEf/88m /m6WPoIhtPDiQJcizyJATHQW2N1Ju9J+dUhOfKnHmvmKX9KEmHBbJAabwGJlwvt0M4uL uiw04mFOIkrw+wllDFmkv6bq3bihk43Nh+w2GNfsCz9aVOdnL8n5R5M02g3D7sPmZPsf KdCQmBX7v3xwVq3GfsiV4tmxxUeTPO81Pt+J1PDtdzoz5WxDi+BRo16Vp+Ev+9sUHOOd WRmg== X-Gm-Message-State: AOJu0Yz93yB2yIAZBTFxtrCtsrgn1ZffseYcuy4aygWbke+WD4KpW/tn ZgOa6POh64IxNaGLtxdyL4Q= X-Received: by 2002:a17:903:32d2:b0:1bf:1181:a614 with SMTP id i18-20020a17090332d200b001bf1181a614mr10763436plr.26.1692769373273; Tue, 22 Aug 2023 22:42:53 -0700 (PDT) Received: from liuwe-devbox-debian-v2 ([20.69.120.36]) by smtp.gmail.com with ESMTPSA id e9-20020a170902b78900b001b5656b0bf9sm9921263pls.286.2023.08.22.22.42.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Aug 2023 22:42:52 -0700 (PDT) Date: Wed, 23 Aug 2023 05:42:32 +0000 From: Wei Liu To: Dexuan Cui Cc: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, linux-hyperv@vger.kernel.org, mikelley@microsoft.com, tiala@microsoft.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, thomas.lendacky@amd.com, linux-kernel@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH] x86/hyperv: Fix undefined reference to isolation_type_en_snp without CONFIG_HYPERV Message-ID: References: <20230823032008.18186-1-decui@microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230823032008.18186-1-decui@microsoft.com> X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no 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, Aug 22, 2023 at 08:20:08PM -0700, Dexuan Cui wrote: > When CONFIG_HYPERV is not set, arch/x86/hyperv/ivm.c is not built (see > arch/x86/Kbuild), so 'isolation_type_en_snp' in the ivm.c is not defined, > and this failure happens: > > ld: arch/x86/kernel/cpu/mshyperv.o: in function `ms_hyperv_init_platform': > arch/x86/kernel/cpu/mshyperv.c:417: undefined reference to `isolation_type_en_snp' > > Fix the failure by testing hv_get_isolation_type() and > ms_hyperv.paravisor_present for a fully enlightened SNP VM: when > CONFIG_HYPERV is not set, hv_get_isolation_type() is defined as a > static inline function that always returns HV_ISOLATION_TYPE_NONE > (see include/asm-generic/mshyperv.h), so the compiler won't generate any > code for the ms_hyperv.paravisor_present and static_branch_enable(). > > Reported-by: Tom Lendacky > Closes: https://lore.kernel.org/lkml/b4979997-23b9-0c43-574e-e4a3506500ff@amd.com/ > Fixes: d6e2d6524437 ("x86/hyperv: Add sev-snp enlightened guest static key") > Signed-off-by: Dexuan Cui Applied. Thanks.