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

Commit 6b7746e8 authored by Jerome Glisse's avatar Jerome Glisse Committed by Dave Airlie
Browse files

drm/radeon/kms: properly set accel working flag and bailout when false



If accel is not working many subsystem such as the ib pool might not be
initialized properly that can lead to segfault inside kernel when cs
ioctl is call with non working acceleration. To avoid this make sure
the accel working flag is false when an error in GPU startup happen and
return EBUSY from cs ioctl if accel is not working.

Signed-off-by: default avatarJerome Glisse <jglisse@redhat.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent f0d14daa
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -3223,6 +3223,7 @@ int evergreen_resume(struct radeon_device *rdev)
	r = evergreen_startup(rdev);
	r = evergreen_startup(rdev);
	if (r) {
	if (r) {
		DRM_ERROR("evergreen startup failed on resume\n");
		DRM_ERROR("evergreen startup failed on resume\n");
		rdev->accel_working = false;
		return r;
		return r;
	}
	}


+1 −0
Original line number Original line Diff line number Diff line
@@ -1547,6 +1547,7 @@ int cayman_resume(struct radeon_device *rdev)
	r = cayman_startup(rdev);
	r = cayman_startup(rdev);
	if (r) {
	if (r) {
		DRM_ERROR("cayman startup failed on resume\n");
		DRM_ERROR("cayman startup failed on resume\n");
		rdev->accel_working = false;
		return r;
		return r;
	}
	}
	return r;
	return r;
+7 −1
Original line number Original line Diff line number Diff line
@@ -3928,6 +3928,8 @@ static int r100_startup(struct radeon_device *rdev)


int r100_resume(struct radeon_device *rdev)
int r100_resume(struct radeon_device *rdev)
{
{
	int r;

	/* Make sur GART are not working */
	/* Make sur GART are not working */
	if (rdev->flags & RADEON_IS_PCI)
	if (rdev->flags & RADEON_IS_PCI)
		r100_pci_gart_disable(rdev);
		r100_pci_gart_disable(rdev);
@@ -3947,7 +3949,11 @@ int r100_resume(struct radeon_device *rdev)
	radeon_surface_init(rdev);
	radeon_surface_init(rdev);


	rdev->accel_working = true;
	rdev->accel_working = true;
	return r100_startup(rdev);
	r = r100_startup(rdev);
	if (r) {
		rdev->accel_working = false;
	}
	return r;
}
}


int r100_suspend(struct radeon_device *rdev)
int r100_suspend(struct radeon_device *rdev)
+7 −1
Original line number Original line Diff line number Diff line
@@ -1431,6 +1431,8 @@ static int r300_startup(struct radeon_device *rdev)


int r300_resume(struct radeon_device *rdev)
int r300_resume(struct radeon_device *rdev)
{
{
	int r;

	/* Make sur GART are not working */
	/* Make sur GART are not working */
	if (rdev->flags & RADEON_IS_PCIE)
	if (rdev->flags & RADEON_IS_PCIE)
		rv370_pcie_gart_disable(rdev);
		rv370_pcie_gart_disable(rdev);
@@ -1452,7 +1454,11 @@ int r300_resume(struct radeon_device *rdev)
	radeon_surface_init(rdev);
	radeon_surface_init(rdev);


	rdev->accel_working = true;
	rdev->accel_working = true;
	return r300_startup(rdev);
	r = r300_startup(rdev);
	if (r) {
		rdev->accel_working = false;
	}
	return r;
}
}


int r300_suspend(struct radeon_device *rdev)
int r300_suspend(struct radeon_device *rdev)
+7 −1
Original line number Original line Diff line number Diff line
@@ -291,6 +291,8 @@ static int r420_startup(struct radeon_device *rdev)


int r420_resume(struct radeon_device *rdev)
int r420_resume(struct radeon_device *rdev)
{
{
	int r;

	/* Make sur GART are not working */
	/* Make sur GART are not working */
	if (rdev->flags & RADEON_IS_PCIE)
	if (rdev->flags & RADEON_IS_PCIE)
		rv370_pcie_gart_disable(rdev);
		rv370_pcie_gart_disable(rdev);
@@ -316,7 +318,11 @@ int r420_resume(struct radeon_device *rdev)
	radeon_surface_init(rdev);
	radeon_surface_init(rdev);


	rdev->accel_working = true;
	rdev->accel_working = true;
	return r420_startup(rdev);
	r = r420_startup(rdev);
	if (r) {
		rdev->accel_working = false;
	}
	return r;
}
}


int r420_suspend(struct radeon_device *rdev)
int r420_suspend(struct radeon_device *rdev)
Loading