Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1626181rwl; Fri, 7 Apr 2023 21:30:18 -0700 (PDT) X-Google-Smtp-Source: AKy350YpOQWqGRPUjF+qf+hB108/GKEF7Aqw6//MTXjJF+whrQbqo/Nf2+aR0E9vujWMQsdSRszE X-Received: by 2002:a05:6402:2c6:b0:502:4184:a067 with SMTP id b6-20020a05640202c600b005024184a067mr3010704edx.15.1680928218478; Fri, 07 Apr 2023 21:30:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680928218; cv=none; d=google.com; s=arc-20160816; b=Nkxn7iqpiapzhaon1JTZrT2sVzBM0Zl9A9gt/OIUsmCIEb96ezOuph1VEXzjtF2VeU 4jmNVFwtu7k2HmDNnVOyHDm6vj4HQ3ysif3e0m7BsPsjP7B6yJn368l78Vbk3wonHYua KBTZlG2BttM8WqqZo4XVPrGmNgTOIQpLxfWBdFse7TrYuPbxWwnPXEZMio07Y+M1Hm3V jJ6Ss98lUaskFf2WF9fE7Y4J0t/CuaugZsAU325i+xNl+214tOf2R9J26E4lCDYKjSon HpmVAS14ziit4Nf3bmOT7qp7JMWTTbkqWLVIZcto1383bVvurv2SqEXCncgJWZBhaQw4 LzkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-filter; bh=W+0x2OvkEBqnZiWb8C8jsuH6ZwkjR30+p5rTEImjBuA=; b=lKW5fhBst/Z7HeW/Sv9QxtAYBnJGl3zy6/QYSYoJ5pGLZ5UWekVPbqiYdKXPkJkM21 iiCQY+x4yB7BjDEda2/uXyTy2e7G0SvqqAzDHQJnvmDQ7keTDjNYNtO824Um4T0DMlJq +9jmGYJw9seKcBVBCS206NX7GYKiCt1qk8BlAiAWI/dfO34QOeFDQDhuBD9uFAyeMFOM bvXt6ZOdoMExOcH8HlHyUwHumYrQiImj/3l1uXn7ZN5j+RXcjKOi78x0g92RNgQaWHQH ddJPiHUud5JV1rtMfbz3NuaDG4z31mMiGNuoXKN6N9iBecrIP+m5AmZpE3tQrZa1SqxF xqKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=cOUImu6F; 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=linux.microsoft.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y1-20020a50eb01000000b0050471532b14si2777652edp.366.2023.04.07.21.29.47; Fri, 07 Apr 2023 21:30:18 -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=@linux.microsoft.com header.s=default header.b=cOUImu6F; 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=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229808AbjDHE2G (ORCPT + 99 others); Sat, 8 Apr 2023 00:28:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229719AbjDHE2E (ORCPT ); Sat, 8 Apr 2023 00:28:04 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 96938B456; Fri, 7 Apr 2023 21:28:02 -0700 (PDT) Received: by linux.microsoft.com (Postfix, from userid 1127) id 19BA7213B640; Fri, 7 Apr 2023 21:28:02 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 19BA7213B640 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1680928082; bh=W+0x2OvkEBqnZiWb8C8jsuH6ZwkjR30+p5rTEImjBuA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cOUImu6FQ4W41G/6fzFr2LxrANh36hnC+OtlWuglGa6LH4AGOo7kMb6SnFwBaykD5 gVsLTzOwA/A/CSxNWbBwWUaJynpijxctsqe5DvJdgZ2w54y015KNwb+xHIO6N6JlnP kHXbFwSfJ31TNnygZRrw11QVd+nTXG8u+8FtyYaA= Date: Fri, 7 Apr 2023 21:28:02 -0700 From: Saurabh Singh Sengar To: Stanislav Kinsburskii Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, arnd@arndb.de, tiala@microsoft.com, mikelley@microsoft.com, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-arch@vger.kernel.org, jgross@suse.com, mat.jonczyk@o2.pl Subject: Re: [PATCH v4 2/5] x86/hyperv: Add VTL specific structs and hypercalls Message-ID: <20230408042802.GA14345@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1680598864-16981-1-git-send-email-ssengar@linux.microsoft.com> <1680598864-16981-3-git-send-email-ssengar@linux.microsoft.com> <20230406135113.GB1317@skinsburskii.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230406135113.GB1317@skinsburskii.localdomain> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-17.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_PASS,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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 Thu, Apr 06, 2023 at 06:51:13AM -0700, Stanislav Kinsburskii wrote: > On Tue, Apr 04, 2023 at 02:01:01AM -0700, Saurabh Sengar wrote: > > Add structs and hypercalls required to enable VTL support on x86. > > > > Signed-off-by: Saurabh Sengar > > Reviewed-by: Michael Kelley > > --- > > arch/x86/include/asm/hyperv-tlfs.h | 75 ++++++++++++++++++++++++++++++ > > include/asm-generic/hyperv-tlfs.h | 4 ++ > > 2 files changed, 79 insertions(+) > > > > diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h > > index 0b73a809e9e1..0b0b4e9a4318 100644 > > --- a/arch/x86/include/asm/hyperv-tlfs.h > > +++ b/arch/x86/include/asm/hyperv-tlfs.h > > @@ -713,6 +713,81 @@ union hv_msi_entry { > > } __packed; > > }; > > > > +struct hv_x64_segment_register { > > + __u64 base; > > Ideally they arch-size types naming should be consistent: either with underscores or > without. > The majority of cases in this file are without underscores. Although I am fine either way, I think in a non-uapi file "without underscore" is prefered. I can change this in next version. Regards, Saurabh > > Reviewed-by: Stanislav Kinsburskii > > > + __u32 limit; > > + __u16 selector; > > + union { > > + struct { > > + __u16 segment_type : 4; > > + __u16 non_system_segment : 1; > > + __u16 descriptor_privilege_level : 2; > > + __u16 present : 1; > > + __u16 reserved : 4; > > + __u16 available : 1; > > + __u16 _long : 1; > > + __u16 _default : 1; > > + __u16 granularity : 1; > > + } __packed; > > + __u16 attributes; > > + }; > > +} __packed; > > + > > +struct hv_x64_table_register { > > + __u16 pad[3]; > > + __u16 limit; > > + __u64 base; > > +} __packed; > > + > > +struct hv_init_vp_context { > > + u64 rip; > > + u64 rsp; > > + u64 rflags; > > + > > + struct hv_x64_segment_register cs; > > + struct hv_x64_segment_register ds; > > + struct hv_x64_segment_register es; > > + struct hv_x64_segment_register fs; > > + struct hv_x64_segment_register gs; > > + struct hv_x64_segment_register ss; > > + struct hv_x64_segment_register tr; > > + struct hv_x64_segment_register ldtr; > > + > > + struct hv_x64_table_register idtr; > > + struct hv_x64_table_register gdtr; > > + > > + u64 efer; > > + u64 cr0; > > + u64 cr3; > > + u64 cr4; > > + u64 msr_cr_pat; > > +} __packed; > > + > > +union hv_input_vtl { > > + u8 as_uint8; > > + struct { > > + u8 target_vtl: 4; > > + u8 use_target_vtl: 1; > > + u8 reserved_z: 3; > > + }; > > +} __packed; > > + > > +struct hv_enable_vp_vtl { > > + u64 partition_id; > > + u32 vp_index; > > + union hv_input_vtl target_vtl; > > + u8 mbz0; > > + u16 mbz1; > > + struct hv_init_vp_context vp_context; > > +} __packed; > > + > > +struct hv_get_vp_from_apic_id_in { > > + u64 partition_id; > > + union hv_input_vtl target_vtl; > > + u8 res[7]; > > + u32 apic_ids[]; > > +} __packed; > > + > > #include > > > > #endif > > diff --git a/include/asm-generic/hyperv-tlfs.h b/include/asm-generic/hyperv-tlfs.h > > index b870983596b9..87258341fd7c 100644 > > --- a/include/asm-generic/hyperv-tlfs.h > > +++ b/include/asm-generic/hyperv-tlfs.h > > @@ -146,6 +146,7 @@ union hv_reference_tsc_msr { > > /* Declare the various hypercall operations. */ > > #define HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE 0x0002 > > #define HVCALL_FLUSH_VIRTUAL_ADDRESS_LIST 0x0003 > > +#define HVCALL_ENABLE_VP_VTL 0x000f > > #define HVCALL_NOTIFY_LONG_SPIN_WAIT 0x0008 > > #define HVCALL_SEND_IPI 0x000b > > #define HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE_EX 0x0013 > > @@ -165,6 +166,8 @@ union hv_reference_tsc_msr { > > #define HVCALL_MAP_DEVICE_INTERRUPT 0x007c > > #define HVCALL_UNMAP_DEVICE_INTERRUPT 0x007d > > #define HVCALL_RETARGET_INTERRUPT 0x007e > > +#define HVCALL_START_VP 0x0099 > > +#define HVCALL_GET_VP_ID_FROM_APIC_ID 0x009a > > #define HVCALL_FLUSH_GUEST_PHYSICAL_ADDRESS_SPACE 0x00af > > #define HVCALL_FLUSH_GUEST_PHYSICAL_ADDRESS_LIST 0x00b0 > > #define HVCALL_MODIFY_SPARSE_GPA_PAGE_HOST_VISIBILITY 0x00db > > @@ -218,6 +221,7 @@ enum HV_GENERIC_SET_FORMAT { > > #define HV_STATUS_INVALID_PORT_ID 17 > > #define HV_STATUS_INVALID_CONNECTION_ID 18 > > #define HV_STATUS_INSUFFICIENT_BUFFERS 19 > > +#define HV_STATUS_VTL_ALREADY_ENABLED 134 > > > > /* > > * The Hyper-V TimeRefCount register and the TSC > > -- > > 2.34.1