qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/2] niagara: fail if a firmware file is missing


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH 1/2] niagara: fail if a firmware file is missing
Date: Tue, 24 Jan 2017 09:21:42 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Peter Maydell <address@hidden> writes:

> On 23 January 2017 at 22:17, Peter Maydell <address@hidden> wrote:
>> On 23 January 2017 at 21:21, Artyom Tarasenko <address@hidden> wrote:
>>> Suggested-by: Peter Maydell <address@hidden>
>>> Signed-off-by: Artyom Tarasenko <address@hidden>
>>> ---
>>>  hw/sparc64/niagara.c | 22 +++++++++++++++-------
>>>  1 file changed, 15 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/hw/sparc64/niagara.c b/hw/sparc64/niagara.c
>>> index b55d4bb..e945b5a 100644
>>> --- a/hw/sparc64/niagara.c
>>> +++ b/hw/sparc64/niagara.c
>>> @@ -35,6 +35,7 @@
>>>  #include "hw/timer/sun4v-rtc.h"
>>>  #include "exec/address-spaces.h"
>>>  #include "sysemu/block-backend.h"
>>> +#include "qemu/error-report.h"
>>>
>>>
>>>  typedef struct NiagaraBoardState {
>>> @@ -85,6 +86,14 @@ typedef struct NiagaraBoardState {
>>>  #define NIAGARA_OBP_OFFSET  0x80000ULL
>>>  #define PROM_SIZE_MAX       (4 * 1024 * 1024)
>>>
>>> +static void add_rom_or_fail(const char *file, const hwaddr addr)
>>> +{
>>> +    if (rom_add_file_fixed(file, addr, -1)) {
>>> +        error_report("Unable to load a firmware for -M niagara");
>>> +        exit(1);
>>
>> It would be nice to include the name of the file in the
>> error message -- or is that reported already inside
>> rom_add_file_fixed() somehow?

Yes, it is, in rom_add_file():

    if (fd == -1) {
        fprintf(stderr, "Could not open option rom '%s': %s\n",
                rom->path, strerror(errno));
        goto err;
    }

> PS: doesn't this break 'make check' if the rom files
> are missing?

Yes, it does.  Obvious incremental fix appended.  It still prints
rom_add_file()'s message.  Swap the operands of && to get rid of it.



diff --git a/hw/sparc64/niagara.c b/hw/sparc64/niagara.c
index a14724f..6b78394 100644
--- a/hw/sparc64/niagara.c
+++ b/hw/sparc64/niagara.c
@@ -35,6 +35,7 @@
 #include "hw/timer/sun4v-rtc.h"
 #include "exec/address-spaces.h"
 #include "sysemu/block-backend.h"
+#include "sysemu/qtest.h"
 #include "qemu/error-report.h"
 
 
@@ -88,7 +89,7 @@ typedef struct NiagaraBoardState {
 
 static void add_rom_or_fail(const char *file, const hwaddr addr)
 {
-    if (rom_add_file_fixed(file, addr, -1)) {
+    if (rom_add_file_fixed(file, addr, -1) && !qtest_enabled()) {
         error_report("Unable to load a firmware for -M niagara");
         exit(1);
     }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]