From nobody Sun Feb 8 17:43:09 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6C6DEB64DA for ; Tue, 20 Jun 2023 00:43:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229936AbjFTAnx (ORCPT ); Mon, 19 Jun 2023 20:43:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbjFTAnn (ORCPT ); Mon, 19 Jun 2023 20:43:43 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66D8A10CB for ; Mon, 19 Jun 2023 17:42:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687221776; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P88UvIrom7/7J04O1khPNHpiLRIr+035xquRG7LdscM=; b=DRmnnarm0Sk+oTkGhESXeidRUiwtGO9+0BEE0CuvkeVZJo5KaxaADsDXf9nwXYGgz1QRuH NPR1T+OpjB/Kbbcn5u5tXxicAqM+RpxWACv08BEcAmfMXDVu3v+B78SdGsr+nqQmTHReJ1 IY8irYOh1PFNmN3WAeFB1RqYxE+nQYk= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-67-OTM3GDMgMky9Z37bLDRs6g-1; Mon, 19 Jun 2023 20:42:55 -0400 X-MC-Unique: OTM3GDMgMky9Z37bLDRs6g-1 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-9835bf83157so296077866b.2 for ; Mon, 19 Jun 2023 17:42:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687221774; x=1689813774; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=P88UvIrom7/7J04O1khPNHpiLRIr+035xquRG7LdscM=; b=KGbSThLzzBYpBr9MPLfGQW1BYAVlWwIUi3Mndowz2pt0SoKIzR7nfHO2nVEnea2gA1 8Wo50uEYje571ty3S0OPEpAE5Tmkdr13P5HSfR1ZwuIkfgxVbt1M3l4AlmISguFUS4mc +d3idF4zso8qoevfeLqi6JK1gsvcH+EMXfTzZGGj0skrh9qDAIjxRLixA7hZPPa9wqiX JeB+kzuz2dwBpS7XZRu3l3uCc4yj1xmKnzpS/fTL/LruhBX9bZD9PvoTBisjT5hSpBOq eAd+FbeLrhDmVHkILm7g9Sfc8KOUy1JFocrDuZQPjXu4skvWJuZjKfS2hF4okqQnIEoI 9GvQ== X-Gm-Message-State: AC+VfDx6YrKXYNhfMkjYnpEMt/rELj6PEd/IobekV1KK0lUapYz4kK0S f8tMkCxvrRm8i3JPIX82IGpvUvrdykYXKQgQzinjsBdRQ5HH3zZqYClm79SeiCnGkeDPM1a292w 8LsaMli9cDYtvdELT/Cdu/SVg X-Received: by 2002:a17:907:6e1f:b0:988:eb17:d052 with SMTP id sd31-20020a1709076e1f00b00988eb17d052mr1838470ejc.56.1687221774234; Mon, 19 Jun 2023 17:42:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4oGWEXqn27DYpinppKE+f1ukkWHSnxW8Ba6bfmxicdq4M8VpVe6u0IQI2uhl8X5JngRBVsnA== X-Received: by 2002:a17:907:6e1f:b0:988:eb17:d052 with SMTP id sd31-20020a1709076e1f00b00988eb17d052mr1838451ejc.56.1687221774063; Mon, 19 Jun 2023 17:42:54 -0700 (PDT) Received: from cassiopeiae.. ([2a02:810d:4b3f:de9c:642:1aff:fe31:a19f]) by smtp.gmail.com with ESMTPSA id u7-20020a05640207c700b00514b854c399sm305873edy.84.2023.06.19.17.42.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 17:42:53 -0700 (PDT) From: Danilo Krummrich To: airlied@gmail.com, daniel@ffwll.ch, tzimmermann@suse.de, mripard@kernel.org, corbet@lwn.net, christian.koenig@amd.com, bskeggs@redhat.com, Liam.Howlett@oracle.com, matthew.brost@intel.com, boris.brezillon@collabora.com, alexdeucher@gmail.com, ogabbay@kernel.org, bagasdotme@gmail.com, willy@infradead.org, jason@jlekstrand.net Cc: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Danilo Krummrich Subject: [PATCH drm-next v5 06/14] drm/nouveau: get vmm via nouveau_cli_vmm() Date: Tue, 20 Jun 2023 02:42:09 +0200 Message-Id: <20230620004217.4700-7-dakr@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230620004217.4700-1-dakr@redhat.com> References: <20230620004217.4700-1-dakr@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Danilo Krummrich --- 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 c2ec91cc845d..7724fe63067d 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, in= t *align, u32 domain, struct nouveau_drm *drm =3D cli->drm; struct nouveau_bo *nvbo; struct nvif_mmu *mmu =3D &cli->mmu; - struct nvif_vmm *vmm =3D cli->svm.cli ? &cli->svm.vmm : &cli->vmm.vmm; + struct nvif_vmm *vmm =3D &nouveau_cli_vmm(cli)->vmm; int i, pi =3D -1; =20 if (!*size) { diff --git a/drivers/gpu/drm/nouveau/nouveau_chan.c b/drivers/gpu/drm/nouve= au/nouveau_chan.c index e648ecd0c1a0..1068abe41024 100644 --- a/drivers/gpu/drm/nouveau/nouveau_chan.c +++ b/drivers/gpu/drm/nouveau/nouveau_chan.c @@ -148,7 +148,7 @@ nouveau_channel_prep(struct nouveau_drm *drm, struct nv= if_device *device, =20 chan->device =3D device; chan->drm =3D drm; - chan->vmm =3D cli->svm.cli ? &cli->svm : &cli->vmm; + chan->vmm =3D nouveau_cli_vmm(cli); atomic_set(&chan->killed, 0); =20 /* allocate memory for dma push buffer */ diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouvea= u/nouveau_drv.h index b5de312a523f..81350e685b50 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h @@ -112,6 +112,15 @@ struct nouveau_cli_work { struct dma_fence_cb cb; }; =20 +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 *); =20 diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouvea= u/nouveau_gem.c index ab9062e50977..45ca4eb98f54 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c @@ -103,7 +103,7 @@ nouveau_gem_object_open(struct drm_gem_object *gem, str= uct drm_file *file_priv) struct nouveau_bo *nvbo =3D nouveau_gem_object(gem); struct nouveau_drm *drm =3D nouveau_bdev(nvbo->bo.bdev); struct device *dev =3D drm->dev->dev; - struct nouveau_vmm *vmm =3D cli->svm.cli ? &cli->svm : &cli->vmm; + struct nouveau_vmm *vmm =3D nouveau_cli_vmm(cli); struct nouveau_vma *vma; int ret; =20 @@ -180,7 +180,7 @@ nouveau_gem_object_close(struct drm_gem_object *gem, st= ruct drm_file *file_priv) struct nouveau_bo *nvbo =3D nouveau_gem_object(gem); struct nouveau_drm *drm =3D nouveau_bdev(nvbo->bo.bdev); struct device *dev =3D drm->dev->dev; - struct nouveau_vmm *vmm =3D cli->svm.cli ? &cli->svm : & cli->vmm; + struct nouveau_vmm *vmm =3D nouveau_cli_vmm(cli); struct nouveau_vma *vma; int ret; =20 @@ -269,7 +269,7 @@ nouveau_gem_info(struct drm_file *file_priv, struct drm= _gem_object *gem, { struct nouveau_cli *cli =3D nouveau_cli(file_priv); struct nouveau_bo *nvbo =3D nouveau_gem_object(gem); - struct nouveau_vmm *vmm =3D cli->svm.cli ? &cli->svm : &cli->vmm; + struct nouveau_vmm *vmm =3D nouveau_cli_vmm(cli); struct nouveau_vma *vma; =20 if (is_power_of_2(nvbo->valid_domains)) --=20 2.40.1