ContiguousPTE[2/12] modify copy_user_pte
Change-Id: Ie696245a8c09e87c48426bc3e74a6f049a085471
This commit is contained in:
committed by
Masamichi Takagi
parent
d1b36aab62
commit
b6de164e9a
@ -332,6 +332,92 @@ static inline void pte_set_dirty(pte_t *ptep, size_t pgsize)
|
||||
return;
|
||||
}
|
||||
|
||||
static inline int pte_is_contiguous(pte_t *ptep)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int pgsize_is_contiguous(size_t pgsize)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int pgsize_to_tbllv(size_t pgsize)
|
||||
{
|
||||
switch (pgsize) {
|
||||
case PTL1_SIZE: return 1;
|
||||
case PTL2_SIZE: return 2;
|
||||
case PTL3_SIZE: return 3;
|
||||
case PTL4_SIZE: return 4;
|
||||
default:
|
||||
#if 0 /* XXX: workaround. cannot use panic() here */
|
||||
panic("pgsize_to_tbllv");
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline size_t tbllv_to_pgsize(int level)
|
||||
{
|
||||
switch (level) {
|
||||
case 1: return PTL1_SIZE;
|
||||
case 2: return PTL2_SIZE;
|
||||
case 3: return PTL3_SIZE;
|
||||
case 4: return PTL4_SIZE;
|
||||
default:
|
||||
#if 0 /* XXX: workaround. cannot use panic() here */
|
||||
panic("tbllv_to_pgsize");
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline size_t tbllv_to_contpgsize(int level)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int tbllv_to_contpgshift(int level)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline pte_t *get_contiguous_head(pte_t *__ptep, size_t __pgsize)
|
||||
{
|
||||
return __ptep;
|
||||
}
|
||||
|
||||
static inline pte_t *get_contiguous_tail(pte_t *__ptep, size_t __pgsize)
|
||||
{
|
||||
return __ptep;
|
||||
}
|
||||
|
||||
static inline int split_contiguous_pages(pte_t *ptep, size_t pgsize)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int page_is_contiguous_head(pte_t *ptep, size_t pgsize)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int page_is_contiguous_tail(pte_t *ptep, size_t pgsize)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void arch_adjust_allocate_page_size(uintptr_t fault_addr,
|
||||
pte_t *ptep,
|
||||
void **pgaddrp,
|
||||
size_t *pgsizep)
|
||||
{
|
||||
}
|
||||
|
||||
struct page_table;
|
||||
void set_pte(pte_t *ppte, unsigned long phys, enum ihk_mc_pt_attribute attr);
|
||||
pte_t *get_pte(struct page_table *pt, void *virt, enum ihk_mc_pt_attribute attr);
|
||||
|
||||
@ -646,11 +646,11 @@ static int copy_user_pte(void *arg0, page_table_t src_pt, pte_t *src_ptep, void
|
||||
intptr_t src_phys;
|
||||
struct page *src_page;
|
||||
void *src_kvirt;
|
||||
const size_t pgsize = (size_t)1 << pgshift;
|
||||
size_t pgsize = (size_t)1 << pgshift;
|
||||
int npages;
|
||||
void *virt = NULL;
|
||||
intptr_t phys;
|
||||
const int pgalign = pgshift - PAGE_SHIFT;
|
||||
int pgalign = pgshift - PAGE_SHIFT;
|
||||
enum ihk_mc_pt_attribute attr;
|
||||
|
||||
if (!pte_is_present(src_ptep)) {
|
||||
@ -672,6 +672,19 @@ static int copy_user_pte(void *arg0, page_table_t src_pt, pte_t *src_ptep, void
|
||||
attr = pte_get_attr(src_ptep, pgsize);
|
||||
}
|
||||
else {
|
||||
if (pte_is_contiguous(src_ptep)) {
|
||||
if (page_is_contiguous_head(src_ptep, pgsize)) {
|
||||
int level = pgsize_to_tbllv(pgsize);
|
||||
|
||||
pgsize = tbllv_to_contpgsize(level);
|
||||
pgalign = tbllv_to_contpgshift(level);
|
||||
pgalign -= PAGE_SHIFT;
|
||||
} else {
|
||||
error = 0;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
dkprintf("copy_user_pte(): 0x%lx PTE found\n", pgaddr);
|
||||
dkprintf("copy_user_pte(): page size: %d\n", pgsize);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user