Received: from list by lists.gnu.org with archive (Exim 4.71) id 1YbTHb-0008UJ-9s for mharc-grub-devel@gnu.org; Fri, 27 Mar 2015 08:22:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbTHZ-0008U7-1d for grub-devel@gnu.org; Fri, 27 Mar 2015 08:22:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YbTHU-0007QN-0D for grub-devel@gnu.org; Fri, 27 Mar 2015 08:22:36 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:31930) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbTHT-0007QH-QD for grub-devel@gnu.org; Fri, 27 Mar 2015 08:22:31 -0400 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t2RCMQcU021647 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 27 Mar 2015 12:22:26 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id t2RCMQmb008075 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 27 Mar 2015 12:22:26 GMT Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by userv0122.oracle.com (8.13.8/8.13.8) with ESMTP id t2RCMPmC015932; Fri, 27 Mar 2015 12:22:25 GMT Received: from olila.local.net-space.pl (/10.175.231.232) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 27 Mar 2015 05:22:24 -0700 Date: Fri, 27 Mar 2015 13:22:18 +0100 From: Daniel Kiper To: Jan Beulich Subject: Re: [PATCH 04/18] xen/x86: add multiboot2 protocol support Message-ID: <20150327122218.GJ8294@olila.local.net-space.pl> References: <1422640462-28103-1-git-send-email-daniel.kiper@oracle.com> <1422640462-28103-5-git-send-email-daniel.kiper@oracle.com> <54E76992020000780006222F@mail.emea.novell.com> <20150327105636.GE8294@olila.local.net-space.pl> <55154AFA020000780006E771@mail.emea.novell.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55154AFA020000780006E771@mail.emea.novell.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: aserv0021.oracle.com [141.146.126.233] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 Cc: Juergen Gross , grub-devel@gnu.org, keir@xen.org, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com, roy.franz@linaro.org, ning.sun@intel.com, david.vrabel@citrix.com, phcoder@gmail.com, xen-devel@lists.xenproject.org, qiaowei.ren@intel.com, richard.l.maliszewski@intel.com, gang.wei@intel.com, fu.wei@linaro.org X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Mar 2015 12:22:38 -0000 On Fri, Mar 27, 2015 at 11:20:10AM +0000, Jan Beulich wrote: > >>> On 27.03.15 at 11:56, wrote: > > On Fri, Feb 20, 2015 at 04:06:26PM +0000, Jan Beulich wrote: > >> >>> On 30.01.15 at 18:54, wrote: > >> > --- a/xen/arch/x86/boot/Makefile > >> > +++ b/xen/arch/x86/boot/Makefile > >> > @@ -1,6 +1,7 @@ > >> > obj-bin-y += head.o > >> > > >> > -RELOC_DEPS = $(BASEDIR)/include/asm-x86/config.h $(BASEDIR)/include/xen/multiboot.h > >> > +RELOC_DEPS = $(BASEDIR)/include/asm-x86/config.h $(BASEDIR)/include/xen/compiler.h \ > >> > + $(BASEDIR)/include/xen/multiboot.h $(BASEDIR)/include/xen/multiboot2.h > >> > >> Perhaps we should rather have the compiler generate the > >> dependencies for us when compiling reloc.o? > > > > Hmmm... I am a bit confused. Here > > http://lists.xen.org/archives/html/xen-devel/2014-10/msg02094.html > > you told a bit different thing and relevant patch was accepted as commit > > c42070df66c9fcedf477959b8371b85aa4ac4933 > > (x86/boot: fix reloc.S build dependencies). I can try to do what you > > suggest, this is not a problem > > for me, however, I would like to be sure what is your final decision in that > > case. > > First of all I wasn't anticipating that this list of dependencies would > further grow. And then I didn't say "don't do this", I only pointed > out (albeit maybe a little too implicitly) that this would be a more > complex patch. So, I understand this as "Go for it!". > >> > + .long MULTIBOOT2_TAG_TYPE_BASIC_MEMINFO > >> > + .long MULTIBOOT2_TAG_TYPE_MMAP > >> > +.Lmultiboot2_info_req_end: > >> > + > >> > + .align MULTIBOOT2_TAG_ALIGN > >> > + .short MULTIBOOT2_HEADER_TAG_MODULE_ALIGN > >> > + .short MULTIBOOT2_HEADER_TAG_REQUIRED > >> > + .long 8 /* Tag size. */ > >> > >> ... here and further down you hard-code it. Please be consistent > >> (and if you go the calculation route, perhaps introduce some > >> redundancy reducing macro). > > > > I did this deliberately. I calculate size using labels when it is really > > needed, e.g. in tags which size depends on number of elements. However, > > most tags have strictly defined sizes. So, that is why I dropped labels > > and entered simple numbers. Though I agree that it can be improved. > > I think that we can define relevant tag structures in multiboot2.h and > > generate relevant constants using asm-offsets.c. Is it OK for you? > > That would mean exposing stuff to other parts of the tree which > doesn't need to be exposed. I don't see why you can't just do > proper size calculations here. OK, I will do this as you wish. > >> > @@ -81,10 +135,51 @@ __start: > >> > mov %ecx,%es > >> > mov %ecx,%ss > >> > > >> > + /* Bootloaders may set multiboot[12].mem_lower to a nonzero value */ > >> > >> Above you meet coding style requirements, but here you stop to do > >> so (ongoing below)? Even if pre-existing neighboring comments aren't > >> well formed, please don't make the situation worse. > > > > Do you ask about ending fullstops? Am I right? > > Yes. > > >> > @@ -31,7 +38,16 @@ asm ( > >> > ); > >> > > >> > typedef unsigned int u32; > >> > +typedef unsigned long long u64; > >> > + > >> > +#include "../../../include/xen/compiler.h" > >> > >> Why? > > > > static multiboot_info_t __used *reloc(void *mbi_in, u32 mb_magic) > > Because of this ------> ^^^^^^ > > And what keeps you from leaving out the "static", making the > __used unnecessary? This func is clearly static. Why do not mark it as is and use __used. What is wrong with that? > >> > + > >> > +typedef struct { > >> > + u32 type; > >> > + u32 size; > >> > + u32 mem_lower; > >> > + u32 mem_upper; > >> > +} multiboot2_tag_basic_meminfo_t; > >> > + > >> > +typedef struct __packed { > >> > >> Why __packed when all the others aren't? > > > > Ha! This thing was taken from GRUB2 source. > > I was asking this question myself many times. > > I have not found real explanation for this > > but if you wish I can dive into code and > > try to find one (if it exists). > > Or even better just drop the __packed. Should not we be in line with GRUB2 source? Even it sounds strange. Anyway, I will check GRUB2 source and maybe we can also remove __packed from it. This way everything will be OK. Daniel