summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd
AgeCommit message (Collapse)AuthorFilesLines
2015-01-22Merge remote-tracking branch 'origin/master' into drm-nextDave Airlie10-367/+219
Backmerge Linus tree after rc5 + drm-fixes went in. There were a few amdkfd conflicts I wanted to avoid, and Ben requested this for nouveau also. Conflicts: drivers/gpu/drm/amd/amdkfd/Makefile drivers/gpu/drm/amd/amdkfd/kfd_chardev.c drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c drivers/gpu/drm/amd/amdkfd/kfd_priv.h drivers/gpu/drm/amd/include/kgd_kfd_interface.h drivers/gpu/drm/i915/intel_runtime_pm.c drivers/gpu/drm/radeon/radeon_kfd.c
2015-01-18drm/amdkfd: Fix description of sched_policy module parameterBen Goz1-1/+1
Signed-off-by: Ben Goz <ben.goz@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-01-15drm/amdkfd: Remove sync_with_hw() from amdkfdOded Gabbay3-30/+0
This patch completely removes the sync_with_hw() because it was broken and actually there is no point of using it. This function was used to: - Make sure that the submitted packet to the HIQ (which is a kernel queue) was read by the CP. However, it was discovered that the method this function used to do that (checking wptr == rptr) is not consistent with how the actual CP firmware works in all cases. - Make sure that the queue is empty before issuing the next packet. To achieve that, the function blocked amdkfd from continuing until the recently submitted packet was consumed. However, the acquire_packet_buffer() already checks if there is enough room for a new packet so calling sync_with_hw() is redundant. Signed-off-by: Oded Gabbay <oded.gabbay@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com>
2015-01-15drm/amdkfd: Remove unused function busy_wait()Oded Gabbay1-6/+0
Signed-off-by: Oded Gabbay <oded.gabbay@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com>
2015-01-15drm/amdkfd: Replace cpu_relax() with schedule() in DQMOded Gabbay1-1/+2
In order not to occupy the current core and thus prevent the core from servicing IOMMU PPR requests, this patch replaces the call in DQM to cpu_relax() with a call to schedule(). Signed-off-by: Oded Gabbay <oded.gabbay@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com>
2015-01-13drm/amdkfd: Fix for-loop when allocating HQD (non-HWS)Ben Goz1-3/+3
This patch fixes a minor bug in allocate_hqd(), where the loop run from the next-to-allocate pipe until the number of pipes. This is wrong because we need to consider the possibility where next-to-allocate pipe is not 0, and thus, the for-loop only checks part of the pipes and doesn't wrap-around, as it supposed to do. Therefore, we add another counting variable to make sure we go over all the pipes, regardless of where we start to look at the first iteration of the loop. This bug only affected non-HWS mode. In HWS mode, the CP fw is responsible for allocating the HQD. Signed-off-by: Ben Goz <ben.goz@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com>
2015-01-08drm/amdkfd: Fix sparse warning (different address space)Oded Gabbay1-1/+1
Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2015-01-08drm/amdkfd: Drop interrupt SW ring bufferMichel Dänzer4-212/+2
The work queue couldn't reliably prevent the SW ring buffer from overflowing, so dmesg was spammed by kfd kfd: Interrupt ring overflow, dropping interrupt. messages when running e.g. the Atlantis Substance demo from https://wiki.unrealengine.com/Linux_Demos on Kaveri. Since the SW ring buffer doesn't actually do anything at this point, just remove it for now. When actual interrupt processing code is added to amdkfd, it should try to do things immediately and only defer to work queues when necessary. Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2015-01-06drm/amdkfd: rewrite kfd_ioctl() according to drm_ioctl()Oded Gabbay2-48/+86
This patch changes kfd_ioctl() to be very similar to drm_ioctl(). The patch defines an array of amdkfd_ioctls, which maps IOCTL definition to the ioctl function. The kfd_ioctl() uses that mapping to call the appropriate ioctl function, through a function pointer. This patch also declares a new typedef for the ioctl function pointer. v2: Renamed KFD_COMMAND_(START|END) to AMDKFD_... Signed-off-by: Oded Gabbay <oded.gabbay@amd.com> Acked-by: Christian König <christian.koenig@amd.com>
2015-01-06drm/amdkfd: reformat IOCTL definitions to drm-styleOded Gabbay1-7/+8
This patch reformats the ioctl definitions in kfd_ioctl.h to be similar to the drm ioctls definition style. v2: Renamed KFD_COMMAND_(START|END) to AMDKFD_... Signed-off-by: Oded Gabbay <oded.gabbay@amd.com> Acked-by: Christian König <christian.koenig@amd.com>
2015-01-06drm/amdkfd: Do copy_to/from_user in general kfd_ioctl()Oded Gabbay1-117/+117
This patch moves the copy_to_user() and copy_from_user() calls from the different ioctl functions in amdkfd to the general kfd_ioctl() function, as this is a common code for all ioctls. This was done according to example taken from drm_ioctl.c Signed-off-by: Oded Gabbay <oded.gabbay@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com>
2015-01-05drm/amdkfd: unmap VMID<-->PASID when relesing VMID (non-HWS)Ben Goz1-0/+3
This patch fixes a bug where deallocate_vmid() didn't actually unmap the VMID<-->PASID mapping (in the registers). That can cause undefined behavior. This bug only occurs in non-HWS mode. Signed-off-by: Ben Goz <ben.goz@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com>
2015-01-04drm/amdkfd: Load mqd to hqd in non-HWS modeBen Goz1-0/+12
This patch fixes a bug in DQM, where the MQD of a newly created compute queue is not loaded to an HQD slot. As a result, the CP never reads packets from this queue. This bug happens only in non-HWS (hardware scheduling) mode. In HWS mode, the CP is responsible of loading MQDs to HQDs slots. Signed-off-by: Ben Goz <ben.goz@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com>
2014-12-09drm/amd: Fixing typos in kfd<->kgd interfaceBen Goz2-2/+2
Signed-off-by: Ben Goz <ben.goz@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-12-28amdkfd: actually allocate longs for the pasid bitmaskSasha Levin1-1/+1
Commit "amdkfd: use sizeof(long) granularity for the pasid bitmask" calculated the number of longs it will need, but ended up allocating that number of bytes rather than longs. Fix that silly error and allocate the amount of data really required. Signed-off-by: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-12-05amdkfd: Remove duplicate includeOded Gabbay1-1/+0
Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-12-02amdkfd: Fixing topology bug in building sysfs nodesBen Goz1-1/+1
Original code sent always 0 as the index number of the node. This patch fixes this bug by sending a variable which is incremented per node. Signed-off-by: Ben Goz <ben.goz@amd.com> Reviewed-by: Oded Gabbay <oded.gabbay@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-12-07amdkfd: Fix accounting of device queuesOded Gabbay1-2/+11
This patch fixes a device QCM bug, where the number of queues were not counted correctly for the operation of update queue. The count was incorrect as there was no regard to the previous state of the queue. Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-12-02drm/amdkfd: Add initial VI support for KQBen Goz5-4/+127
This patch starts to add support for the VI APU in the KQ (kernel queue) module. Because most (more than 90%) of the KQ code is shared among AMD's APUs, we chose a design that performs most/all the code in the shared KQ file (kfd_kernel_queue.c). If there is H/W specific code to be executed, than it is written in an asic-specific extension function for that H/W. That asic-specific extension function is called from the shared function at the appropriate time. This requires that for every asic-specific extension function that is implemented in a specific ASIC, there will be an equivalent implementation in ALL ASICs, even if those implementations are just stubs. That way we achieve: - Maintainability: by having one copy of most of the code, we only need to fix bugs at one locations - Readability: very clear what is the shared code and what is done per ASIC - Extensibility: very easy to add new H/W specific files/functions Signed-off-by: Ben Goz <ben.goz@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-01-12drm/amdkfd: Encapsulate KQ functions in ops structureOded Gabbay3-27/+54
This patch does some re-org on the kernel_queue structure. It takes out all the function pointers from the structure and puts them in a new structure, called kernel_queue_ops. Then, it puts an instance of that structure inside kernel_queue. This re-org is done to prepare the KQ module to support more than one AMD APU (Kaveri). Signed-off-by: Oded Gabbay <oded.gabbay@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-01-12drm/amdkfd: Add initial VI support for DQMBen Goz5-86/+238
This patch starts to add support for the VI APU in the DQM module. Because most (more than 90%) of the DQM code is shared among AMD's APUs, we chose a design that performs most/all the code in the shared DQM file (kfd_device_queue_manager.c). If there is H/W specific code to be executed, than it is written in an asic-specific extension function for that H/W. That asic-specific extension function is called from the shared function at the appropriate time. This requires that for every asic-specific extension function that is implemented in a specific ASIC, there will be an equivalent implementation in ALL ASICs, even if those implementations are just stubs. That way we achieve: - Maintainability: by having one copy of most of the code, we only need to fix bugs at one locations - Readability: very clear what is the shared code and what is done per ASIC - Extensibility: very easy to add new H/W specific files/functions Signed-off-by: Ben Goz <ben.goz@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-01-12drm/amdkfd: Encapsulate DQM functions in ops structureOded Gabbay6-54/+65
This patch does some re-org on the device_queue_manager structure. It takes out all the function pointers from the structure and puts them in a new structure, called device_queue_manager_ops. Then, it puts an instance of that structure inside device_queue_manager. This re-org is done to prepare the DQM module to support more than one AMD APU (Kaveri). Signed-off-by: Oded Gabbay <oded.gabbay@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-01-12drm/amdkfd: Don't BUG on freeing GART sub-allocationOded Gabbay1-1/+4
Instead of creating a BUG if trying to free a NULL GART sub-allocation object, just return 0 (success). This is done to mirror behavior of kfree. Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-11-18amdkfd: init aperture once per processAlexey Skidanov3-8/+11
Since the user space may call open() more that once from the same process, the aperture initialization should be moved from kfd_open() Signed-off-by: Alexey Skidanov <Alexey.Skidanov@amd.com> Reviewed-by: Oded Gabbay <oded.gabbay@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-11-09amdkfd: Display MEC fw version in topology nodeOded Gabbay1-2/+6
This patch displays the firmware version of the microcode that is currently running in the MEC. This is needed for the HSA RT, so it could differentiate its behavior based on fw version. e.g. workarounds for bugs in fw v2: Send the KGD_ENGINE_MEC1 as a parameter to the get_fw_version() Signed-off-by: Oded Gabbay <oded.gabbay@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2014-11-09drm/amd: Add get_fw_version to kfd-->kgd interfaceOded Gabbay1-0/+15
This patch adds a new interface to the kfd-->kgd interface. The new interface function retrieves the firmware version that is currently in use by the MEC engine. The firmware was uploaded to the MEC engine by the kgd (radeon). v2: Added parameter of engine type to interface function Signed-off-by: Oded Gabbay <oded.gabbay@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2014-12-05amdkfd: Disable support for 32-bit user processesOded Gabbay1-1/+12
This patch checks if the process that opens the /dev/kfd device is 32-bit process. If so, it returns -EPERM and prints a warning message in dmesg. This is done to prevent 32-bit user processes from using amdkfd, and hence, HSA features. AMD's HSA userspace stack will also support only 64-bit processes on Linux. Reviewed-by: Alexey Skidanov <alexey.skidanov@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-12-04amdkfd: Set *buffer_ptr to NULL in case of errorOded Gabbay1-1/+7
In function acquire_packet_buffer() we may return -ENOMEM. In that case, we should set the *buffer_ptr to NULL, so that calling functions which check the *buffer_ptr value as a criteria for success, will know that acquire_packet_buffer() failed. Reviewed-by: Alexey Skidanov <alexey.skidanov@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-12-03amdkfd: use atomic allocations within srcu callbacksSasha Levin1-1/+1
srcu callbacks are running in atomic context, we can't allocate using __GFP_WAIT. Signed-off-by: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-12-03amdkfd: use sizeof(long) granularity for the pasid bitmaskSasha Levin1-2/+1
All the bit operations (such as find_first_zero_bit()) read sizeof(long) bytes at a time. If we allocated less than sizeof(long) bytes for the bitmask we would be accessing invalid memory when working with the bitmask. Change the allocator to allocate sizeof(long) multiples for the bitmask. Signed-off-by: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-11-25amdkfd: delete some dead codeDan Carpenter1-5/+0
This is dead code. We don't need to unbind here, we can just return directly. Reviewed-by: Oded Gabbay <oded.gabbay@amd.com> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-11-25amdkfd: Fix memory leak of mqds on dqm finiOded Gabbay1-0/+4
The mqds array members are not freed when dqm is uninitialized. Reviewed-by: Ben Goz <Ben.Goz@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-11-25amdkfd: fix an error handling bug in pqm_create_queue()Dan Carpenter1-1/+1
The call to kernel_queue_uninit(NULL) will trigger a BUG(), and also the error code is incorrect. Fixes: 45102048f77e ('amdkfd: Add process queue manager module') Reviewed-by: Oded Gabbay <oded.gabbay@amd.com> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-11-25amdkfd: fix some error handling in ioctlDan Carpenter1-2/+2
There is a typo here so the errors from kfd_bind_process_to_device() are not detected. Reviewed-by: Oded Gabbay <oded.gabbay@amd.com> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-11-21amdkfd: Remove DRM_AMDGPU dependency from KconfigOded Gabbay1-1/+1
This patch removes the dependency of amdkfd upon DRM_AMDGPU symbol in amdkfd's Kconfig file. This is done because amdgpu driver is not yet upstreamed and therefore, DRM_AMDGPU symbol is not present in any Kconfig file. Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-11-21amdkfd: explicitely include io.h in kfd_doorbell.cOded Gabbay1-0/+1
This patch fixes a compilation error when using certain configuration by including the file io.h in kfd_doorbell.c Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-11-09amdkfd: Clear ctx cb before suspendOded Gabbay1-0/+1
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-11-19amdkfd: Instead of using get function, use container_ofAlexey Skidanov2-12/+11
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alexey Skidanov <Alexey.Skidanov@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-11-17amdkfd: use schedule() in sync_with_hwOded Gabbay1-1/+2
amdkfd uses cpu_relax() in its sync_with_hw() function. Because cpu_relax() is defined as 'REP; NOP' on x86_64, it will block the CPU from servicing IOMMU PPR requests. This may cause a deadlock, because sync_with_hw() won't be completed until the PPR request has been served. Therefore, we need to use schedule() instead of cpu_relax() as it is the minimum requirement to allow other threads to execute. Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-11-20amdkfd: Fix memory leak on process deregistrationJay Cornwall1-0/+1
struct device_process_node was allocated during process registration but not released at process deregistration. Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Jay Cornwall <jay.cornwall@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-11-20amdkfd: add __iomem attribute to doorbell_ptrOded Gabbay2-6/+5
This patch was done due to sparse warning. It changes the definition of doorbell_ptr in queue_properties to be with __iomem attribute, so it would match the type which the doorbell module functions are returning. Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-11-20amdkfd: fence_wait_timeout() can be staticOded Gabbay1-2/+3
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-11-20amdkfd: is_occupied() can be staticOded Gabbay1-3/+3
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-11-20amdkfd: Fix sparse warnings in kfd_flat_memory.cOded Gabbay1-5/+6
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-11-20amdkfd: pqm_get_kernel_queue() can be statickbuild test robot1-1/+2
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-11-20amdkfd: test_kq() can be statickbuild test robot1-1/+1
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-11-20amdkfd: Fix sparse warnings in kfd_topology.cOded Gabbay1-20/+20
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-11-20amdkfd: Fix sparse warnings in kfd_chardev.cOded Gabbay1-4/+12
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-11-02amdkfd: Implement the Get Version IOCTLOded Gabbay1-1/+10
Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
2014-08-18drm/amdkfd: Fix logic of destroy_queue_nocpsch()Ben Goz1-18/+18
This patch rewrites destroy_queue_nocpsch() as the current logic that is implemented in the function is completely flawed. This function is used only in non-HWS mode. Signed-off-by: Ben Goz <ben.goz@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com>