GNU Linux-libre 4.14.266-gnu1
[releases.git] / arch / s390 / include / uapi / asm / kvm_virtio.h
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  * definition for virtio for kvm on s390
4  *
5  * Copyright IBM Corp. 2008
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License (version 2 only)
9  * as published by the Free Software Foundation.
10  *
11  *    Author(s): Christian Borntraeger <borntraeger@de.ibm.com>
12  */
13
14 #ifndef __KVM_S390_VIRTIO_H
15 #define __KVM_S390_VIRTIO_H
16
17 #include <linux/types.h>
18
19 struct kvm_device_desc {
20         /* The device type: console, network, disk etc.  Type 0 terminates. */
21         __u8 type;
22         /* The number of virtqueues (first in config array) */
23         __u8 num_vq;
24         /*
25          * The number of bytes of feature bits.  Multiply by 2: one for host
26          * features and one for guest acknowledgements.
27          */
28         __u8 feature_len;
29         /* The number of bytes of the config array after virtqueues. */
30         __u8 config_len;
31         /* A status byte, written by the Guest. */
32         __u8 status;
33         __u8 config[0];
34 };
35
36 /*
37  * This is how we expect the device configuration field for a virtqueue
38  * to be laid out in config space.
39  */
40 struct kvm_vqconfig {
41         /* The token returned with an interrupt. Set by the guest */
42         __u64 token;
43         /* The address of the virtio ring */
44         __u64 address;
45         /* The number of entries in the virtio_ring */
46         __u16 num;
47
48 };
49
50 #define KVM_S390_VIRTIO_NOTIFY          0
51 #define KVM_S390_VIRTIO_RESET           1
52 #define KVM_S390_VIRTIO_SET_STATUS      2
53
54 /* The alignment to use between consumer and producer parts of vring.
55  * This is pagesize for historical reasons. */
56 #define KVM_S390_VIRTIO_RING_ALIGN      4096
57
58
59 /* These values are supposed to be in ext_params on an interrupt */
60 #define VIRTIO_PARAM_MASK               0xff
61 #define VIRTIO_PARAM_VRING_INTERRUPT    0x0
62 #define VIRTIO_PARAM_CONFIG_CHANGED     0x1
63 #define VIRTIO_PARAM_DEV_ADD            0x2
64
65 #endif