gpu: host1x: Add plausibility check on Host1x calibration data

When syncpoint and channel property are read from device-tree,
add plausibility check to validate against reference data.

Jira HOSTX-5843

Change-Id: I66dd9a5f18200aa8baaeecd36499dfb0ca24ba01
Signed-off-by: Mainak Sen <msen@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3293524
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Mainak Sen
2025-01-30 08:29:09 +00:00
committed by Jon Hunter
parent 2e59ef0253
commit aa3decfdb8

View File

@@ -930,6 +930,10 @@ static int host1x_get_assigned_resources(struct host1x *host)
if (err == 0) { if (err == 0) {
host->channel_base = vals[0]; host->channel_base = vals[0];
host->num_channels = vals[1]; host->num_channels = vals[1];
if (host->channel_base + host->num_channels > host->info->nb_channels) {
dev_err(host->dev, "invalid value for nvidia,channels property");
return -EINVAL;
}
} else if (err == -EINVAL) { } else if (err == -EINVAL) {
host->channel_base = 0; host->channel_base = 0;
host->num_channels = host->info->nb_channels; host->num_channels = host->info->nb_channels;
@@ -942,6 +946,10 @@ static int host1x_get_assigned_resources(struct host1x *host)
if (err == 0) { if (err == 0) {
host->syncpt_base = vals[0]; host->syncpt_base = vals[0];
host->syncpt_end = vals[0] + vals[1]; host->syncpt_end = vals[0] + vals[1];
if (host->syncpt_end > host->info->nb_pts) {
dev_err(host->dev, "invalid value for nvidia,syncpoints property");
return -EINVAL;
}
} else if (err == -EINVAL) { } else if (err == -EINVAL) {
host->syncpt_base = 0; host->syncpt_base = 0;
host->syncpt_end = host->info->nb_pts; host->syncpt_end = host->info->nb_pts;