xen-pvh-common.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * QEMU Xen PVH machine - common code.
  3. *
  4. * Copyright (c) 2024 Advanced Micro Devices, Inc.
  5. *
  6. * SPDX-License-Identifier: GPL-2.0-or-later
  7. */
  8. #ifndef XEN_PVH_COMMON_H__
  9. #define XEN_PVH_COMMON_H__
  10. #include "exec/memory.h"
  11. #include "qom/object.h"
  12. #include "hw/boards.h"
  13. #include "hw/pci-host/gpex.h"
  14. #include "hw/xen/xen-hvm-common.h"
  15. #define TYPE_XEN_PVH_MACHINE MACHINE_TYPE_NAME("xen-pvh-base")
  16. OBJECT_DECLARE_TYPE(XenPVHMachineState, XenPVHMachineClass,
  17. XEN_PVH_MACHINE)
  18. struct XenPVHMachineClass {
  19. MachineClass parent;
  20. /* PVH implementation specific init. */
  21. void (*init)(MachineState *state);
  22. /*
  23. * set_pci_intx_irq - Deliver INTX irqs to the guest.
  24. *
  25. * @opaque: pointer to XenPVHMachineState.
  26. * @irq: IRQ after swizzling, between 0-3.
  27. * @level: IRQ level.
  28. */
  29. void (*set_pci_intx_irq)(void *opaque, int irq, int level);
  30. /*
  31. * set_pci_link_route: - optional implementation call to setup
  32. * routing between INTX IRQ (0 - 3) and GSI's.
  33. *
  34. * @line: line the INTx line (0 => A .. 3 => B)
  35. * @irq: GSI
  36. */
  37. int (*set_pci_link_route)(uint8_t line, uint8_t irq);
  38. /* Allow implementations to optionally enable buffered ioreqs. */
  39. uint8_t handle_bufioreq;
  40. /*
  41. * Each implementation can optionally enable features that it
  42. * supports and are known to work.
  43. */
  44. bool has_pci;
  45. bool has_tpm;
  46. bool has_virtio_mmio;
  47. };
  48. struct XenPVHMachineState {
  49. /*< private >*/
  50. MachineState parent;
  51. XenIOState ioreq;
  52. struct {
  53. MemoryRegion low;
  54. MemoryRegion high;
  55. } ram;
  56. struct {
  57. GPEXHost gpex;
  58. MemoryRegion mmio_alias;
  59. MemoryRegion mmio_high_alias;
  60. } pci;
  61. struct {
  62. MemMapEntry ram_low, ram_high;
  63. MemMapEntry tpm;
  64. /* Virtio-mmio */
  65. MemMapEntry virtio_mmio;
  66. uint32_t virtio_mmio_num;
  67. uint32_t virtio_mmio_irq_base;
  68. /* PCI */
  69. MemMapEntry pci_ecam, pci_mmio, pci_mmio_high;
  70. uint32_t pci_intx_irq_base;
  71. } cfg;
  72. };
  73. void xen_pvh_class_setup_common_props(XenPVHMachineClass *xpc);
  74. #endif