hab_qvm.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef __HAB_QNX_H
  7. #define __HAB_QNX_H
  8. #include "hab.h"
  9. #include "hab_pipe.h"
  10. #include "hab_qvm_os.h"
  11. struct qvm_channel {
  12. int be;
  13. struct hab_pipe *pipe;
  14. struct hab_pipe_endpoint *pipe_ep;
  15. struct hab_shared_buf *tx_buf;
  16. struct hab_shared_buf *rx_buf;
  17. struct dbg_items *dbg_itms;
  18. spinlock_t io_lock;
  19. /* common but only for guest */
  20. struct guest_shm_factory *guest_factory;
  21. struct guest_shm_control *guest_ctrl;
  22. /* cached guest ctrl idx value to prevent trap when accessed */
  23. uint32_t idx;
  24. /* Guest VM */
  25. unsigned int guest_intr;
  26. unsigned int guest_iid;
  27. unsigned int factory_addr;
  28. unsigned int irq;
  29. /* os-specific part */
  30. struct qvm_channel_os *os_data;
  31. /* debug only */
  32. struct workqueue_struct *wq;
  33. struct work_data {
  34. struct work_struct work;
  35. int data; /* free to modify */
  36. } wdata;
  37. char *side_buf; /* to store the contents from hab-pipe */
  38. };
  39. /* This is common but only for guest in HQX */
  40. struct shmem_irq_config {
  41. unsigned long factory_addr; /* from gvm settings when provided */
  42. int irq; /* from gvm settings when provided */
  43. };
  44. struct qvm_plugin_info {
  45. struct shmem_irq_config *pchan_settings;
  46. int setting_size;
  47. int curr;
  48. int probe_cnt;
  49. };
  50. extern struct qvm_plugin_info qvm_priv_info;
  51. /* Shared mem size in each direction for communication pipe */
  52. #define PIPE_SHMEM_SIZE (512 * 1024)
  53. void hab_pipe_reset(struct physical_channel *pchan);
  54. void habhyp_notify(void *commdev);
  55. unsigned long hab_shmem_factory_va(unsigned long factory_addr);
  56. char *hab_shmem_attach(struct qvm_channel *dev, const char *name,
  57. uint32_t pages);
  58. uint64_t get_guest_ctrl_paddr(struct qvm_channel *dev,
  59. unsigned long factory_addr, int irq, const char *name, uint32_t pages);
  60. #endif /* __HAB_QNX_H */