RE: [PATCH v5 2/5] x86/hyper-v: Add synthetic debugger definitions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jon Doron <arilou@xxxxxxxxx>  Sent: Friday, March 13, 2020 9:45 PM
> 
> On 13/03/2020, Michael Kelley wrote:
> >From: Jon Doron <arilou@xxxxxxxxx> Sent: Friday, March 13, 2020 6:21 AM
> >>
> >> Hyper-V synthetic debugger has two modes, one that uses MSRs and
> >> the other that use Hypercalls.
> >>
> >> Add all the required definitions to both types of synthetic debugger
> >> interface.
> >>
> >> Some of the required new CPUIDs and MSRs are not documented in the TLFS
> >> so they are in hyperv.h instead.
> >>
> >> Signed-off-by: Jon Doron <arilou@xxxxxxxxx>
> >> ---
> >>  arch/x86/include/asm/hyperv-tlfs.h |  6 ++++++
> >>  arch/x86/kvm/hyperv.h              | 22 ++++++++++++++++++++++
> >>  2 files changed, 28 insertions(+)
> >>
> >> diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h
> >> index 92abc1e42bfc..671ce2a39d4b 100644
> >> --- a/arch/x86/include/asm/hyperv-tlfs.h
> >> +++ b/arch/x86/include/asm/hyperv-tlfs.h
> >> @@ -131,6 +131,8 @@
> >>  #define HV_FEATURE_FREQUENCY_MSRS_AVAILABLE		BIT(8)
> >>  /* Crash MSR available */
> >>  #define HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE		BIT(10)
> >> +/* Support for debug MSRs available */
> >> +#define HV_FEATURE_DEBUG_MSRS_AVAILABLE			BIT(11)
> >>  /* stimer Direct Mode is available */
> >>  #define HV_STIMER_DIRECT_MODE_AVAILABLE			BIT(19)
> >>
> >> @@ -376,6 +378,9 @@ struct hv_tsc_emulation_status {
> >>  #define HVCALL_SEND_IPI_EX			0x0015
> >>  #define HVCALL_POST_MESSAGE			0x005c
> >>  #define HVCALL_SIGNAL_EVENT			0x005d
> >> +#define HVCALL_POST_DEBUG_DATA			0x0069
> >> +#define HVCALL_RETRIEVE_DEBUG_DATA		0x006a
> >> +#define HVCALL_RESET_DEBUG_SESSION		0x006b
> >>  #define HVCALL_FLUSH_GUEST_PHYSICAL_ADDRESS_SPACE 0x00af
> >>  #define HVCALL_FLUSH_GUEST_PHYSICAL_ADDRESS_LIST 0x00b0
> >>
> >> @@ -419,6 +424,7 @@ enum HV_GENERIC_SET_FORMAT {
> >>  #define HV_STATUS_INVALID_HYPERCALL_INPUT	3
> >>  #define HV_STATUS_INVALID_ALIGNMENT		4
> >>  #define HV_STATUS_INVALID_PARAMETER		5
> >> +#define HV_STATUS_OPERATION_DENIED		8
> >>  #define HV_STATUS_INSUFFICIENT_MEMORY		11
> >>  #define HV_STATUS_INVALID_PORT_ID		17
> >>  #define HV_STATUS_INVALID_CONNECTION_ID		18
> >> diff --git a/arch/x86/kvm/hyperv.h b/arch/x86/kvm/hyperv.h
> >> index 757cb578101c..56bc3416b62f 100644
> >> --- a/arch/x86/kvm/hyperv.h
> >> +++ b/arch/x86/kvm/hyperv.h
> >> @@ -23,6 +23,28 @@
> >>
> >>  #include <linux/kvm_host.h>
> >>
> >> +/* These defines are required by KDNet and they are not part of Hyper-V TLFS */
> >
> >I'm looking for a bit more info in the comment so that it's clear that the
> >synthetic debugger functionality is not committed to be available going
> >forward. Perhaps something along the lines of:
> >
> >/* The #defines related to the synthetic debugger are required by KDNet, but
> > * they are not documented in the Hyper-V TLFS because the synthetic debugger
> > * functionality has been deprecated and is subject to removal in future versions
> > * of Windows.
> > */
> >
> >But with that additional comment text,
> >
> >Reviewed-by: Michael Kelley <mikelley@xxxxxxxxxxxxx>
> >
> 
> Sure thing, but one quick question I have noticed that in the 6.0 TLFS
> the bit indicating the DEBUG_MSRS are available is still documented is
> that intentional or a juss a miss?

>From the side conversation I had with the Hyper-V people, I think
this is just a miss.  They took out the MSR definitions, but forgot to
take out the flag indicating the presence of the MSRs.  As I think I
mentioned in an earlier email, there will be future updates to the
TLFS, and I've put this topic on my list of things to make sure get
cleaned up.

Michael

> 
> Cheers,
> -- Jon.
> 
> >> +#define HYPERV_CPUID_SYNDBG_VENDOR_AND_MAX_FUNCTIONS	0x40000080
> >> +#define HYPERV_CPUID_SYNDBG_INTERFACE			0x40000081
> >> +#define HYPERV_CPUID_SYNDBG_PLATFORM_CAPABILITIES	0x40000082
> >> +
> >> +/*
> >> + * Hyper-V synthetic debugger platform capabilities
> >> + * These are HYPERV_CPUID_SYNDBG_PLATFORM_CAPABILITIES.EAX bits.
> >> + */
> >> +#define HV_X64_SYNDBG_CAP_ALLOW_KERNEL_DEBUGGING	BIT(1)
> >> +
> >> +/* Hyper-V Synthetic debug options MSR */
> >> +#define HV_X64_MSR_SYNDBG_CONTROL		0x400000F1
> >> +#define HV_X64_MSR_SYNDBG_STATUS		0x400000F2
> >> +#define HV_X64_MSR_SYNDBG_SEND_BUFFER		0x400000F3
> >> +#define HV_X64_MSR_SYNDBG_RECV_BUFFER		0x400000F4
> >> +#define HV_X64_MSR_SYNDBG_PENDING_BUFFER	0x400000F5
> >> +#define HV_X64_MSR_SYNDBG_OPTIONS		0x400000FF
> >> +
> >> +/* Hyper-V HV_X64_MSR_SYNDBG_OPTIONS bits */
> >> +#define HV_X64_SYNDBG_OPTION_USE_HCALLS		BIT(2)
> >> +
> >>  static inline struct kvm_vcpu_hv *vcpu_to_hv_vcpu(struct kvm_vcpu *vcpu)
> >>  {
> >>  	return &vcpu->arch.hyperv;
> >> --
> >> 2.24.1
> >




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux