Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp627378pxv; Thu, 15 Jul 2021 11:54:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfegF+yg4odCC1tClqshU4+Xvqt69YrRdwg7Rap7l1sKLrAfGut7EISSmKdqHvPBOFNvJr X-Received: by 2002:a02:c906:: with SMTP id t6mr5391736jao.117.1626375280402; Thu, 15 Jul 2021 11:54:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626375280; cv=none; d=google.com; s=arc-20160816; b=ftFimi+bcPHaMLZeC6BHCHnLmfrUsBAuM0pA7FfXMt0+aVqdkFp5ZvtlTc+/cVcjcz 0gZ1PFpTkfR80ZrVtPFh3bAjrYL4TUuVXa89f8MY9j+zFKtGuk9p4NC+xcegMFAwqmp8 nD770n17NnB3RW7TEZIQZQ2yq1isMrfxGp7ay1NUVgk9XQEBw6eUiqPiriuDJunC0wHR YDx0o/8tc4DyzLXUoEPj/DRVhcjKkn/LluhqSFf6kpxNi61Io+yx01KyQzQVwlGlqbBO fuWjJXX9tcMbpak8TTuhLUs3tBGF8zxxzE98fWqQmOf6ClIyY7Tb7yAaPFEFv0fnRKAB bShg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CBgj7U5IYpuXMqw4HfqTO+dtBWdXOvinqKwOGyUH1f4=; b=DjIafkXkIVXArdLfkIkS+M1nH2FaF0TqvQrGGpTNpZp/ggsk82E73d8Bgd6zZ/6bSK o5/eefwUSSe4qRP9SKIh2B9fimOsvP6Kv5d7kB+GH/hjm5RiqxpwP3loGhp+rCzgucLk JGalQ1RcD423/D0sQb00XPMNkwIlNjXrJN0xICP+M8WarjHdvPKYonmO7Bt51xRyLWth vjPCw8HSw3yoDaqp+NyOnSHWq+EnS2aj2H/h5F9DUTOAe5tWde+DLP4hdJWFBx/qPWF0 GGb/avPX2fDZydTJ0Bg17okLgFcio3/WqngROQ+yPZG8GjEUHjGdYEw/b02fBgs5ixcO Lkkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vURlzP1C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w3si7840937ilh.113.2021.07.15.11.54.28; Thu, 15 Jul 2021 11:54:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vURlzP1C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241730AbhGOS4j (ORCPT + 99 others); Thu, 15 Jul 2021 14:56:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:54302 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239829AbhGOSvI (ORCPT ); Thu, 15 Jul 2021 14:51:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C61D5613D1; Thu, 15 Jul 2021 18:48:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626374894; bh=eAVBS3jUMqm+zrZz7cFi/NOaKFfdCWFwsC/wHtcV3YQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vURlzP1CTHaFirJmyFH6DGRrIwSXqi3FAdD5TkSlmXSd4STwObnY6CYARGnvRcwjS ZRudWOK+kojlZ+2PBiHNWR1Rbf4bi90CJ3yeZyCtW71tmwmwBgH9IaC7UuY+EXWJ/9 QEOg+6OFcChv8hS35Q9wtsWbxlpuId8ZOvBnR+V4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nirmoy Das , =?UTF-8?q?Christian=20K=C3=B6nig?= , Felix Kuehling , Alex Deucher , Sasha Levin Subject: [PATCH 5.10 072/215] drm/amdkfd: use allowed domain for vmbo validation Date: Thu, 15 Jul 2021 20:37:24 +0200 Message-Id: <20210715182612.173361726@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182558.381078833@linuxfoundation.org> References: <20210715182558.381078833@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nirmoy Das [ Upstream commit bc05716d4fdd065013633602c5960a2bf1511b9c ] Fixes handling when page tables are in system memory. v3: remove struct amdgpu_vm_parser. v2: remove unwanted variable. change amdgpu_amdkfd_validate instead of amdgpu_amdkfd_bo_validate. Signed-off-by: Nirmoy Das Reviewed-by: Christian König Reviewed-by: Felix Kuehling Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c index 5da487b64a66..26f8a2138377 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c @@ -48,12 +48,6 @@ static struct { spinlock_t mem_limit_lock; } kfd_mem_limit; -/* Struct used for amdgpu_amdkfd_bo_validate */ -struct amdgpu_vm_parser { - uint32_t domain; - bool wait; -}; - static const char * const domain_bit_to_string[] = { "CPU", "GTT", @@ -337,11 +331,9 @@ validate_fail: return ret; } -static int amdgpu_amdkfd_validate(void *param, struct amdgpu_bo *bo) +static int amdgpu_amdkfd_validate_vm_bo(void *_unused, struct amdgpu_bo *bo) { - struct amdgpu_vm_parser *p = param; - - return amdgpu_amdkfd_bo_validate(bo, p->domain, p->wait); + return amdgpu_amdkfd_bo_validate(bo, bo->allowed_domains, false); } /* vm_validate_pt_pd_bos - Validate page table and directory BOs @@ -355,20 +347,15 @@ static int vm_validate_pt_pd_bos(struct amdgpu_vm *vm) { struct amdgpu_bo *pd = vm->root.base.bo; struct amdgpu_device *adev = amdgpu_ttm_adev(pd->tbo.bdev); - struct amdgpu_vm_parser param; int ret; - param.domain = AMDGPU_GEM_DOMAIN_VRAM; - param.wait = false; - - ret = amdgpu_vm_validate_pt_bos(adev, vm, amdgpu_amdkfd_validate, - ¶m); + ret = amdgpu_vm_validate_pt_bos(adev, vm, amdgpu_amdkfd_validate_vm_bo, NULL); if (ret) { pr_err("failed to validate PT BOs\n"); return ret; } - ret = amdgpu_amdkfd_validate(¶m, pd); + ret = amdgpu_amdkfd_validate_vm_bo(NULL, pd); if (ret) { pr_err("failed to validate PD\n"); return ret; -- 2.30.2