Commit a5dda201 authored by Boqun Feng's avatar Boqun Feng Committed by Wei Liu

Drivers: hv: vmbus: Always use HV_HYP_PAGE_SIZE for gpadl

Since the hypervisor always uses 4K as its page size, the size of PFNs
used for gpadl should be HV_HYP_PAGE_SIZE rather than PAGE_SIZE, so
adjust this accordingly as the preparation for supporting 16K/64K page
size guests. No functional changes on x86, since PAGE_SIZE is always 4k
(equals to HV_HYP_PAGE_SIZE).
Signed-off-by: default avatarBoqun Feng <boqun.feng@gmail.com>
Reviewed-by: default avatarMichael Kelley <mikelley@microsoft.com>
Link: https://lore.kernel.org/r/20200916034817.30282-2-boqun.feng@gmail.comSigned-off-by: default avatarWei Liu <wei.liu@kernel.org>
parent 49971e6b
......@@ -22,9 +22,6 @@
#include "hyperv_vmbus.h"
#define NUM_PAGES_SPANNED(addr, len) \
((PAGE_ALIGN(addr + len) >> PAGE_SHIFT) - (addr >> PAGE_SHIFT))
static unsigned long virt_to_hvpfn(void *addr)
{
phys_addr_t paddr;
......@@ -35,7 +32,7 @@ static unsigned long virt_to_hvpfn(void *addr)
else
paddr = __pa(addr);
return paddr >> PAGE_SHIFT;
return paddr >> HV_HYP_PAGE_SHIFT;
}
/*
......@@ -330,7 +327,7 @@ static int create_gpadl_header(void *kbuffer, u32 size,
int pfnsum, pfncount, pfnleft, pfncurr, pfnsize;
pagecount = size >> PAGE_SHIFT;
pagecount = size >> HV_HYP_PAGE_SHIFT;
/* do we need a gpadl body msg */
pfnsize = MAX_SIZE_CHANNEL_MESSAGE -
......@@ -360,7 +357,7 @@ static int create_gpadl_header(void *kbuffer, u32 size,
gpadl_header->range[0].byte_count = size;
for (i = 0; i < pfncount; i++)
gpadl_header->range[0].pfn_array[i] = virt_to_hvpfn(
kbuffer + PAGE_SIZE * i);
kbuffer + HV_HYP_PAGE_SIZE * i);
*msginfo = msgheader;
pfnsum = pfncount;
......@@ -412,7 +409,7 @@ static int create_gpadl_header(void *kbuffer, u32 size,
*/
for (i = 0; i < pfncurr; i++)
gpadl_body->pfn[i] = virt_to_hvpfn(
kbuffer + PAGE_SIZE * (pfnsum + i));
kbuffer + HV_HYP_PAGE_SIZE * (pfnsum + i));
/* add to msg header */
list_add_tail(&msgbody->msglistentry,
......@@ -441,7 +438,7 @@ static int create_gpadl_header(void *kbuffer, u32 size,
gpadl_header->range[0].byte_count = size;
for (i = 0; i < pagecount; i++)
gpadl_header->range[0].pfn_array[i] = virt_to_hvpfn(
kbuffer + PAGE_SIZE * i);
kbuffer + HV_HYP_PAGE_SIZE * i);
*msginfo = msgheader;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment