Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
forked fromtorvalds/linux

Commite61ce6a

Browse files
Toshi Kanitorvalds
Toshi Kani
authored andcommitted
mm: change ioremap to set up huge I/O mappings
ioremap_pud_range() and ioremap_pmd_range() are changed to create huge I/Omappings when their capability is enabled, and a request meets requiredconditions -- both virtual & physical addresses are aligned by their hugepage size, and a requested range fufills their huge page size. Whenpud_set_huge() or pmd_set_huge() returns zero, i.e. no-operation isperformed, the code simply falls back to the next level.The changes are only enabled when CONFIG_HAVE_ARCH_HUGE_VMAP is defined onthe architecture.Signed-off-by: Toshi Kani <toshi.kani@hp.com>Cc: "H. Peter Anvin" <hpa@zytor.com>Cc: Thomas Gleixner <tglx@linutronix.de>Cc: Ingo Molnar <mingo@redhat.com>Cc: Arnd Bergmann <arnd@arndb.de>Cc: Dave Hansen <dave.hansen@intel.com>Cc: Robert Elliott <Elliott@hp.com>Signed-off-by: Andrew Morton <akpm@linux-foundation.org>Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent0ddab1d commite61ce6a

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

‎include/asm-generic/pgtable.h‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include<linux/mm_types.h>
88
#include<linux/bug.h>
9+
#include<linux/errno.h>
910

1011
#if4- defined(__PAGETABLE_PUD_FOLDED)- defined(__PAGETABLE_PMD_FOLDED)!= \
1112
CONFIG_PGTABLE_LEVELS
@@ -696,6 +697,20 @@ static inline int pmd_protnone(pmd_t pmd)
696697

697698
#endif/* CONFIG_MMU */
698699

700+
#ifdefCONFIG_HAVE_ARCH_HUGE_VMAP
701+
intpud_set_huge(pud_t*pud,phys_addr_taddr,pgprot_tprot);
702+
intpmd_set_huge(pmd_t*pmd,phys_addr_taddr,pgprot_tprot);
703+
#else/* !CONFIG_HAVE_ARCH_HUGE_VMAP */
704+
staticinlineintpud_set_huge(pud_t*pud,phys_addr_taddr,pgprot_tprot)
705+
{
706+
return0;
707+
}
708+
staticinlineintpmd_set_huge(pmd_t*pmd,phys_addr_taddr,pgprot_tprot)
709+
{
710+
return0;
711+
}
712+
#endif/* CONFIG_HAVE_ARCH_HUGE_VMAP */
713+
699714
#endif/* !__ASSEMBLY__ */
700715

701716
#ifndefio_remap_pfn_range

‎lib/ioremap.c‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ static inline int ioremap_pmd_range(pud_t *pud, unsigned long addr,
8080
return-ENOMEM;
8181
do {
8282
next=pmd_addr_end(addr,end);
83+
84+
if (ioremap_pmd_enabled()&&
85+
((next-addr)==PMD_SIZE)&&
86+
IS_ALIGNED(phys_addr+addr,PMD_SIZE)) {
87+
if (pmd_set_huge(pmd,phys_addr+addr,prot))
88+
continue;
89+
}
90+
8391
if (ioremap_pte_range(pmd,addr,next,phys_addr+addr,prot))
8492
return-ENOMEM;
8593
}while (pmd++,addr=next,addr!=end);
@@ -98,6 +106,14 @@ static inline int ioremap_pud_range(pgd_t *pgd, unsigned long addr,
98106
return-ENOMEM;
99107
do {
100108
next=pud_addr_end(addr,end);
109+
110+
if (ioremap_pud_enabled()&&
111+
((next-addr)==PUD_SIZE)&&
112+
IS_ALIGNED(phys_addr+addr,PUD_SIZE)) {
113+
if (pud_set_huge(pud,phys_addr+addr,prot))
114+
continue;
115+
}
116+
101117
if (ioremap_pmd_range(pud,addr,next,phys_addr+addr,prot))
102118
return-ENOMEM;
103119
}while (pud++,addr=next,addr!=end);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp