Skip to content

Commit f863993

Browse files
ehabkostIngo Molnar
authored andcommitted
x86, paravirt_ops: use unsigned long instead of u32 for alloc_p*() pfn args
This patch changes the pfn args from 'u32' to 'unsigned long' on alloc_p*() functions on paravirt_ops, and the corresponding implementations for Xen and VMI. The prototypes for CONFIG_PARAVIRT=n are already using unsigned long, so paravirt.h now matches the prototypes on asm-x86/pgalloc.h. It shouldn't result in any changes on generated code on 32-bit, with or without CONFIG_PARAVIRT. On both cases, 'codiff -f' didn't show any change after applying this patch. On 64-bit, there are (expected) binary changes only when CONFIG_PARAVIRT is enabled, as the patch is really supposed to change the size of the pfn args. [ v2: KVM_GUEST: use the right parameter type on kvm_release_pt() ] Signed-off-by: Eduardo Habkost <[email protected]> Acked-by: Jeremy Fitzhardinge <[email protected]> Acked-by: Zachary Amsden <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
1 parent 6e86841 commit f863993

File tree

4 files changed

+31
-31
lines changed

4 files changed

+31
-31
lines changed

arch/x86/kernel/kvm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ static void kvm_flush_tlb(void)
178178
kvm_deferred_mmu_op(&ftlb, sizeof ftlb);
179179
}
180180

181-
static void kvm_release_pt(u32 pfn)
181+
static void kvm_release_pt(unsigned long pfn)
182182
{
183183
struct kvm_mmu_op_release_pt rpt = {
184184
.header.op = KVM_MMU_OP_RELEASE_PT,

arch/x86/kernel/vmi_32.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -392,13 +392,13 @@ static void *vmi_kmap_atomic_pte(struct page *page, enum km_type type)
392392
}
393393
#endif
394394

395-
static void vmi_allocate_pte(struct mm_struct *mm, u32 pfn)
395+
static void vmi_allocate_pte(struct mm_struct *mm, unsigned long pfn)
396396
{
397397
vmi_set_page_type(pfn, VMI_PAGE_L1);
398398
vmi_ops.allocate_page(pfn, VMI_PAGE_L1, 0, 0, 0);
399399
}
400400

401-
static void vmi_allocate_pmd(struct mm_struct *mm, u32 pfn)
401+
static void vmi_allocate_pmd(struct mm_struct *mm, unsigned long pfn)
402402
{
403403
/*
404404
* This call comes in very early, before mem_map is setup.
@@ -409,20 +409,20 @@ static void vmi_allocate_pmd(struct mm_struct *mm, u32 pfn)
409409
vmi_ops.allocate_page(pfn, VMI_PAGE_L2, 0, 0, 0);
410410
}
411411

412-
static void vmi_allocate_pmd_clone(u32 pfn, u32 clonepfn, u32 start, u32 count)
412+
static void vmi_allocate_pmd_clone(unsigned long pfn, unsigned long clonepfn, unsigned long start, unsigned long count)
413413
{
414414
vmi_set_page_type(pfn, VMI_PAGE_L2 | VMI_PAGE_CLONE);
415415
vmi_check_page_type(clonepfn, VMI_PAGE_L2);
416416
vmi_ops.allocate_page(pfn, VMI_PAGE_L2 | VMI_PAGE_CLONE, clonepfn, start, count);
417417
}
418418

419-
static void vmi_release_pte(u32 pfn)
419+
static void vmi_release_pte(unsigned long pfn)
420420
{
421421
vmi_ops.release_page(pfn, VMI_PAGE_L1);
422422
vmi_set_page_type(pfn, VMI_PAGE_NORMAL);
423423
}
424424

425-
static void vmi_release_pmd(u32 pfn)
425+
static void vmi_release_pmd(unsigned long pfn)
426426
{
427427
vmi_ops.release_page(pfn, VMI_PAGE_L2);
428428
vmi_set_page_type(pfn, VMI_PAGE_NORMAL);

arch/x86/xen/enlighten.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high)
812812

813813
/* Early in boot, while setting up the initial pagetable, assume
814814
everything is pinned. */
815-
static __init void xen_alloc_pte_init(struct mm_struct *mm, u32 pfn)
815+
static __init void xen_alloc_pte_init(struct mm_struct *mm, unsigned long pfn)
816816
{
817817
#ifdef CONFIG_FLATMEM
818818
BUG_ON(mem_map); /* should only be used early */
@@ -822,7 +822,7 @@ static __init void xen_alloc_pte_init(struct mm_struct *mm, u32 pfn)
822822

823823
/* Early release_pte assumes that all pts are pinned, since there's
824824
only init_mm and anything attached to that is pinned. */
825-
static void xen_release_pte_init(u32 pfn)
825+
static void xen_release_pte_init(unsigned long pfn)
826826
{
827827
make_lowmem_page_readwrite(__va(PFN_PHYS(pfn)));
828828
}
@@ -838,7 +838,7 @@ static void pin_pagetable_pfn(unsigned cmd, unsigned long pfn)
838838

839839
/* This needs to make sure the new pte page is pinned iff its being
840840
attached to a pinned pagetable. */
841-
static void xen_alloc_ptpage(struct mm_struct *mm, u32 pfn, unsigned level)
841+
static void xen_alloc_ptpage(struct mm_struct *mm, unsigned long pfn, unsigned level)
842842
{
843843
struct page *page = pfn_to_page(pfn);
844844

@@ -856,12 +856,12 @@ static void xen_alloc_ptpage(struct mm_struct *mm, u32 pfn, unsigned level)
856856
}
857857
}
858858

859-
static void xen_alloc_pte(struct mm_struct *mm, u32 pfn)
859+
static void xen_alloc_pte(struct mm_struct *mm, unsigned long pfn)
860860
{
861861
xen_alloc_ptpage(mm, pfn, PT_PTE);
862862
}
863863

864-
static void xen_alloc_pmd(struct mm_struct *mm, u32 pfn)
864+
static void xen_alloc_pmd(struct mm_struct *mm, unsigned long pfn)
865865
{
866866
xen_alloc_ptpage(mm, pfn, PT_PMD);
867867
}
@@ -909,7 +909,7 @@ static void xen_pgd_free(struct mm_struct *mm, pgd_t *pgd)
909909
}
910910

911911
/* This should never happen until we're OK to use struct page */
912-
static void xen_release_ptpage(u32 pfn, unsigned level)
912+
static void xen_release_ptpage(unsigned long pfn, unsigned level)
913913
{
914914
struct page *page = pfn_to_page(pfn);
915915

@@ -923,23 +923,23 @@ static void xen_release_ptpage(u32 pfn, unsigned level)
923923
}
924924
}
925925

926-
static void xen_release_pte(u32 pfn)
926+
static void xen_release_pte(unsigned long pfn)
927927
{
928928
xen_release_ptpage(pfn, PT_PTE);
929929
}
930930

931-
static void xen_release_pmd(u32 pfn)
931+
static void xen_release_pmd(unsigned long pfn)
932932
{
933933
xen_release_ptpage(pfn, PT_PMD);
934934
}
935935

936936
#if PAGETABLE_LEVELS == 4
937-
static void xen_alloc_pud(struct mm_struct *mm, u32 pfn)
937+
static void xen_alloc_pud(struct mm_struct *mm, unsigned long pfn)
938938
{
939939
xen_alloc_ptpage(mm, pfn, PT_PUD);
940940
}
941941

942-
static void xen_release_pud(u32 pfn)
942+
static void xen_release_pud(unsigned long pfn)
943943
{
944944
xen_release_ptpage(pfn, PT_PUD);
945945
}

include/asm-x86/paravirt.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -257,13 +257,13 @@ struct pv_mmu_ops {
257257
* Hooks for allocating/releasing pagetable pages when they're
258258
* attached to a pagetable
259259
*/
260-
void (*alloc_pte)(struct mm_struct *mm, u32 pfn);
261-
void (*alloc_pmd)(struct mm_struct *mm, u32 pfn);
262-
void (*alloc_pmd_clone)(u32 pfn, u32 clonepfn, u32 start, u32 count);
263-
void (*alloc_pud)(struct mm_struct *mm, u32 pfn);
264-
void (*release_pte)(u32 pfn);
265-
void (*release_pmd)(u32 pfn);
266-
void (*release_pud)(u32 pfn);
260+
void (*alloc_pte)(struct mm_struct *mm, unsigned long pfn);
261+
void (*alloc_pmd)(struct mm_struct *mm, unsigned long pfn);
262+
void (*alloc_pmd_clone)(unsigned long pfn, unsigned long clonepfn, unsigned long start, unsigned long count);
263+
void (*alloc_pud)(struct mm_struct *mm, unsigned long pfn);
264+
void (*release_pte)(unsigned long pfn);
265+
void (*release_pmd)(unsigned long pfn);
266+
void (*release_pud)(unsigned long pfn);
267267

268268
/* Pagetable manipulation functions */
269269
void (*set_pte)(pte_t *ptep, pte_t pteval);
@@ -993,35 +993,35 @@ static inline void paravirt_pgd_free(struct mm_struct *mm, pgd_t *pgd)
993993
PVOP_VCALL2(pv_mmu_ops.pgd_free, mm, pgd);
994994
}
995995

996-
static inline void paravirt_alloc_pte(struct mm_struct *mm, unsigned pfn)
996+
static inline void paravirt_alloc_pte(struct mm_struct *mm, unsigned long pfn)
997997
{
998998
PVOP_VCALL2(pv_mmu_ops.alloc_pte, mm, pfn);
999999
}
1000-
static inline void paravirt_release_pte(unsigned pfn)
1000+
static inline void paravirt_release_pte(unsigned long pfn)
10011001
{
10021002
PVOP_VCALL1(pv_mmu_ops.release_pte, pfn);
10031003
}
10041004

1005-
static inline void paravirt_alloc_pmd(struct mm_struct *mm, unsigned pfn)
1005+
static inline void paravirt_alloc_pmd(struct mm_struct *mm, unsigned long pfn)
10061006
{
10071007
PVOP_VCALL2(pv_mmu_ops.alloc_pmd, mm, pfn);
10081008
}
10091009

1010-
static inline void paravirt_alloc_pmd_clone(unsigned pfn, unsigned clonepfn,
1011-
unsigned start, unsigned count)
1010+
static inline void paravirt_alloc_pmd_clone(unsigned long pfn, unsigned long clonepfn,
1011+
unsigned long start, unsigned long count)
10121012
{
10131013
PVOP_VCALL4(pv_mmu_ops.alloc_pmd_clone, pfn, clonepfn, start, count);
10141014
}
1015-
static inline void paravirt_release_pmd(unsigned pfn)
1015+
static inline void paravirt_release_pmd(unsigned long pfn)
10161016
{
10171017
PVOP_VCALL1(pv_mmu_ops.release_pmd, pfn);
10181018
}
10191019

1020-
static inline void paravirt_alloc_pud(struct mm_struct *mm, unsigned pfn)
1020+
static inline void paravirt_alloc_pud(struct mm_struct *mm, unsigned long pfn)
10211021
{
10221022
PVOP_VCALL2(pv_mmu_ops.alloc_pud, mm, pfn);
10231023
}
1024-
static inline void paravirt_release_pud(unsigned pfn)
1024+
static inline void paravirt_release_pud(unsigned long pfn)
10251025
{
10261026
PVOP_VCALL1(pv_mmu_ops.release_pud, pfn);
10271027
}

0 commit comments

Comments
 (0)