All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Liu, Jingqi" <jingqi.liu@intel.com>
To: Igor Mammedov <imammedo@redhat.com>
Cc: "pbonzini@redhat.com" <pbonzini@redhat.com>,
	"rth@twiddle.net" <rth@twiddle.net>,
	"ehabkost@redhat.com" <ehabkost@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"mst@redhat.com" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v1 1/7] hmat acpi: Build Memory Subsystem Address Range Structre(s) in ACPI HMAT
Date: Wed, 16 May 2018 06:28:32 +0000	[thread overview]
Message-ID: <09D68D4CF52CAF489B702DEBDD12D3D3526A2004@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <20180515163549.2389fc70@redhat.com>

On Tue, May 15, 2018 10:36 PM, Igor Mammedov <imammedo@redhat.com> wrote:

> On Wed,  9 May 2018 16:34:29 +0800
> Liu Jingqi <jingqi.liu@intel.com> wrote:
> 
> > HMAT is defined in ACPI 6.2: 5.2.27 Heterogeneous Memory Attribute Table
> (HMAT).
> > The specification references below link:
> > http://www.uefi.org/sites/default/files/resources/ACPI_6_2.pdf
> >
> > It describes the memory attributes, such as memory side cache
> > attributes and bandwidth and latency details, related to the System
> > Physical Address (SPA) Memory Ranges. The software is expected to use
> > this information as hint for optimization.
> >
> > This structure describes the System Physical Address(SPA) range
> > occupied by memory subsystem and its associativity with processor
> > proximity domain as well as hint for memory usage.
> >
> > Signed-off-by: Liu Jingqi <jingqi.liu@intel.com>
> > ---
> >  default-configs/x86_64-softmmu.mak |   1 +
> >  hw/acpi/Makefile.objs              |   1 +
> >  hw/acpi/hmat.c                     | 174
> +++++++++++++++++++++++++++++++++++++
> >  hw/acpi/hmat.h                     |  75 ++++++++++++++++
> >  hw/i386/acpi-build.c               |   3 +
> >  5 files changed, 254 insertions(+)
> >  create mode 100644 hw/acpi/hmat.c
> >  create mode 100644 hw/acpi/hmat.h
> >
> > diff --git a/default-configs/x86_64-softmmu.mak
> > b/default-configs/x86_64-softmmu.mak
> > index 0390b43..3b4a37d 100644
> > --- a/default-configs/x86_64-softmmu.mak
> > +++ b/default-configs/x86_64-softmmu.mak
> > @@ -66,3 +66,4 @@ CONFIG_I2C=y
> >  CONFIG_SEV=$(CONFIG_KVM)
> >  CONFIG_VTD=y
> >  CONFIG_AMD_IOMMU=y
> > +CONFIG_ACPI_HMAT=y
> > diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs index
> > 11c35bc..21889fd 100644
> > --- a/hw/acpi/Makefile.objs
> > +++ b/hw/acpi/Makefile.objs
> > @@ -6,6 +6,7 @@ common-obj-$(CONFIG_ACPI_MEMORY_HOTPLUG) +=
> > memory_hotplug.o
> >  common-obj-$(CONFIG_ACPI_CPU_HOTPLUG) += cpu.o
> >  common-obj-$(CONFIG_ACPI_NVDIMM) += nvdimm.o
> >  common-obj-$(CONFIG_ACPI_VMGENID) += vmgenid.o
> > +common-obj-$(CONFIG_ACPI_HMAT) += hmat.o
> >  common-obj-$(call lnot,$(CONFIG_ACPI_X86)) += acpi-stub.o
> >
> >  common-obj-y += acpi_interface.o
> > diff --git a/hw/acpi/hmat.c b/hw/acpi/hmat.c new file mode 100644
> > index 0000000..bca1fbb
> > --- /dev/null
> > +++ b/hw/acpi/hmat.c
> > @@ -0,0 +1,174 @@
> > +/*
> > + * HMAT ACPI Implementation
> > + *
> > + * Copyright(C) 2018 Intel Corporation.
> > + *
> > + * Author:
> > + *  Liu jingqi <jingqi.liu@linux.intel.com>
> > + *
> > + * HMAT is defined in ACPI 6.2.
> > + *
> > + * This library is free software; you can redistribute it and/or
> > + * modify it under the terms of the GNU Lesser General Public
> > + * License as published by the Free Software Foundation; either
> > + * version 2 of the License, or (at your option) any later version.
> > + *
> > + * This library is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> > + * Lesser General Public License for more details.
> > + *
> > + * You should have received a copy of the GNU Lesser General Public
> > + * License along with this library; if not, see
> > +<http://www.gnu.org/licenses/>  */
> > +
> > +#include "unistd.h"
> > +#include "fcntl.h"
> > +#include "qemu/osdep.h"
> > +#include "sysemu/numa.h"
> > +#include "hw/i386/pc.h"
> > +#include "hw/acpi/acpi.h"
> > +#include "hw/acpi/hmat.h"
> > +#include "hw/acpi/aml-build.h"
> > +#include "hw/nvram/fw_cfg.h"
> > +#include "hw/acpi/bios-linker-loader.h"
> > +
> > +#define HOLE_640K_START  (640 * 1024)
> > +#define HOLE_640K_END    (1024 * 1024)
> > +
> > +uint32_t initiator_pxm[MAX_NODES], target_pxm[MAX_NODES]; uint32_t
> > +num_initiator = 0, num_target = 0;
> > +
> > +static void hmat_build_spa_info(AcpiHmatSpaRange *spa,
> > +                                uint64_t base, uint64_t length, int
> > +node) {
> > +    int i;
> > +
> > +    spa->type       = ACPI_HMAT_SPA;
> > +    spa->length     = sizeof(*spa);
> > +    spa->spa_base   = base;
> > +    spa->spa_length = length;
> all of above will break on big-endian host, that's one of the reasons we prefer
> new code/tables to use build_append_foo() API.
> 
> Pls rewrite it using preferred build_append_int_noprefix() API,
> build_amd_iommu() can serve as an example.
> 
> As comments above fields use exact field names from spec tables so one could
> easily match spec vs code.
> 
Thanks for your reviewing.
I will use preferred build_append_int_noprefix() API in next version.
Jingqi Liu

  reply	other threads:[~2018-05-16  6:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-09  8:34 [Qemu-devel] [PATCH v1 1/7] hmat acpi: Build Memory Subsystem Address Range Structre(s) in ACPI HMAT Liu Jingqi
2018-05-09 13:13 ` Eric Blake
2018-05-10  3:05   ` Liu, Jingqi
2018-05-11 14:40 ` Eduardo Habkost
2018-05-14  5:55   ` Liu, Jingqi
2018-05-15 14:35 ` Igor Mammedov
2018-05-16  6:28   ` Liu, Jingqi [this message]
2018-05-15 14:41 ` Igor Mammedov

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=09D68D4CF52CAF489B702DEBDD12D3D3526A2004@SHSMSX103.ccr.corp.intel.com \
    --to=jingqi.liu@intel.com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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.