From: Igor Mammedov <imammedo@redhat.com>
To: Lv Zheng <lv.zheng@intel.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
qemu-devel@nongnu.org, Lv Zheng <zetalog@gmail.com>,
armbru@redhat.com, qemu-arm@nongnu.org,
Shannon Zhao <shannon.zhao@linaro.org>,
Paolo Bonzini <pbonzini@redhat.com>,
eblake@redhat.com, Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-arm] [PATCH v5 1/2] ACPI: Cleanup -acpitable option code
Date: Fri, 12 Aug 2016 16:51:00 +0200 [thread overview]
Message-ID: <20160812165100.7fc99c64@nial.brq.redhat.com> (raw)
In-Reply-To: <596008a543fe75e5c91db0cf7fd0cf4b2a6a2ca1.1470907810.git.lv.zheng@intel.com>
On Thu, 11 Aug 2016 17:36:38 +0800
Lv Zheng <lv.zheng@intel.com> wrote:
> In -acpitable options, at least/most one data/file sub-option is mandatory,
> this patch cleans up the code to reflect this in a managed manner so that
> the follow-up mandatory sub-options can be added to -acpitable.
>
> Signed-off-by: Lv Zheng <lv.zheng@intel.com>
> ---
> hw/acpi/core.c | 32 +++++++++++++++++++++++---------
> qapi-schema.json | 26 +++++++-------------------
> qemu-options.hx | 7 +++++--
> 3 files changed, 35 insertions(+), 30 deletions(-)
>
> diff --git a/hw/acpi/core.c b/hw/acpi/core.c
> index e890a5d..85e0e94 100644
> --- a/hw/acpi/core.c
> +++ b/hw/acpi/core.c
> @@ -89,8 +89,6 @@ static int acpi_checksum(const uint8_t *data, int len)
> * It is valid to call this function with
> * (@blob == NULL && bloblen == 0 && !has_header).
> *
> - * @hdrs->file and @hdrs->data are ignored.
> - *
unrelated change?
> * SIZE_MAX is considered "infinity" in this function.
> *
> * The number of tables that can be installed is not limited, but the 16-bit
> @@ -229,7 +227,8 @@ static void acpi_table_install(const char unsigned *blob, size_t bloblen,
> ACPI_TABLE_PFX_SIZE, acpi_payload_size);
> }
>
> -void acpi_table_add(const QemuOpts *opts, Error **errp)
> +static void acpi_table_from_file(bool has_header, const char *file,
> + const QemuOpts *opts, Error **errp)
> {
> AcpiTableOptions *hdrs = NULL;
> Error *err = NULL;
> @@ -249,12 +248,8 @@ void acpi_table_add(const QemuOpts *opts, Error **errp)
> if (err) {
> goto out;
> }
> - if (hdrs->has_file == hdrs->has_data) {
> - error_setg(&err, "'-acpitable' requires one of 'data' or 'file'");
> - goto out;
> - }
>
> - pathnames = g_strsplit(hdrs->has_file ? hdrs->file : hdrs->data, ":", 0);
> + pathnames = g_strsplit(file, ":", 0);
> if (pathnames == NULL || pathnames[0] == NULL) {
> error_setg(&err, "'-acpitable' requires at least one pathname");
> goto out;
> @@ -291,7 +286,7 @@ void acpi_table_add(const QemuOpts *opts, Error **errp)
> close(fd);
> }
>
> - acpi_table_install(blob, bloblen, hdrs->has_file, hdrs, &err);
> + acpi_table_install(blob, bloblen, has_header, hdrs, &err);
>
> out:
> g_free(blob);
> @@ -301,6 +296,25 @@ out:
> error_propagate(errp, err);
> }
>
> +void acpi_table_add(const QemuOpts *opts, Error **errp)
> +{
> + const char *val;
> +
> + val = qemu_opt_get((QemuOpts *)opts, "file");
> + if (val) {
> + acpi_table_from_file(true, val, opts, errp);
> + return;
> + }
> +
> + val = qemu_opt_get((QemuOpts *)opts, "data");
> + if (val) {
> + acpi_table_from_file(false, val, opts, errp);
> + return;
> + }
> +
> + error_setg(errp, "'-acpitable' requires one of 'data' or 'file'");
> +}
> +
> static bool acpi_table_builtin = false;
>
> void acpi_table_add_builtin(const QemuOpts *opts, Error **errp)
> diff --git a/qapi-schema.json b/qapi-schema.json
> index 5658723..75b8b3b 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -3597,17 +3597,17 @@
> ##
> # @AcpiTableOptions
> #
> -# Specify an ACPI table on the command line to load.
> +# Specify ACPI table options for the table loaded on the command line.
> #
> -# At most one of @file and @data can be specified. The list of files specified
> -# by any one of them is loaded and concatenated in order.
> -# If both are omitted, @data is implied.
You are removing this bit of documentation, which is still true
> +# ACPI table can be loaded via 'file' and 'data' options. At most one of
> +# 'file' and 'data' can be specified. The list of files specified by any one
> +# of them is loaded and concatenated in order.
> #
> # Other fields / optargs can be used to override fields of the generic ACPI
> # table header; refer to the ACPI specification 5.0, section 5.2.6 System
> # Description Table Header. If a header field is not overridden, then the
> -# corresponding value from the concatenated blob is used (in case of @file), or
> -# it is filled in with a hard-coded value (in case of @data).
> +# corresponding value from the concatenated blob is used (in case of 'file'),
> +# or it is filled in with a hard-coded value (in case of 'data').
> #
> # String fields are copied into the matching ACPI member from lowest address
> # upwards, and silently truncated / NUL-padded to length.
> @@ -3628,16 +3628,6 @@
> # @asl_compiler_rev: #optional revision number of the utility that created the
> # table (4 bytes)
> #
> -# @file: #optional colon (:) separated list of pathnames to load and
> -# concatenate as table data. The resultant binary blob is expected to
> -# have an ACPI table header. At least one file is required. This field
> -# excludes @data.
> -#
> -# @data: #optional colon (:) separated list of pathnames to load and
> -# concatenate as table data. The resultant binary blob must not have an
> -# ACPI table header. At least one file is required. This field excludes
> -# @file.
> -#
> # Since 1.5
> ##
> { 'struct': 'AcpiTableOptions',
> @@ -3648,9 +3638,7 @@
> '*oem_table_id': 'str',
> '*oem_rev': 'uint32',
> '*asl_compiler_id': 'str',
> - '*asl_compiler_rev': 'uint32',
> - '*file': 'str',
> - '*data': 'str' }}
> + '*asl_compiler_rev': 'uint32' }}
it's probably is not ok to remove fields here
as it might break existing users that expect them
>
> ##
> # @CommandLineParameterType:
> diff --git a/qemu-options.hx b/qemu-options.hx
> index a71aaf8..5fe7f87 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -1493,10 +1493,13 @@ Disable HPET support.
> ETEXI
>
> DEF("acpitable", HAS_ARG, QEMU_OPTION_acpitable,
> - "-acpitable [sig=str][,rev=n][,oem_id=str][,oem_table_id=str][,oem_rev=n][,asl_compiler_id=str][,asl_compiler_rev=n][,{data|file}=file1[:file2]...]\n"
> + "-acpitable {data|file}=file1[:file2]...\n"
> + " [,sig=str][,rev=n]\n"
> + " [,oem_id=str][,oem_table_id=str][,oem_rev=n]\n"
> + " [,asl_compiler_id=str][,asl_compiler_rev=n]\n"
> " ACPI table description\n", QEMU_ARCH_I386)
> STEXI
> -@item -acpitable [sig=@var{str}][,rev=@var{n}][,oem_id=@var{str}][,oem_table_id=@var{str}][,oem_rev=@var{n}] [,asl_compiler_id=@var{str}][,asl_compiler_rev=@var{n}][,data=@var{file1}[:@var{file2}]...]
> +@item -acpitable data=@var{file1}[:@var{file2}]...[,sig=@var{str}][,rev=@var{n}][,oem_id=@var{str}][,oem_table_id=@var{str}][,oem_rev=@var{n}] [,asl_compiler_id=@var{str}][,asl_compiler_rev=@var{n}]
> @findex -acpitable
> Add ACPI table with specified header fields and context from specified files.
> For file=, take whole ACPI table from the specified files, including all
next prev parent reply other threads:[~2016-08-12 15:29 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-08 7:28 [Qemu-arm] [PATCH] ACPI: Add -acpifadt to allow FADT revision changes Lv Zheng
2016-08-08 7:35 ` [Qemu-arm] [Qemu-devel] " no-reply
2016-08-08 8:16 ` [Qemu-arm] [PATCH v2] " Lv Zheng
2016-08-08 9:01 ` Paolo Bonzini
2016-08-09 21:06 ` Zheng, Lv
2016-08-08 11:25 ` [Qemu-arm] [PATCH] " Igor Mammedov
2016-08-11 9:06 ` [Qemu-arm] [PATCH v3 0/2] ACPI: Add FADT revision support Lv Zheng
2016-08-11 9:06 ` [Qemu-arm] [PATCH v3 1/2] ACPI: Cleanup -acpitable option code Lv Zheng
2016-08-11 9:06 ` [Qemu-devel] [PATCH v3 2/2] ACPI: Add -acpitable fadt= to allow FADT revision changes Lv Zheng
2016-08-11 9:11 ` [Qemu-arm] [Qemu-devel] [PATCH v3 0/2] ACPI: Add FADT revision support no-reply
2016-08-11 9:12 ` [Qemu-devel] [PATCH v4 " Lv Zheng
2016-08-11 9:12 ` [Qemu-arm] [PATCH v4 1/2] ACPI: Cleanup -acpitable option code Lv Zheng
2016-08-11 9:17 ` Zheng, Lv
2016-08-11 9:12 ` [Qemu-devel] [PATCH v4 2/2] ACPI: Add -acpitable fadt= to allow FADT revision changes Lv Zheng
2016-08-11 9:36 ` [Qemu-arm] [PATCH v5 0/2] ACPI: Add FADT revision support Lv Zheng
2016-08-11 9:36 ` [Qemu-arm] [PATCH v5 1/2] ACPI: Cleanup -acpitable option code Lv Zheng
2016-08-12 14:51 ` Igor Mammedov [this message]
2016-08-15 5:23 ` Zheng, Lv
2016-08-11 9:36 ` [Qemu-devel] [PATCH v5 2/2] ACPI: Add -acpitable fadt= to allow FADT revision changes Lv Zheng
2016-08-11 12:42 ` [Qemu-arm] " Igor Mammedov
2016-08-12 0:47 ` Zheng, Lv
2016-08-12 3:07 ` Michael S. Tsirkin
2016-08-15 1:33 ` Zheng, Lv
2016-08-15 1:47 ` Michael S. Tsirkin
2016-08-15 2:18 ` [Qemu-devel] " Zheng, Lv
2016-08-15 2:23 ` [Qemu-arm] " Michael S. Tsirkin
2016-08-15 3:18 ` Zheng, Lv
2016-08-12 14:55 ` Igor Mammedov
2016-08-15 4:18 ` Zheng, Lv
2016-08-12 14:59 ` [Qemu-devel] " Paolo Bonzini
2016-08-15 1:42 ` [Qemu-arm] " Zheng, Lv
2016-08-17 11:42 ` Paolo Bonzini
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=20160812165100.7fc99c64@nial.brq.redhat.com \
--to=imammedo@redhat.com \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=lv.zheng@intel.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=shannon.zhao@linaro.org \
--cc=zetalog@gmail.com \
/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).