introduction of ihk_mc_pt_virt_to_phys_size()
This commit is contained in:
@ -490,8 +490,10 @@ uint64_t ihk_mc_pt_virt_to_pagemap(struct page_table *pt, unsigned long virt)
|
|||||||
return pagemap;
|
return pagemap;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ihk_mc_pt_virt_to_phys(struct page_table *pt,
|
int ihk_mc_pt_virt_to_phys_size(struct page_table *pt,
|
||||||
const void *virt, unsigned long *phys)
|
const void *virt,
|
||||||
|
unsigned long *phys,
|
||||||
|
unsigned long *size)
|
||||||
{
|
{
|
||||||
int l4idx, l3idx, l2idx, l1idx;
|
int l4idx, l3idx, l2idx, l1idx;
|
||||||
unsigned long v = (unsigned long)virt;
|
unsigned long v = (unsigned long)virt;
|
||||||
@ -513,6 +515,7 @@ int ihk_mc_pt_virt_to_phys(struct page_table *pt,
|
|||||||
if ((pt->entry[l3idx] & PFL3_SIZE)) {
|
if ((pt->entry[l3idx] & PFL3_SIZE)) {
|
||||||
*phys = pte_get_phys(&pt->entry[l3idx])
|
*phys = pte_get_phys(&pt->entry[l3idx])
|
||||||
| (v & (PTL3_SIZE - 1));
|
| (v & (PTL3_SIZE - 1));
|
||||||
|
if (size) *size = PTL3_SIZE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
pt = phys_to_virt(pte_get_phys(&pt->entry[l3idx]));
|
pt = phys_to_virt(pte_get_phys(&pt->entry[l3idx]));
|
||||||
@ -523,6 +526,7 @@ int ihk_mc_pt_virt_to_phys(struct page_table *pt,
|
|||||||
if ((pt->entry[l2idx] & PFL2_SIZE)) {
|
if ((pt->entry[l2idx] & PFL2_SIZE)) {
|
||||||
*phys = pte_get_phys(&pt->entry[l2idx])
|
*phys = pte_get_phys(&pt->entry[l2idx])
|
||||||
| (v & (PTL2_SIZE - 1));
|
| (v & (PTL2_SIZE - 1));
|
||||||
|
if (size) *size = PTL2_SIZE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
pt = phys_to_virt(pte_get_phys(&pt->entry[l2idx]));
|
pt = phys_to_virt(pte_get_phys(&pt->entry[l2idx]));
|
||||||
@ -532,9 +536,17 @@ int ihk_mc_pt_virt_to_phys(struct page_table *pt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
*phys = pte_get_phys(&pt->entry[l1idx]) | (v & (PTL1_SIZE - 1));
|
*phys = pte_get_phys(&pt->entry[l1idx]) | (v & (PTL1_SIZE - 1));
|
||||||
|
if (size) *size = PTL1_SIZE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ihk_mc_pt_virt_to_phys(struct page_table *pt,
|
||||||
|
const void *virt, unsigned long *phys)
|
||||||
|
{
|
||||||
|
return ihk_mc_pt_virt_to_phys_size(pt, virt, phys, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int ihk_mc_pt_print_pte(struct page_table *pt, void *virt)
|
int ihk_mc_pt_print_pte(struct page_table *pt, void *virt)
|
||||||
{
|
{
|
||||||
int l4idx, l3idx, l2idx, l1idx;
|
int l4idx, l3idx, l2idx, l1idx;
|
||||||
|
|||||||
@ -7694,6 +7694,7 @@ static int do_process_vm_read_writev(int pid,
|
|||||||
struct process_vm *rvm = NULL;
|
struct process_vm *rvm = NULL;
|
||||||
unsigned long rphys;
|
unsigned long rphys;
|
||||||
unsigned long rpage_left;
|
unsigned long rpage_left;
|
||||||
|
unsigned long psize;
|
||||||
void *rva;
|
void *rva;
|
||||||
struct vm_range *range;
|
struct vm_range *range;
|
||||||
struct mcs_rwlock_node_irqsave lock;
|
struct mcs_rwlock_node_irqsave lock;
|
||||||
|
|||||||
@ -164,6 +164,10 @@ struct page_table *ihk_mc_pt_create(enum ihk_mc_ap_flag ap_flag);
|
|||||||
/* XXX: proper use of struct page_table and page_table_t is unknown */
|
/* XXX: proper use of struct page_table and page_table_t is unknown */
|
||||||
void ihk_mc_pt_destroy(struct page_table *pt);
|
void ihk_mc_pt_destroy(struct page_table *pt);
|
||||||
void ihk_mc_load_page_table(struct page_table *pt);
|
void ihk_mc_load_page_table(struct page_table *pt);
|
||||||
|
int ihk_mc_pt_virt_to_phys_size(struct page_table *pt,
|
||||||
|
const void *virt,
|
||||||
|
unsigned long *phys,
|
||||||
|
unsigned long *size);
|
||||||
int ihk_mc_pt_virt_to_phys(struct page_table *pt,
|
int ihk_mc_pt_virt_to_phys(struct page_table *pt,
|
||||||
const void *virt, unsigned long *phys);
|
const void *virt, unsigned long *phys);
|
||||||
uint64_t ihk_mc_pt_virt_to_pagemap(struct page_table *pt, unsigned long virt);
|
uint64_t ihk_mc_pt_virt_to_pagemap(struct page_table *pt, unsigned long virt);
|
||||||
|
|||||||
Reference in New Issue
Block a user