Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp217227rwi; Wed, 2 Nov 2022 11:06:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7iLQU0I8x5m2zBYgoMDJbgCwt+xXuBnxKHmJPN43+dGPZvodQB2HhYt2zpMCQYlNqOMquP X-Received: by 2002:a05:6402:358e:b0:461:ea80:fb61 with SMTP id y14-20020a056402358e00b00461ea80fb61mr25610621edc.356.1667412369651; Wed, 02 Nov 2022 11:06:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667412369; cv=none; d=google.com; s=arc-20160816; b=wuYqJldDczDrOUxnh5tEc6IaXFgXGN0xVIdPvKqxOtaTk7abeSiMUrTjaXXXH+ZVY2 Yk8WSHy9rAS5VkMejyZ1WP5G8bI60qo+PKecoAMU2Kel9LqJD5VsNysznQTzHbDNEQ5U 9uPzVDqWQ/zkzJA0lbFiFKJLMHohsbbHZ3CxMnSV9DO9p5gNMqh2DlMPkSqA7b8fbusu oAptbU6+GgfOn3Ybqk+s8CTVfppK74u6x+Ed/YmTiT1pqyOIPe7Sm6VpRjWNg6ryTQB6 T/Lg7ANIP+GHEFP/J/D/4WSaoL6kaFPNQg37UHbeAVt73gbYiQou88CjS1qkt3Z9klyQ RRWA== 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:to:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=XngaLyoddCmH4VlYM2PfyFy1z8QIlSHJsQqMTNSL+fY=; b=S0hSOwlbkKcZYDKeO4A6JEsPuqxnnRtuWHdMdTCQnTlPGCVtulA3QHp8B3US7+IEse 3+ZBo10NE1TYTATni+u74gilFYC7A/uIj+1fPPrmwRgARPS6WqxIdhLqph2En5OgykDC EAqxyUpw1B/ByQzelfyseMMW0eWln2vIHzB3UVmqRBgxxVVU+jkwKEa43f6bxhPQcdqe zrP2Dp1kKZjBkVL3H7tmIgCiRQJjvH2ysYbbD/lgUZrqVHGkTNxsJrpJC2vBSqvnl0Gf ugAcJLIFEtFNW69ur+uF++klqhWVkVEvMkyLFLaiyW7g+zqI4B6Ml5icZ/gTMxrkFvvQ tovA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=LFmDcNdV; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g10-20020a056402090a00b00463a4ca44e0si9360496edz.138.2022.11.02.11.05.29; Wed, 02 Nov 2022 11:06:09 -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=@gmail.com header.s=20210112 header.b=LFmDcNdV; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230387AbiKBR3P (ORCPT + 98 others); Wed, 2 Nov 2022 13:29:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231512AbiKBR3L (ORCPT ); Wed, 2 Nov 2022 13:29:11 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF8E21130; Wed, 2 Nov 2022 10:29:09 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id z5-20020a17090a8b8500b00210a3a2364fso4021502pjn.0; Wed, 02 Nov 2022 10:29:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=XngaLyoddCmH4VlYM2PfyFy1z8QIlSHJsQqMTNSL+fY=; b=LFmDcNdVJo4K4/FarOGyy+iYSahg3fpZVoW20EDjy0GMIKfgTNw8fvtAhQ15msH1Qk VHt/frVwIRzA+95aTCRBawF42Gjwv69pcfAiYAtFa+IxWw2c0L81a72SzNLI/zhYVV0t K0ZHQnNrJhHrs41sUlChWL8od2BcBx7+xb65Sk1Jcosp5Emqdq+E1yeRQzcf4I9RGVys 8ZCwtkteD0c7nGMW6HOZLCT7XbRkNkFFlndsU3/uIegcdYqiHKLssHEw65pubDMfcOz6 H3vQiqJ9dW6NCjeFtTBEAmTHFWCogGMbqctU+cPtFHx9OfivrJ2DvIF1PBdYIYi7VXf1 hMPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=XngaLyoddCmH4VlYM2PfyFy1z8QIlSHJsQqMTNSL+fY=; b=rszwyG6zHme+cXKv/nV3uJZLtZ/1sqOF6SNhzKcPXjyv35ctpTEIoQ8p5UvGa4fZkK DsNDtfxhNQhMl7UgYIgpMppSvipA/GXuwDN7m5Os2WuYmK8N8bTORTKfXyqfd+wH+fqr aJgphCxJ+j7WFebJw6WjNkVfWbANTqIN1awXxm+9Ls5IDAZIuddccvAmVRJkOJ5QHW3P JiuKnG2KAURXtf3iL23J7QvkaZ8OMgV/PwN445T6kJHzglCxwtroLSIsevtbqX63v8DK FsBhcbABj6Ift+SpgkRE8A/kgGUyyAd9GpJCvRcQGoe77JV7aTtWXPBMp5qd+qKCMecd YD5w== X-Gm-Message-State: ACrzQf26OX4C+3hfPW1fYnXy80mduJP4py5TIjLXnetNGUgDIXSmiEYg KVatFTG1pqQH24U2pVLxXUM= X-Received: by 2002:a17:902:ab89:b0:186:7cfc:cde8 with SMTP id f9-20020a170902ab8900b001867cfccde8mr26293355plr.9.1667410149118; Wed, 02 Nov 2022 10:29:09 -0700 (PDT) Received: from ?IPV6:2404:f801:0:5:8000::75b? ([2404:f801:9000:1a:efea::75b]) by smtp.gmail.com with ESMTPSA id d6-20020a170903230600b0016f196209c9sm8651878plh.123.2022.11.02.10.28.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Nov 2022 10:29:08 -0700 (PDT) Message-ID: Date: Thu, 3 Nov 2022 01:28:54 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.13.1 Subject: Re: [PATCH 03/12] x86/hyperv: Reorder code in prep for subsequent patch Content-Language: en-US To: Michael Kelley , hpa@zytor.com, kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, luto@kernel.org, peterz@infradead.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, lpieralisi@kernel.org, robh@kernel.org, kw@linux.com, bhelgaas@google.com, arnd@arndb.de, hch@infradead.org, m.szyprowski@samsung.com, robin.murphy@arm.com, thomas.lendacky@amd.com, brijesh.singh@amd.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, Tianyu.Lan@microsoft.com, kirill.shutemov@linux.intel.com, sathyanarayanan.kuppuswamy@linux.intel.com, ak@linux.intel.com, isaku.yamahata@intel.com, dan.j.williams@intel.com, jane.chu@oracle.com, seanjc@google.com, tony.luck@intel.com, x86@kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, netdev@vger.kernel.org, linux-pci@vger.kernel.org, linux-arch@vger.kernel.org, iommu@lists.linux.dev References: <1666288635-72591-1-git-send-email-mikelley@microsoft.com> <1666288635-72591-4-git-send-email-mikelley@microsoft.com> From: Tianyu Lan In-Reply-To: <1666288635-72591-4-git-send-email-mikelley@microsoft.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 10/21/2022 1:57 AM, Michael Kelley wrote: > Reorder some code as preparation for a subsequent patch. No > functional change. > > Signed-off-by: Michael Kelley Reviewed-by: Tianyu Lan > --- > arch/x86/hyperv/ivm.c | 68 +++++++++++++++++++++++++-------------------------- > 1 file changed, 34 insertions(+), 34 deletions(-) > > diff --git a/arch/x86/hyperv/ivm.c b/arch/x86/hyperv/ivm.c > index 1dbcbd9..f33c67e 100644 > --- a/arch/x86/hyperv/ivm.c > +++ b/arch/x86/hyperv/ivm.c > @@ -235,40 +235,6 @@ void hv_ghcb_msr_read(u64 msr, u64 *value) > EXPORT_SYMBOL_GPL(hv_ghcb_msr_read); > #endif > > -enum hv_isolation_type hv_get_isolation_type(void) > -{ > - if (!(ms_hyperv.priv_high & HV_ISOLATION)) > - return HV_ISOLATION_TYPE_NONE; > - return FIELD_GET(HV_ISOLATION_TYPE, ms_hyperv.isolation_config_b); > -} > -EXPORT_SYMBOL_GPL(hv_get_isolation_type); > - > -/* > - * hv_is_isolation_supported - Check system runs in the Hyper-V > - * isolation VM. > - */ > -bool hv_is_isolation_supported(void) > -{ > - if (!cpu_feature_enabled(X86_FEATURE_HYPERVISOR)) > - return false; > - > - if (!hypervisor_is_type(X86_HYPER_MS_HYPERV)) > - return false; > - > - return hv_get_isolation_type() != HV_ISOLATION_TYPE_NONE; > -} > - > -DEFINE_STATIC_KEY_FALSE(isolation_type_snp); > - > -/* > - * hv_isolation_type_snp - Check system runs in the AMD SEV-SNP based > - * isolation VM. > - */ > -bool hv_isolation_type_snp(void) > -{ > - return static_branch_unlikely(&isolation_type_snp); > -} > - > /* > * hv_mark_gpa_visibility - Set pages visible to host via hvcall. > * > @@ -387,3 +353,37 @@ void hv_unmap_memory(void *addr) > { > vunmap(addr); > } > + > +enum hv_isolation_type hv_get_isolation_type(void) > +{ > + if (!(ms_hyperv.priv_high & HV_ISOLATION)) > + return HV_ISOLATION_TYPE_NONE; > + return FIELD_GET(HV_ISOLATION_TYPE, ms_hyperv.isolation_config_b); > +} > +EXPORT_SYMBOL_GPL(hv_get_isolation_type); > + > +/* > + * hv_is_isolation_supported - Check system runs in the Hyper-V > + * isolation VM. > + */ > +bool hv_is_isolation_supported(void) > +{ > + if (!cpu_feature_enabled(X86_FEATURE_HYPERVISOR)) > + return false; > + > + if (!hypervisor_is_type(X86_HYPER_MS_HYPERV)) > + return false; > + > + return hv_get_isolation_type() != HV_ISOLATION_TYPE_NONE; > +} > + > +DEFINE_STATIC_KEY_FALSE(isolation_type_snp); > + > +/* > + * hv_isolation_type_snp - Check system runs in the AMD SEV-SNP based > + * isolation VM. > + */ > +bool hv_isolation_type_snp(void) > +{ > + return static_branch_unlikely(&isolation_type_snp); > +}