1. 02 May, 2007 4 commits
    • Michael Ellerman's avatar
      MSI: Give archs the option to free all MSI/Xs at once. · 032de8e2
      Michael Ellerman authored
      This patch introduces an optional function, arch_teardown_msi_irqs(),
      which gives an arch the opportunity to do per-device teardown for
      MSI/X. If that's not required, the default version simply calls
      arch_teardown_msi_irq() for each msi irq required.
      
      arch_teardown_msi_irqs() is simply passed a pdev, attached to the pdev
      is a list of msi_descs, it is up to the arch to free the irq associated
      with each of these as appropriate.
      
      For archs that _don't_ implement arch_teardown_msi_irqs(), all msi_descs
      with irq == 0 are considered unallocated, and the arch teardown routine
      is not called on them.
      Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      032de8e2
    • Michael Ellerman's avatar
      MSI: Give archs the option to allocate all MSI/Xs at once. · 9c831334
      Michael Ellerman authored
      This patch introduces an optional function, arch_setup_msi_irqs(),
      (note the plural) which gives an arch the opportunity to do per-device
      setup for MSI/X and then allocate all the requested MSI/Xs at once.
      
      If that's not required by the arch, the default version simply calls
      arch_setup_msi_irq() for each MSI irq required.
      
      arch_setup_msi_irqs() is passed a pdev, attached to the pdev is a list
      of msi_descs with irq == 0, it is up to the arch to connect these up to
      an irq (via set_irq_msi()) or return an error. For convenience the number
      of vectors and the type are passed also.
      
      All msi_descs with irq != 0 are considered allocated, and the arch
      teardown routine will be called on them when necessary.
      
      The existing semantics of pci_enable_msix() are that if the requested
      number of irqs can not be allocated, the maximum number that _could_ be
      allocated is returned. To support that, we define that in case of an
      error from arch_setup_msi_irqs(), the number of msi_descs with irq != 0
      are considered allocated, and are counted toward the "max that could be
      allocated".
      Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      9c831334
    • Michael Ellerman's avatar
      MSI: Use a list instead of the custom link structure · 4aa9bc95
      Michael Ellerman authored
      The msi descriptors are linked together with what looks a lot like
      a linked list, but isn't a struct list_head list. Make it one.
      
      The only complication is that previously we walked a list of irqs, and
      got the descriptor for each with get_irq_msi(). Now we have a list of
      descriptors and need to get the irq out of it, so it needs to be in the
      actual struct msi_desc. We use 0 to indicate no irq is setup.
      Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      4aa9bc95
    • Michael Ellerman's avatar
      MSI: Add an arch_msi_check_device() · c9953a73
      Michael Ellerman authored
      Add an arch_check_device(), which gives archs a chance to check the input
      to pci_enable_msi/x. The arch might be interested in the value of nvec so
      pass it in. Propagate the error value returned from the arch routine out
      to the caller.
      Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      c9953a73
  2. 12 Mar, 2007 1 commit
    • Eric W. Biederman's avatar
      [PATCH] msi: Safer state caching. · 392ee1e6
      Eric W. Biederman authored
      There are two ways pci_save_state and pci_restore_state are used.  As
      helper functions during suspend/resume, and as helper functions around
      a hardware reset event.  When used as helper functions around a hardware
      reset event there is no reason to believe the calls will be paired, nor
      is there a good reason to believe that if we restore the msi state from
      before the reset that it will match the current msi state.  Since arch
      code may change the msi message without going through the driver, drivers
      currently do not have enough information to even know when to call
      pci_save_state to ensure they will have msi state in sync with the other
      kernel irq reception data structures.
      
      It turns out the solution is straight forward, cache the state in the
      existing msi data structures (not the magic pci saved things) and
      have the msi code update the cached state each time we write to the hardware.
      This means we never need to read the hardware to figure out what the hardware
      state should be.
      
      By modifying the caching in this manner we get to remove our save_state
      routines and only need to provide restore_state routines.
      
      The only fields that were at all tricky to regenerate were the msi and msi-x
      control registers and the way we regenerate them currently is a bit dependent
      upon assumptions on how we use the allow msi registers to be configured and used
      making the code a little bit brittle.  If we ever change what cases we allow
      or how we configure the msi bits we can address the fragility then.
      Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      Acked-by: default avatarAuke Kok <auke-jan.h.kok@intel.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      392ee1e6
  3. 07 Feb, 2007 2 commits
  4. 04 Oct, 2006 1 commit
    • Eric W. Biederman's avatar
      [PATCH] msi: refactor and move the msi irq_chip into the arch code · 3b7d1921
      Eric W. Biederman authored
      It turns out msi_ops was simply not enough to abstract the architecture
      specific details of msi.  So I have moved the resposibility of constructing
      the struct irq_chip to the architectures, and have two architecture specific
      functions arch_setup_msi_irq, and arch_teardown_msi_irq.
      
      For simple architectures those functions can do all of the work.  For
      architectures with platform dependencies they can call into the appropriate
      platform code.
      
      With this msi.c is finally free of assuming you have an apic, and this
      actually takes less code.
      
      The helpers for the architecture specific code are declared in the linux/msi.h
      to keep them separate from the msi functions used by drivers in linux/pci.h
      Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Andi Kleen <ak@suse.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Greg KH <greg@kroah.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      3b7d1921