Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 1 Sep 2015 21:33:35 +0000 (14:33 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 1 Sep 2015 21:33:35 +0000 (14:33 -0700)
Pull irq updates from Thomas Gleixner:
 "This updated pull request does not contain the last few GIC related
  patches which were reported to cause a regression.  There is a fix
  available, but I let it breed for a couple of days first.

  The irq departement provides:

   - new infrastructure to support non PCI based MSI interrupts
   - a couple of new irq chip drivers
   - the usual pile of fixlets and updates to irq chip drivers
   - preparatory changes for removal of the irq argument from interrupt
     flow handlers
   - preparatory changes to remove IRQF_VALID"

* 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (129 commits)
  irqchip/imx-gpcv2: IMX GPCv2 driver for wakeup sources
  irqchip: Add bcm2836 interrupt controller for Raspberry Pi 2
  irqchip: Add documentation for the bcm2836 interrupt controller
  irqchip/bcm2835: Add support for being used as a second level controller
  irqchip/bcm2835: Refactor handle_IRQ() calls out of MAKE_HWIRQ
  PCI: xilinx: Fix typo in function name
  irqchip/gic: Ensure gic_cpu_if_up/down() programs correct GIC instance
  irqchip/gic: Only allow the primary GIC to set the CPU map
  PCI/MSI: pci-xgene-msi: Consolidate chained IRQ handler install/remove
  unicore32/irq: Prepare puv3_gpio_handler for irq argument removal
  tile/pci_gx: Prepare trio_handle_level_irq for irq argument removal
  m68k/irq: Prepare irq handlers for irq argument removal
  C6X/megamode-pic: Prepare megamod_irq_cascade for irq argument removal
  blackfin: Prepare irq handlers for irq argument removal
  arc/irq: Prepare idu_cascade_isr for irq argument removal
  sparc/irq: Use access helper irq_data_get_affinity_mask()
  sparc/irq: Use helper irq_data_get_irq_handler_data()
  parisc/irq: Use access helper irq_data_get_affinity_mask()
  mn10300/irq: Use access helper irq_data_get_affinity_mask()
  irqchip/i8259: Prepare i8259_irq_dispatch for irq argument removal
  ...

22 files changed:
1  2 
arch/arm/mach-shmobile/setup-r8a7779.c
arch/arm/mach-ux500/cpu.c
arch/arm/mach-zynq/common.c
arch/mips/Kconfig
arch/mn10300/kernel/cevt-mn10300.c
arch/s390/pci/pci.c
arch/sparc/kernel/pci.c
arch/xtensa/kernel/irq.c
drivers/base/core.c
drivers/irqchip/irq-crossbar.c
drivers/irqchip/irq-mips-gic.c
drivers/pci/host/pci-keystone-dw.c
drivers/pci/host/pci-xgene-msi.c
drivers/pci/host/pcie-designware.c
drivers/pci/host/pcie-xilinx.c
drivers/pci/msi.c
drivers/pci/probe.c
drivers/spmi/spmi-pmic-arb.c
include/linux/device.h
include/linux/irq.h
include/linux/pci.h
kernel/irq/chip.c

index 7ca8919995471bfdf2a6bbccea4224604a2e2c9a,aea5cff9495de195148294f16941182d5b1a0166..6bfa6407a27c0baed01a04c17f223b0e6087c5cf
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
   */
 -#include <linux/kernel.h>
 +#include <linux/clk/shmobile.h>
 +#include <linux/clocksource.h>
  #include <linux/init.h>
 -#include <linux/interrupt.h>
  #include <linux/irq.h>
  #include <linux/irqchip.h>
  #include <linux/irqchip/arm-gic.h>
 -#include <linux/of_platform.h>
 -#include <linux/platform_data/dma-rcar-hpbdma.h>
 -#include <linux/platform_data/gpio-rcar.h>
 -#include <linux/platform_data/irq-renesas-intc-irqpin.h>
 -#include <linux/platform_device.h>
 -#include <linux/delay.h>
 -#include <linux/input.h>
 -#include <linux/io.h>
 -#include <linux/serial_sci.h>
 -#include <linux/sh_timer.h>
 -#include <linux/dma-mapping.h>
 -#include <linux/usb/otg.h>
 -#include <linux/usb/hcd.h>
 -#include <linux/usb/ehci_pdriver.h>
 -#include <linux/usb/ohci_pdriver.h>
 -#include <linux/pm_runtime.h>
  
 -#include <asm/mach-types.h>
  #include <asm/mach/arch.h>
 -#include <asm/mach/time.h>
  #include <asm/mach/map.h>
 -#include <asm/hardware/cache-l2x0.h>
  
  #include "common.h"
 -#include "irqs.h"
  #include "r8a7779.h"
  
  static struct map_desc r8a7779_io_desc[] __initdata = {
@@@ -44,7 -64,7 +44,7 @@@
        },
  };
  
 -void __init r8a7779_map_io(void)
 +static void __init r8a7779_map_io(void)
  {
        debug_ll_io_init();
        iotable_init(r8a7779_io_desc, ARRAY_SIZE(r8a7779_io_desc));
  #define INT2NTSR0 IOMEM(0xfe700060)
  #define INT2NTSR1 IOMEM(0xfe700064)
  
 -static struct renesas_intc_irqpin_config irqpin0_platform_data __initdata = {
 -      .irq_base = irq_pin(0), /* IRQ0 -> IRQ3 */
 -      .sense_bitfield_width = 2,
 -};
 -
 -static struct resource irqpin0_resources[] __initdata = {
 -      DEFINE_RES_MEM(0xfe78001c, 4), /* ICR1 */
 -      DEFINE_RES_MEM(0xfe780010, 4), /* INTPRI */
 -      DEFINE_RES_MEM(0xfe780024, 4), /* INTREQ */
 -      DEFINE_RES_MEM(0xfe780044, 4), /* INTMSK0 */
 -      DEFINE_RES_MEM(0xfe780064, 4), /* INTMSKCLR0 */
 -      DEFINE_RES_IRQ(gic_spi(27)), /* IRQ0 */
 -      DEFINE_RES_IRQ(gic_spi(28)), /* IRQ1 */
 -      DEFINE_RES_IRQ(gic_spi(29)), /* IRQ2 */
 -      DEFINE_RES_IRQ(gic_spi(30)), /* IRQ3 */
 -};
 -
 -void __init r8a7779_init_irq_extpin_dt(int irlm)
 -{
 -      void __iomem *icr0 = ioremap_nocache(0xfe780000, PAGE_SIZE);
 -      u32 tmp;
 -
 -      if (!icr0) {
 -              pr_warn("r8a7779: unable to setup external irq pin mode\n");
 -              return;
 -      }
 -
 -      tmp = ioread32(icr0);
 -      if (irlm)
 -              tmp |= 1 << 23; /* IRQ0 -> IRQ3 as individual pins */
 -      else
 -              tmp &= ~(1 << 23); /* IRL mode - not supported */
 -      tmp |= (1 << 21); /* LVLMODE = 1 */
 -      iowrite32(tmp, icr0);
 -      iounmap(icr0);
 -}
 -
 -void __init r8a7779_init_irq_extpin(int irlm)
 -{
 -      r8a7779_init_irq_extpin_dt(irlm);
 -      if (irlm)
 -              platform_device_register_resndata(
 -                      NULL, "renesas_intc_irqpin", -1,
 -                      irqpin0_resources, ARRAY_SIZE(irqpin0_resources),
 -                      &irqpin0_platform_data, sizeof(irqpin0_platform_data));
 -}
 -
 -/* PFC/GPIO */
 -static struct resource r8a7779_pfc_resources[] = {
 -      DEFINE_RES_MEM(0xfffc0000, 0x023c),
 -};
 -
 -static struct platform_device r8a7779_pfc_device = {
 -      .name           = "pfc-r8a7779",
 -      .id             = -1,
 -      .resource       = r8a7779_pfc_resources,
 -      .num_resources  = ARRAY_SIZE(r8a7779_pfc_resources),
 -};
 -
 -#define R8A7779_GPIO(idx, npins) \
 -static struct resource r8a7779_gpio##idx##_resources[] = {            \
 -      DEFINE_RES_MEM(0xffc40000 + (0x1000 * (idx)), 0x002c),          \
 -      DEFINE_RES_IRQ(gic_iid(0xad + (idx))),                          \
 -};                                                                    \
 -                                                                      \
 -static struct gpio_rcar_config r8a7779_gpio##idx##_platform_data = {  \
 -      .gpio_base      = 32 * (idx),                                   \
 -      .irq_base       = 0,                                            \
 -      .number_of_pins = npins,                                        \
 -      .pctl_name      = "pfc-r8a7779",                                \
 -};                                                                    \
 -                                                                      \
 -static struct platform_device r8a7779_gpio##idx##_device = {          \
 -      .name           = "gpio_rcar",                                  \
 -      .id             = idx,                                          \
 -      .resource       = r8a7779_gpio##idx##_resources,                \
 -      .num_resources  = ARRAY_SIZE(r8a7779_gpio##idx##_resources),    \
 -      .dev            = {                                             \
 -              .platform_data  = &r8a7779_gpio##idx##_platform_data,   \
 -      },                                                              \
 -}
 -
 -R8A7779_GPIO(0, 32);
 -R8A7779_GPIO(1, 32);
 -R8A7779_GPIO(2, 32);
 -R8A7779_GPIO(3, 32);
 -R8A7779_GPIO(4, 32);
 -R8A7779_GPIO(5, 32);
 -R8A7779_GPIO(6, 9);
 -
 -static struct platform_device *r8a7779_pinctrl_devices[] __initdata = {
 -      &r8a7779_pfc_device,
 -      &r8a7779_gpio0_device,
 -      &r8a7779_gpio1_device,
 -      &r8a7779_gpio2_device,
 -      &r8a7779_gpio3_device,
 -      &r8a7779_gpio4_device,
 -      &r8a7779_gpio5_device,
 -      &r8a7779_gpio6_device,
 -};
 -
 -void __init r8a7779_pinmux_init(void)
 -{
 -      platform_add_devices(r8a7779_pinctrl_devices,
 -                          ARRAY_SIZE(r8a7779_pinctrl_devices));
 -}
 -
 -/* SCIF */
 -#define R8A7779_SCIF(index, baseaddr, irq)                    \
 -static struct plat_sci_port scif##index##_platform_data = {   \
 -      .type           = PORT_SCIF,                            \
 -      .flags          = UPF_BOOT_AUTOCONF | UPF_IOREMAP,      \
 -      .scscr          = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,     \
 -};                                                            \
 -                                                              \
 -static struct resource scif##index##_resources[] = {          \
 -      DEFINE_RES_MEM(baseaddr, 0x100),                        \
 -      DEFINE_RES_IRQ(irq),                                    \
 -};                                                            \
 -                                                              \
 -static struct platform_device scif##index##_device = {                \
 -      .name           = "sh-sci",                             \
 -      .id             = index,                                \
 -      .resource       = scif##index##_resources,              \
 -      .num_resources  = ARRAY_SIZE(scif##index##_resources),  \
 -      .dev            = {                                     \
 -              .platform_data  = &scif##index##_platform_data, \
 -      },                                                      \
 -}
 -
 -R8A7779_SCIF(0, 0xffe40000, gic_iid(0x78));
 -R8A7779_SCIF(1, 0xffe41000, gic_iid(0x79));
 -R8A7779_SCIF(2, 0xffe42000, gic_iid(0x7a));
 -R8A7779_SCIF(3, 0xffe43000, gic_iid(0x7b));
 -R8A7779_SCIF(4, 0xffe44000, gic_iid(0x7c));
 -R8A7779_SCIF(5, 0xffe45000, gic_iid(0x7d));
 -
 -/* TMU */
 -static struct sh_timer_config tmu0_platform_data = {
 -      .channels_mask = 7,
 -};
 -
 -static struct resource tmu0_resources[] = {
 -      DEFINE_RES_MEM(0xffd80000, 0x30),
 -      DEFINE_RES_IRQ(gic_iid(0x40)),
 -      DEFINE_RES_IRQ(gic_iid(0x41)),
 -      DEFINE_RES_IRQ(gic_iid(0x42)),
 -};
 -
 -static struct platform_device tmu0_device = {
 -      .name           = "sh-tmu",
 -      .id             = 0,
 -      .dev = {
 -              .platform_data  = &tmu0_platform_data,
 -      },
 -      .resource       = tmu0_resources,
 -      .num_resources  = ARRAY_SIZE(tmu0_resources),
 -};
 -
 -/* I2C */
 -static struct resource rcar_i2c0_res[] = {
 -      {
 -              .start  = 0xffc70000,
 -              .end    = 0xffc70fff,
 -              .flags  = IORESOURCE_MEM,
 -      }, {
 -              .start  = gic_iid(0x6f),
 -              .flags  = IORESOURCE_IRQ,
 -      },
 -};
 -
 -static struct platform_device i2c0_device = {
 -      .name           = "i2c-rcar",
 -      .id             = 0,
 -      .resource       = rcar_i2c0_res,
 -      .num_resources  = ARRAY_SIZE(rcar_i2c0_res),
 -};
 -
 -static struct resource rcar_i2c1_res[] = {
 -      {
 -              .start  = 0xffc71000,
 -              .end    = 0xffc71fff,
 -              .flags  = IORESOURCE_MEM,
 -      }, {
 -              .start  = gic_iid(0x72),
 -              .flags  = IORESOURCE_IRQ,
 -      },
 -};
 -
 -static struct platform_device i2c1_device = {
 -      .name           = "i2c-rcar",
 -      .id             = 1,
 -      .resource       = rcar_i2c1_res,
 -      .num_resources  = ARRAY_SIZE(rcar_i2c1_res),
 -};
 -
 -static struct resource rcar_i2c2_res[] = {
 -      {
 -              .start  = 0xffc72000,
 -              .end    = 0xffc72fff,
 -              .flags  = IORESOURCE_MEM,
 -      }, {
 -              .start  = gic_iid(0x70),
 -              .flags  = IORESOURCE_IRQ,
 -      },
 -};
 -
 -static struct platform_device i2c2_device = {
 -      .name           = "i2c-rcar",
 -      .id             = 2,
 -      .resource       = rcar_i2c2_res,
 -      .num_resources  = ARRAY_SIZE(rcar_i2c2_res),
 -};
 -
 -static struct resource rcar_i2c3_res[] = {
 -      {
 -              .start  = 0xffc73000,
 -              .end    = 0xffc73fff,
 -              .flags  = IORESOURCE_MEM,
 -      }, {
 -              .start  = gic_iid(0x71),
 -              .flags  = IORESOURCE_IRQ,
 -      },
 -};
 -
 -static struct platform_device i2c3_device = {
 -      .name           = "i2c-rcar",
 -      .id             = 3,
 -      .resource       = rcar_i2c3_res,
 -      .num_resources  = ARRAY_SIZE(rcar_i2c3_res),
 -};
 -
 -static struct resource sata_resources[] = {
 -      [0] = {
 -              .name   = "rcar-sata",
 -              .start  = 0xfc600000,
 -              .end    = 0xfc601fff,
 -              .flags  = IORESOURCE_MEM,
 -      },
 -      [1] = {
 -              .start  = gic_iid(0x84),
 -              .flags  = IORESOURCE_IRQ,
 -      },
 -};
 -
 -static struct platform_device sata_device = {
 -      .name           = "sata_rcar",
 -      .id             = -1,
 -      .resource       = sata_resources,
 -      .num_resources  = ARRAY_SIZE(sata_resources),
 -      .dev            = {
 -              .dma_mask               = &sata_device.dev.coherent_dma_mask,
 -              .coherent_dma_mask      = DMA_BIT_MASK(32),
 -      },
 -};
 -
 -/* USB */
 -static struct usb_phy *phy;
 -
 -static int usb_power_on(struct platform_device *pdev)
 -{
 -      if (IS_ERR(phy))
 -              return PTR_ERR(phy);
 -
 -      pm_runtime_enable(&pdev->dev);
 -      pm_runtime_get_sync(&pdev->dev);
 -
 -      usb_phy_init(phy);
 -
 -      return 0;
 -}
 -
 -static void usb_power_off(struct platform_device *pdev)
 -{
 -      if (IS_ERR(phy))
 -              return;
 -
 -      usb_phy_shutdown(phy);
 -
 -      pm_runtime_put_sync(&pdev->dev);
 -      pm_runtime_disable(&pdev->dev);
 -}
 -
 -static int ehci_init_internal_buffer(struct usb_hcd *hcd)
 +static void __init r8a7779_init_irq_dt(void)
  {
-       gic_set_irqchip_flags(IRQCHIP_SKIP_SET_WAKE);
 -      /*
 -       * Below are recommended values from the datasheet;
 -       * see [USB :: Setting of EHCI Internal Buffer].
 -       */
 -      /* EHCI IP internal buffer setting */
 -      iowrite32(0x00ff0040, hcd->regs + 0x0094);
 -      /* EHCI IP internal buffer enable */
 -      iowrite32(0x00000001, hcd->regs + 0x009C);
 -
 -      return 0;
 -}
 -
 -static struct usb_ehci_pdata ehcix_pdata = {
 -      .power_on       = usb_power_on,
 -      .power_off      = usb_power_off,
 -      .power_suspend  = usb_power_off,
 -      .pre_setup      = ehci_init_internal_buffer,
 -};
 -
 -static struct resource ehci0_resources[] = {
 -      [0] = {
 -              .start  = 0xffe70000,
 -              .end    = 0xffe70400 - 1,
 -              .flags  = IORESOURCE_MEM,
 -      },
 -      [1] = {
 -              .start  = gic_iid(0x4c),
 -              .flags  = IORESOURCE_IRQ,
 -      },
 -};
 -
 -static struct platform_device ehci0_device = {
 -      .name   = "ehci-platform",
 -      .id     = 0,
 -      .dev    = {
 -              .dma_mask               = &ehci0_device.dev.coherent_dma_mask,
 -              .coherent_dma_mask      = 0xffffffff,
 -              .platform_data          = &ehcix_pdata,
 -      },
 -      .num_resources  = ARRAY_SIZE(ehci0_resources),
 -      .resource       = ehci0_resources,
 -};
 -
 -static struct resource ehci1_resources[] = {
 -      [0] = {
 -              .start  = 0xfff70000,
 -              .end    = 0xfff70400 - 1,
 -              .flags  = IORESOURCE_MEM,
 -      },
 -      [1] = {
 -              .start  = gic_iid(0x4d),
 -              .flags  = IORESOURCE_IRQ,
 -      },
 -};
 -
 -static struct platform_device ehci1_device = {
 -      .name   = "ehci-platform",
 -      .id     = 1,
 -      .dev    = {
 -              .dma_mask               = &ehci1_device.dev.coherent_dma_mask,
 -              .coherent_dma_mask      = 0xffffffff,
 -              .platform_data          = &ehcix_pdata,
 -      },
 -      .num_resources  = ARRAY_SIZE(ehci1_resources),
 -      .resource       = ehci1_resources,
 -};
 -
 -static struct usb_ohci_pdata ohcix_pdata = {
 -      .power_on       = usb_power_on,
 -      .power_off      = usb_power_off,
 -      .power_suspend  = usb_power_off,
 -};
 -
 -static struct resource ohci0_resources[] = {
 -      [0] = {
 -              .start  = 0xffe70400,
 -              .end    = 0xffe70800 - 1,
 -              .flags  = IORESOURCE_MEM,
 -      },
 -      [1] = {
 -              .start  = gic_iid(0x4c),
 -              .flags  = IORESOURCE_IRQ,
 -      },
 -};
 -
 -static struct platform_device ohci0_device = {
 -      .name   = "ohci-platform",
 -      .id     = 0,
 -      .dev    = {
 -              .dma_mask               = &ohci0_device.dev.coherent_dma_mask,
 -              .coherent_dma_mask      = 0xffffffff,
 -              .platform_data          = &ohcix_pdata,
 -      },
 -      .num_resources  = ARRAY_SIZE(ohci0_resources),
 -      .resource       = ohci0_resources,
 -};
 -
 -static struct resource ohci1_resources[] = {
 -      [0] = {
 -              .start  = 0xfff70400,
 -              .end    = 0xfff70800 - 1,
 -              .flags  = IORESOURCE_MEM,
 -      },
 -      [1] = {
 -              .start  = gic_iid(0x4d),
 -              .flags  = IORESOURCE_IRQ,
 -      },
 -};
 -
 -static struct platform_device ohci1_device = {
 -      .name   = "ohci-platform",
 -      .id     = 1,
 -      .dev    = {
 -              .dma_mask               = &ohci1_device.dev.coherent_dma_mask,
 -              .coherent_dma_mask      = 0xffffffff,
 -              .platform_data          = &ohcix_pdata,
 -      },
 -      .num_resources  = ARRAY_SIZE(ohci1_resources),
 -      .resource       = ohci1_resources,
 -};
 -
 -/* HPB-DMA */
 -
 -/* Asynchronous mode register bits */
 -#define HPB_DMAE_ASYNCMDR_ASMD43_MASK         BIT(23) /* MMC1 */
 -#define HPB_DMAE_ASYNCMDR_ASMD43_SINGLE               BIT(23) /* MMC1 */
 -#define HPB_DMAE_ASYNCMDR_ASMD43_MULTI                0       /* MMC1 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD43_MASK               BIT(22) /* MMC1 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD43_BURST      BIT(22) /* MMC1 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD43_NBURST     0       /* MMC1 */
 -#define HPB_DMAE_ASYNCMDR_ASMD24_MASK         BIT(21) /* MMC0 */
 -#define HPB_DMAE_ASYNCMDR_ASMD24_SINGLE               BIT(21) /* MMC0 */
 -#define HPB_DMAE_ASYNCMDR_ASMD24_MULTI                0       /* MMC0 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD24_MASK               BIT(20) /* MMC0 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD24_BURST      BIT(20) /* MMC0 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD24_NBURST     0       /* MMC0 */
 -#define HPB_DMAE_ASYNCMDR_ASMD41_MASK         BIT(19) /* SDHI3 */
 -#define HPB_DMAE_ASYNCMDR_ASMD41_SINGLE               BIT(19) /* SDHI3 */
 -#define HPB_DMAE_ASYNCMDR_ASMD41_MULTI                0       /* SDHI3 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD41_MASK               BIT(18) /* SDHI3 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD41_BURST      BIT(18) /* SDHI3 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD41_NBURST     0       /* SDHI3 */
 -#define HPB_DMAE_ASYNCMDR_ASMD40_MASK         BIT(17) /* SDHI3 */
 -#define HPB_DMAE_ASYNCMDR_ASMD40_SINGLE               BIT(17) /* SDHI3 */
 -#define HPB_DMAE_ASYNCMDR_ASMD40_MULTI                0       /* SDHI3 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD40_MASK               BIT(16) /* SDHI3 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD40_BURST      BIT(16) /* SDHI3 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD40_NBURST     0       /* SDHI3 */
 -#define HPB_DMAE_ASYNCMDR_ASMD39_MASK         BIT(15) /* SDHI3 */
 -#define HPB_DMAE_ASYNCMDR_ASMD39_SINGLE               BIT(15) /* SDHI3 */
 -#define HPB_DMAE_ASYNCMDR_ASMD39_MULTI                0       /* SDHI3 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD39_MASK               BIT(14) /* SDHI3 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD39_BURST      BIT(14) /* SDHI3 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD39_NBURST     0       /* SDHI3 */
 -#define HPB_DMAE_ASYNCMDR_ASMD27_MASK         BIT(13) /* SDHI2 */
 -#define HPB_DMAE_ASYNCMDR_ASMD27_SINGLE               BIT(13) /* SDHI2 */
 -#define HPB_DMAE_ASYNCMDR_ASMD27_MULTI                0       /* SDHI2 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD27_MASK               BIT(12) /* SDHI2 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD27_BURST      BIT(12) /* SDHI2 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD27_NBURST     0       /* SDHI2 */
 -#define HPB_DMAE_ASYNCMDR_ASMD26_MASK         BIT(11) /* SDHI2 */
 -#define HPB_DMAE_ASYNCMDR_ASMD26_SINGLE               BIT(11) /* SDHI2 */
 -#define HPB_DMAE_ASYNCMDR_ASMD26_MULTI                0       /* SDHI2 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD26_MASK               BIT(10) /* SDHI2 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD26_BURST      BIT(10) /* SDHI2 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD26_NBURST     0       /* SDHI2 */
 -#define HPB_DMAE_ASYNCMDR_ASMD25_MASK         BIT(9)  /* SDHI2 */
 -#define HPB_DMAE_ASYNCMDR_ASMD25_SINGLE               BIT(9)  /* SDHI2 */
 -#define HPB_DMAE_ASYNCMDR_ASMD25_MULTI                0       /* SDHI2 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD25_MASK               BIT(8)  /* SDHI2 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD25_BURST      BIT(8)  /* SDHI2 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD25_NBURST     0       /* SDHI2 */
 -#define HPB_DMAE_ASYNCMDR_ASMD23_MASK         BIT(7)  /* SDHI0 */
 -#define HPB_DMAE_ASYNCMDR_ASMD23_SINGLE               BIT(7)  /* SDHI0 */
 -#define HPB_DMAE_ASYNCMDR_ASMD23_MULTI                0       /* SDHI0 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD23_MASK               BIT(6)  /* SDHI0 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD23_BURST      BIT(6)  /* SDHI0 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD23_NBURST     0       /* SDHI0 */
 -#define HPB_DMAE_ASYNCMDR_ASMD22_MASK         BIT(5)  /* SDHI0 */
 -#define HPB_DMAE_ASYNCMDR_ASMD22_SINGLE               BIT(5)  /* SDHI0 */
 -#define HPB_DMAE_ASYNCMDR_ASMD22_MULTI                0       /* SDHI0 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD22_MASK               BIT(4)  /* SDHI0 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD22_BURST      BIT(4)  /* SDHI0 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD22_NBURST     0       /* SDHI0 */
 -#define HPB_DMAE_ASYNCMDR_ASMD21_MASK         BIT(3)  /* SDHI0 */
 -#define HPB_DMAE_ASYNCMDR_ASMD21_SINGLE               BIT(3)  /* SDHI0 */
 -#define HPB_DMAE_ASYNCMDR_ASMD21_MULTI                0       /* SDHI0 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD21_MASK               BIT(2)  /* SDHI0 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD21_BURST      BIT(2)  /* SDHI0 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD21_NBURST     0       /* SDHI0 */
 -#define HPB_DMAE_ASYNCMDR_ASMD20_MASK         BIT(1)  /* SDHI1 */
 -#define HPB_DMAE_ASYNCMDR_ASMD20_SINGLE               BIT(1)  /* SDHI1 */
 -#define HPB_DMAE_ASYNCMDR_ASMD20_MULTI                0       /* SDHI1 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD20_MASK               BIT(0)  /* SDHI1 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD20_BURST      BIT(0)  /* SDHI1 */
 -#define HPB_DMAE_ASYNCMDR_ASBTMD20_NBURST     0       /* SDHI1 */
 -
 -static const struct hpb_dmae_slave_config hpb_dmae_slaves[] = {
 -      {
 -              .id     = HPBDMA_SLAVE_SDHI0_TX,
 -              .addr   = 0xffe4c000 + 0x30,
 -              .dcr    = HPB_DMAE_DCR_SPDS_16BIT |
 -                        HPB_DMAE_DCR_DMDL |
 -                        HPB_DMAE_DCR_DPDS_16BIT,
 -              .rstr   = HPB_DMAE_ASYNCRSTR_ASRST21 |
 -                        HPB_DMAE_ASYNCRSTR_ASRST22 |
 -                        HPB_DMAE_ASYNCRSTR_ASRST23,
 -              .mdr    = HPB_DMAE_ASYNCMDR_ASMD21_SINGLE |
 -                        HPB_DMAE_ASYNCMDR_ASBTMD21_NBURST,
 -              .mdm    = HPB_DMAE_ASYNCMDR_ASMD21_MASK |
 -                        HPB_DMAE_ASYNCMDR_ASBTMD21_MASK,
 -              .port   = 0x0D0C,
 -              .flags  = HPB_DMAE_SET_ASYNC_RESET | HPB_DMAE_SET_ASYNC_MODE,
 -              .dma_ch = 21,
 -      }, {
 -              .id     = HPBDMA_SLAVE_SDHI0_RX,
 -              .addr   = 0xffe4c000 + 0x30,
 -              .dcr    = HPB_DMAE_DCR_SMDL |
 -                        HPB_DMAE_DCR_SPDS_16BIT |
 -                        HPB_DMAE_DCR_DPDS_16BIT,
 -              .rstr   = HPB_DMAE_ASYNCRSTR_ASRST21 |
 -                        HPB_DMAE_ASYNCRSTR_ASRST22 |
 -                        HPB_DMAE_ASYNCRSTR_ASRST23,
 -              .mdr    = HPB_DMAE_ASYNCMDR_ASMD22_SINGLE |
 -                        HPB_DMAE_ASYNCMDR_ASBTMD22_NBURST,
 -              .mdm    = HPB_DMAE_ASYNCMDR_ASMD22_MASK |
 -                        HPB_DMAE_ASYNCMDR_ASBTMD22_MASK,
 -              .port   = 0x0D0C,
 -              .flags  = HPB_DMAE_SET_ASYNC_RESET | HPB_DMAE_SET_ASYNC_MODE,
 -              .dma_ch = 22,
 -      },
 -};
 -
 -static const struct hpb_dmae_channel hpb_dmae_channels[] = {
 -      HPB_DMAE_CHANNEL(0x93, HPBDMA_SLAVE_SDHI0_TX), /* ch. 21 */
 -      HPB_DMAE_CHANNEL(0x93, HPBDMA_SLAVE_SDHI0_RX), /* ch. 22 */
 -};
 -
 -static struct hpb_dmae_pdata dma_platform_data __initdata = {
 -      .slaves                 = hpb_dmae_slaves,
 -      .num_slaves             = ARRAY_SIZE(hpb_dmae_slaves),
 -      .channels               = hpb_dmae_channels,
 -      .num_channels           = ARRAY_SIZE(hpb_dmae_channels),
 -      .ts_shift               = {
 -              [XMIT_SZ_8BIT]  = 0,
 -              [XMIT_SZ_16BIT] = 1,
 -              [XMIT_SZ_32BIT] = 2,
 -      },
 -      .num_hw_channels        = 44,
 -};
 -
 -static struct resource hpb_dmae_resources[] __initdata = {
 -      /* Channel registers */
 -      DEFINE_RES_MEM(0xffc08000, 0x1000),
 -      /* Common registers */
 -      DEFINE_RES_MEM(0xffc09000, 0x170),
 -      /* Asynchronous reset registers */
 -      DEFINE_RES_MEM(0xffc00300, 4),
 -      /* Asynchronous mode registers */
 -      DEFINE_RES_MEM(0xffc00400, 4),
 -      /* IRQ for DMA channels */
 -      DEFINE_RES_NAMED(gic_iid(0x8e), 12, NULL, IORESOURCE_IRQ),
 -};
 -
 -static void __init r8a7779_register_hpb_dmae(void)
 -{
 -      platform_device_register_resndata(NULL, "hpb-dma-engine",
 -                                        -1, hpb_dmae_resources,
 -                                        ARRAY_SIZE(hpb_dmae_resources),
 -                                        &dma_platform_data,
 -                                        sizeof(dma_platform_data));
 -}
 -
 -static struct platform_device *r8a7779_early_devices[] __initdata = {
 -      &tmu0_device,
 -};
 -
 -static struct platform_device *r8a7779_standard_devices[] __initdata = {
 -      &scif0_device,
 -      &scif1_device,
 -      &scif2_device,
 -      &scif3_device,
 -      &scif4_device,
 -      &scif5_device,
 -      &i2c0_device,
 -      &i2c1_device,
 -      &i2c2_device,
 -      &i2c3_device,
 -      &sata_device,
 -};
 -
 -void __init r8a7779_add_standard_devices(void)
 -{
 -#ifdef CONFIG_CACHE_L2X0
 -      /* Shared attribute override enable, 64K*16way */
 -      l2x0_init(IOMEM(0xf0100000), 0x00400000, 0xc20f0fff);
 -#endif
 -      r8a7779_pm_init();
 -
 -      r8a7779_init_pm_domains();
 -
 -      platform_add_devices(r8a7779_early_devices,
 -                          ARRAY_SIZE(r8a7779_early_devices));
 -      platform_add_devices(r8a7779_standard_devices,
 -                          ARRAY_SIZE(r8a7779_standard_devices));
 -      r8a7779_register_hpb_dmae();
 -}
 -
 -void __init r8a7779_add_early_devices(void)
 -{
 -      early_platform_add_devices(r8a7779_early_devices,
 -                                 ARRAY_SIZE(r8a7779_early_devices));
 -
 -      /* Early serial console setup is not included here due to
 -       * memory map collisions. The SCIF serial ports in r8a7779
 -       * are difficult to identity map 1:1 due to collision with the
 -       * virtual memory range used by the coherent DMA code on ARM.
 -       *
 -       * Anyone wanting to debug early can remove UPF_IOREMAP from
 -       * the sh-sci serial console platform data, adjust mapbase
 -       * to a static M:N virt:phys mapping that needs to be added to
 -       * the mappings passed with iotable_init() above.
 -       *
 -       * Then add a call to shmobile_setup_console() from this function.
 -       *
 -       * As a final step pass earlyprint=sh-sci.2,115200 on the kernel
 -       * command line in case of the marzen board.
 -       */
 -}
 -
 -static struct platform_device *r8a7779_late_devices[] __initdata = {
 -      &ehci0_device,
 -      &ehci1_device,
 -      &ohci0_device,
 -      &ohci1_device,
 -};
 -
 -void __init r8a7779_init_late(void)
 -{
 -      /* get USB PHY */
 -      phy = usb_get_phy(USB_PHY_TYPE_USB2);
 -
 -      shmobile_init_late();
 -      platform_add_devices(r8a7779_late_devices,
 -                           ARRAY_SIZE(r8a7779_late_devices));
 -}
 -
 -#ifdef CONFIG_USE_OF
 -void __init r8a7779_init_irq_dt(void)
 -{
 -#ifdef CONFIG_ARCH_SHMOBILE_LEGACY
 -      void __iomem *gic_dist_base = ioremap_nocache(0xf0001000, 0x1000);
 -      void __iomem *gic_cpu_base = ioremap_nocache(0xf0000100, 0x1000);
 -#endif
--
 -#ifdef CONFIG_ARCH_SHMOBILE_LEGACY
 -      gic_init(0, 29, gic_dist_base, gic_cpu_base);
 -#else
        irqchip_init();
 -#endif
 +
        /* route all interrupts to ARM */
        __raw_writel(0xffffffff, INT2NTSR0);
        __raw_writel(0x3fffffff, INT2NTSR1);
  
  #define MODEMR                0xffcc0020
  
 -u32 __init r8a7779_read_mode_pins(void)
 +static u32 __init r8a7779_read_mode_pins(void)
  {
        static u32 mode;
        static bool mode_valid;
        return mode;
  }
  
 -static const char *r8a7779_compat_dt[] __initdata = {
 +static void __init r8a7779_init_time(void)
 +{
 +      r8a7779_clocks_init(r8a7779_read_mode_pins());
 +      clocksource_of_init();
 +}
 +
 +static const char *const r8a7779_compat_dt[] __initconst = {
        "renesas,r8a7779",
        NULL,
  };
  
  DT_MACHINE_START(R8A7779_DT, "Generic R8A7779 (Flattened Device Tree)")
 +      .smp            = smp_ops(r8a7779_smp_ops),
        .map_io         = r8a7779_map_io,
        .init_early     = shmobile_init_delay,
 +      .init_time      = r8a7779_init_time,
        .init_irq       = r8a7779_init_irq_dt,
        .init_late      = shmobile_init_late,
        .dt_compat      = r8a7779_compat_dt,
  MACHINE_END
 -#endif /* CONFIG_USE_OF */
index b316e18a76aa1d14ba5d7ce5bc7a77f9fc8bb930,6cb10c77afd84893839f5e1c7903493241530943..41b81c4fbe636593ef26f1dc2de110b435ff61cf
@@@ -56,7 -56,6 +56,6 @@@ void __init ux500_init_irq(void
        struct device_node *np;
        struct resource r;
  
-       gic_set_irqchip_flags(IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND);
        irqchip_init();
        np = of_find_compatible_node(NULL, NULL, "stericsson,db8500-prcmu");
        of_address_to_resource(np, 0, &r);
         * Init clocks here so that they are available for system timer
         * initialization.
         */
 -      if (cpu_is_u8500_family()) {
 -              u8500_of_clk_init(U8500_CLKRST1_BASE,
 -                                U8500_CLKRST2_BASE,
 -                                U8500_CLKRST3_BASE,
 -                                U8500_CLKRST5_BASE,
 -                                U8500_CLKRST6_BASE);
 -      } else if (cpu_is_u9540()) {
 -              u9540_clk_init(U8500_CLKRST1_BASE, U8500_CLKRST2_BASE,
 -                             U8500_CLKRST3_BASE, U8500_CLKRST5_BASE,
 -                             U8500_CLKRST6_BASE);
 -      } else if (cpu_is_u8540()) {
 -              u8540_clk_init(U8500_CLKRST1_BASE, U8500_CLKRST2_BASE,
 -                             U8500_CLKRST3_BASE, U8500_CLKRST5_BASE,
 -                             U8500_CLKRST6_BASE);
 -      }
 +      if (cpu_is_u8500_family())
 +              u8500_clk_init();
 +      else if (cpu_is_u9540())
 +              u9540_clk_init();
 +      else if (cpu_is_u8540())
 +              u8540_clk_init();
  }
  
  static const char * __init ux500_get_machine(void)
index 6bd4a43e1a7835fecd005e09808de61cece7cdd0,2ad1accfba35bfe089447715059f58f254410d7d..5a6e4e20ca0a98ae07d39d6b764d2f799fc1448d
@@@ -186,7 -186,6 +186,6 @@@ static void __init zynq_map_io(void
  
  static void __init zynq_irq_init(void)
  {
-       gic_set_irqchip_flags(IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND);
        irqchip_init();
  }
  
@@@ -197,8 -196,8 +196,8 @@@ static const char * const zynq_dt_match
  
  DT_MACHINE_START(XILINX_EP107, "Xilinx Zynq Platform")
        /* 64KB way size, 8-way associativity, parity disabled */
 -      .l2c_aux_val    = 0x00000000,
 -      .l2c_aux_mask   = 0xffffffff,
 +      .l2c_aux_val    = 0x00400000,
 +      .l2c_aux_mask   = 0xffbfffff,
        .smp            = smp_ops(zynq_smp_ops),
        .map_io         = zynq_map_io,
        .init_irq       = zynq_irq_init,
diff --combined arch/mips/Kconfig
index c6d28bce0b408f2f01e95f2d0f561df39dc21d73,d61297252006e99a5fa6053db773efd706f2e40e..4ab9a794bbcd4cc5121ff6c6f8e2b062c75474ad
@@@ -118,7 -118,6 +118,7 @@@ config ATH2
  
  config ATH79
        bool "Atheros AR71XX/AR724X/AR913X based boards"
 +      select ARCH_HAS_RESET_CONTROLLER
        select ARCH_REQUIRE_GPIOLIB
        select BOOT_RAW
        select CEVT_R4K
@@@ -152,6 -151,7 +152,6 @@@ config BMIPS_GENERI
        select BCM7120_L2_IRQ
        select BRCMSTB_L2_IRQ
        select IRQ_MIPS_CPU
 -      select RAW_IRQ_ACCESSORS
        select DMA_NONCOHERENT
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_LITTLE_ENDIAN
@@@ -1071,10 -1071,6 +1071,6 @@@ config HOTPLUG_CP
  config SYS_SUPPORTS_HOTPLUG_CPU
        bool
  
- config I8259
-       bool
-       select IRQ_DOMAIN
  config MIPS_BONITO64
        bool
  
index 3aae9f5a98aac5c98d8858512e77fbdb1ce3d14d,326677d4a3b2a6060247edf771ce18eddd683150..d9b34dd44f04f902354da47561fd9b2cce1f5542
@@@ -41,6 -41,12 +41,6 @@@ static int next_event(unsigned long del
        return 0;
  }
  
 -static void set_clock_mode(enum clock_event_mode mode,
 -                         struct clock_event_device *evt)
 -{
 -      /* Nothing to do ...  */
 -}
 -
  static DEFINE_PER_CPU(struct clock_event_device, mn10300_clockevent_device);
  static DEFINE_PER_CPU(struct irqaction, timer_irq);
  
@@@ -102,6 -108,7 +102,6 @@@ int __init init_clockevents(void
  
        cd->rating              = 200;
        cd->cpumask             = cpumask_of(smp_processor_id());
 -      cd->set_mode            = set_clock_mode;
        cd->event_handler       = event_handler;
        cd->set_next_event      = next_event;
  
        {
                struct irq_data *data;
                data = irq_get_irq_data(cd->irq);
-               cpumask_copy(data->affinity, cpumask_of(cpu));
+               cpumask_copy(irq_data_get_affinity_mask(data), cpumask_of(cpu));
                iact->flags |= IRQF_NOBALANCING;
        }
  #endif
diff --combined arch/s390/pci/pci.c
index 17c04c7269e79d1d1c4c69ccc46769b07d62339e,34f16275340326540c68c07fcc72993e387f5e65..7ef12a3ace3aef665bd7b1bb637cc0d9dafcc6bd
@@@ -76,6 -76,11 +76,6 @@@ EXPORT_SYMBOL_GPL(zpci_iomap_start)
  
  static struct kmem_cache *zdev_fmb_cache;
  
 -struct zpci_dev *get_zdev(struct pci_dev *pdev)
 -{
 -      return (struct zpci_dev *) pdev->sysdata;
 -}
 -
  struct zpci_dev *get_zdev_by_fid(u32 fid)
  {
        struct zpci_dev *tmp, *zdev = NULL;
@@@ -264,7 -269,7 +264,7 @@@ void __iomem *pci_iomap_range(struct pc
                              unsigned long offset,
                              unsigned long max)
  {
 -      struct zpci_dev *zdev = get_zdev(pdev);
 +      struct zpci_dev *zdev = to_zpci(pdev);
        u64 addr;
        int idx;
  
@@@ -380,7 -385,7 +380,7 @@@ static void zpci_irq_handler(struct air
  
  int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
  {
 -      struct zpci_dev *zdev = get_zdev(pdev);
 +      struct zpci_dev *zdev = to_zpci(pdev);
        unsigned int hwirq, msi_vecs;
        unsigned long aisb;
        struct msi_desc *msi;
  
        /* Request MSI interrupts */
        hwirq = 0;
-       list_for_each_entry(msi, &pdev->msi_list, list) {
+       for_each_pci_msi_entry(msi, pdev) {
                rc = -EIO;
                irq = irq_alloc_desc(0);        /* Alloc irq on node 0 */
                if (irq < 0)
        return (msi_vecs == nvec) ? 0 : msi_vecs;
  
  out_msi:
-       list_for_each_entry(msi, &pdev->msi_list, list) {
+       for_each_pci_msi_entry(msi, pdev) {
                if (hwirq-- == 0)
                        break;
                irq_set_msi_desc(msi->irq, NULL);
@@@ -455,7 -460,7 +455,7 @@@ out
  
  void arch_teardown_msi_irqs(struct pci_dev *pdev)
  {
 -      struct zpci_dev *zdev = get_zdev(pdev);
 +      struct zpci_dev *zdev = to_zpci(pdev);
        struct msi_desc *msi;
        int rc;
  
                return;
  
        /* Release MSI interrupts */
-       list_for_each_entry(msi, &pdev->msi_list, list) {
+       for_each_pci_msi_entry(msi, pdev) {
                if (msi->msi_attrib.is_msix)
                        __pci_msix_desc_mask_irq(msi, 1);
                else
@@@ -632,7 -637,7 +632,7 @@@ static void zpci_cleanup_bus_resources(
        int i;
  
        for (i = 0; i < PCI_BAR_COUNT; i++) {
 -              if (!zdev->bars[i].size)
 +              if (!zdev->bars[i].size || !zdev->bars[i].res)
                        continue;
  
                zpci_free_iomap(zdev, zdev->bars[i].map_idx);
  
  int pcibios_add_device(struct pci_dev *pdev)
  {
 -      struct zpci_dev *zdev = get_zdev(pdev);
 +      struct zpci_dev *zdev = to_zpci(pdev);
        struct resource *res;
        int i;
  
@@@ -668,7 -673,7 +668,7 @@@ void pcibios_release_device(struct pci_
  
  int pcibios_enable_device(struct pci_dev *pdev, int mask)
  {
 -      struct zpci_dev *zdev = get_zdev(pdev);
 +      struct zpci_dev *zdev = to_zpci(pdev);
  
        zdev->pdev = pdev;
        zpci_debug_init_device(zdev);
  
  void pcibios_disable_device(struct pci_dev *pdev)
  {
 -      struct zpci_dev *zdev = get_zdev(pdev);
 +      struct zpci_dev *zdev = to_zpci(pdev);
  
        zpci_fmb_disable_device(zdev);
        zpci_debug_exit_device(zdev);
  static int zpci_restore(struct device *dev)
  {
        struct pci_dev *pdev = to_pci_dev(dev);
 -      struct zpci_dev *zdev = get_zdev(pdev);
 +      struct zpci_dev *zdev = to_zpci(pdev);
        int ret = 0;
  
        if (zdev->state != ZPCI_FN_STATE_ONLINE)
@@@ -712,7 -717,7 +712,7 @@@ out
  static int zpci_freeze(struct device *dev)
  {
        struct pci_dev *pdev = to_pci_dev(dev);
 -      struct zpci_dev *zdev = get_zdev(pdev);
 +      struct zpci_dev *zdev = to_zpci(pdev);
  
        if (zdev->state != ZPCI_FN_STATE_ONLINE)
                return 0;
@@@ -772,22 -777,17 +772,22 @@@ static int zpci_scan_bus(struct zpci_de
  
        ret = zpci_setup_bus_resources(zdev, &resources);
        if (ret)
 -              return ret;
 +              goto error;
  
        zdev->bus = pci_scan_root_bus(NULL, ZPCI_BUS_NR, &pci_root_ops,
                                      zdev, &resources);
        if (!zdev->bus) {
 -              zpci_cleanup_bus_resources(zdev);
 -              return -EIO;
 +              ret = -EIO;
 +              goto error;
        }
        zdev->bus->max_bus_speed = zdev->max_bus_speed;
        pci_bus_add_devices(zdev->bus);
        return 0;
 +
 +error:
 +      zpci_cleanup_bus_resources(zdev);
 +      pci_free_resource_list(&resources);
 +      return ret;
  }
  
  int zpci_enable_device(struct zpci_dev *zdev)
diff --combined arch/sparc/kernel/pci.c
index 3a0e1a986bfe3cf89c9f3cb92ac04c056b0f86eb,048b406d9e02af274facb987b3f3d981ca78b707..3a14a35592fe928754d7d1d946110b576a4bd95f
@@@ -249,6 -249,7 +249,6 @@@ static struct pci_dev *of_create_pci_de
                                         struct pci_bus *bus, int devfn)
  {
        struct dev_archdata *sd;
 -      struct pci_slot *slot;
        struct platform_device *op;
        struct pci_dev *dev;
        const char *type;
        dev->multifunction = 0;         /* maybe a lie? */
        set_pcie_port_type(dev);
  
 -      list_for_each_entry(slot, &dev->bus->slots, list)
 -              if (PCI_SLOT(dev->devfn) == slot->number)
 -                      dev->slot = slot;
 -
 +      pci_dev_assign_slot(dev);
        dev->vendor = of_getintprop_default(node, "vendor-id", 0xffff);
        dev->device = of_getintprop_default(node, "device-id", 0xffff);
        dev->subsystem_vendor =
@@@ -914,7 -918,7 +914,7 @@@ int arch_setup_msi_irq(struct pci_dev *
  void arch_teardown_msi_irq(unsigned int irq)
  {
        struct msi_desc *entry = irq_get_msi_desc(irq);
-       struct pci_dev *pdev = entry->dev;
+       struct pci_dev *pdev = msi_desc_to_pci_dev(entry);
        struct pci_pbm_info *pbm = pdev->dev.archdata.host_controller;
  
        if (pbm->teardown_msi_irq)
diff --combined arch/xtensa/kernel/irq.c
index 6df31cacc4b884c85c509a552edddcca55c0418a,d7b5a4c8ae5d9b6efa5dc1b223b5098cdad322dc..4ac3d23161cf782484da4f0c89b9394e1911a07f
@@@ -28,7 -28,7 +28,7 @@@
  #include <asm/uaccess.h>
  #include <asm/platform.h>
  
 -atomic_t irq_err_count;
 +DECLARE_PER_CPU(unsigned long, nmi_count);
  
  asmlinkage void do_IRQ(int hwirq, struct pt_regs *regs)
  {
  
  int arch_show_interrupts(struct seq_file *p, int prec)
  {
 +      unsigned cpu __maybe_unused;
  #ifdef CONFIG_SMP
        show_ipi_list(p, prec);
  #endif
 -      seq_printf(p, "%*s: ", prec, "ERR");
 -      seq_printf(p, "%10u\n", atomic_read(&irq_err_count));
 +#if XTENSA_FAKE_NMI
 +      seq_printf(p, "%*s:", prec, "NMI");
 +      for_each_online_cpu(cpu)
 +              seq_printf(p, " %10lu", per_cpu(nmi_count, cpu));
 +      seq_puts(p, "   Non-maskable interrupts\n");
 +#endif
        return 0;
  }
  
@@@ -111,12 -106,6 +111,12 @@@ int xtensa_irq_map(struct irq_domain *d
                irq_set_chip_and_handler_name(irq, irq_chip,
                                handle_percpu_irq, "timer");
                irq_clear_status_flags(irq, IRQ_LEVEL);
 +#ifdef XCHAL_INTTYPE_MASK_PROFILING
 +      } else if (mask & XCHAL_INTTYPE_MASK_PROFILING) {
 +              irq_set_chip_and_handler_name(irq, irq_chip,
 +                              handle_percpu_irq, "profiling");
 +              irq_set_status_flags(irq, IRQ_LEVEL);
 +#endif
        } else {/* XCHAL_INTTYPE_MASK_WRITE_ERROR */
                /* XCHAL_INTTYPE_MASK_NMI */
                irq_set_chip_and_handler_name(irq, irq_chip,
@@@ -177,23 -166,25 +177,25 @@@ void migrate_irqs(void
  
        for_each_active_irq(i) {
                struct irq_data *data = irq_get_irq_data(i);
+               struct cpumask *mask;
                unsigned int newcpu;
  
                if (irqd_is_per_cpu(data))
                        continue;
  
-               if (!cpumask_test_cpu(cpu, data->affinity))
+               mask = irq_data_get_affinity_mask(data);
+               if (!cpumask_test_cpu(cpu, mask))
                        continue;
  
-               newcpu = cpumask_any_and(data->affinity, cpu_online_mask);
+               newcpu = cpumask_any_and(mask, cpu_online_mask);
  
                if (newcpu >= nr_cpu_ids) {
                        pr_info_ratelimited("IRQ%u no longer affine to CPU%u\n",
                                            i, cpu);
  
-                       cpumask_setall(data->affinity);
+                       cpumask_setall(mask);
                }
-               irq_set_affinity(i, data->affinity);
+               irq_set_affinity(i, mask);
        }
  }
  #endif /* CONFIG_HOTPLUG_CPU */
diff --combined drivers/base/core.c
index fc5a558f62f974bbd769e3879ae11f6eb7297d9d,18e2a89aa138945cf1154cfa1c1c2c71546a89b0..f6947d0abc2f470e56f6b4b72f894cacd050efd3
@@@ -533,52 -533,6 +533,52 @@@ static DEVICE_ATTR_RO(dev)
  /* /sys/devices/ */
  struct kset *devices_kset;
  
 +/**
 + * devices_kset_move_before - Move device in the devices_kset's list.
 + * @deva: Device to move.
 + * @devb: Device @deva should come before.
 + */
 +static void devices_kset_move_before(struct device *deva, struct device *devb)
 +{
 +      if (!devices_kset)
 +              return;
 +      pr_debug("devices_kset: Moving %s before %s\n",
 +               dev_name(deva), dev_name(devb));
 +      spin_lock(&devices_kset->list_lock);
 +      list_move_tail(&deva->kobj.entry, &devb->kobj.entry);
 +      spin_unlock(&devices_kset->list_lock);
 +}
 +
 +/**
 + * devices_kset_move_after - Move device in the devices_kset's list.
 + * @deva: Device to move
 + * @devb: Device @deva should come after.
 + */
 +static void devices_kset_move_after(struct device *deva, struct device *devb)
 +{
 +      if (!devices_kset)
 +              return;
 +      pr_debug("devices_kset: Moving %s after %s\n",
 +               dev_name(deva), dev_name(devb));
 +      spin_lock(&devices_kset->list_lock);
 +      list_move(&deva->kobj.entry, &devb->kobj.entry);
 +      spin_unlock(&devices_kset->list_lock);
 +}
 +
 +/**
 + * devices_kset_move_last - move the device to the end of devices_kset's list.
 + * @dev: device to move
 + */
 +void devices_kset_move_last(struct device *dev)
 +{
 +      if (!devices_kset)
 +              return;
 +      pr_debug("devices_kset: Moving %s to end of list\n", dev_name(dev));
 +      spin_lock(&devices_kset->list_lock);
 +      list_move_tail(&dev->kobj.entry, &devices_kset->list);
 +      spin_unlock(&devices_kset->list_lock);
 +}
 +
  /**
   * device_create_file - create sysfs attribute file for device.
   * @dev: device.
@@@ -708,6 -662,9 +708,9 @@@ void device_initialize(struct device *d
        INIT_LIST_HEAD(&dev->devres_head);
        device_pm_init(dev);
        set_dev_node(dev, -1);
+ #ifdef CONFIG_GENERIC_MSI_IRQ
+       INIT_LIST_HEAD(&dev->msi_list);
+ #endif
  }
  EXPORT_SYMBOL_GPL(device_initialize);
  
@@@ -1969,15 -1926,12 +1972,15 @@@ int device_move(struct device *dev, str
                break;
        case DPM_ORDER_DEV_AFTER_PARENT:
                device_pm_move_after(dev, new_parent);
 +              devices_kset_move_after(dev, new_parent);
                break;
        case DPM_ORDER_PARENT_BEFORE_DEV:
                device_pm_move_before(new_parent, dev);
 +              devices_kset_move_before(new_parent, dev);
                break;
        case DPM_ORDER_DEV_LAST:
                device_pm_move_last(dev);
 +              devices_kset_move_last(dev);
                break;
        }
  
index c12bb93334ff99e7a5ddc72d274b00c4eeb9c24c,1240c4deda7517d63c789e53d49951ed82336452..a7f5626930f506289c6eaea34529c20b2051c750
   */
  #include <linux/err.h>
  #include <linux/io.h>
+ #include <linux/irqchip.h>
  #include <linux/irqdomain.h>
  #include <linux/of_address.h>
  #include <linux/of_irq.h>
  #include <linux/slab.h>
  
- #include "irqchip.h"
  #define IRQ_FREE      -1
  #define IRQ_RESERVED  -2
  #define IRQ_SKIP      -3
@@@ -68,9 -67,7 +67,9 @@@ static struct irq_chip crossbar_chip = 
        .irq_mask               = irq_chip_mask_parent,
        .irq_unmask             = irq_chip_unmask_parent,
        .irq_retrigger          = irq_chip_retrigger_hierarchy,
 -      .irq_set_wake           = irq_chip_set_wake_parent,
 +      .irq_set_type           = irq_chip_set_type_parent,
 +      .flags                  = IRQCHIP_MASK_ON_SUSPEND |
 +                                IRQCHIP_SKIP_SET_WAKE,
  #ifdef CONFIG_SMP
        .irq_set_affinity       = irq_chip_set_affinity_parent,
  #endif
index ff4be0515a0dc7dbb206ae0a84968f922817101e,2d36eca76bef82aa2b88d725cc8a4cb6e25e6fd6..dae5914578834050751b3fe2283046add588ea09
@@@ -11,6 -11,7 +11,7 @@@
  #include <linux/init.h>
  #include <linux/interrupt.h>
  #include <linux/irq.h>
+ #include <linux/irqchip.h>
  #include <linux/irqchip/mips-gic.h>
  #include <linux/of_address.h>
  #include <linux/sched.h>
@@@ -22,8 -23,6 +23,6 @@@
  
  #include <dt-bindings/interrupt-controller/mips-gic.h>
  
- #include "irqchip.h"
  unsigned int gic_present;
  
  struct gic_pcpu_mask {
@@@ -358,15 -357,12 +357,12 @@@ static int gic_set_type(struct irq_dat
                break;
        }
  
-       if (is_edge) {
-               __irq_set_chip_handler_name_locked(d->irq,
-                                                  &gic_edge_irq_controller,
-                                                  handle_edge_irq, NULL);
-       } else {
-               __irq_set_chip_handler_name_locked(d->irq,
-                                                  &gic_level_irq_controller,
-                                                  handle_level_irq, NULL);
-       }
+       if (is_edge)
+               irq_set_chip_handler_name_locked(d, &gic_edge_irq_controller,
+                                                handle_edge_irq, NULL);
+       else
+               irq_set_chip_handler_name_locked(d, &gic_level_irq_controller,
+                                                handle_level_irq, NULL);
        spin_unlock_irqrestore(&gic_lock, flags);
  
        return 0;
@@@ -396,7 -392,7 +392,7 @@@ static int gic_set_affinity(struct irq_
                clear_bit(irq, pcpu_masks[i].pcpu_mask);
        set_bit(irq, pcpu_masks[cpumask_first(&tmp)].pcpu_mask);
  
-       cpumask_copy(d->affinity, cpumask);
+       cpumask_copy(irq_data_get_affinity_mask(d), cpumask);
        spin_unlock_irqrestore(&gic_lock, flags);
  
        return IRQ_SET_MASK_OK_NOCOPY;
@@@ -538,7 -534,7 +534,7 @@@ static irqreturn_t ipi_resched_interrup
  
  static irqreturn_t ipi_call_interrupt(int irq, void *dev_id)
  {
 -      smp_call_function_interrupt();
 +      generic_smp_call_function_interrupt();
  
        return IRQ_HANDLED;
  }
index f1d0749ebbf066d99e02c73a8c609aaf55b4baa4,6f3abc2c73169d60d11c046c4dcb2baa2c46bcfc..e71da991949b1d598444a81dd775b3117c1c4744
@@@ -104,14 -104,13 +104,13 @@@ static void ks_dw_pcie_msi_irq_ack(stru
  {
        u32 offset, reg_offset, bit_pos;
        struct keystone_pcie *ks_pcie;
-       unsigned int irq = d->irq;
        struct msi_desc *msi;
        struct pcie_port *pp;
  
-       msi = irq_get_msi_desc(irq);
-       pp = sys_to_pcie(msi->dev->bus->sysdata);
+       msi = irq_data_get_msi_desc(d);
+       pp = sys_to_pcie(msi_desc_to_pci_sysdata(msi));
        ks_pcie = to_keystone_pcie(pp);
-       offset = irq - irq_linear_revmap(pp->irq_domain, 0);
+       offset = d->irq - irq_linear_revmap(pp->irq_domain, 0);
        update_reg_offset_bit_pos(offset, &reg_offset, &bit_pos);
  
        writel(BIT(bit_pos),
@@@ -142,15 -141,14 +141,14 @@@ void ks_dw_pcie_msi_clear_irq(struct pc
  static void ks_dw_pcie_msi_irq_mask(struct irq_data *d)
  {
        struct keystone_pcie *ks_pcie;
-       unsigned int irq = d->irq;
        struct msi_desc *msi;
        struct pcie_port *pp;
        u32 offset;
  
-       msi = irq_get_msi_desc(irq);
-       pp = sys_to_pcie(msi->dev->bus->sysdata);
+       msi = irq_data_get_msi_desc(d);
+       pp = sys_to_pcie(msi_desc_to_pci_sysdata(msi));
        ks_pcie = to_keystone_pcie(pp);
-       offset = irq - irq_linear_revmap(pp->irq_domain, 0);
+       offset = d->irq - irq_linear_revmap(pp->irq_domain, 0);
  
        /* Mask the end point if PVM implemented */
        if (IS_ENABLED(CONFIG_PCI_MSI)) {
  static void ks_dw_pcie_msi_irq_unmask(struct irq_data *d)
  {
        struct keystone_pcie *ks_pcie;
-       unsigned int irq = d->irq;
        struct msi_desc *msi;
        struct pcie_port *pp;
        u32 offset;
  
-       msi = irq_get_msi_desc(irq);
-       pp = sys_to_pcie(msi->dev->bus->sysdata);
+       msi = irq_data_get_msi_desc(d);
+       pp = sys_to_pcie(msi_desc_to_pci_sysdata(msi));
        ks_pcie = to_keystone_pcie(pp);
-       offset = irq - irq_linear_revmap(pp->irq_domain, 0);
+       offset = d->irq - irq_linear_revmap(pp->irq_domain, 0);
  
        /* Mask the end point if PVM implemented */
        if (IS_ENABLED(CONFIG_PCI_MSI)) {
@@@ -196,6 -193,7 +193,6 @@@ static int ks_dw_pcie_msi_map(struct ir
        irq_set_chip_and_handler(irq, &ks_dw_pcie_msi_irq_chip,
                                 handle_level_irq);
        irq_set_chip_data(irq, domain->host_data);
 -      set_irq_flags(irq, IRQF_VALID);
  
        return 0;
  }
@@@ -276,6 -274,7 +273,6 @@@ static int ks_dw_pcie_init_legacy_irq_m
        irq_set_chip_and_handler(irq, &ks_dw_pcie_legacy_irq_chip,
                                 handle_level_irq);
        irq_set_chip_data(irq, d->host_data);
 -      set_irq_flags(irq, IRQF_VALID);
  
        return 0;
  }
index 398c9bfe13a92166f747d67fcc676eb42eadeec3,23456b90ca0b140a17e6be0cb908100426dfdfc3..996327cfa1e1945e47449f1a33dd941ef143b372
@@@ -40,8 -40,8 +40,8 @@@ struct xgene_msi_group 
  
  struct xgene_msi {
        struct device_node      *node;
-       struct msi_controller   mchip;
-       struct irq_domain       *domain;
+       struct irq_domain       *inner_domain;
+       struct irq_domain       *msi_domain;
        u64                     msi_addr;
        void __iomem            *msi_regs;
        unsigned long           *bitmap;
@@@ -223,6 -223,7 +223,6 @@@ static int xgene_irq_domain_alloc(struc
        irq_domain_set_info(domain, virq, msi_irq,
                            &xgene_msi_bottom_irq_chip, domain->host_data,
                            handle_simple_irq, NULL, NULL);
 -      set_irq_flags(virq, IRQF_VALID);
  
        return 0;
  }
@@@ -251,17 -252,17 +251,17 @@@ static const struct irq_domain_ops msi_
  
  static int xgene_allocate_domains(struct xgene_msi *msi)
  {
-       msi->domain = irq_domain_add_linear(NULL, NR_MSI_VEC,
-                                           &msi_domain_ops, msi);
-       if (!msi->domain)
+       msi->inner_domain = irq_domain_add_linear(NULL, NR_MSI_VEC,
+                                                 &msi_domain_ops, msi);
+       if (!msi->inner_domain)
                return -ENOMEM;
  
-       msi->mchip.domain = pci_msi_create_irq_domain(msi->mchip.of_node,
-                                                     &xgene_msi_domain_info,
-                                                     msi->domain);
+       msi->msi_domain = pci_msi_create_irq_domain(msi->node,
+                                                   &xgene_msi_domain_info,
+                                                   msi->inner_domain);
  
-       if (!msi->mchip.domain) {
-               irq_domain_remove(msi->domain);
+       if (!msi->msi_domain) {
+               irq_domain_remove(msi->inner_domain);
                return -ENOMEM;
        }
  
  
  static void xgene_free_domains(struct xgene_msi *msi)
  {
-       if (msi->mchip.domain)
-               irq_domain_remove(msi->mchip.domain);
-       if (msi->domain)
-               irq_domain_remove(msi->domain);
+       if (msi->msi_domain)
+               irq_domain_remove(msi->msi_domain);
+       if (msi->inner_domain)
+               irq_domain_remove(msi->inner_domain);
  }
  
  static int xgene_msi_init_allocator(struct xgene_msi *xgene_msi)
@@@ -339,7 -340,7 +339,7 @@@ static void xgene_msi_isr(unsigned int 
                         * CPU0
                         */
                        hw_irq = hwirq_to_canonical_hwirq(hw_irq);
-                       virq = irq_find_mapping(xgene_msi->domain, hw_irq);
+                       virq = irq_find_mapping(xgene_msi->inner_domain, hw_irq);
                        WARN_ON(!virq);
                        if (virq != 0)
                                generic_handle_irq(virq);
@@@ -367,10 -368,8 +367,8 @@@ static int xgene_msi_remove(struct plat
  
        for (i = 0; i < NR_HW_IRQS; i++) {
                virq = msi->msi_groups[i].gic_irq;
-               if (virq != 0) {
-                       irq_set_chained_handler(virq, NULL);
-                       irq_set_handler_data(virq, NULL);
-               }
+               if (virq != 0)
+                       irq_set_chained_handler_and_data(virq, NULL, NULL);
        }
        kfree(msi->msi_groups);
  
@@@ -420,8 -419,8 +418,8 @@@ static int xgene_msi_hwirq_alloc(unsign
                }
  
                if (err) {
-                       irq_set_chained_handler(msi_group->gic_irq, NULL);
-                       irq_set_handler_data(msi_group->gic_irq, NULL);
+                       irq_set_chained_handler_and_data(msi_group->gic_irq,
+                                                        NULL, NULL);
                        return err;
                }
        }
@@@ -440,8 -439,8 +438,8 @@@ static void xgene_msi_hwirq_free(unsign
                if (!msi_group->gic_irq)
                        continue;
  
-               irq_set_chained_handler(msi_group->gic_irq, NULL);
-               irq_set_handler_data(msi_group->gic_irq, NULL);
+               irq_set_chained_handler_and_data(msi_group->gic_irq, NULL,
+                                                NULL);
        }
  }
  
@@@ -496,7 -495,7 +494,7 @@@ static int xgene_msi_probe(struct platf
                goto error;
        }
        xgene_msi->msi_addr = res->start;
+       xgene_msi->node = pdev->dev.of_node;
        xgene_msi->num_cpus = num_possible_cpus();
  
        rc = xgene_msi_init_allocator(xgene_msi);
  
        cpu_notifier_register_done();
  
-       xgene_msi->mchip.of_node = pdev->dev.of_node;
-       rc = of_pci_msi_chip_add(&xgene_msi->mchip);
-       if (rc) {
-               dev_err(&pdev->dev, "failed to add MSI controller chip\n");
-               goto error_notifier;
-       }
        dev_info(&pdev->dev, "APM X-Gene PCIe MSI driver loaded\n");
  
        return 0;
  
- error_notifier:
-       unregister_hotcpu_notifier(&xgene_msi_cpu_notifier);
  error:
        xgene_msi_remove(pdev);
        return rc;
  static struct platform_driver xgene_msi_driver = {
        .driver = {
                .name = "xgene-msi",
 -              .owner = THIS_MODULE,
                .of_match_table = xgene_msi_match_table,
        },
        .probe = xgene_msi_probe,
index 8d52ce73f84262a4835557d952ddd709693fcef3,aae6dcb528c1faef1b4d74dc6b8c82553ba0c6f5..52aa6e34002bc2543f20b8607efdab9e2a5a669a
@@@ -255,7 -255,7 +255,7 @@@ static void dw_pcie_msi_set_irq(struct 
  static int assign_irq(int no_irqs, struct msi_desc *desc, int *pos)
  {
        int irq, pos0, i;
-       struct pcie_port *pp = sys_to_pcie(desc->dev->bus->sysdata);
+       struct pcie_port *pp = sys_to_pcie(msi_desc_to_pci_sysdata(desc));
  
        pos0 = bitmap_find_free_region(pp->msi_irq_in_use, MAX_MSI_IRQS,
                                       order_base_2(no_irqs));
@@@ -326,8 -326,8 +326,8 @@@ static int dw_msi_setup_irq(struct msi_
  static void dw_msi_teardown_irq(struct msi_controller *chip, unsigned int irq)
  {
        struct irq_data *data = irq_get_irq_data(irq);
-       struct msi_desc *msi = irq_data_get_msi(data);
-       struct pcie_port *pp = sys_to_pcie(msi->dev->bus->sysdata);
+       struct msi_desc *msi = irq_data_get_msi_desc(data);
+       struct pcie_port *pp = sys_to_pcie(msi_desc_to_pci_sysdata(msi));
  
        clear_irq_range(pp, irq, 1, data->hwirq);
  }
@@@ -350,6 -350,7 +350,6 @@@ static int dw_pcie_msi_map(struct irq_d
  {
        irq_set_chip_and_handler(irq, &dw_msi_irq_chip, handle_simple_irq);
        irq_set_chip_data(irq, domain->host_data);
 -      set_irq_flags(irq, IRQF_VALID);
  
        return 0;
  }
@@@ -387,7 -388,7 +387,7 @@@ int dw_pcie_host_init(struct pcie_port 
                addrp = of_get_address(np, index, NULL, NULL);
                pp->cfg0_mod_base = of_read_number(addrp, ns);
                pp->cfg1_mod_base = pp->cfg0_mod_base + pp->cfg0_size;
 -      } else {
 +      } else if (!pp->va_cfg0_base) {
                dev_err(pp->dev, "missing *config* reg space\n");
        }
  
  
  #ifdef CONFIG_PCI_MSI
        dw_pcie_msi_chip.dev = pp->dev;
 -      dw_pci.msi_ctrl = &dw_pcie_msi_chip;
  #endif
  
        dw_pci.nr_controllers = 1;
@@@ -706,15 -708,8 +706,15 @@@ static struct pci_bus *dw_pcie_scan_bus
        struct pcie_port *pp = sys_to_pcie(sys);
  
        pp->root_bus_nr = sys->busnr;
 -      bus = pci_scan_root_bus(pp->dev, sys->busnr,
 -                                &dw_pcie_ops, sys, &sys->resources);
 +
 +      if (IS_ENABLED(CONFIG_PCI_MSI))
 +              bus = pci_scan_root_bus_msi(pp->dev, sys->busnr, &dw_pcie_ops,
 +                                          sys, &sys->resources,
 +                                          &dw_pcie_msi_chip);
 +      else
 +              bus = pci_scan_root_bus(pp->dev, sys->busnr, &dw_pcie_ops,
 +                                      sys, &sys->resources);
 +
        if (!bus)
                return NULL;
  
index 1aeaa914bd3034e0b42823b6ba593ad047b917fc,be494e46bbd16dfdb0cbb4935b1859c8353bf7e8..3c7a0d580b1ed990d9978efc5927c3a8d2abc8af
@@@ -227,18 -227,16 +227,16 @@@ static struct pci_ops xilinx_pcie_ops 
   */
  static void xilinx_pcie_destroy_msi(unsigned int irq)
  {
-       struct irq_desc *desc;
        struct msi_desc *msi;
        struct xilinx_pcie_port *port;
  
-       desc = irq_to_desc(irq);
-       msi = irq_desc_get_msi_desc(desc);
-       port = sys_to_pcie(msi->dev->bus->sysdata);
-       if (!test_bit(irq, msi_irq_in_use))
+       if (!test_bit(irq, msi_irq_in_use)) {
+               msi = irq_get_msi_desc(irq);
+               port = sys_to_pcie(msi_desc_to_pci_sysdata(msi));
                dev_err(port->dev, "Trying to free unused MSI#%d\n", irq);
-       else
+       } else {
                clear_bit(irq, msi_irq_in_use);
+       }
  }
  
  /**
@@@ -338,6 -336,7 +336,6 @@@ static int xilinx_pcie_msi_map(struct i
  {
        irq_set_chip_and_handler(irq, &xilinx_msi_irq_chip, handle_simple_irq);
        irq_set_chip_data(irq, domain->host_data);
 -      set_irq_flags(irq, IRQF_VALID);
  
        return 0;
  }
@@@ -376,6 -375,7 +374,6 @@@ static int xilinx_pcie_intx_map(struct 
  {
        irq_set_chip_and_handler(irq, &dummy_irq_chip, handle_simple_irq);
        irq_set_chip_data(irq, domain->host_data);
 -      set_irq_flags(irq, IRQF_VALID);
  
        return 0;
  }
@@@ -447,17 -447,14 +445,17 @@@ static irqreturn_t xilinx_pcie_intr_han
                        return IRQ_HANDLED;
                }
  
 -              /* Clear interrupt FIFO register 1 */
 -              pcie_write(port, XILINX_PCIE_RPIFR1_ALL_MASK,
 -                         XILINX_PCIE_REG_RPIFR1);
 +              if (!(val & XILINX_PCIE_RPIFR1_MSI_INTR)) {
 +                      /* Clear interrupt FIFO register 1 */
 +                      pcie_write(port, XILINX_PCIE_RPIFR1_ALL_MASK,
 +                                 XILINX_PCIE_REG_RPIFR1);
  
 -              /* Handle INTx Interrupt */
 -              val = ((val & XILINX_PCIE_RPIFR1_INTR_MASK) >>
 -                      XILINX_PCIE_RPIFR1_INTR_SHIFT) + 1;
 -              generic_handle_irq(irq_find_mapping(port->irq_domain, val));
 +                      /* Handle INTx Interrupt */
 +                      val = ((val & XILINX_PCIE_RPIFR1_INTR_MASK) >>
 +                              XILINX_PCIE_RPIFR1_INTR_SHIFT) + 1;
 +                      generic_handle_irq(irq_find_mapping(port->irq_domain,
 +                                                          val));
 +              }
        }
  
        if (status & XILINX_PCIE_INTR_MSI) {
@@@ -648,15 -645,9 +646,15 @@@ static struct pci_bus *xilinx_pcie_scan
        struct pci_bus *bus;
  
        port->root_busno = sys->busnr;
 -      bus = pci_scan_root_bus(port->dev, sys->busnr, &xilinx_pcie_ops,
 -                              sys, &sys->resources);
  
 +      if (IS_ENABLED(CONFIG_PCI_MSI))
 +              bus = pci_scan_root_bus_msi(port->dev, sys->busnr,
 +                                          &xilinx_pcie_ops, sys,
 +                                          &sys->resources,
 +                                          &xilinx_pcie_msi_chip);
 +      else
 +              bus = pci_scan_root_bus(port->dev, sys->busnr,
 +                                      &xilinx_pcie_ops, sys, &sys->resources);
        return bus;
  }
  
@@@ -854,6 -845,7 +852,6 @@@ static int xilinx_pcie_probe(struct pla
  
  #ifdef CONFIG_PCI_MSI
        xilinx_pcie_msi_chip.dev = port->dev;
 -      hw.msi_ctrl = &xilinx_pcie_msi_chip;
  #endif
        pci_common_init_dev(dev, &hw);
  
diff --combined drivers/pci/msi.c
index 2f9b1c0d1f961cb961d3320011a5b40afa1bb917,f70aa0f5cbaf23d5fb737dfc3e2a0d1e20be0ec4..d4497141d083a71d5d5206496fee58fbddc5cb13
@@@ -39,14 -39,13 +39,13 @@@ struct irq_domain * __weak arch_get_pci
  
  static struct irq_domain *pci_msi_get_domain(struct pci_dev *dev)
  {
-       struct irq_domain *domain = NULL;
+       struct irq_domain *domain;
  
-       if (dev->bus->msi)
-               domain = dev->bus->msi->domain;
-       if (!domain)
-               domain = arch_get_pci_msi_domain(dev);
+       domain = dev_get_msi_domain(&dev->dev);
+       if (domain)
+               return domain;
  
-       return domain;
+       return arch_get_pci_msi_domain(dev);
  }
  
  static int pci_msi_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
@@@ -77,9 -76,24 +76,9 @@@ static void pci_msi_teardown_msi_irqs(s
  
  /* Arch hooks */
  
 -struct msi_controller * __weak pcibios_msi_controller(struct pci_dev *dev)
 -{
 -      return NULL;
 -}
 -
 -static struct msi_controller *pci_msi_controller(struct pci_dev *dev)
 -{
 -      struct msi_controller *msi_ctrl = dev->bus->msi;
 -
 -      if (msi_ctrl)
 -              return msi_ctrl;
 -
 -      return pcibios_msi_controller(dev);
 -}
 -
  int __weak arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
  {
 -      struct msi_controller *chip = pci_msi_controller(dev);
 +      struct msi_controller *chip = dev->bus->msi;
        int err;
  
        if (!chip || !chip->setup_irq)
@@@ -116,7 -130,7 +115,7 @@@ int __weak arch_setup_msi_irqs(struct p
        if (type == PCI_CAP_ID_MSI && nvec > 1)
                return 1;
  
-       list_for_each_entry(entry, &dev->msi_list, list) {
+       for_each_pci_msi_entry(entry, dev) {
                ret = arch_setup_msi_irq(dev, entry);
                if (ret < 0)
                        return ret;
@@@ -136,7 -150,7 +135,7 @@@ void default_teardown_msi_irqs(struct p
        int i;
        struct msi_desc *entry;
  
-       list_for_each_entry(entry, &dev->msi_list, list)
+       for_each_pci_msi_entry(entry, dev)
                if (entry->irq)
                        for (i = 0; i < entry->nvec_used; i++)
                                arch_teardown_msi_irq(entry->irq + i);
@@@ -153,7 -167,7 +152,7 @@@ static void default_restore_msi_irq(str
  
        entry = NULL;
        if (dev->msix_enabled) {
-               list_for_each_entry(entry, &dev->msi_list, list) {
+               for_each_pci_msi_entry(entry, dev) {
                        if (irq == entry->irq)
                                break;
                }
@@@ -193,7 -207,8 +192,8 @@@ u32 __pci_msi_desc_mask_irq(struct msi_
  
        mask_bits &= ~mask;
        mask_bits |= flag;
-       pci_write_config_dword(desc->dev, desc->mask_pos, mask_bits);
+       pci_write_config_dword(msi_desc_to_pci_dev(desc), desc->mask_pos,
+                              mask_bits);
  
        return mask_bits;
  }
@@@ -234,7 -249,7 +234,7 @@@ static void msix_mask_irq(struct msi_de
  
  static void msi_set_mask_bit(struct irq_data *data, u32 flag)
  {
-       struct msi_desc *desc = irq_data_get_msi(data);
+       struct msi_desc *desc = irq_data_get_msi_desc(data);
  
        if (desc->msi_attrib.is_msix) {
                msix_mask_irq(desc, flag);
@@@ -267,13 -282,15 +267,15 @@@ void default_restore_msi_irqs(struct pc
  {
        struct msi_desc *entry;
  
-       list_for_each_entry(entry, &dev->msi_list, list)
+       for_each_pci_msi_entry(entry, dev)
                default_restore_msi_irq(dev, entry->irq);
  }
  
  void __pci_read_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
  {
-       BUG_ON(entry->dev->current_state != PCI_D0);
+       struct pci_dev *dev = msi_desc_to_pci_dev(entry);
+       BUG_ON(dev->current_state != PCI_D0);
  
        if (entry->msi_attrib.is_msix) {
                void __iomem *base = entry->mask_base +
                msg->address_hi = readl(base + PCI_MSIX_ENTRY_UPPER_ADDR);
                msg->data = readl(base + PCI_MSIX_ENTRY_DATA);
        } else {
-               struct pci_dev *dev = entry->dev;
                int pos = dev->msi_cap;
                u16 data;
  
  
  void __pci_write_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
  {
-       if (entry->dev->current_state != PCI_D0) {
+       struct pci_dev *dev = msi_desc_to_pci_dev(entry);
+       if (dev->current_state != PCI_D0) {
                /* Don't touch the hardware now */
        } else if (entry->msi_attrib.is_msix) {
                void __iomem *base;
                writel(msg->address_hi, base + PCI_MSIX_ENTRY_UPPER_ADDR);
                writel(msg->data, base + PCI_MSIX_ENTRY_DATA);
        } else {
-               struct pci_dev *dev = entry->dev;
                int pos = dev->msi_cap;
                u16 msgctl;
  
@@@ -348,21 -365,22 +350,22 @@@ EXPORT_SYMBOL_GPL(pci_write_msi_msg)
  
  static void free_msi_irqs(struct pci_dev *dev)
  {
+       struct list_head *msi_list = dev_to_msi_list(&dev->dev);
        struct msi_desc *entry, *tmp;
        struct attribute **msi_attrs;
        struct device_attribute *dev_attr;
        int i, count = 0;
  
-       list_for_each_entry(entry, &dev->msi_list, list)
+       for_each_pci_msi_entry(entry, dev)
                if (entry->irq)
                        for (i = 0; i < entry->nvec_used; i++)
                                BUG_ON(irq_has_action(entry->irq + i));
  
        pci_msi_teardown_msi_irqs(dev);
  
-       list_for_each_entry_safe(entry, tmp, &dev->msi_list, list) {
+       list_for_each_entry_safe(entry, tmp, msi_list, list) {
                if (entry->msi_attrib.is_msix) {
-                       if (list_is_last(&entry->list, &dev->msi_list))
+                       if (list_is_last(&entry->list, msi_list))
                                iounmap(entry->mask_base);
                }
  
        }
  }
  
- static struct msi_desc *alloc_msi_entry(struct pci_dev *dev)
- {
-       struct msi_desc *desc = kzalloc(sizeof(*desc), GFP_KERNEL);
-       if (!desc)
-               return NULL;
-       INIT_LIST_HEAD(&desc->list);
-       desc->dev = dev;
-       return desc;
- }
  static void pci_intx_for_msi(struct pci_dev *dev, int enable)
  {
        if (!(dev->dev_flags & PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG))
@@@ -433,7 -439,7 +424,7 @@@ static void __pci_restore_msix_state(st
  
        if (!dev->msix_enabled)
                return;
-       BUG_ON(list_empty(&dev->msi_list));
+       BUG_ON(list_empty(dev_to_msi_list(&dev->dev)));
  
        /* route the table */
        pci_intx_for_msi(dev, 0);
                                PCI_MSIX_FLAGS_ENABLE | PCI_MSIX_FLAGS_MASKALL);
  
        arch_restore_msi_irqs(dev);
-       list_for_each_entry(entry, &dev->msi_list, list)
+       for_each_pci_msi_entry(entry, dev)
                msix_mask_irq(entry, entry->masked);
  
        pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_MASKALL, 0);
@@@ -486,7 -492,7 +477,7 @@@ static int populate_msi_sysfs(struct pc
        int count = 0;
  
        /* Determine how many msi entries we have */
-       list_for_each_entry(entry, &pdev->msi_list, list)
+       for_each_pci_msi_entry(entry, pdev)
                ++num_msi;
        if (!num_msi)
                return 0;
        msi_attrs = kzalloc(sizeof(void *) * (num_msi + 1), GFP_KERNEL);
        if (!msi_attrs)
                return -ENOMEM;
-       list_for_each_entry(entry, &pdev->msi_list, list) {
+       for_each_pci_msi_entry(entry, pdev) {
                msi_dev_attr = kzalloc(sizeof(*msi_dev_attr), GFP_KERNEL);
                if (!msi_dev_attr)
                        goto error_attrs;
@@@ -553,7 -559,7 +544,7 @@@ static struct msi_desc *msi_setup_entry
        struct msi_desc *entry;
  
        /* MSI Entry Initialization */
-       entry = alloc_msi_entry(dev);
+       entry = alloc_msi_entry(&dev->dev);
        if (!entry)
                return NULL;
  
@@@ -584,7 -590,7 +575,7 @@@ static int msi_verify_entries(struct pc
  {
        struct msi_desc *entry;
  
-       list_for_each_entry(entry, &dev->msi_list, list) {
+       for_each_pci_msi_entry(entry, dev) {
                if (!dev->no_64bit_msi || !entry->msg.address_hi)
                        continue;
                dev_err(&dev->dev, "Device has broken 64-bit MSI but arch"
@@@ -621,7 -627,7 +612,7 @@@ static int msi_capability_init(struct p
        mask = msi_mask(entry->msi_attrib.multi_cap);
        msi_mask_irq(entry, mask, mask);
  
-       list_add_tail(&entry->list, &dev->msi_list);
+       list_add_tail(&entry->list, dev_to_msi_list(&dev->dev));
  
        /* Configure MSI capability structure */
        ret = pci_msi_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSI);
        pci_msi_set_enable(dev, 1);
        dev->msi_enabled = 1;
  
 +      pcibios_free_irq(dev);
        dev->irq = entry->irq;
        return 0;
  }
@@@ -682,7 -687,7 +673,7 @@@ static int msix_setup_entries(struct pc
        int i;
  
        for (i = 0; i < nvec; i++) {
-               entry = alloc_msi_entry(dev);
+               entry = alloc_msi_entry(&dev->dev);
                if (!entry) {
                        if (!i)
                                iounmap(base);
                entry->mask_base                = base;
                entry->nvec_used                = 1;
  
-               list_add_tail(&entry->list, &dev->msi_list);
+               list_add_tail(&entry->list, dev_to_msi_list(&dev->dev));
        }
  
        return 0;
@@@ -711,7 -716,7 +702,7 @@@ static void msix_program_entries(struc
        struct msi_desc *entry;
        int i = 0;
  
-       list_for_each_entry(entry, &dev->msi_list, list) {
+       for_each_pci_msi_entry(entry, dev) {
                int offset = entries[i].entry * PCI_MSIX_ENTRY_SIZE +
                                                PCI_MSIX_ENTRY_VECTOR_CTRL;
  
@@@ -778,9 -783,9 +769,9 @@@ static int msix_capability_init(struct 
        /* Set MSI-X enabled bits and unmask the function */
        pci_intx_for_msi(dev, 0);
        dev->msix_enabled = 1;
 -
        pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_MASKALL, 0);
  
 +      pcibios_free_irq(dev);
        return 0;
  
  out_avail:
                struct msi_desc *entry;
                int avail = 0;
  
-               list_for_each_entry(entry, &dev->msi_list, list) {
+               for_each_pci_msi_entry(entry, dev) {
                        if (entry->irq != 0)
                                avail++;
                }
@@@ -881,8 -886,8 +872,8 @@@ void pci_msi_shutdown(struct pci_dev *d
        if (!pci_msi_enable || !dev || !dev->msi_enabled)
                return;
  
-       BUG_ON(list_empty(&dev->msi_list));
-       desc = list_first_entry(&dev->msi_list, struct msi_desc, list);
+       BUG_ON(list_empty(dev_to_msi_list(&dev->dev)));
+       desc = first_pci_msi_entry(dev);
  
        pci_msi_set_enable(dev, 0);
        pci_intx_for_msi(dev, 1);
  
        /* Restore dev->irq to its default pin-assertion irq */
        dev->irq = desc->msi_attrib.default_irq;
 +      pcibios_alloc_irq(dev);
  }
  
  void pci_disable_msi(struct pci_dev *dev)
@@@ -988,7 -992,7 +979,7 @@@ void pci_msix_shutdown(struct pci_dev *
                return;
  
        /* Return the device with MSI-X masked as initial states */
-       list_for_each_entry(entry, &dev->msi_list, list) {
+       for_each_pci_msi_entry(entry, dev) {
                /* Keep cached states to be restored */
                __pci_msix_desc_mask_irq(entry, 1);
        }
        pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_ENABLE, 0);
        pci_intx_for_msi(dev, 1);
        dev->msix_enabled = 0;
 +      pcibios_alloc_irq(dev);
  }
  
  void pci_disable_msix(struct pci_dev *dev)
@@@ -1028,7 -1031,6 +1019,6 @@@ EXPORT_SYMBOL(pci_msi_enabled)
  
  void pci_msi_init_pci_dev(struct pci_dev *dev)
  {
-       INIT_LIST_HEAD(&dev->msi_list);
  }
  
  /**
@@@ -1125,6 -1127,19 +1115,19 @@@ int pci_enable_msix_range(struct pci_de
  }
  EXPORT_SYMBOL(pci_enable_msix_range);
  
+ struct pci_dev *msi_desc_to_pci_dev(struct msi_desc *desc)
+ {
+       return to_pci_dev(desc->dev);
+ }
+ void *msi_desc_to_pci_sysdata(struct msi_desc *desc)
+ {
+       struct pci_dev *dev = msi_desc_to_pci_dev(desc);
+       return dev->bus->sysdata;
+ }
+ EXPORT_SYMBOL_GPL(msi_desc_to_pci_sysdata);
  #ifdef CONFIG_PCI_MSI_IRQ_DOMAIN
  /**
   * pci_msi_domain_write_msg - Helper to write MSI message to PCI config space
   */
  void pci_msi_domain_write_msg(struct irq_data *irq_data, struct msi_msg *msg)
  {
-       struct msi_desc *desc = irq_data->msi_desc;
+       struct msi_desc *desc = irq_data_get_msi_desc(irq_data);
  
        /*
         * For MSI-X desc->irq is always equal to irq_data->irq. For
@@@ -1257,12 -1272,19 +1260,19 @@@ struct irq_domain *pci_msi_create_irq_d
                                             struct msi_domain_info *info,
                                             struct irq_domain *parent)
  {
+       struct irq_domain *domain;
        if (info->flags & MSI_FLAG_USE_DEF_DOM_OPS)
                pci_msi_domain_update_dom_ops(info);
        if (info->flags & MSI_FLAG_USE_DEF_CHIP_OPS)
                pci_msi_domain_update_chip_ops(info);
  
-       return msi_create_irq_domain(node, info, parent);
+       domain = msi_create_irq_domain(node, info, parent);
+       if (!domain)
+               return NULL;
+       domain->bus_token = DOMAIN_BUS_PCI_MSI;
+       return domain;
  }
  
  /**
diff --combined drivers/pci/probe.c
index 04cfc60f786070617e06dfdd692129cbac841ee3,a7afeacce7f175ccad0640d9078459473bf3a2b0..8177f3b0449152a7c01136a1925f4bfcf885cf8a
@@@ -661,6 -661,35 +661,35 @@@ static void pci_set_bus_speed(struct pc
        }
  }
  
+ static struct irq_domain *pci_host_bridge_msi_domain(struct pci_bus *bus)
+ {
+       struct irq_domain *d;
+       /*
+        * Any firmware interface that can resolve the msi_domain
+        * should be called from here.
+        */
+       d = pci_host_bridge_of_msi_domain(bus);
+       return d;
+ }
+ static void pci_set_bus_msi_domain(struct pci_bus *bus)
+ {
+       struct irq_domain *d;
+       /*
+        * Either bus is the root, and we must obtain it from the
+        * firmware, or we inherit it from the bridge device.
+        */
+       if (pci_is_root_bus(bus))
+               d = pci_host_bridge_msi_domain(bus);
+       else
+               d = dev_get_msi_domain(&bus->self->dev);
+       dev_set_msi_domain(&bus->dev, d);
+ }
  static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,
                                           struct pci_dev *bridge, int busnr)
  {
        bridge->subordinate = child;
  
  add_dev:
+       pci_set_bus_msi_domain(child);
        ret = device_register(&child->dev);
        WARN_ON(ret < 0);
  
@@@ -826,9 -856,6 +856,9 @@@ int pci_scan_bridge(struct pci_bus *bus
                        child->bridge_ctl = bctl;
                }
  
 +              /* Read and initialize bridge resources */
 +              pci_read_bridge_bases(child);
 +
                cmax = pci_scan_child_bus(child);
                if (cmax > subordinate)
                        dev_warn(&dev->dev, "bridge has subordinate %02x but max busn %02x\n",
  
                if (!is_cardbus) {
                        child->bridge_ctl = bctl;
 +
 +                      /* Read and initialize bridge resources */
 +                      pci_read_bridge_bases(child);
                        max = pci_scan_child_bus(child);
                } else {
                        /*
@@@ -1003,12 -1027,7 +1033,12 @@@ void set_pcie_port_type(struct pci_dev 
        else if (type == PCI_EXP_TYPE_UPSTREAM ||
                 type == PCI_EXP_TYPE_DOWNSTREAM) {
                parent = pci_upstream_bridge(pdev);
 -              if (!parent->has_secondary_link)
 +
 +              /*
 +               * Usually there's an upstream device (Root Port or Switch
 +               * Downstream Port), but we can't assume one exists.
 +               */
 +              if (parent && !parent->has_secondary_link)
                        pdev->has_secondary_link = 1;
        }
  }
@@@ -1114,7 -1133,7 +1144,7 @@@ int pci_cfg_space_size(struct pci_dev *
  
  #define LEGACY_IO_RESOURCE    (IORESOURCE_IO | IORESOURCE_PCI_FIXED)
  
 -static void pci_msi_setup_pci_dev(struct pci_dev *dev)
 +void pci_msi_setup_pci_dev(struct pci_dev *dev)
  {
        /*
         * Disable the MSI hardware to avoid screaming interrupts
@@@ -1144,6 -1163,7 +1174,6 @@@ int pci_setup_device(struct pci_dev *de
  {
        u32 class;
        u8 hdr_type;
 -      struct pci_slot *slot;
        int pos = 0;
        struct pci_bus_region region;
        struct resource *res;
        dev->error_state = pci_channel_io_normal;
        set_pcie_port_type(dev);
  
 -      list_for_each_entry(slot, &dev->bus->slots, list)
 -              if (PCI_SLOT(dev->devfn) == slot->number)
 -                      dev->slot = slot;
 -
 +      pci_dev_assign_slot(dev);
        /* Assume 32-bit PCI; let 64-bit PCI cards (which are far rarer)
           set this higher, assuming the system even supports it.  */
        dev->dma_mask = 0xffffffff;
        bad:
                dev_err(&dev->dev, "ignoring class %#08x (doesn't match header type %02x)\n",
                        dev->class, dev->hdr_type);
 -              dev->class = PCI_CLASS_NOT_DEFINED;
 +              dev->class = PCI_CLASS_NOT_DEFINED << 8;
        }
  
        /* We found a fine healthy device, go go go... */
        return 0;
  }
  
 +static void pci_configure_mps(struct pci_dev *dev)
 +{
 +      struct pci_dev *bridge = pci_upstream_bridge(dev);
 +      int mps, p_mps, rc;
 +
 +      if (!pci_is_pcie(dev) || !bridge || !pci_is_pcie(bridge))
 +              return;
 +
 +      mps = pcie_get_mps(dev);
 +      p_mps = pcie_get_mps(bridge);
 +
 +      if (mps == p_mps)
 +              return;
 +
 +      if (pcie_bus_config == PCIE_BUS_TUNE_OFF) {
 +              dev_warn(&dev->dev, "Max Payload Size %d, but upstream %s set to %d; if necessary, use \"pci=pcie_bus_safe\" and report a bug\n",
 +                       mps, pci_name(bridge), p_mps);
 +              return;
 +      }
 +
 +      /*
 +       * Fancier MPS configuration is done later by
 +       * pcie_bus_configure_settings()
 +       */
 +      if (pcie_bus_config != PCIE_BUS_DEFAULT)
 +              return;
 +
 +      rc = pcie_set_mps(dev, p_mps);
 +      if (rc) {
 +              dev_warn(&dev->dev, "can't set Max Payload Size to %d; if necessary, use \"pci=pcie_bus_safe\" and report a bug\n",
 +                       p_mps);
 +              return;
 +      }
 +
 +      dev_info(&dev->dev, "Max Payload Size set to %d (was %d, max %d)\n",
 +               p_mps, mps, 128 << dev->pcie_mpss);
 +}
 +
  static struct hpp_type0 pci_default_type0 = {
        .revision = 1,
        .cache_line_size = 8,
@@@ -1441,8 -1426,6 +1471,8 @@@ static void pci_configure_device(struc
        struct hotplug_params hpp;
        int ret;
  
 +      pci_configure_mps(dev);
 +
        memset(&hpp, 0, sizeof(hpp));
        ret = pci_get_hp_params(dev, &hpp);
        if (ret)
@@@ -1587,13 -1570,21 +1617,24 @@@ static void pci_init_capabilities(struc
        /* Single Root I/O Virtualization */
        pci_iov_init(dev);
  
 +      /* Address Translation Services */
 +      pci_ats_init(dev);
 +
        /* Enable ACS P2P upstream forwarding */
        pci_enable_acs(dev);
  }
  
+ static void pci_set_msi_domain(struct pci_dev *dev)
+ {
+       /*
+        * If no domain has been set through the pcibios_add_device
+        * callback, inherit the default from the bus device.
+        */
+       if (!dev_get_msi_domain(&dev->dev))
+               dev_set_msi_domain(&dev->dev,
+                                  dev_get_msi_domain(&dev->bus->dev));
+ }
  void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
  {
        int ret;
        ret = pcibios_add_device(dev);
        WARN_ON(ret < 0);
  
+       /* Setup MSI irq domain */
+       pci_set_msi_domain(dev);
        /* Notifier could use PCI capabilities */
        dev->match_driver = false;
        ret = device_add(&dev->dev);
@@@ -1841,6 -1835,22 +1885,6 @@@ static void pcie_write_mrrs(struct pci_
                dev_err(&dev->dev, "MRRS was unable to be configured with a safe value.  If problems are experienced, try running with pci=pcie_bus_safe\n");
  }
  
 -static void pcie_bus_detect_mps(struct pci_dev *dev)
 -{
 -      struct pci_dev *bridge = dev->bus->self;
 -      int mps, p_mps;
 -
 -      if (!bridge)
 -              return;
 -
 -      mps = pcie_get_mps(dev);
 -      p_mps = pcie_get_mps(bridge);
 -
 -      if (mps != p_mps)
 -              dev_warn(&dev->dev, "Max Payload Size %d, but upstream %s set to %d; if necessary, use \"pci=pcie_bus_safe\" and report a bug\n",
 -                       mps, pci_name(bridge), p_mps);
 -}
 -
  static int pcie_bus_configure_set(struct pci_dev *dev, void *data)
  {
        int mps, orig_mps;
        if (!pci_is_pcie(dev))
                return 0;
  
 -      if (pcie_bus_config == PCIE_BUS_TUNE_OFF) {
 -              pcie_bus_detect_mps(dev);
 +      if (pcie_bus_config == PCIE_BUS_TUNE_OFF ||
 +          pcie_bus_config == PCIE_BUS_DEFAULT)
                return 0;
 -      }
  
        mps = 128 << *(u8 *)data;
        orig_mps = pcie_get_mps(dev);
@@@ -2008,6 -2019,7 +2052,7 @@@ struct pci_bus *pci_create_root_bus(str
        b->bridge = get_device(&bridge->dev);
        device_enable_async_suspend(b->bridge);
        pci_set_bus_of_node(b);
+       pci_set_bus_msi_domain(b);
  
        if (!parent)
                set_dev_node(b->bridge, pcibus_to_node(b));
@@@ -2129,9 -2141,8 +2174,9 @@@ void pci_bus_release_busn_res(struct pc
                        res, ret ? "can not be" : "is");
  }
  
 -struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 -              struct pci_ops *ops, void *sysdata, struct list_head *resources)
 +struct pci_bus *pci_scan_root_bus_msi(struct device *parent, int bus,
 +              struct pci_ops *ops, void *sysdata,
 +              struct list_head *resources, struct msi_controller *msi)
  {
        struct resource_entry *window;
        bool found = false;
        if (!b)
                return NULL;
  
 +      b->msi = msi;
 +
        if (!found) {
                dev_info(&b->dev,
                 "No busn resource found for root bus, will use [bus %02x-ff]\n",
  
        return b;
  }
 +
 +struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
 +              struct pci_ops *ops, void *sysdata, struct list_head *resources)
 +{
 +      return pci_scan_root_bus_msi(parent, bus, ops, sysdata, resources,
 +                                   NULL);
 +}
  EXPORT_SYMBOL(pci_scan_root_bus);
  
  struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
index a4d8c043a7106907259c3deb78c36fbb9b631b47,48394845976501ea7b137e2f6794627997ad20d5..bdfb3c84c3cb43a652dcb36fb449758807f58fa4
@@@ -453,8 -453,8 +453,8 @@@ static void periph_interrupt(struct spm
  
  static void pmic_arb_chained_irq(unsigned int irq, struct irq_desc *desc)
  {
-       struct spmi_pmic_arb_dev *pa = irq_get_handler_data(irq);
-       struct irq_chip *chip = irq_get_chip(irq);
+       struct spmi_pmic_arb_dev *pa = irq_desc_get_handler_data(desc);
+       struct irq_chip *chip = irq_desc_get_chip(desc);
        void __iomem *intr = pa->intr;
        int first = pa->min_apid >> 5;
        int last = pa->max_apid >> 5;
@@@ -575,22 -575,6 +575,22 @@@ static int qpnpint_irq_set_type(struct 
        return 0;
  }
  
 +static int qpnpint_get_irqchip_state(struct irq_data *d,
 +                                   enum irqchip_irq_state which,
 +                                   bool *state)
 +{
 +      u8 irq = d->hwirq >> 8;
 +      u8 status = 0;
 +
 +      if (which != IRQCHIP_STATE_LINE_LEVEL)
 +              return -EINVAL;
 +
 +      qpnpint_spmi_read(d, QPNPINT_REG_RT_STS, &status, 1);
 +      *state = !!(status & BIT(irq));
 +
 +      return 0;
 +}
 +
  static struct irq_chip pmic_arb_irqchip = {
        .name           = "pmic_arb",
        .irq_enable     = qpnpint_irq_enable,
        .irq_mask       = qpnpint_irq_mask,
        .irq_unmask     = qpnpint_irq_unmask,
        .irq_set_type   = qpnpint_irq_set_type,
 +      .irq_get_irqchip_state  = qpnpint_get_irqchip_state,
        .flags          = IRQCHIP_MASK_ON_SUSPEND
                        | IRQCHIP_SKIP_SET_WAKE,
  };
@@@ -945,8 -928,7 +945,7 @@@ static int spmi_pmic_arb_probe(struct p
                goto err_put_ctrl;
        }
  
-       irq_set_handler_data(pa->irq, pa);
-       irq_set_chained_handler(pa->irq, pmic_arb_chained_irq);
+       irq_set_chained_handler_and_data(pa->irq, pmic_arb_chained_irq, pa);
  
        err = spmi_controller_add(ctrl);
        if (err)
        return 0;
  
  err_domain_remove:
-       irq_set_chained_handler(pa->irq, NULL);
-       irq_set_handler_data(pa->irq, NULL);
+       irq_set_chained_handler_and_data(pa->irq, NULL, NULL);
        irq_domain_remove(pa->domain);
  err_put_ctrl:
        spmi_controller_put(ctrl);
@@@ -968,8 -949,7 +966,7 @@@ static int spmi_pmic_arb_remove(struct 
        struct spmi_controller *ctrl = platform_get_drvdata(pdev);
        struct spmi_pmic_arb_dev *pa = spmi_controller_get_drvdata(ctrl);
        spmi_controller_remove(ctrl);
-       irq_set_chained_handler(pa->irq, NULL);
-       irq_set_handler_data(pa->irq, NULL);
+       irq_set_chained_handler_and_data(pa->irq, NULL, NULL);
        irq_domain_remove(pa->domain);
        spmi_controller_put(ctrl);
        return 0;
diff --combined include/linux/device.h
index 1225f98e9240226ff7685190aef463b8d640a6e0,50e000576d3cb0c3a19d28adb1a70191170856ee..49fdcc4b8adff4e7482f243d459afed09c91b2d4
@@@ -341,7 -341,7 +341,7 @@@ struct subsys_interface 
        struct bus_type *subsys;
        struct list_head node;
        int (*add_dev)(struct device *dev, struct subsys_interface *sif);
 -      int (*remove_dev)(struct device *dev, struct subsys_interface *sif);
 +      void (*remove_dev)(struct device *dev, struct subsys_interface *sif);
  };
  
  int subsys_interface_register(struct subsys_interface *sif);
@@@ -714,6 -714,8 +714,8 @@@ struct device_dma_parameters 
   *            along with subsystem-level and driver-level callbacks.
   * @pins:     For device pin management.
   *            See Documentation/pinctrl.txt for details.
+  * @msi_list: Hosts MSI descriptors
+  * @msi_domain: The generic MSI domain this device is using.
   * @numa_node:        NUMA node this device is close to.
   * @dma_mask: Dma mask (if dma'ble device).
   * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all
@@@ -774,9 -776,15 +776,15 @@@ struct device 
        struct dev_pm_info      power;
        struct dev_pm_domain    *pm_domain;
  
+ #ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN
+       struct irq_domain       *msi_domain;
+ #endif
  #ifdef CONFIG_PINCTRL
        struct dev_pin_info     *pins;
  #endif
+ #ifdef CONFIG_GENERIC_MSI_IRQ
+       struct list_head        msi_list;
+ #endif
  
  #ifdef CONFIG_NUMA
        int             numa_node;      /* NUMA node this device is close to */
@@@ -861,6 -869,22 +869,22 @@@ static inline void set_dev_node(struct 
  }
  #endif
  
+ static inline struct irq_domain *dev_get_msi_domain(const struct device *dev)
+ {
+ #ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN
+       return dev->msi_domain;
+ #else
+       return NULL;
+ #endif
+ }
+ static inline void dev_set_msi_domain(struct device *dev, struct irq_domain *d)
+ {
+ #ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN
+       dev->msi_domain = d;
+ #endif
+ }
  static inline void *dev_get_drvdata(const struct device *dev)
  {
        return dev->driver_data;
diff --combined include/linux/irq.h
index 51744bcf74eec7bee678b9e1f63c3a10f247350e,2c8730a108be2777a7471b883cb062e548b623b1..6f8b340664421bb797fd37488bbd2c97afb6d3d4
@@@ -324,8 -324,10 +324,10 @@@ static inline irq_hw_number_t irqd_to_h
   * @irq_bus_sync_unlock:function to sync and unlock slow bus (i2c) chips
   * @irq_cpu_online:   configure an interrupt source for a secondary CPU
   * @irq_cpu_offline:  un-configure an interrupt source for a secondary CPU
-  * @irq_suspend:      function called from core code on suspend once per chip
-  * @irq_resume:               function called from core code on resume once per chip
+  * @irq_suspend:      function called from core code on suspend once per
+  *                    chip, when one or more interrupts are installed
+  * @irq_resume:               function called from core code on resume once per chip,
+  *                    when one ore more interrupts are installed
   * @irq_pm_shutdown:  function called from core code on shutdown once per chip
   * @irq_calc_mask:    Optional function to set irq_data.mask for special cases
   * @irq_print_chip:   optional to print special chip info in show_interrupts
@@@ -484,12 -486,10 +486,11 @@@ extern int irq_chip_set_affinity_parent
  extern int irq_chip_set_wake_parent(struct irq_data *data, unsigned int on);
  extern int irq_chip_set_vcpu_affinity_parent(struct irq_data *data,
                                             void *vcpu_info);
 +extern int irq_chip_set_type_parent(struct irq_data *data, unsigned int type);
  #endif
  
  /* Handling of unhandled and spurious interrupts: */
- extern void note_interrupt(unsigned int irq, struct irq_desc *desc,
-                          irqreturn_t action_ret);
+ extern void note_interrupt(struct irq_desc *desc, irqreturn_t action_ret);
  
  
  /* Enable/disable irq debugging output: */
@@@ -640,7 -640,7 +641,7 @@@ static inline struct msi_desc *irq_get_
        return d ? d->msi_desc : NULL;
  }
  
- static inline struct msi_desc *irq_data_get_msi(struct irq_data *d)
+ static inline struct msi_desc *irq_data_get_msi_desc(struct irq_data *d)
  {
        return d->msi_desc;
  }
@@@ -762,6 -762,12 +763,12 @@@ struct irq_chip_type 
   * @reg_base:         Register base address (virtual)
   * @reg_readl:                Alternate I/O accessor (defaults to readl if NULL)
   * @reg_writel:               Alternate I/O accessor (defaults to writel if NULL)
+  * @suspend:          Function called from core code on suspend once per
+  *                    chip; can be useful instead of irq_chip::suspend to
+  *                    handle chip details even when no interrupts are in use
+  * @resume:           Function called from core code on resume once per chip;
+  *                    can be useful instead of irq_chip::suspend to handle
+  *                    chip details even when no interrupts are in use
   * @irq_base:         Interrupt base nr for this chip
   * @irq_cnt:          Number of interrupts handled by this chip
   * @mask_cache:               Cached mask register shared between all chip types
@@@ -788,6 -794,8 +795,8 @@@ struct irq_chip_generic 
        void __iomem            *reg_base;
        u32                     (*reg_readl)(void __iomem *addr);
        void                    (*reg_writel)(u32 val, void __iomem *addr);
+       void                    (*suspend)(struct irq_chip_generic *gc);
+       void                    (*resume)(struct irq_chip_generic *gc);
        unsigned int            irq_base;
        unsigned int            irq_cnt;
        u32                     mask_cache;
diff --combined include/linux/pci.h
index 4fee9cd7a7df948d59f29b89f18b24f6db4c14a6,772616d3b184945542163da3272a88c8af3c205d..1a64733c48c741dff6d8bdfc34588c8c8f72f7fd
@@@ -180,8 -180,6 +180,8 @@@ enum pci_dev_flags 
        PCI_DEV_FLAGS_NO_BUS_RESET = (__force pci_dev_flags_t) (1 << 6),
        /* Do not use PM reset even if device advertises NoSoftRst- */
        PCI_DEV_FLAGS_NO_PM_RESET = (__force pci_dev_flags_t) (1 << 7),
 +      /* Get VPD from function 0 VPD */
 +      PCI_DEV_FLAGS_VPD_REF_F0 = (__force pci_dev_flags_t) (1 << 8),
  };
  
  enum pci_irq_reroute_variant {
@@@ -345,7 -343,6 +345,7 @@@ struct pci_dev 
        unsigned int    msi_enabled:1;
        unsigned int    msix_enabled:1;
        unsigned int    ari_enabled:1;  /* ARI forwarding */
 +      unsigned int    ats_enabled:1;  /* Address Translation Service */
        unsigned int    is_managed:1;
        unsigned int    needs_freset:1; /* Dev requires fundamental reset */
        unsigned int    state_saved:1;
        struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */
        struct bin_attribute *res_attr_wc[DEVICE_COUNT_RESOURCE]; /* sysfs file for WC mapping of resources */
  #ifdef CONFIG_PCI_MSI
-       struct list_head msi_list;
        const struct attribute_group **msi_irq_groups;
  #endif
        struct pci_vpd *vpd;
                struct pci_sriov *sriov;        /* SR-IOV capability related */
                struct pci_dev *physfn; /* the PF this VF is associated with */
        };
 -      struct pci_ats  *ats;   /* Address Translation Service */
 +      u16             ats_cap;        /* ATS Capability offset */
 +      u8              ats_stu;        /* ATS Smallest Translation Unit */
 +      atomic_t        ats_ref_cnt;    /* number of VFs with ATS enabled */
  #endif
        phys_addr_t rom; /* Physical address of ROM if it's not from the BAR */
        size_t romlen; /* Length of ROM if it's not from the BAR */
@@@ -451,8 -445,7 +450,8 @@@ struct pci_bus 
        struct list_head children;      /* list of child buses */
        struct list_head devices;       /* list of devices on this bus */
        struct pci_dev  *self;          /* bridge device as seen by parent */
 -      struct list_head slots;         /* list of slots on this bus */
 +      struct list_head slots;         /* list of slots on this bus;
 +                                         protected by pci_slot_mutex */
        struct resource *resource[PCI_BRIDGE_RESOURCE_NUM];
        struct list_head resources;     /* address space routed to this bus */
        struct resource busn_res;       /* bus numbers routed to this bus */
@@@ -744,11 -737,10 +743,11 @@@ struct pci_driver 
  void pcie_bus_configure_settings(struct pci_bus *bus);
  
  enum pcie_bus_config_types {
 -      PCIE_BUS_TUNE_OFF,
 -      PCIE_BUS_SAFE,
 -      PCIE_BUS_PERFORMANCE,
 -      PCIE_BUS_PEER2PEER,
 +      PCIE_BUS_TUNE_OFF,      /* don't touch MPS at all */
 +      PCIE_BUS_DEFAULT,       /* ensure MPS matches upstream bridge */
 +      PCIE_BUS_SAFE,          /* use largest MPS boot-time devices support */
 +      PCIE_BUS_PERFORMANCE,   /* use MPS and MRRS for best performance */
 +      PCIE_BUS_PEER2PEER,     /* set MPS = 128 for all devices */
  };
  
  extern enum pcie_bus_config_types pcie_bus_config;
@@@ -794,10 -786,6 +793,10 @@@ struct pci_bus *pci_create_root_bus(str
  int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax);
  int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax);
  void pci_bus_release_busn_res(struct pci_bus *b);
 +struct pci_bus *pci_scan_root_bus_msi(struct device *parent, int bus,
 +                                    struct pci_ops *ops, void *sysdata,
 +                                    struct list_head *resources,
 +                                    struct msi_controller *msi);
  struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
                                             struct pci_ops *ops, void *sysdata,
                                             struct list_head *resources);
@@@ -808,11 -796,6 +807,11 @@@ struct pci_slot *pci_create_slot(struc
                                 const char *name,
                                 struct hotplug_slot *hotplug);
  void pci_destroy_slot(struct pci_slot *slot);
 +#ifdef CONFIG_SYSFS
 +void pci_dev_assign_slot(struct pci_dev *dev);
 +#else
 +static inline void pci_dev_assign_slot(struct pci_dev *dev) { }
 +#endif
  int pci_scan_slot(struct pci_bus *bus, int devfn);
  struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn);
  void pci_device_add(struct pci_dev *dev, struct pci_bus *bus);
@@@ -979,23 -962,6 +978,23 @@@ static inline int pci_is_managed(struc
        return pdev->is_managed;
  }
  
 +static inline void pci_set_managed_irq(struct pci_dev *pdev, unsigned int irq)
 +{
 +      pdev->irq = irq;
 +      pdev->irq_managed = 1;
 +}
 +
 +static inline void pci_reset_managed_irq(struct pci_dev *pdev)
 +{
 +      pdev->irq = 0;
 +      pdev->irq_managed = 0;
 +}
 +
 +static inline bool pci_has_managed_irq(struct pci_dev *pdev)
 +{
 +      return pdev->irq_managed && pdev->irq > 0;
 +}
 +
  void pci_disable_device(struct pci_dev *dev);
  
  extern unsigned int pcibios_max_latency;
@@@ -1235,7 -1201,6 +1234,7 @@@ struct msix_entry 
        u16     entry;  /* driver uses to specify entry, OS writes */
  };
  
 +void pci_msi_setup_pci_dev(struct pci_dev *dev);
  
  #ifdef CONFIG_PCI_MSI
  int pci_msi_vec_count(struct pci_dev *dev);
@@@ -1328,19 -1293,6 +1327,19 @@@ int  ht_create_irq(struct pci_dev *dev
  void ht_destroy_irq(unsigned int irq);
  #endif /* CONFIG_HT_IRQ */
  
 +#ifdef CONFIG_PCI_ATS
 +/* Address Translation Service */
 +void pci_ats_init(struct pci_dev *dev);
 +int pci_enable_ats(struct pci_dev *dev, int ps);
 +void pci_disable_ats(struct pci_dev *dev);
 +int pci_ats_queue_depth(struct pci_dev *dev);
 +#else
 +static inline void pci_ats_init(struct pci_dev *d) { }
 +static inline int pci_enable_ats(struct pci_dev *d, int ps) { return -ENODEV; }
 +static inline void pci_disable_ats(struct pci_dev *d) { }
 +static inline int pci_ats_queue_depth(struct pci_dev *d) { return -ENODEV; }
 +#endif
 +
  void pci_cfg_access_lock(struct pci_dev *dev);
  bool pci_cfg_access_trylock(struct pci_dev *dev);
  void pci_cfg_access_unlock(struct pci_dev *dev);
@@@ -1692,8 -1644,6 +1691,8 @@@ int pcibios_set_pcie_reset_state(struc
  int pcibios_add_device(struct pci_dev *dev);
  void pcibios_release_device(struct pci_dev *dev);
  void pcibios_penalize_isa_irq(int irq, int active);
 +int pcibios_alloc_irq(struct pci_dev *dev);
 +void pcibios_free_irq(struct pci_dev *dev);
  
  #ifdef CONFIG_HIBERNATE_CALLBACKS
  extern struct dev_pm_ops pcibios_pm_ops;
@@@ -1710,7 -1660,6 +1709,7 @@@ static inline void pci_mmcfg_late_init(
  int pci_ext_cfg_avail(void);
  
  void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
 +void __iomem *pci_ioremap_wc_bar(struct pci_dev *pdev, int bar);
  
  #ifdef CONFIG_PCI_IOV
  int pci_iov_virtfn_bus(struct pci_dev *dev, int id);
@@@ -1892,10 -1841,12 +1891,12 @@@ int pci_vpd_find_info_keyword(const u8 
  /* PCI <-> OF binding helpers */
  #ifdef CONFIG_OF
  struct device_node;
+ struct irq_domain;
  void pci_set_of_node(struct pci_dev *dev);
  void pci_release_of_node(struct pci_dev *dev);
  void pci_set_bus_of_node(struct pci_bus *bus);
  void pci_release_bus_of_node(struct pci_bus *bus);
+ struct irq_domain *pci_host_bridge_of_msi_domain(struct pci_bus *bus);
  
  /* Arch may override this (weak) */
  struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus);
@@@ -1918,6 -1869,8 +1919,8 @@@ static inline void pci_set_bus_of_node(
  static inline void pci_release_bus_of_node(struct pci_bus *bus) { }
  static inline struct device_node *
  pci_device_to_OF_node(const struct pci_dev *pdev) { return NULL; }
+ static inline struct irq_domain *
+ pci_host_bridge_of_msi_domain(struct pci_bus *bus) { return NULL; }
  #endif  /* CONFIG_OF */
  
  #ifdef CONFIG_EEH
diff --combined kernel/irq/chip.c
index ae216824e8ca9224c4b76f225ef58d664a3e1726,09304a6533531cb53934e8f02bf2593156b70a89..6e40a9539763f48efc695c2b780a29f61b760f9f
@@@ -63,7 -63,7 +63,7 @@@ int irq_set_irq_type(unsigned int irq, 
                return -EINVAL;
  
        type &= IRQ_TYPE_SENSE_MASK;
-       ret = __irq_set_trigger(desc, irq, type);
+       ret = __irq_set_trigger(desc, type);
        irq_put_desc_busunlock(desc, flags);
        return ret;
  }
@@@ -187,7 -187,7 +187,7 @@@ int irq_startup(struct irq_desc *desc, 
                irq_enable(desc);
        }
        if (resend)
-               check_irq_resend(desc, desc->irq_data.irq);
+               check_irq_resend(desc);
        return ret;
  }
  
@@@ -315,7 -315,7 +315,7 @@@ void handle_nested_irq(unsigned int irq
        raw_spin_lock_irq(&desc->lock);
  
        desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
-       kstat_incr_irqs_this_cpu(irq, desc);
+       kstat_incr_irqs_this_cpu(desc);
  
        action = desc->action;
        if (unlikely(!action || irqd_irq_disabled(&desc->irq_data))) {
  
        action_ret = action->thread_fn(action->irq, action->dev_id);
        if (!noirqdebug)
-               note_interrupt(irq, desc, action_ret);
+               note_interrupt(desc, action_ret);
  
        raw_spin_lock_irq(&desc->lock);
        irqd_clear(&desc->irq_data, IRQD_IRQ_INPROGRESS);
@@@ -391,7 -391,7 +391,7 @@@ handle_simple_irq(unsigned int irq, str
                goto out_unlock;
  
        desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
-       kstat_incr_irqs_this_cpu(irq, desc);
+       kstat_incr_irqs_this_cpu(desc);
  
        if (unlikely(!desc->action || irqd_irq_disabled(&desc->irq_data))) {
                desc->istate |= IRQS_PENDING;
@@@ -443,7 -443,7 +443,7 @@@ handle_level_irq(unsigned int irq, stru
                goto out_unlock;
  
        desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
-       kstat_incr_irqs_this_cpu(irq, desc);
+       kstat_incr_irqs_this_cpu(desc);
  
        /*
         * If its disabled or no action available
@@@ -515,7 -515,7 +515,7 @@@ handle_fasteoi_irq(unsigned int irq, st
                goto out;
  
        desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
-       kstat_incr_irqs_this_cpu(irq, desc);
+       kstat_incr_irqs_this_cpu(desc);
  
        /*
         * If its disabled or no action available
@@@ -583,7 -583,7 +583,7 @@@ handle_edge_irq(unsigned int irq, struc
                goto out_unlock;
        }
  
-       kstat_incr_irqs_this_cpu(irq, desc);
+       kstat_incr_irqs_this_cpu(desc);
  
        /* Start handling the irq */
        desc->irq_data.chip->irq_ack(&desc->irq_data);
@@@ -646,7 -646,7 +646,7 @@@ void handle_edge_eoi_irq(unsigned int i
                goto out_eoi;
        }
  
-       kstat_incr_irqs_this_cpu(irq, desc);
+       kstat_incr_irqs_this_cpu(desc);
  
        do {
                if (unlikely(!desc->action))
@@@ -675,7 -675,7 +675,7 @@@ handle_percpu_irq(unsigned int irq, str
  {
        struct irq_chip *chip = irq_desc_get_chip(desc);
  
-       kstat_incr_irqs_this_cpu(irq, desc);
+       kstat_incr_irqs_this_cpu(desc);
  
        if (chip->irq_ack)
                chip->irq_ack(&desc->irq_data);
@@@ -705,7 -705,7 +705,7 @@@ void handle_percpu_devid_irq(unsigned i
        void *dev_id = raw_cpu_ptr(action->percpu_dev_id);
        irqreturn_t res;
  
-       kstat_incr_irqs_this_cpu(irq, desc);
+       kstat_incr_irqs_this_cpu(desc);
  
        if (chip->irq_ack)
                chip->irq_ack(&desc->irq_data);
@@@ -984,23 -984,6 +984,23 @@@ int irq_chip_set_affinity_parent(struc
        return -ENOSYS;
  }
  
 +/**
 + * irq_chip_set_type_parent - Set IRQ type on the parent interrupt
 + * @data:     Pointer to interrupt specific data
 + * @type:     IRQ_TYPE_{LEVEL,EDGE}_* value - see include/linux/irq.h
 + *
 + * Conditional, as the underlying parent chip might not implement it.
 + */
 +int irq_chip_set_type_parent(struct irq_data *data, unsigned int type)
 +{
 +      data = data->parent_data;
 +
 +      if (data->chip->irq_set_type)
 +              return data->chip->irq_set_type(data, type);
 +
 +      return -ENOSYS;
 +}
 +
  /**
   * irq_chip_retrigger_hierarchy - Retrigger an interrupt in hardware
   * @data:     Pointer to interrupt specific data
@@@ -1014,13 -997,13 +1014,13 @@@ int irq_chip_retrigger_hierarchy(struc
                if (data->chip && data->chip->irq_retrigger)
                        return data->chip->irq_retrigger(data);
  
 -      return -ENOSYS;
 +      return 0;
  }
  
  /**
   * irq_chip_set_vcpu_affinity_parent - Set vcpu affinity on the parent interrupt
   * @data:     Pointer to interrupt specific data
-  * @dest:     The vcpu affinity information
+  * @vcpu_info:        The vcpu affinity information
   */
  int irq_chip_set_vcpu_affinity_parent(struct irq_data *data, void *vcpu_info)
  {