• Lyude Paul's avatar
    drm/nouveau: Move irq setup/teardown to pci ctor/dtor · 0fd189a9
    Lyude Paul authored
    For a while we've been having issues with seemingly random interrupts
    coming from nvidia cards when resuming them. Originally the fix for this
    was thought to be just re-arming the MSI interrupt registers right after
    re-allocating our IRQs, however it seems a lot of what we do is both
    wrong and not even nessecary.
    
    This was made apparent by what appeared to be a regression in the
    mainline kernel that started introducing suspend/resume issues for
    nouveau:
    
            a0c9259d (irq/matrix: Spread interrupts on allocation)
    
    After this commit was introduced, we started getting interrupts from the
    GPU before we actually re-allocated our own IRQ (see references below)
    and assigned the IRQ handler. Investigating this turned out that the
    problem was not with the commit, but the fact that nouveau even
    free/allocates it's irqs before and after suspend/resume.
    
    For starters: drivers in the linux kernel haven't had to handle
    freeing/re-allocating their IRQs during suspend/resume cycles for quite
    a while now. Nouveau seems to be one of the few drivers left that still
    does this, despite the fact there's no reason we actually need to since
    disabling interrupts from the device side should be enough, as the
    kernel is already smart enough to know to disable host-side interrupts
    for us before going into suspend. Since we were tearing down our IRQs by
    hand however, that means there was a short period during resume where
    interrupts could be received before we re-allocated our IRQ which would
    lead to us getting an unhandled IRQ. Since we never handle said IRQ and
    re-arm the interrupt registers, this would cause us to miss all of the
    interrupts from the GPU and cause our init process to start timing out
    on anything requiring interrupts.
    
    So, since this whole setup/teardown every suspend/resume cycle is
    useless anyway, move irq setup/teardown into the pci subdev's ctor/dtor
    functions instead so they're only called at driver load and driver
    unload. This should fix most of the issues with pending interrupts on
    resume, along with getting suspend/resume for nouveau to work again.
    
    As well, this probably means we can also just remove the msi rearm call
    inside nvkm_pci_init(). But since our main focus here is to fix
    suspend/resume before 4.15, we'll save that for a later patch.
    Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
    Cc: Karol Herbst <kherbst@redhat.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Mike Galbraith <efault@gmx.de>
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
    0fd189a9
base.c 5.08 KB