diff options
| author | Thomas Fleury <tfleury@nvidia.com> | 2016-05-10 12:05:45 -0400 |
|---|---|---|
| committer | Vijayakumar Subbu <vsubbu@nvidia.com> | 2016-07-19 02:12:51 -0400 |
| commit | c8ffe0fdecfa110a9f9beb1b7e0298d3c3c64cc2 (patch) | |
| tree | 08054741c436ab6a783e710a9efa87fc7a0b71df /include/uapi/linux | |
| parent | 90988af81237d3b56c063b750c32efcbee9ab9cc (diff) | |
gpu: nvgpu: add sched control API
Added a dedicated device node to allow an
app manager to control TSG scheduling parameters:
- Get list of TSGs
- Get list of recent TSGs
- Get list of TSGs per pid
- Get TSG current scheduling parameters
- Set TSG timeslice
- Set TSG runlist interleave
Jira VFND-1586
Change-Id: I014c9d1534bce0eaea6c25ad114cf0cff317af79
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: http://git-master/r/1160384
(cherry picked from commit 75ca739517cc7f7f76714b5f6a1a57c39b8cb38e)
Reviewed-on: http://git-master/r/1167021
Reviewed-by: Richard Zhao <rizhao@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Diffstat (limited to 'include/uapi/linux')
| -rw-r--r-- | include/uapi/linux/nvgpu.h | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/include/uapi/linux/nvgpu.h b/include/uapi/linux/nvgpu.h index 496fda5c..17604d32 100644 --- a/include/uapi/linux/nvgpu.h +++ b/include/uapi/linux/nvgpu.h | |||
| @@ -1497,4 +1497,127 @@ struct nvgpu_ctxsw_trace_filter_args { | |||
| 1497 | #define NVGPU_CTXSW_IOCTL_MAX_ARG_SIZE \ | 1497 | #define NVGPU_CTXSW_IOCTL_MAX_ARG_SIZE \ |
| 1498 | sizeof(struct nvgpu_ctxsw_trace_filter_args) | 1498 | sizeof(struct nvgpu_ctxsw_trace_filter_args) |
| 1499 | 1499 | ||
| 1500 | /* | ||
| 1501 | * /dev/nvhost-sched-gpu device | ||
| 1502 | * | ||
| 1503 | * Opening a '/dev/nvhost-sched-gpu' device node creates a way to control | ||
| 1504 | * GPU scheduling parameters. | ||
| 1505 | */ | ||
| 1506 | |||
| 1507 | #define NVGPU_SCHED_IOCTL_MAGIC 'S' | ||
| 1508 | |||
| 1509 | /* | ||
| 1510 | * When the app manager receives a NVGPU_SCHED_STATUS_TSG_OPEN notification, | ||
| 1511 | * it is expected to query the list of recently opened TSGs using | ||
| 1512 | * NVGPU_SCHED_IOCTL_GET_RECENT_TSGS. The kernel driver maintains a bitmap | ||
| 1513 | * of recently opened TSGs. When the app manager queries the list, it | ||
| 1514 | * atomically clears the bitmap. This way, at each invocation of | ||
| 1515 | * NVGPU_SCHED_IOCTL_GET_RECENT_TSGS, app manager only receives the list of | ||
| 1516 | * TSGs that have been opened since last invocation. | ||
| 1517 | * | ||
| 1518 | * If the app manager needs to re-synchronize with the driver, it can use | ||
| 1519 | * NVGPU_SCHED_IOCTL_GET_TSGS to retrieve the complete list of TSGs. The | ||
| 1520 | * recent TSG bitmap will be cleared in that case too. | ||
| 1521 | */ | ||
| 1522 | struct nvgpu_sched_get_tsgs_args { | ||
| 1523 | /* in: size of buffer in bytes */ | ||
| 1524 | /* out: actual size of size of TSG bitmap. if user-provided size is too | ||
| 1525 | * small, ioctl will return -ENOSPC, and update this field, allowing | ||
| 1526 | * application to discover required number of bytes and allocate | ||
| 1527 | * a buffer accordingly. | ||
| 1528 | */ | ||
| 1529 | __u32 size; | ||
| 1530 | |||
| 1531 | /* in: address of 64-bit aligned buffer */ | ||
| 1532 | /* out: buffer contains a TSG bitmap. | ||
| 1533 | * Bit #n will be set in the bitmap if TSG #n is present. | ||
| 1534 | * When using NVGPU_SCHED_IOCTL_GET_RECENT_TSGS, the first time you use | ||
| 1535 | * this command, it will return the opened TSGs and subsequent calls | ||
| 1536 | * will only return the delta (ie. each invocation clears bitmap) | ||
| 1537 | */ | ||
| 1538 | __u64 buffer; | ||
| 1539 | }; | ||
| 1540 | |||
| 1541 | struct nvgpu_sched_get_tsgs_by_pid_args { | ||
| 1542 | /* in: process id for which we want to retrieve TSGs */ | ||
| 1543 | __u64 pid; | ||
| 1544 | |||
| 1545 | /* in: size of buffer in bytes */ | ||
| 1546 | /* out: actual size of size of TSG bitmap. if user-provided size is too | ||
| 1547 | * small, ioctl will return -ENOSPC, and update this field, allowing | ||
| 1548 | * application to discover required number of bytes and allocate | ||
| 1549 | * a buffer accordingly. | ||
| 1550 | */ | ||
| 1551 | __u32 size; | ||
| 1552 | |||
| 1553 | /* in: address of 64-bit aligned buffer */ | ||
| 1554 | /* out: buffer contains a TSG bitmap. */ | ||
| 1555 | __u64 buffer; | ||
| 1556 | }; | ||
| 1557 | |||
| 1558 | struct nvgpu_sched_tsg_get_params_args { | ||
| 1559 | __u32 tsgid; /* in: TSG identifier */ | ||
| 1560 | __u32 timeslice; /* out: timeslice in usecs */ | ||
| 1561 | __u32 runlist_interleave; | ||
| 1562 | __u32 graphics_preempt_mode; | ||
| 1563 | __u32 compute_preempt_mode; | ||
| 1564 | __u64 pid; /* out: process identifier of TSG owner */ | ||
| 1565 | }; | ||
| 1566 | |||
| 1567 | struct nvgpu_sched_tsg_timeslice_args { | ||
| 1568 | __u32 tsgid; /* in: TSG identifier */ | ||
| 1569 | __u32 timeslice; /* in: timeslice in usecs */ | ||
| 1570 | }; | ||
| 1571 | |||
| 1572 | struct nvgpu_sched_tsg_runlist_interleave_args { | ||
| 1573 | __u32 tsgid; /* in: TSG identifier */ | ||
| 1574 | |||
| 1575 | /* in: see NVGPU_RUNLIST_INTERLEAVE_LEVEL_ */ | ||
| 1576 | __u32 runlist_interleave; | ||
| 1577 | }; | ||
| 1578 | |||
| 1579 | #define NVGPU_SCHED_IOCTL_GET_TSGS \ | ||
| 1580 | _IOWR(NVGPU_SCHED_IOCTL_MAGIC, 1, \ | ||
| 1581 | struct nvgpu_sched_get_tsgs_args) | ||
| 1582 | #define NVGPU_SCHED_IOCTL_GET_RECENT_TSGS \ | ||
| 1583 | _IOWR(NVGPU_SCHED_IOCTL_MAGIC, 2, \ | ||
| 1584 | struct nvgpu_sched_get_tsgs_args) | ||
| 1585 | #define NVGPU_SCHED_IOCTL_GET_TSGS_BY_PID \ | ||
| 1586 | _IOWR(NVGPU_SCHED_IOCTL_MAGIC, 3, \ | ||
| 1587 | struct nvgpu_sched_get_tsgs_by_pid_args) | ||
| 1588 | #define NVGPU_SCHED_IOCTL_TSG_GET_PARAMS \ | ||
| 1589 | _IOWR(NVGPU_SCHED_IOCTL_MAGIC, 4, \ | ||
| 1590 | struct nvgpu_sched_tsg_get_params_args) | ||
| 1591 | #define NVGPU_SCHED_IOCTL_TSG_SET_TIMESLICE \ | ||
| 1592 | _IOW(NVGPU_SCHED_IOCTL_MAGIC, 5, \ | ||
| 1593 | struct nvgpu_sched_tsg_timeslice_args) | ||
| 1594 | #define NVGPU_SCHED_IOCTL_TSG_SET_RUNLIST_INTERLEAVE \ | ||
| 1595 | _IOW(NVGPU_SCHED_IOCTL_MAGIC, 6, \ | ||
| 1596 | struct nvgpu_sched_tsg_runlist_interleave_args) | ||
| 1597 | #define NVGPU_SCHED_IOCTL_LOCK_CONTROL \ | ||
| 1598 | _IO(NVGPU_SCHED_IOCTL_MAGIC, 7) | ||
| 1599 | #define NVGPU_SCHED_IOCTL_UNLOCK_CONTROL \ | ||
| 1600 | _IO(NVGPU_SCHED_IOCTL_MAGIC, 8) | ||
| 1601 | |||
| 1602 | #define NVGPU_SCHED_IOCTL_LAST \ | ||
| 1603 | _IOC_NR(NVGPU_SCHED_IOCTL_UNLOCK_CONTROL) | ||
| 1604 | |||
| 1605 | #define NVGPU_SCHED_IOCTL_MAX_ARG_SIZE \ | ||
| 1606 | sizeof(struct nvgpu_sched_tsg_get_params_args) | ||
| 1607 | |||
| 1608 | |||
| 1609 | #define NVGPU_SCHED_SET(n, bitmap) \ | ||
| 1610 | (((__u64 *)(bitmap))[(n) / 64] |= (1ULL << (((__u64)n) & 63))) | ||
| 1611 | #define NVGPU_SCHED_CLR(n, bitmap) \ | ||
| 1612 | (((__u64 *)(bitmap))[(n) / 64] &= ~(1ULL << (((__u64)n) & 63))) | ||
| 1613 | #define NVGPU_SCHED_ISSET(n, bitmap) \ | ||
| 1614 | (((__u64 *)(bitmap))[(n) / 64] & (1ULL << (((__u64)n) & 63))) | ||
| 1615 | |||
| 1616 | #define NVGPU_SCHED_STATUS_TSG_OPEN (1ULL << 0) | ||
| 1617 | |||
| 1618 | struct nvgpu_sched_event_arg { | ||
| 1619 | __u64 reserved; | ||
| 1620 | __u64 status; | ||
| 1621 | }; | ||
| 1622 | |||
| 1500 | #endif | 1623 | #endif |
