From: Boaz Harrosh <boaz@plexistor.com>
To: Ingo Molnar <mingo@redhat.com>,
Ross Zwisler <ross.zwisler@linux.intel.com>,
x86@kernel.org, linux-kernel <linux-kernel@vger.kernel.org>,
"Roger C. Pao" <rcpao.enmotus@gmail.com>,
Dan Williams <dan.j.williams@intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
Linus Torvalds <torvalds@linux-foundation.org>,
linux-nvdimm <linux-nvdimm@lists.01.org>,
"H. Peter Anvin" <hpa@zytor.com>,
Matthew Wilcox <willy@linux.intel.com>,
Andy Lutomirski <luto@amacapital.net>,
Christoph Hellwig <hch@infradead.org>
Subject: [PATCH 3B/3 fat] e820: dynamic unknown-xxx names (for DDR3-NvDIMM)
Date: Mon, 23 Feb 2015 14:48:31 +0200 [thread overview]
Message-ID: <54EB219F.5050706@plexistor.com> (raw)
In-Reply-To: <54EB1D33.3050107@plexistor.com>
There are multiple vendors of DDR3 NvDIMMs out in the market today.
At various stages of development/production. It is estimated that
there are already more the 100ds of thousands chips sold to
testers and sites.
All the BIOS vendors I know of, tagged these chips at e820 table
as type-12 memory.
Now the ACPI comity, as far as I know, did not yet define a
standard type for NvDIMM. Also, as far as I know any NvDIMM
standard will only be defined for DDR4. So DDR3 NvDIMM is
probably stuck with this none STD type.
I Wish and call the ACPI comity to Define that NvDIMM is type-12.
Also for DDR4
In this patch I dynamically sprintf names into a static buffer
(max two unknown names) of the form "unknown-XXX" where XXX
is the type number. This is so we can return static string to
caller.
If there are too many types or type is bigger than 999 we
name the unknown region as "unknown-xxx"
I hope this patch is not accepted and that the simple patch
that just names above as "unknown-12" is. KISS right?
Signed-off-by: Boaz Harrosh <boaz@plexistor.com>
---
arch/x86/include/uapi/asm/e820.h | 1 -
arch/x86/kernel/e820.c | 29 ++++++++++++++++++++++++++++-
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/uapi/asm/e820.h b/arch/x86/include/uapi/asm/e820.h
index d993e33..1f11303 100644
--- a/arch/x86/include/uapi/asm/e820.h
+++ b/arch/x86/include/uapi/asm/e820.h
@@ -33,7 +33,6 @@
#define E820_NVS 4
#define E820_UNUSABLE 5
-
/*
* reserved RAM used by kernel itself
* if CONFIG_INTEL_TXT is enabled, memory of this type will be
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 18a9850..3e06bab 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -919,6 +919,33 @@ void __init finish_e820_parsing(void)
}
}
+static const char *_unknown_name(uint e820_type)
+{
+ enum {
+ MAX_UNKNOWN_TYPES = 1,
+ UNKNOWN_NAME_SIZE = 16, /* unknown-xxx\0 */
+ };
+ static struct __unknown_name__ {
+ int type;
+ char name[UNKNOWN_NAME_SIZE];
+ } names[MAX_UNKNOWN_TYPES];
+ static int num_names;
+
+ int i;
+
+ for (i = 0; i < num_names; ++i)
+ if (e820_type == names[i].type)
+ return names[i].name;
+
+ if ((num_names == MAX_UNKNOWN_TYPES) || (e820_type > 999))
+ return "unknown-xxx";
+
+ snprintf(names[++num_names].name, UNKNOWN_NAME_SIZE,
+ "unknown-%03d", e820_type);
+ names[num_names].type = e820_type;
+ return names[num_names].name;
+}
+
static inline const char *e820_type_to_string(int e820_type)
{
switch (e820_type) {
@@ -928,7 +955,7 @@ static inline const char *e820_type_to_string(int e820_type)
case E820_NVS: return "ACPI Non-volatile Storage";
case E820_UNUSABLE: return "Unusable memory";
case E820_RESERVED: return "reserved";
- default: return "reserved-unkown";
+ default: return _unknown_name(e820_type);
}
}
--
1.9.3
WARNING: multiple messages have this Message-ID (diff)
From: Boaz Harrosh <boaz@plexistor.com>
To: Ingo Molnar <mingo@redhat.com>,
Ross Zwisler <ross.zwisler@linux.intel.com>,
x86@kernel.org, linux-kernel <linux-kernel@vger.kernel.org>,
"Roger C. Pao" <rcpao.enmotus@gmail.com>,
Dan Williams <dan.j.williams@intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
Linus Torvalds <torvalds@linux-foundation.org>,
linux-nvdimm <linux-nvdimm@ml01.01.org>,
"H. Peter Anvin" <hpa@zytor.com>,
Matthew Wilcox <willy@linux.intel.com>,
Andy Lutomirski <luto@amacapital.net>,
Christoph Hellwig <hch@infradead.org>
Subject: [PATCH 3B/3 fat] e820: dynamic unknown-xxx names (for DDR3-NvDIMM)
Date: Mon, 23 Feb 2015 14:48:31 +0200 [thread overview]
Message-ID: <54EB219F.5050706@plexistor.com> (raw)
In-Reply-To: <54EB1D33.3050107@plexistor.com>
There are multiple vendors of DDR3 NvDIMMs out in the market today.
At various stages of development/production. It is estimated that
there are already more the 100ds of thousands chips sold to
testers and sites.
All the BIOS vendors I know of, tagged these chips at e820 table
as type-12 memory.
Now the ACPI comity, as far as I know, did not yet define a
standard type for NvDIMM. Also, as far as I know any NvDIMM
standard will only be defined for DDR4. So DDR3 NvDIMM is
probably stuck with this none STD type.
I Wish and call the ACPI comity to Define that NvDIMM is type-12.
Also for DDR4
In this patch I dynamically sprintf names into a static buffer
(max two unknown names) of the form "unknown-XXX" where XXX
is the type number. This is so we can return static string to
caller.
If there are too many types or type is bigger than 999 we
name the unknown region as "unknown-xxx"
I hope this patch is not accepted and that the simple patch
that just names above as "unknown-12" is. KISS right?
Signed-off-by: Boaz Harrosh <boaz@plexistor.com>
---
arch/x86/include/uapi/asm/e820.h | 1 -
arch/x86/kernel/e820.c | 29 ++++++++++++++++++++++++++++-
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/uapi/asm/e820.h b/arch/x86/include/uapi/asm/e820.h
index d993e33..1f11303 100644
--- a/arch/x86/include/uapi/asm/e820.h
+++ b/arch/x86/include/uapi/asm/e820.h
@@ -33,7 +33,6 @@
#define E820_NVS 4
#define E820_UNUSABLE 5
-
/*
* reserved RAM used by kernel itself
* if CONFIG_INTEL_TXT is enabled, memory of this type will be
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 18a9850..3e06bab 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -919,6 +919,33 @@ void __init finish_e820_parsing(void)
}
}
+static const char *_unknown_name(uint e820_type)
+{
+ enum {
+ MAX_UNKNOWN_TYPES = 1,
+ UNKNOWN_NAME_SIZE = 16, /* unknown-xxx\0 */
+ };
+ static struct __unknown_name__ {
+ int type;
+ char name[UNKNOWN_NAME_SIZE];
+ } names[MAX_UNKNOWN_TYPES];
+ static int num_names;
+
+ int i;
+
+ for (i = 0; i < num_names; ++i)
+ if (e820_type == names[i].type)
+ return names[i].name;
+
+ if ((num_names == MAX_UNKNOWN_TYPES) || (e820_type > 999))
+ return "unknown-xxx";
+
+ snprintf(names[++num_names].name, UNKNOWN_NAME_SIZE,
+ "unknown-%03d", e820_type);
+ names[num_names].type = e820_type;
+ return names[num_names].name;
+}
+
static inline const char *e820_type_to_string(int e820_type)
{
switch (e820_type) {
@@ -928,7 +955,7 @@ static inline const char *e820_type_to_string(int e820_type)
case E820_NVS: return "ACPI Non-volatile Storage";
case E820_UNUSABLE: return "Unusable memory";
case E820_RESERVED: return "reserved";
- default: return "reserved-unkown";
+ default: return _unknown_name(e820_type);
}
}
--
1.9.3
next prev parent reply other threads:[~2015-02-23 12:48 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-23 12:29 [PATCH 0/3 v2] e820: Fix handling of NvDIMM chips Boaz Harrosh
2015-02-23 12:29 ` Boaz Harrosh
2015-02-23 12:33 ` [PATCH 1/3] e820: Don't let unknown DIMM type come out BUSY Boaz Harrosh
2015-02-23 12:33 ` Boaz Harrosh
2015-02-24 4:22 ` Dan Williams
2015-02-24 4:22 ` Dan Williams
2015-02-24 7:59 ` Boaz Harrosh
2015-02-24 7:59 ` Boaz Harrosh
2015-02-24 8:34 ` Ingo Molnar
2015-02-24 8:34 ` Ingo Molnar
2015-02-24 8:51 ` Boaz Harrosh
2015-02-24 8:51 ` Boaz Harrosh
2015-02-26 2:09 ` Dan Williams
2015-02-26 2:09 ` Dan Williams
2015-02-23 12:43 ` [PATCH 2/3] resource: Add new flag IORESOURCE_WARN (64bit) Boaz Harrosh
2015-02-23 12:43 ` Boaz Harrosh
2015-02-23 15:46 ` Andy Lutomirski
2015-02-23 15:46 ` Andy Lutomirski
2015-02-24 7:20 ` Boaz Harrosh
2015-02-24 7:20 ` Boaz Harrosh
2015-02-24 19:58 ` Andy Lutomirski
2015-02-24 19:58 ` Andy Lutomirski
2015-02-24 8:39 ` [PATCH 2/3 v3] resource: Add new flag IORESOURCE_MEM_WARN Boaz Harrosh
2015-02-24 8:39 ` Boaz Harrosh
2015-02-24 8:44 ` Boaz Harrosh
2015-02-24 8:44 ` Boaz Harrosh
2015-02-24 9:06 ` Ingo Molnar
2015-02-24 9:06 ` Ingo Molnar
2015-02-24 9:08 ` Boaz Harrosh
2015-02-24 9:08 ` Boaz Harrosh
2015-02-24 9:07 ` Ingo Molnar
2015-02-24 9:07 ` Ingo Molnar
2015-02-24 9:09 ` Boaz Harrosh
2015-02-24 9:09 ` Boaz Harrosh
2015-02-24 15:00 ` [PATCH 2/3 v4] " Boaz Harrosh
2015-02-24 15:00 ` Boaz Harrosh
2015-02-24 17:04 ` Dan Williams
2015-02-24 17:04 ` Dan Williams
2015-02-25 6:36 ` Boaz Harrosh
2015-02-25 6:36 ` Boaz Harrosh
2015-02-23 12:46 ` [PATCH 3A/3 good] e820: Add the unknown-12 Memory type (DDR3-NvDIMM) Boaz Harrosh
2015-02-23 12:46 ` Boaz Harrosh
2015-02-23 15:48 ` Andy Lutomirski
2015-02-23 15:48 ` Andy Lutomirski
2015-02-23 12:48 ` Boaz Harrosh [this message]
2015-02-23 12:48 ` [PATCH 3B/3 fat] e820: dynamic unknown-xxx names (for DDR3-NvDIMM) Boaz Harrosh
2015-02-23 15:49 ` Andy Lutomirski
2015-02-23 15:49 ` Andy Lutomirski
2015-02-24 7:38 ` Boaz Harrosh
2015-02-24 7:38 ` Boaz Harrosh
2015-02-25 10:22 ` [PATCH 0/3 v2] e820: Fix handling of NvDIMM chips Ingo Molnar
2015-02-25 10:22 ` Ingo Molnar
2015-02-25 14:42 ` Boaz Harrosh
2015-02-25 14:42 ` Boaz Harrosh
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=54EB219F.5050706@plexistor.com \
--to=boaz@plexistor.com \
--cc=dan.j.williams@intel.com \
--cc=hch@infradead.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvdimm@lists.01.org \
--cc=luto@amacapital.net \
--cc=mingo@redhat.com \
--cc=rcpao.enmotus@gmail.com \
--cc=ross.zwisler@linux.intel.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=willy@linux.intel.com \
--cc=x86@kernel.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.