2
0

smmuv3.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * Copyright (C) 2014-2016 Broadcom Corporation
  3. * Copyright (c) 2017 Red Hat, Inc.
  4. * Written by Prem Mallappa, Eric Auger
  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 as
  8. * published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License along
  16. * with this program; if not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef HW_ARM_SMMUV3_H
  19. #define HW_ARM_SMMUV3_H
  20. #include "hw/arm/smmu-common.h"
  21. #include "qom/object.h"
  22. #define TYPE_SMMUV3_IOMMU_MEMORY_REGION "smmuv3-iommu-memory-region"
  23. typedef struct SMMUQueue {
  24. uint64_t base; /* base register */
  25. uint32_t prod;
  26. uint32_t cons;
  27. uint8_t entry_size;
  28. uint8_t log2size;
  29. } SMMUQueue;
  30. struct SMMUv3State {
  31. SMMUState smmu_state;
  32. uint32_t features;
  33. uint8_t sid_size;
  34. uint8_t sid_split;
  35. uint32_t idr[6];
  36. uint32_t iidr;
  37. uint32_t aidr;
  38. uint32_t cr[3];
  39. uint32_t cr0ack;
  40. uint32_t statusr;
  41. uint32_t gbpa;
  42. uint32_t irq_ctrl;
  43. uint32_t gerror;
  44. uint32_t gerrorn;
  45. uint64_t gerror_irq_cfg0;
  46. uint32_t gerror_irq_cfg1;
  47. uint32_t gerror_irq_cfg2;
  48. uint64_t strtab_base;
  49. uint32_t strtab_base_cfg;
  50. uint64_t eventq_irq_cfg0;
  51. uint32_t eventq_irq_cfg1;
  52. uint32_t eventq_irq_cfg2;
  53. SMMUQueue eventq, cmdq;
  54. qemu_irq irq[4];
  55. QemuMutex mutex;
  56. char *stage;
  57. };
  58. typedef enum {
  59. SMMU_IRQ_EVTQ,
  60. SMMU_IRQ_PRIQ,
  61. SMMU_IRQ_CMD_SYNC,
  62. SMMU_IRQ_GERROR,
  63. } SMMUIrq;
  64. struct SMMUv3Class {
  65. /*< private >*/
  66. SMMUBaseClass smmu_base_class;
  67. /*< public >*/
  68. DeviceRealize parent_realize;
  69. ResettablePhases parent_phases;
  70. };
  71. #define TYPE_ARM_SMMUV3 "arm-smmuv3"
  72. OBJECT_DECLARE_TYPE(SMMUv3State, SMMUv3Class, ARM_SMMUV3)
  73. #define STAGE1_SUPPORTED(s) FIELD_EX32(s->idr[0], IDR0, S1P)
  74. #define STAGE2_SUPPORTED(s) FIELD_EX32(s->idr[0], IDR0, S2P)
  75. #endif