public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Avi Kivity <avi@redhat.com>
Cc: Alexander Graf <agraf@suse.de>,
	virtualization@lists.linux-foundation.org,
	Rusty Russell <rusty@rustcorp.com.au>,
	Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>,
	Carsten Otte <carsteno@de.ibm.com>,
	KVM list <kvm@vger.kernel.org>
Subject: Re: [PATCH 1/2] S390: take a full byte as ext_param indicator
Date: Tue, 24 Aug 2010 15:24:16 +0200	[thread overview]
Message-ID: <4C73C800.4020000@de.ibm.com> (raw)
In-Reply-To: <4C73B97E.2060303@redhat.com>

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

Am 24.08.2010 14:22, schrieb Avi Kivity:
> First of all we need a virtio/s390 specification, like we have a
> virtio/pci spec.

Here is something that I started a year ago but never finished.

Christian





[-- Attachment #2: virtio.txt --]
[-- Type: text/plain, Size: 9520 bytes --]

guest/host interface for s390/virtio devices

            KVM_DEVICE_DESCRIPTOR PAGE
                0        8        16       24    31
              +--------+--------+--------+--------+
            0 | type   | num_vq | featlen| conflen|
              +--------+--------+--------+--------+
            1 | status |                          |
              +--------+                          +------>+
            2 |                 config            |       |
              +                                   +       |
                            ...                           |
                                                          |
    +-----------------------------------------------------+
    |
    |       CONFIG ARRAY
    |           0        8        16       24    31
    +-------->+--------+--------+--------+--------+
            0 |                                   |
              +                                   +
            1 |                                   |
              +                                   +
            2 |                                   |
              +    virtqueue 0                    +------>+
            3 |                                   |       |
              +                                   +       |
            4 |                                   |       |
              +                                   +       |
            5 |                                   |       |
              +--------+--------+--------+--------+       |
              |///////////////////////////////////+       |
              |///////////////////////////////////+       |
              +--------+--------+--------+--------+       |
              |                                   |       |
              +                                   +       |
              |                                   |       |
              +                                   +       |
              |                                   |       |
              +    virtqueue num_vq - 1           +------>+
              |                                   |       |
              +                                   +       |
              |                                   |       |
              +                                   +       |
              |                                   |       |
              +--------+--------+--------+--------+       |
     num_vq*6 | feature bits  (featlen * 2 Bytes) |       |
              +                 +--------+--------+       |
              |                 |                 |       |
              +--------+--------+                 +       |
              | config space (conflen Bytes)      |       |
              +                          +--------+       |
              |                          |                |
              +--------+--------+--------+                |
                                                          |
                                                          |
    +-----------------------------------------------------+
    |
    |       VIRTQUEUE
    |          0        8        16       24    31
    |-------->+--------+--------+--------+--------+
            0 |     interrupt token ...           |
              +                                   +
            1 |     ... set by guest              |
              +--------+--------+--------+--------+
            2 |     virtio ring address           |
              +                                   +
            3 |     ... set by host               |
              +--------+--------+--------+--------+
            4 | number of elems |/////////////////+
              +--------+--------+/////////////////+
            5 |///////////////////////////////////+
              +--------+--------+--------+--------+



            COMPLETE KVM_DEVICE_DESCRIPTOR PAGE
                0        8        16       24    31
              +--------+--------+--------+--------+
            0 | type   | num_vq | featlen| conflen|
              +--------+--------+--------+--------+
            1 | status |  interrupt token         |
              +--------+                          +
            2 | virtqueue 0(set by guest)         |
              +        +--------+--------+--------+
            3 |        | virtio ring address      |
              +--------+                          +
            4 | virtqueue 0 (set by host)         |
              +        +--------+--------+--------+
            5 |        | number of descr |////////|
              +--------+--------+--------+////////+
            6 |///////////////////////////////////|
              +////////+--------+--------+--------+
            7 |////////|   interrupt token        |
              +--------+                          +
            8 | virtqueue 1(set by guest)         |
              +        +--------+--------+--------+
            9 |        | virtio ring address      |
              +--------+                          +
           10 | virtqueue 1 (set by host)         |
              +        +--------+--------+--------+
           11 |        | number of descr |////////|
              +--------+--------+--------+////////+
           12 |///////////////////////////////////|
              +////////+--------+--------+--------+
           13 |////////|
              +--------+      .....

            ? |///////////////////////////////////|
              +////////+--------+--------+--------+
            ? |////////| feature bits             |
              +--------+ (size multiple  +--------+
              |          of 2 bytes)     |        |
              +--------+--------+--------+        +
              | config space (size of any length) |
              +                 +++++++++++++++++++
              |                 |
              +--------+--------+




Host->Guest notification:
-------------------------

via external interrupt with
- real storage 0x86-0x87 : 0x2603  --> host interrupt
- real storage 0x84: 0xd --> VIRTIO_SUBCODE_64
- real storage 0x11B8-0x11bf: the interrupt token (is a pointer to a struct virtqueue -> set by guest)
- real storage 0x83:
   0: normal interrupt
   1: config change

Guest->Host notification:
-------------------------
via  diagnose call:

diag 2,4,0x500\n"

 The calling convention is similar to the
 * s390 ABI, so we use R2-R6 for parameters 1-5. In addition we use R1
 * as hypercall number and R7 as parameter 6. The return value is
 * written to R2. We use the diagnose instru

hypercall numbers are
#define KVM_S390_VIRTIO_NOTIFY          0
#define KVM_S390_VIRTIO_RESET           1
#define KVM_S390_VIRTIO_SET_STATUS      2



Virtio Ring: (3Pages)
---------------------

                0        8        16       24    31
              +--------+--------+--------+--------+\
            0 |  Desriptor 0:                     | \
              +  guest physical address           +  \
            1 |                                   |   \
              +--------+--------+--------+--------+     one descriptor
            2 | Descriptor 0: Length              |   /
              +--------+--------+--------+--------+  /
            3 |   D0: Flags     |   D0: Next      | /
              +--------+--------+--------+--------+/
              |                                   |
                              ...
              |                                   |
              +--------+--------+--------+--------+
            0 |       Descriptor num -1           |
              +  - guest physical address 64bit   +
            1 |  - Length 32bit                   |
              +  - flags 16 bit                   +
            2 |  - next 16 bit                    |
              +                                   +
            3 |                                   |
              +--------+--------+--------+--------+
              |///////////////////////////////////|
                                ...
              |///////////////////////////////////|
              +--------+--------+--------+--------+
         4096 |   avail_flags   |    avail_idx    |
              +--------+--------+--------+--------+
         4097 |  available 0    |   available 1   |
              +--------+--------+--------+--------+
              |                                   |
                               ...
              |                                   |
              +--------+--------+--------+--------+
              | available num-2 | available num-1 |
              +--------+--------+--------+--------+
              |///////////////////////////////////|
                                ...
              |///////////////////////////////////|
              +--------+--------+--------+--------+
         8192 |   used_flags    | used_idx        |
              +--------+--------+--------+--------+
              | used_elem_id 0                    |
              +--------+--------+--------+--------+
              | used_elem_len 0                   |
              +--------+--------+--------+--------+
              |                                   |
                               ...
              |                                   |
              +--------+--------+--------+--------+
              | used_elem_id num-1                |
              +--------+--------+--------+--------+
              | used_elem_len num-1               |
              +--------+--------+--------+--------+



      parent reply	other threads:[~2010-08-24 13:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-23 21:31 [PATCH 1/2] S390: take a full byte as ext_param indicator Alexander Graf
2010-08-23 21:31 ` [PATCH 2/2] S390: Add virtio hotplug add support Alexander Graf
2010-08-24  7:13   ` Christian Borntraeger
2010-08-24  7:03 ` [PATCH 1/2] S390: take a full byte as ext_param indicator Christian Borntraeger
2010-08-24 12:06   ` Alexander Graf
2010-08-24 12:14     ` Christian Borntraeger
2010-08-24 12:22       ` Avi Kivity
2010-08-24 12:25         ` Alexander Graf
2010-08-24 12:30           ` Avi Kivity
2010-08-24 12:32             ` Alexander Graf
2010-08-24 12:35               ` Avi Kivity
2010-08-24 13:24         ` Christian Borntraeger [this message]

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=4C73C800.4020000@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=agraf@suse.de \
    --cc=avi@redhat.com \
    --cc=carsteno@de.ibm.com \
    --cc=ehrhardt@linux.vnet.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=virtualization@lists.linux-foundation.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