2
1

0001-include-uapi-linux-xlnx-ai-engine.h-fix-CONFIG_XILIN.patch 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. From 333678d7b9edc29e8148411d48f70950b1b614c1 Mon Sep 17 00:00:00 2001
  2. From: Neal Frager <neal.frager@amd.com>
  3. Date: Mon, 2 Jun 2025 11:07:03 +0100
  4. Subject: [PATCH] include/uapi/linux/xlnx-ai-engine.h: fix
  5. CONFIG_XILINX_AIE leak
  6. Linux Kconfig options should not be exposed to user space. This patch fixes
  7. a Linux kernel leak of the CONFIG_XILINX_AIE option by moving the changes
  8. implemented by the CONFIG_XILINX_AIE from the uapi header file to the local
  9. Linux kernel header file.
  10. Upstream: internal AMD jira process
  11. Signed-off-by: Neal Frager <neal.frager@amd.com>
  12. ---
  13. include/linux/xlnx-ai-engine.h | 37 +++++++++++++++++++++++++
  14. include/uapi/linux/xlnx-ai-engine.h | 42 -----------------------------
  15. 2 files changed, 37 insertions(+), 42 deletions(-)
  16. diff --git a/include/linux/xlnx-ai-engine.h b/include/linux/xlnx-ai-engine.h
  17. index 44a1e40ef9b8..10905dc84ae9 100644
  18. --- a/include/linux/xlnx-ai-engine.h
  19. +++ b/include/linux/xlnx-ai-engine.h
  20. @@ -171,6 +171,13 @@ static inline u32 aie_get_error_category(struct aie_error *err)
  21. return err->category;
  22. }
  23. +int aie_partition_write_privileged_mem(struct device *dev, size_t offset, size_t len, void *data);
  24. +int aie_partition_read_privileged_mem(struct device *dev, size_t offset, size_t len, void *data);
  25. +bool aie_partition_check_noc_aximm(struct device *dev, struct aie_location *loc);
  26. +int aie_partition_check_uc_aximm(struct device *dev, struct aie_location *loc);
  27. +int aie_partition_uc_zeroize_mem(struct device *dev, struct aie_location *loc, u32 regval);
  28. +int aie_load_cert(struct device *dev, unsigned char *elf_addr);
  29. +
  30. #else
  31. static inline bool aie_partition_is_available(struct aie_partition_req *req)
  32. {
  33. @@ -271,5 +278,35 @@ static inline int aie_part_rscmgr_set_static_range(struct device *dev,
  34. return -EINVAL;
  35. }
  36. +int aie_partition_write_privileged_mem(struct device *dev, size_t offset, size_t len, void *data)
  37. +{
  38. + return -EINVAL;
  39. +}
  40. +
  41. +int aie_partition_read_privileged_mem(struct device *dev, size_t offset, size_t len, void *data)
  42. +{
  43. + return -EINVAL;
  44. +}
  45. +
  46. +bool aie_partition_check_noc_aximm(struct device *dev, struct aie_location *loc)
  47. +{
  48. + return false;
  49. +}
  50. +
  51. +int aie_partition_check_uc_aximm(struct device *dev, struct aie_location *loc)
  52. +{
  53. + return 0;
  54. +}
  55. +
  56. +int aie_partition_uc_zeroize_mem(struct device *dev, struct aie_location *loc, u32 regval)
  57. +{
  58. + return -EINVAL;
  59. +}
  60. +
  61. +int aie_load_cert(struct device *dev, unsigned char *elf_addr)
  62. +{
  63. + return -EINVAL;
  64. +}
  65. +
  66. #endif /* CONFIG_XILINX_AIE */
  67. #endif
  68. diff --git a/include/uapi/linux/xlnx-ai-engine.h b/include/uapi/linux/xlnx-ai-engine.h
  69. index 424c5f4c4097..1680aed8ad85 100644
  70. --- a/include/uapi/linux/xlnx-ai-engine.h
  71. +++ b/include/uapi/linux/xlnx-ai-engine.h
  72. @@ -781,47 +781,5 @@ struct aie_rsc_user_stat_array {
  73. */
  74. #define AIE_UPDATE_SHIMDMA_DMABUF_BD_ADDR_IOCTL _IOW(AIE_IOCTL_BASE, 0x1e, \
  75. struct aie_dmabuf_bd_args)
  76. -#if IS_ENABLED(CONFIG_XILINX_AIE)
  77. -
  78. -int aie_partition_write_privileged_mem(struct device *dev, size_t offset, size_t len, void *data);
  79. -int aie_partition_read_privileged_mem(struct device *dev, size_t offset, size_t len, void *data);
  80. -bool aie_partition_check_noc_aximm(struct device *dev, struct aie_location *loc);
  81. -int aie_partition_check_uc_aximm(struct device *dev, struct aie_location *loc);
  82. -int aie_partition_uc_zeroize_mem(struct device *dev, struct aie_location *loc, u32 regval);
  83. -int aie_load_cert(struct device *dev, unsigned char *elf_addr);
  84. -
  85. -#else /* IS_ENABLED(CONFIG_XILINX_AIE) */
  86. -
  87. -int aie_partition_write_privileged_mem(struct device *dev, size_t offset, size_t len, void *data)
  88. -{
  89. - return -EINVAL;
  90. -}
  91. -
  92. -int aie_partition_read_privileged_mem(struct device *dev, size_t offset, size_t len, void *data)
  93. -{
  94. - return -EINVAL;
  95. -}
  96. -
  97. -bool aie_partition_check_noc_aximm(struct device *dev, struct aie_location *loc)
  98. -{
  99. - return false;
  100. -}
  101. -
  102. -int aie_partition_check_uc_aximm(struct device *dev, struct aie_location *loc)
  103. -{
  104. - return 0;
  105. -}
  106. -
  107. -int aie_partition_uc_zeroize_mem(struct device *dev, struct aie_location *loc, u32 regval)
  108. -{
  109. - return -EINVAL;
  110. -}
  111. -
  112. -int aie_load_cert(struct device *dev, unsigned char *elf_addr)
  113. -{
  114. - return -EINVAL;
  115. -}
  116. -
  117. -#endif /* IS_ENABLED(CONFIG_XILINX_AIE) */
  118. #endif
  119. --
  120. 2.25.1