Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp8890096rwp; Wed, 19 Jul 2023 17:40:52 -0700 (PDT) X-Google-Smtp-Source: APBJJlEBCCfRquNdXs6V+zhdm9obRwygrU1az2+gFOJ8S4h2w+xQAAl3pihGX5mZy/Q2T2d0WGkn X-Received: by 2002:a17:906:1c97:b0:992:61c5:dab0 with SMTP id g23-20020a1709061c9700b0099261c5dab0mr3545447ejh.62.1689813652195; Wed, 19 Jul 2023 17:40:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689813652; cv=none; d=google.com; s=arc-20160816; b=fcdti9S5G+V+4he0ceJMaSf00Cujfoe9AaWDRTv1l/G3UlcU6ah9BkceDdXDbtgobd 9LcNQ29udjrhP7UMgG5xjIQS8jyTR00HrpTgKHSAguDDga5sF1ZdibQEPFzP0iybli4C hfy5tRfbeQ8/ZOXWbUyKWxFn+tXkz12fitC7pdtCSF/FIsZjf+0W0kUFxJz/JMsFEcho u36oAvVVrs+SEqt0ysFn3diOkeb9apnt5xDWyDXi0MG9YwBWDdyH2rEWrhTvbe4aPOm4 B128wdoZEu4uYEFrblutOUDdW509YhsgBu+SAqe74x3S6OwUYWBn7T/687GZP5BnFr3k kT+w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DNvPFmPephzOlef4HOM2AR90BUKB3CUNAq245FGhm7Y=; fh=grh6qrjW0oxu0S8zfHJMhxWLgUXiZ/TU2uoVe6KOi4w=; b=MUvaEHGKjts2fS0IG4TNQWlV4T7n4fJk/pigvRnW9QtTyCWpNoUI0ZM1N2SAe18PLs EDoTVP7bYQsCj+YVFotA3hbIdg6ByT/4skLHm4Dzv5KUE/8ZG4I8lN8ehdfcP01Sd6IX vE8CdafStxX6MMiAVUy800c3iot1ovHq1IewixZfy7jxD2jKrafwsg5RAHql1OkQMCaa qn7+AV0c8eiGYq2g35HhmVb1iqCwLaib1+ZySxnWVN5NGSB9xS7g7Zhgh8TWfEghEW/M Gg4pLhxjTm2OdA4hwW+A7QAKg42boGL8ANqtSM1115iiFVCnnp8yp89VE0OIGIRAoUok aywA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Gc7prBh9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lu11-20020a170906facb00b0098dd9f4ed69si3499416ejb.707.2023.07.19.17.40.28; Wed, 19 Jul 2023 17:40:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Gc7prBh9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229897AbjGTAQt (ORCPT + 99 others); Wed, 19 Jul 2023 20:16:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229829AbjGTAQi (ORCPT ); Wed, 19 Jul 2023 20:16:38 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E19DF2107 for ; Wed, 19 Jul 2023 17:15:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689812116; 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=DNvPFmPephzOlef4HOM2AR90BUKB3CUNAq245FGhm7Y=; b=Gc7prBh9OJv/NqTJrJ2+XslunY36tMXOPSEmUtmAErVkhZtwIIfFmRxZkutFipgDKQDeMJ TNOnSCr+F/fNmivicGbHrkwY/W9pCoDQyiy3uwsvT8fqcIEWrUpMcBjLdb96kNvFtlgRe4 h1zPkjoKX8wWcz1YsjTSu+aHGSKWuGA= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-66-DbkKRoKePuOvfXPUmiy0bg-1; Wed, 19 Jul 2023 20:15:14 -0400 X-MC-Unique: DbkKRoKePuOvfXPUmiy0bg-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-993c2d9e496so14879366b.0 for ; Wed, 19 Jul 2023 17:15:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689812114; x=1692404114; 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=DNvPFmPephzOlef4HOM2AR90BUKB3CUNAq245FGhm7Y=; b=kWHQil1VSQD4prq8pYCg1cw/xgJZNKwBBhlWqwjyiYg+gPYpb4Hni/ComuPfxPeh22 ZSF7gNSqP/GIuTPQS1OkZcFTelMOvy2o4Ma0oAjPrWPyani0Zg7zIK64erv7UYMdnahS L7JKSxw7hh1AERTPeN82MhsZiaW6eA1ldiP6OS2bqsqA8IAfqw/hym3/IeSXpBlNanak TCPAC10jExmHF66mvLEsqUYPzRAHemohmqkxlXSwzdZGT+jO9bq2Z/kXLQcantGXAAHh 7h4Y8ex6x+1kmcPbymcOVCV0aGmc9DGiYvVFedM2fCTXhYw/KfegWqZr7z30/xqpdTAu ZRfw== X-Gm-Message-State: ABy/qLZpwodKS5RgyfhTGYgaOeDGwQ4RcLVG+iyBM2MffHB9uawhTig9 e37gc/AgAme2b4dyclbg48/w9rM2qNU1NZ38Y6DSny2WDJ4gyghgpowDqLKJIZZIwRLkl5EklhP REarxfoMsTS5JDkdMIAvVyHuW X-Received: by 2002:a17:907:3e18:b0:982:caf9:126 with SMTP id hp24-20020a1709073e1800b00982caf90126mr4684529ejc.42.1689812113884; Wed, 19 Jul 2023 17:15:13 -0700 (PDT) X-Received: by 2002:a17:907:3e18:b0:982:caf9:126 with SMTP id hp24-20020a1709073e1800b00982caf90126mr4684505ejc.42.1689812113522; Wed, 19 Jul 2023 17:15:13 -0700 (PDT) Received: from cassiopeiae.. ([2a02:810d:4b3f:de9c:642:1aff:fe31:a19f]) by smtp.gmail.com with ESMTPSA id pj20-20020a170906d79400b00993664a9987sm2975604ejb.103.2023.07.19.17.15.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jul 2023 17:15:13 -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, donald.robson@imgtec.com Cc: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Danilo Krummrich Subject: [PATCH drm-misc-next v8 04/12] drm/nouveau: get vmm via nouveau_cli_vmm() Date: Thu, 20 Jul 2023 02:14:25 +0200 Message-ID: <20230720001443.2380-5-dakr@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230720001443.2380-1-dakr@redhat.com> References: <20230720001443.2380-1-dakr@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, 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 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 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 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; }; +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 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, 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; @@ -180,7 +180,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; @@ -269,7 +269,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.41.0