FAILED: patch "[PATCH] drm/amd/amdgpu: apply command submission parser for JPEG v1" failed to apply to 5.15-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x 8409fb50ce48d66cf9dc5391f03f05c56c430605
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024091428-baffling-wound-9fa1@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^..
Possible dependencies:
8409fb50ce48 ("drm/amd/amdgpu: apply command submission parser for JPEG v1")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 8409fb50ce48d66cf9dc5391f03f05c56c430605 Mon Sep 17 00:00:00 2001
From: "David (Ming Qiang) Wu" <[email protected]>
Date: Thu, 5 Sep 2024 16:57:28 -0400
Subject: [PATCH] drm/amd/amdgpu: apply command submission parser for JPEG v1
Similar to jpeg_v2_dec_ring_parse_cs() but it has different register ranges and a few other registers access.
drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c +75 -1
@@ -23,6 +23,7 @@#include "amdgpu.h" #include "amdgpu_jpeg.h" +#include "amdgpu_cs.h" #include "soc15.h" #include "soc15d.h" #include "vcn_v1_0.h"
@@ -34,6 +35,9 @@static void jpeg_v1_0_set_dec_ring_funcs (struct amdgpu_device *adev);static void jpeg_v1_0_set_irq_funcs (struct amdgpu_device *adev);static void jpeg_v1_0_ring_begin_use (struct amdgpu_ring *ring); +static int jpeg_v1_dec_ring_parse_cs (struct amdgpu_cs_parser *parser, +struct amdgpu_job *job, +struct amdgpu_ib *ib);static void jpeg_v1_0_decode_ring_patch_wreg (struct amdgpu_ring *ring,uint32_t *ptr,uint32_t reg_offset,uint32_t val) {
@@ -300,7 +304,10 @@ static void jpeg_v1_0_decode_ring_emit_ib(struct amdgpu_ring *ring,amdgpu_ring_write (ring,PACKETJ (SOC15_REG_OFFSET (JPEG ,0 , mmUVD_LMI_JRBC_IB_VMID),0 ,0 ,PACKETJ_TYPE0 )); -amdgpu_ring_write (ring, (vmid | (vmid <<4 ))); +if (ring->funcs->parse_cs) +amdgpu_ring_write (ring,0 ); +else +amdgpu_ring_write (ring, (vmid | (vmid <<4 )));amdgpu_ring_write (ring,PACKETJ (SOC15_REG_OFFSET (JPEG ,0 , mmUVD_LMI_JPEG_VMID),0 ,0 ,PACKETJ_TYPE0 ));
@@ -554,6 +561,7 @@ static const struct amdgpu_ring_funcs jpeg_v1_0_decode_ring_vm_funcs = { .get_rptr = jpeg_v1_0_decode_ring_get_rptr, .get_wptr = jpeg_v1_0_decode_ring_get_wptr, .set_wptr = jpeg_v1_0_decode_ring_set_wptr, + .parse_cs = jpeg_v1_dec_ring_parse_cs, .emit_frame_size =6 +6 +/* hdp invalidate / flush */ SOC15_FLUSH_GPU_TLB_NUM_WREG * 6 +
@@ -611,3 +619,69 @@ static void jpeg_v1_0_ring_begin_use(struct amdgpu_ring *ring)vcn_v1_0_set_pg_for_begin_use (ring, set_clocks); } + +/** +* jpeg_v1_dec_ring_parse_cs - command submission parser +* +* @parser: Command submission parser context +* @job: the job to parse +* @ib: the IB to parse +* +* Parse the command stream, return -EINVAL for invalid packet, +* 0 otherwise +*/ +static int jpeg_v1_dec_ring_parse_cs (struct amdgpu_cs_parser *parser, +struct amdgpu_job *job, +struct amdgpu_ib *ib) +{ +u32 i, reg, res, cond, type; +int ret =0 ; +struct amdgpu_device *adev = parser->adev; + +for (i =0 ; i < ib->length_dw ; i +=2 ) { + reg =CP_PACKETJ_GET_REG (ib->ptr[i]); + res =CP_PACKETJ_GET_RES (ib->ptr[i]); + cond =CP_PACKETJ_GET_COND (ib->ptr[i]); + type =CP_PACKETJ_GET_TYPE (ib->ptr[i]); + +if (res || cond !=PACKETJ_CONDITION_CHECK0 )/* only allow 0 for now */ +return -EINVAL ; + +if (reg >=JPEG_V1_REG_RANGE_START && reg <=JPEG_V1_REG_RANGE_END ) +continue ; + +switch (type) { +case PACKETJ_TYPE0 : +if (reg !=JPEG_V1_LMI_JPEG_WRITE_64BIT_BAR_HIGH && + reg !=JPEG_V1_LMI_JPEG_WRITE_64BIT_BAR_LOW && + reg !=JPEG_V1_LMI_JPEG_READ_64BIT_BAR_HIGH && + reg !=JPEG_V1_LMI_JPEG_READ_64BIT_BAR_LOW && + reg !=JPEG_V1_REG_CTX_INDEX && + reg !=JPEG_V1_REG_CTX_DATA ) { + ret = -EINVAL ; + } +break ; +case PACKETJ_TYPE1 : +if (reg !=JPEG_V1_REG_CTX_DATA ) + ret = -EINVAL ; +break ; +case PACKETJ_TYPE3 : +if (reg !=JPEG_V1_REG_SOFT_RESET ) + ret = -EINVAL ; +break ; +case PACKETJ_TYPE6 : +if (ib->ptr[i] !=CP_PACKETJ_NOP ) + ret = -EINVAL ; +break ; +default : + ret = -EINVAL ; + } + +if (ret) { +dev_err (adev->dev,"Invalid packet [0x%08x]!\n" , ib->ptr[i]); +break ; + } + } + +return ret; +}
drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.h +11 -0
@@ -29,4 +29,15 @@ int jpeg_v1_0_sw_init(void *handle);void jpeg_v1_0_sw_fini (void *handle);void jpeg_v1_0_start (struct amdgpu_device *adev,int mode); +#define JPEG_V1_REG_RANGE_START 0x8000 +#define JPEG_V1_REG_RANGE_END 0x803f + +#define JPEG_V1_LMI_JPEG_WRITE_64BIT_BAR_HIGH 0x8238 +#define JPEG_V1_LMI_JPEG_WRITE_64BIT_BAR_LOW 0x8239 +#define JPEG_V1_LMI_JPEG_READ_64BIT_BAR_HIGH 0x825a +#define JPEG_V1_LMI_JPEG_READ_64BIT_BAR_LOW 0x825b +#define JPEG_V1_REG_CTX_INDEX 0x8328 +#define JPEG_V1_REG_CTX_DATA 0x8329 +#define JPEG_V1_REG_SOFT_RESET 0x83a0 +#endif /*__JPEG_V1_0_H__*/