Commit c03509cb authored by Andrey Grodzovsky's avatar Andrey Grodzovsky Committed by Alex Deucher
Browse files

drm/amdgpu: Fix MMIO access page fault

parent d82e2c24
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
 */

#include <linux/firmware.h>
#include <drm/drm_drv.h>

#include "amdgpu.h"
#include "amdgpu_vcn.h"
@@ -194,11 +195,14 @@ static int vcn_v2_0_sw_init(void *handle)
 */
static int vcn_v2_0_sw_fini(void *handle)
{
	int r;
	int r, idx;
	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
	volatile struct amdgpu_fw_shared *fw_shared = adev->vcn.inst->fw_shared_cpu_addr;

	if (drm_dev_enter(&adev->ddev, &idx)) {
		fw_shared->present_flag_0 = 0;
		drm_dev_exit(idx);
	}

	amdgpu_virt_free_mm_table(adev);

+11 −6
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
 */

#include <linux/firmware.h>
#include <drm/drm_drv.h>

#include "amdgpu.h"
#include "amdgpu_vcn.h"
@@ -235,16 +236,20 @@ static int vcn_v2_5_sw_init(void *handle)
 */
static int vcn_v2_5_sw_fini(void *handle)
{
	int i, r;
	int i, r, idx;
	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
	volatile struct amdgpu_fw_shared *fw_shared;

	if (drm_dev_enter(&adev->ddev, &idx)) {
		for (i = 0; i < adev->vcn.num_vcn_inst; i++) {
			if (adev->vcn.harvest_config & (1 << i))
				continue;
			fw_shared = adev->vcn.inst[i].fw_shared_cpu_addr;
			fw_shared->present_flag_0 = 0;
		}
		drm_dev_exit(idx);
	}


	if (amdgpu_sriov_vf(adev))
		amdgpu_virt_free_mm_table(adev);