qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alistair Francis <alistair.francis@xilinx.com>
To: qemu-devel@nongnu.org, peter.maydell@linaro.org
Cc: edgar.iglesias@xilinx.com, alistair.francis@xilinx.com,
	crosthwaitepeter@gmail.com, edgar.iglesias@gmail.com,
	alex.bennee@linaro.org, afaerber@suse.de,
	fred.konrad@greensocs.com
Subject: [Qemu-devel] [PATCH v5 00/15]  data-driven device registers
Date: Tue, 8 Mar 2016 13:06:30 -0800	[thread overview]
Message-ID: <cover.1457470980.git.alistair.francis@xilinx.com> (raw)

This patch series is based on Peter C's original register API. His
original cover letter is below.

Future work: Allow support for memory attributes.

V5:
 - Only create a single memory region instead of a memory region for
   each register
 - General tidyups based on Alex's comments
V4:
 - Rebase and fix build issue
 - Simplify the register write logic
 - Other small fixes suggested by Alex Bennee
V3:
 - Small changes reported by Fred
V2:
 - Rebase
 - Fix up IOU SLCR connections
 - Add the memory_region_add_subregion_no_print() function and use it
   for the registers
Changes since RFC:
 - Connect the ZynqMP IOU SLCR device
 - Rebase

Original cover letter From Peter:
Hi All. This is a new scheme I've come up with handling device registers in a
data driven way. My motivation for this is to factor out a lot of the access
checking that seems to be replicated in every device. See P1 commit message for
further discussion.

P1 is the main patch, adds the register definition functionality
P2-3,6 add helpers that glue the register API to the Memory API
P4 Defines a set of macros that minimise register and field definitions
P5 is QOMfication
P7 is a trivial
P10-13 Work up to GPIO support
P8,9,14 add new devices (the Xilinx Zynq devcfg & ZynqMP SLCR) that use this
        scheme.
P15: Connect the ZynqMP SLCR device

This Zynq devcfg device was particularly finnicky with per-bit restrictions.
I'm also looking for a higher-than-usual modelling fidelity
on the register space, with semantics defined for random reserved bits
in-between otherwise consistent fields.

Here's an example of the qemu_log output for the devcfg device. This is produced
by now generic sharable code:

/machine/unattached/device[44]:Addr 0x000008:CFG: write of value 00000508
/machine/unattached/device[44]:Addr 0x000080:MCTRL: write of value 00800010
/machine/unattached/device[44]:Addr 0x000010:INT_MASK: write of value ffffffff
/machine/unattached/device[44]:Addr 00000000:CTRL: write of value 0c00607f

And an example of a rogue guest banging on a bad bit:

/machine/unattached/device[44]:Addr 0x000014:STATUS bits 0x000001 may not be \
								written to 1

A future feature I am interested in is implementing TCG optimisation of
side-effectless registers. The register API allows clear definition of
what registers have txn side effects and which ones don't. You could even
go a step further and translate such side-effectless accesses based on the
data pointer for the register.


Alistair Francis (7):
  bitops: Add MAKE_64BIT_MASK macro
  register: Add Register API
  register: Add Memory API glue
  register: Add support for decoding information
  dma: Add Xilinx Zynq devcfg device model
  register: Add GPIO API
  xlnx-zynqmp: Connect the ZynqMP IOU SLCR

Peter Crosthwaite (8):
  register: Define REG and FIELD macros
  register: QOMify
  register: Add block initialise helper
  xilinx_zynq: Connect devcfg to the Zynq machine model
  qdev: Define qdev_get_gpio_out
  qdev: Add qdev_pass_all_gpios API
  irq: Add opaque setter routine
  misc: Introduce ZynqMP IOU SLCR

 default-configs/arm-softmmu.mak        |   1 +
 hw/arm/xilinx_zynq.c                   |   8 +
 hw/arm/xlnx-zynqmp.c                   |  13 ++
 hw/core/Makefile.objs                  |   1 +
 hw/core/irq.c                          |   5 +
 hw/core/qdev.c                         |  21 ++
 hw/core/register.c                     | 376 +++++++++++++++++++++++++++++++
 hw/dma/Makefile.objs                   |   1 +
 hw/dma/xlnx-zynq-devcfg.c              | 394 +++++++++++++++++++++++++++++++++
 hw/misc/Makefile.objs                  |   1 +
 hw/misc/xlnx-zynqmp-iou-slcr.c         | 115 ++++++++++
 include/hw/arm/xlnx-zynqmp.h           |   2 +
 include/hw/dma/xlnx-zynq-devcfg.h      |  62 ++++++
 include/hw/irq.h                       |   2 +
 include/hw/misc/xlnx-zynqmp-iou-slcr.h |  47 ++++
 include/hw/qdev-core.h                 |   3 +
 include/hw/register.h                  | 263 ++++++++++++++++++++++
 include/qemu/bitops.h                  |   3 +
 18 files changed, 1318 insertions(+)
 create mode 100644 hw/core/register.c
 create mode 100644 hw/dma/xlnx-zynq-devcfg.c
 create mode 100644 hw/misc/xlnx-zynqmp-iou-slcr.c
 create mode 100644 include/hw/dma/xlnx-zynq-devcfg.h
 create mode 100644 include/hw/misc/xlnx-zynqmp-iou-slcr.h
 create mode 100644 include/hw/register.h

-- 
2.5.0

             reply	other threads:[~2016-03-08 21:09 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-08 21:06 Alistair Francis [this message]
2016-03-08 21:06 ` [Qemu-devel] [PATCH v5 01/15] bitops: Add MAKE_64BIT_MASK macro Alistair Francis
2016-03-22 15:26   ` Alex Bennée
2016-03-08 21:06 ` [Qemu-devel] [PATCH v5 02/15] register: Add Register API Alistair Francis
2016-03-22 16:28   ` Alex Bennée
2016-03-08 21:06 ` [Qemu-devel] [PATCH v5 03/15] register: Add Memory API glue Alistair Francis
2016-03-22 16:56   ` Alex Bennée
2016-03-24 23:03     ` Alistair Francis
2016-03-08 21:06 ` [Qemu-devel] [PATCH v5 04/15] register: Add support for decoding information Alistair Francis
2016-03-22 17:42   ` Alex Bennée
2016-03-24 23:17     ` Alistair Francis
2016-03-08 21:06 ` [Qemu-devel] [PATCH v5 05/15] register: Define REG and FIELD macros Alistair Francis
2016-03-08 21:06 ` [Qemu-devel] [PATCH v5 06/15] register: QOMify Alistair Francis
2016-03-08 21:06 ` [Qemu-devel] [PATCH v5 07/15] register: Add block initialise helper Alistair Francis
2016-03-22 17:11   ` Alex Bennée
2016-03-24 23:28     ` Alistair Francis
2016-03-08 21:06 ` [Qemu-devel] [PATCH v5 08/15] dma: Add Xilinx Zynq devcfg device model Alistair Francis
2016-03-08 21:06 ` [Qemu-devel] [PATCH v5 09/15] xilinx_zynq: Connect devcfg to the Zynq machine model Alistair Francis
2016-03-08 21:06 ` [Qemu-devel] [PATCH v5 10/15] qdev: Define qdev_get_gpio_out Alistair Francis
2016-03-08 21:06 ` [Qemu-devel] [PATCH v5 11/15] qdev: Add qdev_pass_all_gpios API Alistair Francis
2016-03-08 21:06 ` [Qemu-devel] [PATCH v5 12/15] irq: Add opaque setter routine Alistair Francis
2016-03-08 21:07 ` [Qemu-devel] [PATCH v5 13/15] register: Add GPIO API Alistair Francis
2016-03-08 21:07 ` [Qemu-devel] [PATCH v5 14/15] misc: Introduce ZynqMP IOU SLCR Alistair Francis
2016-03-22 17:44 ` [Qemu-devel] [PATCH v5 00/15] data-driven device registers Alex Bennée
2016-03-24 23:43   ` Alistair Francis

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=cover.1457470980.git.alistair.francis@xilinx.com \
    --to=alistair.francis@xilinx.com \
    --cc=afaerber@suse.de \
    --cc=alex.bennee@linaro.org \
    --cc=crosthwaitepeter@gmail.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=edgar.iglesias@xilinx.com \
    --cc=fred.konrad@greensocs.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).