From patchwork Wed Jan 9 04:00:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin O'Connor X-Patchwork-Id: 210611 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C238C2C014C for ; Wed, 9 Jan 2013 15:01:01 +1100 (EST) Received: from localhost ([::1]:45354 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsmqZ-0006MR-UD for incoming@patchwork.ozlabs.org; Tue, 08 Jan 2013 23:00:59 -0500 Received: from eggs.gnu.org ([208.118.235.92]:38662) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsmqQ-0006M8-5J for qemu-devel@nongnu.org; Tue, 08 Jan 2013 23:00:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TsmqM-0004op-JK for qemu-devel@nongnu.org; Tue, 08 Jan 2013 23:00:50 -0500 Received: from mail-qa0-f44.google.com ([209.85.216.44]:37381) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsmqM-0004oa-6S for qemu-devel@nongnu.org; Tue, 08 Jan 2013 23:00:46 -0500 Received: by mail-qa0-f44.google.com with SMTP id z4so353158qan.3 for ; Tue, 08 Jan 2013 20:00:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent:x-gm-message-state; bh=Anuv2Zy0UWVGOkIIwUDJ6DcTVCkZ7wsw2/tGqdOrjnk=; b=VrOGbxI/YMveL0cTcAr92VF27BUjPsufod6s1PRuwr+tSbsk6ignnC7SUgIr8mtriL pvoyNHlWsJln09sO0x8cYH4Ae9f+Os0p68PUlWbd1bCeonVdjpQMS4ty/i1SVCBTjmBX VfHADaipOGFY68Z7m9uhmHMxYfeBXRSkcTnin/UzGudvOAElbsIeeaY6nM1blsPHpNTS Ld2a/igm9ykw38i6Q1XepAQytTRosijf3WRtojoCttPmnTkmiJvppbIl69kwo+hafwfp +DLgBzwW+BwErmFGXSV9jo32Sh/KLNc3dCse44Qfja4scA1r+jCho2YnGal/GcpxxWbw 0ONg== X-Received: by 10.229.75.224 with SMTP id z32mr11879719qcj.148.1357704045239; Tue, 08 Jan 2013 20:00:45 -0800 (PST) Received: from localhost (207-172-165-101.c3-0.avec-ubr1.nyr-avec.ny.cable.rcn.com. [207.172.165.101]) by mx.google.com with ESMTPS id cy2sm18426873qeb.9.2013.01.08.20.00.43 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Jan 2013 20:00:44 -0800 (PST) Date: Tue, 8 Jan 2013 23:00:42 -0500 From: Kevin O'Connor To: Amos Kong Message-ID: <20130109040042.GC26614@morn.localdomain> References: <20121225103701.GA6688@t430s.redhat.com> <1356483340-12962-1-git-send-email-akong@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1356483340-12962-1-git-send-email-akong@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Gm-Message-State: ALoCoQnfTmt1z/UWAlZMcazTylL6UHz1RUJeMwwhO8OFqF5qpCdlDLLqqEp8bJEaVpVwhmoHkcWi X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.216.44 Cc: alex.williamson@redhat.com, seabios@seabios.org, dallan@redhat.com, qemu-devel@nongnu.org, gleb@redhat.com Subject: Re: [Qemu-devel] [SeaBIOS PATCH v2] boot: support strict boot and make it configurable X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On Wed, Dec 26, 2012 at 08:55:40AM +0800, Amos Kong wrote: > Current seabios will try to boot from selected devices first, > if they are all failed, seabios will also try to boot from > un-selected devices. > > For example: > @ qemu-kvm -boot order=n,menu=on ... > > Guest will boot from network first, if it's failed, guest will try to > boot from other un-selected devices (floppy, cdrom, disk) one by one. > > We need to make it configurable, seabios user can config it by a rom > file('etc/boot-strict'). 'strict boot' means only boot from user > selected devices. > > I added some comments in this patch to explain why we can judge if > device is selected or not by DEFAULT_PRIO(9999). I also added 'selected' > flag in struct bootentry_s and struct bev_s to make it clearer. > > If this patch is accepted, I will add a boot option (-boot strict=on) > for qemu. I think it would be simpler to use the existing bootorder file instead of introducing a new "boot-strict" file. Something like the below (untested). -Kevin diff --git a/src/boot.c b/src/boot.c index c67cc7f..56843e3 100644 --- a/src/boot.c +++ b/src/boot.c @@ -291,6 +291,7 @@ static struct bootentry_s *BootList; #define IPL_TYPE_CBFS 0x20 #define IPL_TYPE_BEV 0x80 #define IPL_TYPE_BCV 0x81 +#define IPL_TYPE_HALT 0xf0 static void bootentry_add(int type, int prio, u32 data, const char *desc) @@ -488,6 +489,10 @@ boot_prep(void) interactive_bootmenu(); wait_threads(); + int haltprio = find_prio("HALT"); + if (haltprio >= 0) + bootentry_add(IPL_TYPE_HALT, haltprio, 0, "HALT"); + // Map drives and populate BEV list struct bootentry_s *pos = BootList; while (pos) { @@ -672,6 +677,9 @@ do_boot(int seq_nr) case IPL_TYPE_BEV: boot_rom(ie->vector); break; + case IPL_TYPE_HALT: + boot_fail(); + break; } // Boot failed: invoke the boot recovery function