pci: do a msi rearm on init

Submitted by Karol Herbst on Nov. 24, 2017, 2:56 a.m.

Details

Message ID 20171124025626.14037-1-kherbst@redhat.com
State New
Headers show
Series "pci: do a msi rearm on init" ( rev: 1 ) in Nouveau

Not browsing as part of any series.

Commit Message

Karol Herbst Nov. 24, 2017, 2:56 a.m.
On my GP107 when I load nouveau after unloading it, for some reason the
GPU stopped sending or the CPU stopped receiving interrupts if MSI was
enabled.

Doing a rearm once before getting any interrupts fixes this.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
---
 drm/nouveau/nvkm/subdev/pci/base.c | 4 ++++
 1 file changed, 4 insertions(+)

Patch hide | download patch | download mbox

diff --git a/drm/nouveau/nvkm/subdev/pci/base.c b/drm/nouveau/nvkm/subdev/pci/base.c
index b1b1f362..7ee1fbb4 100644
--- a/drm/nouveau/nvkm/subdev/pci/base.c
+++ b/drm/nouveau/nvkm/subdev/pci/base.c
@@ -136,6 +136,10 @@  nvkm_pci_init(struct nvkm_subdev *subdev)
 		return ret;
 
 	pci->irq = pdev->irq;
+	/* workaround: do a rearm once */
+	if (pci->msi)
+		pci->func->msi_rearm(pci);
+
 	return ret;
 }
 

Comments

On Fri, Nov 24, 2017 at 03:56:26AM +0100, Karol Herbst wrote:
> On my GP107 when I load nouveau after unloading it, for some reason the
> GPU stopped sending or the CPU stopped receiving interrupts if MSI was
> enabled.

I suppose this could happen if the GPU raises an interrupt after the
driver's already called free_irq() on it, and hence the driver can't
rearm itself in the interrupt handler.

This possibly points to a bug somewhere (the GPU should be completely
idle by the time free_irq() is called), but this seems like a valid
thing to do at initialization in any case to avoid relying on the prior
owner of the device to always behave properly.

> Doing a rearm once before getting any interrupts fixes this.
> 
> Signed-off-by: Karol Herbst <kherbst@redhat.com>
> ---
>  drm/nouveau/nvkm/subdev/pci/base.c | 4 ++++
>  1 file changed, 4 insertions(+)

Reviewed-by: Thierry Reding <treding@nvidia.com>
On Fri, Nov 24, 2017 at 3:02 PM, Thierry Reding
<thierry.reding@gmail.com> wrote:
> On Fri, Nov 24, 2017 at 03:56:26AM +0100, Karol Herbst wrote:
>> On my GP107 when I load nouveau after unloading it, for some reason the
>> GPU stopped sending or the CPU stopped receiving interrupts if MSI was
>> enabled.
>
> I suppose this could happen if the GPU raises an interrupt after the
> driver's already called free_irq() on it, and hence the driver can't
> rearm itself in the interrupt handler.
>
> This possibly points to a bug somewhere (the GPU should be completely
> idle by the time free_irq() is called), but this seems like a valid
> thing to do at initialization in any case to avoid relying on the prior
> owner of the device to always behave properly.
>

Yeah, this makes sense. But what I am wondering about is, why this
isn't a bigger problem or maybe this is just due to those changes in
the Pascal interrupt handler and this is a Pascal only problem?
Anyway, the Nvidia driver seems to do it once on loading time as well,
so I was quite sure we could simply do it this way and be sure that we
are able to use the GPU from any state.

>> Doing a rearm once before getting any interrupts fixes this.
>>
>> Signed-off-by: Karol Herbst <kherbst@redhat.com>
>> ---
>>  drm/nouveau/nvkm/subdev/pci/base.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>
> Reviewed-by: Thierry Reding <treding@nvidia.com>