Commit 5bf02571 authored by Ben Skeggs's avatar Ben Skeggs Committed by Dave Airlie
Browse files

drm/nouveau/mmu/r535: initial support



- Valid VRAM regions are read from GSP-RM, and used to construct our MM
- BAR1/BAR2 VMMs modified to be shared with RM
- Client VMMs have RM VASPACE objects created for them
- Adds FBSR to backup system objects in VRAM across suspend

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230918202149.4343-37-skeggsb@gmail.com
parent 830531e9
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -11,6 +11,10 @@ struct nvkm_bar {
	spinlock_t lock;
	bool bar2;

	void __iomem *flushBAR2PhysMode;
	struct nvkm_memory *flushFBZero;
	void __iomem *flushBAR2;

	/* whether the BAR supports to be ioremapped WC or should be uncached */
	bool iomap_uncached;
};
+12 −0
Original line number Diff line number Diff line
@@ -65,6 +65,13 @@ struct nvkm_gsp {
		} heap;
		u64 addr;
		u64 size;

		struct {
			u64 addr;
			u64 size;
		} region[16];
		int region_nr;
		u32 rsvd_size;
	} fb;

	struct {
@@ -159,6 +166,11 @@ struct nvkm_gsp {
	} intr[32];
	int intr_nr;

	struct {
		u64 rm_bar1_pdb;
		u64 rm_bar2_pdb;
	} bar;

	const struct nvkm_gsp_rm {
		void *(*rpc_get)(struct nvkm_gsp *, u32 fn, u32 argc);
		void *(*rpc_push)(struct nvkm_gsp *, void *argv, bool wait, u32 repc);
+5 −0
Original line number Diff line number Diff line
@@ -24,6 +24,11 @@ struct nvkm_instmem {
	struct nvkm_ramht  *ramht;
	struct nvkm_memory *ramro;
	struct nvkm_memory *ramfc;

	struct {
		struct sg_table fbsr;
		bool fbsr_valid;
	} rm;
};

u32 nvkm_instmem_rd32(struct nvkm_instmem *, u32 addr);
+11 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
#ifndef __NVKM_MMU_H__
#define __NVKM_MMU_H__
#include <core/subdev.h>
#include <subdev/gsp.h>

struct nvkm_vma {
	struct list_head head;
@@ -63,6 +64,16 @@ struct nvkm_vmm {
	void *nullp;

	bool replay;

	struct {
		u64 bar2_pdb;

		struct nvkm_gsp_client client;
		struct nvkm_gsp_device device;
		struct nvkm_gsp_object object;

		struct nvkm_vma *rsvd;
	} rm;
};

int nvkm_vmm_new(struct nvkm_device *, u64 addr, u64 size, void *argv, u32 argc,
+33 −0
Original line number Diff line number Diff line
#ifndef __src_common_sdk_nvidia_inc_class_cl84a0_h__
#define __src_common_sdk_nvidia_inc_class_cl84a0_h__

/* Excerpt of RM headers from https://github.com/NVIDIA/open-gpu-kernel-modules/tree/535.54.03 */

/*
 * SPDX-FileCopyrightText: Copyright (c) 2001-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 * SPDX-License-Identifier: MIT
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 */

#define NV01_MEMORY_LIST_SYSTEM (0x00000081)

#define NV01_MEMORY_LIST_FBMEM  (0x00000082)

#endif
Loading