FAILED: patch "[PATCH] drm/amdgpu: sign extend the addresses GEM_OP(GET_MAPPING_INFO) returns" failed to apply to 6.18-stable tree
Subsystems (3)
Sasha Levin
maintainerThe patch below does not apply to the 6.18-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-6.18.y
git checkout FETCH_HEAD
git cherry-pick -x 37cfaaa6b5e9448ef786342d470d0e0b8eb89fa6
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 37cfaaa6b5e9448ef786342d470d0e0b8eb89fa6 Mon Sep 17 00:00:00 2001
From: Jesse Zhang <[email protected]>
Date: Tue, 20 Oct 2026 10:15:22 +0800
Subject: [PATCH] drm/amdgpu: sign extend the addresses
GEM_OP(GET_MAPPING_INFO) returns
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
GEM_VA takes the GPU virtual addresses above the VA hole sign extended, like the rest of the UAPI, but GET_MAPPING_INFO reports them without the upper bits, so they land in the hole. Mappings in the upper half of the address space can't be recreated or removed with what it returns. On navi31:
MAP at 0xffff800100000000 -> 0 GET_MAPPING_INFO -> addr 0x800100000000 UNMAP at 0x800100000000 -> -EINVAL
Sign extend the addresses before handing them out.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +5 -2
@@ -1064,6 +1064,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,int amdgpu_gem_op_ioctl (struct drm_device *dev,void *data,struct drm_file *filp) { +struct amdgpu_device *adev =drm_to_adev (dev);struct drm_amdgpu_gem_op *args = data;struct drm_gem_object *gobj;struct amdgpu_vm_bo_base *base;
@@ -1170,7 +1171,8 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data,amdgpu_vm_bo_va_for_each_valid_mapping (bo_va, mapping) {if (num_mappings < args->num_entries) { - vm_entries[num_mappings].addr = mapping->start *AMDGPU_GPU_PAGE_SIZE ; + vm_entries[num_mappings].addr = +amdgpu_gmc_sign_extend (mapping->start *AMDGPU_GPU_PAGE_SIZE ); vm_entries[num_mappings].size = (mapping->last - mapping->start +1 ) *AMDGPU_GPU_PAGE_SIZE ; vm_entries[num_mappings].offset = mapping->offset; vm_entries[num_mappings].flags = mapping->flags;
@@ -1180,7 +1182,8 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data,amdgpu_vm_bo_va_for_each_invalid_mapping (bo_va, mapping) {if (num_mappings < args->num_entries) { - vm_entries[num_mappings].addr = mapping->start *AMDGPU_GPU_PAGE_SIZE ; + vm_entries[num_mappings].addr = +amdgpu_gmc_sign_extend (mapping->start *AMDGPU_GPU_PAGE_SIZE ); vm_entries[num_mappings].size = (mapping->last - mapping->start +1 ) *AMDGPU_GPU_PAGE_SIZE ; vm_entries[num_mappings].offset = mapping->offset; vm_entries[num_mappings].flags = mapping->flags;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 drm/amdgpu: sign extend the addresses GEM_OP(GET_MAPPING_INFO) returns
From: Jesse Zhang <[email protected]>
[ Upstream commit 37cfaaa6b5e9448ef786342d470d0e0b8eb89fa6 ]
GEM_VA takes the GPU virtual addresses above the VA hole sign extended, like the rest of the UAPI, but GET_MAPPING_INFO reports them without the upper bits, so they land in the hole. Mappings in the upper half of the address space can't be recreated or removed with what it returns. On navi31:
MAP at 0xffff800100000000 -> 0 GET_MAPPING_INFO -> addr 0x800100000000 UNMAP at 0x800100000000 -> -EINVAL
Sign extend the addresses before handing them out.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +4 -2
@@ -1118,7 +1118,8 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data,amdgpu_vm_bo_va_for_each_valid_mapping (bo_va, mapping) {if (num_mappings < args->num_entries) { - vm_entries[num_mappings].addr = mapping->start *AMDGPU_GPU_PAGE_SIZE ; + vm_entries[num_mappings].addr = +amdgpu_gmc_sign_extend (mapping->start *AMDGPU_GPU_PAGE_SIZE ); vm_entries[num_mappings].size = (mapping->last - mapping->start +1 ) *AMDGPU_GPU_PAGE_SIZE ; vm_entries[num_mappings].offset = mapping->offset; vm_entries[num_mappings].flags = mapping->flags;
@@ -1128,7 +1129,8 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data,amdgpu_vm_bo_va_for_each_invalid_mapping (bo_va, mapping) {if (num_mappings < args->num_entries) { - vm_entries[num_mappings].addr = mapping->start *AMDGPU_GPU_PAGE_SIZE ; + vm_entries[num_mappings].addr = +amdgpu_gmc_sign_extend (mapping->start *AMDGPU_GPU_PAGE_SIZE ); vm_entries[num_mappings].size = (mapping->last - mapping->start +1 ) *AMDGPU_GPU_PAGE_SIZE ; vm_entries[num_mappings].offset = mapping->offset; vm_entries[num_mappings].flags = mapping->flags;
Signature · 1 line
2.53.0