public inbox for qemu-devel@nongnu.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Magnus Kulke <magnuskulke@linux.microsoft.com>,
	Wei Liu <wei.liu@kernel.org>
Subject: [PULL 41/41] target/i386/mshv: remove unused optimization of gva=>gpa translation
Date: Thu, 12 Feb 2026 15:42:43 +0100	[thread overview]
Message-ID: <20260212144244.22579-42-pbonzini@redhat.com> (raw)
In-Reply-To: <20260212144244.22579-1-pbonzini@redhat.com>

From: Magnus Kulke <magnuskulke@linux.microsoft.com>

The removed parameters are remnants of a prior attempt to optimize
gva=>gpa translation. Currently there is only one call site and it's
not using it. So we can remove it as dead code.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Reviewed-by: Wei Liu <wei.liu@kernel.org>
Link: https://lore.kernel.org/r/20251125120852.250149-1-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/mshv/mshv-cpu.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/target/i386/mshv/mshv-cpu.c b/target/i386/mshv/mshv-cpu.c
index f5c388eb87c..f190e83bd15 100644
--- a/target/i386/mshv/mshv-cpu.c
+++ b/target/i386/mshv/mshv-cpu.c
@@ -1336,23 +1336,19 @@ static int read_memory(const CPUState *cpu, uint64_t initial_gva,
     return 0;
 }
 
-static int write_memory(const CPUState *cpu, uint64_t initial_gva,
-                        uint64_t initial_gpa, uint64_t gva, const uint8_t *data,
+static int write_memory(const CPUState *cpu, uint64_t gva, const uint8_t *data,
                         size_t len)
 {
     int ret;
     uint64_t gpa, flags;
 
-    if (gva == initial_gva) {
-        gpa = initial_gpa;
-    } else {
-        flags = HV_TRANSLATE_GVA_VALIDATE_WRITE;
-        ret = translate_gva(cpu, gva, &gpa, flags);
-        if (ret < 0) {
-            error_report("failed to translate gva to gpa");
-            return -1;
-        }
+    flags = HV_TRANSLATE_GVA_VALIDATE_WRITE;
+    ret = translate_gva(cpu, gva, &gpa, flags);
+    if (ret < 0) {
+        error_report("failed to translate gva to gpa");
+        return -1;
     }
+
     ret = mshv_guest_mem_write(gpa, data, len, false);
     if (ret != MEMTX_OK) {
         error_report("failed to write to mmio");
@@ -1407,7 +1403,7 @@ static int handle_pio_str_read(CPUState *cpu,
     for (size_t i = 0; i < repeat; i++) {
         pio_read(port, data, len, false);
 
-        ret = write_memory(cpu, 0, 0, dst, data, len);
+        ret = write_memory(cpu, dst, data, len);
         if (ret < 0) {
             error_report("Failed to write memory");
             return -1;
-- 
2.52.0



  parent reply	other threads:[~2026-02-12 14:51 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-12 14:42 [PULL 00/41] QOM, target/i386 patches for 2026-02-12 Paolo Bonzini
2026-02-12 14:42 ` [PULL 01/41] target/i386: convert SEV-ES termination requests to guest panic events Paolo Bonzini
2026-02-12 14:42 ` [PULL 02/41] hw/i386/pc: Remove deprecated pc-q35-2.6 and pc-i440fx-2.6 machines Paolo Bonzini
2026-02-12 14:42 ` [PULL 03/41] tests/acpi: Allow DSDT table change for x86 machines Paolo Bonzini
2026-02-12 14:42 ` [PULL 04/41] pc: Start with modern CPU hotplug interface by default Paolo Bonzini
2026-03-16 16:01   ` Peter Maydell
2026-03-17  4:23     ` Zhao Liu
2026-03-17 14:21       ` Peter Maydell
2026-02-12 14:42 ` [PULL 05/41] hw/i386/pc: Remove PCMachineClass::legacy_cpu_hotplug field Paolo Bonzini
2026-02-12 14:42 ` [PULL 06/41] acpi: Remove legacy cpu hotplug utilities Paolo Bonzini
2026-02-12 14:42 ` [PULL 07/41] docs/specs/acpi_cpu_hotplug: Remove legacy cpu hotplug descriptions Paolo Bonzini
2026-02-12 14:42 ` [PULL 08/41] tests/acpi: Update DSDT tables for pc & q35 machines Paolo Bonzini
2026-02-12 14:42 ` [PULL 09/41] hw/nvram/fw_cfg: Rename fw_cfg_init_mem() with '_nodma' suffix Paolo Bonzini
2026-02-12 14:42 ` [PULL 10/41] hw/mips/loongson3_virt: Prefer using fw_cfg_init_mem_nodma() Paolo Bonzini
2026-02-12 14:42 ` [PULL 11/41] hw/nvram/fw_cfg: Factor fw_cfg_init_mem_internal() out Paolo Bonzini
2026-02-12 14:42 ` [PULL 12/41] hw/nvram/fw_cfg: Rename fw_cfg_init_mem_wide() -> fw_cfg_init_mem_dma() Paolo Bonzini
2026-02-12 14:42 ` [PULL 13/41] hw/i386/x86: Remove X86MachineClass::fwcfg_dma_enabled field Paolo Bonzini
2026-02-12 14:42 ` [PULL 14/41] hw/i386/pc: Remove multiboot.bin Paolo Bonzini
2026-02-12 14:42 ` [PULL 15/41] hw/i386: Assume fw_cfg DMA is always enabled Paolo Bonzini
2026-02-12 14:42 ` [PULL 16/41] hw/i386: Remove linuxboot.bin Paolo Bonzini
2026-03-24 12:12   ` Daniel P. Berrangé
2026-03-24 12:14     ` Paolo Bonzini
2026-02-12 14:42 ` [PULL 17/41] hw/i386/pc: Remove pc_compat_2_6[] array Paolo Bonzini
2026-02-12 14:42 ` [PULL 18/41] hw/intc/apic: Remove APICCommonState::legacy_instance_id field Paolo Bonzini
2026-02-12 14:42 ` [PULL 19/41] hw/core/machine: Remove hw_compat_2_6[] array Paolo Bonzini
2026-02-12 14:42 ` [PULL 20/41] hw/virtio/virtio-mmio: Remove VirtIOMMIOProxy::format_transport_address field Paolo Bonzini
2026-02-12 14:42 ` [PULL 21/41] hw/i386/pc: Remove deprecated pc-q35-2.7 and pc-i440fx-2.7 machines Paolo Bonzini
2026-02-12 14:42 ` [PULL 22/41] hw/i386/pc: Remove pc_compat_2_7[] array Paolo Bonzini
2026-02-12 14:42 ` [PULL 23/41] target/i386/cpu: Remove CPUX86State::full_cpuid_auto_level field Paolo Bonzini
2026-02-12 14:42 ` [PULL 24/41] hw/audio/pcspk: Remove PCSpkState::migrate field Paolo Bonzini
2026-02-12 14:42 ` [PULL 25/41] hw/core/machine: Remove hw_compat_2_7[] array Paolo Bonzini
2026-02-12 14:42 ` [PULL 26/41] hw/i386/intel_iommu: Remove IntelIOMMUState::buggy_eim field Paolo Bonzini
2026-02-12 14:42 ` [PULL 27/41] hw/virtio/virtio-pci: Remove VirtIOPCIProxy::ignore_backend_features field Paolo Bonzini
2026-02-12 14:42 ` [PULL 28/41] hw/char/virtio-serial: Do not expose the 'emergency-write' property Paolo Bonzini
2026-02-16 17:21   ` Alexander Bulekov
2026-02-12 14:42 ` [PULL 29/41] i386/cpu: Fix incorrect initializer in Diamond Rapids definition Paolo Bonzini
2026-02-12 14:42 ` [PULL 30/41] target/i386/kvm: set KVM_PMU_CAP_DISABLE if "-pmu" is configured Paolo Bonzini
2026-02-12 14:42 ` [PULL 31/41] target/i386/kvm: extract unrelated code out of kvm_x86_build_cpuid() Paolo Bonzini
2026-02-12 14:42 ` [PULL 32/41] target/i386/kvm: rename architectural PMU variables Paolo Bonzini
2026-02-12 14:42 ` [PULL 33/41] target/i386/kvm: reset AMD PMU registers during VM reset Paolo Bonzini
2026-02-12 14:42 ` [PULL 34/41] target/i386/kvm: support perfmon-v2 for reset Paolo Bonzini
2026-02-12 14:42 ` [PULL 35/41] qdev: Free property array on release Paolo Bonzini
2026-02-12 14:42 ` [PULL 36/41] qdev: make release_string() idempotent Paolo Bonzini
2026-02-12 14:42 ` [PULL 37/41] qdev: make release_drive() idempotent Paolo Bonzini
2026-02-12 14:42 ` [PULL 38/41] qdev: make release_tpm() idempotent Paolo Bonzini
2026-02-12 14:42 ` [PULL 39/41] tests: add /qdev/free-properties test Paolo Bonzini
2026-02-12 14:42 ` [PULL 40/41] accel/mshv: Remove remap overlapping mappings code Paolo Bonzini
2026-02-12 14:42 ` Paolo Bonzini [this message]
2026-02-12 16:26 ` [PULL 00/41] QOM, target/i386 patches for 2026-02-12 Peter Maydell

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=20260212144244.22579-42-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=magnuskulke@linux.microsoft.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wei.liu@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox