From owner-freebsd-current@FreeBSD.ORG Sat Dec 21 13:57:14 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DBB7055A; Sat, 21 Dec 2013 13:57:13 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5D3FE16EB; Sat, 21 Dec 2013 13:57:13 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id rBLDtdEf027049; Sat, 21 Dec 2013 15:55:39 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua rBLDtdEf027049 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id rBLDtdLk027047; Sat, 21 Dec 2013 15:55:39 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 21 Dec 2013 15:55:39 +0200 From: Konstantin Belousov To: Roger Pau Monne , royger@freebsd.org Subject: Re: [PATCH v7 07/19] xen: implement hook to fetch e820 memory map Message-ID: <20131221135539.GW59496@kib.kiev.ua> References: <1387479296-33389-1-git-send-email-roger.pau@citrix.com> <1387479296-33389-8-git-send-email-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="CT8mOM7I+A1mxHvt" Content-Disposition: inline In-Reply-To: <1387479296-33389-8-git-send-email-roger.pau@citrix.com> User-Agent: Mutt/1.5.22 (2013-10-16) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: xen-devel@lists.xen.org, julien.grall@citrix.com, freebsd-xen@freebsd.org, freebsd-current@freebsd.org, gibbs@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Dec 2013 13:57:14 -0000 --CT8mOM7I+A1mxHvt Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable This also looks fine, with the style nit noted in the patch. On Thu, Dec 19, 2013 at 07:54:44PM +0100, Roger Pau Monne wrote: > --- > sys/amd64/amd64/machdep.c | 50 ++++++++++++++++++++++++++-----------= ----- > sys/amd64/include/pc/bios.h | 2 + > sys/amd64/include/sysarch.h | 1 + > sys/x86/xen/pv.c | 26 ++++++++++++++++++++++ > 4 files changed, 60 insertions(+), 19 deletions(-) >=20 > diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c > index a2dcb90..6bbfe5a 100644 > --- a/sys/amd64/amd64/machdep.c > +++ b/sys/amd64/amd64/machdep.c > @@ -177,11 +177,15 @@ SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startu= p, NULL); > /* Preload data parse function */ > static caddr_t native_parse_preload_data(u_int64_t); > =20 > +/* Native function to fetch and parse the e820 map */ > +static void native_parse_memmap(caddr_t, vm_paddr_t *, int *); > + > /* Default init_ops implementation. */ > struct init_ops init_ops =3D { > .parse_preload_data =3D native_parse_preload_data, > .early_delay_init =3D i8254_init, > .early_delay =3D i8254_delay, > + .parse_memmap =3D native_parse_memmap, > }; > =20 > /* > @@ -1418,21 +1422,12 @@ add_physmap_entry(uint64_t base, uint64_t length,= vm_paddr_t *physmap, > return (1); > } > =20 > -static void > -add_smap_entries(struct bios_smap *smapbase, vm_paddr_t *physmap, > - int *physmap_idx) > +void > +bios_add_smap_entries(struct bios_smap *smapbase, u_int32_t smapsize, > + vm_paddr_t *physmap, int *physmap_idx) > { > struct bios_smap *smap, *smapend; > - u_int32_t smapsize; > =20 > - /* > - * Memory map from INT 15:E820. > - * > - * subr_module.c says: > - * "Consumer may safely assume that size value precedes data." > - * ie: an int32_t immediately precedes smap. > - */ > - smapsize =3D *((u_int32_t *)smapbase - 1); > smapend =3D (struct bios_smap *)((uintptr_t)smapbase + smapsize); > =20 > for (smap =3D smapbase; smap < smapend; smap++) { > @@ -1449,6 +1444,29 @@ add_smap_entries(struct bios_smap *smapbase, vm_pa= ddr_t *physmap, > } > } > =20 > +static void > +native_parse_memmap(caddr_t kmdp, vm_paddr_t *physmap, int *physmap_idx) > +{ > + struct bios_smap *smap; > + u_int32_t size; > + > + /* > + * Memory map from INT 15:E820. > + * > + * subr_module.c says: > + * "Consumer may safely assume that size value precedes data." > + * ie: an int32_t immediately precedes smap. > + */ > + > + smap =3D (struct bios_smap *)preload_search_info(kmdp, > + MODINFO_METADATA | MODINFOMD_SMAP); > + if (smap =3D=3D NULL) > + panic("No BIOS smap info from loader!"); > + size =3D *((u_int32_t *)smap - 1); > + > + bios_add_smap_entries(smap, size, physmap, physmap_idx); > +} > + > /* > * Populate the (physmap) array with base/bound pairs describing the > * available physical memory in the system, then test this memory and > @@ -1466,19 +1484,13 @@ getmemsize(caddr_t kmdp, u_int64_t first) > vm_paddr_t pa, physmap[PHYSMAP_SIZE]; > u_long physmem_start, physmem_tunable, memtest; > pt_entry_t *pte; > - struct bios_smap *smapbase; > quad_t dcons_addr, dcons_size; > =20 > bzero(physmap, sizeof(physmap)); > basemem =3D 0; > physmap_idx =3D 0; > =20 > - smapbase =3D (struct bios_smap *)preload_search_info(kmdp, > - MODINFO_METADATA | MODINFOMD_SMAP); > - if (smapbase =3D=3D NULL) > - panic("No BIOS smap info from loader!"); > - > - add_smap_entries(smapbase, physmap, &physmap_idx); > + init_ops.parse_memmap(kmdp, physmap, &physmap_idx); > =20 > /* > * Find the 'base memory' segment for SMP > diff --git a/sys/amd64/include/pc/bios.h b/sys/amd64/include/pc/bios.h > index e7d568e..92d4265 100644 > --- a/sys/amd64/include/pc/bios.h > +++ b/sys/amd64/include/pc/bios.h > @@ -106,6 +106,8 @@ struct bios_oem { > int bios_oem_strings(struct bios_oem *oem, u_char *buffer, size_t maxlen= ); > uint32_t bios_sigsearch(uint32_t start, u_char *sig, int siglen, int par= alen, > int sigofs); > +void bios_add_smap_entries(struct bios_smap *smapbase, u_int32_t smapsiz= e, > + vm_paddr_t *physmap, int *physmap_idx); This uses the GNU formatting conventions, please indent the continuation line same as the previous line. --CT8mOM7I+A1mxHvt Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iQIcBAEBAgAGBQJStZ3aAAoJEJDCuSvBvK1BgfQP/jpj4Oh1SEQ7UlPkAowY+3+s 3cPDxrepWMtJrYuYWpPJTtNYbn8VmMlnOo97YTdEUQZ1idflGJufZco6kgSRXvxt XTH5CaZuQ2FEgMP6iU+pGGEMknZj4BXa5Tfiv6b9eYB99f87Mvp2lC5E8mrDBqQx 7hYC1fz3B0LGG0Z/kGGDFijjWFo/sVZUDLvUgP5nV6tYYfWrkf/8PTazxDtw+Jaw YhDXo9qSDmNbrKQ0AepECdPsdTX2dSd7AK85Px+fpwuclgza9B/ZDp1256rxOg+6 MdASfC51pWzr1FYEevUi0xujGPjKo17aIMnaxVluVTmfY7drSgEzq0ye2u9ogTHf ISXtni7DQisePagC20VlQQv26G1tGVLqsPIjWG/UoI033YCqW7LwlmUnuHjoaC2c 3e5aM5Nht+3fJ1WjMW+2EH9c99ecep+WnLxpFXt9jdcrjtERBmr4fhXnuwtI6P8r 4fBTFOVF2Bvsbx/VyXqigVVNPnrK6u2PcWIRnwPbKAJTZFpAVWC7wQPQLYI9Ca7O kI2/WJQFVV2LOuHLR0EwpEZaDncMccRyc8pyUzVlaf6Blogy+F3iWk/lDYo0kPpi OZFmtsz0rvWTDrqK6iT4a7RoMHUB5UuZHnoJtuT96aedTpkFYmPn6WMWFyXfPRiD 10vwIYGTVQvvVJPyapod =GSIk -----END PGP SIGNATURE----- --CT8mOM7I+A1mxHvt--