From nobody Mon Apr 29 02:52:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1576613814; cv=none; d=zohomail.com; s=zohoarc; b=UQYY9GriwXacgMfeILKs5cnJZNDXUOY2LFON3E9kpb5qmleeshl6EW5ypxw2+JloPMHetCahqEQcj5pYkCemkMEHqLeHXeErnmPfvBQeN3eYYsXuWminmEGe3uNMzH6FbZbZJRlfjp11kfYWn0nngiFhlQrDla6zt/BbVAdgYfY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576613814; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kjUGN3WedWfQaqK83nVAx3a0gG6tybx/C3r9DDNSutc=; b=KM64P/mPgBV3HHToAHRlWAeA7rSvCBRRr/ZFos+tyaeuF7QJgVg49zzzeLdc635RmNZe51ulMgEMK3OoTCpLcDSUZi7MG6wHSPMHgHjzAysWSRq4wyv4qJUbryUAgFayx7xsM789GHdj/haobiCBgkUIiFU4fTUI5QD+B0MGuA8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1576613814033356.0478729538429; Tue, 17 Dec 2019 12:16:54 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ihJGI-0005Lk-1D; Tue, 17 Dec 2019 20:16:06 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ihJGH-0005Ld-HJ for xen-devel@lists.xenproject.org; Tue, 17 Dec 2019 20:16:05 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 08317d96-210a-11ea-88e7-bc764e2007e4; Tue, 17 Dec 2019 20:15:56 +0000 (UTC) X-Inumbo-ID: 08317d96-210a-11ea-88e7-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1576613756; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=UIoR9Jt1do7A36WFyGZ+Wi6DXdFlYgY5dbm8wHWAgts=; b=dGLZLP/w9+kEeDfBjgr+3q4qBJnIM4g0jIA45zXL+H4btgaFBJYo1Vj8 84kuUFnGUfM4eqA2SkZxS5dPJddGIWHjddBkHuaxKkVLG5HSi1lsxtD7z saGVnN3519PmtkIhyXh9xR79r8aOjCQj6DSvhpmBz7b089oDrJK6S2K5R w=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: cm0G/iCHSr7pk8tmx5FtcW89HpSDIHbWDB8FXkIPOTDtUjlWItoFNvxxx307NSWPfWAtvyFXiK X0oHUD7LSkFZgTfD+D+tLPAbXTReHN6kLjTXTmPrH/BWvFh3bNz9EQn1KnD0xNPJSP8z73I9Af Klf1oBl25G7WMBjmOZ02t7ldN/Y2BtpNlFfobPsGdYwCOVKMfe2mVN2WUQj/uK5OFZ0vdBdCaw LyA9R3vFWCM3DyIbmfJfuIXhpsswE5PGRHe64gdyPCX5LnXIfOAwMYpb043G25EmuFNDuPneUX Jsw= X-SBRS: 2.7 X-MesageID: 10420422 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,326,1571716800"; d="scan'208";a="10420422" From: Andrew Cooper To: Xen-devel Date: Tue, 17 Dec 2019 20:15:47 +0000 Message-ID: <20191217201550.15864-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191217201550.15864-1-andrew.cooper3@citrix.com> References: <20191217201550.15864-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 1/4] tools/dombuilder: xc_dom_x86 cleanup X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Julien Grall , Wei Liu , Andrew Cooper , Varad Gautam , Ian Jackson , Volodymyr Babchuk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The two xc_dom_params structures for PV pagetables are never modified and c= an live in .rodata. Reduce their scope to the alloc_pgtable_*() functions whi= ch construct xc_dom_image_x86 appropriately. Rename {alloc,setup}_pgtables() to {alloc,setup}_pgtables_pv() to highlight that they are PV only, and drop some _x86() suffixes from static helpers. No functional change. Signed-off-by: Andrew Cooper Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Varad Gautam --- tools/libxc/xc_dom_x86.c | 60 ++++++++++++++++++++++----------------------= ---- 1 file changed, 28 insertions(+), 32 deletions(-) diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c index 9e279d6768..1ce3c798ef 100644 --- a/tools/libxc/xc_dom_x86.c +++ b/tools/libxc/xc_dom_x86.c @@ -103,7 +103,7 @@ struct xc_dom_image_x86 { unsigned n_mappings; #define MAPPING_MAX 2 struct xc_dom_x86_mapping maps[MAPPING_MAX]; - struct xc_dom_params *params; + const struct xc_dom_params *params; }; =20 /* get guest IO ABI protocol */ @@ -235,7 +235,7 @@ static int count_pgtables(struct xc_dom_image *dom, xen= _vaddr_t from, return 0; } =20 -static int alloc_pgtables(struct xc_dom_image *dom) +static int alloc_pgtables_pv(struct xc_dom_image *dom) { int pages, extra_pages; xen_vaddr_t try_virt_end; @@ -268,20 +268,20 @@ static int alloc_pgtables(struct xc_dom_image *dom) /* -----------------------------------------------------------------------= - */ /* i386 pagetables = */ =20 -static struct xc_dom_params x86_32_params =3D { - .levels =3D PGTBL_LEVELS_I386, - .vaddr_mask =3D bits_to_mask(VIRT_BITS_I386), - .lvl_prot[0] =3D _PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED, - .lvl_prot[1] =3D _PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PA= GE_USER, - .lvl_prot[2] =3D _PAGE_PRESENT, -}; - static int alloc_pgtables_x86_32_pae(struct xc_dom_image *dom) { + static const struct xc_dom_params x86_32_params =3D { + .levels =3D PGTBL_LEVELS_I386, + .vaddr_mask =3D bits_to_mask(VIRT_BITS_I386), + .lvl_prot[0] =3D _PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED, + .lvl_prot[1] =3D _PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY= |_PAGE_USER, + .lvl_prot[2] =3D _PAGE_PRESENT, + }; struct xc_dom_image_x86 *domx86 =3D dom->arch_private; =20 domx86->params =3D &x86_32_params; - return alloc_pgtables(dom); + + return alloc_pgtables_pv(dom); } =20 #define pfn_to_paddr(pfn) ((xen_paddr_t)(pfn) << PAGE_SHIFT_X86) @@ -355,7 +355,7 @@ static xen_pfn_t move_l3_below_4G(struct xc_dom_image *= dom, return l3mfn; } =20 -static x86_pgentry_t *get_pg_table_x86(struct xc_dom_image *dom, int m, in= t l) +static x86_pgentry_t *get_pg_table(struct xc_dom_image *dom, int m, int l) { struct xc_dom_image_x86 *domx86 =3D dom->arch_private; struct xc_dom_x86_mapping *map; @@ -371,8 +371,7 @@ static x86_pgentry_t *get_pg_table_x86(struct xc_dom_im= age *dom, int m, int l) return NULL; } =20 -static x86_pgentry_t get_pg_prot_x86(struct xc_dom_image *dom, int l, - xen_pfn_t pfn) +static x86_pgentry_t get_pg_prot(struct xc_dom_image *dom, int l, xen_pfn_= t pfn) { struct xc_dom_image_x86 *domx86 =3D dom->arch_private; struct xc_dom_x86_mapping *map; @@ -396,7 +395,7 @@ static x86_pgentry_t get_pg_prot_x86(struct xc_dom_imag= e *dom, int l, return prot; } =20 -static int setup_pgtables_x86(struct xc_dom_image *dom) +static int setup_pgtables_pv(struct xc_dom_image *dom) { struct xc_dom_image_x86 *domx86 =3D dom->arch_private; struct xc_dom_x86_mapping *map1, *map2; @@ -413,7 +412,7 @@ static int setup_pgtables_x86(struct xc_dom_image *dom) map1 =3D domx86->maps + m1; from =3D map1->lvls[l].from; to =3D map1->lvls[l].to; - pg =3D get_pg_table_x86(dom, m1, l); + pg =3D get_pg_table(dom, m1, l); if ( !pg ) return -1; for ( m2 =3D 0; m2 < domx86->n_mappings; m2++ ) @@ -433,7 +432,7 @@ static int setup_pgtables_x86(struct xc_dom_image *dom) for ( p =3D p_s; p <=3D p_e; p++ ) { pg[p] =3D pfn_to_paddr(xc_dom_p2m(dom, pfn)) | - get_pg_prot_x86(dom, l, pfn); + get_pg_prot(dom, l, pfn); pfn++; } } @@ -464,32 +463,32 @@ static int setup_pgtables_x86_32_pae(struct xc_dom_im= age *dom) } } =20 - return setup_pgtables_x86(dom); + return setup_pgtables_pv(dom); } =20 /* -----------------------------------------------------------------------= - */ /* x86_64 pagetables = */ =20 -static struct xc_dom_params x86_64_params =3D { - .levels =3D PGTBL_LEVELS_X86_64, - .vaddr_mask =3D bits_to_mask(VIRT_BITS_X86_64), - .lvl_prot[0] =3D _PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED, - .lvl_prot[1] =3D _PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PA= GE_USER, - .lvl_prot[2] =3D _PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PA= GE_USER, - .lvl_prot[3] =3D _PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PA= GE_USER, -}; - static int alloc_pgtables_x86_64(struct xc_dom_image *dom) { + const static struct xc_dom_params x86_64_params =3D { + .levels =3D PGTBL_LEVELS_X86_64, + .vaddr_mask =3D bits_to_mask(VIRT_BITS_X86_64), + .lvl_prot[0] =3D _PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED, + .lvl_prot[1] =3D _PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY= |_PAGE_USER, + .lvl_prot[2] =3D _PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY= |_PAGE_USER, + .lvl_prot[3] =3D _PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY= |_PAGE_USER, + }; struct xc_dom_image_x86 *domx86 =3D dom->arch_private; =20 domx86->params =3D &x86_64_params; - return alloc_pgtables(dom); + + return alloc_pgtables_pv(dom); } =20 static int setup_pgtables_x86_64(struct xc_dom_image *dom) { - return setup_pgtables_x86(dom); + return setup_pgtables_pv(dom); } =20 /* -----------------------------------------------------------------------= - */ @@ -1908,9 +1907,6 @@ static struct xc_dom_arch xc_hvm_32 =3D { .sizeof_pfn =3D 4, .alloc_magic_pages =3D alloc_magic_pages_hvm, .alloc_pgtables =3D alloc_pgtables_hvm, - .setup_pgtables =3D NULL, - .start_info =3D NULL, - .shared_info =3D NULL, .vcpu =3D vcpu_hvm, .meminit =3D meminit_hvm, .bootearly =3D bootearly, --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Mon Apr 29 02:52:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1576613811; cv=none; d=zohomail.com; s=zohoarc; b=R5MXC/yOpRDdLDGot7ehpGBlnxg7b1QYLW9yWFHSW1mF0dzzanizcXoIgPkRJr6YPcqUeBJzhYB7FKjS73t2203lRwPRqOm/6XACBH43sii16m5NnAlvtn39Cy4AfvpJD/vUqMn1YCSSkERIKh6ztiNHyyTwZ1ZEouI/vA468kM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576613811; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bPukvtL15BKa+RvceqDtNBc2aYKgM3et9gPaygj/vo0=; b=NripT4h/FBkJKcybB9gNYq/VYgKW427nd8lqCJkZOOYId6seqkUf95eKVohY/0y4C21wFYCw12CpXJ8N0msjUywIAlUsnaB+olRFE+5kFdN25jJyQMHQ4WSnF1+paxQCTIw37Hm27bFTHCb5y3/FtiuyCNvcN1rBPtDtuqlhHzw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1576613811177794.4407662356083; Tue, 17 Dec 2019 12:16:51 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ihJGN-0005N4-Ai; Tue, 17 Dec 2019 20:16:11 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ihJGM-0005MJ-8N for xen-devel@lists.xenproject.org; Tue, 17 Dec 2019 20:16:10 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 0896be0e-210a-11ea-a1e1-bc764e2007e4; Tue, 17 Dec 2019 20:15:57 +0000 (UTC) X-Inumbo-ID: 0896be0e-210a-11ea-a1e1-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1576613757; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=UbYFJaiRix7wpLb702dcBKspb43ZVMeXwf1/IAyio30=; b=YOcw4VOL3sUHcsIrYt4TtkD1yVSRsL5xsRioEYs9BrFLOVzya0d5dXhl cYffqh00iBIlM40wdpCuAETTWDbPTVcXr3RPTMRKNptTMjLBSSKRM6vZA Mi1fwYajdjaCY+60gte6RHIozzHpvecGFCIXaGXGbAixJa3pJJpvmSVUT A=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: O7Og8KE7yMeB6qM4mdw4dz3nsnzK74BX9TP60d7Y4L8aSWYvdipoX3d3wH61+kZuowNw2//ZqU +RJ5CdbMT9FEF9C1Eo/2v+zI/qb2KMW/zPdLpd3J1cjvvApuPYTThx4gEoWxCKQkKjrHbgGBr/ nq5PNTyaL5ucJ4r9h6OlugHBdL/+mKDd0hBySDGNIpxgq5E3rbZdcsdn01eeabuGSjOZ3XFEVj T/oATGBdPg5yXIH3HIuX3ZlGLfw8L5bHACPWW/yqjlDerkeavfVYt7m6lehEIrY7L+3BwIY2NC +NI= X-SBRS: 2.7 X-MesageID: 9830369 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,326,1571716800"; d="scan'208";a="9830369" From: Andrew Cooper To: Xen-devel Date: Tue, 17 Dec 2019 20:15:48 +0000 Message-ID: <20191217201550.15864-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191217201550.15864-1-andrew.cooper3@citrix.com> References: <20191217201550.15864-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 2/4] tools/dombuilder: Remove PV-only, mandatory hooks X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Julien Grall , Wei Liu , Andrew Cooper , Varad Gautam , Ian Jackson , Volodymyr Babchuk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Currently, the setup_pgtable() hook is optional, but alloc_pgtable() hook is not. Both are specific to x86 PV guests, and stubbed in various ways by the dombuilders for translated guests (x86 HVM, ARM). Make alloc_pgtables() optional, and drop all the stubs for translated guest types. No change in the constructed guests. Signed-off-by: Andrew Cooper Acked-by: Julien Grall Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Varad Gautam --- tools/libxc/include/xc_dom.h | 3 ++- tools/libxc/xc_dom_arm.c | 21 --------------------- tools/libxc/xc_dom_boot.c | 6 +++--- tools/libxc/xc_dom_core.c | 3 ++- tools/libxc/xc_dom_x86.c | 7 ------- 5 files changed, 7 insertions(+), 33 deletions(-) diff --git a/tools/libxc/include/xc_dom.h b/tools/libxc/include/xc_dom.h index 5900bbe8fa..9ff1cb8b07 100644 --- a/tools/libxc/include/xc_dom.h +++ b/tools/libxc/include/xc_dom.h @@ -253,8 +253,9 @@ void xc_dom_register_loader(struct xc_dom_loader *loade= r); /* --- arch specific hooks ----------------------------------------- */ =20 struct xc_dom_arch { - /* pagetable setup */ int (*alloc_magic_pages) (struct xc_dom_image * dom); + + /* pagetable setup - x86 PV only */ int (*alloc_pgtables) (struct xc_dom_image * dom); int (*alloc_p2m_list) (struct xc_dom_image * dom); int (*setup_pgtables) (struct xc_dom_image * dom); diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c index 5b9eca6087..7e0fb9169f 100644 --- a/tools/libxc/xc_dom_arm.c +++ b/tools/libxc/xc_dom_arm.c @@ -47,23 +47,6 @@ const char *xc_domain_get_native_protocol(xc_interface *= xch, } =20 /* -----------------------------------------------------------------------= - */ -/* - * arm guests are hybrid and start off with paging disabled, therefore no - * pagetables and nothing to do here. - */ -static int alloc_pgtables_arm(struct xc_dom_image *dom) -{ - DOMPRINTF_CALLED(dom->xch); - return 0; -} - -static int setup_pgtables_arm(struct xc_dom_image *dom) -{ - DOMPRINTF_CALLED(dom->xch); - return 0; -} - -/* -----------------------------------------------------------------------= - */ =20 static int alloc_magic_pages(struct xc_dom_image *dom) { @@ -539,8 +522,6 @@ static struct xc_dom_arch xc_dom_32 =3D { .page_shift =3D PAGE_SHIFT_ARM, .sizeof_pfn =3D 8, .alloc_magic_pages =3D alloc_magic_pages, - .alloc_pgtables =3D alloc_pgtables_arm, - .setup_pgtables =3D setup_pgtables_arm, .start_info =3D start_info_arm, .shared_info =3D shared_info_arm, .vcpu =3D vcpu_arm32, @@ -555,8 +536,6 @@ static struct xc_dom_arch xc_dom_64 =3D { .page_shift =3D PAGE_SHIFT_ARM, .sizeof_pfn =3D 8, .alloc_magic_pages =3D alloc_magic_pages, - .alloc_pgtables =3D alloc_pgtables_arm, - .setup_pgtables =3D setup_pgtables_arm, .start_info =3D start_info_arm, .shared_info =3D shared_info_arm, .vcpu =3D vcpu_arm64, diff --git a/tools/libxc/xc_dom_boot.c b/tools/libxc/xc_dom_boot.c index 918ee4d045..79dbbf6571 100644 --- a/tools/libxc/xc_dom_boot.c +++ b/tools/libxc/xc_dom_boot.c @@ -199,9 +199,9 @@ int xc_dom_boot_image(struct xc_dom_image *dom) /* initial mm setup */ if ( (rc =3D xc_dom_update_guest_p2m(dom)) !=3D 0 ) return rc; - if ( dom->arch_hooks->setup_pgtables ) - if ( (rc =3D dom->arch_hooks->setup_pgtables(dom)) !=3D 0 ) - return rc; + if ( dom->arch_hooks->setup_pgtables && + (rc =3D dom->arch_hooks->setup_pgtables(dom)) !=3D 0 ) + return rc; =20 /* start info page */ if ( dom->arch_hooks->start_info ) diff --git a/tools/libxc/xc_dom_core.c b/tools/libxc/xc_dom_core.c index 9bd04cb2d5..fc77804a7e 100644 --- a/tools/libxc/xc_dom_core.c +++ b/tools/libxc/xc_dom_core.c @@ -1247,7 +1247,8 @@ int xc_dom_build_image(struct xc_dom_image *dom) goto err; if ( dom->arch_hooks->alloc_magic_pages(dom) !=3D 0 ) goto err; - if ( dom->arch_hooks->alloc_pgtables(dom) !=3D 0 ) + if ( dom->arch_hooks->alloc_pgtables && + dom->arch_hooks->alloc_pgtables(dom) !=3D 0 ) goto err; if ( dom->alloc_bootstack ) { diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c index 1ce3c798ef..d2acff1061 100644 --- a/tools/libxc/xc_dom_x86.c +++ b/tools/libxc/xc_dom_x86.c @@ -1690,12 +1690,6 @@ static int bootlate_pv(struct xc_dom_image *dom) return 0; } =20 -static int alloc_pgtables_hvm(struct xc_dom_image *dom) -{ - DOMPRINTF("%s: doing nothing", __func__); - return 0; -} - /* * The memory layout of the start_info page and the modules, and where the * addresses are stored: @@ -1906,7 +1900,6 @@ static struct xc_dom_arch xc_hvm_32 =3D { .page_shift =3D PAGE_SHIFT_X86, .sizeof_pfn =3D 4, .alloc_magic_pages =3D alloc_magic_pages_hvm, - .alloc_pgtables =3D alloc_pgtables_hvm, .vcpu =3D vcpu_hvm, .meminit =3D meminit_hvm, .bootearly =3D bootearly, --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Mon Apr 29 02:52:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1576613815; cv=none; d=zohomail.com; s=zohoarc; b=RzO6lxGsKAjE/lKyjgXuC5oJXbSJnWCqE7y+GYh82FxeKqqAhR6KblrBiFV/DMw/RHfGxzV4Ll0IEkCRoGIMFSR5J7Rn+rlhtyas74trtKiGVurPDU9RiUm9TgSclfcZtXSV9rNP3pcRJN0IDKcGMNjKnv965JgFwEoWw2XKmgA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576613815; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LiUFnY+L8/q9w5T5tK5v6k/XCFZZJvgdcguYdJ8nWuA=; b=lOMFHq6NpYjaazdMI1O8d4izS8VhakqllHX/GZtixZgU268sTs3ipvrmPYE3UEyq7oHHd2C4ms6l/p84U53duopVjtva8Xa+MSOD8pP3dQ1D2cn/X9oFvsrq86qNx966R30Vmjvux2xfJRwYy2rng8zmHfzQ1KXxVQm02jWMZZc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1576613815945481.4877183788609; Tue, 17 Dec 2019 12:16:55 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ihJGS-0005Or-L1; Tue, 17 Dec 2019 20:16:16 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ihJGR-0005OY-9V for xen-devel@lists.xenproject.org; Tue, 17 Dec 2019 20:16:15 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 0e30e31c-210a-11ea-a1e1-bc764e2007e4; Tue, 17 Dec 2019 20:16:06 +0000 (UTC) X-Inumbo-ID: 0e30e31c-210a-11ea-a1e1-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1576613766; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=BJyXIpkCPt9JZU9N+q+I1imLp9WhWhx0vZTrqg9EqXM=; b=eC0ZPPGD1MkL6m1eZxo+4yJqQHf3ImTjEVwSoTnVnS0QcofrwpQlaA2T 3ZDk4LSXqNLOrUoNhhwbkBHFRgVfHHjGgp2wL0vcX6UvppedoF13gPZzP Ecnq6KSJ47kgI3ur8WJz90yWWy7Uk63lgZVr79GmFSN0dO7144IazbvHh k=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: CfxPR4I4OBFF9AMufUYeJraWCeHu++YL/H7MooABj7Y7R6QCIa1i2xBshWFtBnTvphG0L1QEWo R9oOCS4r/0C+2xEB9isAMcJEMpTWl7E+NVtGibHwiCQS+AxJjNS6bXl+gDbUvZ45KpVXNdO596 fyowi8FHxlVC+CzGJ3Rnax3VOu4ursILtwBkPejmQr5fEtjrbSz8JlNT2xt2PKCX7Rq1rbuzHh flYZIEvVJWFEAOsMtazaZJqKD8cdqHlwf8Kr3r2IEEe2QqDkjm+hFYFb69Odgo+qJQcZjqOAfy t8Q= X-SBRS: 2.7 X-MesageID: 9830371 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,326,1571716800"; d="scan'208";a="9830371" From: Andrew Cooper To: Xen-devel Date: Tue, 17 Dec 2019 20:15:49 +0000 Message-ID: <20191217201550.15864-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191217201550.15864-1-andrew.cooper3@citrix.com> References: <20191217201550.15864-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 3/4] tools/dombuilder: Remove p2m_guest from the common interface X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Julien Grall , Wei Liu , Andrew Cooper , Varad Gautam , Ian Jackson , Volodymyr Babchuk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) In-guest p2m's are a concept specific to x86 PV guests. alloc_p2m_list() is the only hook which initialises dom->p2m_guest, making xc_dom_update_guest_p2m() a nop for non-PV guests. Move p2m_guest into xc_dom_image_x86 and adjust alloc_p2m_list() to match. Drop xc_dom_update_guest_p2m() entirely. One caller, move_l3_below_4G(), only uses it to modify a single entry, so rewriting the whole guest p2m is wasteful - opencode the single update instead. The other caller is common code. Instead, move the logic into the setup_pgtables() hooks, which know their own sizeof_pfn and can do away with the switch statement. No change in the constructed guests. Signed-off-by: Andrew Cooper Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Varad Gautam --- stubdom/grub/kexec.c | 8 -------- tools/libxc/include/xc_dom.h | 2 -- tools/libxc/xc_dom_boot.c | 2 -- tools/libxc/xc_dom_core.c | 40 ---------------------------------------- tools/libxc/xc_dom_x86.c | 41 +++++++++++++++++++++++++++++++++++------ 5 files changed, 35 insertions(+), 58 deletions(-) diff --git a/stubdom/grub/kexec.c b/stubdom/grub/kexec.c index 61ca082d42..10891eabcc 100644 --- a/stubdom/grub/kexec.c +++ b/stubdom/grub/kexec.c @@ -320,14 +320,6 @@ void kexec(void *kernel, long kernel_size, void *modul= e, long module_size, char do_exchange(dom, PHYS_PFN(_boot_target - dom->parms.virt_base), virt_to_mfn(&_boot_page)); =20 - /* Make sure the bootstrap page table does not RW-map any of our curre= nt - * page table frames */ - if ( (rc =3D xc_dom_update_guest_p2m(dom))) { - printk("xc_dom_update_guest_p2m returned %d\n", rc); - errnum =3D ERR_BOOT_FAILURE; - goto out; - } - if ( dom->arch_hooks->setup_pgtables ) if ( (rc =3D dom->arch_hooks->setup_pgtables(dom))) { printk("setup_pgtables returned %d\n", rc); diff --git a/tools/libxc/include/xc_dom.h b/tools/libxc/include/xc_dom.h index 9ff1cb8b07..b7d0faf7e1 100644 --- a/tools/libxc/include/xc_dom.h +++ b/tools/libxc/include/xc_dom.h @@ -133,7 +133,6 @@ struct xc_dom_image { * Note that the input is offset by rambase. */ xen_pfn_t *p2m_host; - void *p2m_guest; =20 /* physical memory * @@ -331,7 +330,6 @@ int xc_dom_devicetree_mem(struct xc_dom_image *dom, con= st void *mem, int xc_dom_parse_image(struct xc_dom_image *dom); int xc_dom_set_arch_hooks(struct xc_dom_image *dom); int xc_dom_build_image(struct xc_dom_image *dom); -int xc_dom_update_guest_p2m(struct xc_dom_image *dom); =20 int xc_dom_boot_xen_init(struct xc_dom_image *dom, xc_interface *xch, uint32_t domid); diff --git a/tools/libxc/xc_dom_boot.c b/tools/libxc/xc_dom_boot.c index 79dbbf6571..bb599b33ba 100644 --- a/tools/libxc/xc_dom_boot.c +++ b/tools/libxc/xc_dom_boot.c @@ -197,8 +197,6 @@ int xc_dom_boot_image(struct xc_dom_image *dom) return -1; =20 /* initial mm setup */ - if ( (rc =3D xc_dom_update_guest_p2m(dom)) !=3D 0 ) - return rc; if ( dom->arch_hooks->setup_pgtables && (rc =3D dom->arch_hooks->setup_pgtables(dom)) !=3D 0 ) return rc; diff --git a/tools/libxc/xc_dom_core.c b/tools/libxc/xc_dom_core.c index fc77804a7e..f30c73b5e8 100644 --- a/tools/libxc/xc_dom_core.c +++ b/tools/libxc/xc_dom_core.c @@ -969,46 +969,6 @@ int xc_dom_mem_init(struct xc_dom_image *dom, unsigned= int mem_mb) return 0; } =20 -int xc_dom_update_guest_p2m(struct xc_dom_image *dom) -{ - uint32_t *p2m_32; - uint64_t *p2m_64; - xen_pfn_t i; - - if ( !dom->p2m_guest ) - return 0; - - switch ( dom->arch_hooks->sizeof_pfn ) - { - case 4: - DOMPRINTF("%s: dst 32bit, pages 0x%" PRIpfn "", - __FUNCTION__, dom->p2m_size); - p2m_32 =3D dom->p2m_guest; - for ( i =3D 0; i < dom->p2m_size; i++ ) - if ( dom->p2m_host[i] !=3D INVALID_PFN ) - p2m_32[i] =3D dom->p2m_host[i]; - else - p2m_32[i] =3D (uint32_t) - 1; - break; - case 8: - DOMPRINTF("%s: dst 64bit, pages 0x%" PRIpfn "", - __FUNCTION__, dom->p2m_size); - p2m_64 =3D dom->p2m_guest; - for ( i =3D 0; i < dom->p2m_size; i++ ) - if ( dom->p2m_host[i] !=3D INVALID_PFN ) - p2m_64[i] =3D dom->p2m_host[i]; - else - p2m_64[i] =3D (uint64_t) - 1; - break; - default: - xc_dom_panic(dom->xch, XC_INTERNAL_ERROR, - "sizeof_pfn is invalid (is %d, can be 4 or 8)", - dom->arch_hooks->sizeof_pfn); - return -1; - } - return 0; -} - static int xc_dom_build_module(struct xc_dom_image *dom, unsigned int mod) { size_t unziplen, modulelen; diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c index d2acff1061..f21662c8b9 100644 --- a/tools/libxc/xc_dom_x86.c +++ b/tools/libxc/xc_dom_x86.c @@ -104,6 +104,9 @@ struct xc_dom_image_x86 { #define MAPPING_MAX 2 struct xc_dom_x86_mapping maps[MAPPING_MAX]; const struct xc_dom_params *params; + + /* PV: Pointer to the in-guest P2M. */ + void *p2m_guest; }; =20 /* get guest IO ABI protocol */ @@ -296,6 +299,8 @@ static xen_pfn_t move_l3_below_4G(struct xc_dom_image *= dom, xen_pfn_t l3pfn, xen_pfn_t l3mfn) { + struct xc_dom_image_x86 *domx86 =3D dom->arch_private; + uint32_t *p2m_guest =3D domx86->p2m_guest; xen_pfn_t new_l3mfn; struct xc_mmu *mmu; void *l3tab; @@ -313,9 +318,7 @@ static xen_pfn_t move_l3_below_4G(struct xc_dom_image *= dom, if ( !new_l3mfn ) goto out; =20 - dom->p2m_host[l3pfn] =3D new_l3mfn; - if ( xc_dom_update_guest_p2m(dom) !=3D 0 ) - goto out; + p2m_guest[l3pfn] =3D dom->p2m_host[l3pfn] =3D new_l3mfn; =20 if ( xc_add_mmu_update(dom->xch, mmu, (((unsigned long long)new_l3mfn) @@ -444,7 +447,17 @@ static int setup_pgtables_pv(struct xc_dom_image *dom) static int setup_pgtables_x86_32_pae(struct xc_dom_image *dom) { struct xc_dom_image_x86 *domx86 =3D dom->arch_private; - xen_pfn_t l3mfn, l3pfn; + uint32_t *p2m_guest =3D domx86->p2m_guest; + xen_pfn_t l3mfn, l3pfn, i; + + /* Copy dom->p2m_host[] into the guest. */ + for ( i =3D 0; i < dom->p2m_size; ++i ) + { + if ( dom->p2m_host[i] !=3D INVALID_PFN ) + p2m_guest[i] =3D dom->p2m_host[i]; + else + p2m_guest[i] =3D -1; + } =20 l3pfn =3D domx86->maps[0].lvls[2].pfn; l3mfn =3D xc_dom_p2m(dom, l3pfn); @@ -488,6 +501,19 @@ static int alloc_pgtables_x86_64(struct xc_dom_image *= dom) =20 static int setup_pgtables_x86_64(struct xc_dom_image *dom) { + struct xc_dom_image_x86 *domx86 =3D dom->arch_private; + uint64_t *p2m_guest =3D domx86->p2m_guest; + xen_pfn_t i; + + /* Copy dom->p2m_host[] into the guest. */ + for ( i =3D 0; i < dom->p2m_size; ++i ) + { + if ( dom->p2m_host[i] !=3D INVALID_PFN ) + p2m_guest[i] =3D dom->p2m_host[i]; + else + p2m_guest[i] =3D -1; + } + return setup_pgtables_pv(dom); } =20 @@ -495,11 +521,14 @@ static int setup_pgtables_x86_64(struct xc_dom_image = *dom) =20 static int alloc_p2m_list(struct xc_dom_image *dom, size_t p2m_alloc_size) { + struct xc_dom_image_x86 *domx86 =3D dom->arch_private; + if ( xc_dom_alloc_segment(dom, &dom->p2m_seg, "phys2mach", 0, p2m_alloc_size) ) return -1; - dom->p2m_guest =3D xc_dom_seg_to_ptr(dom, &dom->p2m_seg); - if ( dom->p2m_guest =3D=3D NULL ) + + domx86->p2m_guest =3D xc_dom_seg_to_ptr(dom, &dom->p2m_seg); + if ( domx86->p2m_guest =3D=3D NULL ) return -1; =20 return 0; --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Mon Apr 29 02:52:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1576613813; cv=none; d=zohomail.com; s=zohoarc; b=MRg9eEEBuhQJQ4m87rARLKH4SLFJRu4TP4Tar+xd97YL5vP4Bw+86rQYoIgR86tHxrJbEEk8iBMX1/Q3nWsTDYIWqt8S78KoHoIFRQF5ay62tAErU9VJwzXMgFYyN+6kfVrZwGdhEoDUhj5pghyQKCCC/tHL0Vol1CnthUt75gQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576613813; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VfBib+YZkzr9aMWeMVK1p43fzHKJo/LSlYBbJRV2Q7c=; b=QdT/+vdxtlot7+6AWbc1ZH+dAGLJcPsYKe84w2MBOuZPbSVpQ/nybArpEsJFW3/LTcjvAzUu+IFaiEL7Lzq7iTJS2CnqeJjp37/43qB4ChQK+sS4ifacgQqyQ/IKRiCuAkUWsHA2+4M97g5ZxStXXldVsNGCJeaPQ7LBWEeS6mw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1576613813672759.0024488125417; Tue, 17 Dec 2019 12:16:53 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ihJGE-0005LH-Jb; Tue, 17 Dec 2019 20:16:02 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ihJGD-0005LC-DN for xen-devel@lists.xenproject.org; Tue, 17 Dec 2019 20:16:01 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 096ab1b4-210a-11ea-8f95-12813bfff9fa; Tue, 17 Dec 2019 20:15:58 +0000 (UTC) X-Inumbo-ID: 096ab1b4-210a-11ea-8f95-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1576613758; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=a5RkKskjboJj5FOVFNqOmI4Lfq8tJHlMrwioAAGK2lc=; b=WhzK9n4P+/1UXaH59e3Gm2BxWcqd2oNdDtHanmXgvGEhY3QjwmSEAXFa jtlM0mplCHnezphv7u8o9d31nQ0Hy693KDNeHR2JHvMXzwo0kaHC8XDbk fcvztiIv7lpEMJsddDq4rrntYjqBu705Xuglv/0wKgRsrV9+pEcX0z2vq g=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: pq5o/Buzj0Rt/ZMF6tkZcuQs6wPF2PxQ6ljNDFT/XsO8JOKE8NOyLVoWmianuccTQG/fHK5h3Q JSomdCNb6ZbQ4A/oO5eiE/D5AObjHUM9w94Ss+4RljT74pp0hHPwD7f022rOGKU+YFNDVFNwdc xZQuwvgjttey4e0y7ND1kb3dKJQ8ZTr8bSlqax5Qt5C/w94v6Uie5RrNikXO4GAdWMHnoo4pcz s89O0bcVRa5pQOViOs0bUvnDm4qnEj0VBBryRyveEH4jsoOPtW74C/m+IT+tHLBHFTmF3LduSn exU= X-SBRS: 2.7 X-MesageID: 10255290 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,326,1571716800"; d="scan'208";a="10255290" From: Andrew Cooper To: Xen-devel Date: Tue, 17 Dec 2019 20:15:50 +0000 Message-ID: <20191217201550.15864-5-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191217201550.15864-1-andrew.cooper3@citrix.com> References: <20191217201550.15864-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 4/4] tools/dombuilder: Don't allocate dom->p2m_host[] for translated domains X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Julien Grall , Wei Liu , Andrew Cooper , Varad Gautam , Ian Jackson , Volodymyr Babchuk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) xc_dom_p2m() and dom->p2m_host[] implement a linear transform for translated domains, but waste a substantial chunk of RAM doing so. ARM literally never reads dom->p2m_host[] (because of the xc_dom_translated= () short circuit in xc_dom_p2m()). Drop it all. x86 HVM does use dom->p2m_host[] for xc_domain_populate_physmap_exact() cal= ls when populating 4k pages. Reuse the same tactic from 2M/1G ranges and use = an on-stack array instead. Drop the memory allocation. x86 PV guests do use dom->p2m_host[] as a non-identity transform. Rename t= he field to pv_p2m to make it clear it is PV-only. No change in the constructed guests. Reported-by: Varad Gautam Reported-by: Julien Grall Signed-off-by: Andrew Cooper Acked-by: Julien Grall Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Varad Gautam --- stubdom/grub/kexec.c | 28 ++++++++--------- tools/libxc/include/xc_dom.h | 19 ++++++------ tools/libxc/xc_dom_arm.c | 9 ------ tools/libxc/xc_dom_x86.c | 72 ++++++++++++++++++----------------------= ---- 4 files changed, 52 insertions(+), 76 deletions(-) diff --git a/stubdom/grub/kexec.c b/stubdom/grub/kexec.c index 10891eabcc..0e68b969a2 100644 --- a/stubdom/grub/kexec.c +++ b/stubdom/grub/kexec.c @@ -87,17 +87,17 @@ static void do_exchange(struct xc_dom_image *dom, xen_p= fn_t target_pfn, xen_pfn_ xen_pfn_t target_mfn; =20 for (source_pfn =3D 0; source_pfn < start_info.nr_pages; source_pfn++) - if (dom->p2m_host[source_pfn] =3D=3D source_mfn) + if (dom->pv_p2m[source_pfn] =3D=3D source_mfn) break; ASSERT(source_pfn < start_info.nr_pages); =20 - target_mfn =3D dom->p2m_host[target_pfn]; + target_mfn =3D dom->pv_p2m[target_pfn]; =20 /* Put target MFN at source PFN */ - dom->p2m_host[source_pfn] =3D target_mfn; + dom->pv_p2m[source_pfn] =3D target_mfn; =20 /* Put source MFN at target PFN */ - dom->p2m_host[target_pfn] =3D source_mfn; + dom->pv_p2m[target_pfn] =3D source_mfn; } =20 int kexec_allocate(struct xc_dom_image *dom) @@ -110,7 +110,7 @@ int kexec_allocate(struct xc_dom_image *dom) pages_moved2pfns =3D realloc(pages_moved2pfns, new_allocated * sizeof(= *pages_moved2pfns)); for (i =3D allocated; i < new_allocated; i++) { /* Exchange old page of PFN i with a newly allocated page. */ - xen_pfn_t old_mfn =3D dom->p2m_host[i]; + xen_pfn_t old_mfn =3D dom->pv_p2m[i]; xen_pfn_t new_pfn; xen_pfn_t new_mfn; =20 @@ -122,7 +122,7 @@ int kexec_allocate(struct xc_dom_image *dom) /* * If PFN of newly allocated page (new_pfn) is less then currently * requested PFN (i) then look for relevant PFN/MFN pair. In this - * situation dom->p2m_host[new_pfn] no longer contains proper MFN + * situation dom->pv_p2m[new_pfn] no longer contains proper MFN * because original page with new_pfn was moved earlier * to different location. */ @@ -132,10 +132,10 @@ int kexec_allocate(struct xc_dom_image *dom) pages_moved2pfns[i] =3D new_pfn; =20 /* Put old page at new PFN */ - dom->p2m_host[new_pfn] =3D old_mfn; + dom->pv_p2m[new_pfn] =3D old_mfn; =20 /* Put new page at PFN i */ - dom->p2m_host[i] =3D new_mfn; + dom->pv_p2m[i] =3D new_mfn; } =20 allocated =3D new_allocated; @@ -282,11 +282,11 @@ void kexec(void *kernel, long kernel_size, void *modu= le, long module_size, char dom->p2m_size =3D dom->total_pages; =20 /* setup initial p2m */ - dom->p2m_host =3D malloc(sizeof(*dom->p2m_host) * dom->p2m_size); + dom->pv_p2m =3D malloc(sizeof(*dom->pv_p2m) * dom->p2m_size); =20 /* Start with our current P2M */ for (i =3D 0; i < dom->p2m_size; i++) - dom->p2m_host[i] =3D pfn_to_mfn(i); + dom->pv_p2m[i] =3D pfn_to_mfn(i); =20 if ( (rc =3D xc_dom_build_image(dom)) !=3D 0 ) { printk("xc_dom_build_image returned %d\n", rc); @@ -373,7 +373,7 @@ void kexec(void *kernel, long kernel_size, void *module= , long module_size, char _boot_oldpdmfn =3D virt_to_mfn(start_info.pt_base); DEBUG("boot old pd mfn %lx\n", _boot_oldpdmfn); DEBUG("boot pd virt %lx\n", dom->pgtables_seg.vstart); - _boot_pdmfn =3D dom->p2m_host[PHYS_PFN(dom->pgtables_seg.vstart - dom-= >parms.virt_base)]; + _boot_pdmfn =3D dom->pv_p2m[PHYS_PFN(dom->pgtables_seg.vstart - dom->p= arms.virt_base)]; DEBUG("boot pd mfn %lx\n", _boot_pdmfn); _boot_stack =3D _boot_target + PAGE_SIZE; DEBUG("boot stack %lx\n", _boot_stack); @@ -384,13 +384,13 @@ void kexec(void *kernel, long kernel_size, void *modu= le, long module_size, char =20 /* Keep only useful entries */ for (nr_m2p_updates =3D pfn =3D 0; pfn < start_info.nr_pages; pfn++) - if (dom->p2m_host[pfn] !=3D pfn_to_mfn(pfn)) + if (dom->pv_p2m[pfn] !=3D pfn_to_mfn(pfn)) nr_m2p_updates++; =20 m2p_updates =3D malloc(sizeof(*m2p_updates) * nr_m2p_updates); for (i =3D pfn =3D 0; pfn < start_info.nr_pages; pfn++) - if (dom->p2m_host[pfn] !=3D pfn_to_mfn(pfn)) { - m2p_updates[i].ptr =3D PFN_PHYS(dom->p2m_host[pfn]) | MMU_MACH= PHYS_UPDATE; + if (dom->pv_p2m[pfn] !=3D pfn_to_mfn(pfn)) { + m2p_updates[i].ptr =3D PFN_PHYS(dom->pv_p2m[pfn]) | MMU_MACHPH= YS_UPDATE; m2p_updates[i].val =3D pfn; i++; } diff --git a/tools/libxc/include/xc_dom.h b/tools/libxc/include/xc_dom.h index b7d0faf7e1..d2e316f35e 100644 --- a/tools/libxc/include/xc_dom.h +++ b/tools/libxc/include/xc_dom.h @@ -123,16 +123,12 @@ struct xc_dom_image { =20 /* other state info */ uint32_t f_active[XENFEAT_NR_SUBMAPS]; + /* - * p2m_host maps guest physical addresses an offset from - * rambase_pfn (see below) into gfns. - * - * For a pure PV guest this means that it maps GPFNs into MFNs for - * a hybrid guest this means that it maps GPFNs to GPFNS. - * - * Note that the input is offset by rambase. + * pv_p2m is specific to x86 PV guests, and maps GFNs to MFNs. It is + * eventually copied into guest context. */ - xen_pfn_t *p2m_host; + xen_pfn_t *pv_p2m; =20 /* physical memory * @@ -433,9 +429,12 @@ static inline xen_pfn_t xc_dom_p2m(struct xc_dom_image= *dom, xen_pfn_t pfn) { if ( xc_dom_translated(dom) ) return pfn; - if (pfn < dom->rambase_pfn || pfn >=3D dom->rambase_pfn + dom->total_p= ages) + + /* x86 PV only now. */ + if ( pfn >=3D dom->total_pages ) return INVALID_MFN; - return dom->p2m_host[pfn - dom->rambase_pfn]; + + return dom->pv_p2m[pfn]; } =20 #endif /* _XC_DOM_H */ diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c index 7e0fb9169f..931404c222 100644 --- a/tools/libxc/xc_dom_arm.c +++ b/tools/libxc/xc_dom_arm.c @@ -348,9 +348,6 @@ static int populate_guest_memory(struct xc_dom_image *d= om, } } =20 - for ( pfn =3D 0; pfn < nr_pfns; pfn++ ) - dom->p2m_host[pfn] =3D base_pfn + pfn; - out: free(extents); return rc < 0 ? rc : 0; @@ -359,7 +356,6 @@ static int populate_guest_memory(struct xc_dom_image *d= om, static int meminit(struct xc_dom_image *dom) { int i, rc; - xen_pfn_t pfn; uint64_t modbase; =20 uint64_t ramsize =3D (uint64_t)dom->total_pages << XC_PAGE_SHIFT; @@ -423,11 +419,6 @@ static int meminit(struct xc_dom_image *dom) assert(ramsize =3D=3D 0); /* Too much RAM is rejected above */ =20 dom->p2m_size =3D p2m_size; - dom->p2m_host =3D xc_dom_malloc(dom, sizeof(xen_pfn_t) * p2m_size); - if ( dom->p2m_host =3D=3D NULL ) - return -EINVAL; - for ( pfn =3D 0; pfn < p2m_size; pfn++ ) - dom->p2m_host[pfn] =3D INVALID_PFN; =20 /* setup initial p2m and allocate guest memory */ for ( i =3D 0; i < GUEST_RAM_BANKS && dom->rambank_size[i]; i++ ) diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c index f21662c8b9..819afcb03f 100644 --- a/tools/libxc/xc_dom_x86.c +++ b/tools/libxc/xc_dom_x86.c @@ -318,7 +318,7 @@ static xen_pfn_t move_l3_below_4G(struct xc_dom_image *= dom, if ( !new_l3mfn ) goto out; =20 - p2m_guest[l3pfn] =3D dom->p2m_host[l3pfn] =3D new_l3mfn; + p2m_guest[l3pfn] =3D dom->pv_p2m[l3pfn] =3D new_l3mfn; =20 if ( xc_add_mmu_update(dom->xch, mmu, (((unsigned long long)new_l3mfn) @@ -450,11 +450,11 @@ static int setup_pgtables_x86_32_pae(struct xc_dom_im= age *dom) uint32_t *p2m_guest =3D domx86->p2m_guest; xen_pfn_t l3mfn, l3pfn, i; =20 - /* Copy dom->p2m_host[] into the guest. */ + /* Copy dom->pv_p2m[] into the guest. */ for ( i =3D 0; i < dom->p2m_size; ++i ) { - if ( dom->p2m_host[i] !=3D INVALID_PFN ) - p2m_guest[i] =3D dom->p2m_host[i]; + if ( dom->pv_p2m[i] !=3D INVALID_PFN ) + p2m_guest[i] =3D dom->pv_p2m[i]; else p2m_guest[i] =3D -1; } @@ -505,11 +505,11 @@ static int setup_pgtables_x86_64(struct xc_dom_image = *dom) uint64_t *p2m_guest =3D domx86->p2m_guest; xen_pfn_t i; =20 - /* Copy dom->p2m_host[] into the guest. */ + /* Copy dom->pv_p2m[] into the guest. */ for ( i =3D 0; i < dom->p2m_size; ++i ) { - if ( dom->p2m_host[i] !=3D INVALID_PFN ) - p2m_guest[i] =3D dom->p2m_host[i]; + if ( dom->pv_p2m[i] !=3D INVALID_PFN ) + p2m_guest[i] =3D dom->pv_p2m[i]; else p2m_guest[i] =3D -1; } @@ -1245,11 +1245,11 @@ static int meminit_pv(struct xc_dom_image *dom) return -EINVAL; } =20 - dom->p2m_host =3D xc_dom_malloc(dom, sizeof(xen_pfn_t) * dom->p2m_size= ); - if ( dom->p2m_host =3D=3D NULL ) + dom->pv_p2m =3D xc_dom_malloc(dom, sizeof(xen_pfn_t) * dom->p2m_size); + if ( dom->pv_p2m =3D=3D NULL ) return -EINVAL; for ( pfn =3D 0; pfn < dom->p2m_size; pfn++ ) - dom->p2m_host[pfn] =3D INVALID_PFN; + dom->pv_p2m[pfn] =3D INVALID_PFN; =20 /* allocate guest memory */ for ( i =3D 0; i < nr_vmemranges; i++ ) @@ -1269,7 +1269,7 @@ static int meminit_pv(struct xc_dom_image *dom) pfn_base =3D vmemranges[i].start >> PAGE_SHIFT; =20 for ( pfn =3D pfn_base; pfn < pfn_base+pages; pfn++ ) - dom->p2m_host[pfn] =3D pfn; + dom->pv_p2m[pfn] =3D pfn; =20 pfn_base_idx =3D pfn_base; while ( super_pages ) { @@ -1279,7 +1279,7 @@ static int meminit_pv(struct xc_dom_image *dom) for ( pfn =3D pfn_base_idx, j =3D 0; pfn < pfn_base_idx + (count << SUPERPAGE_2MB_SHIFT); pfn +=3D SUPERPAGE_2MB_NR_PFNS, j++ ) - extents[j] =3D dom->p2m_host[pfn]; + extents[j] =3D dom->pv_p2m[pfn]; rc =3D xc_domain_populate_physmap(dom->xch, dom->guest_domid, = count, SUPERPAGE_2MB_SHIFT, memflags, extents); @@ -1292,7 +1292,7 @@ static int meminit_pv(struct xc_dom_image *dom) { mfn =3D extents[j]; for ( k =3D 0; k < SUPERPAGE_2MB_NR_PFNS; k++, pfn++ ) - dom->p2m_host[pfn] =3D mfn + k; + dom->pv_p2m[pfn] =3D mfn + k; } pfn_base_idx =3D pfn; } @@ -1301,7 +1301,7 @@ static int meminit_pv(struct xc_dom_image *dom) { allocsz =3D min_t(uint64_t, 1024 * 1024, pages - j); rc =3D xc_domain_populate_physmap_exact(dom->xch, dom->guest_d= omid, - allocsz, 0, memflags, &dom->p2m_host[pfn_base + j]); + allocsz, 0, memflags, &dom->pv_p2m[pfn_base + j]); =20 if ( rc ) { @@ -1428,25 +1428,6 @@ static int meminit_hvm(struct xc_dom_image *dom) } =20 dom->p2m_size =3D p2m_size; - dom->p2m_host =3D xc_dom_malloc(dom, sizeof(xen_pfn_t) * - dom->p2m_size); - if ( dom->p2m_host =3D=3D NULL ) - { - DOMPRINTF("Could not allocate p2m"); - goto error_out; - } - - for ( i =3D 0; i < p2m_size; i++ ) - dom->p2m_host[i] =3D ((xen_pfn_t)-1); - for ( vmemid =3D 0; vmemid < nr_vmemranges; vmemid++ ) - { - uint64_t pfn; - - for ( pfn =3D vmemranges[vmemid].start >> PAGE_SHIFT; - pfn < vmemranges[vmemid].end >> PAGE_SHIFT; - pfn++ ) - dom->p2m_host[pfn] =3D pfn; - } =20 /* * Try to claim pages for early warning of insufficient memory availab= le. @@ -1488,14 +1469,16 @@ static int meminit_hvm(struct xc_dom_image *dom) * We attempt to allocate 1GB pages if possible. It falls back on 2MB * pages if 1GB allocation fails. 4KB pages will be used eventually if * both fail. - *=20 - * Under 2MB mode, we allocate pages in batches of no more than 8MB to=20 - * ensure that we can be preempted and hence dom0 remains responsive. */ if ( dom->device_model ) { + xen_pfn_t extents[0xa0]; + + for ( i =3D 0; i < ARRAY_SIZE(extents); ++i ) + extents[i] =3D i; + rc =3D xc_domain_populate_physmap_exact( - xch, domid, 0xa0, 0, memflags, &dom->p2m_host[0x00]); + xch, domid, 0xa0, 0, memflags, extents); if ( rc !=3D 0 ) { DOMPRINTF("Could not populate low memory (< 0xA0).\n"); @@ -1538,7 +1521,7 @@ static int meminit_hvm(struct xc_dom_image *dom) if ( count > max_pages ) count =3D max_pages; =20 - cur_pfn =3D dom->p2m_host[cur_pages]; + cur_pfn =3D cur_pages; =20 /* Take care the corner cases of super page tails */ if ( ((cur_pfn & (SUPERPAGE_1GB_NR_PFNS-1)) !=3D 0) && @@ -1564,8 +1547,7 @@ static int meminit_hvm(struct xc_dom_image *dom) xen_pfn_t sp_extents[nr_extents]; =20 for ( i =3D 0; i < nr_extents; i++ ) - sp_extents[i] =3D - dom->p2m_host[cur_pages+(i<p2m_host[cur_pages+(i<p2m_host[cur= _pages]); + xch, domid, count, 0, new_memflags, extents); cur_pages +=3D count; stat_normal_pages +=3D count; } --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel