tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: amd64: svs
On 2018/01/15 18:12, Emmanuel Dreyfus wrote:
On Mon, Jan 15, 2018 at 05:34:18PM +0900, Masanobu SAITOH wrote:
cpu0: MSR_IA32_ARCH_CAPABILITIES=0x1
I've not written this bit by myself.
Where can this be readen without your patch?
In cpu_ucode_intel.c::cpu_ucode_intel_apply().
-----------------
cvs diff: Diffing .
Index: cpu_ucode_intel.c
===================================================================
RCS file: /cvsroot/src/sys/arch/x86/x86/cpu_ucode_intel.c,v
retrieving revision 1.12
diff -u -p -r1.12 cpu_ucode_intel.c
--- cpu_ucode_intel.c 1 Jun 2017 02:45:08 -0000 1.12
+++ cpu_ucode_intel.c 15 Jan 2018 09:31:34 -0000
@@ -110,8 +110,13 @@ cpu_ucode_intel_apply(struct cpu_ucode_s
uint32_t ucodetarget, oucodeversion, nucodeversion;
int platformid, cpuid;
struct intel1_ucode_header *uh;
+ struct cpu_info *ci;
+ struct cpu_info oldci;
+ int i;
void *uha;
size_t newbufsize = 0;
+ uint64_t msr = 0;
+ u_int descs[4];
int rv = 0;
if (sc->loader_version != CPU_UCODE_LOADER_INTEL1
@@ -144,15 +149,37 @@ cpu_ucode_intel_apply(struct cpu_ucode_s
intel_getcurrentucode(&nucodeversion, &platformid);
cpuid = curcpu()->ci_index;
- kpreempt_enable();
-
if (nucodeversion != ucodetarget) {
+ kpreempt_enable();
rv = EIO;
goto out;
}
+ ci = curcpu();
+ oldci = *ci;
+#if 0
+ /* Update cpu_info */
+ cpu_probe(curcpu());
+#endif
+ if (ci->ci_max_cpuid >= 7) {
+ x86_cpuid(7, descs);
+ if (descs[3] & CPUID_SEF_ARCH_CAP)
+ msr = rdmsr(MSR_IA32_ARCH_CAPABILITIES);
+ }
+ kpreempt_enable();
+
+ if ((ci->ci_max_cpuid >= 7) && (descs[3] & CPUID_SEF_ARCH_CAP))
+ printf("cpu%d: MSR_IA32_ARCH_CAPABILITIES=0x%lx\n", cpuid,
+ msr);
printf("cpu %d: ucode 0x%x->0x%x\n", cpuid,
oucodeversion, nucodeversion);
+ for (i = 0; i < __arraycount(ci->ci_feat_val); i++) {
+ if (oldci.ci_feat_val[i] != ci->ci_feat_val[i])
+ printf("cpu%d: cpu_feature[%d] changed from "
+ "%08x to %08x\n", cpuid, i, oldci.ci_feat_val[i],
+ ci->ci_feat_val[i]);
+ }
+
out:
if (newbufsize != 0)
kmem_free(uha, newbufsize);
-----------------
--
-----------------------------------------------
SAITOH Masanobu (msaitoh%execsw.org@localhost
msaitoh%netbsd.org@localhost)
Home |
Main Index |
Thread Index |
Old Index