From: "Jan Beulich" Subject: [PATCH 3/3] x86/shadow: pass domain to sh_install_xen_entries_in_lN() Date: Tue, 17 Mar 2015 15:56:10 +0000 Message-ID: <55085CAA020000780006B01D@mail.emea.novell.com> References: <55085AE7020000780006AFEE@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartF1C5A18A.0__=" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YXtqo-0000ZS-UI for xen-devel@lists.xenproject.org; Tue, 17 Mar 2015 15:56:15 +0000 In-Reply-To: <55085AE7020000780006AFEE@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: 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. --=__PartF1C5A18A.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Most callers have this available already, and the functions don't need any vcpu specifics. Signed-off-by: Jan Beulich --- a/xen/arch/x86/mm/shadow/multi.c +++ b/xen/arch/x86/mm/shadow/multi.c @@ -1416,9 +1416,8 @@ do { =20 // shadow-types.h to shadow-private.h // #if GUEST_PAGING_LEVELS =3D=3D 4 -void sh_install_xen_entries_in_l4(struct vcpu *v, mfn_t gl4mfn, mfn_t = sl4mfn) +void sh_install_xen_entries_in_l4(struct domain *d, mfn_t gl4mfn, mfn_t = sl4mfn) { - struct domain *d =3D v->domain; shadow_l4e_t *sl4e; unsigned int slots; =20 @@ -1449,7 +1448,7 @@ void sh_install_xen_entries_in_l4(struct shadow_l4e_from_mfn(sl4mfn, __PAGE_HYPERVISOR); =20 /* Self linear mapping. */ - if ( shadow_mode_translate(v->domain) && !shadow_mode_external(v->doma= in) ) + if ( shadow_mode_translate(d) && !shadow_mode_external(d) ) { // linear tables may not be used with translated PV guests sl4e[shadow_l4_table_offset(LINEAR_PT_VIRT_START)] =3D @@ -1470,12 +1469,11 @@ void sh_install_xen_entries_in_l4(struct // place, which means that we need to populate the l2h entry in the l3 // table. =20 -static void sh_install_xen_entries_in_l2h(struct vcpu *v, mfn_t sl2hmfn) +static void sh_install_xen_entries_in_l2h(struct domain *d, mfn_t = sl2hmfn) { - struct domain *d =3D v->domain; shadow_l2e_t *sl2e; =20 - if ( !is_pv_32on64_vcpu(v) ) + if ( !is_pv_32on64_domain(d) ) return; =20 sl2e =3D sh_map_domain_page(sl2hmfn); @@ -1549,11 +1547,13 @@ sh_make_shadow(struct vcpu *v, mfn_t gmf { #if GUEST_PAGING_LEVELS =3D=3D 4 case SH_type_l4_shadow: - sh_install_xen_entries_in_l4(v, gmfn, smfn); break; + sh_install_xen_entries_in_l4(v->domain, gmfn, smfn); + break; #endif #if GUEST_PAGING_LEVELS >=3D 3 case SH_type_l2h_shadow: - sh_install_xen_entries_in_l2h(v, smfn); break; + sh_install_xen_entries_in_l2h(v->domain, smfn); + break; #endif default: /* Do nothing */ break; } @@ -1594,7 +1594,7 @@ sh_make_monitor_table(struct vcpu *v) { mfn_t m4mfn; m4mfn =3D shadow_alloc(d, SH_type_monitor_table, 0); - sh_install_xen_entries_in_l4(v, m4mfn, m4mfn); + sh_install_xen_entries_in_l4(d, m4mfn, m4mfn); /* Remember the level of this table */ mfn_to_page(m4mfn)->shadow_flags =3D 4; #if SHADOW_PAGING_LEVELS < 4 @@ -1618,7 +1618,7 @@ sh_make_monitor_table(struct vcpu *v) l3e[0] =3D l3e_from_pfn(mfn_x(m2mfn), __PAGE_HYPERVISOR); sh_unmap_domain_page(l3e); =20 - if ( is_pv_32on64_vcpu(v) ) + if ( is_pv_32on64_domain(d) ) { /* For 32-on-64 PV guests, we need to map the 32-bit Xen * area into its usual VAs in the monitor tables */ @@ -1630,7 +1630,7 @@ sh_make_monitor_table(struct vcpu *v) mfn_to_page(m2mfn)->shadow_flags =3D 2; l3e =3D sh_map_domain_page(m3mfn); l3e[3] =3D l3e_from_pfn(mfn_x(m2mfn), _PAGE_PRESENT); - sh_install_xen_entries_in_l2h(v, m2mfn); + sh_install_xen_entries_in_l2h(d, m2mfn); sh_unmap_domain_page(l3e); } =20 --- a/xen/arch/x86/mm/shadow/private.h +++ b/xen/arch/x86/mm/shadow/private.h @@ -361,7 +361,7 @@ mfn_t shadow_alloc(struct domain *d,=20 void shadow_free(struct domain *d, mfn_t smfn); =20 /* Install the xen mappings in various flavours of shadow */ -void sh_install_xen_entries_in_l4(struct vcpu *v, mfn_t gl4mfn, mfn_t = sl4mfn); +void sh_install_xen_entries_in_l4(struct domain *, mfn_t gl4mfn, mfn_t = sl4mfn); =20 /* 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); --=__PartF1C5A18A.0__= Content-Type: text/plain; name="sh-install-xen-entries.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="sh-install-xen-entries.patch" x86/shadow: pass domain to sh_install_xen_entries_in_lN()=0A=0AMost = callers have this available already, and the functions don't need=0Aany = vcpu specifics.=0A=0ASigned-off-by: Jan Beulich =0A=0A--= - a/xen/arch/x86/mm/shadow/multi.c=0A+++ b/xen/arch/x86/mm/shadow/multi.c= =0A@@ -1416,9 +1416,8 @@ do { =0A // = shadow-types.h to shadow-private.h=0A //=0A #if GUEST_PAGING_LEVELS = =3D=3D 4=0A-void sh_install_xen_entries_in_l4(struct vcpu *v, mfn_t = gl4mfn, mfn_t sl4mfn)=0A+void sh_install_xen_entries_in_l4(struct domain = *d, mfn_t gl4mfn, mfn_t sl4mfn)=0A {=0A- struct domain *d =3D v->domain;= =0A shadow_l4e_t *sl4e;=0A unsigned int slots;=0A =0A@@ -1449,7 = +1448,7 @@ void sh_install_xen_entries_in_l4(struct=0A shadow_l4e_f= rom_mfn(sl4mfn, __PAGE_HYPERVISOR);=0A =0A /* Self linear mapping. = */=0A- if ( shadow_mode_translate(v->domain) && !shadow_mode_external(v-= >domain) )=0A+ if ( shadow_mode_translate(d) && !shadow_mode_external(d)= )=0A {=0A // linear tables may not be used with translated PV = guests=0A sl4e[shadow_l4_table_offset(LINEAR_PT_VIRT_START)] = =3D=0A@@ -1470,12 +1469,11 @@ void sh_install_xen_entries_in_l4(struct=0A = // place, which means that we need to populate the l2h entry in the l3=0A = // table.=0A =0A-static void sh_install_xen_entries_in_l2h(struct vcpu *v, = mfn_t sl2hmfn)=0A+static void sh_install_xen_entries_in_l2h(struct domain = *d, mfn_t sl2hmfn)=0A {=0A- struct domain *d =3D v->domain;=0A = shadow_l2e_t *sl2e;=0A =0A- if ( !is_pv_32on64_vcpu(v) )=0A+ if ( = !is_pv_32on64_domain(d) )=0A return;=0A =0A sl2e =3D sh_map_dom= ain_page(sl2hmfn);=0A@@ -1549,11 +1547,13 @@ sh_make_shadow(struct vcpu = *v, mfn_t gmf=0A {=0A #if GUEST_PAGING_LEVELS =3D=3D 4=0A = case SH_type_l4_shadow:=0A- sh_install_xen_entries_in_l4(v, = gmfn, smfn); break;=0A+ sh_install_xen_entries_in_l4(v->domain, = gmfn, smfn);=0A+ break;=0A #endif=0A #if GUEST_PAGING_LEVELS = >=3D 3=0A case SH_type_l2h_shadow:=0A- sh_install_xen_en= tries_in_l2h(v, smfn); break;=0A+ sh_install_xen_entries_in_l2h(= v->domain, smfn);=0A+ break;=0A #endif=0A default: /* = Do nothing */ break;=0A }=0A@@ -1594,7 +1594,7 @@ sh_make_monitor_t= able(struct vcpu *v)=0A {=0A mfn_t m4mfn;=0A m4mfn =3D = shadow_alloc(d, SH_type_monitor_table, 0);=0A- sh_install_xen_entrie= s_in_l4(v, m4mfn, m4mfn);=0A+ sh_install_xen_entries_in_l4(d, = m4mfn, m4mfn);=0A /* Remember the level of this table */=0A = mfn_to_page(m4mfn)->shadow_flags =3D 4;=0A #if SHADOW_PAGING_LEVELS < = 4=0A@@ -1618,7 +1618,7 @@ sh_make_monitor_table(struct vcpu *v)=0A = l3e[0] =3D l3e_from_pfn(mfn_x(m2mfn), __PAGE_HYPERVISOR);=0A = sh_unmap_domain_page(l3e);=0A =0A- if ( is_pv_32on64_vcpu(v) = )=0A+ if ( is_pv_32on64_domain(d) )=0A {=0A = /* For 32-on-64 PV guests, we need to map the 32-bit Xen=0A = * area into its usual VAs in the monitor tables */=0A@@ -1630,7 = +1630,7 @@ sh_make_monitor_table(struct vcpu *v)=0A = mfn_to_page(m2mfn)->shadow_flags =3D 2;=0A l3e =3D = sh_map_domain_page(m3mfn);=0A l3e[3] =3D l3e_from_pfn(mfn_x= (m2mfn), _PAGE_PRESENT);=0A- sh_install_xen_entries_in_l2h(v= , m2mfn);=0A+ sh_install_xen_entries_in_l2h(d, m2mfn);=0A = sh_unmap_domain_page(l3e);=0A }=0A =0A--- = a/xen/arch/x86/mm/shadow/private.h=0A+++ b/xen/arch/x86/mm/shadow/private.h= =0A@@ -361,7 +361,7 @@ mfn_t shadow_alloc(struct domain *d, =0A void = shadow_free(struct domain *d, mfn_t smfn);=0A =0A /* Install the xen = mappings in various flavours of shadow */=0A-void sh_install_xen_entries_in= _l4(struct vcpu *v, mfn_t gl4mfn, mfn_t sl4mfn);=0A+void sh_install_xen_ent= ries_in_l4(struct domain *, mfn_t gl4mfn, mfn_t sl4mfn);=0A =0A /* Update = the shadows in response to a pagetable write from Xen */=0A int sh_validate= _guest_entry(struct vcpu *v, mfn_t gmfn, void *entry, u32 size);=0A --=__PartF1C5A18A.0__= 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 --=__PartF1C5A18A.0__=--