Commit acdae216 authored by Luben Tuikov's avatar Luben Tuikov Committed by Alex Deucher
Browse files

drm/amdgpu: Remove redundant ras->supported



Remove redundant ras->supported, as this value
is also stored in adev->ras_features.

Use adev->ras_features, as that supercedes "ras",
since the latter is its member.

The dependency goes like this:
ras <== adev->ras_features <== hw_supported,
and is read as "ras depends on ras_features, which
depends on hw_supported." The arrows show the flow
of information, i.e. the dependency update.

"hw_supported" should also live in "adev".

Cc: Alexander Deucher <Alexander.Deucher@amd.com>
Cc: John Clements <john.clements@amd.com>
Cc: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: default avatarLuben Tuikov <luben.tuikov@amd.com>
Acked-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarJohn Clements <John.Clements@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 71efc870
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -5108,7 +5108,8 @@ int amdgpu_device_baco_enter(struct drm_device *dev)
	if (!amdgpu_device_supports_baco(adev_to_drm(adev)))
		return -ENOTSUPP;

	if (ras && ras->supported && adev->nbio.funcs->enable_doorbell_interrupt)
	if (ras && adev->ras_features &&
	    adev->nbio.funcs->enable_doorbell_interrupt)
		adev->nbio.funcs->enable_doorbell_interrupt(adev, false);

	return amdgpu_dpm_baco_enter(adev);
@@ -5127,7 +5128,8 @@ int amdgpu_device_baco_exit(struct drm_device *dev)
	if (ret)
		return ret;

	if (ras && ras->supported && adev->nbio.funcs->enable_doorbell_interrupt)
	if (ras && adev->ras_features &&
	    adev->nbio.funcs->enable_doorbell_interrupt)
		adev->nbio.funcs->enable_doorbell_interrupt(adev, true);

	return 0;
+1 −1
Original line number Diff line number Diff line
@@ -986,7 +986,7 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)

		if (!ras)
			return -EINVAL;
		ras_mask = (uint64_t)ras->supported << 32 | ras->features;
		ras_mask = (uint64_t)adev->ras_features << 32 | ras->features;

		return copy_to_user(out, &ras_mask,
				min_t(u64, size, sizeof(ras_mask))) ?
+1 −1
Original line number Diff line number Diff line
@@ -2146,7 +2146,7 @@ static int psp_load_smu_fw(struct psp_context *psp)
		return 0;

	if ((amdgpu_in_reset(adev) &&
	     ras && ras->supported &&
	     ras && adev->ras_features &&
	     (adev->asic_type == CHIP_ARCTURUS ||
	      adev->asic_type == CHIP_VEGA20)) ||
	     (adev->in_runpm &&
+4 −5
Original line number Diff line number Diff line
@@ -2130,9 +2130,8 @@ static void amdgpu_ras_check_supported(struct amdgpu_device *adev,
	/* hw_supported needs to be aligned with RAS block mask. */
	*hw_supported &= AMDGPU_RAS_BLOCK_MASK;

	*supported = amdgpu_ras_enable == 0 ?
			0 : *hw_supported & amdgpu_ras_mask;
	adev->ras_features = *supported;
	*supported = amdgpu_ras_enable == 0 ? 0 :
		*hw_supported & amdgpu_ras_mask;
}

int amdgpu_ras_init(struct amdgpu_device *adev)
@@ -2154,7 +2153,7 @@ int amdgpu_ras_init(struct amdgpu_device *adev)
	amdgpu_ras_set_context(adev, con);

	amdgpu_ras_check_supported(adev, &con->hw_supported,
			&con->supported);
				   &adev->ras_features);
	if (!con->hw_supported || (adev->asic_type == CHIP_VEGA10)) {
		/* set gfx block ras context feature for VEGA20 Gaming
		 * send ras disable cmd to ras ta during ras late init.
@@ -2210,7 +2209,7 @@ int amdgpu_ras_init(struct amdgpu_device *adev)

	dev_info(adev->dev, "RAS INFO: ras initialized successfully, "
			"hardware ability[%x] ras_mask[%x]\n",
			con->hw_supported, con->supported);
			con->hw_supported, adev->ras_features);
	return 0;
release_con:
	amdgpu_ras_set_context(adev, NULL);
+1 −3
Original line number Diff line number Diff line
@@ -314,8 +314,6 @@ struct amdgpu_ras {
	/* ras infrastructure */
	/* for ras itself. */
	uint32_t hw_supported;
	/* for IP to check its ras ability. */
	uint32_t supported;
	uint32_t features;
	struct list_head head;
	/* sysfs */
@@ -478,7 +476,7 @@ static inline int amdgpu_ras_is_supported(struct amdgpu_device *adev,

	if (block >= AMDGPU_RAS_BLOCK_COUNT)
		return 0;
	return ras && (ras->supported & (1 << block));
	return ras && (adev->ras_features & (1 << block));
}

int amdgpu_ras_recovery_init(struct amdgpu_device *adev);
Loading