diff options
Diffstat (limited to 'drivers/hv/vmbus_drv.c')
-rw-r--r-- | drivers/hv/vmbus_drv.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 2b7b51d264f1..526fa8b19cda 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c | |||
@@ -37,6 +37,8 @@ | |||
37 | #include <asm/hyperv.h> | 37 | #include <asm/hyperv.h> |
38 | #include <asm/hypervisor.h> | 38 | #include <asm/hypervisor.h> |
39 | #include <asm/mshyperv.h> | 39 | #include <asm/mshyperv.h> |
40 | #include <linux/notifier.h> | ||
41 | #include <linux/ptrace.h> | ||
40 | #include "hyperv_vmbus.h" | 42 | #include "hyperv_vmbus.h" |
41 | 43 | ||
42 | static struct acpi_device *hv_acpi_dev; | 44 | static struct acpi_device *hv_acpi_dev; |
@@ -45,6 +47,31 @@ static struct tasklet_struct msg_dpc; | |||
45 | static struct completion probe_event; | 47 | static struct completion probe_event; |
46 | static int irq; | 48 | static int irq; |
47 | 49 | ||
50 | |||
51 | int hyperv_panic_event(struct notifier_block *nb, | ||
52 | unsigned long event, void *ptr) | ||
53 | { | ||
54 | struct pt_regs *regs; | ||
55 | |||
56 | regs = current_pt_regs(); | ||
57 | |||
58 | wrmsrl(HV_X64_MSR_CRASH_P0, regs->ip); | ||
59 | wrmsrl(HV_X64_MSR_CRASH_P1, regs->ax); | ||
60 | wrmsrl(HV_X64_MSR_CRASH_P2, regs->bx); | ||
61 | wrmsrl(HV_X64_MSR_CRASH_P3, regs->cx); | ||
62 | wrmsrl(HV_X64_MSR_CRASH_P4, regs->dx); | ||
63 | |||
64 | /* | ||
65 | * Let Hyper-V know there is crash data available | ||
66 | */ | ||
67 | wrmsrl(HV_X64_MSR_CRASH_CTL, HV_CRASH_CTL_CRASH_NOTIFY); | ||
68 | return NOTIFY_DONE; | ||
69 | } | ||
70 | |||
71 | static struct notifier_block hyperv_panic_block = { | ||
72 | .notifier_call = hyperv_panic_event, | ||
73 | }; | ||
74 | |||
48 | struct resource hyperv_mmio = { | 75 | struct resource hyperv_mmio = { |
49 | .name = "hyperv mmio", | 76 | .name = "hyperv mmio", |
50 | .flags = IORESOURCE_MEM, | 77 | .flags = IORESOURCE_MEM, |
@@ -795,6 +822,15 @@ static int vmbus_bus_init(int irq) | |||
795 | goto err_alloc; | 822 | goto err_alloc; |
796 | 823 | ||
797 | hv_cpu_hotplug_quirk(true); | 824 | hv_cpu_hotplug_quirk(true); |
825 | |||
826 | /* | ||
827 | * Only register if the crash MSRs are available | ||
828 | */ | ||
829 | if (ms_hyperv.features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE) { | ||
830 | atomic_notifier_chain_register(&panic_notifier_list, | ||
831 | &hyperv_panic_block); | ||
832 | } | ||
833 | |||
798 | vmbus_request_offers(); | 834 | vmbus_request_offers(); |
799 | 835 | ||
800 | return 0; | 836 | return 0; |