Skip to contentSkip to conversation

MSR_IA32_PERF_STATUS support

PATCH RESEND In review Alexander Graf 2 participants 6 messages Jan 15, 2008 4 messages not in the archive KVM

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 MSR_IA32_PERF_STATUS support

This is a resend of a mail I sent on 01/10/2008. I did not receive any response, so I assume it was lost.

The patch is really minor, does not break any compatibility (the MSR is Intel family 13+) and makes Darwin work.

--- old mail ---

This patch adds support for the MSR MSR_IA32_PERF_STATUS. This is required to boot Darwin.

I only implemented dummy support, as the real value would be of no meaning to any OS I know so far anyway and is only implemented on very recent Intel CPUs.

x86.c +7 -2
Index: kernel/x86.c
===================================================================
@@ -412,7 +412,7 @@ static u32 msrs_to_save[] = {
 #ifdef CONFIG_X86_64
 	MSR_CSTAR, MSR_KERNEL_GS_BASE, MSR_SYSCALL_MASK, MSR_LSTAR,
 #endif
-	MSR_IA32_TIME_STAMP_COUNTER,
+	MSR_IA32_TIME_STAMP_COUNTER, MSR_IA32_PERF_STATUS,
 };
 
 static unsigned num_msrs_to_save;
@@ -532,7 +532,6 @@ int kvm_get_msr_common(struct kvm_vcpu *
 	case MSR_IA32_MC0_MISC+12:
 	case MSR_IA32_MC0_MISC+16:
 	case MSR_IA32_UCODE_REV:
-	case MSR_IA32_PERF_STATUS:
 	case MSR_IA32_EBL_CR_POWERON:
 		/* MTRR registers */
 	case 0xfe:
@@ -548,6 +547,12 @@ int kvm_get_msr_common(struct kvm_vcpu *
 	case MSR_IA32_MISC_ENABLE:
 		data = vcpu->arch.ia32_misc_enable_msr;
 		break;
+	case MSR_IA32_PERF_STATUS:
+                /* These are fake values, necessary to get
+                   Darwin running */
+		data = 1000ULL /* tsc_increment_by_tick */
+                     | (((uint64_t)(4ULL /* granularity */ & 0x7)) << 40);
+		break;
 #ifdef CONFIG_X86_64
 	case MSR_EFER:
 		data = vcpu->arch.shadow_efer;

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 6 lines · Alexander Graf

This is a resend of a mail I sent on 01/10/2008. I did not receive any response, so I assume it was lost.

The patch is really minor, does not break any compatibility (the MSR is Intel family 13+) and makes Darwin work.

Quoted 10 lines

--- old mail ---

This patch adds support for the MSR MSR_IA32_PERF_STATUS. This is required to boot Darwin.

I only implemented dummy support, as the real value would be of no meaning to any OS I know so far anyway and is only implemented on very recent Intel CPUs.

Looks okay, but please add a signoff line and use the kernel coding style (tabs and comment style).

Signature · 7 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

A message that is not in the archive (sent off-list or not yet received): 478CD11A.1030500-atKUWr5tajBWk0Htik3J/[email protected]

#4 lore raw
Quoted 20 lines · Avi Kivity
Quoted 6 lines · Alexander Graf

This is a resend of a mail I sent on 01/10/2008. I did not receive any response, so I assume it was lost.

The patch is really minor, does not break any compatibility (the MSR is Intel family 13+) and makes Darwin work.

Quoted 11 lines

--- old mail ---

This patch adds support for the MSR MSR_IA32_PERF_STATUS. This is required to boot Darwin.

I only implemented dummy support, as the real value would be of no meaning to any OS I know so far anyway and is only implemented on very recent Intel CPUs.

Quoted 6 lines

Looks okay, but please add a signoff line and use the kernel coding style (tabs and comment style).

Ok, should I resend the patch with a signed-off line and proper coding style?

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw
Quoted 30 lines · Alexander Graf
Quoted 21 lines · Avi Kivity
Quoted 6 lines · Alexander Graf

This is a resend of a mail I sent on 01/10/2008. I did not receive any response, so I assume it was lost.

The patch is really minor, does not break any compatibility (the MSR is Intel family 13+) and makes Darwin work.

Quoted 12 lines

--- old mail ---

This patch adds support for the MSR MSR_IA32_PERF_STATUS. This is required to boot Darwin.

I only implemented dummy support, as the real value would be of no meaning to any OS I know so far anyway and is only implemented on very recent Intel CPUs.

Quoted 7 lines

Looks okay, but please add a signoff line and use the kernel coding style (tabs and comment style).

Quoted 3 lines

Ok, should I resend the patch with a signed-off line and proper coding style?

Yes please. I'm a little worried that this can confuse other guests, but as it's read only and a large variety have run so far without complaining, it's probably safe enough.

Signature · 7 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
#7 lore raw
In reply to a message not in the archive
Quoted 6 lines · Alexander Graf

This is a resend of a mail I sent on 01/10/2008. I did not receive any response, so I assume it was lost.

The patch is really minor, does not break any compatibility (the MSR is Intel family 13+) and makes Darwin work.

Quoted 9 lines

--- old mail ---

This patch adds support for the MSR MSR_IA32_PERF_STATUS. This is required to boot Darwin.

I only implemented dummy support, as the real value would be of no meaning to any OS I know so far anyway and is only implemented on very recent Intel CPUs.

I see some documentation of this in 13.1.1, but is there somewhere with more information?

Signature · 7 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

A message that is not in the archive (sent off-list or not yet received): 478CD687.9070000-atKUWr5tajBWk0Htik3J/[email protected]

#9 lore raw
Quoted 12 lines · Avi Kivity
Quoted 11 lines · Alexander Graf

This is a resend of a mail I sent on 01/10/2008. I did not receive any response, so I assume it was lost.

The patch is really minor, does not break any compatibility (the MSR is Intel family 13+) and makes Darwin work.

--- old mail ---

This patch adds support for the MSR MSR_IA32_PERF_STATUS. This is required to boot Darwin.

Quoted 8 lines
Quoted 4 lines

I only implemented dummy support, as the real value would be of no meaning to any OS I know so far anyway and is only implemented on very recent Intel CPUs.

I see some documentation of this in 13.1.1, but is there somewhere with more information?

The only proper source of information I found was the XNU kernel, which implements a full interpretation of the MSR values. Basically the high bits are the CPU multiplier, while the low bits represent the number the TSC advances in one cycle.

There is also a bit which multiplies everything by 2, but maybe the Intel people on this list can tell us more about it.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/