Skip to content

Commit 99e5c12

Browse files
kelleymhtyhicks
authored andcommitted
Drivers: hv: vmbus: Move hyperv_report_panic_msg to arch neutral code
With the new Hyper-V MSR set function, hyperv_report_panic_msg() can be architecture neutral, so move it out from under arch/x86 and merge into hv_kmsg_dump(). This move also avoids needing a separate implementation under arch/arm64. No functional change. Signed-off-by: Michael Kelley <mikelley@microsoft.com> Reviewed-by: Boqun Feng <boqun.feng@gmail.com> Link: https://lore.kernel.org/r/1614721102-2241-5-git-send-email-mikelley@microsoft.com Signed-off-by: Wei Liu <wei.liu@kernel.org> (cherry picked from commit b548a77) Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
1 parent 8aab751 commit 99e5c12

3 files changed

Lines changed: 19 additions & 33 deletions

File tree

arch/x86/hyperv/hv_init.c

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -479,33 +479,6 @@ void hyperv_report_panic(struct pt_regs *regs, long err, bool in_die)
479479
}
480480
EXPORT_SYMBOL_GPL(hyperv_report_panic);
481481

482-
/**
483-
* hyperv_report_panic_msg - report panic message to Hyper-V
484-
* @pa: physical address of the panic page containing the message
485-
* @size: size of the message in the page
486-
*/
487-
void hyperv_report_panic_msg(phys_addr_t pa, size_t size)
488-
{
489-
/*
490-
* P3 to contain the physical address of the panic page & P4 to
491-
* contain the size of the panic data in that page. Rest of the
492-
* registers are no-op when the NOTIFY_MSG flag is set.
493-
*/
494-
wrmsrl(HV_X64_MSR_CRASH_P0, 0);
495-
wrmsrl(HV_X64_MSR_CRASH_P1, 0);
496-
wrmsrl(HV_X64_MSR_CRASH_P2, 0);
497-
wrmsrl(HV_X64_MSR_CRASH_P3, pa);
498-
wrmsrl(HV_X64_MSR_CRASH_P4, size);
499-
500-
/*
501-
* Let Hyper-V know there is crash data available along with
502-
* the panic message.
503-
*/
504-
wrmsrl(HV_X64_MSR_CRASH_CTL,
505-
(HV_CRASH_CTL_CRASH_NOTIFY | HV_CRASH_CTL_CRASH_NOTIFY_MSG));
506-
}
507-
EXPORT_SYMBOL_GPL(hyperv_report_panic_msg);
508-
509482
bool hv_is_hyperv_initialized(void)
510483
{
511484
union hv_x64_msr_hypercall_contents hypercall_msr;

drivers/hv/vmbus_drv.c

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,22 +1362,36 @@ static void hv_kmsg_dump(struct kmsg_dumper *dumper,
13621362
enum kmsg_dump_reason reason)
13631363
{
13641364
size_t bytes_written;
1365-
phys_addr_t panic_pa;
13661365

13671366
/* We are only interested in panics. */
13681367
if ((reason != KMSG_DUMP_PANIC) || (!sysctl_record_panic_msg))
13691368
return;
13701369

1371-
panic_pa = virt_to_phys(hv_panic_page);
1372-
13731370
/*
13741371
* Write dump contents to the page. No need to synchronize; panic should
13751372
* be single-threaded.
13761373
*/
13771374
kmsg_dump_get_buffer(dumper, false, hv_panic_page, HV_HYP_PAGE_SIZE,
13781375
&bytes_written);
1379-
if (bytes_written)
1380-
hyperv_report_panic_msg(panic_pa, bytes_written);
1376+
if (!bytes_written)
1377+
return;
1378+
/*
1379+
* P3 to contain the physical address of the panic page & P4 to
1380+
* contain the size of the panic data in that page. Rest of the
1381+
* registers are no-op when the NOTIFY_MSG flag is set.
1382+
*/
1383+
hv_set_register(HV_REGISTER_CRASH_P0, 0);
1384+
hv_set_register(HV_REGISTER_CRASH_P1, 0);
1385+
hv_set_register(HV_REGISTER_CRASH_P2, 0);
1386+
hv_set_register(HV_REGISTER_CRASH_P3, virt_to_phys(hv_panic_page));
1387+
hv_set_register(HV_REGISTER_CRASH_P4, bytes_written);
1388+
1389+
/*
1390+
* Let Hyper-V know there is crash data available along with
1391+
* the panic message.
1392+
*/
1393+
hv_set_register(HV_REGISTER_CRASH_CTL,
1394+
(HV_CRASH_CTL_CRASH_NOTIFY | HV_CRASH_CTL_CRASH_NOTIFY_MSG));
13811395
}
13821396

13831397
static struct kmsg_dumper hv_kmsg_dumper = {

include/asm-generic/mshyperv.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ static inline int cpumask_to_vpset(struct hv_vpset *vpset,
170170
}
171171

172172
void hyperv_report_panic(struct pt_regs *regs, long err, bool in_die);
173-
void hyperv_report_panic_msg(phys_addr_t pa, size_t size);
174173
bool hv_is_hyperv_initialized(void);
175174
bool hv_is_hibernation_supported(void);
176175
void hyperv_cleanup(void);

0 commit comments

Comments
 (0)