From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 1B86936D9F5 for ; Sat, 12 Sep 2026 21:01:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789246919; cv=none; b=YpicI/g3Zz/orPr54l5Nca0nqSWcQKj7EoUoJK2q40iOAIbA4fw8z81/j0+E8ZtvEJ6UcspSuZ/1mETHB/cpdF2z0Y1qNNflc9pVbgKQjhfu014pWqsYmegS6KFtGU5WZT/uDCIlJ1f6KbUdlZHJDx8S/hoU4k8M29yu7fJ45pw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789246919; c=relaxed/simple; bh=lxm1T17icEfnAO+7NYYxBgwc8n9czGuhXUygPHt7AOY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=c5ODeKFwp2lzMpD1zFOQbWe7mUvZRrApR7bjyMMbF1sVYWqjtJljm5BB/wmLLYIPkDsiWajRvturTlfsg9me4vmU6GK0ExDFvaPGOFuWX7iYr89Q2JQB+h8HcxxTx6purfu5XsQNdZEG1+jWonhh+nG6C2B/aKbibeDsSz8tdY4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mr1YXRgX; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mr1YXRgX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8066D1F00893; Sat, 12 Sep 2026 21:01:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789246918; bh=Cd0TmIKNNIkUA//7UOs7GOXVWVmaS7rYILI5cQZjSk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=mr1YXRgX7KEGB3XXcxXzeoKKKezE1lmPoca1uHxBhbpdVqMMf7aMQVC5Fo9tYiPcY /shgzYUQOa71+y8q16TyYKS0byykghy2JvXvj0WN8pUmuGhreu/W3qsWzs3AeA/IfU 1VmdH0ynjhxif3VU5KB3J+/U08ZlrGGwLyZZGm0Gp+cu18VL7Km20uyQZc6hz3/yPF 3BROvS+CUOAtkRjfLqM/HIPgK7lEsdNuHn3BNwu/exFR86lOq8u7+oL71VBbSr7fXv HQNFxJkSqZqTlLNr5SPHAUTqG0UlQNurq2EIL9eBbFCLLdr3XscInadU+QehJ6znv7 WPCBGLxgTl1ww== From: Sasha Levin To: stable@vger.kernel.org Cc: Danilo Krummrich , Dave Airlie , Sasha Levin Subject: [PATCH 5.15.y 1/2] drm/nouveau: get vmm via nouveau_cli_vmm() Date: Sat, 12 Sep 2026 17:01:55 -0400 Message-ID: <20260912210156.3935765-1-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <2026090932-flatbed-quotable-d5a9@gregkh> References: <2026090932-flatbed-quotable-d5a9@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Danilo Krummrich [ Upstream commit 7b05a7c0c9ca6e7e2d27181504920987226477e5 ] Provide a getter function for the client's current vmm context. Since we'll add a new (u)vmm context for UMD bindings in subsequent commits, this will keep the code clean. Reviewed-by: Dave Airlie Signed-off-by: Danilo Krummrich Link: https://patchwork.freedesktop.org/patch/msgid/20230804182406.5222-5-dakr@redhat.com Stable-dep-of: 511585987d27 ("drm/nouveau: unsubscribe the channel-kill event before the fence context") Signed-off-by: Sasha Levin --- drivers/gpu/drm/nouveau/nouveau_bo.c | 2 +- drivers/gpu/drm/nouveau/nouveau_chan.c | 2 +- drivers/gpu/drm/nouveau/nouveau_drv.h | 9 +++++++++ drivers/gpu/drm/nouveau/nouveau_gem.c | 6 +++--- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 21e81546b1570..559f9218e4e07 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -206,7 +206,7 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 *size, int *align, u32 domain, struct nouveau_drm *drm = cli->drm; struct nouveau_bo *nvbo; struct nvif_mmu *mmu = &cli->mmu; - struct nvif_vmm *vmm = cli->svm.cli ? &cli->svm.vmm : &cli->vmm.vmm; + struct nvif_vmm *vmm = &nouveau_cli_vmm(cli)->vmm; int i, pi = -1; if (!*size) { diff --git a/drivers/gpu/drm/nouveau/nouveau_chan.c b/drivers/gpu/drm/nouveau/nouveau_chan.c index ea7769135b0dc..da345b50769cf 100644 --- a/drivers/gpu/drm/nouveau/nouveau_chan.c +++ b/drivers/gpu/drm/nouveau/nouveau_chan.c @@ -150,7 +150,7 @@ nouveau_channel_prep(struct nouveau_drm *drm, struct nvif_device *device, chan->device = device; chan->drm = drm; - chan->vmm = cli->svm.cli ? &cli->svm : &cli->vmm; + chan->vmm = nouveau_cli_vmm(cli); atomic_set(&chan->killed, 0); /* allocate memory for dma push buffer */ diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index b2a970aa9bf4b..5446eab6dd57f 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h @@ -119,6 +119,15 @@ struct nouveau_cli_work { struct dma_fence_cb cb; }; +static inline struct nouveau_vmm * +nouveau_cli_vmm(struct nouveau_cli *cli) +{ + if (cli->svm.cli) + return &cli->svm; + + return &cli->vmm; +} + void nouveau_cli_work_queue(struct nouveau_cli *, struct dma_fence *, struct nouveau_cli_work *); diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index 7de846a919232..b53ea8ef7f38b 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c @@ -100,7 +100,7 @@ nouveau_gem_object_open(struct drm_gem_object *gem, struct drm_file *file_priv) struct nouveau_bo *nvbo = nouveau_gem_object(gem); struct nouveau_drm *drm = nouveau_bdev(nvbo->bo.bdev); struct device *dev = drm->dev->dev; - struct nouveau_vmm *vmm = cli->svm.cli ? &cli->svm : &cli->vmm; + struct nouveau_vmm *vmm = nouveau_cli_vmm(cli); struct nouveau_vma *vma; int ret; @@ -177,7 +177,7 @@ nouveau_gem_object_close(struct drm_gem_object *gem, struct drm_file *file_priv) struct nouveau_bo *nvbo = nouveau_gem_object(gem); struct nouveau_drm *drm = nouveau_bdev(nvbo->bo.bdev); struct device *dev = drm->dev->dev; - struct nouveau_vmm *vmm = cli->svm.cli ? &cli->svm : & cli->vmm; + struct nouveau_vmm *vmm = nouveau_cli_vmm(cli); struct nouveau_vma *vma; int ret; @@ -266,7 +266,7 @@ nouveau_gem_info(struct drm_file *file_priv, struct drm_gem_object *gem, { struct nouveau_cli *cli = nouveau_cli(file_priv); struct nouveau_bo *nvbo = nouveau_gem_object(gem); - struct nouveau_vmm *vmm = cli->svm.cli ? &cli->svm : &cli->vmm; + struct nouveau_vmm *vmm = nouveau_cli_vmm(cli); struct nouveau_vma *vma; if (is_power_of_2(nvbo->valid_domains)) -- 2.53.0