mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-21 00:42:16 +00:00
Staging: hv: Use native page allocation/free functions
In preperation for getting rid of the osd.[ch] files; change all page allocation/free functions to use native interfaces. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Hank Janssen <hjanssen@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
7249e6a17b
commit
df3493e0b3
@ -180,8 +180,9 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
|
|||||||
newchannel->channel_callback_context = context;
|
newchannel->channel_callback_context = context;
|
||||||
|
|
||||||
/* Allocate the ring buffer */
|
/* Allocate the ring buffer */
|
||||||
out = osd_page_alloc((send_ringbuffer_size + recv_ringbuffer_size)
|
out = (void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO,
|
||||||
>> PAGE_SHIFT);
|
get_order(send_ringbuffer_size + recv_ringbuffer_size));
|
||||||
|
|
||||||
if (!out)
|
if (!out)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
@ -300,8 +301,8 @@ Cleanup:
|
|||||||
errorout:
|
errorout:
|
||||||
ringbuffer_cleanup(&newchannel->outbound);
|
ringbuffer_cleanup(&newchannel->outbound);
|
||||||
ringbuffer_cleanup(&newchannel->inbound);
|
ringbuffer_cleanup(&newchannel->inbound);
|
||||||
osd_page_free(out, (send_ringbuffer_size + recv_ringbuffer_size)
|
free_pages((unsigned long)out,
|
||||||
>> PAGE_SHIFT);
|
get_order(send_ringbuffer_size + recv_ringbuffer_size));
|
||||||
kfree(openInfo);
|
kfree(openInfo);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -686,7 +687,8 @@ void vmbus_close(struct vmbus_channel *channel)
|
|||||||
ringbuffer_cleanup(&channel->outbound);
|
ringbuffer_cleanup(&channel->outbound);
|
||||||
ringbuffer_cleanup(&channel->inbound);
|
ringbuffer_cleanup(&channel->inbound);
|
||||||
|
|
||||||
osd_page_free(channel->ringbuffer_pages, channel->ringbuffer_pagecount);
|
free_pages((unsigned long)channel->ringbuffer_pages,
|
||||||
|
get_order(channel->ringbuffer_pagecount * PAGE_SIZE));
|
||||||
|
|
||||||
kfree(info);
|
kfree(info);
|
||||||
|
|
||||||
|
@ -66,7 +66,8 @@ int vmbus_connect(void)
|
|||||||
* Setup the vmbus event connection for channel interrupt
|
* Setup the vmbus event connection for channel interrupt
|
||||||
* abstraction stuff
|
* abstraction stuff
|
||||||
*/
|
*/
|
||||||
vmbus_connection.int_page = osd_page_alloc(1);
|
vmbus_connection.int_page =
|
||||||
|
(void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO, 0);
|
||||||
if (vmbus_connection.int_page == NULL) {
|
if (vmbus_connection.int_page == NULL) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto Cleanup;
|
goto Cleanup;
|
||||||
@ -81,7 +82,8 @@ int vmbus_connect(void)
|
|||||||
* 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 = osd_page_alloc(2);
|
vmbus_connection.monitor_pages =
|
||||||
|
(void *)__get_free_pages((GFP_KERNEL|__GFP_ZERO), 1);
|
||||||
if (vmbus_connection.monitor_pages == NULL) {
|
if (vmbus_connection.monitor_pages == NULL) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto Cleanup;
|
goto Cleanup;
|
||||||
@ -162,12 +164,12 @@ Cleanup:
|
|||||||
destroy_workqueue(vmbus_connection.work_queue);
|
destroy_workqueue(vmbus_connection.work_queue);
|
||||||
|
|
||||||
if (vmbus_connection.int_page) {
|
if (vmbus_connection.int_page) {
|
||||||
osd_page_free(vmbus_connection.int_page, 1);
|
free_pages((unsigned long)vmbus_connection.int_page, 0);
|
||||||
vmbus_connection.int_page = NULL;
|
vmbus_connection.int_page = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vmbus_connection.monitor_pages) {
|
if (vmbus_connection.monitor_pages) {
|
||||||
osd_page_free(vmbus_connection.monitor_pages, 2);
|
free_pages((unsigned long)vmbus_connection.monitor_pages, 1);
|
||||||
vmbus_connection.monitor_pages = NULL;
|
vmbus_connection.monitor_pages = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,7 +205,8 @@ int vmbus_disconnect(void)
|
|||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
goto Cleanup;
|
goto Cleanup;
|
||||||
|
|
||||||
osd_page_free(vmbus_connection.int_page, 1);
|
free_pages((unsigned long)vmbus_connection.int_page, 0);
|
||||||
|
free_pages((unsigned long)vmbus_connection.monitor_pages, 1);
|
||||||
|
|
||||||
/* TODO: iterate thru the msg list and free up */
|
/* TODO: iterate thru the msg list and free up */
|
||||||
destroy_workqueue(vmbus_connection.work_queue);
|
destroy_workqueue(vmbus_connection.work_queue);
|
||||||
|
@ -230,7 +230,12 @@ int hv_init(void)
|
|||||||
* Allocate the hypercall page memory
|
* Allocate the hypercall page memory
|
||||||
* virtaddr = osd_page_alloc(1);
|
* virtaddr = osd_page_alloc(1);
|
||||||
*/
|
*/
|
||||||
virtaddr = osd_virtual_alloc_exec(PAGE_SIZE);
|
#ifdef __x86_64__
|
||||||
|
virtaddr = __vmalloc(PAGE_SIZE, GFP_KERNEL, PAGE_KERNEL_EXEC);
|
||||||
|
#else
|
||||||
|
virtaddr = __vmalloc(PAGE_SIZE, GFP_KERNEL,
|
||||||
|
__pgprot(__PAGE_KERNEL & (~_PAGE_NX)));
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!virtaddr) {
|
if (!virtaddr) {
|
||||||
DPRINT_ERR(VMBUS,
|
DPRINT_ERR(VMBUS,
|
||||||
@ -462,10 +467,10 @@ void hv_synic_init(void *irqarg)
|
|||||||
|
|
||||||
Cleanup:
|
Cleanup:
|
||||||
if (hv_context.synic_event_page[cpu])
|
if (hv_context.synic_event_page[cpu])
|
||||||
osd_page_free(hv_context.synic_event_page[cpu], 1);
|
free_page((unsigned long)hv_context.synic_event_page[cpu]);
|
||||||
|
|
||||||
if (hv_context.synic_message_page[cpu])
|
if (hv_context.synic_message_page[cpu])
|
||||||
osd_page_free(hv_context.synic_message_page[cpu], 1);
|
free_page((unsigned long)hv_context.synic_message_page[cpu]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -502,6 +507,6 @@ void hv_synic_cleanup(void *arg)
|
|||||||
|
|
||||||
wrmsrl(HV_X64_MSR_SIEFP, siefp.as_uint64);
|
wrmsrl(HV_X64_MSR_SIEFP, siefp.as_uint64);
|
||||||
|
|
||||||
osd_page_free(hv_context.synic_message_page[cpu], 1);
|
free_page((unsigned long)hv_context.synic_message_page[cpu]);
|
||||||
osd_page_free(hv_context.synic_event_page[cpu], 1);
|
free_page((unsigned long)hv_context.synic_event_page[cpu]);
|
||||||
}
|
}
|
||||||
|
@ -223,7 +223,8 @@ static int netvsc_init_recv_buf(struct hv_device *device)
|
|||||||
/* ASSERT((netDevice->ReceiveBufferSize & (PAGE_SIZE - 1)) == 0); */
|
/* ASSERT((netDevice->ReceiveBufferSize & (PAGE_SIZE - 1)) == 0); */
|
||||||
|
|
||||||
net_device->recv_buf =
|
net_device->recv_buf =
|
||||||
osd_page_alloc(net_device->recv_buf_size >> PAGE_SHIFT);
|
(void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO,
|
||||||
|
get_order(net_device->recv_buf_size));
|
||||||
if (!net_device->recv_buf) {
|
if (!net_device->recv_buf) {
|
||||||
DPRINT_ERR(NETVSC,
|
DPRINT_ERR(NETVSC,
|
||||||
"unable to allocate receive buffer of size %d",
|
"unable to allocate receive buffer of size %d",
|
||||||
@ -360,7 +361,8 @@ static int netvsc_init_send_buf(struct hv_device *device)
|
|||||||
/* ASSERT((netDevice->SendBufferSize & (PAGE_SIZE - 1)) == 0); */
|
/* ASSERT((netDevice->SendBufferSize & (PAGE_SIZE - 1)) == 0); */
|
||||||
|
|
||||||
net_device->send_buf =
|
net_device->send_buf =
|
||||||
osd_page_alloc(net_device->send_buf_size >> PAGE_SHIFT);
|
(void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO,
|
||||||
|
get_order(net_device->send_buf_size));
|
||||||
if (!net_device->send_buf) {
|
if (!net_device->send_buf) {
|
||||||
DPRINT_ERR(NETVSC, "unable to allocate send buffer of size %d",
|
DPRINT_ERR(NETVSC, "unable to allocate send buffer of size %d",
|
||||||
net_device->send_buf_size);
|
net_device->send_buf_size);
|
||||||
@ -498,8 +500,8 @@ static int netvsc_destroy_recv_buf(struct netvsc_device *net_device)
|
|||||||
DPRINT_INFO(NETVSC, "Freeing up receive buffer...");
|
DPRINT_INFO(NETVSC, "Freeing up receive buffer...");
|
||||||
|
|
||||||
/* Free up the receive buffer */
|
/* Free up the receive buffer */
|
||||||
osd_page_free(net_device->recv_buf,
|
free_pages((unsigned long)net_device->recv_buf,
|
||||||
net_device->recv_buf_size >> PAGE_SHIFT);
|
get_order(net_device->recv_buf_size));
|
||||||
net_device->recv_buf = NULL;
|
net_device->recv_buf = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -574,8 +576,8 @@ static int netvsc_destroy_send_buf(struct netvsc_device *net_device)
|
|||||||
DPRINT_INFO(NETVSC, "Freeing up send buffer...");
|
DPRINT_INFO(NETVSC, "Freeing up send buffer...");
|
||||||
|
|
||||||
/* Free up the receive buffer */
|
/* Free up the receive buffer */
|
||||||
osd_page_free(net_device->send_buf,
|
free_pages((unsigned long)net_device->send_buf,
|
||||||
net_device->send_buf_size >> PAGE_SHIFT);
|
get_order(net_device->send_buf_size));
|
||||||
net_device->send_buf = NULL;
|
net_device->send_buf = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user