From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: qemu-devel@nongnu.org
Cc: "Alexey Kardashevskiy" <aik@ozlabs.ru>,
qemu-ppc@nongnu.org, "Alexander Graf" <agraf@suse.de>,
"Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH v3 1/6] cpu: add suboptions support
Date: Sat, 30 Nov 2013 21:10:26 +1100 [thread overview]
Message-ID: <5299B992.3060906@ozlabs.ru> (raw)
In-Reply-To: <1384155875-26999-2-git-send-email-aik@ozlabs.ru>
On 11/11/2013 06:44 PM, Alexey Kardashevskiy wrote:
> This adds suboptions support for -cpu.
>
> Cc: Andreas Färber <afaerber@suse.de>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
> include/qom/cpu.h | 29 +++++++++++++++++++++++++++++
> include/sysemu/sysemu.h | 1 +
> qom/cpu.c | 27 +++++++++++++++++++++++++++
> vl.c | 42 ++++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 99 insertions(+)
>
> diff --git a/include/qom/cpu.h b/include/qom/cpu.h
> index 7739e00..7d3b043 100644
> --- a/include/qom/cpu.h
> +++ b/include/qom/cpu.h
> @@ -124,6 +124,7 @@ typedef struct CPUClass {
> int cpuid, void *opaque);
> int (*write_elf32_qemunote)(WriteCoreDumpFunction f, CPUState *cpu,
> void *opaque);
> + void (*parse_options)(CPUState *cpu, Error **errp);
>
> const struct VMStateDescription *vmsd;
> int gdb_num_core_regs;
> @@ -327,6 +328,34 @@ static inline hwaddr cpu_get_phys_page_debug(CPUState *cpu, vaddr addr)
> #endif
>
> /**
> + * cpu_parse_options:
> + * @cpu: The CPU to set options for.
> + */
> +static inline int cpu_parse_options(CPUState *cpu)
> +{
> + CPUClass *cc = CPU_GET_CLASS(cpu);
> + Error *err = NULL;
> +
> + if (cc->parse_options) {
> + cc->parse_options(cpu, &err);
> + if (err) {
> + return -1;
> + }
> + }
> +
> + /* No callback, let arch do it the old way */
> + return 0;
> +}
> +
> +/**
> + * cpu_default_parse_options_func:
> + * The default handler for CPUClass::parse_options
> + * @cpu: the CPU to set option for.
> + * @errp: the handling error descriptor.
> + */
> +void cpu_default_parse_options_func(CPUState *cpu, Error **errp);
> +
> +/**
> * cpu_reset:
> * @cpu: The CPU whose state is to be reset.
> */
> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
> index cd5791e..c6e3ea0 100644
> --- a/include/sysemu/sysemu.h
> +++ b/include/sysemu/sysemu.h
> @@ -190,6 +190,7 @@ char *get_boot_devices_list(size_t *size);
> DeviceState *get_boot_device(uint32_t position);
>
> QemuOpts *qemu_get_machine_opts(void);
> +QemuOpts *qemu_get_cpu_opts(void);
>
> bool usb_enabled(bool default_usb);
>
> diff --git a/qom/cpu.c b/qom/cpu.c
> index 818fb26..231dec5 100644
> --- a/qom/cpu.c
> +++ b/qom/cpu.c
> @@ -24,6 +24,8 @@
> #include "qemu/notify.h"
> #include "qemu/log.h"
> #include "sysemu/sysemu.h"
> +#include "qapi/qmp/qerror.h"
> +#include "qemu/config-file.h"
>
> bool cpu_exists(int64_t id)
> {
> @@ -186,6 +188,31 @@ void cpu_reset(CPUState *cpu)
> }
> }
>
> +static int cpu_set_property(const char *name, const char *value, void *opaque)
> +{
> + Error *err = NULL;
> +
> + if (strcmp(name, "type") == 0) {
> + return 0;
> + }
> +
> + object_property_parse(opaque, value, name, &err);
> + if (err != NULL) {
> + qerror_report_err(err);
> + error_free(err);
> + return -1;
> + }
> +
> + return 0;
> +}
> +
> +void cpu_default_parse_options_func(CPUState *cpu, Error **errp)
> +{
> + if (qemu_opt_foreach(qemu_get_cpu_opts(), cpu_set_property, cpu, 1)) {
> + error_setg(errp, "Bad option");
> + }
> +}
btw there is a problem - all this qemu_opt stuff normally lives in vl.c so
this patch does not compile with linux-user target.
How to solve this properly before I continue spamming the list? :)
--
Alexey
next prev parent reply other threads:[~2013-11-30 10:10 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-11 7:44 [Qemu-devel] [PATCH v3 0/6] spapr: add "compat" machine option Alexey Kardashevskiy
2013-11-11 7:44 ` [Qemu-devel] [PATCH v3 1/6] cpu: add suboptions support Alexey Kardashevskiy
2013-11-30 10:10 ` Alexey Kardashevskiy [this message]
2013-11-30 11:00 ` Paolo Bonzini
2013-11-30 13:08 ` Alexey Kardashevskiy
2013-11-11 7:44 ` [Qemu-devel] [PATCH v3 2/6] target-ppc: make use of new -cpu suboptions handling Alexey Kardashevskiy
2013-11-11 7:44 ` [Qemu-devel] [PATCH v3 3/6] target-ppc: add "compat" CPU option Alexey Kardashevskiy
2013-11-11 7:44 ` [Qemu-devel] [PATCH v3 4/6] qemu-option: support +foo/-foo command line agruments Alexey Kardashevskiy
2013-11-11 12:41 ` Andreas Färber
2013-11-11 12:52 ` Jan Kiszka
2013-11-11 13:23 ` Andreas Färber
2013-11-11 14:25 ` Igor Mammedov
2013-11-11 23:49 ` Alexey Kardashevskiy
2013-11-12 9:58 ` Igor Mammedov
2013-11-12 12:39 ` Alexey Kardashevskiy
2013-11-12 12:45 ` Andreas Färber
2013-11-13 1:51 ` Alexey Kardashevskiy
2013-11-13 9:29 ` Paolo Bonzini
2013-11-12 13:11 ` Igor Mammedov
2013-11-13 2:07 ` Alexey Kardashevskiy
2013-11-13 10:38 ` Igor Mammedov
2013-11-13 9:20 ` Paolo Bonzini
2013-11-11 7:44 ` [Qemu-devel] [PATCH v3 5/6] bitops: add BITNR macro Alexey Kardashevskiy
2013-11-11 11:57 ` Andreas Färber
2013-11-11 12:09 ` Alexey Kardashevskiy
2013-11-13 2:40 ` Alexey Kardashevskiy
2013-11-13 12:04 ` Paolo Bonzini
2013-11-14 5:51 ` Alexey Kardashevskiy
2013-11-14 8:54 ` Paolo Bonzini
2013-11-11 7:44 ` [Qemu-devel] [PATCH v3 6/6] target-ppc: demonstrate new "vsx" property Alexey Kardashevskiy
2013-11-11 13:31 ` Andreas Färber
2013-11-14 5:20 ` Alexey Kardashevskiy
2013-11-14 16:04 ` Andreas Färber
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=5299B992.3060906@ozlabs.ru \
--to=aik@ozlabs.ru \
--cc=afaerber@suse.de \
--cc=agraf@suse.de \
--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.