remove cache parts of struct cpu_info only vmm used
authorjsg <jsg@openbsd.org>
Tue, 12 Jul 2022 04:46:00 +0000 (04:46 +0000)
committerjsg <jsg@openbsd.org>
Tue, 12 Jul 2022 04:46:00 +0000 (04:46 +0000)
suggested by and ok mlarkin@

sys/arch/amd64/amd64/cacheinfo.c
sys/arch/amd64/amd64/identcpu.c
sys/arch/amd64/amd64/vmm.c
sys/arch/amd64/include/cpu.h

index 0fde195..6996d6f 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: cacheinfo.c,v 1.10 2022/06/28 12:11:41 jsg Exp $      */
+/*     $OpenBSD: cacheinfo.c,v 1.11 2022/07/12 04:46:00 jsg Exp $      */
 
 /*
  * Copyright (c) 2022 Jonathan Gray <jsg@openbsd.org>
 #include <machine/cpu.h>
 #include <machine/specialreg.h>
 
-void
-amd_cpu_cacheinfo(struct cpu_info *ci)
-{
-       u_int eax, ebx, ecx, edx;
-
-       /* used by vmm */
-
-       if (ci->ci_pnfeatset >= 0x80000005) {
-               CPUID(0x80000005, eax, ebx, ecx, edx);
-               ci->ci_amdcacheinfo[0] = eax;
-               ci->ci_amdcacheinfo[1] = ebx;
-               ci->ci_amdcacheinfo[2] = ecx;
-               ci->ci_amdcacheinfo[3] = edx;
-       }
-
-       if (ci->ci_pnfeatset >= 0x80000006) {
-               CPUID(0x80000006, eax, ebx, ecx, edx);
-               ci->ci_extcacheinfo[0] = eax;
-               ci->ci_extcacheinfo[1] = ebx;
-               ci->ci_extcacheinfo[2] = ecx;
-               ci->ci_extcacheinfo[3] = edx;
-       }
-}
-
 void
 amd64_print_l1_cacheinfo(struct cpu_info *ci)
 {
index 158f4c4..e633f93 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: identcpu.c,v 1.124 2022/04/26 10:48:20 claudio Exp $  */
+/*     $OpenBSD: identcpu.c,v 1.125 2022/07/12 04:46:00 jsg Exp $      */
 /*     $NetBSD: identcpu.c,v 1.1 2003/04/26 18:39:28 fvdl Exp $        */
 
 /*
@@ -605,8 +605,6 @@ identifycpu(struct cpu_info *ci)
 
        freq = cpu_freq(ci);
 
-       amd_cpu_cacheinfo(ci);
-
        printf("%s: %s", ci->ci_dev->dv_xname, mycpu_model);
 
        if (freq != 0)
index f790f5a..e813d06 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: vmm.c,v 1.316 2022/06/30 13:17:58 dv Exp $    */
+/*     $OpenBSD: vmm.c,v 1.317 2022/07/12 04:46:00 jsg Exp $   */
 /*
  * Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
  *
@@ -7229,16 +7229,16 @@ vmm_handle_cpuid(struct vcpu *vcpu)
                *rdx = curcpu()->ci_brand[11];
                break;
        case 0x80000005:        /* Reserved (Intel), cacheinfo (AMD) */
-               *rax = curcpu()->ci_amdcacheinfo[0];
-               *rbx = curcpu()->ci_amdcacheinfo[1];
-               *rcx = curcpu()->ci_amdcacheinfo[2];
-               *rdx = curcpu()->ci_amdcacheinfo[3];
+               *rax = eax;
+               *rbx = ebx;
+               *rcx = ecx;
+               *rdx = edx;
                break;
        case 0x80000006:        /* ext. cache info */
-               *rax = curcpu()->ci_extcacheinfo[0];
-               *rbx = curcpu()->ci_extcacheinfo[1];
-               *rcx = curcpu()->ci_extcacheinfo[2];
-               *rdx = curcpu()->ci_extcacheinfo[3];
+               *rax = eax;
+               *rbx = ebx;
+               *rcx = ecx;
+               *rdx = edx;
                break;
        case 0x80000007:        /* apmi */
                *rax = eax;
index e4e9b98..6916915 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: cpu.h,v 1.144 2022/06/28 12:11:41 jsg Exp $   */
+/*     $OpenBSD: cpu.h,v 1.145 2022/07/12 04:46:00 jsg Exp $   */
 /*     $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $     */
 
 /*-
@@ -150,8 +150,6 @@ struct cpu_info {
        u_int32_t       ci_efeature_eax;
        u_int32_t       ci_efeature_ecx;
        u_int32_t       ci_brand[12];
-       u_int32_t       ci_amdcacheinfo[4];
-       u_int32_t       ci_extcacheinfo[4];
        u_int32_t       ci_signature;
        u_int32_t       ci_family;
        u_int32_t       ci_model;
@@ -387,7 +385,6 @@ extern u_int cpu_mwait_size;
 extern u_int cpu_mwait_states;
 
 /* cacheinfo.c */
-void   amd_cpu_cacheinfo(struct cpu_info *);
 void   x86_print_cacheinfo(struct cpu_info *);
 
 /* identcpu.c */