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, roman@roolebo.dev, pbonzini@redhat.com,
	lists@philjordan.eu, phil@philjordan.eu
Subject: [PATCH v2 3/4] hvf: Consistent types for vCPU handles
Date: Sat, 21 Oct 2023 22:05:17 +0200	[thread overview]
Message-ID: <20231021200518.30125-4-phil@philjordan.eu> (raw)
In-Reply-To: <20231021200518.30125-1-phil@philjordan.eu>

macOS Hypervisor.framework uses different types for identifying vCPUs,
hv_vcpu_t or hv_vcpuid_t, depending on host architecture. They are not just
differently named typedefs for the same primitive type, but reference
different-width integers.

Instead of using an integer type and casting where necessary, this change
introduces a typedef which resolves to the active architecture’s hvf typedef.
It also removes a now-unnecessary cast.

Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu>
---
 accel/hvf/hvf-accel-ops.c | 2 +-
 include/sysemu/hvf_int.h  | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c
index abe7adf7ee..165e54ea27 100644
--- a/accel/hvf/hvf-accel-ops.c
+++ b/accel/hvf/hvf-accel-ops.c
@@ -400,7 +400,7 @@ static int hvf_init_vcpu(CPUState *cpu)
     r = hv_vcpu_create(&cpu->accel->fd,
                        (hv_vcpu_exit_t **)&cpu->accel->exit, NULL);
 #else
-    r = hv_vcpu_create((hv_vcpuid_t *)&cpu->accel->fd, HV_VCPU_DEFAULT);
+    r = hv_vcpu_create(&cpu->accel->fd, HV_VCPU_DEFAULT);
 #endif
     cpu->vcpu_dirty = 1;
     assert_hvf_ok(r);
diff --git a/include/sysemu/hvf_int.h b/include/sysemu/hvf_int.h
index 718beddcdd..7980c90825 100644
--- a/include/sysemu/hvf_int.h
+++ b/include/sysemu/hvf_int.h
@@ -13,8 +13,10 @@
 
 #ifdef __aarch64__
 #include <Hypervisor/Hypervisor.h>
+typedef hv_vcpu_t hvf_vcpuid;
 #else
 #include <Hypervisor/hv.h>
+typedef hv_vcpuid_t hvf_vcpuid;
 #endif
 
 /* hvf_slot flags */
@@ -50,7 +52,7 @@ struct HVFState {
 extern HVFState *hvf_state;
 
 struct AccelCPUState {
-    uint64_t fd;
+    hvf_vcpuid fd;
     void *exit;
     bool vtimer_masked;
     sigset_t unblock_ipi_mask;
-- 
2.36.1



  parent reply	other threads:[~2023-10-21 20:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-21 20:05 [PATCH v2 0/4] hvf x86 correctness and efficiency improvements part 1 Phil Dennis-Jordan
2023-10-21 20:05 ` [PATCH v2 1/4] i386: hvf: Adds support for INVTSC cpuid bit Phil Dennis-Jordan
2023-11-06  5:10   ` Roman Bolshakov
2023-10-21 20:05 ` [PATCH v2 2/4] hvf: Fixes some compilation warnings Phil Dennis-Jordan
2023-11-06  5:16   ` Roman Bolshakov
2023-10-21 20:05 ` Phil Dennis-Jordan [this message]
2023-11-06  5:24   ` [PATCH v2 3/4] hvf: Consistent types for vCPU handles Roman Bolshakov
2023-10-21 20:05 ` [PATCH v2 4/4] i386/hvf: Fixes dirty memory tracking by page granularity RX->RWX change Phil Dennis-Jordan
2023-11-06  8:53   ` Roman Bolshakov

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=20231021200518.30125-4-phil@philjordan.eu \
    --to=phil@philjordan.eu \
    --cc=dirty@apple.com \
    --cc=lists@philjordan.eu \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=roman@roolebo.dev \
    /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).