mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-19 18:24:14 +08:00
f87e4cac4f
This is a fairly straightforward Xen implementation of smp_ops. Xen has its own IPI mechanisms, and has no dependency on any APIC-based IPI. The smp_ops hooks and the flush_tlb_others pv_op allow a Xen guest to avoid all APIC code in arch/i386 (the only apic operation is a single apic_read for the apic version number). One subtle point which needs to be addressed is unpinning pagetables when another cpu may have a lazy tlb reference to the pagetable. Xen will not allow an in-use pagetable to be unpinned, so we must find any other cpus with a reference to the pagetable and get them to shoot down their references. Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com> Signed-off-by: Chris Wright <chrisw@sous-sol.org> Cc: Benjamin LaHaise <bcrl@kvack.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Andi Kleen <ak@suse.de>
61 lines
1.9 KiB
C
61 lines
1.9 KiB
C
#ifndef _XEN_MMU_H
|
|
|
|
#include <linux/linkage.h>
|
|
#include <asm/page.h>
|
|
|
|
/*
|
|
* Page-directory addresses above 4GB do not fit into architectural %cr3.
|
|
* When accessing %cr3, or equivalent field in vcpu_guest_context, guests
|
|
* must use the following accessor macros to pack/unpack valid MFNs.
|
|
*
|
|
* Note that Xen is using the fact that the pagetable base is always
|
|
* page-aligned, and putting the 12 MSB of the address into the 12 LSB
|
|
* of cr3.
|
|
*/
|
|
#define xen_pfn_to_cr3(pfn) (((unsigned)(pfn) << 12) | ((unsigned)(pfn) >> 20))
|
|
#define xen_cr3_to_pfn(cr3) (((unsigned)(cr3) >> 12) | ((unsigned)(cr3) << 20))
|
|
|
|
|
|
void set_pte_mfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags);
|
|
|
|
void xen_set_pte(pte_t *ptep, pte_t pteval);
|
|
void xen_set_pte_at(struct mm_struct *mm, unsigned long addr,
|
|
pte_t *ptep, pte_t pteval);
|
|
void xen_set_pmd(pmd_t *pmdp, pmd_t pmdval);
|
|
|
|
void xen_activate_mm(struct mm_struct *prev, struct mm_struct *next);
|
|
void xen_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm);
|
|
void xen_exit_mmap(struct mm_struct *mm);
|
|
|
|
void xen_pgd_pin(pgd_t *pgd);
|
|
//void xen_pgd_unpin(pgd_t *pgd);
|
|
|
|
#ifdef CONFIG_X86_PAE
|
|
unsigned long long xen_pte_val(pte_t);
|
|
unsigned long long xen_pmd_val(pmd_t);
|
|
unsigned long long xen_pgd_val(pgd_t);
|
|
|
|
pte_t xen_make_pte(unsigned long long);
|
|
pmd_t xen_make_pmd(unsigned long long);
|
|
pgd_t xen_make_pgd(unsigned long long);
|
|
|
|
void xen_set_pte_at(struct mm_struct *mm, unsigned long addr,
|
|
pte_t *ptep, pte_t pteval);
|
|
void xen_set_pte_atomic(pte_t *ptep, pte_t pte);
|
|
void xen_set_pud(pud_t *ptr, pud_t val);
|
|
void xen_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
|
|
void xen_pmd_clear(pmd_t *pmdp);
|
|
|
|
|
|
#else
|
|
unsigned long xen_pte_val(pte_t);
|
|
unsigned long xen_pmd_val(pmd_t);
|
|
unsigned long xen_pgd_val(pgd_t);
|
|
|
|
pte_t xen_make_pte(unsigned long);
|
|
pmd_t xen_make_pmd(unsigned long);
|
|
pgd_t xen_make_pgd(unsigned long);
|
|
#endif
|
|
|
|
#endif /* _XEN_MMU_H */
|