[PATCH] drm/i915/gvt: Fix firmware loading interface for GVT-g golden HW state

Zhi Wang zhi.a.wang at intel.com
Fri Mar 31 08:44:57 UTC 2017



On 03/31/17 16:47, Zhenyu Wang wrote:
> On 2017.03.31 16:30:24 +0800, Zhi Wang wrote:
>> Tested on my SKL, BTW: Zhenyuw: the script works well. :P I adjust the code
>> to fit the name of file generated by the script.
>>
>
> oh, I think that script should fit for kernel instead, but not vice versa...
>
Haha, the REV ID is a 16bit field anyway, so I change the output format 
to %02x instead of %04x in the original code.

>> For further usage of loading golden HW state, I think we need to prevent the
>> user to reboot or reload the module after updating the golden HW state.
>>
>> Also, we need to bump up the firmware version after changing MMIO table as
>> currently we only read HW mmio according to the MMIO table.
>>
>
> oh, my...that's horrible..
>
Yes, it's a bit complicated here. I have thought about it yesterday. 
better we just let function work first and see how the requirement goes 
in future.

>> Let's see how the requirement goes in future.
>>
>> Thanks,
>> Zhi.
>>
>> On 04/01/17 00:00, Zhi Wang wrote:
>>> Firmware loading interface for GVT-g golden HW state has been broken
>>> before. This patch fixes GVT-g firmware loading interface. A user should
>>> apply this patch if he wants to load GVT-g golden HW state from firmware
>>> interface.
>>>
>>> Fixes: 579cea5 ("drm/i915/gvt: golden virtual HW state management")
>>> Cc: Zhenyu Wang <zhenyuw at linux.intel.com>
>>> Cc: drm-intel-fixes at lists.freedesktop.org
>>> Signed-off-by: Zhi Wang <zhi.a.wang at intel.com>
>>> ---
>>>    drivers/gpu/drm/i915/gvt/firmware.c | 9 ++++++---
>>>    1 file changed, 6 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/i915/gvt/firmware.c b/drivers/gpu/drm/i915/gvt/firmware.c
>>> index 933a7c2..dce8d15 100644
>>> --- a/drivers/gpu/drm/i915/gvt/firmware.c
>>> +++ b/drivers/gpu/drm/i915/gvt/firmware.c
>>> @@ -75,11 +75,11 @@ static int expose_firmware_sysfs(struct intel_gvt *gvt)
>>>    	struct gvt_firmware_header *h;
>>>    	void *firmware;
>>>    	void *p;
>>> -	unsigned long size;
>>> +	unsigned long size, crc32_start;
>>>    	int i;
>>>    	int ret;
>>>
>>> -	size = sizeof(*h) + info->mmio_size + info->cfg_space_size - 1;
>>> +	size = sizeof(*h) + info->mmio_size + info->cfg_space_size;
>>>    	firmware = vzalloc(size);
>>>    	if (!firmware)
>>>    		return -ENOMEM;
>>> @@ -112,6 +112,9 @@ static int expose_firmware_sysfs(struct intel_gvt *gvt)
>>>
>>>    	memcpy(gvt->firmware.mmio, p, info->mmio_size);
>>>
>>> +	crc32_start = offsetof(struct gvt_firmware_header, crc32) + 4;
>>> +	h->crc32 = crc32_le(0, firmware + crc32_start, size - crc32_start);
>>> +
>>>    	firmware_attr.size = size;
>>>    	firmware_attr.private = firmware;
>>>
>>> @@ -234,7 +237,7 @@ int intel_gvt_load_firmware(struct intel_gvt *gvt)
>>>
>>>    	firmware->mmio = mem;
>>>
>>> -	sprintf(path, "%s/vid_0x%04x_did_0x%04x_rid_0x%04x.golden_hw_state",
>>> +	sprintf(path, "%s/vid_0x%04x_did_0x%04x_rid_0x%02x.golden_hw_state",
>>>    		 GVT_FIRMWARE_PATH, pdev->vendor, pdev->device,
>>>    		 pdev->revision);
>>>
>>>
>


More information about the intel-gvt-dev mailing list