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: Boqun Feng <boqun.feng@gmail.com> Reviewed-by: Michael Kelley <mikelley@microsoft.com> Link: https://lore.kernel.org/r/20200916034817.30282-2-boqun.feng@gmail.com Signed-off-by: Wei Liu <wei.liu@kernel.org>
This commit is contained in:
Родитель
49971e6bad
Коммит
a5dda201a0
|
@ -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;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче