All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: qemu-devel@nongnu.org
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>,
	qemu-ppc@nongnu.org, Paul Mackerras <paulus@samba.org>,
	Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH 2/5] machine: introduce get_fw_dev_path() callback
Date: Tue, 26 Nov 2013 15:55:06 +1100	[thread overview]
Message-ID: <529429AA.1000403@ozlabs.ru> (raw)
In-Reply-To: <1385364460-24332-3-git-send-email-aik@ozlabs.ru>

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;
> +}
> +
>  static int qdev_get_fw_dev_path_helper(DeviceState *dev, char *p, int size)
>  {
>      int l = 0;
> @@ -504,7 +514,10 @@ static int qdev_get_fw_dev_path_helper(DeviceState *dev, char *p, int size)
>      if (dev && dev->parent_bus) {
>          char *d;
>          l = qdev_get_fw_dev_path_helper(dev->parent_bus->parent, p, size);
> -        d = bus_get_fw_dev_path(dev->parent_bus, dev);
> +        d = machine_get_fw_dev_path(dev->parent_bus, dev);
> +        if (!d) {
> +            d = bus_get_fw_dev_path(dev->parent_bus, dev);
> +        }
>          if (d) {
>              l += snprintf(p + l, size - l, "%s", d);
>              g_free(d);
> diff --git a/include/hw/boards.h b/include/hw/boards.h
> index 5a7ae9f..50ff24a 100644
> --- a/include/hw/boards.h
> +++ b/include/hw/boards.h
> @@ -43,6 +43,7 @@ typedef struct QEMUMachine {
>      GlobalProperty *compat_props;
>      struct QEMUMachine *next;
>      const char *hw_version;
> +    char *(*get_fw_dev_path)(BusState *bus, DeviceState *dev);
>  } QEMUMachine;
>  
>  int qemu_register_machine(QEMUMachine *m);
> 


-- 
Alexey

  reply	other threads:[~2013-11-26  4:55 UTC|newest]

Thread overview: 24+ 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 [this message]
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
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
2013-11-26  4:07 ` [PATCH] boot: enable support for bootindex 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=529429AA.1000403@ozlabs.ru \
    --to=aik@ozlabs.ru \
    --cc=nikunj@linux.vnet.ibm.com \
    --cc=paulus@samba.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.