qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC PATCH 0/6] Enhancing Qemu MMIO emulation with scripting interface
@ 2019-08-07  7:14 Balamuruhan S
  2019-08-07  7:14 ` [Qemu-devel] [RFC PATCH 1/6] utils/python_api: add scripting interface for Qemu with python lib Balamuruhan S
                   ` (10 more replies)
  0 siblings, 11 replies; 45+ messages in thread
From: Balamuruhan S @ 2019-08-07  7:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: maddy, Balamuruhan S, anju, clg, hari, pbonzini, david

Hi All,

This is a proposal to extend mmio callbacks in Qemu with scripting interface
that is prototyped with python in this implementation. It gives ability to
feed runtime data through callbacks without recompiling Qemu in generic way.
This patchset adds library that provides APIs for Qemu to talk with python
scripts placed in path -module-path and how existing xscom can be extended
with python interface infrastructure.

We have also added an hacky emulation for memory region (OCC common area and HOMER)
which is shared between core and un-core engine (ideally this should be via
sram device) to showcase the effectiveness of having the scripting interface
(uncore engine taken for discussion here is powerpc specificed called OCC).
Having scripting interface helps to emulate/test different uncore-core
interactions including uncore engine failure or hang. It also helps in feeding
randomized data at byte level access. This patchset is primarily to extend mmio
callbacks with scripting interface and to demonstrate effectiveness it.

Some changes are required in PowerPC skiboot tree to test these changes since
the memory region is disabled currently for Qemu emulated PowerNV host,
https://github.com/balamuruhans/skiboot/commit/a655514d2a730e0372a2faee277d1cf01f71a524

Qemu commandline used to test,

```
# qemu/ppc64-softmmu/qemu-system-ppc64 \
-M powernv \
-cpu POWER9 \
-m 16G \
-kernel vmlinux \
-initrd debug_homer.cpio \
-nographic -bios skiboot/skiboot.lid \
-module-path /home/bala/homer/python-modules/,xscom_module=homer,xscom_read=xscom_read,xscom_write=xscom_write,homer_module=homer,homer=homer_read,occ_module=homer,occ=occ_read
```

Script used to feed data can be something like,
https://github.com/balamuruhans/python-modules/blob/master/script.py

It could uncover couple of firmware bugs,
https://github.com/balamuruhans/skiboot/commit/fd3d93d92ec66a7494346d6d24ced7b48264c9a0
https://github.com/balamuruhans/skiboot/commit/165b3829a93bc177c18133945a8cca3a2d701173

Code changes:
Patch 1: adds library to provide python interface APIs
Patch 2: extend existing xscom to adopt this python interface
Patch 3 - 6: emulate uncore/core shared memory region with mmio callbacks and
add support with this infrastructure.

I request for comments, suggestions, ideas on getting a scripting interface
like python added in qemu.

Balamuruhan S (6):
  utils/python_api: add scripting interface for Qemu with python lib
  hw/ppc/pnv_xscom: extend xscom to use python interface
  hw/ppc/pnv_homer: add homer/occ common area emulation for PowerNV
  hw/ppc/pnv: initialize and realize homer/occ common area
  hw/ppc/pnv_xscom: retrieve homer/occ base address from PBA BARs
  hw/ppc/pnv_homer: add python interface support for homer/occ common
    area

 configure                   |  10 +++
 hw/ppc/Makefile.objs        |   2 +-
 hw/ppc/pnv.c                |  49 ++++++++++-
 hw/ppc/pnv_homer.c          | 205 ++++++++++++++++++++++++++++++++++++++++++++
 hw/ppc/pnv_xscom.c          |  59 +++++++++++--
 include/hw/ppc/pnv.h        |  15 ++++
 include/hw/ppc/pnv_homer.h  |  41 +++++++++
 include/sysemu/python_api.h |  30 +++++++
 include/sysemu/sysemu.h     |   8 ++
 qemu-options.hx             |  14 +++
 util/Makefile.objs          |   1 +
 util/python_api.c           | 100 +++++++++++++++++++++
 vl.c                        |  66 ++++++++++++++
 13 files changed, 588 insertions(+), 12 deletions(-)
 create mode 100644 hw/ppc/pnv_homer.c
 create mode 100644 include/hw/ppc/pnv_homer.h
 create mode 100644 include/sysemu/python_api.h
 create mode 100644 util/python_api.c

-- 
2.14.5



^ permalink raw reply	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2019-08-12  6:04 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-07  7:14 [Qemu-devel] [RFC PATCH 0/6] Enhancing Qemu MMIO emulation with scripting interface Balamuruhan S
2019-08-07  7:14 ` [Qemu-devel] [RFC PATCH 1/6] utils/python_api: add scripting interface for Qemu with python lib Balamuruhan S
2019-08-07 10:20   ` Philippe Mathieu-Daudé
2019-08-08 10:10     ` Stefan Hajnoczi
2019-08-08 10:33       ` Philippe Mathieu-Daudé
2019-08-08 10:53       ` Daniel P. Berrangé
2019-08-09  8:46         ` Stefan Hajnoczi
2019-08-12  4:53           ` Balamuruhan S
2019-08-08 10:09   ` Stefan Hajnoczi
2019-08-11  6:39     ` Balamuruhan S
2019-08-08 10:49   ` Daniel P. Berrangé
2019-08-08 12:45     ` Philippe Mathieu-Daudé
2019-08-09  4:39       ` David Gibson
2019-08-12  4:45       ` Balamuruhan S
2019-08-07  7:14 ` [Qemu-devel] [RFC PATCH 2/6] hw/ppc/pnv_xscom: extend xscom to use python interface Balamuruhan S
2019-08-08  9:04   ` Cédric Le Goater
2019-08-07  7:14 ` [Qemu-devel] [RFC PATCH 3/6] hw/ppc/pnv_homer: add homer/occ common area emulation for PowerNV Balamuruhan S
2019-08-07  7:54   ` Cédric Le Goater
2019-08-07 10:07     ` Balamuruhan S
2019-08-08  8:32       ` Cédric Le Goater
2019-08-09  4:44     ` David Gibson
2019-08-11  6:34       ` Balamuruhan S
2019-08-07  7:14 ` [Qemu-devel] [RFC PATCH 4/6] hw/ppc/pnv: initialize and realize homer/occ common area Balamuruhan S
2019-08-07  7:59   ` Cédric Le Goater
2019-08-07 10:12     ` Balamuruhan S
2019-08-08  8:46       ` Cédric Le Goater
2019-08-09  4:45   ` David Gibson
2019-08-07  7:14 ` [Qemu-devel] [RFC PATCH 5/6] hw/ppc/pnv_xscom: retrieve homer/occ base address from PBA BARs Balamuruhan S
2019-08-07  8:01   ` Cédric Le Goater
2019-08-07 10:22     ` Balamuruhan S
2019-08-09  4:45   ` David Gibson
2019-08-07  7:14 ` [Qemu-devel] [RFC PATCH 6/6] hw/ppc/pnv_homer: add python interface support for homer/occ common area Balamuruhan S
2019-08-07 10:27   ` Philippe Mathieu-Daudé
2019-08-11  6:05     ` Balamuruhan S
2019-08-09  4:46   ` David Gibson
2019-08-11  6:19     ` Balamuruhan S
2019-08-07  7:33 ` [Qemu-devel] [RFC PATCH 0/6] Enhancing Qemu MMIO emulation with scripting interface no-reply
2019-08-07  8:15 ` Cédric Le Goater
2019-08-07 10:16   ` Balamuruhan S
2019-08-09  4:49   ` David Gibson
2019-08-12  5:07     ` Balamuruhan S
2019-08-07  8:51 ` no-reply
2019-08-07  9:18 ` no-reply
2019-08-08 10:25 ` Stefan Hajnoczi
2019-08-12  6:03   ` Balamuruhan S

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).