All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: Haozhong Zhang <haozhong.zhang@intel.com>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Eduardo Habkost <ehabkost@redhat.com>,
	qemu-devel@nongnu.org, linux-nvdimm <linux-nvdimm@lists.01.org>
Subject: [PATCH 2/3] nvdimm, acpi: add NFIT platform capabilities
Date: Fri, 27 Apr 2018 15:53:13 -0600	[thread overview]
Message-ID: <20180427215314.23168-2-ross.zwisler@linux.intel.com> (raw)
In-Reply-To: <20180427215314.23168-1-ross.zwisler@linux.intel.com>

Add support for the NFIT Platform Capabilities Structure, newly added in
ACPI 6.2 Errata A.

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
---
 hw/acpi/nvdimm.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c
index 59d6e4254c..859b390e07 100644
--- a/hw/acpi/nvdimm.c
+++ b/hw/acpi/nvdimm.c
@@ -169,6 +169,21 @@ struct NvdimmNfitControlRegion {
 } QEMU_PACKED;
 typedef struct NvdimmNfitControlRegion NvdimmNfitControlRegion;
 
+/*
+ * NVDIMM Platform Capabilities Structure
+ *
+ * Defined in section 5.2.25.9 of ACPI 6.2 Errata A, September 2017
+ */
+struct NvdimmNfitPlatformCaps {
+    uint16_t type;
+    uint16_t length;
+    uint8_t highest_cap;
+    uint8_t reserved[3];
+    uint32_t capabilities;
+    uint8_t reserved2[4];
+} QEMU_PACKED;
+typedef struct NvdimmNfitPlatformCaps NvdimmNfitPlatformCaps;
+
 /*
  * Module serial number is a unique number for each device. We use the
  * slot id of NVDIMM device to generate this number so that each device
@@ -351,6 +366,21 @@ static void nvdimm_build_structure_dcr(GArray *structures, DeviceState *dev)
                                          JEDEC Annex L Release 3. */);
 }
 
+/*
+ * ACPI 6.2 Errata A: 5.2.25.9 NVDIMM Platform Capabilities Structure
+ */
+static void
+nvdimm_build_structure_caps(GArray *structures)
+{
+    NvdimmNfitPlatformCaps *nfit_caps;
+
+    nfit_caps = acpi_data_push(structures, sizeof(*nfit_caps));
+
+    nfit_caps->type = cpu_to_le16(7 /* NVDIMM Platform Capabilities */);
+    nfit_caps->length = cpu_to_le16(sizeof(*nfit_caps));
+    nfit_caps->highest_cap = 1;
+    nfit_caps->capabilities = cpu_to_le32(2 /* memory controller */);
+}
 static GArray *nvdimm_build_device_structure(void)
 {
     GSList *device_list = nvdimm_get_device_list();
@@ -373,6 +403,8 @@ static GArray *nvdimm_build_device_structure(void)
     }
     g_slist_free(device_list);
 
+    nvdimm_build_structure_caps(structures);
+
     return structures;
 }
 
-- 
2.14.3

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

WARNING: multiple messages have this Message-ID (diff)
From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: Haozhong Zhang <haozhong.zhang@intel.com>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Eduardo Habkost <ehabkost@redhat.com>,
	qemu-devel@nongnu.org, linux-nvdimm <linux-nvdimm@lists.01.org>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Subject: [Qemu-devel] [PATCH 2/3] nvdimm, acpi: add NFIT platform capabilities
Date: Fri, 27 Apr 2018 15:53:13 -0600	[thread overview]
Message-ID: <20180427215314.23168-2-ross.zwisler@linux.intel.com> (raw)
In-Reply-To: <20180427215314.23168-1-ross.zwisler@linux.intel.com>

Add support for the NFIT Platform Capabilities Structure, newly added in
ACPI 6.2 Errata A.

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
---
 hw/acpi/nvdimm.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c
index 59d6e4254c..859b390e07 100644
--- a/hw/acpi/nvdimm.c
+++ b/hw/acpi/nvdimm.c
@@ -169,6 +169,21 @@ struct NvdimmNfitControlRegion {
 } QEMU_PACKED;
 typedef struct NvdimmNfitControlRegion NvdimmNfitControlRegion;
 
+/*
+ * NVDIMM Platform Capabilities Structure
+ *
+ * Defined in section 5.2.25.9 of ACPI 6.2 Errata A, September 2017
+ */
+struct NvdimmNfitPlatformCaps {
+    uint16_t type;
+    uint16_t length;
+    uint8_t highest_cap;
+    uint8_t reserved[3];
+    uint32_t capabilities;
+    uint8_t reserved2[4];
+} QEMU_PACKED;
+typedef struct NvdimmNfitPlatformCaps NvdimmNfitPlatformCaps;
+
 /*
  * Module serial number is a unique number for each device. We use the
  * slot id of NVDIMM device to generate this number so that each device
@@ -351,6 +366,21 @@ static void nvdimm_build_structure_dcr(GArray *structures, DeviceState *dev)
                                          JEDEC Annex L Release 3. */);
 }
 
+/*
+ * ACPI 6.2 Errata A: 5.2.25.9 NVDIMM Platform Capabilities Structure
+ */
+static void
+nvdimm_build_structure_caps(GArray *structures)
+{
+    NvdimmNfitPlatformCaps *nfit_caps;
+
+    nfit_caps = acpi_data_push(structures, sizeof(*nfit_caps));
+
+    nfit_caps->type = cpu_to_le16(7 /* NVDIMM Platform Capabilities */);
+    nfit_caps->length = cpu_to_le16(sizeof(*nfit_caps));
+    nfit_caps->highest_cap = 1;
+    nfit_caps->capabilities = cpu_to_le32(2 /* memory controller */);
+}
 static GArray *nvdimm_build_device_structure(void)
 {
     GSList *device_list = nvdimm_get_device_list();
@@ -373,6 +403,8 @@ static GArray *nvdimm_build_device_structure(void)
     }
     g_slist_free(device_list);
 
+    nvdimm_build_structure_caps(structures);
+
     return structures;
 }
 
-- 
2.14.3

  reply	other threads:[~2018-04-27 21:53 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-27 21:53 [PATCH 1/3] nvdimm: fix typo in label-size definition Ross Zwisler
2018-04-27 21:53 ` [Qemu-devel] " Ross Zwisler
2018-04-27 21:53 ` Ross Zwisler [this message]
2018-04-27 21:53   ` [Qemu-devel] [PATCH 2/3] nvdimm, acpi: add NFIT platform capabilities Ross Zwisler
2018-04-30 11:39   ` Stefan Hajnoczi
2018-04-30 11:39     ` [Qemu-devel] " Stefan Hajnoczi
2018-05-10 13:39   ` Igor Mammedov
2018-05-10 13:39     ` Igor Mammedov
2018-04-27 21:53 ` [PATCH 3/3] nvdimm: platform capabilities command line option Ross Zwisler
2018-04-27 21:53   ` [Qemu-devel] " Ross Zwisler
2018-04-30 11:39   ` Stefan Hajnoczi
2018-04-30 11:39     ` [Qemu-devel] " Stefan Hajnoczi
2018-05-10 13:28   ` Igor Mammedov
2018-05-10 13:28     ` Igor Mammedov
2018-05-15 23:03     ` Ross Zwisler
2018-05-15 23:03       ` Ross Zwisler
2018-05-16  7:22       ` Igor Mammedov
2018-05-16  7:22         ` Igor Mammedov
2018-04-30 11:38 ` [PATCH 1/3] nvdimm: fix typo in label-size definition Stefan Hajnoczi
2018-04-30 11:38   ` [Qemu-devel] " Stefan Hajnoczi
2018-05-03 22:20   ` Ross Zwisler
2018-05-03 22:20     ` [Qemu-devel] " Ross Zwisler
2018-05-04  8:44     ` Stefan Hajnoczi
2018-05-04  8:44       ` [Qemu-devel] " Stefan Hajnoczi
2018-05-10 13:06 ` Igor Mammedov
2018-05-10 13:06   ` 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=20180427215314.23168-2-ross.zwisler@linux.intel.com \
    --to=ross.zwisler@linux.intel.com \
    --cc=ehabkost@redhat.com \
    --cc=haozhong.zhang@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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 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.