#define KVM_HV_MAX_SPARSE_VCPU_SET_BITS DIV_ROUND_UP(KVM_MAX_VCPUS, HV_VCPUS_PER_SPARSE_BANK)
 
+/*
+ * As per Hyper-V TLFS, extended hypercalls start from 0x8001
+ * (HvExtCallQueryCapabilities). Response of this hypercalls is a 64 bit value
+ * where each bit tells which extended hypercall is available besides
+ * HvExtCallQueryCapabilities.
+ *
+ * 0x8001 - First extended hypercall, HvExtCallQueryCapabilities, no bit
+ * assigned.
+ *
+ * 0x8002 - Bit 0
+ * 0x8003 - Bit 1
+ * ..
+ * 0x8041 - Bit 63
+ *
+ * Therefore, HV_EXT_CALL_MAX = 0x8001 + 64
+ */
+#define HV_EXT_CALL_MAX (HV_EXT_CALL_QUERY_CAPABILITIES + 64)
+
 static void stimer_mark_pending(struct kvm_vcpu_hv_stimer *stimer,
                                bool vcpu_kick);
 
        case HVCALL_SEND_IPI:
                return hv_vcpu->cpuid_cache.enlightenments_eax &
                        HV_X64_CLUSTER_IPI_RECOMMENDED;
+       case HV_EXT_CALL_QUERY_CAPABILITIES ... HV_EXT_CALL_MAX:
+               return hv_vcpu->cpuid_cache.features_ebx &
+                       HV_ENABLE_EXTENDED_HYPERCALLS;
        default:
                break;
        }
                }
                goto hypercall_userspace_exit;
        }
+       case HV_EXT_CALL_QUERY_CAPABILITIES ... HV_EXT_CALL_MAX:
+               if (unlikely(hc.fast)) {
+                       ret = HV_STATUS_INVALID_PARAMETER;
+                       break;
+               }
+               goto hypercall_userspace_exit;
        default:
                ret = HV_STATUS_INVALID_HYPERCALL_CODE;
                break;
 
                        ent->ebx |= HV_POST_MESSAGES;
                        ent->ebx |= HV_SIGNAL_EVENTS;
+                       ent->ebx |= HV_ENABLE_EXTENDED_HYPERCALLS;
 
                        ent->edx |= HV_X64_HYPERCALL_XMM_INPUT_AVAILABLE;
                        ent->edx |= HV_FEATURE_FREQUENCY_MSRS_AVAILABLE;