Drivers: hv: vmbus: Remove dependencies on guest page size
Hyper-V assumes page size to be 4K. This might not be the case for ARM64 architecture. Hence use hyper-v page size and page allocation function to avoid conflicts between different host and guest page size on ARM64. Signed-off-by: Himadri Pandya <himadri18.07@gmail.com> Reviewed-by: Michael Kelley <mikelley@microsoft.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Родитель
fa36dcdf8b
Коммит
53edce00ce
|
@ -208,7 +208,7 @@ int vmbus_connect(void)
|
||||||
* abstraction stuff
|
* abstraction stuff
|
||||||
*/
|
*/
|
||||||
vmbus_connection.int_page =
|
vmbus_connection.int_page =
|
||||||
(void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO, 0);
|
(void *)hv_alloc_hyperv_zeroed_page();
|
||||||
if (vmbus_connection.int_page == NULL) {
|
if (vmbus_connection.int_page == NULL) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -217,14 +217,14 @@ int vmbus_connect(void)
|
||||||
vmbus_connection.recv_int_page = vmbus_connection.int_page;
|
vmbus_connection.recv_int_page = vmbus_connection.int_page;
|
||||||
vmbus_connection.send_int_page =
|
vmbus_connection.send_int_page =
|
||||||
(void *)((unsigned long)vmbus_connection.int_page +
|
(void *)((unsigned long)vmbus_connection.int_page +
|
||||||
(PAGE_SIZE >> 1));
|
(HV_HYP_PAGE_SIZE >> 1));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Setup the monitor notification facility. The 1st page for
|
* Setup the monitor notification facility. The 1st page for
|
||||||
* parent->child and the 2nd page for child->parent
|
* parent->child and the 2nd page for child->parent
|
||||||
*/
|
*/
|
||||||
vmbus_connection.monitor_pages[0] = (void *)__get_free_pages((GFP_KERNEL|__GFP_ZERO), 0);
|
vmbus_connection.monitor_pages[0] = (void *)hv_alloc_hyperv_zeroed_page();
|
||||||
vmbus_connection.monitor_pages[1] = (void *)__get_free_pages((GFP_KERNEL|__GFP_ZERO), 0);
|
vmbus_connection.monitor_pages[1] = (void *)hv_alloc_hyperv_zeroed_page();
|
||||||
if ((vmbus_connection.monitor_pages[0] == NULL) ||
|
if ((vmbus_connection.monitor_pages[0] == NULL) ||
|
||||||
(vmbus_connection.monitor_pages[1] == NULL)) {
|
(vmbus_connection.monitor_pages[1] == NULL)) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
|
@ -297,12 +297,12 @@ void vmbus_disconnect(void)
|
||||||
destroy_workqueue(vmbus_connection.work_queue);
|
destroy_workqueue(vmbus_connection.work_queue);
|
||||||
|
|
||||||
if (vmbus_connection.int_page) {
|
if (vmbus_connection.int_page) {
|
||||||
free_pages((unsigned long)vmbus_connection.int_page, 0);
|
hv_free_hyperv_page((unsigned long)vmbus_connection.int_page);
|
||||||
vmbus_connection.int_page = NULL;
|
vmbus_connection.int_page = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
free_pages((unsigned long)vmbus_connection.monitor_pages[0], 0);
|
hv_free_hyperv_page((unsigned long)vmbus_connection.monitor_pages[0]);
|
||||||
free_pages((unsigned long)vmbus_connection.monitor_pages[1], 0);
|
hv_free_hyperv_page((unsigned long)vmbus_connection.monitor_pages[1]);
|
||||||
vmbus_connection.monitor_pages[0] = NULL;
|
vmbus_connection.monitor_pages[0] = NULL;
|
||||||
vmbus_connection.monitor_pages[1] = NULL;
|
vmbus_connection.monitor_pages[1] = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1275,7 +1275,7 @@ static void hv_kmsg_dump(struct kmsg_dumper *dumper,
|
||||||
* Write dump contents to the page. No need to synchronize; panic should
|
* Write dump contents to the page. No need to synchronize; panic should
|
||||||
* be single-threaded.
|
* be single-threaded.
|
||||||
*/
|
*/
|
||||||
kmsg_dump_get_buffer(dumper, true, hv_panic_page, PAGE_SIZE,
|
kmsg_dump_get_buffer(dumper, true, hv_panic_page, HV_HYP_PAGE_SIZE,
|
||||||
&bytes_written);
|
&bytes_written);
|
||||||
if (bytes_written)
|
if (bytes_written)
|
||||||
hyperv_report_panic_msg(panic_pa, bytes_written);
|
hyperv_report_panic_msg(panic_pa, bytes_written);
|
||||||
|
@ -1379,7 +1379,7 @@ static int vmbus_bus_init(void)
|
||||||
*/
|
*/
|
||||||
hv_get_crash_ctl(hyperv_crash_ctl);
|
hv_get_crash_ctl(hyperv_crash_ctl);
|
||||||
if (hyperv_crash_ctl & HV_CRASH_CTL_CRASH_NOTIFY_MSG) {
|
if (hyperv_crash_ctl & HV_CRASH_CTL_CRASH_NOTIFY_MSG) {
|
||||||
hv_panic_page = (void *)get_zeroed_page(GFP_KERNEL);
|
hv_panic_page = (void *)hv_alloc_hyperv_zeroed_page();
|
||||||
if (hv_panic_page) {
|
if (hv_panic_page) {
|
||||||
ret = kmsg_dump_register(&hv_kmsg_dumper);
|
ret = kmsg_dump_register(&hv_kmsg_dumper);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -1408,7 +1408,7 @@ err_alloc:
|
||||||
hv_remove_vmbus_irq();
|
hv_remove_vmbus_irq();
|
||||||
|
|
||||||
bus_unregister(&hv_bus);
|
bus_unregister(&hv_bus);
|
||||||
free_page((unsigned long)hv_panic_page);
|
hv_free_hyperv_page((unsigned long)hv_panic_page);
|
||||||
unregister_sysctl_table(hv_ctl_table_hdr);
|
unregister_sysctl_table(hv_ctl_table_hdr);
|
||||||
hv_ctl_table_hdr = NULL;
|
hv_ctl_table_hdr = NULL;
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче