[PATCH v3 0/4] HyperV: Synthetic Debugging device

Jon Doron posted 4 patches 2 years, 1 month ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220315153220.953556-1-arilou@gmail.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>
docs/hyperv.txt                  |  15 ++
hw/hyperv/Kconfig                |   5 +
hw/hyperv/hyperv.c               | 352 ++++++++++++++++++++++++---
hw/hyperv/meson.build            |   1 +
hw/hyperv/syndbg.c               | 402 +++++++++++++++++++++++++++++++
include/hw/hyperv/hyperv-proto.h |  52 ++++
include/hw/hyperv/hyperv.h       |  58 +++++
target/i386/cpu.c                |   2 +
target/i386/cpu.h                |   7 +
target/i386/kvm/hyperv-proto.h   |  37 +++
target/i386/kvm/hyperv-stub.c    |   6 +
target/i386/kvm/hyperv.c         |  52 +++-
target/i386/kvm/kvm.c            |  76 +++++-
13 files changed, 1024 insertions(+), 41 deletions(-)
create mode 100644 hw/hyperv/syndbg.c
[PATCH v3 0/4] HyperV: Synthetic Debugging device
Posted by Jon Doron 2 years, 1 month ago
This patchset adds support for the synthetic debugging device.

HyperV supports a special transport layer for the kernel debugger when
running in HyperV.

This patchset add supports for this device so you could have a setup
fast windows kernel debugging.

At this point of time, DHCP is not implmeneted so to set this up few
things need to be noted.

The scenario I used to test is having 2 VMs in the same virtual network
i.e a Debugger VM with the NIC:
-nic tap,model=virtio,mac=02:ca:01:01:01:01,script=/etc/qemu-ifup
And it's IP is going to be static 192.168.53.12
And the VM we want to debug, to which we need to have the englightments
and vmbus configured:
 -cpu host,hv-relaxed,hv_spinlocks=0x1fff,hv_time,+vmx,invtsc,hv-vapic,hv-vpindex,hv-synic,hv-syndbg \
 -device vmbus-bridge \
 -device hv-syndbg,host_ip=192.168.53.12,host_port=50000,use_hcalls=false \
 -nic tap,model=virtio,mac=02:ca:01:01:01:02,script=/etc/qemu-ifup \

Then in the debuggee VM we would setup the kernel debugging in the
following way:

If the VM is older than Win8:
* Copy the proper platform kdvm.dll (make sure it's called kdvm.dll even if platform is 32bit)
bcdedit /set {GUID} dbgtransport kdvm.dll
bcdedit /set {GUID} loadoptions host_ip="1.2.3.4",host_port="50000",nodhcp
bcdedit /set {GUID} debug on
bcdedit /set {GUID} halbreakpoint on

Win8 and late:
bcdedit /dbgsettings net hostip:7.7.7.7 port:50000 nodhcp

This is all the setup that is required to get the synthetic debugger
configured correctly.

v3:
Fixed review from Paolo changes from QLIST*RCU to non RCU

Jon Doron (4):
  hyperv: SControl is optional to enable SynIc
  hyperv: Add definitions for syndbg
  hyperv: Add support to process syndbg commands
  hw: hyperv: Initial commit for Synthetic Debugging device

 docs/hyperv.txt                  |  15 ++
 hw/hyperv/Kconfig                |   5 +
 hw/hyperv/hyperv.c               | 352 ++++++++++++++++++++++++---
 hw/hyperv/meson.build            |   1 +
 hw/hyperv/syndbg.c               | 402 +++++++++++++++++++++++++++++++
 include/hw/hyperv/hyperv-proto.h |  52 ++++
 include/hw/hyperv/hyperv.h       |  58 +++++
 target/i386/cpu.c                |   2 +
 target/i386/cpu.h                |   7 +
 target/i386/kvm/hyperv-proto.h   |  37 +++
 target/i386/kvm/hyperv-stub.c    |   6 +
 target/i386/kvm/hyperv.c         |  52 +++-
 target/i386/kvm/kvm.c            |  76 +++++-
 13 files changed, 1024 insertions(+), 41 deletions(-)
 create mode 100644 hw/hyperv/syndbg.c

-- 
2.35.1
Re: [PATCH v3 0/4] HyperV: Synthetic Debugging device
Posted by Paolo Bonzini 2 years, 1 month ago
Queued, thanks.

Paolo