[01/32] bios/vpstate: There are some fermi vbios with no boost or tdp entry

Submitted by Karol Herbst on Nov. 17, 2017, 12:04 a.m.

Details

Message ID 20171117000436.2432-2-karolherbst@gmail.com
State New
Headers show
Series "Updated State of my clk patches" ( rev: 1 ) in Nouveau

Not browsing as part of any series.

Commit Message

Karol Herbst Nov. 17, 2017, 12:04 a.m.
Signed-off-by: Karol Herbst <karolherbst@gmail.com>
---
 drm/nouveau/nvkm/subdev/bios/vpstate.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drm/nouveau/nvkm/subdev/bios/vpstate.c b/drm/nouveau/nvkm/subdev/bios/vpstate.c
index 20b6fc82..71524548 100644
--- a/drm/nouveau/nvkm/subdev/bios/vpstate.c
+++ b/drm/nouveau/nvkm/subdev/bios/vpstate.c
@@ -58,8 +58,14 @@  nvbios_vpstate_parse(struct nvkm_bios *b, struct nvbios_vpstate_header *h)
 		h->ecount   = nvbios_rd08(b, h->offset + 0x5);
 
 		h->base_id  = nvbios_rd08(b, h->offset + 0x0f);
-		h->boost_id = nvbios_rd08(b, h->offset + 0x10);
-		h->tdp_id   = nvbios_rd08(b, h->offset + 0x11);
+		if (h->hlen > 0x10)
+			h->boost_id = nvbios_rd08(b, h->offset + 0x10);
+		else
+			h->boost_id = 0xff;
+		if (h->hlen > 0x11)
+			h->tdp_id = nvbios_rd08(b, h->offset + 0x11);
+		else
+			h->tdp_id = 0xff;
 		return 0;
 	default:
 		return -EINVAL;

Comments

On 17/11/17 02:04, Karol Herbst wrote:

Please add here something like this:

If the entry size is too small, default to invalid values for both
boost_id and tdp_id, so as to default to the base clock in both cases.

> Signed-off-by: Karol Herbst <karolherbst@gmail.com>

With the better commit message, this patch is:
Signed-off-by: Martin Peres <martin.peres@free.fr>

> ---
>  drm/nouveau/nvkm/subdev/bios/vpstate.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drm/nouveau/nvkm/subdev/bios/vpstate.c b/drm/nouveau/nvkm/subdev/bios/vpstate.c
> index 20b6fc82..71524548 100644
> --- a/drm/nouveau/nvkm/subdev/bios/vpstate.c
> +++ b/drm/nouveau/nvkm/subdev/bios/vpstate.c
> @@ -58,8 +58,14 @@ nvbios_vpstate_parse(struct nvkm_bios *b, struct nvbios_vpstate_header *h)
>  		h->ecount   = nvbios_rd08(b, h->offset + 0x5);
>  
>  		h->base_id  = nvbios_rd08(b, h->offset + 0x0f);
> -		h->boost_id = nvbios_rd08(b, h->offset + 0x10);
> -		h->tdp_id   = nvbios_rd08(b, h->offset + 0x11);
> +		if (h->hlen > 0x10)
> +			h->boost_id = nvbios_rd08(b, h->offset + 0x10);
> +		else
> +			h->boost_id = 0xff;
> +		if (h->hlen > 0x11)
> +			h->tdp_id = nvbios_rd08(b, h->offset + 0x11);
> +		else
> +			h->tdp_id = 0xff;
>  		return 0;
>  	default:
>  		return -EINVAL;
>
On Wed, Nov 22, 2017 at 1:16 AM, Martin Peres <martin.peres@free.fr> wrote:
> On 17/11/17 02:04, Karol Herbst wrote:
>
> Please add here something like this:
>
> If the entry size is too small, default to invalid values for both
> boost_id and tdp_id, so as to default to the base clock in both cases.
>

well actually we still have the option to go max clocks, there is no
entry for that. The entire table just defines limits, which may be
enabled or not.

>> Signed-off-by: Karol Herbst <karolherbst@gmail.com>
>
> With the better commit message, this patch is:
> Signed-off-by: Martin Peres <martin.peres@free.fr>
>
>> ---
>>  drm/nouveau/nvkm/subdev/bios/vpstate.c | 10 ++++++++--
>>  1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/drm/nouveau/nvkm/subdev/bios/vpstate.c b/drm/nouveau/nvkm/subdev/bios/vpstate.c
>> index 20b6fc82..71524548 100644
>> --- a/drm/nouveau/nvkm/subdev/bios/vpstate.c
>> +++ b/drm/nouveau/nvkm/subdev/bios/vpstate.c
>> @@ -58,8 +58,14 @@ nvbios_vpstate_parse(struct nvkm_bios *b, struct nvbios_vpstate_header *h)
>>               h->ecount   = nvbios_rd08(b, h->offset + 0x5);
>>
>>               h->base_id  = nvbios_rd08(b, h->offset + 0x0f);
>> -             h->boost_id = nvbios_rd08(b, h->offset + 0x10);
>> -             h->tdp_id   = nvbios_rd08(b, h->offset + 0x11);
>> +             if (h->hlen > 0x10)
>> +                     h->boost_id = nvbios_rd08(b, h->offset + 0x10);
>> +             else
>> +                     h->boost_id = 0xff;
>> +             if (h->hlen > 0x11)
>> +                     h->tdp_id = nvbios_rd08(b, h->offset + 0x11);
>> +             else
>> +                     h->tdp_id = 0xff;
>>               return 0;
>>       default:
>>               return -EINVAL;
>>
>
> _______________________________________________
> Nouveau mailing list
> Nouveau@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau