From: "Jan Beulich" Subject: [PATCH v2 3/5] x86/mm: allow for building without shadow mode support Date: Mon, 02 Feb 2015 11:20:02 +0000 Message-ID: <54CF6B72020000780005BDB9@mail.emea.novell.com> References: <54CF68DF020000780005BD6C@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartDCE94A72.1__=" Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YIF31-0004HX-TY for xen-devel@lists.xenproject.org; Mon, 02 Feb 2015 11:20:08 +0000 In-Reply-To: <54CF68DF020000780005BD6C@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Andrew Cooper , Keir Fraser , Tim Deegan List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__PartDCE94A72.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Considering the complexity of the code, it seems to be a reasonable thing to allow people to disable that code entirely even outside the immediate need for this by the next patch. Signed-off-by: Jan Beulich --- v2: Set mode table in shadow_vcpu_init() stub. Convert BUG()/BUG_ON() to ASSERT()/ASSERT_UNREACHABLE() and make various of the stub functions macros or inline. Hide opt_dom0_shadow when !CONFIG_SHADOW_PAGING. Adjust Makefile modification. --- a/xen/arch/x86/Rules.mk +++ b/xen/arch/x86/Rules.mk @@ -32,9 +32,13 @@ x86 :=3D y x86_32 :=3D n x86_64 :=3D y =20 +shadow-paging ?=3D y + CFLAGS +=3D -mno-red-zone -mno-sse -fpic CFLAGS +=3D -fno-asynchronous-unwind-tables # -fvisibility=3Dhidden reduces -fpic cost, if it's available ifneq ($(call cc-option,$(CC),-fvisibility=3Dhidden,n),n) CFLAGS +=3D -DGCC_HAS_VISIBILITY_ATTRIBUTE endif + +CFLAGS-$(shadow-paging) +=3D -DCONFIG_SHADOW_PAGING --- a/xen/arch/x86/domain_build.c +++ b/xen/arch/x86/domain_build.c @@ -128,8 +128,10 @@ struct vcpu *__init alloc_dom0_vcpu0(str return alloc_vcpu(dom0, 0, 0); } =20 +#ifdef CONFIG_SHADOW_PAGING static bool_t __initdata opt_dom0_shadow; boolean_param("dom0_shadow", opt_dom0_shadow); +#endif =20 static char __initdata opt_dom0_ioports_disable[200] =3D ""; string_param("dom0_ioports_disable", opt_dom0_ioports_disable); @@ -1399,6 +1401,7 @@ int __init construct_dom0( regs->esi =3D vstartinfo_start; regs->eflags =3D X86_EFLAGS_IF; =20 +#ifdef CONFIG_SHADOW_PAGING if ( opt_dom0_shadow ) { if ( is_pvh_domain(d) ) @@ -1409,6 +1412,7 @@ int __init construct_dom0( if ( paging_enable(d, PG_SH_enable) =3D=3D 0 )=20 paging_update_paging_modes(v); } +#endif =20 /* * PVH Fixme: XENFEAT_supervisor_mode_kernel has been reused in PVH = with a --- a/xen/arch/x86/mm/paging.c +++ b/xen/arch/x86/mm/paging.c @@ -635,16 +635,16 @@ int paging_domain_init(struct domain *d, * don't want to leak any active log-dirty bitmaps */ d->arch.paging.log_dirty.top =3D _mfn(INVALID_MFN); =20 - /* The order of the *_init calls below is important, as the later - * ones may rewrite some common fields. Shadow pagetables are the - * default... */ - shadow_domain_init(d, domcr_flags); - - /* ... but we will use hardware assistance if it's available. */ + /* + * Shadow pagetables are the default, but we will use + * hardware assistance if it's available and enabled. + */ if ( hap_enabled(d) ) hap_domain_init(d); + else + rc =3D shadow_domain_init(d, domcr_flags); =20 - return 0; + return rc; } =20 /* vcpu paging struct initialization goes here */ @@ -822,12 +822,16 @@ int paging_enable(struct domain *d, u32=20 * and therefore its pagetables will soon be discarded */ void pagetable_dying(struct domain *d, paddr_t gpa) { +#ifdef CONFIG_SHADOW_PAGING struct vcpu *v; =20 ASSERT(paging_mode_shadow(d)); =20 v =3D d->vcpu[0]; v->arch.paging.mode->shadow.pagetable_dying(v, gpa); +#else + BUG(); +#endif } =20 /* Print paging-assistance info to the console */ --- a/xen/arch/x86/mm/shadow/Makefile +++ b/xen/arch/x86/mm/shadow/Makefile @@ -1,4 +1,8 @@ -obj-$(x86_64) +=3D common.o guest_2.o guest_3.o guest_4.o +ifeq ($(shadow-paging),y) +obj-y +=3D common.o guest_2.o guest_3.o guest_4.o +else +obj-y +=3D none.o +endif =20 guest_%.o: multi.c Makefile $(CC) $(CFLAGS) -DGUEST_PAGING_LEVELS=3D$* -c $< -o $@ --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -47,7 +47,7 @@ static void sh_clean_dirty_bitmap(struct =20 /* Set up the shadow-specific parts of a domain struct at start of day. * Called for every domain from arch_domain_create() */ -void shadow_domain_init(struct domain *d, unsigned int domcr_flags) +int shadow_domain_init(struct domain *d, unsigned int domcr_flags) { INIT_PAGE_LIST_HEAD(&d->arch.paging.shadow.freelist); INIT_PAGE_LIST_HEAD(&d->arch.paging.shadow.pinned_shadows); @@ -61,6 +61,8 @@ void shadow_domain_init(struct domain *d d->arch.paging.shadow.oos_off =3D (domcr_flags & DOMCRF_oos_off) ? 1 = : 0; #endif d->arch.paging.shadow.pagetable_dying_op =3D 0; + + return 0; } =20 /* Setup the shadow-specfic parts of a vcpu struct. Note: The most = important --- /dev/null +++ b/xen/arch/x86/mm/shadow/none.c @@ -0,0 +1,78 @@ +#include +#include + +static int _enable_log_dirty(struct domain *d, bool_t log_global) +{ + ASSERT(is_pv_domain(d)); + return -EOPNOTSUPP; +} + +static int _disable_log_dirty(struct domain *d) +{ + ASSERT(is_pv_domain(d)); + return -EOPNOTSUPP; +} + +static void _clean_dirty_bitmap(struct domain *d) +{ + ASSERT(is_pv_domain(d)); +} + +int shadow_domain_init(struct domain *d, unsigned int domcr_flags) +{ + paging_log_dirty_init(d, _enable_log_dirty, + _disable_log_dirty, _clean_dirty_bitmap); + return is_pv_domain(d) ? 0 : -EOPNOTSUPP; +} + +static int _page_fault(struct vcpu *v, unsigned long va, + struct cpu_user_regs *regs) +{ + ASSERT_UNREACHABLE(); + return 0; +} + +static int _invlpg(struct vcpu *v, unsigned long va) +{ + ASSERT_UNREACHABLE(); + return -EOPNOTSUPP; +} + +static unsigned long _gva_to_gfn(struct vcpu *v, struct p2m_domain *p2m, + unsigned long va, uint32_t *pfec) +{ + ASSERT_UNREACHABLE(); + return INVALID_GFN; +} + +static void _update_cr3(struct vcpu *v, int do_locking) +{ + ASSERT_UNREACHABLE(); +} + +static void _update_paging_modes(struct vcpu *v) +{ + ASSERT_UNREACHABLE(); +} + +static void _write_p2m_entry(struct domain *d, unsigned long gfn, + l1_pgentry_t *p, l1_pgentry_t new, + unsigned int level) +{ + ASSERT_UNREACHABLE(); +} + +static const struct paging_mode sh_paging_none =3D { + .page_fault =3D _page_fault, + .invlpg =3D _invlpg, + .gva_to_gfn =3D _gva_to_gfn, + .update_cr3 =3D _update_cr3, + .update_paging_modes =3D _update_paging_modes, + .write_p2m_entry =3D _write_p2m_entry, +}; + +void shadow_vcpu_init(struct vcpu *v) +{ + ASSERT(is_pv_domain(v->domain)); + v->arch.paging.mode =3D &sh_paging_none; +} --- a/xen/include/asm-x86/domain.h +++ b/xen/include/asm-x86/domain.h @@ -87,6 +87,7 @@ void hypercall_page_initialise(struct do /* shadow paging extension */ /************************************************/ struct shadow_domain { +#ifdef CONFIG_SHADOW_PAGING unsigned int opt_flags; /* runtime tunable optimizations = on/off */ struct page_list_head pinned_shadows; =20 @@ -116,9 +117,11 @@ struct shadow_domain { =20 /* Has this domain ever used HVMOP_pagetable_dying? */ bool_t pagetable_dying_op; +#endif }; =20 struct shadow_vcpu { +#ifdef CONFIG_SHADOW_PAGING /* PAE guests: per-vcpu shadow top-level table */ l3_pgentry_t l3table[4] __attribute__((__aligned__(32))); /* PAE guests: per-vcpu cache of the top-level *guest* entries */ @@ -144,6 +147,7 @@ struct shadow_vcpu { } oos_fixup[SHADOW_OOS_PAGES]; =20 bool_t pagetable_dying; +#endif }; =20 /************************************************/ --- a/xen/include/asm-x86/paging.h +++ b/xen/include/asm-x86/paging.h @@ -39,7 +39,11 @@ #define PG_SH_shift 20 #define PG_HAP_shift 21 /* We're in one of the shadow modes */ +#ifdef CONFIG_SHADOW_PAGING #define PG_SH_enable (1U << PG_SH_shift) +#else +#define PG_SH_enable 0 +#endif #define PG_HAP_enable (1U << PG_HAP_shift) =20 /* common paging mode bits */ @@ -74,6 +78,7 @@ =20 struct sh_emulate_ctxt; struct shadow_paging_mode { +#ifdef CONFIG_SHADOW_PAGING void (*detach_old_tables )(struct vcpu *v); int (*x86_emulate_write )(struct vcpu *v, unsigned long = va, void *src, u32 bytes, @@ -88,6 +93,7 @@ struct shadow_paging_mode { int (*guess_wrmap )(struct vcpu *v,=20 unsigned long vaddr, mfn_t = gmfn); void (*pagetable_dying )(struct vcpu *v, paddr_t gpa); +#endif /* For outsiders to tell what mode we're in */ unsigned int shadow_levels; }; --- a/xen/include/asm-x86/shadow.h +++ b/xen/include/asm-x86/shadow.h @@ -49,12 +49,14 @@ =20 /* Set up the shadow-specific parts of a domain struct at start of day. * Called from paging_domain_init(). */ -void shadow_domain_init(struct domain *d, unsigned int domcr_flags); +int shadow_domain_init(struct domain *d, unsigned int domcr_flags); =20 /* Setup the shadow-specific parts of a vcpu struct. It is called by * paging_vcpu_init() in paging.c */ void shadow_vcpu_init(struct vcpu *v); =20 +#ifdef CONFIG_SHADOW_PAGING + /* Enable an arbitrary shadow mode. Call once at domain creation. */ int shadow_enable(struct domain *d, u32 mode); =20 @@ -77,17 +79,40 @@ void shadow_teardown(struct domain *d); /* Call once all of the references to the domain have gone away */ void shadow_final_teardown(struct domain *d); =20 -/* Remove all shadows of the guest mfn. */ void sh_remove_shadows(struct vcpu *v, mfn_t gmfn, int fast, int all); + +/* Discard _all_ mappings from the domain's shadows. */ +void shadow_blow_tables_per_domain(struct domain *d); + +#else /* !CONFIG_SHADOW_PAGING */ + +#define shadow_teardown(d) ASSERT(is_pv_domain(d)) +#define shadow_final_teardown(d) ASSERT(is_pv_domain(d)) +#define shadow_enable(d, mode) \ + ({ ASSERT(is_pv_domain(d)); -EOPNOTSUPP; }) +#define shadow_track_dirty_vram(d, begin_pfn, nr, bitmap) \ + ({ ASSERT_UNREACHABLE(); -EOPNOTSUPP; }) + +static inline void sh_remove_shadows(struct vcpu *v, mfn_t gmfn, + bool_t fast, bool_t all) {} + +static inline void shadow_blow_tables_per_domain(struct domain *d) {} + +static inline int shadow_domctl(struct domain *d, xen_domctl_shadow_op_t = *sc, + XEN_GUEST_HANDLE_PARAM(void) u_domctl) +{ + return -EINVAL; +} + +#endif /* CONFIG_SHADOW_PAGING */ + +/* Remove all shadows of the guest mfn. */ static inline void shadow_remove_all_shadows(struct vcpu *v, mfn_t gmfn) { /* See the comment about locking in sh_remove_shadows */ sh_remove_shadows(v, gmfn, 0 /* Be thorough */, 1 /* Must succeed = */); } =20 -/* Discard _all_ mappings from the domain's shadows. */ -void shadow_blow_tables_per_domain(struct domain *d); - #endif /* _XEN_SHADOW_H */ =20 /* --- a/xen/include/xen/paging.h +++ b/xen/include/xen/paging.h @@ -7,7 +7,7 @@ #include #include =20 -#elif defined CONFIG_SHADOW +#elif defined CONFIG_SHADOW_PAGING =20 #include =20 --=__PartDCE94A72.1__= Content-Type: text/plain; name="x86-no-shadow.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-no-shadow.patch" x86/mm: allow for building without shadow mode support=0A=0AConsidering = the complexity of the code, it seems to be a reasonable=0Athing to allow = people to disable that code entirely even outside the=0Aimmediate need for = this by the next patch.=0A=0ASigned-off-by: Jan Beulich = =0A---=0Av2: Set mode table in shadow_vcpu_init() stub. Convert BUG()/BUG_O= N()=0A to ASSERT()/ASSERT_UNREACHABLE() and make various of the stub=0A = functions macros or inline. Hide opt_dom0_shadow when=0A !CONFIG_SHAD= OW_PAGING. Adjust Makefile modification.=0A=0A--- a/xen/arch/x86/Rules.mk= =0A+++ b/xen/arch/x86/Rules.mk=0A@@ -32,9 +32,13 @@ x86 :=3D y=0A x86_32 = :=3D n=0A x86_64 :=3D y=0A =0A+shadow-paging ?=3D y=0A+=0A CFLAGS +=3D = -mno-red-zone -mno-sse -fpic=0A CFLAGS +=3D -fno-asynchronous-unwind-tables= =0A # -fvisibility=3Dhidden reduces -fpic cost, if it's available=0A ifneq = ($(call cc-option,$(CC),-fvisibility=3Dhidden,n),n)=0A CFLAGS +=3D = -DGCC_HAS_VISIBILITY_ATTRIBUTE=0A endif=0A+=0A+CFLAGS-$(shadow-paging) = +=3D -DCONFIG_SHADOW_PAGING=0A--- a/xen/arch/x86/domain_build.c=0A+++ = b/xen/arch/x86/domain_build.c=0A@@ -128,8 +128,10 @@ struct vcpu *__init = alloc_dom0_vcpu0(str=0A return alloc_vcpu(dom0, 0, 0);=0A }=0A = =0A+#ifdef CONFIG_SHADOW_PAGING=0A static bool_t __initdata opt_dom0_shadow= ;=0A boolean_param("dom0_shadow", opt_dom0_shadow);=0A+#endif=0A =0A = static char __initdata opt_dom0_ioports_disable[200] =3D "";=0A string_para= m("dom0_ioports_disable", opt_dom0_ioports_disable);=0A@@ -1399,6 +1401,7 = @@ int __init construct_dom0(=0A regs->esi =3D vstartinfo_start;=0A = regs->eflags =3D X86_EFLAGS_IF;=0A =0A+#ifdef CONFIG_SHADOW_PAGING=0A = if ( opt_dom0_shadow )=0A {=0A if ( is_pvh_domain(d) )=0A@@ = -1409,6 +1412,7 @@ int __init construct_dom0(=0A if ( paging_enable= (d, PG_SH_enable) =3D=3D 0 ) =0A paging_update_paging_modes(v);= =0A }=0A+#endif=0A =0A /*=0A * PVH Fixme: XENFEAT_supervisor_m= ode_kernel has been reused in PVH with a=0A--- a/xen/arch/x86/mm/paging.c= =0A+++ b/xen/arch/x86/mm/paging.c=0A@@ -635,16 +635,16 @@ int paging_domain= _init(struct domain *d,=0A * don't want to leak any active log-dirty = bitmaps */=0A d->arch.paging.log_dirty.top =3D _mfn(INVALID_MFN);=0A = =0A- /* The order of the *_init calls below is important, as the = later=0A- * ones may rewrite some common fields. Shadow pagetables = are the=0A- * default... */=0A- shadow_domain_init(d, domcr_flags);= =0A-=0A- /* ... but we will use hardware assistance if it's available. = */=0A+ /*=0A+ * Shadow pagetables are the default, but we will = use=0A+ * hardware assistance if it's available and enabled.=0A+ = */=0A if ( hap_enabled(d) )=0A hap_domain_init(d);=0A+ = else=0A+ rc =3D shadow_domain_init(d, domcr_flags);=0A =0A- = return 0;=0A+ return rc;=0A }=0A =0A /* vcpu paging struct initializatio= n goes here */=0A@@ -822,12 +822,16 @@ int paging_enable(struct domain *d, = u32 =0A * and therefore its pagetables will soon be discarded */=0A void = pagetable_dying(struct domain *d, paddr_t gpa)=0A {=0A+#ifdef CONFIG_SHADOW= _PAGING=0A struct vcpu *v;=0A =0A ASSERT(paging_mode_shadow(d));=0A= =0A v =3D d->vcpu[0];=0A v->arch.paging.mode->shadow.pagetable_dyi= ng(v, gpa);=0A+#else=0A+ BUG();=0A+#endif=0A }=0A =0A /* Print = paging-assistance info to the console */=0A--- a/xen/arch/x86/mm/shadow/Mak= efile=0A+++ b/xen/arch/x86/mm/shadow/Makefile=0A@@ -1,4 +1,8 @@=0A-obj-$(x8= 6_64) +=3D common.o guest_2.o guest_3.o guest_4.o=0A+ifeq ($(shadow-paging)= ,y)=0A+obj-y +=3D common.o guest_2.o guest_3.o guest_4.o=0A+else=0A+obj-y = +=3D none.o=0A+endif=0A =0A guest_%.o: multi.c Makefile=0A $(CC) = $(CFLAGS) -DGUEST_PAGING_LEVELS=3D$* -c $< -o $@=0A--- a/xen/arch/x86/mm/sh= adow/common.c=0A+++ b/xen/arch/x86/mm/shadow/common.c=0A@@ -47,7 +47,7 @@ = static void sh_clean_dirty_bitmap(struct=0A =0A /* Set up the shadow-specif= ic parts of a domain struct at start of day.=0A * Called for every domain = from arch_domain_create() */=0A-void shadow_domain_init(struct domain *d, = unsigned int domcr_flags)=0A+int shadow_domain_init(struct domain *d, = unsigned int domcr_flags)=0A {=0A INIT_PAGE_LIST_HEAD(&d->arch.paging.s= hadow.freelist);=0A INIT_PAGE_LIST_HEAD(&d->arch.paging.shadow.pinned_s= hadows);=0A@@ -61,6 +61,8 @@ void shadow_domain_init(struct domain *d=0A = d->arch.paging.shadow.oos_off =3D (domcr_flags & DOMCRF_oos_off) ? 1 : = 0;=0A #endif=0A d->arch.paging.shadow.pagetable_dying_op =3D 0;=0A+=0A+= return 0;=0A }=0A =0A /* Setup the shadow-specfic parts of a vcpu = struct. Note: The most important=0A--- /dev/null=0A+++ b/xen/arch/x86/mm/sh= adow/none.c=0A@@ -0,0 +1,78 @@=0A+#include =0A+#include = =0A+=0A+static int _enable_log_dirty(struct domain *d, = bool_t log_global)=0A+{=0A+ ASSERT(is_pv_domain(d));=0A+ return = -EOPNOTSUPP;=0A+}=0A+=0A+static int _disable_log_dirty(struct domain = *d)=0A+{=0A+ ASSERT(is_pv_domain(d));=0A+ return -EOPNOTSUPP;=0A+}=0A= +=0A+static void _clean_dirty_bitmap(struct domain *d)=0A+{=0A+ = ASSERT(is_pv_domain(d));=0A+}=0A+=0A+int shadow_domain_init(struct domain = *d, unsigned int domcr_flags)=0A+{=0A+ paging_log_dirty_init(d, = _enable_log_dirty,=0A+ _disable_log_dirty, = _clean_dirty_bitmap);=0A+ return is_pv_domain(d) ? 0 : -EOPNOTSUPP;=0A+}= =0A+=0A+static int _page_fault(struct vcpu *v, unsigned long va,=0A+ = struct cpu_user_regs *regs)=0A+{=0A+ ASSERT_UNREACHABLE(= );=0A+ return 0;=0A+}=0A+=0A+static int _invlpg(struct vcpu *v, = unsigned long va)=0A+{=0A+ ASSERT_UNREACHABLE();=0A+ return = -EOPNOTSUPP;=0A+}=0A+=0A+static unsigned long _gva_to_gfn(struct vcpu *v, = struct p2m_domain *p2m,=0A+ unsigned long = va, uint32_t *pfec)=0A+{=0A+ ASSERT_UNREACHABLE();=0A+ return = INVALID_GFN;=0A+}=0A+=0A+static void _update_cr3(struct vcpu *v, int = do_locking)=0A+{=0A+ ASSERT_UNREACHABLE();=0A+}=0A+=0A+static void = _update_paging_modes(struct vcpu *v)=0A+{=0A+ ASSERT_UNREACHABLE();=0A+}= =0A+=0A+static void _write_p2m_entry(struct domain *d, unsigned long = gfn,=0A+ l1_pgentry_t *p, l1_pgentry_t = new,=0A+ unsigned int level)=0A+{=0A+ = ASSERT_UNREACHABLE();=0A+}=0A+=0A+static const struct paging_mode = sh_paging_none =3D {=0A+ .page_fault =3D _page_fault,= =0A+ .invlpg =3D _invlpg,=0A+ .gva_to_gfn = =3D _gva_to_gfn,=0A+ .update_cr3 =3D = _update_cr3,=0A+ .update_paging_modes =3D _update_paging_modes= ,=0A+ .write_p2m_entry =3D _write_p2m_entry,=0A+};=0A+=0A+= void shadow_vcpu_init(struct vcpu *v)=0A+{=0A+ ASSERT(is_pv_domain(v->do= main));=0A+ v->arch.paging.mode =3D &sh_paging_none;=0A+}=0A--- = a/xen/include/asm-x86/domain.h=0A+++ b/xen/include/asm-x86/domain.h=0A@@ = -87,6 +87,7 @@ void hypercall_page_initialise(struct do=0A /* = shadow paging extension */=0A /********************************= ****************/=0A struct shadow_domain {=0A+#ifdef CONFIG_SHADOW_PAGING= =0A unsigned int opt_flags; /* runtime tunable optimizations = on/off */=0A struct page_list_head pinned_shadows;=0A =0A@@ -116,9 = +117,11 @@ struct shadow_domain {=0A =0A /* Has this domain ever used = HVMOP_pagetable_dying? */=0A bool_t pagetable_dying_op;=0A+#endif=0A = };=0A =0A struct shadow_vcpu {=0A+#ifdef CONFIG_SHADOW_PAGING=0A /* = PAE guests: per-vcpu shadow top-level table */=0A l3_pgentry_t = l3table[4] __attribute__((__aligned__(32)));=0A /* PAE guests: = per-vcpu cache of the top-level *guest* entries */=0A@@ -144,6 +147,7 @@ = struct shadow_vcpu {=0A } oos_fixup[SHADOW_OOS_PAGES];=0A =0A = bool_t pagetable_dying;=0A+#endif=0A };=0A =0A /***************************= *********************/=0A--- a/xen/include/asm-x86/paging.h=0A+++ = b/xen/include/asm-x86/paging.h=0A@@ -39,7 +39,11 @@=0A #define PG_SH_shift = 20=0A #define PG_HAP_shift 21=0A /* We're in one of the shadow modes = */=0A+#ifdef CONFIG_SHADOW_PAGING=0A #define PG_SH_enable (1U << = PG_SH_shift)=0A+#else=0A+#define PG_SH_enable 0=0A+#endif=0A #define = PG_HAP_enable (1U << PG_HAP_shift)=0A =0A /* common paging mode bits = */=0A@@ -74,6 +78,7 @@=0A =0A struct sh_emulate_ctxt;=0A struct shadow_pagi= ng_mode {=0A+#ifdef CONFIG_SHADOW_PAGING=0A void (*detach_old_= tables )(struct vcpu *v);=0A int (*x86_emulate_write = )(struct vcpu *v, unsigned long va,=0A = void *src, u32 bytes,=0A@@ -88,6 +93,7 @@ struct shadow_paging_mode= {=0A int (*guess_wrmap )(struct vcpu *v, =0A = unsigned long vaddr, mfn_t = gmfn);=0A void (*pagetable_dying )(struct vcpu *v, = paddr_t gpa);=0A+#endif=0A /* For outsiders to tell what mode we're in = */=0A unsigned int shadow_levels;=0A };=0A--- a/xen/include/asm-x86/sha= dow.h=0A+++ b/xen/include/asm-x86/shadow.h=0A@@ -49,12 +49,14 @@=0A =0A /* = Set up the shadow-specific parts of a domain struct at start of day.=0A * = Called from paging_domain_init(). */=0A-void shadow_domain_init(struct = domain *d, unsigned int domcr_flags);=0A+int shadow_domain_init(struct = domain *d, unsigned int domcr_flags);=0A =0A /* Setup the shadow-specific = parts of a vcpu struct. It is called by=0A * paging_vcpu_init() in = paging.c */=0A void shadow_vcpu_init(struct vcpu *v);=0A =0A+#ifdef = CONFIG_SHADOW_PAGING=0A+=0A /* Enable an arbitrary shadow mode. Call once = at domain creation. */=0A int shadow_enable(struct domain *d, u32 = mode);=0A =0A@@ -77,17 +79,40 @@ void shadow_teardown(struct domain = *d);=0A /* Call once all of the references to the domain have gone away = */=0A void shadow_final_teardown(struct domain *d);=0A =0A-/* Remove all = shadows of the guest mfn. */=0A void sh_remove_shadows(struct vcpu *v, = mfn_t gmfn, int fast, int all);=0A+=0A+/* Discard _all_ mappings from the = domain's shadows. */=0A+void shadow_blow_tables_per_domain(struct domain = *d);=0A+=0A+#else /* !CONFIG_SHADOW_PAGING */=0A+=0A+#define shadow_teardow= n(d) ASSERT(is_pv_domain(d))=0A+#define shadow_final_teardown(d) ASSERT(is_= pv_domain(d))=0A+#define shadow_enable(d, mode) \=0A+ ({ ASSERT(is_pv_do= main(d)); -EOPNOTSUPP; })=0A+#define shadow_track_dirty_vram(d, begin_pfn, = nr, bitmap) \=0A+ ({ ASSERT_UNREACHABLE(); -EOPNOTSUPP; })=0A+=0A+static= inline void sh_remove_shadows(struct vcpu *v, mfn_t gmfn,=0A+ = bool_t fast, bool_t all) {}=0A+=0A+static inline = void shadow_blow_tables_per_domain(struct domain *d) {}=0A+=0A+static = inline int shadow_domctl(struct domain *d, xen_domctl_shadow_op_t *sc,=0A+ = XEN_GUEST_HANDLE_PARAM(void) u_domctl)=0A+{= =0A+ return -EINVAL;=0A+}=0A+=0A+#endif /* CONFIG_SHADOW_PAGING = */=0A+=0A+/* Remove all shadows of the guest mfn. */=0A static inline void = shadow_remove_all_shadows(struct vcpu *v, mfn_t gmfn)=0A {=0A /* See = the comment about locking in sh_remove_shadows */=0A sh_remove_shadows(= v, gmfn, 0 /* Be thorough */, 1 /* Must succeed */);=0A }=0A =0A-/* = Discard _all_ mappings from the domain's shadows. */=0A-void shadow_blow_ta= bles_per_domain(struct domain *d);=0A-=0A #endif /* _XEN_SHADOW_H */=0A = =0A /*=0A--- a/xen/include/xen/paging.h=0A+++ b/xen/include/xen/paging.h=0A= @@ -7,7 +7,7 @@=0A #include =0A #include =0A = =0A-#elif defined CONFIG_SHADOW=0A+#elif defined CONFIG_SHADOW_PAGING=0A = =0A #include =0A =0A --=__PartDCE94A72.1__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__PartDCE94A72.1__=--