drm/ast: Do not enable PCI resources multiple times

suijingfeng suijingfeng at loongson.cn
Tue Jul 18 04:48:43 UTC 2023


Hi,


I have tested this patch on my x86-64(i3-8100, H110 D4L board) + ast2400 
discrete BMC card just now,

drm/ast still works on normal case.


But  originally this function is called in ast_post_gpu() function.

ast_post_gpu() doesn't happen on my test case.


I know something about the POST (Power On Self Test),

In the past, my mips and loongarch have difficulty to run x86 VBIOS code.

So part of my radeon and amdgpu gpu card will just hang(stall) at the 
bios/vbios boot stage.

When we debugging, we hasty solve this problem by disabling (comment out)

the VBIOS part initialization code of the BIOS.

The results is that the screen will not light-up during the boot stage.

We relay the kernel-space drivers (drm/radeon and drm/amdgpu) to 
initialize the GPU.

In this case, (drm/radeon and drm/amdgpu) driver log(dmesg) will print : 
"need POST ...".


So, from my past experience, I think the "need POST" will only happens

when there no firmware support for a specific machine + BMC combination.

But this is not a normal case.


So, I think we probably could try this, if there no objections from 
experienced reviewers.


On 2023/7/12 21:08, Thomas Zimmermann wrote:
> Remove ast_init_pci_config() as the ast driver already enables the PCI
> resources by calling pcim_enable_device().
>
> Suggested-by: Sui Jingfeng <suijingfeng at loongson.cn>
> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
> Reviewed-by: Jocelyn Falempe <jfalempe at redhat.com>


Tested-by: Sui Jingfeng <suijingfeng at loongson.cn>


> ---
>   drivers/gpu/drm/ast/ast_main.c | 21 ---------------------
>   1 file changed, 21 deletions(-)
>
> diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
> index 8bfbdfd86d77..dae365ed3969 100644
> --- a/drivers/gpu/drm/ast/ast_main.c
> +++ b/drivers/gpu/drm/ast/ast_main.c
> @@ -35,23 +35,6 @@
>   
>   #include "ast_drv.h"
>   
> -static int ast_init_pci_config(struct pci_dev *pdev)
> -{
> -	int err;
> -	u16 pcis04;
> -
> -	err = pci_read_config_word(pdev, PCI_COMMAND, &pcis04);
> -	if (err)
> -		goto out;
> -
> -	pcis04 |= PCI_COMMAND_MEMORY | PCI_COMMAND_IO;
> -
> -	err = pci_write_config_word(pdev, PCI_COMMAND, pcis04);
> -
> -out:
> -	return pcibios_err_to_errno(err);
> -}
> -
>   static bool ast_is_vga_enabled(struct drm_device *dev)
>   {
>   	struct ast_device *ast = to_ast_device(dev);
> @@ -483,10 +466,6 @@ struct ast_device *ast_device_create(const struct drm_driver *drv,
>   			return ERR_PTR(-EIO);
>   	}
>   
> -	ret = ast_init_pci_config(pdev);
> -	if (ret)
> -		return ERR_PTR(ret);
> -
>   	if (!ast_is_vga_enabled(dev)) {
>   		drm_info(dev, "VGA not enabled on entry, requesting chip POST\n");
>   		need_post = true;



More information about the dri-devel mailing list