drm/xe/guc: Fix h2g_write usage of GUC_CTB_MSG_MAX_LEN
authorAlan Previn <alan.previn.teres.alexis@intel.com>
Fri, 2 Jun 2023 18:16:50 +0000 (11:16 -0700)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Thu, 21 Dec 2023 16:35:07 +0000 (11:35 -0500)
commitc7fac450dd865d2ad3400a1df0e8655df75a465f
tree33299be8d20264bf90e89b60018fe55316763797
parent44869c72e847e015649ffd4366df88fe529826bb
drm/xe/guc: Fix h2g_write usage of GUC_CTB_MSG_MAX_LEN

In the ABI header, GUC_CTB_MSG_MIN_LEN is '1' because
GUC_CTB_HDR_LEN is 1. This aligns with H2G/G2H CTB specification
where all command formats are defined in units of dwords so that '1'
is a dword. Accordingly, GUC_CTB_MSG_MAX_LEN is 256-1 (i.e. 255
dwords). However, h2g_write was incorrectly assuming that
GUC_CTB_MSG_MAX_LEN was in bytes. Fix this.

v3: Fix nit on #define location.(Matt)
v2: By correctly treating GUC_CTB_MSG_MAX_LEN as dwords, it causes
    a local array to consume 4x the stack size. Rework the function
    to avoid consuming stack even if the action size is large. (Matt)

Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/xe/xe_guc_ct.c