xref: /openbmc/linux/arch/arm64/include/asm/hyperv-tlfs.h (revision 03ab8e6297acd1bc0eedaa050e2a1635c576fd11)
157d276bbSMichael Kelley /* SPDX-License-Identifier: GPL-2.0 */
257d276bbSMichael Kelley 
357d276bbSMichael Kelley /*
457d276bbSMichael Kelley  * This file contains definitions from the Hyper-V Hypervisor Top-Level
557d276bbSMichael Kelley  * Functional Specification (TLFS):
657d276bbSMichael Kelley  * https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/tlfs
757d276bbSMichael Kelley  *
857d276bbSMichael Kelley  * Copyright (C) 2021, Microsoft, Inc.
957d276bbSMichael Kelley  *
1057d276bbSMichael Kelley  * Author : Michael Kelley <mikelley@microsoft.com>
1157d276bbSMichael Kelley  */
1257d276bbSMichael Kelley 
1357d276bbSMichael Kelley #ifndef _ASM_HYPERV_TLFS_H
1457d276bbSMichael Kelley #define _ASM_HYPERV_TLFS_H
1557d276bbSMichael Kelley 
1657d276bbSMichael Kelley #include <linux/types.h>
1757d276bbSMichael Kelley 
1857d276bbSMichael Kelley /*
1957d276bbSMichael Kelley  * All data structures defined in the TLFS that are shared between Hyper-V
2057d276bbSMichael Kelley  * and a guest VM use Little Endian byte ordering.  This matches the default
2157d276bbSMichael Kelley  * byte ordering of Linux running on ARM64, so no special handling is required.
2257d276bbSMichael Kelley  */
2357d276bbSMichael Kelley 
2457d276bbSMichael Kelley /*
2557d276bbSMichael Kelley  * These Hyper-V registers provide information equivalent to the CPUID
2657d276bbSMichael Kelley  * instruction on x86/x64.
2757d276bbSMichael Kelley  */
2857d276bbSMichael Kelley #define HV_REGISTER_HYPERVISOR_VERSION		0x00000100 /*CPUID 0x40000002 */
2957d276bbSMichael Kelley #define HV_REGISTER_FEATURES			0x00000200 /*CPUID 0x40000003 */
3057d276bbSMichael Kelley #define HV_REGISTER_ENLIGHTENMENTS		0x00000201 /*CPUID 0x40000004 */
3157d276bbSMichael Kelley 
3257d276bbSMichael Kelley /*
3357d276bbSMichael Kelley  * Group C Features. See the asm-generic version of hyperv-tlfs.h
3457d276bbSMichael Kelley  * for a description of Feature Groups.
3557d276bbSMichael Kelley  */
3657d276bbSMichael Kelley 
3757d276bbSMichael Kelley /* Crash MSRs available */
3857d276bbSMichael Kelley #define HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE	BIT(8)
3957d276bbSMichael Kelley 
4057d276bbSMichael Kelley /* STIMER direct mode is available */
4157d276bbSMichael Kelley #define HV_STIMER_DIRECT_MODE_AVAILABLE		BIT(13)
4257d276bbSMichael Kelley 
4357d276bbSMichael Kelley /*
4457d276bbSMichael Kelley  * Synthetic register definitions equivalent to MSRs on x86/x64
4557d276bbSMichael Kelley  */
4657d276bbSMichael Kelley #define HV_REGISTER_CRASH_P0		0x00000210
4757d276bbSMichael Kelley #define HV_REGISTER_CRASH_P1		0x00000211
4857d276bbSMichael Kelley #define HV_REGISTER_CRASH_P2		0x00000212
4957d276bbSMichael Kelley #define HV_REGISTER_CRASH_P3		0x00000213
5057d276bbSMichael Kelley #define HV_REGISTER_CRASH_P4		0x00000214
5157d276bbSMichael Kelley #define HV_REGISTER_CRASH_CTL		0x00000215
5257d276bbSMichael Kelley 
5357d276bbSMichael Kelley #define HV_REGISTER_GUEST_OSID		0x00090002
5457d276bbSMichael Kelley #define HV_REGISTER_VP_INDEX		0x00090003
5557d276bbSMichael Kelley #define HV_REGISTER_TIME_REF_COUNT	0x00090004
5657d276bbSMichael Kelley #define HV_REGISTER_REFERENCE_TSC	0x00090017
5757d276bbSMichael Kelley 
5857d276bbSMichael Kelley #define HV_REGISTER_SINT0		0x000A0000
5957d276bbSMichael Kelley #define HV_REGISTER_SCONTROL		0x000A0010
6057d276bbSMichael Kelley #define HV_REGISTER_SIEFP		0x000A0012
6157d276bbSMichael Kelley #define HV_REGISTER_SIMP		0x000A0013
6257d276bbSMichael Kelley #define HV_REGISTER_EOM			0x000A0014
6357d276bbSMichael Kelley 
6457d276bbSMichael Kelley #define HV_REGISTER_STIMER0_CONFIG	0x000B0000
6557d276bbSMichael Kelley #define HV_REGISTER_STIMER0_COUNT	0x000B0001
6657d276bbSMichael Kelley 
67*d9932b46SSunil Muthuswamy union hv_msi_entry {
68*d9932b46SSunil Muthuswamy 	u64 as_uint64[2];
69*d9932b46SSunil Muthuswamy 	struct {
70*d9932b46SSunil Muthuswamy 		u64 address;
71*d9932b46SSunil Muthuswamy 		u32 data;
72*d9932b46SSunil Muthuswamy 		u32 reserved;
73*d9932b46SSunil Muthuswamy 	} __packed;
74*d9932b46SSunil Muthuswamy };
75*d9932b46SSunil Muthuswamy 
7657d276bbSMichael Kelley #include <asm-generic/hyperv-tlfs.h>
7757d276bbSMichael Kelley 
7857d276bbSMichael Kelley #endif
79