qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: "Steffen Görtz" <contrib@steffen-goertz.de>
Cc: qemu-devel@nongnu.org, Joel Stanley <joel@jms.id.au>,
	Jim Mussared <jim@groklearning.com>,
	Julia Suvorova <jusual@mail.ru>,
	Peter Maydell <peter.maydell@linaro.org>,
	Eric Blake <eblake@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	"open list:ARM" <qemu-arm@nongnu.org>,
	Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [RFC v3] qapi: command category to stimulate high-level machine devices
Date: Mon, 4 Jun 2018 10:20:08 +0100	[thread overview]
Message-ID: <20180604092008.GA13674@stefanha-x1.localdomain> (raw)
In-Reply-To: <20180603203412.11033-1-contrib@steffen-goertz.de>

[-- Attachment #1: Type: text/plain, Size: 3737 bytes --]

On Sun, Jun 03, 2018 at 04:34:12PM -0400, Steffen Görtz wrote:
> Changes in v2:
>   - Remove stray 1
> 
> Changes in v1:
>   - Fix coding style issues
> 
> Add a new category "stimulate" to host commands that
> act upon high-level devices associated with machines/boards.
> 
> This is patch is part of an effort to add support for BBC:microbit
> educational computer to QEMU.
> 
> The microbit board, as many other microcontroller boards,
> contains typical trivial (digital) input and output options such as buttons and LEDs,
> but also more sophiscated possibilities such as analog inputs and
> complex dedicated sensor ICs that are connected to the microbit machine
> by means of inter-ic bus (i2c).
> These devices interact with peripheral devices of the microcontroller
> in use, for example with the GPIO peripheral of the used NRF51.
> 
> One aim of our efforts is to create a user interface that models the
> look and feel of the physical microbit board and lets the user interact
> with its inputs and provide feedback on its outsputs.
> 
> For this it is necessary to transmit user inputs such as the pressing of a
> button to the machine.
> In return, when the state of an output is changed on the machine, this
> change needs to be reflected in the user interface.
> 
> At the moment, there are only a few QMP commands that provide user input to the
> machine, eg. send-keys, input-button. These commands require very

QMP command names (from qapi/ui.json): send-key and input-send-event.

> high-level concepts, which are not really suitable for applications that
> microcontrollers are typically used in in.

I agree that existing commands aren't suitable.  They are tied to
QemuConsole, which makes sense for graphics + keyboard/mouse input
devices but doesn't exist for microcontrollers.

I have CCed Gerd Hoffmann, the ui/ maintainer, to see if he agrees.

> This RFC is meant to start a discussion on how to provide stimuli to
> low-complex inputs and outputs typically found in embedded
> microcontroller applications. To the best of my knowledge, there are
> currently no examples of how to provide such stimuli to either SoC
> device peripheral or machine level concepts like pushbuttons and LEDs.
> 
> To my understanding, the following concepts/apis are needed:
> - QMP commands to send stimuli to machine level concepts like
> pushbuttons
> - Machine level devices that receive these stimuli and act as an adapter
> to manipulate the associated SoC peripheral devices

The QEMU Object Model offers "interfaces".  Many object-oriented
programming languages have similar concepts (interfaces, virtual base
classes, etc).

Interfaces could be used to connect board-specific devices with the
monitor command.  But this is an implementation detail, we first need to
agree on the API design.

> - For outputs, machine level devices are needed that observe changes in
> SoC peripherals and emit QMP events that clients can receive
> 
> This patch adds a new qmp command "buttons-set-state" to update the
> push-down state of arbitrarily identified buttons (string identifier).

Can you list the types of devices that can consume events?

 * Pushbutton
 * GPIO input pin
 * Analog-to-digital converter
 * Temperature sensor
 * Accelerometer
 * Magnetometer
 * LED voltage decay light sensing
 * ?

And list the types of devices that can produce events?

 * LED states
 * GPIO output pin
 * Digital-to-analog converter
 * ?

Many of these inputs/outputs can be tied to an external UI.  A degree of
timing precision is required so that the UI is responsive, although
cycle-accurate timing is not what I'd expect from QMP.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

  parent reply	other threads:[~2018-06-04  9:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-03 20:34 [Qemu-devel] [RFC v3] qapi: command category to stimulate high-level machine devices Steffen Görtz
2018-06-03 20:41 ` no-reply
2018-06-03 20:42 ` no-reply
2018-06-04  9:20 ` Stefan Hajnoczi [this message]
2018-06-04  9:29   ` Peter Maydell
2018-06-04 10:12     ` Gerd Hoffmann
2018-06-07 10:24       ` Stefan Hajnoczi
2018-06-07 10:33         ` Daniel P. Berrangé
2018-06-08  7:58           ` Stefan Hajnoczi
2018-06-07 12:58         ` Gerd Hoffmann
2018-06-08  8:01           ` Stefan Hajnoczi
2018-06-04  9:56   ` Gerd Hoffmann

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=20180604092008.GA13674@stefanha-x1.localdomain \
    --to=stefanha@gmail.com \
    --cc=armbru@redhat.com \
    --cc=contrib@steffen-goertz.de \
    --cc=eblake@redhat.com \
    --cc=jim@groklearning.com \
    --cc=joel@jms.id.au \
    --cc=jusual@mail.ru \
    --cc=kraxel@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.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).