All of lore.kernel.org
 help / color / mirror / Atom feed
From: George Yunaev <gyunaev@ulduzsoft.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] qemu-kvm: use the proper CPU vendor if -cpu is specified with -enable-kvm
Date: Tue, 11 Mar 2014 11:35:15 -0700	[thread overview]
Message-ID: <531F5763.5030701@ulduzsoft.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1622 bytes --]

Hello everyone,

This patch fixes the issue when -cpu specification is partially ignored 
when -enable-kvm is specified. For example, |when running:

qemu-system-x86_64 -cpu core2duo

on AMD machine, the CPU vendor is properly identified as GenuineIntel. 
However when running:
|
|qemu-system-x86_64 -cpu core2duo| |-enable-kvm

on the same AMD machine, the CPU vendor is now identified as 
AuthenticAMD, despite the rest of CPU information (such as name) being 
Intel-specific. This behavior breaks the attempts to emulate Mac OS X on 
AMD CPU with kvm enabled.

This behavior is caused by the code in cpu_x86_register() which copies 
the host CPU vendor into the emulated CPU when kvm is enabled. While 
this makes sense for the qemu-emulated CPU, this makes little sense when 
the user actually specified the -cpu. Not sure if this behavior

The attached patch changes this behavior by only copying the vendor CPU 
information from the host CPU when either the qemu32 or qemu64 CPU is 
being used.

|

Signed-off-by: George Yunaev <gyunaev@ulduzsoft.com>
---

--- qemu.old/target-i386/cpu.c  2014-03-10 23:47:08.000000000 -0700
+++ qemu/target-i386/cpu.c      2014-03-10 23:47:32.433412520 -0700
@@ -1863,7 +1863,7 @@
      const char *vendor = def->vendor;
      char host_vendor[CPUID_VENDOR_SZ + 1];

-    if (kvm_enabled()) {
+    if (kvm_enabled() && def->name[0] == 'q' && def->name[1] == 'e' && 
def->name[2] == 'm' && def->name[3] == 'u' ) {
          uint32_t  ebx = 0, ecx = 0, edx = 0;
          host_cpuid(0, 0, NULL, &ebx, &ecx, &edx);
          x86_cpu_vendor_words2str(host_vendor, ebx, edx, ecx);

---


[-- Attachment #2: Type: text/html, Size: 2582 bytes --]

                 reply	other threads:[~2014-03-11 19:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=531F5763.5030701@ulduzsoft.com \
    --to=gyunaev@ulduzsoft.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.