intel_guc_ct.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * Copyright © 2016-2017 Intel Corporation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice (including the next
  12. * paragraph) shall be included in all copies or substantial portions of the
  13. * Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  18. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  20. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  21. * IN THE SOFTWARE.
  22. */
  23. #ifndef _INTEL_GUC_CT_H_
  24. #define _INTEL_GUC_CT_H_
  25. struct intel_guc;
  26. struct i915_vma;
  27. #include "intel_guc_fwif.h"
  28. /**
  29. * DOC: Command Transport (CT).
  30. *
  31. * Buffer based command transport is a replacement for MMIO based mechanism.
  32. * It can be used to perform both host-2-guc and guc-to-host communication.
  33. */
  34. /** Represents single command transport buffer.
  35. *
  36. * A single command transport buffer consists of two parts, the header
  37. * record (command transport buffer descriptor) and the actual buffer which
  38. * holds the commands.
  39. *
  40. * @desc: pointer to the buffer descriptor
  41. * @cmds: pointer to the commands buffer
  42. */
  43. struct intel_guc_ct_buffer {
  44. struct guc_ct_buffer_desc *desc;
  45. u32 *cmds;
  46. };
  47. /** Represents pair of command transport buffers.
  48. *
  49. * Buffers go in pairs to allow bi-directional communication.
  50. * To simplify the code we place both of them in the same vma.
  51. * Buffers from the same pair must share unique owner id.
  52. *
  53. * @vma: pointer to the vma with pair of CT buffers
  54. * @ctbs: buffers for sending(0) and receiving(1) commands
  55. * @owner: unique identifier
  56. * @next_fence: fence to be used with next send command
  57. */
  58. struct intel_guc_ct_channel {
  59. struct i915_vma *vma;
  60. struct intel_guc_ct_buffer ctbs[2];
  61. u32 owner;
  62. u32 next_fence;
  63. };
  64. /** Holds all command transport channels.
  65. *
  66. * @host_channel: main channel used by the host
  67. */
  68. struct intel_guc_ct {
  69. struct intel_guc_ct_channel host_channel;
  70. /* other channels are tbd */
  71. /** @lock: protects pending requests list */
  72. spinlock_t lock;
  73. /** @pending_requests: list of requests waiting for response */
  74. struct list_head pending_requests;
  75. /** @incoming_requests: list of incoming requests */
  76. struct list_head incoming_requests;
  77. /** @worker: worker for handling incoming requests */
  78. struct work_struct worker;
  79. };
  80. void intel_guc_ct_init_early(struct intel_guc_ct *ct);
  81. int intel_guc_ct_enable(struct intel_guc_ct *ct);
  82. void intel_guc_ct_disable(struct intel_guc_ct *ct);
  83. #endif /* _INTEL_GUC_CT_H_ */