162306a36Sopenharmony_ci* Freescale MSI interrupt controller
262306a36Sopenharmony_ci
362306a36Sopenharmony_ciRequired properties:
462306a36Sopenharmony_ci- compatible : compatible list, may contain one or two entries
562306a36Sopenharmony_ci  The first is "fsl,CHIP-msi", where CHIP is the processor(mpc8610, mpc8572,
662306a36Sopenharmony_ci  etc.) and the second is "fsl,mpic-msi" or "fsl,ipic-msi" or
762306a36Sopenharmony_ci  "fsl,mpic-msi-v4.3" depending on the parent type and version. If mpic
862306a36Sopenharmony_ci  version is 4.3, the number of MSI registers is increased to 16, MSIIR1 is
962306a36Sopenharmony_ci  provided to access these 16 registers, and compatible "fsl,mpic-msi-v4.3"
1062306a36Sopenharmony_ci  should be used. The first entry is optional; the second entry is
1162306a36Sopenharmony_ci  required.
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci- reg : It may contain one or two regions. The first region should contain
1462306a36Sopenharmony_ci  the address and the length of the shared message interrupt register set.
1562306a36Sopenharmony_ci  The second region should contain the address of aliased MSIIR or MSIIR1
1662306a36Sopenharmony_ci  register for platforms that have such an alias, if using MSIIR1, the second
1762306a36Sopenharmony_ci  region must be added because different MSI group has different MSIIR1 offset.
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci- interrupts : each one of the interrupts here is one entry per 32 MSIs,
2062306a36Sopenharmony_ci  and routed to the host interrupt controller. the interrupts should
2162306a36Sopenharmony_ci  be set as edge sensitive.  If msi-available-ranges is present, only
2262306a36Sopenharmony_ci  the interrupts that correspond to available ranges shall be present.
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ciOptional properties:
2562306a36Sopenharmony_ci- msi-available-ranges: use <start count> style section to define which
2662306a36Sopenharmony_ci  msi interrupt can be used in the 256 msi interrupts. This property is
2762306a36Sopenharmony_ci  optional, without this, all the MSI interrupts can be used.
2862306a36Sopenharmony_ci  Each available range must begin and end on a multiple of 32 (i.e.
2962306a36Sopenharmony_ci  no splitting an individual MSI register or the associated PIC interrupt).
3062306a36Sopenharmony_ci  MPIC v4.3 does not support this property because the 32 interrupts of an
3162306a36Sopenharmony_ci  individual register are not continuous when using MSIIR1.
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci- msi-address-64: 64-bit PCI address of the MSIIR register. The MSIIR register
3462306a36Sopenharmony_ci  is used for MSI messaging.  The address of MSIIR in PCI address space is
3562306a36Sopenharmony_ci  the MSI message address.
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci  This property may be used in virtualized environments where the hypervisor
3862306a36Sopenharmony_ci  has created an alternate mapping for the MSIR block.  See below for an
3962306a36Sopenharmony_ci  explanation.
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ciExample:
4362306a36Sopenharmony_ci	msi@41600 {
4462306a36Sopenharmony_ci		compatible = "fsl,mpc8610-msi", "fsl,mpic-msi";
4562306a36Sopenharmony_ci		reg = <0x41600 0x80>;
4662306a36Sopenharmony_ci		msi-available-ranges = <0 0x100>;
4762306a36Sopenharmony_ci		interrupts = <
4862306a36Sopenharmony_ci			0xe0 0
4962306a36Sopenharmony_ci			0xe1 0
5062306a36Sopenharmony_ci			0xe2 0
5162306a36Sopenharmony_ci			0xe3 0
5262306a36Sopenharmony_ci			0xe4 0
5362306a36Sopenharmony_ci			0xe5 0
5462306a36Sopenharmony_ci			0xe6 0
5562306a36Sopenharmony_ci			0xe7 0>;
5662306a36Sopenharmony_ci		interrupt-parent = <&mpic>;
5762306a36Sopenharmony_ci	};
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci	msi@41600 {
6062306a36Sopenharmony_ci		compatible = "fsl,mpic-msi-v4.3";
6162306a36Sopenharmony_ci		reg = <0x41600 0x200 0x44148 4>;
6262306a36Sopenharmony_ci		interrupts = <
6362306a36Sopenharmony_ci			0xe0 0 0 0
6462306a36Sopenharmony_ci			0xe1 0 0 0
6562306a36Sopenharmony_ci			0xe2 0 0 0
6662306a36Sopenharmony_ci			0xe3 0 0 0
6762306a36Sopenharmony_ci			0xe4 0 0 0
6862306a36Sopenharmony_ci			0xe5 0 0 0
6962306a36Sopenharmony_ci			0xe6 0 0 0
7062306a36Sopenharmony_ci			0xe7 0 0 0
7162306a36Sopenharmony_ci			0x100 0 0 0
7262306a36Sopenharmony_ci			0x101 0 0 0
7362306a36Sopenharmony_ci			0x102 0 0 0
7462306a36Sopenharmony_ci			0x103 0 0 0
7562306a36Sopenharmony_ci			0x104 0 0 0
7662306a36Sopenharmony_ci			0x105 0 0 0
7762306a36Sopenharmony_ci			0x106 0 0 0
7862306a36Sopenharmony_ci			0x107 0 0 0>;
7962306a36Sopenharmony_ci	};
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ciThe Freescale hypervisor and msi-address-64
8262306a36Sopenharmony_ci-------------------------------------------
8362306a36Sopenharmony_ciNormally, PCI devices have access to all of CCSR via an ATMU mapping.  The
8462306a36Sopenharmony_ciFreescale MSI driver calculates the address of MSIIR (in the MSI register
8562306a36Sopenharmony_ciblock) and sets that address as the MSI message address.
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ciIn a virtualized environment, the hypervisor may need to create an IOMMU
8862306a36Sopenharmony_cimapping for MSIIR.  The Freescale ePAPR hypervisor has this requirement
8962306a36Sopenharmony_cibecause of hardware limitations of the Peripheral Access Management Unit
9062306a36Sopenharmony_ci(PAMU), which is currently the only IOMMU that the hypervisor supports.
9162306a36Sopenharmony_ciThe ATMU is programmed with the guest physical address, and the PAMU
9262306a36Sopenharmony_ciintercepts transactions and reroutes them to the true physical address.
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ciIn the PAMU, each PCI controller is given only one primary window.  The
9562306a36Sopenharmony_ciPAMU restricts DMA operations so that they can only occur within a window.
9662306a36Sopenharmony_ciBecause PCI devices must be able to DMA to memory, the primary window must
9762306a36Sopenharmony_cibe used to cover all of the guest's memory space.
9862306a36Sopenharmony_ci
9962306a36Sopenharmony_ciPAMU primary windows can be divided into 256 subwindows, and each
10062306a36Sopenharmony_cisubwindow can have its own address mapping ("guest physical" to "true
10162306a36Sopenharmony_ciphysical").  However, each subwindow has to have the same alignment, which
10262306a36Sopenharmony_cimeans they cannot be located at just any address.  Because of these
10362306a36Sopenharmony_cirestrictions, it is usually impossible to create a 4KB subwindow that
10462306a36Sopenharmony_cicovers MSIIR where it's normally located.
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ciTherefore, the hypervisor has to create a subwindow inside the same
10762306a36Sopenharmony_ciprimary window used for memory, but mapped to the MSIR block (where MSIIR
10862306a36Sopenharmony_cilives).  The first subwindow after the end of guest memory is used for
10962306a36Sopenharmony_cithis.  The address specified in the msi-address-64 property is the PCI
11062306a36Sopenharmony_ciaddress of MSIIR.  The hypervisor configures the PAMU to map that address to
11162306a36Sopenharmony_cithe true physical address of MSIIR.
112