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 6E86C36657B for ; Sat, 12 Sep 2026 21:04:38 +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=1789247079; cv=none; b=lqGzOjNPNNvnpJwc7ckOY9nX6OGAaFZtVgoAZrem0V388PZlOFGduvGEHt3fzZSmE089aGNviLf+/DWqHvo+sdzwUzZJUjJeKOt8rVZUgqQYtAPFbcYkZAfi+IJKcZmgaXFe7pT5xqwPM3/TFc3r9qhRlEx2NVjImCP+peM8pyI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789247079; c=relaxed/simple; bh=VUIsck8uXtbmn942OPSbLsAXMiGiXm7d3753YrLcG5Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=I7m0/BOKkuRINulicH63/4IcxUUwr6aZU5ryRDO4deBTAMCRK5AYi9qN8NIlRRBTFIr3+gNxdhtmVdw19iBBhJ7dd1fOzbmTBlJrQbRzARyUDGE/rVXQ7eFnpKtjJMigOkOJJ0YE8YTtEZaADhy7xLfyyvR6EPjVNWf9OAxwXjU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TxB8icdu; 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="TxB8icdu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9700E1F0089B; Sat, 12 Sep 2026 21:04:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789247078; bh=mJKpFsAkT6iYF2ypmccLw4NcebuL/2E1M0k0z2Kak9E=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=TxB8icduoR3bpoH1Yb16hw8zUiw8HD1weUetELeQiK9OrQGE5tSNKxvxG6TOPS46G 0BiJbVuMF3oib5ZZwuqmpWGzfdBZiHkU7HKYP4ojNOAV4VoFlnK0cdaV71sXMOHfXM k7pqndZ9Wyus8sN5ZHt77gKo4k/+2/1krjvTezeFIbFilCJBZvJxOAW+fBD6JrH1BB vtqgAf6jEVOzYQAnLtkK+ERBFZNptCX4ZP9o8C6MN6dmRe7XBKCvo7u4LMT7RpgtmJ fW+Nm+dJodi8oeC1molW5HNUkd+FIrV5iXwykL05W79pAqs03b5e16aCH+Wwu6Tqyn d0MRFRDIAJOhg== From: Sasha Levin To: stable@vger.kernel.org Cc: Danilo Krummrich , Dave Airlie , Sasha Levin Subject: [PATCH 5.10.y 1/2] drm/nouveau: get vmm via nouveau_cli_vmm() Date: Sat, 12 Sep 2026 17:04:35 -0400 Message-ID: <20260912210436.3939374-1-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <2026090932-swab-frostlike-a716@gregkh> References: <2026090932-swab-frostlike-a716@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 d9106f14fde50..d48baf7dc3e84 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -204,7 +204,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 9b6f2c1414d72..bef84589130eb 100644 --- a/drivers/gpu/drm/nouveau/nouveau_chan.c +++ b/drivers/gpu/drm/nouveau/nouveau_chan.c @@ -159,7 +159,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 8b252dca0fc3e..939d84bf5d95e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h @@ -122,6 +122,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 93c1afff5e90e..24f82f5357ba9 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c @@ -64,7 +64,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; @@ -141,7 +141,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; @@ -216,7 +216,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