Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0d83b72a authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge tag 'amdkfd-fixes-2014-12-23' of git://people.freedesktop.org/~gabbayo/linux into drm-fixes

- Display MEC fw version in topology. Without this, the HSA userspace
  stack is broken.

- Init apertures information only once per process

* tag 'amdkfd-fixes-2014-12-23' of git://people.freedesktop.org/~gabbayo/linux:
  amdkfd: init aperture once per process
  amdkfd: Display MEC fw version in topology node
  drm/radeon: Add implementation of get_fw_version
  drm/amd: Add get_fw_version to kfd-->kgd interface
parents bd8136d3 dd59239a
Loading
Loading
Loading
Loading
+0 −4
Original line number Original line Diff line number Diff line
@@ -121,13 +121,9 @@ static int kfd_open(struct inode *inode, struct file *filep)
	if (IS_ERR(process))
	if (IS_ERR(process))
		return PTR_ERR(process);
		return PTR_ERR(process);


	process->is_32bit_user_mode = is_32bit_user_mode;

	dev_dbg(kfd_device, "process %d opened, compat mode (32 bit) - %d\n",
	dev_dbg(kfd_device, "process %d opened, compat mode (32 bit) - %d\n",
		process->pasid, process->is_32bit_user_mode);
		process->pasid, process->is_32bit_user_mode);


	kfd_init_apertures(process);

	return 0;
	return 0;
}
}


+2 −4
Original line number Original line Diff line number Diff line
@@ -299,13 +299,13 @@ int kfd_init_apertures(struct kfd_process *process)
	struct kfd_dev *dev;
	struct kfd_dev *dev;
	struct kfd_process_device *pdd;
	struct kfd_process_device *pdd;


	mutex_lock(&process->mutex);

	/*Iterating over all devices*/
	/*Iterating over all devices*/
	while ((dev = kfd_topology_enum_kfd_devices(id)) != NULL &&
	while ((dev = kfd_topology_enum_kfd_devices(id)) != NULL &&
		id < NUM_OF_SUPPORTED_GPUS) {
		id < NUM_OF_SUPPORTED_GPUS) {


		pdd = kfd_get_process_device_data(dev, process, 1);
		pdd = kfd_get_process_device_data(dev, process, 1);
		if (!pdd)
			return -1;


		/*
		/*
		 * For 64 bit process aperture will be statically reserved in
		 * For 64 bit process aperture will be statically reserved in
@@ -348,8 +348,6 @@ int kfd_init_apertures(struct kfd_process *process)
		id++;
		id++;
	}
	}


	mutex_unlock(&process->mutex);

	return 0;
	return 0;
}
}


+9 −0
Original line number Original line Diff line number Diff line
@@ -26,6 +26,8 @@
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/amd-iommu.h>
#include <linux/amd-iommu.h>
#include <linux/notifier.h>
#include <linux/notifier.h>
#include <linux/compat.h>

struct mm_struct;
struct mm_struct;


#include "kfd_priv.h"
#include "kfd_priv.h"
@@ -285,8 +287,15 @@ static struct kfd_process *create_process(const struct task_struct *thread)
	if (err != 0)
	if (err != 0)
		goto err_process_pqm_init;
		goto err_process_pqm_init;


	/* init process apertures*/
	process->is_32bit_user_mode = is_compat_task();
	if (kfd_init_apertures(process) != 0)
		goto err_init_apretures;

	return process;
	return process;


err_init_apretures:
	pqm_uninit(&process->pqm);
err_process_pqm_init:
err_process_pqm_init:
	hash_del_rcu(&process->kfd_processes);
	hash_del_rcu(&process->kfd_processes);
	synchronize_rcu();
	synchronize_rcu();
+6 −2
Original line number Original line Diff line number Diff line
@@ -700,8 +700,6 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr,
				dev->node_props.simd_per_cu);
				dev->node_props.simd_per_cu);
		sysfs_show_32bit_prop(buffer, "max_slots_scratch_cu",
		sysfs_show_32bit_prop(buffer, "max_slots_scratch_cu",
				dev->node_props.max_slots_scratch_cu);
				dev->node_props.max_slots_scratch_cu);
		sysfs_show_32bit_prop(buffer, "engine_id",
				dev->node_props.engine_id);
		sysfs_show_32bit_prop(buffer, "vendor_id",
		sysfs_show_32bit_prop(buffer, "vendor_id",
				dev->node_props.vendor_id);
				dev->node_props.vendor_id);
		sysfs_show_32bit_prop(buffer, "device_id",
		sysfs_show_32bit_prop(buffer, "device_id",
@@ -715,6 +713,12 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr,
						dev->gpu->kgd));
						dev->gpu->kgd));
			sysfs_show_64bit_prop(buffer, "local_mem_size",
			sysfs_show_64bit_prop(buffer, "local_mem_size",
					kfd2kgd->get_vmem_size(dev->gpu->kgd));
					kfd2kgd->get_vmem_size(dev->gpu->kgd));

			sysfs_show_32bit_prop(buffer, "fw_version",
					kfd2kgd->get_fw_version(
							dev->gpu->kgd,
							KGD_ENGINE_MEC1));

		}
		}


		ret = sysfs_show_32bit_prop(buffer, "max_engine_clk_ccompute",
		ret = sysfs_show_32bit_prop(buffer, "max_engine_clk_ccompute",
+15 −0
Original line number Original line Diff line number Diff line
@@ -45,6 +45,17 @@ enum kgd_memory_pool {
	KGD_POOL_FRAMEBUFFER = 3,
	KGD_POOL_FRAMEBUFFER = 3,
};
};


enum kgd_engine_type {
	KGD_ENGINE_PFP = 1,
	KGD_ENGINE_ME,
	KGD_ENGINE_CE,
	KGD_ENGINE_MEC1,
	KGD_ENGINE_MEC2,
	KGD_ENGINE_RLC,
	KGD_ENGINE_SDMA,
	KGD_ENGINE_MAX
};

struct kgd2kfd_shared_resources {
struct kgd2kfd_shared_resources {
	/* Bit n == 1 means VMID n is available for KFD. */
	/* Bit n == 1 means VMID n is available for KFD. */
	unsigned int compute_vmid_bitmap;
	unsigned int compute_vmid_bitmap;
@@ -137,6 +148,8 @@ struct kgd2kfd_calls {
 *
 *
 * @hqd_destroy: Destructs and preempts the queue assigned to that hqd slot.
 * @hqd_destroy: Destructs and preempts the queue assigned to that hqd slot.
 *
 *
 * @get_fw_version: Returns FW versions from the header
 *
 * This structure contains function pointers to services that the kgd driver
 * This structure contains function pointers to services that the kgd driver
 * provides to amdkfd driver.
 * provides to amdkfd driver.
 *
 *
@@ -176,6 +189,8 @@ struct kfd2kgd_calls {
	int (*hqd_destroy)(struct kgd_dev *kgd, uint32_t reset_type,
	int (*hqd_destroy)(struct kgd_dev *kgd, uint32_t reset_type,
				unsigned int timeout, uint32_t pipe_id,
				unsigned int timeout, uint32_t pipe_id,
				uint32_t queue_id);
				uint32_t queue_id);
	uint16_t (*get_fw_version)(struct kgd_dev *kgd,
				enum kgd_engine_type type);
};
};


bool kgd2kfd_init(unsigned interface_version,
bool kgd2kfd_init(unsigned interface_version,
Loading