Skip to content

Implements MMIO emulation for lvx/stvx instructions

Jose Ricardo Ziviani kvm-ppc linuxppc-dev 8 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest1 patch 0 repliesNew
  2. v51 patch 3 repliesSuperseded
  3. v41 patch 0 repliesSuperseded
Earlier versions · 5
VersionPostedPatchesRepliesStatus
v31 patch0 repliesSuperseded
v21 patch0 repliesSuperseded
v1 posting 3/31 patch2 repliesSuperseded
v1 posting 2/31 patch1 replySuperseded
v1 posting 1/31 patch0 repliesSuperseded

Changes in v6 from the cover letter

- Applied Paul's code suggestion to fix endianess
- Moved kvmppc_get_vsr_dword_offset() back to #ifdef CONFIG_VSX

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1KVM: PPC: Book3S: Add MMIO emulation for VMX instructionsarch/powerpc/include/asm/kvm_host.h arch/powerpc/include/asm/kvm_ppc.h arch/powerpc/include/asm/ppc-opcode.h +2 more+196 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v6 yet.

Read the v6 thread

Cover letter [PATCH v6 0/1] Implements MMIO emulation for lvx/stvx instructions

v6:
- Applied Paul's code suggestion to fix endianess
- Moved kvmppc_get_vsr_dword_offset() back to #ifdef CONFIG_VSX

v5:
- Fixed the mask off of the effective address

v4:
- Changed KVM_MMIO_REG_VMX to 0xc0 because there are 64 VSX registers

v3:
- Added Reported-by in the commit message

v2:
- kvmppc_get_vsr_word_offset() moved back to its original place
- EA AND ~0xF, following ISA.
- fixed BE/LE cases

TESTS:

For testing purposes I wrote a small program that performs stvx/lvx using the program's virtual memory and using MMIO. Load/Store into virtual memory is the model I use to check if MMIO results are correct (because only MMIO is emulated by KVM).

Results:

HOST LE - GUEST BE
address: 0x10034850010
0x21436587bbbbaaaa4444555578563412
io_address: 0x3fff89a20000
0x21436587bbbbaaaa4444555578563412

HOST LE - GUEST LE
address: 0x10033a20010
0x1234567855554444aaaabbbb87654321
io_address: 0x3fffb5380000
0x1234567855554444aaaabbbb87654321

HOST BE - GUEST BE
address: 0x1002c4a0010
0x21436587bbbbaaaa4444555578563412
io_address: 0x3ffface40000
0x21436587bbbbaaaa4444555578563412

HOST BR - GUEST LE
address: 0x100225e0010
0x1234567855554444aaaabbbb87654321
io_address: 0x3fff7fcb0000
0x1234567855554444aaaabbbb87654321

This patch implements MMIO emulation for two instructions: lvx and stvx.

Jose Ricardo Ziviani (1):
KVM: PPC: Book3S: Add MMIO emulation for VMX instructions

 arch/powerpc/include/asm/kvm_host.h   |   2 +
 arch/powerpc/include/asm/kvm_ppc.h    |   4 +
 arch/powerpc/include/asm/ppc-opcode.h |   6 ++
 arch/powerpc/kvm/emulate_loadstore.c  |  34 ++++++++
 arch/powerpc/kvm/powerpc.c            | 150 ++++++++++++++++++++++++++++++++++
 5 files changed, 196 insertions(+)
Signature · 1 line
2.14.3