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 <[email protected]>
---
 target/i386/mshv/mshv-cpu.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/target/i386/mshv/mshv-cpu.c b/target/i386/mshv/mshv-cpu.c
index 1c3db02188..03ef085d5e 100644
--- a/target/i386/mshv/mshv-cpu.c
+++ b/target/i386/mshv/mshv-cpu.c
@@ -1189,7 +1189,7 @@ static int handle_unmapped_mem(int vm_fd, CPUState *cpu,
     remap_result = mshv_remap_overlap_region(vm_fd, gpa);
     *exit_reason = MshvVmExitIgnore;
 
-    switch (remap_result) {
+   switch (remap_result) {
     case MshvRemapNoMapping:
         /* if we didn't find a mapping, it is probably mmio */
         return handle_mmio(cpu, msg, exit_reason);
@@ -1374,23 +1374,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");
@@ -1445,7 +1441,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.34.1


Reply via email to