Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xen: add xen_set_domain_pte()

Add xen_set_domain_pte() to allow setting a pte mapping a page from
another domain. The common case is to map from DOMID_IO, the pseudo
domain which owns all IO pages, but will also be used in the privcmd
interface to map other domain pages.

[ Impact: new Xen-internal API for cross-domain mappings ]

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>

authored by

Jeremy Fitzhardinge and committed by
Jeremy Fitzhardinge
eba3ff8b 655d406a

+9 -2
+1
arch/x86/include/asm/xen/page.h
··· 159 159 160 160 #define pgd_val_ma(x) ((x).pgd) 161 161 162 + void xen_set_domain_pte(pte_t *ptep, pte_t pteval, unsigned domid); 162 163 163 164 xmaddr_t arbitrary_virt_to_machine(void *address); 164 165 unsigned long arbitrary_virt_to_mfn(void *vaddr);
+8 -2
arch/x86/xen/mmu.c
··· 395 395 return pte_flags(pte) & _PAGE_IOMAP; 396 396 } 397 397 398 - static void xen_set_iomap_pte(pte_t *ptep, pte_t pteval) 398 + void xen_set_domain_pte(pte_t *ptep, pte_t pteval, unsigned domid) 399 399 { 400 400 struct multicall_space mcs; 401 401 struct mmu_update *u; ··· 407 407 u->ptr = arbitrary_virt_to_machine(ptep).maddr; 408 408 u->val = pte_val_ma(pteval); 409 409 410 - MULTI_mmu_update(mcs.mc, mcs.args, 1, NULL, DOMID_IO); 410 + MULTI_mmu_update(mcs.mc, mcs.args, 1, NULL, domid); 411 411 412 412 xen_mc_issue(PARAVIRT_LAZY_MMU); 413 + } 414 + EXPORT_SYMBOL_GPL(xen_set_domain_pte); 415 + 416 + static void xen_set_iomap_pte(pte_t *ptep, pte_t pteval) 417 + { 418 + xen_set_domain_pte(ptep, pteval, DOMID_IO); 413 419 } 414 420 415 421 static void xen_extend_mmu_update(const struct mmu_update *update)