26ba25
From 15a2a3aa1c4eb2c3abac569a120714425b64864d Mon Sep 17 00:00:00 2001
26ba25
From: Eduardo Habkost <ehabkost@redhat.com>
26ba25
Date: Thu, 26 Jul 2018 17:18:56 +0100
26ba25
Subject: [PATCH 06/14] i386: Initialize cache information for EPYC family
26ba25
 processors
26ba25
26ba25
RH-Author: Eduardo Habkost <ehabkost@redhat.com>
26ba25
Message-id: <20180726171904.27418-4-ehabkost@redhat.com>
26ba25
Patchwork-id: 81527
26ba25
O-Subject: [qemu-kvm RHEL8/virt212 PATCH v2 03/11] i386: Initialize cache information for EPYC family processors
26ba25
Bugzilla: 1597739
26ba25
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
26ba25
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
26ba25
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
26ba25
26ba25
From: Babu Moger <babu.moger@amd.com>
26ba25
26ba25
Initialize pre-determined cache information for EPYC processors.
26ba25
26ba25
Signed-off-by: Babu Moger <babu.moger@amd.com>
26ba25
Tested-by: Geoffrey McRae <geoff@hostfission.com>
26ba25
Message-Id: <20180510204148.11687-5-babu.moger@amd.com>
26ba25
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
26ba25
(cherry picked from commit fe52acd2a054b97765963a42037f2f886545e30c)
26ba25
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
26ba25
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
26ba25
---
26ba25
 target/i386/cpu.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
26ba25
 1 file changed, 52 insertions(+)
26ba25
26ba25
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
26ba25
index 50af741..bd0abc2 100644
26ba25
--- a/target/i386/cpu.c
26ba25
+++ b/target/i386/cpu.c
26ba25
@@ -1108,6 +1108,56 @@ struct X86CPUDefinition {
26ba25
     CPUCaches *cache_info;
26ba25
 };
26ba25
 
26ba25
+static CPUCaches epyc_cache_info = {
26ba25
+    .l1d_cache = {
26ba25
+        .type = DCACHE,
26ba25
+        .level = 1,
26ba25
+        .size = 32 * KiB,
26ba25
+        .line_size = 64,
26ba25
+        .associativity = 8,
26ba25
+        .partitions = 1,
26ba25
+        .sets = 64,
26ba25
+        .lines_per_tag = 1,
26ba25
+        .self_init = 1,
26ba25
+        .no_invd_sharing = true,
26ba25
+    },
26ba25
+    .l1i_cache = {
26ba25
+        .type = ICACHE,
26ba25
+        .level = 1,
26ba25
+        .size = 64 * KiB,
26ba25
+        .line_size = 64,
26ba25
+        .associativity = 4,
26ba25
+        .partitions = 1,
26ba25
+        .sets = 256,
26ba25
+        .lines_per_tag = 1,
26ba25
+        .self_init = 1,
26ba25
+        .no_invd_sharing = true,
26ba25
+    },
26ba25
+    .l2_cache = {
26ba25
+        .type = UNIFIED_CACHE,
26ba25
+        .level = 2,
26ba25
+        .size = 512 * KiB,
26ba25
+        .line_size = 64,
26ba25
+        .associativity = 8,
26ba25
+        .partitions = 1,
26ba25
+        .sets = 1024,
26ba25
+        .lines_per_tag = 1,
26ba25
+    },
26ba25
+    .l3_cache = {
26ba25
+        .type = UNIFIED_CACHE,
26ba25
+        .level = 3,
26ba25
+        .size = 8 * MiB,
26ba25
+        .line_size = 64,
26ba25
+        .associativity = 16,
26ba25
+        .partitions = 1,
26ba25
+        .sets = 8192,
26ba25
+        .lines_per_tag = 1,
26ba25
+        .self_init = true,
26ba25
+        .inclusive = true,
26ba25
+        .complex_indexing = true,
26ba25
+    },
26ba25
+};
26ba25
+
26ba25
 static X86CPUDefinition builtin_x86_defs[] = {
26ba25
     {
26ba25
         /* qemu64 is the default CPU model for all *-rhel7.* machine-types.
26ba25
@@ -2327,6 +2377,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
26ba25
             CPUID_6_EAX_ARAT,
26ba25
         .xlevel = 0x8000000A,
26ba25
         .model_id = "AMD EPYC Processor",
26ba25
+        .cache_info = &epyc_cache_info,
26ba25
     },
26ba25
     {
26ba25
         .name = "EPYC-IBPB",
26ba25
@@ -2373,6 +2424,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
26ba25
             CPUID_6_EAX_ARAT,
26ba25
         .xlevel = 0x8000000A,
26ba25
         .model_id = "AMD EPYC Processor (with IBPB)",
26ba25
+        .cache_info = &epyc_cache_info,
26ba25
     },
26ba25
 };
26ba25
 
26ba25
-- 
26ba25
1.8.3.1
26ba25