From: Babu Moger <babu.moger@amd.com>
To: pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com,
rkrcmar@redhat.com
Cc: mtosatti@redhat.com, qemu-devel@nongnu.org, kvm@vger.kernel.org,
Gary.Hook@amd.com, Thomas.Lendacky@amd.com, babu.moger@amd.com
Subject: [Qemu-devel] [PATCH v3 1/5] target/i386: Generalize some of the macro definitions
Date: Mon, 5 Mar 2018 15:18:23 -0500 [thread overview]
Message-ID: <1520281107-5115-2-git-send-email-babu.moger@amd.com> (raw)
In-Reply-To: <1520281107-5115-1-git-send-email-babu.moger@amd.com>
Generalize some of the macro definitions which are generic cache
properties that are common between CPUID 4 and CPUID 0x8000001D
in preparation for adding support for 0x8000001D.
Signed-off-by: Babu Moger <babu.moger@amd.com>
---
target/i386/cpu.c | 52 ++++++++++++++++++++++++++--------------------------
1 file changed, 26 insertions(+), 26 deletions(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index b5e431e..42dd381 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -66,22 +66,22 @@
#define CPUID_2_L3_16MB_16WAY_64B 0x4d
-/* CPUID Leaf 4 constants: */
+/* Cache specific constants: */
/* EAX: */
-#define CPUID_4_TYPE_DCACHE 1
-#define CPUID_4_TYPE_ICACHE 2
-#define CPUID_4_TYPE_UNIFIED 3
+#define TYPE_DCACHE 1
+#define TYPE_ICACHE 2
+#define TYPE_UNIFIED 3
-#define CPUID_4_LEVEL(l) ((l) << 5)
+#define CACHE_LEVEL(l) ((l) << 5)
-#define CPUID_4_SELF_INIT_LEVEL (1 << 8)
-#define CPUID_4_FULLY_ASSOC (1 << 9)
+#define CACHE_SELF_INIT_LEVEL (1 << 8)
+#define CACHE_FULLY_ASSOC (1 << 9)
/* EDX: */
-#define CPUID_4_NO_INVD_SHARING (1 << 0)
-#define CPUID_4_INCLUSIVE (1 << 1)
-#define CPUID_4_COMPLEX_IDX (1 << 2)
+#define CACHE_NO_INVD_SHARING (1 << 0)
+#define CACHE_INCLUSIVE (1 << 1)
+#define CACHE_COMPLEX_IDX (1 << 2)
#define ASSOC_FULL 0xFF
@@ -3273,29 +3273,29 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
*eax = 0;
switch (count) {
case 0: /* L1 dcache info */
- *eax |= CPUID_4_TYPE_DCACHE | \
- CPUID_4_LEVEL(1) | \
- CPUID_4_SELF_INIT_LEVEL;
+ *eax |= TYPE_DCACHE | \
+ CACHE_LEVEL(1) | \
+ CACHE_SELF_INIT_LEVEL;
*ebx = (L1D_LINE_SIZE - 1) | \
((L1D_PARTITIONS - 1) << 12) | \
((L1D_ASSOCIATIVITY - 1) << 22);
*ecx = L1D_SETS - 1;
- *edx = CPUID_4_NO_INVD_SHARING;
+ *edx = CACHE_NO_INVD_SHARING;
break;
case 1: /* L1 icache info */
- *eax |= CPUID_4_TYPE_ICACHE | \
- CPUID_4_LEVEL(1) | \
- CPUID_4_SELF_INIT_LEVEL;
+ *eax |= TYPE_ICACHE | \
+ CACHE_LEVEL(1) | \
+ CACHE_SELF_INIT_LEVEL;
*ebx = (L1I_LINE_SIZE - 1) | \
((L1I_PARTITIONS - 1) << 12) | \
((L1I_ASSOCIATIVITY - 1) << 22);
*ecx = L1I_SETS - 1;
- *edx = CPUID_4_NO_INVD_SHARING;
+ *edx = CACHE_NO_INVD_SHARING;
break;
case 2: /* L2 cache info */
- *eax |= CPUID_4_TYPE_UNIFIED | \
- CPUID_4_LEVEL(2) | \
- CPUID_4_SELF_INIT_LEVEL;
+ *eax |= TYPE_UNIFIED | \
+ CACHE_LEVEL(2) | \
+ CACHE_SELF_INIT_LEVEL;
if (cs->nr_threads > 1) {
*eax |= (cs->nr_threads - 1) << 14;
}
@@ -3303,7 +3303,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
((L2_PARTITIONS - 1) << 12) | \
((L2_ASSOCIATIVITY - 1) << 22);
*ecx = L2_SETS - 1;
- *edx = CPUID_4_NO_INVD_SHARING;
+ *edx = CACHE_NO_INVD_SHARING;
break;
case 3: /* L3 cache info */
if (!cpu->enable_l3_cache) {
@@ -3313,16 +3313,16 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
*edx = 0;
break;
}
- *eax |= CPUID_4_TYPE_UNIFIED | \
- CPUID_4_LEVEL(3) | \
- CPUID_4_SELF_INIT_LEVEL;
+ *eax |= TYPE_UNIFIED | \
+ CACHE_LEVEL(3) | \
+ CACHE_SELF_INIT_LEVEL;
pkg_offset = apicid_pkg_offset(cs->nr_cores, cs->nr_threads);
*eax |= ((1 << pkg_offset) - 1) << 14;
*ebx = (L3_N_LINE_SIZE - 1) | \
((L3_N_PARTITIONS - 1) << 12) | \
((L3_N_ASSOCIATIVITY - 1) << 22);
*ecx = L3_N_SETS - 1;
- *edx = CPUID_4_INCLUSIVE | CPUID_4_COMPLEX_IDX;
+ *edx = CACHE_INCLUSIVE | CACHE_COMPLEX_IDX;
break;
default: /* end of info */
*eax = 0;
--
1.8.3.1
next prev parent reply other threads:[~2018-03-05 20:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-05 20:18 [Qemu-devel] [PATCH v3 0/5] Enable TOPOEXT to support hyperthreading on AMD CPU Babu Moger
2018-03-05 20:18 ` Babu Moger [this message]
2018-03-05 20:18 ` [Qemu-devel] [PATCH v3 2/5] target/i386: Populate AMD Processor Cache Information Babu Moger
2018-03-05 20:18 ` [Qemu-devel] [PATCH v3 3/5] target/i386: Add support for CPUID_8000_001E for AMD Babu Moger
2018-03-05 20:18 ` [Qemu-devel] [PATCH v3 4/5] target/i386: Enable TOPOEXT feature on AMD EPYC CPU Babu Moger
2018-03-05 20:18 ` [Qemu-devel] [PATCH v3 5/5] target/i386: Remove generic SMT thread check Babu Moger
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=1520281107-5115-2-git-send-email-babu.moger@amd.com \
--to=babu.moger@amd.com \
--cc=Gary.Hook@amd.com \
--cc=Thomas.Lendacky@amd.com \
--cc=ehabkost@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rkrcmar@redhat.com \
--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 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).