qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Alexey Kardashevskiy <aik@ozlabs.ru>, qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>, qemu-ppc@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/5] machine: introduce get_fw_dev_path() callback
Date: Tue, 03 Dec 2013 14:41:14 +0100	[thread overview]
Message-ID: <529DDF7A.5020106@suse.de> (raw)
In-Reply-To: <529D5570.8060205@ozlabs.ru>

Am 03.12.2013 04:52, schrieb Alexey Kardashevskiy:
> On 11/26/2013 03:55 PM, Alexey Kardashevskiy wrote:
>> Hi!
>>
>> btw there is a problem with this patch - it does not compile for
>> "linux-user" as there is no current-machine global variable defined in vl.c
>> which is not compiled for linux-user.
>>
>> How to solve this problem correctly?
>>
>>
>> On 11/25/2013 06:27 PM, Alexey Kardashevskiy wrote:
>>> QEMU supports firmware names for all devices in the QEMU tree but
>>> sometime the exact format differs from what sPAPR platform uses.
>>>
>>> This introduces a callback to let a machine fix device tree path names.
>>>
>>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>>> ---
>>>  hw/core/qdev.c      | 15 ++++++++++++++-
>>>  include/hw/boards.h |  1 +
>>>  2 files changed, 15 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
>>> index e374a93..7347483 100644
>>> --- a/hw/core/qdev.c
>>> +++ b/hw/core/qdev.c
>>> @@ -26,6 +26,7 @@
>>>     this API directly.  */
>>>  
>>>  #include "hw/qdev.h"
>>> +#include "hw/boards.h"
>>>  #include "sysemu/sysemu.h"
>>>  #include "qapi/error.h"
>>>  #include "qapi/qmp/qerror.h"
>>> @@ -497,6 +498,15 @@ static char *bus_get_fw_dev_path(BusState *bus, DeviceState *dev)
>>>      return NULL;
>>>  }
>>>  
>>> +static char *machine_get_fw_dev_path(BusState *bus, DeviceState *dev)
>>> +{
>>> +    if (current_machine->get_fw_dev_path) {
>>> +        return current_machine->get_fw_dev_path(bus, dev);
>>> +    }
>>> +
>>> +    return NULL;
>>> +}
>>> +
> 
> 
> Anyone, please?
> 
> The only easy fix for this I can think of would be this:
> 
> extern QEMUMachine *current_machine __attribute__((weak));
> 
> 
> But I suspect this is disgusting? :)

Kind of. ;) It's introducing one concept in ppc code that's different
from the rest of the code. And it has nothing to do with core device
code, so please not in qdev.c. Better place this function close to where
the current_machine variable actually lives (vl.c?) and add a stub
function to stubs/ if needed.

I don't see how a firmware device path might be relevant for linux-user
though - so since the CPU will be the only device in linux-user, you
might as well use an old-fashioned #ifdef around its usage (assuming
that's reasonably contained) and just place the function where it makes
the most sense for softmmus.

Regards,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

  parent reply	other threads:[~2013-12-03 13:41 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-25  7:27 [Qemu-devel] [RFC PATCH 0/5] spapr: support bootindex Alexey Kardashevskiy
2013-11-25  7:27 ` [Qemu-devel] [PATCH 1/5] boot: extend get_boot_devices_list() to ignore suffixes Alexey Kardashevskiy
2013-11-25  7:27 ` [Qemu-devel] [PATCH 2/5] machine: introduce get_fw_dev_path() callback Alexey Kardashevskiy
2013-11-26  4:55   ` Alexey Kardashevskiy
2013-12-03  3:52     ` Alexey Kardashevskiy
2013-12-03  9:11       ` Markus Armbruster
2013-12-03  9:32         ` Alexey Kardashevskiy
2013-12-03  9:41           ` Paolo Bonzini
2013-12-03 13:41       ` Andreas Färber [this message]
2013-12-03  9:37   ` Paolo Bonzini
2013-12-03 13:44     ` Andreas Färber
2013-12-03 14:00       ` Paolo Bonzini
2013-12-03 14:35         ` Andreas Färber
2013-12-03 14:58           ` Paolo Bonzini
2013-12-11  5:20             ` Alexey Kardashevskiy
2013-12-11  7:47               ` Paolo Bonzini
2013-12-11  7:59                 ` Alexey Kardashevskiy
2013-12-11  8:38                   ` Alexey Kardashevskiy
2013-12-10  7:34         ` Alexey Kardashevskiy
2013-11-25  7:27 ` [Qemu-devel] [PATCH 3/5] spapr-llan: add to boot device list Alexey Kardashevskiy
2013-11-25  7:27 ` [Qemu-devel] [PATCH 4/5] spapr-vio: fix firmware names Alexey Kardashevskiy
2013-11-25  7:27 ` [Qemu-devel] [PATCH 5/5] spapr: define get_fw_dev_path() callback Alexey Kardashevskiy
2013-11-26  4:05   ` [Qemu-devel] [PATCH v2] " Alexey Kardashevskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=529DDF7A.5020106@suse.de \
    --to=afaerber@suse.de \
    --cc=aik@ozlabs.ru \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).