Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Commit be1bd3d

Browse files
committed
Fix msr GPF for cpu signature 0x000306a0
This is on an x230 laptop with coreboot. This allows it to boot. Signed-off-by: Ronald G Minnich <rminnich@gmail.com>
1 parent de7dc06 commit be1bd3d

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

sys/src/9/amd64/archamd64.c

+11-3
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ cpuidhz_hypervisor()
119119
static int64_t
120120
cpuidhz(uint32_t *info0, uint32_t *info1, CpuHypervisor hypervisor)
121121
{
122-
int f, r;
122+
int f = -1, r;
123123
int64_t hz;
124124
uint64_t msr;
125125
char *vendorid;
@@ -191,6 +191,14 @@ cpuidhz(uint32_t *info0, uint32_t *info1, CpuHypervisor hypervisor)
191191
hz = ((rdmsr(0x2a)>>22) & 0x1f)*100 * 1000000ll;
192192
//print("msr 2a is 0x%x >> 22 0x%x\n", rdmsr(0x2a), rdmsr(0x2a)>>22);
193193
break;
194+
case 0x000306a0: /* i7,5,3 3xxx */
195+
// reading msr 0xcd gets a GPF on this CPU.
196+
// per the coreboot irc:
197+
// <icon[m]> rminnich: if you need the base for the core's clock multiplier, it's 100MHz since sandybridge
198+
// Which, going by the Good Book (35-46 volume 3C) is index 5.
199+
f = 5;
200+
// This will likely be true of many of the CPUs below. FSB did a *long* time ago.
201+
// fallthrough
194202
case 0x000006e0: /* Core Duo */
195203
case 0x000006f0: /* Core 2 Duo/Quad/Extreme */
196204
case 0x00000660: /* kvm over i5 */
@@ -203,7 +211,6 @@ cpuidhz(uint32_t *info0, uint32_t *info1, CpuHypervisor hypervisor)
203211
case 0x000106e0: /* i7,5,3 8xx */
204212
case 0x000206a0: /* i7,5,3 2xxx */
205213
case 0x000206c0: /* i7,5,3 4xxx */
206-
case 0x000306a0: /* i7,5,3 3xxx */
207214
case 0x000306f0: /* i7,5,3 5xxx */
208215
case 0x000506e0: /* i7,5,3 6xxx */
209216
case 0x00050650: /* i9 7900X */
@@ -221,7 +228,8 @@ cpuidhz(uint32_t *info0, uint32_t *info1, CpuHypervisor hypervisor)
221228
msr = 0;
222229
r = rdmsr(0x2a) & 0x1f;
223230
}
224-
f = rdmsr(0xcd) & 0x07;
231+
if (f < 0)
232+
f = rdmsr(0xcd) & 0x07;
225233
//iprint("rdmsr Intel: %d\n", rdmsr(0x2a));
226234
//iprint("Intel msr.lo %d\n", r);
227235
//iprint("Intel msr.hi %d\n", f);

0 commit comments

Comments
 (0)