Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 99576
b: refs/heads/master
c: e57778a
h: refs/heads/master
v: v3
  • Loading branch information
Jeremy Fitzhardinge authored and Ingo Molnar committed Jun 25, 2008
1 parent 09355ab commit 2d5abc4
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 08b882c627aeeeb3cfd3c4354f0d360d7949549d
refs/heads/master: e57778a1e30470c9f5b79e370511b9af29b59c48
13 changes: 10 additions & 3 deletions trunk/arch/x86/xen/enlighten.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ static void __init xen_banner(void)
{
printk(KERN_INFO "Booting paravirtualized kernel on %s\n",
pv_info.name);
printk(KERN_INFO "Hypervisor signature: %s\n", xen_start_info->magic);
printk(KERN_INFO "Hypervisor signature: %s%s\n",
xen_start_info->magic,
xen_feature(XENFEAT_mmu_pt_update_preserve_ad) ? " (preserve-AD)" : "");
}

static void xen_cpuid(unsigned int *ax, unsigned int *bx,
Expand Down Expand Up @@ -1243,6 +1245,8 @@ asmlinkage void __init xen_start_kernel(void)

BUG_ON(memcmp(xen_start_info->magic, "xen-3", 5) != 0);

xen_setup_features();

/* Install Xen paravirt ops */
pv_info = xen_info;
pv_init_ops = xen_init_ops;
Expand All @@ -1252,14 +1256,17 @@ asmlinkage void __init xen_start_kernel(void)
pv_apic_ops = xen_apic_ops;
pv_mmu_ops = xen_mmu_ops;

if (xen_feature(XENFEAT_mmu_pt_update_preserve_ad)) {
pv_mmu_ops.ptep_modify_prot_start = xen_ptep_modify_prot_start;
pv_mmu_ops.ptep_modify_prot_commit = xen_ptep_modify_prot_commit;
}

machine_ops = xen_machine_ops;

#ifdef CONFIG_SMP
smp_ops = xen_smp_ops;
#endif

xen_setup_features();

/* Get mfn list */
if (!xen_feature(XENFEAT_auto_translated_physmap))
xen_build_dynamic_phys_to_machine();
Expand Down
21 changes: 21 additions & 0 deletions trunk/arch/x86/xen/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,27 @@ void xen_set_pte_at(struct mm_struct *mm, unsigned long addr,
preempt_enable();
}

pte_t xen_ptep_modify_prot_start(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
{
/* Just return the pte as-is. We preserve the bits on commit */
return *ptep;
}

void xen_ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr,
pte_t *ptep, pte_t pte)
{
struct multicall_space mcs;
struct mmu_update *u;

mcs = xen_mc_entry(sizeof(*u));
u = mcs.args;
u->ptr = virt_to_machine(ptep).maddr | MMU_PT_UPDATE_PRESERVE_AD;
u->val = pte_val_ma(pte);
MULTI_mmu_update(mcs.mc, u, 1, NULL, DOMID_SELF);

xen_mc_issue(PARAVIRT_LAZY_MMU);
}

/* Assume pteval_t is equivalent to all the other *val_t types. */
static pteval_t pte_mfn_to_pfn(pteval_t val)
{
Expand Down
4 changes: 4 additions & 0 deletions trunk/arch/x86/xen/mmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,8 @@ void xen_set_pud_hyper(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);

pte_t xen_ptep_modify_prot_start(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
void xen_ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr,
pte_t *ptep, pte_t pte);

#endif /* _XEN_MMU_H */
3 changes: 3 additions & 0 deletions trunk/include/xen/interface/features.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
*/
#define XENFEAT_pae_pgdir_above_4gb 4

/* x86: Does this Xen host support the MMU_PT_UPDATE_PRESERVE_AD hypercall? */
#define XENFEAT_mmu_pt_update_preserve_ad 5

#define XENFEAT_NR_SUBMAPS 1

#endif /* __XEN_PUBLIC_FEATURES_H__ */
9 changes: 7 additions & 2 deletions trunk/include/xen/interface/xen.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,14 @@
* ptr[:2] -- Machine address within the frame whose mapping to modify.
* The frame must belong to the FD, if one is specified.
* val -- Value to write into the mapping entry.
*
* ptr[1:0] == MMU_PT_UPDATE_PRESERVE_AD:
* As MMU_NORMAL_PT_UPDATE above, but A/D bits currently in the PTE are ORed
* with those in @val.
*/
#define MMU_NORMAL_PT_UPDATE 0 /* checked '*ptr = val'. ptr is MA. */
#define MMU_MACHPHYS_UPDATE 1 /* ptr = MA of frame to modify entry for */
#define MMU_NORMAL_PT_UPDATE 0 /* checked '*ptr = val'. ptr is MA. */
#define MMU_MACHPHYS_UPDATE 1 /* ptr = MA of frame to modify entry for */
#define MMU_PT_UPDATE_PRESERVE_AD 2 /* atomically: *ptr = val | (*ptr&(A|D)) */

/*
* MMU EXTENDED OPERATIONS
Expand Down

0 comments on commit 2d5abc4

Please sign in to comment.