Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/hisilicon/hibmc: missing DP IRQ in hibmc_msi_init() on
  single-MSI fallback
--

commit c5b72c7e5869fdeb7952573f12ec81ff829734f9
Author: Lin He <[email protected]>

drm/hisilicon/hibmc: Add a flag to indicate whether the OS-side driver has been 
loaded

This commit adds a hardware enable flag to notify the BMC when the OS
driver and DP block are initialized, and serializes RMW access to the
shared GPIO/flag register with a spinlock.

> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c 
> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> index a110b5e15e596..9b9077b69cdc5 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c

[ ... ]

> @@ -347,12 +349,17 @@ static void hibmc_unload(struct drm_device *dev)
>  static int hibmc_msi_init(struct drm_device *dev)
>  {
>       struct pci_dev *pdev = to_pci_dev(dev->dev);
> +     struct hibmc_drm_private *priv = to_hibmc_drm_private(dev);
> +     int max_vectors = HIBMC_MIN_VECTORS;
>       int valid_irq_num;
>       int irq;
>       int ret;
>  
> -     ret = pci_alloc_irq_vectors(pdev, HIBMC_MIN_VECTORS,
> -                                 HIBMC_MAX_VECTORS, PCI_IRQ_MSI);
> +     if (priv->dp.initialized)
> +             max_vectors = HIBMC_MAX_VECTORS;
> +
> +     ret = pci_alloc_irq_vectors(pdev, HIBMC_MIN_VECTORS, max_vectors,
> +                                 PCI_IRQ_MSI);
>       if (ret < 0) {
>               drm_err(dev, "enabling MSI failed: %d\n", ret);
>               return ret;

[Severity: Medium]
What happens when priv->dp.initialized is true, but
pci_alloc_irq_vectors() only allocates 1 vector instead of 2 (for
example, when multi-MSI is unavailable)?

Because HIBMC_MIN_VECTORS (1) is still passed as min_vecs,
hibmc_msi_init() succeeds while only requesting vector 0
(hibmc_interrupt()) and skipping hibmc_dp_interrupt().  However,
hibmc_set_enable_flag() still sets HIBMC_ENABLE_STATE because
priv->dp.initialized is true, and hibmc_dp_late_register() unmasks DP
interrupts via hibmc_dp_enable_int().  With single-message MSI fallback,
DP interrupts are routed to vector 0 where hibmc_interrupt() does not
clear them and returns IRQ_NONE, triggering an unhandled interrupt storm
that disables vector 0 and leaves DP HPD broken.

Should min_vecs also be HIBMC_MAX_VECTORS when priv->dp.initialized is
true, or should DP be disabled if the second vector cannot be allocated?

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=2

Reply via email to