xref: /freebsd/sys/contrib/device-tree/Bindings/interrupt-controller/fsl,mpic-msi.yaml (revision 833e5d42ab135b0238e61c5b3c19b8619677cbfa)
1*833e5d42SEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2*833e5d42SEmmanuel Vadot%YAML 1.2
3*833e5d42SEmmanuel Vadot---
4*833e5d42SEmmanuel Vadot$id: http://devicetree.org/schemas/interrupt-controller/fsl,mpic-msi.yaml#
5*833e5d42SEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
6*833e5d42SEmmanuel Vadot
7*833e5d42SEmmanuel Vadottitle: Freescale MSI interrupt controller
8*833e5d42SEmmanuel Vadot
9*833e5d42SEmmanuel Vadotdescription: |
10*833e5d42SEmmanuel Vadot  The Freescale hypervisor and msi-address-64
11*833e5d42SEmmanuel Vadot  -------------------------------------------
12*833e5d42SEmmanuel Vadot
13*833e5d42SEmmanuel Vadot  Normally, PCI devices have access to all of CCSR via an ATMU mapping.  The
14*833e5d42SEmmanuel Vadot  Freescale MSI driver calculates the address of MSIIR (in the MSI register
15*833e5d42SEmmanuel Vadot  block) and sets that address as the MSI message address.
16*833e5d42SEmmanuel Vadot
17*833e5d42SEmmanuel Vadot  In a virtualized environment, the hypervisor may need to create an IOMMU
18*833e5d42SEmmanuel Vadot  mapping for MSIIR.  The Freescale ePAPR hypervisor has this requirement
19*833e5d42SEmmanuel Vadot  because of hardware limitations of the Peripheral Access Management Unit
20*833e5d42SEmmanuel Vadot  (PAMU), which is currently the only IOMMU that the hypervisor supports.
21*833e5d42SEmmanuel Vadot  The ATMU is programmed with the guest physical address, and the PAMU
22*833e5d42SEmmanuel Vadot  intercepts transactions and reroutes them to the true physical address.
23*833e5d42SEmmanuel Vadot
24*833e5d42SEmmanuel Vadot  In the PAMU, each PCI controller is given only one primary window.  The
25*833e5d42SEmmanuel Vadot  PAMU restricts DMA operations so that they can only occur within a window.
26*833e5d42SEmmanuel Vadot  Because PCI devices must be able to DMA to memory, the primary window must
27*833e5d42SEmmanuel Vadot  be used to cover all of the guest's memory space.
28*833e5d42SEmmanuel Vadot
29*833e5d42SEmmanuel Vadot  PAMU primary windows can be divided into 256 subwindows, and each
30*833e5d42SEmmanuel Vadot  subwindow can have its own address mapping ("guest physical" to "true
31*833e5d42SEmmanuel Vadot  physical").  However, each subwindow has to have the same alignment, which
32*833e5d42SEmmanuel Vadot  means they cannot be located at just any address.  Because of these
33*833e5d42SEmmanuel Vadot  restrictions, it is usually impossible to create a 4KB subwindow that
34*833e5d42SEmmanuel Vadot  covers MSIIR where it's normally located.
35*833e5d42SEmmanuel Vadot
36*833e5d42SEmmanuel Vadot  Therefore, the hypervisor has to create a subwindow inside the same
37*833e5d42SEmmanuel Vadot  primary window used for memory, but mapped to the MSIR block (where MSIIR
38*833e5d42SEmmanuel Vadot  lives).  The first subwindow after the end of guest memory is used for
39*833e5d42SEmmanuel Vadot  this.  The address specified in the msi-address-64 property is the PCI
40*833e5d42SEmmanuel Vadot  address of MSIIR.  The hypervisor configures the PAMU to map that address to
41*833e5d42SEmmanuel Vadot  the true physical address of MSIIR.
42*833e5d42SEmmanuel Vadot
43*833e5d42SEmmanuel Vadotmaintainers:
44*833e5d42SEmmanuel Vadot  - J. Neuschäfer <j.ne@posteo.net>
45*833e5d42SEmmanuel Vadot
46*833e5d42SEmmanuel Vadotproperties:
47*833e5d42SEmmanuel Vadot  compatible:
48*833e5d42SEmmanuel Vadot    oneOf:
49*833e5d42SEmmanuel Vadot      - enum:
50*833e5d42SEmmanuel Vadot          - fsl,mpic-msi
51*833e5d42SEmmanuel Vadot          - fsl,mpic-msi-v4.3
52*833e5d42SEmmanuel Vadot          - fsl,ipic-msi
53*833e5d42SEmmanuel Vadot          - fsl,vmpic-msi
54*833e5d42SEmmanuel Vadot          - fsl,vmpic-msi-v4.3
55*833e5d42SEmmanuel Vadot      - items:
56*833e5d42SEmmanuel Vadot          - enum:
57*833e5d42SEmmanuel Vadot              - fsl,mpc8572-msi
58*833e5d42SEmmanuel Vadot              - fsl,mpc8610-msi
59*833e5d42SEmmanuel Vadot              - fsl,mpc8641-msi
60*833e5d42SEmmanuel Vadot          - const: fsl,mpic-msi
61*833e5d42SEmmanuel Vadot
62*833e5d42SEmmanuel Vadot  reg:
63*833e5d42SEmmanuel Vadot    minItems: 1
64*833e5d42SEmmanuel Vadot    items:
65*833e5d42SEmmanuel Vadot      - description: Address and length of the shared message interrupt
66*833e5d42SEmmanuel Vadot          register set
67*833e5d42SEmmanuel Vadot      - description: Address of aliased MSIIR or MSIIR1 register for platforms
68*833e5d42SEmmanuel Vadot          that have such an alias. If using MSIIR1, the second region must be
69*833e5d42SEmmanuel Vadot          added because different MSI group has different MSIIR1 offset.
70*833e5d42SEmmanuel Vadot
71*833e5d42SEmmanuel Vadot  interrupts:
72*833e5d42SEmmanuel Vadot    minItems: 1
73*833e5d42SEmmanuel Vadot    maxItems: 16
74*833e5d42SEmmanuel Vadot    description:
75*833e5d42SEmmanuel Vadot      Each one of the interrupts here is one entry per 32 MSIs, and routed to
76*833e5d42SEmmanuel Vadot      the host interrupt controller. The interrupts should be set as edge
77*833e5d42SEmmanuel Vadot      sensitive. If msi-available-ranges is present, only the interrupts that
78*833e5d42SEmmanuel Vadot      correspond to available ranges shall be present.
79*833e5d42SEmmanuel Vadot
80*833e5d42SEmmanuel Vadot  msi-available-ranges:
81*833e5d42SEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32-matrix
82*833e5d42SEmmanuel Vadot    items:
83*833e5d42SEmmanuel Vadot      items:
84*833e5d42SEmmanuel Vadot        - description: First MSI interrupt in this range
85*833e5d42SEmmanuel Vadot        - description: Number of MSI interrupts in this range
86*833e5d42SEmmanuel Vadot    description:
87*833e5d42SEmmanuel Vadot      Define which MSI interrupt can be used in the 256 MSI interrupts.
88*833e5d42SEmmanuel Vadot      If not specified, all the MSI interrupts can be used.
89*833e5d42SEmmanuel Vadot      Each available range must begin and end on a multiple of 32 (i.e. no
90*833e5d42SEmmanuel Vadot      splitting an individual MSI register or the associated PIC interrupt).
91*833e5d42SEmmanuel Vadot
92*833e5d42SEmmanuel Vadot  msi-address-64:
93*833e5d42SEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint64
94*833e5d42SEmmanuel Vadot    description:
95*833e5d42SEmmanuel Vadot      64-bit PCI address of the MSIIR register. The MSIIR register is used for
96*833e5d42SEmmanuel Vadot      MSI messaging.  The address of MSIIR in PCI address space is the MSI
97*833e5d42SEmmanuel Vadot      message address.
98*833e5d42SEmmanuel Vadot
99*833e5d42SEmmanuel Vadot      This property may be used in virtualized environments where the hypervisor
100*833e5d42SEmmanuel Vadot      has created an alternate mapping for the MSIR block.  See the top-level
101*833e5d42SEmmanuel Vadot      description for an explanation.
102*833e5d42SEmmanuel Vadot
103*833e5d42SEmmanuel Vadotrequired:
104*833e5d42SEmmanuel Vadot  - compatible
105*833e5d42SEmmanuel Vadot  - reg
106*833e5d42SEmmanuel Vadot  - interrupts
107*833e5d42SEmmanuel Vadot
108*833e5d42SEmmanuel VadotallOf:
109*833e5d42SEmmanuel Vadot  - if:
110*833e5d42SEmmanuel Vadot      properties:
111*833e5d42SEmmanuel Vadot        compatible:
112*833e5d42SEmmanuel Vadot          contains:
113*833e5d42SEmmanuel Vadot            enum:
114*833e5d42SEmmanuel Vadot              - fsl,mpic-msi-v4.3
115*833e5d42SEmmanuel Vadot              - fsl,vmpic-msi-v4.3
116*833e5d42SEmmanuel Vadot    then:
117*833e5d42SEmmanuel Vadot      properties:
118*833e5d42SEmmanuel Vadot        interrupts:
119*833e5d42SEmmanuel Vadot          minItems: 16
120*833e5d42SEmmanuel Vadot          description:
121*833e5d42SEmmanuel Vadot            Version 4.3 implies that there are 16 shared interrupts, and they
122*833e5d42SEmmanuel Vadot            are configured through MSIIR1.
123*833e5d42SEmmanuel Vadot
124*833e5d42SEmmanuel Vadot        # MPIC v4.3 does not support this property because the 32 interrupts of
125*833e5d42SEmmanuel Vadot        # an individual register are not continuous when using MSIIR1.
126*833e5d42SEmmanuel Vadot        msi-available-ranges: false
127*833e5d42SEmmanuel Vadot
128*833e5d42SEmmanuel Vadot        reg:
129*833e5d42SEmmanuel Vadot          minItems: 2
130*833e5d42SEmmanuel Vadot
131*833e5d42SEmmanuel Vadot    else:
132*833e5d42SEmmanuel Vadot      properties:
133*833e5d42SEmmanuel Vadot        interrupts:
134*833e5d42SEmmanuel Vadot          maxItems: 8
135*833e5d42SEmmanuel Vadot          description:
136*833e5d42SEmmanuel Vadot            In versions before 4.3, only 8 shared interrupts are available, and
137*833e5d42SEmmanuel Vadot            they are configured through MSIIR.
138*833e5d42SEmmanuel Vadot
139*833e5d42SEmmanuel VadotunevaluatedProperties: false
140*833e5d42SEmmanuel Vadot
141*833e5d42SEmmanuel Vadotexamples:
142*833e5d42SEmmanuel Vadot  - |
143*833e5d42SEmmanuel Vadot    msi@41600 {
144*833e5d42SEmmanuel Vadot            compatible = "fsl,mpc8610-msi", "fsl,mpic-msi";
145*833e5d42SEmmanuel Vadot            reg = <0x41600 0x80>;
146*833e5d42SEmmanuel Vadot            msi-available-ranges = <0 0x100>;
147*833e5d42SEmmanuel Vadot            interrupts = <0xe0 0>, <0xe1 0>, <0xe2 0>, <0xe3 0>,
148*833e5d42SEmmanuel Vadot                         <0xe4 0>, <0xe5 0>, <0xe6 0>, <0xe7 0>;
149*833e5d42SEmmanuel Vadot    };
150*833e5d42SEmmanuel Vadot
151*833e5d42SEmmanuel Vadot  - |
152*833e5d42SEmmanuel Vadot    msi@41600 {
153*833e5d42SEmmanuel Vadot            compatible = "fsl,mpic-msi-v4.3";
154*833e5d42SEmmanuel Vadot            reg = <0x41600 0x200>, <0x44148 4>;
155*833e5d42SEmmanuel Vadot            interrupts = <0xe0 0 0 0>, <0xe1 0 0 0>, <0xe2 0 0 0>, <0xe3 0 0 0>,
156*833e5d42SEmmanuel Vadot                         <0xe4 0 0 0>, <0xe5 0 0 0>, <0xe6 0 0 0>, <0xe7 0 0 0>,
157*833e5d42SEmmanuel Vadot                         <0x100 0 0 0>, <0x101 0 0 0>, <0x102 0 0 0>, <0x103 0 0 0>,
158*833e5d42SEmmanuel Vadot                         <0x104 0 0 0>, <0x105 0 0 0>, <0x106 0 0 0>, <0x107 0 0 0>;
159*833e5d42SEmmanuel Vadot    };
160*833e5d42SEmmanuel Vadot
161*833e5d42SEmmanuel Vadot...
162