kvm_virtio.h 1.7 KB

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