[PATCH v2 06/14] drm/ast: Set PCI config before accessing I/O registers

Thomas Zimmermann tzimmermann at suse.de
Fri Jun 23 09:02:52 UTC 2023


Hi

Am 22.06.23 um 17:42 schrieb Sui Jingfeng:
[...]
>> +    ret = ast_init_pci_config(pdev);
>> +    if (ret)
>> +        return ERR_PTR(ret);
>> +
> 
> 
> Is the calling to ast_init_pci_config() absolute necessary ?
> 
> I'm asking this question because
> 
> I think this function is needed to be run only when the chip need POST.
> 
> On normal case, when you call pcim_enable_device() function,
> 
> the pci_enable_device() function will do such thing for you.

You're right. We could probably remove this code from the driver. I 
don't want to do this in a patchset that is about refactoring. Maybe in 
a later patch.

> 
> 
> ```
> 
> int pci_enable_device(struct pci_dev *dev)
> {
>      return pci_enable_device_flags(dev, IORESOURCE_MEM | IORESOURCE_IO);
> }
> 
> ```
> 
>>       if (!ast_is_vga_enabled(dev)) {
>>           drm_info(dev, "VGA not enabled on entry, requesting chip 
>> POST\n");
>>           need_post = true;
>> diff --git a/drivers/gpu/drm/ast/ast_post.c 
>> b/drivers/gpu/drm/ast/ast_post.c
>> index aa3f2cb00f82c..2da5bdb4bac45 100644
>> --- a/drivers/gpu/drm/ast/ast_post.c
>> +++ b/drivers/gpu/drm/ast/ast_post.c
>> @@ -361,12 +361,6 @@ static void ast_init_dram_reg(struct drm_device 
>> *dev)
>>   void ast_post_gpu(struct drm_device *dev)
>>   {
>>       struct ast_device *ast = to_ast_device(dev);
>> -    struct pci_dev *pdev = to_pci_dev(dev->dev);
>> -    u32 reg;
>> -
>> -    pci_read_config_dword(pdev, 0x04, &reg);
>> -    reg |= 0x3;
>> -    pci_write_config_dword(pdev, 0x04, reg);
> 
> You have changed the semantics after this patch is applied .
> 
> Yes, it still works.
> 
> But would you like to explain something about this?

I'm looking at the function, but I don't see the change in semantics. I 
only moved the PCI calls and added error detection. What do you mean?

Best regards
Thomas

> 
> We want to learn more knowledge from your patch.
> 
>>       ast_enable_vga(dev);
>>       ast_open_key(ast);
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20230623/77677558/attachment.sig>


More information about the dri-devel mailing list