Received: from eggs.gnu.org ([208.118.235.92]:50710) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJjdT-0006xK-QR for qemu-devel@nongnu.org; Thu, 04 Oct 2012 07:30:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TJjdR-0001Po-Ls for qemu-devel@nongnu.org; Thu, 04 Oct 2012 07:30:35 -0400 Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=iso-8859-1 From: Alexander Graf In-Reply-To: <506D7317.40906@linux.vnet.ibm.com> Date: Thu, 4 Oct 2012 13:30:27 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <49B19A15-2864-4354-BA5E-66CBA139FD84@suse.de> References: <50641A82.4030708@linux.vnet.ibm.com> <1348738150.24701.21.camel@pasglop> <20120927095136.GI23096@redhat.com> <506D6B20.7020508@linux.vnet.ibm.com> <20121004112217.GA27396@redhat.com> <506D7317.40906@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [Qemu-ppc] Qemu boot device precedence over nvram boot-device setting List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avik Sil Cc: Benjamin Herrenschmidt , "qemu-ppc@nongnu.org List" , Nikunj A Dadhania , Gleb Natapov , qemu-devel qemu-devel On 04.10.2012, at 13:29, Avik Sil wrote: > On 10/04/2012 04:52 PM, Gleb Natapov wrote: >> On Thu, Oct 04, 2012 at 04:25:28PM +0530, Avik Sil wrote: >>> On 09/27/2012 03:21 PM, Gleb Natapov wrote: >>>> On Thu, Sep 27, 2012 at 11:33:31AM +0200, Alexander Graf wrote: >>>>>=20 >>>>> On 27.09.2012, at 11:29, Benjamin Herrenschmidt wrote: >>>>>=20 >>>>>> On Thu, 2012-09-27 at 14:51 +0530, Avik Sil wrote: >>>>>>> Hi, >>>>>>>=20 >>>>>>> We would like to get a method to boot from devices provided in = -boot >>>>>>> arguments in qemu when the 'boot-device' is set in nvram for = pseries >>>>>>> machine. I mean the boot device specified in -boot should get a >>>>>>> precedence over the 'boot-device' specified in nvram. >>>>>>>=20 >>>>>>> At the same time, when -boot is not provided, i.e., the default = boot >>>>>>> order "cad" is present, the device specified in nvram = 'boot-device' >>>>>>> should get precedence if it is set. >>>>>>>=20 >>>>>>> What should be the elegant way to implement this requirement? >>>>>>> Suggestions welcome. >>>>>>=20 >>>>>> Actually I think it's a more open question. We have essentially = two >>>>>> things at play here: >>>>>>=20 >>>>>> - With the new nvram model, the firmware can store a boot device >>>>>> reference in it, which is standard OF practice, and in fact the = various >>>>>> distro installers are going to do just that >>>>>>=20 >>>>>> - Qemu has its own boot order thingy via -boot, which we loosely >>>>>> translate as c =3D first bootable disk we find (actually first = disk we >>>>>> find, we should probably make the algorithm a bit smarter), d =3D = first >>>>>> cdrom we find, n =3D network , ... We pass that selection (boot = list) down >>>>>> to SLOF via a device-tree property. >>>>>>=20 >>>>>> The question is thus what precedence should we give them. I was >>>>>> initially thinking that an explicit qemu boot list should = override the >>>>>> firmware nvram setting but I'm now not that sure anymore. >>>>>>=20 >>>>>> The -boot list is at best a "blurry" indication of what type of = device >>>>>> the user wants ... The firmware setting in nvram is precise. >>>>>=20 >>>>> IIRC gleb had implemented a specific boot order thing. Gleb, mind = to enlighten us? :) >>>>>=20 >>>> Yes, forget about -boot. It is deprecated :) You should use = bootindex >>>> (device property) to set boot priority. It constructs OF device = path >>>> and passes it to firmware. There is nothing "blurry" about OF = device >>>> path. The problem is that it works reasonably well with legacy BIOS >>>> since it is enough to specify device to boot from, but with EFI (OF = is >>>> the same I guess) it is not enough to point to a device to boot = from, >>>> but you also need to specify a file you want to boot and this is = where >>>> bootindex approach fails. If EFI would specify default file to boot = from >>>> firmware could have used it, but EFI specifies it only for = removable media >>>> (what media is not removable this days, especially with = virtualization?). >>>> We can add qemu parameter to specify file to boot, but how users = should >>>> know the name of the file? >>>>=20 >>> I looked at the bootindex stuff and found that when the bootindex is >>> specified for the disk and cdrom it generates a string like: >>>=20 >>> "/spapr-vio-bridge/spapr-vscsi/channel@0/disk@0,1 >>> /spapr-vio-bridge/spapr-vscsi/channel@0/disk@0,0" >>>=20 >>> Now converting/translating this to OF device path is going to be >>> much trickier and might not be proper. So I propose a simple >>> solution by introducing a global flag that checks if explicit -boot >>> parameter is provided or not. The presence of this parameter is >>> verified in SLOF firmware. The flag had to be introduced as >>> boot_devices defaults to "cad" instead of null and passed to >>> machine->init(). >>>=20 >> So you want to hack around the problem. If -boot is specified what >> device are you going to boot from? >=20 > It is going to boot from the device specified in -boot as = default_boot_order is set to 0 in that case. Imagine you have 2 controllers: * vio * virtio and you specify -boot c. Which device are you going to boot from? Alex