[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/shadow: sh_validate_guest_pt_write() is HVM-only
commit f1f20bb3fab9c307d04b0dd55ec8c5b8ab36363a Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Tue Mar 12 14:44:38 2019 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Tue Mar 12 14:44:38 2019 +0100 x86/shadow: sh_validate_guest_pt_write() is HVM-only Move the function to hvm.c, make it static, and drop its sh_ prefix. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Acked-by: Tim Deegan <tim@xxxxxxx> --- xen/arch/x86/mm/shadow/common.c | 27 --------------------------- xen/arch/x86/mm/shadow/hvm.c | 32 ++++++++++++++++++++++++++++++-- xen/arch/x86/mm/shadow/private.h | 4 ---- 3 files changed, 30 insertions(+), 33 deletions(-) diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c index 025071a163..2d44855388 100644 --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -886,33 +886,6 @@ sh_validate_guest_entry(struct vcpu *v, mfn_t gmfn, void *entry, u32 size) } -void -sh_validate_guest_pt_write(struct vcpu *v, mfn_t gmfn, - void *entry, u32 size) -/* This is the entry point for emulated writes to pagetables in HVM guests and - * PV translated guests. - */ -{ - struct domain *d = v->domain; - int rc; - - ASSERT(paging_locked_by_me(v->domain)); - rc = sh_validate_guest_entry(v, gmfn, entry, size); - if ( rc & SHADOW_SET_FLUSH ) - /* Need to flush TLBs to pick up shadow PT changes */ - flush_tlb_mask(d->dirty_cpumask); - if ( rc & SHADOW_SET_ERROR ) - { - /* This page is probably not a pagetable any more: tear it out of the - * shadows, along with any tables that reference it. - * Since the validate call above will have made a "safe" (i.e. zero) - * shadow entry, we can let the domain live even if we can't fully - * unshadow the page. */ - sh_remove_shadows(d, gmfn, 0, 0); - } -} - - /**************************************************************************/ /* Memory management for shadow pages. */ diff --git a/xen/arch/x86/mm/shadow/hvm.c b/xen/arch/x86/mm/shadow/hvm.c index 8994cb9f87..bf9fd20770 100644 --- a/xen/arch/x86/mm/shadow/hvm.c +++ b/xen/arch/x86/mm/shadow/hvm.c @@ -493,6 +493,34 @@ static inline void check_for_early_unshadow(struct vcpu *v, mfn_t gmfn) #endif } +/* This is the entry point for emulated writes to pagetables in HVM guests */ +static void validate_guest_pt_write(struct vcpu *v, mfn_t gmfn, + void *entry, unsigned int size) +{ + struct domain *d = v->domain; + int rc; + + ASSERT(paging_locked_by_me(v->domain)); + + rc = sh_validate_guest_entry(v, gmfn, entry, size); + + if ( rc & SHADOW_SET_FLUSH ) + /* Need to flush TLBs to pick up shadow PT changes */ + flush_tlb_mask(d->dirty_cpumask); + + if ( rc & SHADOW_SET_ERROR ) + { + /* + * This page is probably not a pagetable any more: tear it out of the + * shadows, along with any tables that reference it. + * Since the validate call above will have made a "safe" (i.e. zero) + * shadow entry, we can let the domain live even if we can't fully + * unshadow the page. + */ + sh_remove_shadows(d, gmfn, 0, 0); + } +} + /* * Tidy up after the emulated write: mark pages dirty, verify the new * contents, and undo the mapping. @@ -558,9 +586,9 @@ static void sh_emulate_unmap_dest(struct vcpu *v, void *addr, ASSERT(b2 < bytes); } if ( likely(b1 > 0) ) - sh_validate_guest_pt_write(v, sh_ctxt->mfn[0], addr, b1); + validate_guest_pt_write(v, sh_ctxt->mfn[0], addr, b1); if ( unlikely(b2 > 0) ) - sh_validate_guest_pt_write(v, sh_ctxt->mfn[1], addr + b1, b2); + validate_guest_pt_write(v, sh_ctxt->mfn[1], addr + b1, b2); } paging_mark_dirty(v->domain, sh_ctxt->mfn[0]); diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h index 580ef3e29e..5a94b20c4d 100644 --- a/xen/arch/x86/mm/shadow/private.h +++ b/xen/arch/x86/mm/shadow/private.h @@ -359,10 +359,6 @@ void sh_install_xen_entries_in_l4(struct domain *, mfn_t gl4mfn, mfn_t sl4mfn); /* Update the shadows in response to a pagetable write from Xen */ int sh_validate_guest_entry(struct vcpu *v, mfn_t gmfn, void *entry, u32 size); -/* Update the shadows in response to a pagetable write from a HVM guest */ -void sh_validate_guest_pt_write(struct vcpu *v, mfn_t gmfn, - void *entry, u32 size); - /* Remove all writeable mappings of a guest frame from the shadows. * Returns non-zero if we need to flush TLBs. * level and fault_addr desribe how we found this to be a pagetable; -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |