mbox series

[00/13] i386: hvf: Remove HVFX86EmulatorState

Message ID 20200528193758.51454-1-r.bolshakov@yadro.com
Headers show
Series i386: hvf: Remove HVFX86EmulatorState | expand

Message

Roman Bolshakov May 28, 2020, 7:37 p.m. UTC
Hi,

This is a cleanup series for HVF accel.

HVF is using two emulator states CPUX86State and HVFX86EmulatorState
simultaneously. HVFX86EmulatorState is used for instruction emulation.
CPUX86State is used in all other places. Sometimes the states are in
sync, sometimes they're not. It complicates reasoning about emulator
behaviour given that there's a third state - VMCS.

The series tries to leverage CPUX86State for instruction decoding and
removes HVFX86EmulatorState. I had to add two new hvf-specific fields to
CPUX86State: lazy_flags and mmio_buf. It's likely that cc_op, cc_dst,
etc could be reused for lazy_flags but it'd require major rework of flag
processing during instruction emulation. Hopefully that'll happen too in
the future.

I tried to include sysemu/hvf.h into target/i386/cpu.h to add definition
of hvf lazy flags but couldn't do that at first it because it introduced
circular dependency between existing sysemu/hvf.h and cpu.h. The first
three patches untangle and prune sysemu/hvf.h to the bare minimum to
allow inclusion of sysemu/hvf.h into target/i386/cpu.h.

This might conflict with [1], but merge/rebase should be trivial.

1. https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg07449.html

Thanks,
Roman

Roman Bolshakov (13):
  i386: hvf: Move HVFState definition into hvf
  i386: hvf: Drop useless declarations in sysemu
  i386: hvf: Clean stray includes in sysemu
  i386: hvf: Drop unused variable
  i386: hvf: Use ins_len to advance IP
  i386: hvf: Use IP from CPUX86State
  i386: hvf: Drop fetch_rip from HVFX86EmulatorState
  i386: hvf: Drop rflags from HVFX86EmulatorState
  i386: hvf: Drop copy of RFLAGS defines
  i386: hvf: Drop regs in HVFX86EmulatorState
  i386: hvf: Move lazy_flags into CPUX86State
  i386: hvf: Move mmio_buf into CPUX86State
  i386: hvf: Drop HVFX86EmulatorState

 include/qemu/typedefs.h      |   1 -
 include/sysemu/hvf.h         |  73 ++-------------------
 target/i386/cpu.h            |   4 +-
 target/i386/hvf/hvf-i386.h   |  35 ++++++++++
 target/i386/hvf/hvf.c        |  30 ++++-----
 target/i386/hvf/x86.c        |   2 +-
 target/i386/hvf/x86.h        |  89 ++-----------------------
 target/i386/hvf/x86_decode.c |  25 ++++---
 target/i386/hvf/x86_emu.c    | 122 +++++++++++++++++------------------
 target/i386/hvf/x86_flags.c  |  81 ++++++++++++-----------
 target/i386/hvf/x86_task.c   |  10 +--
 target/i386/hvf/x86hvf.c     |   6 +-
 12 files changed, 186 insertions(+), 292 deletions(-)

Comments

no-reply@patchew.org May 29, 2020, 2:57 a.m. UTC | #1
Patchew URL: https://patchew.org/QEMU/20200528193758.51454-1-r.bolshakov@yadro.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 20200528193758.51454-1-r.bolshakov@yadro.com
Subject: [PATCH 00/13] i386: hvf: Remove HVFX86EmulatorState
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Switched to a new branch 'test'
babfd75 i386: hvf: Drop HVFX86EmulatorState
57557be i386: hvf: Move mmio_buf into CPUX86State
53b9354 i386: hvf: Move lazy_flags into CPUX86State
ba6c821 i386: hvf: Drop regs in HVFX86EmulatorState
70b2839 i386: hvf: Drop copy of RFLAGS defines
aef7278 i386: hvf: Drop rflags from HVFX86EmulatorState
3aa57aa i386: hvf: Drop fetch_rip from HVFX86EmulatorState
44a94ed i386: hvf: Use IP from CPUX86State
ef6fe79 i386: hvf: Use ins_len to advance IP
ec88b12 i386: hvf: Drop unused variable
de8d999 i386: hvf: Clean stray includes in sysemu
ad061bc i386: hvf: Drop useless declarations in sysemu
0da6fba i386: hvf: Move HVFState definition into hvf

=== OUTPUT BEGIN ===
1/13 Checking commit 0da6fbafda5f (i386: hvf: Move HVFState definition into hvf)
2/13 Checking commit ad061bc7f025 (i386: hvf: Drop useless declarations in sysemu)
3/13 Checking commit de8d9997e911 (i386: hvf: Clean stray includes in sysemu)
4/13 Checking commit ec88b12c4ae7 (i386: hvf: Drop unused variable)
5/13 Checking commit ef6fe796978e (i386: hvf: Use ins_len to advance IP)
6/13 Checking commit 44a94ed21d06 (i386: hvf: Use IP from CPUX86State)
ERROR: unnecessary whitespace before a quoted newline
#444: FILE: target/i386/hvf/x86_emu.c:1470:
+        printf("Unimplemented handler (%llx) for %d (%x %x) \n", env->eip,

total: 1 errors, 0 warnings, 403 lines checked

Patch 6/13 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

7/13 Checking commit 3aa57aab9271 (i386: hvf: Drop fetch_rip from HVFX86EmulatorState)
8/13 Checking commit aef72785da68 (i386: hvf: Drop rflags from HVFX86EmulatorState)
9/13 Checking commit 70b2839d8d2e (i386: hvf: Drop copy of RFLAGS defines)
10/13 Checking commit ba6c821f8a7e (i386: hvf: Drop regs in HVFX86EmulatorState)
11/13 Checking commit 53b935424444 (i386: hvf: Move lazy_flags into CPUX86State)
12/13 Checking commit 57557be2d13c (i386: hvf: Move mmio_buf into CPUX86State)
13/13 Checking commit babfd7578724 (i386: hvf: Drop HVFX86EmulatorState)
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20200528193758.51454-1-r.bolshakov@yadro.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Cameron Esfahani June 4, 2020, 1:53 a.m. UTC | #2
Reviewed-by: Cameron Esfahani <dirty@apple.com> 

Cameron Esfahani
dirty@apple.com

"The cake is a lie."

Common wisdom



> On May 28, 2020, at 12:37 PM, Roman Bolshakov <r.bolshakov@yadro.com> wrote:
> 
> Hi,
> 
> This is a cleanup series for HVF accel.
> 
> HVF is using two emulator states CPUX86State and HVFX86EmulatorState
> simultaneously. HVFX86EmulatorState is used for instruction emulation.
> CPUX86State is used in all other places. Sometimes the states are in
> sync, sometimes they're not. It complicates reasoning about emulator
> behaviour given that there's a third state - VMCS.
> 
> The series tries to leverage CPUX86State for instruction decoding and
> removes HVFX86EmulatorState. I had to add two new hvf-specific fields to
> CPUX86State: lazy_flags and mmio_buf. It's likely that cc_op, cc_dst,
> etc could be reused for lazy_flags but it'd require major rework of flag
> processing during instruction emulation. Hopefully that'll happen too in
> the future.
> 
> I tried to include sysemu/hvf.h into target/i386/cpu.h to add definition
> of hvf lazy flags but couldn't do that at first it because it introduced
> circular dependency between existing sysemu/hvf.h and cpu.h. The first
> three patches untangle and prune sysemu/hvf.h to the bare minimum to
> allow inclusion of sysemu/hvf.h into target/i386/cpu.h.
> 
> This might conflict with [1], but merge/rebase should be trivial.
> 
> 1. https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg07449.html
> 
> Thanks,
> Roman
> 
> Roman Bolshakov (13):
>  i386: hvf: Move HVFState definition into hvf
>  i386: hvf: Drop useless declarations in sysemu
>  i386: hvf: Clean stray includes in sysemu
>  i386: hvf: Drop unused variable
>  i386: hvf: Use ins_len to advance IP
>  i386: hvf: Use IP from CPUX86State
>  i386: hvf: Drop fetch_rip from HVFX86EmulatorState
>  i386: hvf: Drop rflags from HVFX86EmulatorState
>  i386: hvf: Drop copy of RFLAGS defines
>  i386: hvf: Drop regs in HVFX86EmulatorState
>  i386: hvf: Move lazy_flags into CPUX86State
>  i386: hvf: Move mmio_buf into CPUX86State
>  i386: hvf: Drop HVFX86EmulatorState
> 
> include/qemu/typedefs.h      |   1 -
> include/sysemu/hvf.h         |  73 ++-------------------
> target/i386/cpu.h            |   4 +-
> target/i386/hvf/hvf-i386.h   |  35 ++++++++++
> target/i386/hvf/hvf.c        |  30 ++++-----
> target/i386/hvf/x86.c        |   2 +-
> target/i386/hvf/x86.h        |  89 ++-----------------------
> target/i386/hvf/x86_decode.c |  25 ++++---
> target/i386/hvf/x86_emu.c    | 122 +++++++++++++++++------------------
> target/i386/hvf/x86_flags.c  |  81 ++++++++++++-----------
> target/i386/hvf/x86_task.c   |  10 +--
> target/i386/hvf/x86hvf.c     |   6 +-
> 12 files changed, 186 insertions(+), 292 deletions(-)
> 
> -- 
> 2.26.1
> 
>