kvm_virtio.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. #ifndef __KVM_S390_VIRTIO_H
  14. #define __KVM_S390_VIRTIO_H
  15. #include <linux/types.h>
  16. struct kvm_device_desc {
  17. /* The device type: console, network, disk etc. Type 0 terminates. */
  18. __u8 type;
  19. /* The number of virtqueues (first in config array) */
  20. __u8 num_vq;
  21. /*
  22. * The number of bytes of feature bits. Multiply by 2: one for host
  23. * features and one for guest acknowledgements.
  24. */
  25. __u8 feature_len;
  26. /* The number of bytes of the config array after virtqueues. */
  27. __u8 config_len;
  28. /* A status byte, written by the Guest. */
  29. __u8 status;
  30. __u8 config[0];
  31. };
  32. /*
  33. * This is how we expect the device configuration field for a virtqueue
  34. * to be laid out in config space.
  35. */
  36. struct kvm_vqconfig {
  37. /* The token returned with an interrupt. Set by the guest */
  38. __u64 token;
  39. /* The address of the virtio ring */
  40. __u64 address;
  41. /* The number of entries in the virtio_ring */
  42. __u16 num;
  43. };
  44. #define KVM_S390_VIRTIO_NOTIFY 0
  45. #define KVM_S390_VIRTIO_RESET 1
  46. #define KVM_S390_VIRTIO_SET_STATUS 2
  47. /* The alignment to use between consumer and producer parts of vring.
  48. * This is pagesize for historical reasons. */
  49. #define KVM_S390_VIRTIO_RING_ALIGN 4096
  50. /* These values are supposed to be in ext_params on an interrupt */
  51. #define VIRTIO_PARAM_MASK 0xff
  52. #define VIRTIO_PARAM_VRING_INTERRUPT 0x0
  53. #define VIRTIO_PARAM_CONFIG_CHANGED 0x1
  54. #define VIRTIO_PARAM_DEV_ADD 0x2
  55. #endif