From: Wei Liu <liuwe@linux.microsoft.com>
To: qemu-devel@nongnu.org
Cc: wei.liu@kernel.org, dirty@apple.com, rbolshakov@ddn.com,
phil@philjordan.eu, jinankjain@linux.microsoft.com,
liuwe@microsoft.com, muislam@microsoft.com,
ziqiaozhou@microsoft.com, mukeshrathor@microsoft.com,
magnuskulke@microsoft.com, prapal@microsoft.com,
jpiotrowski@microsoft.com, deviv@microsoft.com,
Wei Liu <liuwe@linux.microsoft.com>
Subject: [PATCH v2 04/14] target/i386: rename hvf_mmio_buf to emu_mmio_buf
Date: Fri, 7 Mar 2025 11:55:15 -0800 [thread overview]
Message-ID: <1741377325-28175-5-git-send-email-liuwe@linux.microsoft.com> (raw)
In-Reply-To: <1741377325-28175-1-git-send-email-liuwe@linux.microsoft.com>
We want to refactor HVF's instruction emulator to a common component. Renaming
hvf_mmio_buf removes the association between HVF and the instruction emulator.
The definition of the field is still guarded by CONFIG_HVF for now, since it is
the only user.
No functional change.
Signed-off-by: Wei Liu <liuwe@linux.microsoft.com>
---
v2: mmio_buf -> emu_mmio_buf per suggestion from Paolo
---
target/i386/cpu.h | 2 +-
target/i386/hvf/hvf.c | 4 ++--
target/i386/hvf/x86_emu.c | 12 ++++++------
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 7882b63b9b61..cf2bd0e9ada9 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -2109,7 +2109,7 @@ typedef struct CPUArchState {
#endif
#if defined(CONFIG_HVF)
HVFX86LazyFlags hvf_lflags;
- void *hvf_mmio_buf;
+ void *emu_mmio_buf;
#endif
uint64_t mcg_cap;
diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c
index 7da03f9c0811..1cecb765952b 100644
--- a/target/i386/hvf/hvf.c
+++ b/target/i386/hvf/hvf.c
@@ -168,7 +168,7 @@ void hvf_arch_vcpu_destroy(CPUState *cpu)
X86CPU *x86_cpu = X86_CPU(cpu);
CPUX86State *env = &x86_cpu->env;
- g_free(env->hvf_mmio_buf);
+ g_free(env->emu_mmio_buf);
}
static void init_tsc_freq(CPUX86State *env)
@@ -262,7 +262,7 @@ int hvf_arch_init_vcpu(CPUState *cpu)
if (hvf_state->hvf_caps == NULL) {
hvf_state->hvf_caps = g_new0(struct hvf_vcpu_caps, 1);
}
- env->hvf_mmio_buf = g_new(char, 4096);
+ env->emu_mmio_buf = g_new(char, 4096);
if (x86cpu->vmware_cpuid_freq) {
init_tsc_freq(env);
diff --git a/target/i386/hvf/x86_emu.c b/target/i386/hvf/x86_emu.c
index 7b01ccde5d3e..e59a73e00d5c 100644
--- a/target/i386/hvf/x86_emu.c
+++ b/target/i386/hvf/x86_emu.c
@@ -184,8 +184,8 @@ void write_val_ext(CPUX86State *env, target_ulong ptr, target_ulong val, int siz
uint8_t *read_mmio(CPUX86State *env, target_ulong ptr, int bytes)
{
- vmx_read_mem(env_cpu(env), env->hvf_mmio_buf, ptr, bytes);
- return env->hvf_mmio_buf;
+ vmx_read_mem(env_cpu(env), env->emu_mmio_buf, ptr, bytes);
+ return env->emu_mmio_buf;
}
@@ -487,9 +487,9 @@ static void exec_ins_single(CPUX86State *env, struct x86_decode *decode)
target_ulong addr = linear_addr_size(env_cpu(env), RDI(env),
decode->addressing_size, R_ES);
- emul_ops->handle_io(env_cpu(env), DX(env), env->hvf_mmio_buf, 0,
+ emul_ops->handle_io(env_cpu(env), DX(env), env->emu_mmio_buf, 0,
decode->operand_size, 1);
- vmx_write_mem(env_cpu(env), addr, env->hvf_mmio_buf,
+ vmx_write_mem(env_cpu(env), addr, env->emu_mmio_buf,
decode->operand_size);
string_increment_reg(env, R_EDI, decode);
@@ -510,9 +510,9 @@ static void exec_outs_single(CPUX86State *env, struct x86_decode *decode)
{
target_ulong addr = decode_linear_addr(env, decode, RSI(env), R_DS);
- vmx_read_mem(env_cpu(env), env->hvf_mmio_buf, addr,
+ vmx_read_mem(env_cpu(env), env->emu_mmio_buf, addr,
decode->operand_size);
- emul_ops->handle_io(env_cpu(env), DX(env), env->hvf_mmio_buf, 1,
+ emul_ops->handle_io(env_cpu(env), DX(env), env->emu_mmio_buf, 1,
decode->operand_size, 1);
string_increment_reg(env, R_ESI, decode);
--
2.47.2
next prev parent reply other threads:[~2025-03-07 19:56 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-07 19:55 [PATCH v2 00/14] Factor out HVF's instruction emulator Wei Liu
2025-03-07 19:55 ` [PATCH v2 01/14] target/i386/hvf: introduce x86_emul_ops Wei Liu
2025-03-07 19:55 ` [PATCH v2 02/14] target/i386/hvf: remove HVF specific calls from x86_decode.c Wei Liu
2025-03-07 19:55 ` [PATCH v2 03/14] target/i386/hvf: provide and use handle_io in emul_ops Wei Liu
2025-03-07 19:55 ` Wei Liu [this message]
2025-03-07 19:55 ` [PATCH v2 05/14] target/i386/hvf: use emul_ops->read_mem in x86_emu.c Wei Liu
2025-03-07 19:55 ` [PATCH v2 06/14] taret/i386/hvf: provide and use write_mem in emul_ops Wei Liu
2025-03-07 19:55 ` [PATCH v2 07/14] target/i386/hvf: provide and use simulate_{wrmsr, rdmsr} " Wei Liu
2025-03-07 19:55 ` [PATCH v2 08/14] target/i386: rename lazy flags field and its type Wei Liu
2025-03-07 19:55 ` [PATCH v2 09/14] target/i386/hvf: drop unused headers Wei Liu
2025-03-07 19:55 ` [PATCH v2 10/14] target/i386/hvf: rename some include guards Wei Liu
2025-03-07 19:55 ` [PATCH v2 11/14] target/i386: add a directory for x86 instruction emulator Wei Liu
2025-03-07 19:55 ` [PATCH v2 12/14] target/i386/emulate: add a panic.h Wei Liu
2025-03-07 19:55 ` [PATCH v2 13/14] target/i386: move x86 instruction emulator out of hvf Wei Liu
2025-03-07 19:55 ` [PATCH v2 14/14] MAINTAINERS: add an entry for the x86 instruction emulator Wei Liu
2025-03-14 19:01 ` [PATCH v2 00/14] Factor out HVF's " Wei Liu
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=1741377325-28175-5-git-send-email-liuwe@linux.microsoft.com \
--to=liuwe@linux.microsoft.com \
--cc=deviv@microsoft.com \
--cc=dirty@apple.com \
--cc=jinankjain@linux.microsoft.com \
--cc=jpiotrowski@microsoft.com \
--cc=liuwe@microsoft.com \
--cc=magnuskulke@microsoft.com \
--cc=muislam@microsoft.com \
--cc=mukeshrathor@microsoft.com \
--cc=phil@philjordan.eu \
--cc=prapal@microsoft.com \
--cc=qemu-devel@nongnu.org \
--cc=rbolshakov@ddn.com \
--cc=wei.liu@kernel.org \
--cc=ziqiaozhou@microsoft.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).