Commit 86f7bae5 authored by Christian König's avatar Christian König Committed by Alex Deucher
Browse files

drm/amdgpu: revert "XGMI pstate switch initial support"



This reverts commit 9b638f97.

Adding this to the mapping is complete nonsense and the whole
implementation looks racy. This patch wasn't thoughtfully reviewed
and should be reverted for now.

Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Acked-by: default avatarLiu, Shaoyun <Shaoyun.Liu@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent c3546695
Loading
Loading
Loading
Loading
+0 −3
Original line number Original line Diff line number Diff line
@@ -928,9 +928,6 @@ struct amdgpu_device {
	int asic_reset_res;
	int asic_reset_res;
	struct work_struct		xgmi_reset_work;
	struct work_struct		xgmi_reset_work;


	/* counter of mapped memory through xgmi */
	atomic_t			xgmi_map_counter;

	bool                            in_baco_reset;
	bool                            in_baco_reset;
};
};


+0 −3
Original line number Original line Diff line number Diff line
@@ -2018,9 +2018,6 @@ static void amdgpu_device_ip_late_init_func_handler(struct work_struct *work)
	r = amdgpu_device_enable_mgpu_fan_boost();
	r = amdgpu_device_enable_mgpu_fan_boost();
	if (r)
	if (r)
		DRM_ERROR("enable mgpu fan boost failed (%d).\n", r);
		DRM_ERROR("enable mgpu fan boost failed (%d).\n", r);

	/*set to low pstate by default */
	amdgpu_xgmi_set_pstate(adev, 0);
}
}


static void amdgpu_device_delay_enable_gfx_off(struct work_struct *work)
static void amdgpu_device_delay_enable_gfx_off(struct work_struct *work)
+0 −1
Original line number Original line Diff line number Diff line
@@ -54,7 +54,6 @@ struct amdgpu_bo_va_mapping {
	uint64_t			__subtree_last;
	uint64_t			__subtree_last;
	uint64_t			offset;
	uint64_t			offset;
	uint64_t			flags;
	uint64_t			flags;
	bool				is_xgmi;
};
};


/* User space allocated BO in a VM */
/* User space allocated BO in a VM */
+1 −28
Original line number Original line Diff line number Diff line
@@ -34,7 +34,6 @@
#include "amdgpu_trace.h"
#include "amdgpu_trace.h"
#include "amdgpu_amdkfd.h"
#include "amdgpu_amdkfd.h"
#include "amdgpu_gmc.h"
#include "amdgpu_gmc.h"
#include "amdgpu_xgmi.h"


/**
/**
 * DOC: GPUVM
 * DOC: GPUVM
@@ -1709,9 +1708,8 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
	struct ttm_mem_reg *mem;
	struct ttm_mem_reg *mem;
	struct drm_mm_node *nodes;
	struct drm_mm_node *nodes;
	struct dma_fence *exclusive, **last_update;
	struct dma_fence *exclusive, **last_update;
	struct amdgpu_device *bo_adev = adev;
	bool is_xgmi = false;
	uint64_t flags;
	uint64_t flags;
	struct amdgpu_device *bo_adev = adev;
	int r;
	int r;


	if (clear || !bo) {
	if (clear || !bo) {
@@ -1733,10 +1731,6 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
	if (bo) {
	if (bo) {
		flags = amdgpu_ttm_tt_pte_flags(adev, bo->tbo.ttm, mem);
		flags = amdgpu_ttm_tt_pte_flags(adev, bo->tbo.ttm, mem);
		bo_adev = amdgpu_ttm_adev(bo->tbo.bdev);
		bo_adev = amdgpu_ttm_adev(bo->tbo.bdev);
		if (adev != bo_adev &&
		    adev->gmc.xgmi.hive_id &&
		    adev->gmc.xgmi.hive_id == bo_adev->gmc.xgmi.hive_id)
			is_xgmi = true;
	} else {
	} else {
		flags = 0x0;
		flags = 0x0;
	}
	}
@@ -1755,19 +1749,6 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
	}
	}


	list_for_each_entry(mapping, &bo_va->invalids, list) {
	list_for_each_entry(mapping, &bo_va->invalids, list) {
		if (mapping->is_xgmi != is_xgmi) {
			if (is_xgmi) {
				/* Adding an XGMI mapping to the PT */
				if (atomic_inc_return(&adev->xgmi_map_counter) == 1)
					amdgpu_xgmi_set_pstate(adev, 1);
			} else {
				/* Removing an XGMI mapping from the PT */
				if (atomic_dec_return(&adev->xgmi_map_counter) == 0)
					amdgpu_xgmi_set_pstate(adev, 0);
			}
			mapping->is_xgmi = is_xgmi;
		}

		r = amdgpu_vm_bo_split_mapping(adev, exclusive, pages_addr, vm,
		r = amdgpu_vm_bo_split_mapping(adev, exclusive, pages_addr, vm,
					       mapping, flags, bo_adev, nodes,
					       mapping, flags, bo_adev, nodes,
					       last_update);
					       last_update);
@@ -1985,13 +1966,6 @@ int amdgpu_vm_clear_freed(struct amdgpu_device *adev,
		r = amdgpu_vm_bo_update_mapping(adev, NULL, NULL, vm,
		r = amdgpu_vm_bo_update_mapping(adev, NULL, NULL, vm,
						mapping->start, mapping->last,
						mapping->start, mapping->last,
						init_pte_value, 0, &f);
						init_pte_value, 0, &f);

		if (mapping->is_xgmi) {
			/* Removing an XGMI mapping from the PT */
			if (atomic_dec_return(&adev->xgmi_map_counter) == 0)
				amdgpu_xgmi_set_pstate(adev, 0);
		}

		amdgpu_vm_free_mapping(adev, vm, mapping, f);
		amdgpu_vm_free_mapping(adev, vm, mapping, f);
		if (r) {
		if (r) {
			dma_fence_put(f);
			dma_fence_put(f);
@@ -2188,7 +2162,6 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev,
	mapping->last = eaddr;
	mapping->last = eaddr;
	mapping->offset = offset;
	mapping->offset = offset;
	mapping->flags = flags;
	mapping->flags = flags;
	mapping->is_xgmi = false;


	amdgpu_vm_bo_insert_map(adev, bo_va, mapping);
	amdgpu_vm_bo_insert_map(adev, bo_va, mapping);


+0 −15
Original line number Original line Diff line number Diff line
@@ -200,7 +200,6 @@ struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev, int lo


	if (lock)
	if (lock)
		mutex_lock(&tmp->hive_lock);
		mutex_lock(&tmp->hive_lock);
	tmp->pstate = -1;


	mutex_unlock(&xgmi_mutex);
	mutex_unlock(&xgmi_mutex);


@@ -322,17 +321,3 @@ void amdgpu_xgmi_remove_device(struct amdgpu_device *adev)
		mutex_unlock(&hive->hive_lock);
		mutex_unlock(&hive->hive_lock);
	}
	}
}
}

int amdgpu_xgmi_set_pstate(struct amdgpu_device *adev, int pstate)
{
	int ret = 0;
	struct amdgpu_hive_info *hive = amdgpu_get_xgmi_hive(adev, 0);

	if (!hive)
		return 0;

	if (hive->pstate == pstate)
		return 0;
	/* Todo : sent the message to SMU for pstate change */
	return ret;
}
 No newline at end of file
Loading