qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Phil Dennis-Jordan <phil@philjordan.eu>
To: qemu-devel@nongnu.org
Cc: dirty@apple.com, rbolshakov@ddn.com, lists@philjordan.eu,
	Phil Dennis-Jordan <phil@philjordan.eu>
Subject: [PATCH 1/3] i386: hvf: Adds support for INVTSC cpuid bit
Date: Fri, 22 Sep 2023 16:09:12 +0200	[thread overview]
Message-ID: <20230922140914.13906-2-phil@philjordan.eu> (raw)
In-Reply-To: <20230922140914.13906-1-phil@philjordan.eu>

This patch adds the INVTSC bit to the Hypervisor.framework accelerator's
CPUID bit passthrough allow-list. Previously, specifying +invtsc in the CPU
configuration would fail with the following warning despite the host CPU
advertising the feature:

qemu-system-x86_64: warning: host doesn't support requested feature:
CPUID.80000007H:EDX.invtsc [bit 8]

x86 macOS itself relies on a fixed rate TSC for its own Mach absolute time
timestamp mechanism, so there's no reason we can't enable this bit for guests.

Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu>
---
 target/i386/hvf/x86_cpuid.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/target/i386/hvf/x86_cpuid.c b/target/i386/hvf/x86_cpuid.c
index 7323a7a94b..d2721bd2a7 100644
--- a/target/i386/hvf/x86_cpuid.c
+++ b/target/i386/hvf/x86_cpuid.c
@@ -145,6 +145,10 @@ uint32_t hvf_get_supported_cpuid(uint32_t func, uint32_t idx,
                 CPUID_EXT3_3DNOWPREFETCH | CPUID_EXT3_OSVW | CPUID_EXT3_XOP |
                 CPUID_EXT3_FMA4 | CPUID_EXT3_TBM;
         break;
+    case 0x80000007:
+        edx &= CPUID_APM_INVTSC;
+        eax = ebx = ecx = 0;
+        break;
     default:
         return 0;
     }
-- 
2.36.1



  reply	other threads:[~2023-09-22 14:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-22 14:09 [PATCH 0/3] hvf x86 correctness and efficiency improvements Phil Dennis-Jordan
2023-09-22 14:09 ` Phil Dennis-Jordan [this message]
2023-10-08 18:07   ` [PATCH 1/3] i386: hvf: Adds support for INVTSC cpuid bit Roman Bolshakov
2023-09-22 14:09 ` [PATCH 2/3] i386: hvf: In kick_vcpu use hv_vcpu_interrupt to force exit Phil Dennis-Jordan
2023-10-08 18:23   ` Roman Bolshakov
2023-10-08 18:39     ` Phil Dennis-Jordan
2023-10-08 19:19       ` Roman Bolshakov
2023-10-08 19:29         ` Phil Dennis-Jordan
2023-10-16 14:19           ` Phil Dennis-Jordan
2023-10-20 15:12             ` Phil Dennis-Jordan
2023-11-05 15:21               ` Roman Bolshakov
2023-11-06 14:15                 ` Phil Dennis-Jordan
2023-09-22 14:09 ` [PATCH 3/3] i386: hvf: Updates API usage to use modern vCPU run function Phil Dennis-Jordan
2023-10-05 20:30 ` [PATCH 0/3] hvf x86 correctness and efficiency improvements Phil Dennis-Jordan
2023-10-16 14:39 ` Paolo Bonzini
2023-10-16 16:45   ` Phil Dennis-Jordan
2023-10-16 16:48     ` Paolo Bonzini
2023-10-16 20:05       ` Phil Dennis-Jordan
2023-10-16 21:08         ` Paolo Bonzini

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=20230922140914.13906-2-phil@philjordan.eu \
    --to=phil@philjordan.eu \
    --cc=dirty@apple.com \
    --cc=lists@philjordan.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=rbolshakov@ddn.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).