18c2ecf20Sopenharmony_ci* Freescale MSI interrupt controller
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ciRequired properties:
48c2ecf20Sopenharmony_ci- compatible : compatible list, may contain one or two entries
58c2ecf20Sopenharmony_ci  The first is "fsl,CHIP-msi", where CHIP is the processor(mpc8610, mpc8572,
68c2ecf20Sopenharmony_ci  etc.) and the second is "fsl,mpic-msi" or "fsl,ipic-msi" or
78c2ecf20Sopenharmony_ci  "fsl,mpic-msi-v4.3" depending on the parent type and version. If mpic
88c2ecf20Sopenharmony_ci  version is 4.3, the number of MSI registers is increased to 16, MSIIR1 is
98c2ecf20Sopenharmony_ci  provided to access these 16 registers, and compatible "fsl,mpic-msi-v4.3"
108c2ecf20Sopenharmony_ci  should be used. The first entry is optional; the second entry is
118c2ecf20Sopenharmony_ci  required.
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci- reg : It may contain one or two regions. The first region should contain
148c2ecf20Sopenharmony_ci  the address and the length of the shared message interrupt register set.
158c2ecf20Sopenharmony_ci  The second region should contain the address of aliased MSIIR or MSIIR1
168c2ecf20Sopenharmony_ci  register for platforms that have such an alias, if using MSIIR1, the second
178c2ecf20Sopenharmony_ci  region must be added because different MSI group has different MSIIR1 offset.
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci- interrupts : each one of the interrupts here is one entry per 32 MSIs,
208c2ecf20Sopenharmony_ci  and routed to the host interrupt controller. the interrupts should
218c2ecf20Sopenharmony_ci  be set as edge sensitive.  If msi-available-ranges is present, only
228c2ecf20Sopenharmony_ci  the interrupts that correspond to available ranges shall be present.
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ciOptional properties:
258c2ecf20Sopenharmony_ci- msi-available-ranges: use <start count> style section to define which
268c2ecf20Sopenharmony_ci  msi interrupt can be used in the 256 msi interrupts. This property is
278c2ecf20Sopenharmony_ci  optional, without this, all the MSI interrupts can be used.
288c2ecf20Sopenharmony_ci  Each available range must begin and end on a multiple of 32 (i.e.
298c2ecf20Sopenharmony_ci  no splitting an individual MSI register or the associated PIC interrupt).
308c2ecf20Sopenharmony_ci  MPIC v4.3 does not support this property because the 32 interrupts of an
318c2ecf20Sopenharmony_ci  individual register are not continuous when using MSIIR1.
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci- msi-address-64: 64-bit PCI address of the MSIIR register. The MSIIR register
348c2ecf20Sopenharmony_ci  is used for MSI messaging.  The address of MSIIR in PCI address space is
358c2ecf20Sopenharmony_ci  the MSI message address.
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci  This property may be used in virtualized environments where the hypervisor
388c2ecf20Sopenharmony_ci  has created an alternate mapping for the MSIR block.  See below for an
398c2ecf20Sopenharmony_ci  explanation.
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ciExample:
438c2ecf20Sopenharmony_ci	msi@41600 {
448c2ecf20Sopenharmony_ci		compatible = "fsl,mpc8610-msi", "fsl,mpic-msi";
458c2ecf20Sopenharmony_ci		reg = <0x41600 0x80>;
468c2ecf20Sopenharmony_ci		msi-available-ranges = <0 0x100>;
478c2ecf20Sopenharmony_ci		interrupts = <
488c2ecf20Sopenharmony_ci			0xe0 0
498c2ecf20Sopenharmony_ci			0xe1 0
508c2ecf20Sopenharmony_ci			0xe2 0
518c2ecf20Sopenharmony_ci			0xe3 0
528c2ecf20Sopenharmony_ci			0xe4 0
538c2ecf20Sopenharmony_ci			0xe5 0
548c2ecf20Sopenharmony_ci			0xe6 0
558c2ecf20Sopenharmony_ci			0xe7 0>;
568c2ecf20Sopenharmony_ci		interrupt-parent = <&mpic>;
578c2ecf20Sopenharmony_ci	};
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci	msi@41600 {
608c2ecf20Sopenharmony_ci		compatible = "fsl,mpic-msi-v4.3";
618c2ecf20Sopenharmony_ci		reg = <0x41600 0x200 0x44148 4>;
628c2ecf20Sopenharmony_ci		interrupts = <
638c2ecf20Sopenharmony_ci			0xe0 0 0 0
648c2ecf20Sopenharmony_ci			0xe1 0 0 0
658c2ecf20Sopenharmony_ci			0xe2 0 0 0
668c2ecf20Sopenharmony_ci			0xe3 0 0 0
678c2ecf20Sopenharmony_ci			0xe4 0 0 0
688c2ecf20Sopenharmony_ci			0xe5 0 0 0
698c2ecf20Sopenharmony_ci			0xe6 0 0 0
708c2ecf20Sopenharmony_ci			0xe7 0 0 0
718c2ecf20Sopenharmony_ci			0x100 0 0 0
728c2ecf20Sopenharmony_ci			0x101 0 0 0
738c2ecf20Sopenharmony_ci			0x102 0 0 0
748c2ecf20Sopenharmony_ci			0x103 0 0 0
758c2ecf20Sopenharmony_ci			0x104 0 0 0
768c2ecf20Sopenharmony_ci			0x105 0 0 0
778c2ecf20Sopenharmony_ci			0x106 0 0 0
788c2ecf20Sopenharmony_ci			0x107 0 0 0>;
798c2ecf20Sopenharmony_ci	};
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ciThe Freescale hypervisor and msi-address-64
828c2ecf20Sopenharmony_ci-------------------------------------------
838c2ecf20Sopenharmony_ciNormally, PCI devices have access to all of CCSR via an ATMU mapping.  The
848c2ecf20Sopenharmony_ciFreescale MSI driver calculates the address of MSIIR (in the MSI register
858c2ecf20Sopenharmony_ciblock) and sets that address as the MSI message address.
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ciIn a virtualized environment, the hypervisor may need to create an IOMMU
888c2ecf20Sopenharmony_cimapping for MSIIR.  The Freescale ePAPR hypervisor has this requirement
898c2ecf20Sopenharmony_cibecause of hardware limitations of the Peripheral Access Management Unit
908c2ecf20Sopenharmony_ci(PAMU), which is currently the only IOMMU that the hypervisor supports.
918c2ecf20Sopenharmony_ciThe ATMU is programmed with the guest physical address, and the PAMU
928c2ecf20Sopenharmony_ciintercepts transactions and reroutes them to the true physical address.
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ciIn the PAMU, each PCI controller is given only one primary window.  The
958c2ecf20Sopenharmony_ciPAMU restricts DMA operations so that they can only occur within a window.
968c2ecf20Sopenharmony_ciBecause PCI devices must be able to DMA to memory, the primary window must
978c2ecf20Sopenharmony_cibe used to cover all of the guest's memory space.
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ciPAMU primary windows can be divided into 256 subwindows, and each
1008c2ecf20Sopenharmony_cisubwindow can have its own address mapping ("guest physical" to "true
1018c2ecf20Sopenharmony_ciphysical").  However, each subwindow has to have the same alignment, which
1028c2ecf20Sopenharmony_cimeans they cannot be located at just any address.  Because of these
1038c2ecf20Sopenharmony_cirestrictions, it is usually impossible to create a 4KB subwindow that
1048c2ecf20Sopenharmony_cicovers MSIIR where it's normally located.
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ciTherefore, the hypervisor has to create a subwindow inside the same
1078c2ecf20Sopenharmony_ciprimary window used for memory, but mapped to the MSIR block (where MSIIR
1088c2ecf20Sopenharmony_cilives).  The first subwindow after the end of guest memory is used for
1098c2ecf20Sopenharmony_cithis.  The address specified in the msi-address-64 property is the PCI
1108c2ecf20Sopenharmony_ciaddress of MSIIR.  The hypervisor configures the PAMU to map that address to
1118c2ecf20Sopenharmony_cithe true physical address of MSIIR.
112