From: Peter Maydell <peter.maydell@linaro.org>
To: Kwangwoo Lee <kwangwoo.lee@sk.com>
Cc: Xiao Guangrong <guangrong.xiao@linux.intel.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Igor Mammedov <imammedo@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Richard Henderson <rth@twiddle.net>,
Eduardo Habkost <ehabkost@redhat.com>,
Shannon Zhao <zhaoshenglong@huawei.com>,
Shannon Zhao <shannon.zhao@linaro.org>,
QEMU Developers <qemu-devel@nongnu.org>,
qemu-arm <qemu-arm@nongnu.org>,
Woosuk Chung <woosuk.chung@sk.com>,
Hyunchul Kim <hyunchul3.kim@sk.com>
Subject: Re: [Qemu-devel] [RFC PATCH 2/3] nvdimm: use configurable ACPI IO base and size
Date: Mon, 25 Jul 2016 17:12:35 +0100 [thread overview]
Message-ID: <CAFEAcA9Dce1qQS6QHjxYWMykX6wycusPQM3UDquifTr38oOd=Q@mail.gmail.com> (raw)
In-Reply-To: <1468975744-12587-3-git-send-email-kwangwoo.lee@sk.com>
On 20 July 2016 at 01:49, Kwangwoo Lee <kwangwoo.lee@sk.com> wrote:
> This patch uses configurable IO base and size to create NPIO AML for
> ACPI NFIT. Since a different architecture like AArch64 does not use
> port-mapped IO, a configurable IO base is required to create correct
> mapping of ACPI IO address and size.
>
> Signed-off-by: Kwangwoo Lee <kwangwoo.lee@sk.com>
> ---
> hw/acpi/nvdimm.c | 23 +++++++++++++++--------
> hw/i386/acpi-build.c | 2 +-
> hw/i386/pc_piix.c | 8 +++++++-
> hw/i386/pc_q35.c | 8 +++++++-
> include/hw/mem/nvdimm.h | 17 ++++++++++++++++-
> 5 files changed, 46 insertions(+), 12 deletions(-)
>
> diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c
> index e486128..57e03ee 100644
> --- a/hw/acpi/nvdimm.c
> +++ b/hw/acpi/nvdimm.c
> @@ -765,8 +765,8 @@ void nvdimm_init_acpi_state(AcpiNVDIMMState *state, MemoryRegion *io,
> FWCfgState *fw_cfg, Object *owner)
> {
> memory_region_init_io(&state->io_mr, owner, &nvdimm_dsm_ops, state,
> - "nvdimm-acpi-io", NVDIMM_ACPI_IO_LEN);
> - memory_region_add_subregion(io, NVDIMM_ACPI_IO_BASE, &state->io_mr);
> + "nvdimm-acpi-io", state->dsm_io.size);
> + memory_region_add_subregion(io, state->dsm_io.base, &state->io_mr);
>
> state->dsm_mem = g_array_new(false, true /* clear */, 1);
> acpi_data_push(state->dsm_mem, sizeof(NvdimmDsmIn));
Why does this function take a MemoryRegion to insert itself into,
rather than returning a MemoryRegion for the caller to map into
wherever is appropriate, or even being a DeviceState which has
mappable memory regions via the sysbus API ?
I guess the answer is "that's the way it happens to be at the moment",
so I'm not really asking for a change here necessarily.
> @@ -912,9 +912,10 @@ static void nvdimm_build_nvdimm_devices(GSList *device_list, Aml *root_dev)
>
> static void nvdimm_build_ssdt(GSList *device_list, GArray *table_offsets,
> GArray *table_data, BIOSLinker *linker,
> - GArray *dsm_dma_arrea)
> + AcpiNVDIMMState *acpi_nvdimm_state)
> {
> Aml *ssdt, *sb_scope, *dev, *field;
> + AmlRegionSpace rs;
> int mem_addr_offset, nvdimm_ssdt;
>
> acpi_add_table(table_offsets, table_data);
> @@ -940,8 +941,14 @@ static void nvdimm_build_ssdt(GSList *device_list, GArray *table_offsets,
> aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0012")));
>
> /* map DSM memory and IO into ACPI namespace. */
> - aml_append(dev, aml_operation_region("NPIO", AML_SYSTEM_IO,
> - aml_int(NVDIMM_ACPI_IO_BASE), NVDIMM_ACPI_IO_LEN));
> + if (acpi_nvdimm_state->dsm_io.type == NVDIMM_ACPI_IO_PORT) {
> + rs = AML_SYSTEM_IO;
> + } else {
> + rs = AML_SYSTEM_MEMORY;
> + }
> + aml_append(dev, aml_operation_region("NPIO", rs,
> + aml_int(acpi_nvdimm_state->dsm_io.base),
> + acpi_nvdimm_state->dsm_io.size));
> aml_append(dev, aml_operation_region("NRAM", AML_SYSTEM_MEMORY,
> aml_name(NVDIMM_ACPI_MEM_ADDR), sizeof(NvdimmDsmIn)));
>
> @@ -1014,7 +1021,7 @@ static void nvdimm_build_ssdt(GSList *device_list, GArray *table_offsets,
> NVDIMM_ACPI_MEM_ADDR);
>
> bios_linker_loader_alloc(linker,
> - NVDIMM_DSM_MEM_FILE, dsm_dma_arrea,
> + NVDIMM_DSM_MEM_FILE, acpi_nvdimm_state->dsm_mem,
> sizeof(NvdimmDsmIn), false /* high memory */);
> bios_linker_loader_add_pointer(linker,
> ACPI_BUILD_TABLE_FILE, mem_addr_offset, sizeof(uint32_t),
> @@ -1026,7 +1033,7 @@ static void nvdimm_build_ssdt(GSList *device_list, GArray *table_offsets,
> }
>
> void nvdimm_build_acpi(GArray *table_offsets, GArray *table_data,
> - BIOSLinker *linker, GArray *dsm_dma_arrea)
> + BIOSLinker *linker, AcpiNVDIMMState *acpi_nvdimm_state)
> {
> GSList *device_list;
>
> @@ -1037,6 +1044,6 @@ void nvdimm_build_acpi(GArray *table_offsets, GArray *table_data,
> }
> nvdimm_build_nfit(device_list, table_offsets, table_data, linker);
> nvdimm_build_ssdt(device_list, table_offsets, table_data, linker,
> - dsm_dma_arrea);
> + acpi_nvdimm_state);
> g_slist_free(device_list);
> }
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index fbba461..54b09a9 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -2632,7 +2632,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
> }
> if (pcms->acpi_nvdimm_state.is_enabled) {
> nvdimm_build_acpi(table_offsets, tables_blob, tables->linker,
> - pcms->acpi_nvdimm_state.dsm_mem);
> + &pcms->acpi_nvdimm_state);
> }
>
> /* Add tables supplied by user (if any) */
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index a07dc81..b624f59 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -298,7 +298,13 @@ static void pc_init1(MachineState *machine,
> }
>
> if (pcms->acpi_nvdimm_state.is_enabled) {
> - nvdimm_init_acpi_state(&pcms->acpi_nvdimm_state, system_io,
> + AcpiNVDIMMState *acpi_nvdimm_state = &pcms->acpi_nvdimm_state;
> +
> + acpi_nvdimm_state->dsm_io.type = NVDIMM_ACPI_IO_PORT;
> + acpi_nvdimm_state->dsm_io.base = NVDIMM_ACPI_IO_BASE;
> + acpi_nvdimm_state->dsm_io.size = NVDIMM_ACPI_IO_LEN;
> +
> + nvdimm_init_acpi_state(acpi_nvdimm_state, system_io,
> pcms->fw_cfg, OBJECT(pcms));
> }
> }
> diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> index c0b9961..779ac32 100644
> --- a/hw/i386/pc_q35.c
> +++ b/hw/i386/pc_q35.c
> @@ -263,7 +263,13 @@ static void pc_q35_init(MachineState *machine)
> }
>
> if (pcms->acpi_nvdimm_state.is_enabled) {
> - nvdimm_init_acpi_state(&pcms->acpi_nvdimm_state, system_io,
> + AcpiNVDIMMState *acpi_nvdimm_state = &pcms->acpi_nvdimm_state;
> +
> + acpi_nvdimm_state->dsm_io.type = NVDIMM_ACPI_IO_PORT;
> + acpi_nvdimm_state->dsm_io.base = NVDIMM_ACPI_IO_BASE;
> + acpi_nvdimm_state->dsm_io.size = NVDIMM_ACPI_IO_LEN;
> +
> + nvdimm_init_acpi_state(acpi_nvdimm_state, system_io,
> pcms->fw_cfg, OBJECT(pcms));
> }
> }
Ideally this would be a QOM object with QOM properties, rather
than an ad-hoc init function.
thanks
-- PMM
next prev parent reply other threads:[~2016-07-25 16:12 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-20 0:49 [Qemu-devel] [RFC PATCH 0/3] add nvdimm support on AArch64 virt platform Kwangwoo Lee
2016-07-20 0:49 ` [Qemu-devel] [RFC PATCH 1/3] hw/arm/virt: add hotplug memory support Kwangwoo Lee
2016-07-29 18:10 ` Peter Maydell
2016-08-01 0:35 ` kwangwoo.lee
2016-08-01 7:46 ` Igor Mammedov
2016-08-01 8:13 ` Peter Maydell
2016-08-01 9:14 ` Igor Mammedov
2016-08-02 5:54 ` kwangwoo.lee
2016-08-02 7:59 ` Peter Maydell
2016-08-02 12:18 ` Igor Mammedov
2016-08-04 23:30 ` kwangwoo.lee
2016-07-20 0:49 ` [Qemu-devel] [RFC PATCH 2/3] nvdimm: use configurable ACPI IO base and size Kwangwoo Lee
2016-07-25 16:12 ` Peter Maydell [this message]
2016-07-26 6:55 ` kwangwoo.lee
2016-07-20 0:49 ` [Qemu-devel] [RFC PATCH 3/3] hw/arm/virt: add nvdimm emulation support Kwangwoo Lee
2016-07-25 16:05 ` Peter Maydell
2016-07-26 7:03 ` kwangwoo.lee
2016-07-26 8:23 ` Peter Maydell
2016-07-27 2:23 ` kwangwoo.lee
2016-07-25 16:06 ` [Qemu-devel] [RFC PATCH 0/3] add nvdimm support on AArch64 virt platform Peter Maydell
2016-07-26 6:32 ` kwangwoo.lee
2016-07-29 18:11 ` Peter Maydell
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='CAFEAcA9Dce1qQS6QHjxYWMykX6wycusPQM3UDquifTr38oOd=Q@mail.gmail.com' \
--to=peter.maydell@linaro.org \
--cc=ehabkost@redhat.com \
--cc=guangrong.xiao@linux.intel.com \
--cc=hyunchul3.kim@sk.com \
--cc=imammedo@redhat.com \
--cc=kwangwoo.lee@sk.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=woosuk.chung@sk.com \
--cc=zhaoshenglong@huawei.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).