Commit 176ada03 authored by James Jones's avatar James Jones Committed by Ben Skeggs
Browse files

drm/nouveau/mmu: Add correct turing page kinds



Turing introduced a new simplified page kind
scheme, reducing the number of possible page
kinds from 256 to 16.  It also is the first
NVIDIA GPU in which the highest possible page
kind value is not reserved as an "invalid" page
kind.

To address this, the invalid page kind is made
an explicit property of the MMU HAL, and a new
table of page kinds is added to the tu102 MMU
HAL.

One hardware change not addressed here is that
0x00 is technically no longer a supported page
kind, and pitch surfaces are instead intended to
share the block-linear generic page kind 0x06.
However, because that will be a rather invasive
change to nouveau and 0x00 still works fine in
practice on Turing hardware, addressing this new
behavior is deferred.

Signed-off-by: default avatarJames Jones <jajones@nvidia.com>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 72ecb0a6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ struct nvif_mmu_type_v0 {

struct nvif_mmu_kind_v0 {
	__u8  version;
	__u8  pad01[1];
	__u8  kind_inv;
	__u16 count;
	__u8  data[];
};
+2 −2
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ struct nvif_mmu {
	u8  dmabits;
	u8  heap_nr;
	u8  type_nr;
	u8  kind_inv;
	u16 kind_nr;
	s32 mem;

@@ -36,9 +37,8 @@ void nvif_mmu_fini(struct nvif_mmu *);
static inline bool
nvif_mmu_kind_valid(struct nvif_mmu *mmu, u8 kind)
{
	const u8 invalid = mmu->kind_nr - 1;
	if (kind) {
		if (kind >= mmu->kind_nr || mmu->kind[kind] == invalid)
		if (kind >= mmu->kind_nr || mmu->kind[kind] == mmu->kind_inv)
			return false;
	}
	return true;
+1 −0
Original line number Diff line number Diff line
@@ -121,6 +121,7 @@ nvif_mmu_init(struct nvif_object *parent, s32 oclass, struct nvif_mmu *mmu)
				       kind, argc);
		if (ret == 0)
			memcpy(mmu->kind, kind->data, kind->count);
		mmu->kind_inv = kind->kind_inv;
		kfree(kind);
	}

+2 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@
 * The value 0xff represents an invalid storage type.
 */
const u8 *
gf100_mmu_kind(struct nvkm_mmu *mmu, int *count)
gf100_mmu_kind(struct nvkm_mmu *mmu, int *count, u8 *invalid)
{
	static const u8
	kind[256] = {
@@ -69,6 +69,7 @@ gf100_mmu_kind(struct nvkm_mmu *mmu, int *count)
	};

	*count = ARRAY_SIZE(kind);
	*invalid = 0xff;
	return kind;
}

+2 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@
#include <nvif/class.h>

const u8 *
gm200_mmu_kind(struct nvkm_mmu *mmu, int *count)
gm200_mmu_kind(struct nvkm_mmu *mmu, int *count, u8 *invalid)
{
	static const u8
	kind[256] = {
@@ -65,6 +65,7 @@ gm200_mmu_kind(struct nvkm_mmu *mmu, int *count)
		0xfe, 0xfe, 0xfe, 0xfe, 0xff, 0xfd, 0xfe, 0xff
	};
	*count = ARRAY_SIZE(kind);
	*invalid = 0xff;
	return kind;
}

Loading