From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 20E74184532 for ; Mon, 12 Aug 2024 14:46:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723473967; cv=none; b=GBnDTVcPtGBtmsPSdNpOo53QZjJmgQ1owLSH/dYams4G/fhQ4PuaNThn+RHGdZAr/IRhG2miAJY80xZOJitEaKJmkaJfVp0OJDXV5PrcF5G7CDzQDOoC9rfhHiY3HJDzreZks+VEyr/OUR1GIvt+1/RDaRIODpdFIgn108l4aMQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723473967; c=relaxed/simple; bh=D+BxJWaWfmu0S95UI65731Cy2up2lgZ70oKgelP0Lz8=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=YkcZOfgAwKY5/nhGrXNK1AoFxAWTDdWoI0XNW8wnCQyhhRYYgkGgeu/HBwFRTxEsIO5I6XBHLaWGXBjz1gON4767fSIfC4eR5vUHySGw5/qBRs6UiALMWC3NOAOkDvwfXhvtf8CcjnxoaakePTewGRb28h0TWeW2q3HHxI0/qQY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=zBZaMrDO; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="zBZaMrDO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43AF8C32782; Mon, 12 Aug 2024 14:46:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1723473966; bh=D+BxJWaWfmu0S95UI65731Cy2up2lgZ70oKgelP0Lz8=; h=Subject:To:Cc:From:Date:From; b=zBZaMrDOu25RUsrklOEh1Qbxb0rekpAEDGlOA5OdhyWUqMUGP2epuZ54LQATb4QMX p9dR6Uaj6pp05FUdm2FtIvP2us5bTyRsQBExjzEHfCuGiOeXFwqYYJm8Kovnz7RM7X Uo6XXjMrvYmXBgZbE1RomkbtBJ14RoTi0zB7b9Oo= Subject: FAILED: patch "[PATCH] drm/amdkfd: don't allow mapping the MMIO HDP page with large" failed to apply to 6.10-stable tree To: alexander.deucher@amd.com,felix.kuehling@amd.com Cc: From: Date: Mon, 12 Aug 2024 16:46:00 +0200 Message-ID: <2024081200-overuse-imaginary-f30a@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.10-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 . 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.10.y git checkout FETCH_HEAD git cherry-pick -x 24e82654e98e96cece5d8b919c522054456eeec6 # git commit -s git send-email --to '' --in-reply-to '2024081200-overuse-imaginary-f30a@gregkh' --subject-prefix 'PATCH 6.10.y' HEAD^.. Possible dependencies: 24e82654e98e ("drm/amdkfd: don't allow mapping the MMIO HDP page with large pages") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 24e82654e98e96cece5d8b919c522054456eeec6 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Sun, 14 Apr 2024 13:06:39 -0400 Subject: [PATCH] drm/amdkfd: don't allow mapping the MMIO HDP page with large pages We don't get the right offset in that case. The GPU has an unused 4K area of the register BAR space into which you can remap registers. We remap the HDP flush registers into this space to allow userspace (CPU or GPU) to flush the HDP when it updates VRAM. However, on systems with >4K pages, we end up exposing PAGE_SIZE of MMIO space. Fixes: d8e408a82704 ("drm/amdkfd: Expose HDP registers to user space") Reviewed-by: Felix Kuehling Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c index 6b713fb0b818..fdf171ad4a3c 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c @@ -1144,7 +1144,7 @@ static int kfd_ioctl_alloc_memory_of_gpu(struct file *filep, goto err_unlock; } offset = dev->adev->rmmio_remap.bus_addr; - if (!offset) { + if (!offset || (PAGE_SIZE > 4096)) { err = -ENOMEM; goto err_unlock; } @@ -2312,7 +2312,7 @@ static int criu_restore_memory_of_gpu(struct kfd_process_device *pdd, return -EINVAL; } offset = pdd->dev->adev->rmmio_remap.bus_addr; - if (!offset) { + if (!offset || (PAGE_SIZE > 4096)) { pr_err("amdgpu_amdkfd_get_mmio_remap_phys_addr failed\n"); return -ENOMEM; } @@ -3354,6 +3354,9 @@ static int kfd_mmio_mmap(struct kfd_node *dev, struct kfd_process *process, if (vma->vm_end - vma->vm_start != PAGE_SIZE) return -EINVAL; + if (PAGE_SIZE > 4096) + return -EINVAL; + address = dev->adev->rmmio_remap.bus_addr; vm_flags_set(vma, VM_IO | VM_DONTCOPY | VM_DONTEXPAND | VM_NORESERVE |