mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
bitkeeper revision 1.1726.1.8 (42c1acafTSObuXeDW7_GDxYN5dosRA)
Grant table support changes and fix cmpxchg_user Signed-off-by: Matt Chapman <matthewc@hp.com>
This commit is contained in:
1 parent
f76a149879
commit
cbd0cf0989
3 files changed
+58
-10
No files matched your search
+35
-1
@@ -465,10 +465,44 @@ if (unlikely(page_to_phys(p) > vhpt_paddr && page_to_phys(p) < vhpt_pend)) {
|
||||
set_pte(pte, pfn_pte(page_to_phys(p) >> PAGE_SHIFT,
|
||||
__pgprot(__DIRTY_BITS | _PAGE_PL_2 | _PAGE_AR_RWX)));
|
||||
}
|
||||
else printk("map_new_domain_page: page %p already mapped!\n",p);
|
||||
else printk("map_new_domain_page: mpaddr %lx already mapped!\n",mpaddr);
|
||||
return p;
|
||||
}
|
||||
|
||||
/* map a physical address to the specified metaphysical addr */
|
||||
void map_domain_page(struct domain *d, unsigned long mpaddr, unsigned long physaddr)
|
||||
{
|
||||
struct mm_struct *mm = d->arch.mm;
|
||||
pgd_t *pgd;
|
||||
pud_t *pud;
|
||||
pmd_t *pmd;
|
||||
pte_t *pte;
|
||||
|
||||
if (!mm->pgd) {
|
||||
printk("map_domain_page: domain pgd must exist!\n");
|
||||
return;
|
||||
}
|
||||
pgd = pgd_offset(mm,mpaddr);
|
||||
if (pgd_none(*pgd))
|
||||
pgd_populate(mm, pgd, pud_alloc_one(mm,mpaddr));
|
||||
|
||||
pud = pud_offset(pgd, mpaddr);
|
||||
if (pud_none(*pud))
|
||||
pud_populate(mm, pud, pmd_alloc_one(mm,mpaddr));
|
||||
|
||||
pmd = pmd_offset(pud, mpaddr);
|
||||
if (pmd_none(*pmd))
|
||||
pmd_populate_kernel(mm, pmd, pte_alloc_one_kernel(mm,mpaddr));
|
||||
// pmd_populate(mm, pmd, pte_alloc_one(mm,mpaddr));
|
||||
|
||||
pte = pte_offset_map(pmd, mpaddr);
|
||||
if (pte_none(*pte)) {
|
||||
set_pte(pte, pfn_pte(physaddr >> PAGE_SHIFT,
|
||||
__pgprot(__DIRTY_BITS | _PAGE_PL_2 | _PAGE_AR_RWX)));
|
||||
}
|
||||
else printk("map_domain_page: mpaddr %lx already mapped!\n",mpaddr);
|
||||
}
|
||||
|
||||
void mpafoo(unsigned long mpaddr)
|
||||
{
|
||||
extern unsigned long privop_trace;
|
||||
|
||||
@@ -570,13 +570,13 @@ __gnttab_unmap_grant_ref(
|
||||
/* Frame is now unmapped for device access. */
|
||||
}
|
||||
|
||||
#ifdef __ia64__
|
||||
// FIXME-ia64: any error checking need to be done here?
|
||||
#else
|
||||
if ( (virt != 0) &&
|
||||
(flags & GNTMAP_host_map) &&
|
||||
((act->pin & (GNTPIN_hstw_mask | GNTPIN_hstr_mask)) > 0))
|
||||
{
|
||||
#ifdef __ia64__
|
||||
// FIXME-ia64: any error checking need to be done here?
|
||||
#else
|
||||
l1_pgentry_t *pl1e;
|
||||
unsigned long _ol1e;
|
||||
|
||||
@@ -609,6 +609,7 @@ __gnttab_unmap_grant_ref(
|
||||
rc = -EINVAL;
|
||||
goto unmap_out;
|
||||
}
|
||||
#endif
|
||||
|
||||
map->ref_and_flags &= ~GNTMAP_host_map;
|
||||
|
||||
@@ -627,7 +628,6 @@ __gnttab_unmap_grant_ref(
|
||||
rc = 0;
|
||||
*va = virt;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( (map->ref_and_flags & (GNTMAP_device_map|GNTMAP_host_map)) == 0)
|
||||
{
|
||||
@@ -696,6 +696,7 @@ gnttab_setup_table(
|
||||
gnttab_setup_table_t op;
|
||||
struct domain *d;
|
||||
int i;
|
||||
unsigned long addr;
|
||||
|
||||
if ( count != 1 )
|
||||
return -EINVAL;
|
||||
@@ -735,10 +736,24 @@ gnttab_setup_table(
|
||||
{
|
||||
ASSERT(d->grant_table != NULL);
|
||||
(void)put_user(GNTST_okay, &uop->status);
|
||||
#ifdef __ia64__
|
||||
if (d == dom0) {
|
||||
for ( i = 0; i < op.nr_frames; i++ )
|
||||
(void)put_user(
|
||||
(virt_to_phys(d->grant_table->shared) >> PAGE_SHIFT) + i,
|
||||
&uop->frame_list[i]);
|
||||
} else {
|
||||
/* IA64 hack - need to map it somewhere */
|
||||
addr = (1UL << 40);
|
||||
map_domain_page(d, addr, virt_to_phys(d->grant_table->shared));
|
||||
(void)put_user(addr >> PAGE_SHIFT, &uop->frame_list[0]);
|
||||
}
|
||||
#else
|
||||
for ( i = 0; i < op.nr_frames; i++ )
|
||||
(void)put_user(
|
||||
(virt_to_phys(d->grant_table->shared) >> PAGE_SHIFT) + i,
|
||||
&uop->frame_list[i]);
|
||||
#endif
|
||||
}
|
||||
|
||||
put_domain(d);
|
||||
|
||||
@@ -66,13 +66,12 @@ extern struct task_struct *vmx_ia64_switch_to (void *next_task);
|
||||
register long __gu_r8 asm ("r8"); \
|
||||
register long __gu_r9 asm ("r9"); \
|
||||
asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \
|
||||
asm volatile ("mov %2=r0;;\n" \
|
||||
"[1:]\tcmpxchg"_size".acq %0=[%3],%4,ar.ccv\n" \
|
||||
"\t.xdata4 \"__ex_table\", 1b-., 1f-.+4\n" \
|
||||
asm volatile ("mov %1=r0;;\n" \
|
||||
"[1:]\tcmpxchg"_size".acq %0=[%2],%3,ar.ccv\n" \
|
||||
"\t.xdata4 \"__ex_table\", 1b-., 1f-.\n" \
|
||||
"[1:]" \
|
||||
: "=r"(old), "=r"(__gu_r9), "=r"(__gu_r8) : \
|
||||
: "=r"(old), "=r"(__gu_r8) : \
|
||||
"r"(ptr), "r"(new) : "memory"); \
|
||||
(old) = __gu_r9; \
|
||||
__gu_r8; \
|
||||
})
|
||||
|
||||
|
||||