diff options
Diffstat (limited to 'recipes-extended/skmm-ep')
-rw-r--r-- | recipes-extended/skmm-ep/skmm-ep/add-two-missing-header-files.patch | 660 | ||||
-rw-r--r-- | recipes-extended/skmm-ep/skmm-ep_git.bb | 31 |
2 files changed, 691 insertions, 0 deletions
diff --git a/recipes-extended/skmm-ep/skmm-ep/add-two-missing-header-files.patch b/recipes-extended/skmm-ep/skmm-ep/add-two-missing-header-files.patch new file mode 100644 index 00000000..2a7bb9f2 --- /dev/null +++ b/recipes-extended/skmm-ep/skmm-ep/add-two-missing-header-files.patch | |||
@@ -0,0 +1,660 @@ | |||
1 | add two missing header files | ||
2 | |||
3 | Upstream-status: Pending | ||
4 | |||
5 | --- | ||
6 | include/linux/fsl_pci_ep_vfio.h | 79 ++++++ | ||
7 | include/linux/vfio.h | 555 ++++++++++++++++++++++++++++++++++++++++ | ||
8 | 2 files changed, 634 insertions(+) | ||
9 | create mode 100644 include/linux/fsl_pci_ep_vfio.h | ||
10 | create mode 100644 include/linux/vfio.h | ||
11 | |||
12 | diff --git a/include/linux/fsl_pci_ep_vfio.h b/include/linux/fsl_pci_ep_vfio.h | ||
13 | new file mode 100644 | ||
14 | index 0000000..8960157 | ||
15 | --- /dev/null | ||
16 | +++ b/include/linux/fsl_pci_ep_vfio.h | ||
17 | @@ -0,0 +1,79 @@ | ||
18 | +/* | ||
19 | + * Copyright 2013 Freescale Semiconductor, Inc. | ||
20 | + * | ||
21 | + * Author: Minghuan Lian <Minghuan.Lian@freescale.com> | ||
22 | + * | ||
23 | + * This program is free software; you can redistribute it and/or modify | ||
24 | + * it under the terms of the GNU General Public License, version 2, as | ||
25 | + * published by the Free Software Foundation. | ||
26 | + * | ||
27 | + * This program is distributed in the hope that it will be useful, | ||
28 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
29 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
30 | + * GNU General Public License for more details. | ||
31 | + * | ||
32 | + * You should have received a copy of the GNU General Public License | ||
33 | + * along with this program; if not, write to the Free Software | ||
34 | + * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
35 | + * | ||
36 | + */ | ||
37 | + | ||
38 | +#ifndef _FSL_PCI_EP_VFIO_H | ||
39 | +#define _FSL_PCI_EP_VFIO_H | ||
40 | + | ||
41 | +#include <linux/vfio.h> | ||
42 | + | ||
43 | +enum { | ||
44 | + PCI_EP_TYPE_PF, | ||
45 | + PCI_EP_TYPE_VF, | ||
46 | +}; | ||
47 | + | ||
48 | +enum PCI_EP_REGION_TYPE { | ||
49 | + PCI_EP_REGION_IBWIN, | ||
50 | + PCI_EP_REGION_OBWIN, | ||
51 | + PCI_EP_REGION_VF_IBWIN, | ||
52 | + PCI_EP_REGION_VF_OBWIN, | ||
53 | + PCI_EP_REGION_REGS, | ||
54 | + PCI_EP_REGION_CONFIG, | ||
55 | + PCI_EP_REGION_MEM, | ||
56 | + PCI_EP_REGION_MSIX_OBWIN | ||
57 | +}; | ||
58 | + | ||
59 | +enum PCI_EP_REGION_INDEX { | ||
60 | + PCI_EP_WIN0_INDEX, | ||
61 | + PCI_EP_WIN1_INDEX, | ||
62 | + PCI_EP_WIN2_INDEX, | ||
63 | + PCI_EP_WIN3_INDEX, | ||
64 | + PCI_EP_WIN4_INDEX, | ||
65 | + PCI_EP_WIN5_INDEX, | ||
66 | +}; | ||
67 | + | ||
68 | +#define PCI_EP_MSI_WIN_INDEX PCI_EP_WIN1_INDEX | ||
69 | +#define PCI_EP_CCSR_WIN_INDEX PCI_EP_WIN0_INDEX | ||
70 | +#define PCI_EP_DEFAULT_OW_INDEX PCI_EP_WIN0_INDEX | ||
71 | + | ||
72 | +struct pci_ep_win { | ||
73 | + uint64_t pci_addr; | ||
74 | + uint64_t cpu_addr; | ||
75 | + uint64_t size; | ||
76 | + uint64_t offset; | ||
77 | + uint32_t attr; | ||
78 | + uint32_t type; | ||
79 | + uint32_t idx; | ||
80 | +}; | ||
81 | + | ||
82 | +#define VFIO_DEVICE_SET_WIN_INFO _IO(VFIO_TYPE, VFIO_BASE + 20) | ||
83 | +#define VFIO_DEVICE_GET_WIN_INFO _IO(VFIO_TYPE, VFIO_BASE + 21) | ||
84 | + | ||
85 | +struct pci_ep_info { | ||
86 | + uint32_t type; | ||
87 | + uint32_t pf_idx; | ||
88 | + uint32_t vf_idx; | ||
89 | + uint32_t iw_num; | ||
90 | + uint32_t ow_num; | ||
91 | + uint32_t vf_iw_num; | ||
92 | + uint32_t vf_ow_num; | ||
93 | + bool msix_enable; | ||
94 | +}; | ||
95 | + | ||
96 | +#endif | ||
97 | diff --git a/include/linux/vfio.h b/include/linux/vfio.h | ||
98 | new file mode 100644 | ||
99 | index 0000000..44578d2 | ||
100 | --- /dev/null | ||
101 | +++ b/include/linux/vfio.h | ||
102 | @@ -0,0 +1,555 @@ | ||
103 | +/* | ||
104 | + * VFIO API definition | ||
105 | + * | ||
106 | + * Copyright (C) 2012 Red Hat, Inc. All rights reserved. | ||
107 | + * Author: Alex Williamson <alex.williamson@redhat.com> | ||
108 | + * | ||
109 | + * This program is free software; you can redistribute it and/or modify | ||
110 | + * it under the terms of the GNU General Public License version 2 as | ||
111 | + * published by the Free Software Foundation. | ||
112 | + */ | ||
113 | +#ifndef _UAPIVFIO_H | ||
114 | +#define _UAPIVFIO_H | ||
115 | + | ||
116 | +#include <linux/types.h> | ||
117 | +#include <linux/ioctl.h> | ||
118 | + | ||
119 | +#define VFIO_API_VERSION 0 | ||
120 | + | ||
121 | + | ||
122 | +/* Kernel & User level defines for VFIO IOCTLs. */ | ||
123 | + | ||
124 | +/* Extensions */ | ||
125 | + | ||
126 | +#define VFIO_TYPE1_IOMMU 1 | ||
127 | +#define VFIO_SPAPR_TCE_IOMMU 2 | ||
128 | +#define VFIO_FSL_PAMU_IOMMU 1000 | ||
129 | +#define VFIO_IOMMU_DUMMY 1001 | ||
130 | + | ||
131 | +/* | ||
132 | + * The IOCTL interface is designed for extensibility by embedding the | ||
133 | + * structure length (argsz) and flags into structures passed between | ||
134 | + * kernel and userspace. We therefore use the _IO() macro for these | ||
135 | + * defines to avoid implicitly embedding a size into the ioctl request. | ||
136 | + * As structure fields are added, argsz will increase to match and flag | ||
137 | + * bits will be defined to indicate additional fields with valid data. | ||
138 | + * It's *always* the caller's responsibility to indicate the size of | ||
139 | + * the structure passed by setting argsz appropriately. | ||
140 | + */ | ||
141 | + | ||
142 | +#define VFIO_TYPE (';') | ||
143 | +#define VFIO_BASE 100 | ||
144 | + | ||
145 | +/* -------- IOCTLs for VFIO file descriptor (/dev/vfio/vfio) -------- */ | ||
146 | + | ||
147 | +/** | ||
148 | + * VFIO_GET_API_VERSION - _IO(VFIO_TYPE, VFIO_BASE + 0) | ||
149 | + * | ||
150 | + * Report the version of the VFIO API. This allows us to bump the entire | ||
151 | + * API version should we later need to add or change features in incompatible | ||
152 | + * ways. | ||
153 | + * Return: VFIO_API_VERSION | ||
154 | + * Availability: Always | ||
155 | + */ | ||
156 | +#define VFIO_GET_API_VERSION _IO(VFIO_TYPE, VFIO_BASE + 0) | ||
157 | + | ||
158 | +/** | ||
159 | + * VFIO_CHECK_EXTENSION - _IOW(VFIO_TYPE, VFIO_BASE + 1, __u32) | ||
160 | + * | ||
161 | + * Check whether an extension is supported. | ||
162 | + * Return: 0 if not supported, 1 (or some other positive integer) if supported. | ||
163 | + * Availability: Always | ||
164 | + */ | ||
165 | +#define VFIO_CHECK_EXTENSION _IO(VFIO_TYPE, VFIO_BASE + 1) | ||
166 | + | ||
167 | +/** | ||
168 | + * VFIO_SET_IOMMU - _IOW(VFIO_TYPE, VFIO_BASE + 2, __s32) | ||
169 | + * | ||
170 | + * Set the iommu to the given type. The type must be supported by an | ||
171 | + * iommu driver as verified by calling CHECK_EXTENSION using the same | ||
172 | + * type. A group must be set to this file descriptor before this | ||
173 | + * ioctl is available. The IOMMU interfaces enabled by this call are | ||
174 | + * specific to the value set. | ||
175 | + * Return: 0 on success, -errno on failure | ||
176 | + * Availability: When VFIO group attached | ||
177 | + */ | ||
178 | +#define VFIO_SET_IOMMU _IO(VFIO_TYPE, VFIO_BASE + 2) | ||
179 | + | ||
180 | +/* -------- IOCTLs for GROUP file descriptors (/dev/vfio/$GROUP) -------- */ | ||
181 | + | ||
182 | +/** | ||
183 | + * VFIO_GROUP_GET_STATUS - _IOR(VFIO_TYPE, VFIO_BASE + 3, | ||
184 | + * struct vfio_group_status) | ||
185 | + * | ||
186 | + * Retrieve information about the group. Fills in provided | ||
187 | + * struct vfio_group_info. Caller sets argsz. | ||
188 | + * Return: 0 on succes, -errno on failure. | ||
189 | + * Availability: Always | ||
190 | + */ | ||
191 | +struct vfio_group_status { | ||
192 | + __u32 argsz; | ||
193 | + __u32 flags; | ||
194 | +#define VFIO_GROUP_FLAGS_VIABLE (1 << 0) | ||
195 | +#define VFIO_GROUP_FLAGS_CONTAINER_SET (1 << 1) | ||
196 | +}; | ||
197 | +#define VFIO_GROUP_GET_STATUS _IO(VFIO_TYPE, VFIO_BASE + 3) | ||
198 | + | ||
199 | +/** | ||
200 | + * VFIO_GROUP_SET_CONTAINER - _IOW(VFIO_TYPE, VFIO_BASE + 4, __s32) | ||
201 | + * | ||
202 | + * Set the container for the VFIO group to the open VFIO file | ||
203 | + * descriptor provided. Groups may only belong to a single | ||
204 | + * container. Containers may, at their discretion, support multiple | ||
205 | + * groups. Only when a container is set are all of the interfaces | ||
206 | + * of the VFIO file descriptor and the VFIO group file descriptor | ||
207 | + * available to the user. | ||
208 | + * Return: 0 on success, -errno on failure. | ||
209 | + * Availability: Always | ||
210 | + */ | ||
211 | +#define VFIO_GROUP_SET_CONTAINER _IO(VFIO_TYPE, VFIO_BASE + 4) | ||
212 | + | ||
213 | +/** | ||
214 | + * VFIO_GROUP_UNSET_CONTAINER - _IO(VFIO_TYPE, VFIO_BASE + 5) | ||
215 | + * | ||
216 | + * Remove the group from the attached container. This is the | ||
217 | + * opposite of the SET_CONTAINER call and returns the group to | ||
218 | + * an initial state. All device file descriptors must be released | ||
219 | + * prior to calling this interface. When removing the last group | ||
220 | + * from a container, the IOMMU will be disabled and all state lost, | ||
221 | + * effectively also returning the VFIO file descriptor to an initial | ||
222 | + * state. | ||
223 | + * Return: 0 on success, -errno on failure. | ||
224 | + * Availability: When attached to container | ||
225 | + */ | ||
226 | +#define VFIO_GROUP_UNSET_CONTAINER _IO(VFIO_TYPE, VFIO_BASE + 5) | ||
227 | + | ||
228 | +/** | ||
229 | + * VFIO_GROUP_GET_DEVICE_FD - _IOW(VFIO_TYPE, VFIO_BASE + 6, char) | ||
230 | + * | ||
231 | + * Return a new file descriptor for the device object described by | ||
232 | + * the provided string. The string should match a device listed in | ||
233 | + * the devices subdirectory of the IOMMU group sysfs entry. The | ||
234 | + * group containing the device must already be added to this context. | ||
235 | + * Return: new file descriptor on success, -errno on failure. | ||
236 | + * Availability: When attached to container | ||
237 | + */ | ||
238 | +#define VFIO_GROUP_GET_DEVICE_FD _IO(VFIO_TYPE, VFIO_BASE + 6) | ||
239 | + | ||
240 | +/* --------------- IOCTLs for DEVICE file descriptors --------------- */ | ||
241 | + | ||
242 | +/** | ||
243 | + * VFIO_DEVICE_GET_INFO - _IOR(VFIO_TYPE, VFIO_BASE + 7, | ||
244 | + * struct vfio_device_info) | ||
245 | + * | ||
246 | + * Retrieve information about the device. Fills in provided | ||
247 | + * struct vfio_device_info. Caller sets argsz. | ||
248 | + * Return: 0 on success, -errno on failure. | ||
249 | + */ | ||
250 | +struct vfio_device_info { | ||
251 | + __u32 argsz; | ||
252 | + __u32 flags; | ||
253 | +#define VFIO_DEVICE_FLAGS_RESET (1 << 0) /* Device supports reset */ | ||
254 | +#define VFIO_DEVICE_FLAGS_PCI (1 << 1) /* vfio-pci device */ | ||
255 | + __u32 num_regions; /* Max region index + 1 */ | ||
256 | + __u32 num_irqs; /* Max IRQ index + 1 */ | ||
257 | +}; | ||
258 | +#define VFIO_DEVICE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 7) | ||
259 | + | ||
260 | +/** | ||
261 | + * VFIO_DEVICE_GET_REGION_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 8, | ||
262 | + * struct vfio_region_info) | ||
263 | + * | ||
264 | + * Retrieve information about a device region. Caller provides | ||
265 | + * struct vfio_region_info with index value set. Caller sets argsz. | ||
266 | + * Implementation of region mapping is bus driver specific. This is | ||
267 | + * intended to describe MMIO, I/O port, as well as bus specific | ||
268 | + * regions (ex. PCI config space). Zero sized regions may be used | ||
269 | + * to describe unimplemented regions (ex. unimplemented PCI BARs). | ||
270 | + * Return: 0 on success, -errno on failure. | ||
271 | + */ | ||
272 | +struct vfio_region_info { | ||
273 | + __u32 argsz; | ||
274 | + __u32 flags; | ||
275 | +#define VFIO_REGION_INFO_FLAG_READ (1 << 0) /* Region supports read */ | ||
276 | +#define VFIO_REGION_INFO_FLAG_WRITE (1 << 1) /* Region supports write */ | ||
277 | +#define VFIO_REGION_INFO_FLAG_MMAP (1 << 2) /* Region supports mmap */ | ||
278 | + __u32 index; /* Region index */ | ||
279 | + __u32 resv; /* Reserved for alignment */ | ||
280 | + __u64 size; /* Region size (bytes) */ | ||
281 | + __u64 offset; /* Region offset from start of device fd */ | ||
282 | +}; | ||
283 | +#define VFIO_DEVICE_GET_REGION_INFO _IO(VFIO_TYPE, VFIO_BASE + 8) | ||
284 | + | ||
285 | +/** | ||
286 | + * VFIO_DEVICE_GET_IRQ_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 9, | ||
287 | + * struct vfio_irq_info) | ||
288 | + * | ||
289 | + * Retrieve information about a device IRQ. Caller provides | ||
290 | + * struct vfio_irq_info with index value set. Caller sets argsz. | ||
291 | + * Implementation of IRQ mapping is bus driver specific. Indexes | ||
292 | + * using multiple IRQs are primarily intended to support MSI-like | ||
293 | + * interrupt blocks. Zero count irq blocks may be used to describe | ||
294 | + * unimplemented interrupt types. | ||
295 | + * | ||
296 | + * The EVENTFD flag indicates the interrupt index supports eventfd based | ||
297 | + * signaling. | ||
298 | + * | ||
299 | + * The MASKABLE flags indicates the index supports MASK and UNMASK | ||
300 | + * actions described below. | ||
301 | + * | ||
302 | + * AUTOMASKED indicates that after signaling, the interrupt line is | ||
303 | + * automatically masked by VFIO and the user needs to unmask the line | ||
304 | + * to receive new interrupts. This is primarily intended to distinguish | ||
305 | + * level triggered interrupts. | ||
306 | + * | ||
307 | + * The NORESIZE flag indicates that the interrupt lines within the index | ||
308 | + * are setup as a set and new subindexes cannot be enabled without first | ||
309 | + * disabling the entire index. This is used for interrupts like PCI MSI | ||
310 | + * and MSI-X where the driver may only use a subset of the available | ||
311 | + * indexes, but VFIO needs to enable a specific number of vectors | ||
312 | + * upfront. In the case of MSI-X, where the user can enable MSI-X and | ||
313 | + * then add and unmask vectors, it's up to userspace to make the decision | ||
314 | + * whether to allocate the maximum supported number of vectors or tear | ||
315 | + * down setup and incrementally increase the vectors as each is enabled. | ||
316 | + */ | ||
317 | +struct vfio_irq_info { | ||
318 | + __u32 argsz; | ||
319 | + __u32 flags; | ||
320 | +#define VFIO_IRQ_INFO_EVENTFD (1 << 0) | ||
321 | +#define VFIO_IRQ_INFO_MASKABLE (1 << 1) | ||
322 | +#define VFIO_IRQ_INFO_AUTOMASKED (1 << 2) | ||
323 | +#define VFIO_IRQ_INFO_NORESIZE (1 << 3) | ||
324 | + __u32 index; /* IRQ index */ | ||
325 | + __u32 count; /* Number of IRQs within this index */ | ||
326 | +}; | ||
327 | +#define VFIO_DEVICE_GET_IRQ_INFO _IO(VFIO_TYPE, VFIO_BASE + 9) | ||
328 | + | ||
329 | +/** | ||
330 | + * VFIO_DEVICE_SET_IRQS - _IOW(VFIO_TYPE, VFIO_BASE + 10, struct vfio_irq_set) | ||
331 | + * | ||
332 | + * Set signaling, masking, and unmasking of interrupts. Caller provides | ||
333 | + * struct vfio_irq_set with all fields set. 'start' and 'count' indicate | ||
334 | + * the range of subindexes being specified. | ||
335 | + * | ||
336 | + * The DATA flags specify the type of data provided. If DATA_NONE, the | ||
337 | + * operation performs the specified action immediately on the specified | ||
338 | + * interrupt(s). For example, to unmask AUTOMASKED interrupt [0,0]: | ||
339 | + * flags = (DATA_NONE|ACTION_UNMASK), index = 0, start = 0, count = 1. | ||
340 | + * | ||
341 | + * DATA_BOOL allows sparse support for the same on arrays of interrupts. | ||
342 | + * For example, to mask interrupts [0,1] and [0,3] (but not [0,2]): | ||
343 | + * flags = (DATA_BOOL|ACTION_MASK), index = 0, start = 1, count = 3, | ||
344 | + * data = {1,0,1} | ||
345 | + * | ||
346 | + * DATA_EVENTFD binds the specified ACTION to the provided __s32 eventfd. | ||
347 | + * A value of -1 can be used to either de-assign interrupts if already | ||
348 | + * assigned or skip un-assigned interrupts. For example, to set an eventfd | ||
349 | + * to be trigger for interrupts [0,0] and [0,2]: | ||
350 | + * flags = (DATA_EVENTFD|ACTION_TRIGGER), index = 0, start = 0, count = 3, | ||
351 | + * data = {fd1, -1, fd2} | ||
352 | + * If index [0,1] is previously set, two count = 1 ioctls calls would be | ||
353 | + * required to set [0,0] and [0,2] without changing [0,1]. | ||
354 | + * | ||
355 | + * Once a signaling mechanism is set, DATA_BOOL or DATA_NONE can be used | ||
356 | + * with ACTION_TRIGGER to perform kernel level interrupt loopback testing | ||
357 | + * from userspace (ie. simulate hardware triggering). | ||
358 | + * | ||
359 | + * Setting of an event triggering mechanism to userspace for ACTION_TRIGGER | ||
360 | + * enables the interrupt index for the device. Individual subindex interrupts | ||
361 | + * can be disabled using the -1 value for DATA_EVENTFD or the index can be | ||
362 | + * disabled as a whole with: flags = (DATA_NONE|ACTION_TRIGGER), count = 0. | ||
363 | + * | ||
364 | + * Note that ACTION_[UN]MASK specify user->kernel signaling (irqfds) while | ||
365 | + * ACTION_TRIGGER specifies kernel->user signaling. | ||
366 | + */ | ||
367 | +struct vfio_irq_set { | ||
368 | + __u32 argsz; | ||
369 | + __u32 flags; | ||
370 | +#define VFIO_IRQ_SET_DATA_NONE (1 << 0) /* Data not present */ | ||
371 | +#define VFIO_IRQ_SET_DATA_BOOL (1 << 1) /* Data is bool (u8) */ | ||
372 | +#define VFIO_IRQ_SET_DATA_EVENTFD (1 << 2) /* Data is eventfd (s32) */ | ||
373 | +#define VFIO_IRQ_SET_ACTION_MASK (1 << 3) /* Mask interrupt */ | ||
374 | +#define VFIO_IRQ_SET_ACTION_UNMASK (1 << 4) /* Unmask interrupt */ | ||
375 | +#define VFIO_IRQ_SET_ACTION_TRIGGER (1 << 5) /* Trigger interrupt */ | ||
376 | + __u32 index; | ||
377 | + __u32 start; | ||
378 | + __u32 count; | ||
379 | + __u8 data[]; | ||
380 | +}; | ||
381 | +#define VFIO_DEVICE_SET_IRQS _IO(VFIO_TYPE, VFIO_BASE + 10) | ||
382 | + | ||
383 | +#define VFIO_IRQ_SET_DATA_TYPE_MASK (VFIO_IRQ_SET_DATA_NONE | \ | ||
384 | + VFIO_IRQ_SET_DATA_BOOL | \ | ||
385 | + VFIO_IRQ_SET_DATA_EVENTFD) | ||
386 | +#define VFIO_IRQ_SET_ACTION_TYPE_MASK (VFIO_IRQ_SET_ACTION_MASK | \ | ||
387 | + VFIO_IRQ_SET_ACTION_UNMASK | \ | ||
388 | + VFIO_IRQ_SET_ACTION_TRIGGER) | ||
389 | +/** | ||
390 | + * VFIO_DEVICE_RESET - _IO(VFIO_TYPE, VFIO_BASE + 11) | ||
391 | + * | ||
392 | + * Reset a device. | ||
393 | + */ | ||
394 | +#define VFIO_DEVICE_RESET _IO(VFIO_TYPE, VFIO_BASE + 11) | ||
395 | + | ||
396 | +/* | ||
397 | + * The VFIO-PCI bus driver makes use of the following fixed region and | ||
398 | + * IRQ index mapping. Unimplemented regions return a size of zero. | ||
399 | + * Unimplemented IRQ types return a count of zero. | ||
400 | + */ | ||
401 | + | ||
402 | +enum { | ||
403 | + VFIO_PCI_BAR0_REGION_INDEX, | ||
404 | + VFIO_PCI_BAR1_REGION_INDEX, | ||
405 | + VFIO_PCI_BAR2_REGION_INDEX, | ||
406 | + VFIO_PCI_BAR3_REGION_INDEX, | ||
407 | + VFIO_PCI_BAR4_REGION_INDEX, | ||
408 | + VFIO_PCI_BAR5_REGION_INDEX, | ||
409 | + VFIO_PCI_ROM_REGION_INDEX, | ||
410 | + VFIO_PCI_CONFIG_REGION_INDEX, | ||
411 | + /* | ||
412 | + * Expose VGA regions defined for PCI base class 03, subclass 00. | ||
413 | + * This includes I/O port ranges 0x3b0 to 0x3bb and 0x3c0 to 0x3df | ||
414 | + * as well as the MMIO range 0xa0000 to 0xbffff. Each implemented | ||
415 | + * range is found at it's identity mapped offset from the region | ||
416 | + * offset, for example 0x3b0 is region_info.offset + 0x3b0. Areas | ||
417 | + * between described ranges are unimplemented. | ||
418 | + */ | ||
419 | + VFIO_PCI_VGA_REGION_INDEX, | ||
420 | + VFIO_PCI_NUM_REGIONS | ||
421 | +}; | ||
422 | + | ||
423 | +enum { | ||
424 | + VFIO_PCI_INTX_IRQ_INDEX, | ||
425 | + VFIO_PCI_MSI_IRQ_INDEX, | ||
426 | + VFIO_PCI_MSIX_IRQ_INDEX, | ||
427 | + VFIO_PCI_ERR_IRQ_INDEX, | ||
428 | + VFIO_PCI_NUM_IRQS | ||
429 | +}; | ||
430 | + | ||
431 | +/** | ||
432 | + * VFIO_DEVICE_GET_PCI_HOT_RESET_INFO - _IORW(VFIO_TYPE, VFIO_BASE + 12, | ||
433 | + * struct vfio_pci_hot_reset_info) | ||
434 | + * | ||
435 | + * Return: 0 on success, -errno on failure: | ||
436 | + * -enospc = insufficient buffer, -enodev = unsupported for device. | ||
437 | + */ | ||
438 | +struct vfio_pci_dependent_device { | ||
439 | + __u32 group_id; | ||
440 | + __u16 segment; | ||
441 | + __u8 bus; | ||
442 | + __u8 devfn; /* Use PCI_SLOT/PCI_FUNC */ | ||
443 | +}; | ||
444 | + | ||
445 | +struct vfio_pci_hot_reset_info { | ||
446 | + __u32 argsz; | ||
447 | + __u32 flags; | ||
448 | + __u32 count; | ||
449 | + struct vfio_pci_dependent_device devices[]; | ||
450 | +}; | ||
451 | + | ||
452 | +#define VFIO_DEVICE_GET_PCI_HOT_RESET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12) | ||
453 | + | ||
454 | +/** | ||
455 | + * VFIO_DEVICE_PCI_HOT_RESET - _IOW(VFIO_TYPE, VFIO_BASE + 13, | ||
456 | + * struct vfio_pci_hot_reset) | ||
457 | + * | ||
458 | + * Return: 0 on success, -errno on failure. | ||
459 | + */ | ||
460 | +struct vfio_pci_hot_reset { | ||
461 | + __u32 argsz; | ||
462 | + __u32 flags; | ||
463 | + __u32 count; | ||
464 | + __s32 group_fds[]; | ||
465 | +}; | ||
466 | + | ||
467 | +#define VFIO_DEVICE_PCI_HOT_RESET _IO(VFIO_TYPE, VFIO_BASE + 13) | ||
468 | + | ||
469 | +/* -------- API for Type1 VFIO IOMMU -------- */ | ||
470 | + | ||
471 | +/** | ||
472 | + * VFIO_IOMMU_GET_INFO - _IOR(VFIO_TYPE, VFIO_BASE + 12, struct vfio_iommu_info) | ||
473 | + * | ||
474 | + * Retrieve information about the IOMMU object. Fills in provided | ||
475 | + * struct vfio_iommu_info. Caller sets argsz. | ||
476 | + * | ||
477 | + * XXX Should we do these by CHECK_EXTENSION too? | ||
478 | + */ | ||
479 | +struct vfio_iommu_type1_info { | ||
480 | + __u32 argsz; | ||
481 | + __u32 flags; | ||
482 | +#define VFIO_IOMMU_INFO_PGSIZES (1 << 0) /* supported page sizes info */ | ||
483 | + __u64 iova_pgsizes; /* Bitmap of supported page sizes */ | ||
484 | +}; | ||
485 | + | ||
486 | +#define VFIO_IOMMU_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12) | ||
487 | + | ||
488 | +/** | ||
489 | + * VFIO_IOMMU_MAP_DMA - _IOW(VFIO_TYPE, VFIO_BASE + 13, struct vfio_dma_map) | ||
490 | + * | ||
491 | + * Map process virtual addresses to IO virtual addresses using the | ||
492 | + * provided struct vfio_dma_map. Caller sets argsz. READ &/ WRITE required. | ||
493 | + */ | ||
494 | +struct vfio_iommu_type1_dma_map { | ||
495 | + __u32 argsz; | ||
496 | + __u32 flags; | ||
497 | +#define VFIO_DMA_MAP_FLAG_READ (1 << 0) /* readable from device */ | ||
498 | +#define VFIO_DMA_MAP_FLAG_WRITE (1 << 1) /* writable from device */ | ||
499 | + __u64 vaddr; /* Process virtual address */ | ||
500 | + __u64 iova; /* IO virtual address */ | ||
501 | + __u64 size; /* Size of mapping (bytes) */ | ||
502 | +}; | ||
503 | + | ||
504 | +#define VFIO_IOMMU_MAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 13) | ||
505 | + | ||
506 | +/** | ||
507 | + * VFIO_IOMMU_UNMAP_DMA - _IOWR(VFIO_TYPE, VFIO_BASE + 14, | ||
508 | + * struct vfio_dma_unmap) | ||
509 | + * | ||
510 | + * Unmap IO virtual addresses using the provided struct vfio_dma_unmap. | ||
511 | + * Caller sets argsz. The actual unmapped size is returned in the size | ||
512 | + * field. No guarantee is made to the user that arbitrary unmaps of iova | ||
513 | + * or size different from those used in the original mapping call will | ||
514 | + * succeed. | ||
515 | + */ | ||
516 | +struct vfio_iommu_type1_dma_unmap { | ||
517 | + __u32 argsz; | ||
518 | + __u32 flags; | ||
519 | + __u64 iova; /* IO virtual address */ | ||
520 | + __u64 size; /* Size of mapping (bytes) */ | ||
521 | +}; | ||
522 | + | ||
523 | +#define VFIO_IOMMU_UNMAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 14) | ||
524 | + | ||
525 | +/*********** APIs for VFIO_PAMU type only ****************/ | ||
526 | +/* | ||
527 | + * VFIO_IOMMU_PAMU_GET_ATTR - _IO(VFIO_TYPE, VFIO_BASE + 15, | ||
528 | + * struct vfio_pamu_attr) | ||
529 | + * | ||
530 | + * Gets the iommu attributes for the current vfio container. | ||
531 | + * Caller sets argsz and attribute. The ioctl fills in | ||
532 | + * the provided struct vfio_pamu_attr based on the attribute | ||
533 | + * value that was set. | ||
534 | + * Return: 0 on success, -errno on failure | ||
535 | + */ | ||
536 | +struct vfio_pamu_attr { | ||
537 | + __u32 argsz; | ||
538 | + __u32 flags; /* no flags currently */ | ||
539 | +#define VFIO_ATTR_GEOMETRY 0 | ||
540 | +#define VFIO_ATTR_WINDOWS 1 | ||
541 | +#define VFIO_ATTR_PAMU_STASH 2 | ||
542 | + __u32 attribute; | ||
543 | + | ||
544 | + union { | ||
545 | + /* VFIO_ATTR_GEOMETRY */ | ||
546 | + struct { | ||
547 | + /* first addr that can be mapped */ | ||
548 | + __u64 aperture_start; | ||
549 | + /* last addr that can be mapped */ | ||
550 | + __u64 aperture_end; | ||
551 | + } attr; | ||
552 | + | ||
553 | + /* VFIO_ATTR_WINDOWS */ | ||
554 | + __u32 windows; /* number of windows in the aperture | ||
555 | + * initially this will be the max number | ||
556 | + * of windows that can be set | ||
557 | + */ | ||
558 | + /* VFIO_ATTR_PAMU_STASH */ | ||
559 | + struct { | ||
560 | + __u32 cpu; /* CPU number for stashing */ | ||
561 | + __u32 cache; /* cache ID for stashing */ | ||
562 | + } stash; | ||
563 | + } attr_info; | ||
564 | +}; | ||
565 | +#define VFIO_IOMMU_PAMU_GET_ATTR _IO(VFIO_TYPE, VFIO_BASE + 15) | ||
566 | + | ||
567 | +/* | ||
568 | + * VFIO_IOMMU_PAMU_SET_ATTR - _IO(VFIO_TYPE, VFIO_BASE + 16, | ||
569 | + * struct vfio_pamu_attr) | ||
570 | + * | ||
571 | + * Sets the iommu attributes for the current vfio container. | ||
572 | + * Caller sets struct vfio_pamu attr, including argsz and attribute and | ||
573 | + * setting any fields that are valid for the attribute. | ||
574 | + * Return: 0 on success, -errno on failure | ||
575 | + */ | ||
576 | +#define VFIO_IOMMU_PAMU_SET_ATTR _IO(VFIO_TYPE, VFIO_BASE + 16) | ||
577 | + | ||
578 | +/* | ||
579 | + * VFIO_IOMMU_PAMU_GET_MSI_BANK_COUNT - _IO(VFIO_TYPE, VFIO_BASE + 17, __u32) | ||
580 | + * | ||
581 | + * Returns the number of MSI banks for this platform. This tells user space | ||
582 | + * how many aperture windows should be reserved for MSI banks when setting | ||
583 | + * the PAMU geometry and window count. | ||
584 | + * Return: __u32 bank count on success, -errno on failure | ||
585 | + */ | ||
586 | +#define VFIO_IOMMU_PAMU_GET_MSI_BANK_COUNT _IO(VFIO_TYPE, VFIO_BASE + 17) | ||
587 | + | ||
588 | +/* | ||
589 | + * VFIO_IOMMU_PAMU_MAP_MSI_BANK - _IO(VFIO_TYPE, VFIO_BASE + 18, | ||
590 | + * struct vfio_pamu_msi_bank_map) | ||
591 | + * | ||
592 | + * Maps the MSI bank at the specified index and iova. User space must | ||
593 | + * call this ioctl once for each MSI bank (count of banks is returned by | ||
594 | + * VFIO_IOMMU_PAMU_GET_MSI_BANK_COUNT). | ||
595 | + * Caller provides struct vfio_pamu_msi_bank_map with all fields set. | ||
596 | + * Return: 0 on success, -errno on failure | ||
597 | + */ | ||
598 | + | ||
599 | +struct vfio_pamu_msi_bank_map { | ||
600 | + __u32 argsz; | ||
601 | + __u32 flags; /* no flags currently */ | ||
602 | + __u32 msi_bank_index; /* the index of the MSI bank */ | ||
603 | + __u64 iova; /* the iova the bank is to be mapped to */ | ||
604 | +}; | ||
605 | +#define VFIO_IOMMU_PAMU_MAP_MSI_BANK _IO(VFIO_TYPE, VFIO_BASE + 18) | ||
606 | + | ||
607 | +/* | ||
608 | + * VFIO_IOMMU_PAMU_UNMAP_MSI_BANK - _IO(VFIO_TYPE, VFIO_BASE + 19, | ||
609 | + * struct vfio_pamu_msi_bank_unmap) | ||
610 | + * | ||
611 | + * Unmaps the MSI bank at the specified iova. | ||
612 | + * Caller provides struct vfio_pamu_msi_bank_unmap with all fields set. | ||
613 | + * Operates on VFIO file descriptor (/dev/vfio/vfio). | ||
614 | + * Return: 0 on success, -errno on failure | ||
615 | + */ | ||
616 | + | ||
617 | +struct vfio_pamu_msi_bank_unmap { | ||
618 | + __u32 argsz; | ||
619 | + __u32 flags; /* no flags currently */ | ||
620 | + __u64 iova; /* the iova to be unmapped to */ | ||
621 | +}; | ||
622 | +#define VFIO_IOMMU_PAMU_UNMAP_MSI_BANK _IO(VFIO_TYPE, VFIO_BASE + 19) | ||
623 | + | ||
624 | +/* | ||
625 | + * IOCTLs to enable/disable IOMMU container usage. | ||
626 | + * No parameters are supported. | ||
627 | + */ | ||
628 | +#define VFIO_IOMMU_ENABLE _IO(VFIO_TYPE, VFIO_BASE + 15) | ||
629 | +#define VFIO_IOMMU_DISABLE _IO(VFIO_TYPE, VFIO_BASE + 16) | ||
630 | + | ||
631 | +/* -------- Additional API for SPAPR TCE (Server POWERPC) IOMMU -------- */ | ||
632 | + | ||
633 | +/* | ||
634 | + * The SPAPR TCE info struct provides the information about the PCI bus | ||
635 | + * address ranges available for DMA, these values are programmed into | ||
636 | + * the hardware so the guest has to know that information. | ||
637 | + * | ||
638 | + * The DMA 32 bit window start is an absolute PCI bus address. | ||
639 | + * The IOVA address passed via map/unmap ioctls are absolute PCI bus | ||
640 | + * addresses too so the window works as a filter rather than an offset | ||
641 | + * for IOVA addresses. | ||
642 | + * | ||
643 | + * A flag will need to be added if other page sizes are supported, | ||
644 | + * so as defined here, it is always 4k. | ||
645 | + */ | ||
646 | +struct vfio_iommu_spapr_tce_info { | ||
647 | + __u32 argsz; | ||
648 | + __u32 flags; /* reserved for future use */ | ||
649 | + __u32 dma32_window_start; /* 32 bit window start (bytes) */ | ||
650 | + __u32 dma32_window_size; /* 32 bit window size (bytes) */ | ||
651 | +}; | ||
652 | + | ||
653 | +#define VFIO_IOMMU_SPAPR_TCE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12) | ||
654 | + | ||
655 | +/* ***************************************************************** */ | ||
656 | + | ||
657 | +#endif /* _UAPIVFIO_H */ | ||
658 | -- | ||
659 | 1.8.3.2 | ||
660 | |||
diff --git a/recipes-extended/skmm-ep/skmm-ep_git.bb b/recipes-extended/skmm-ep/skmm-ep_git.bb new file mode 100644 index 00000000..ca5d6734 --- /dev/null +++ b/recipes-extended/skmm-ep/skmm-ep_git.bb | |||
@@ -0,0 +1,31 @@ | |||
1 | DESCRIPTION = "SKMM application for PCIe endpoint" | ||
2 | SECTION = "skmm-ep" | ||
3 | LICENSE = "BSD & GPLv2" | ||
4 | LIC_FILES_CHKSUM = "file://Makefile;endline=30;md5=39e58bedc879163c9338596e52df5b1f" | ||
5 | |||
6 | DEPENDS = "libedit openssl virtual/kernel" | ||
7 | |||
8 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
9 | |||
10 | SRC_URI = "git://git.freescale.com/ppc/sdk/skmm-ep.git;nobranch=1 \ | ||
11 | file://add-two-missing-header-files.patch \ | ||
12 | " | ||
13 | SRCREV = "27156a6621c8f6d7f98210b1ca5cd97bde926875" | ||
14 | |||
15 | COMPATIBLE_MACHINE = "(p4080ds|t4240qds|c293pcie)" | ||
16 | |||
17 | S = "${WORKDIR}/git" | ||
18 | |||
19 | EXTRA_OEMAKE = 'MACHINE=${MACHINE}' | ||
20 | |||
21 | export LIBEDIT_CFLAGS = "`pkg-config --cflags libedit`" | ||
22 | export LIBEDIT_LDFLAGS = "`pkg-config --libs --static libedit`" | ||
23 | |||
24 | do_compile () { | ||
25 | export ARCH=${TARGET_ARCH} | ||
26 | oe_runmake | ||
27 | } | ||
28 | |||
29 | do_install () { | ||
30 | oe_runmake ARCH=${TARGET_ARCH} install DESTDIR=${D} | ||
31 | } | ||