# SPDX-License-Identifier: GPL-2.0

config XCU_SCHEDULER
    bool "Enable XSched functionality"
    default n
    select XCU_VSTREAM
    select XCU_SCHED_RT
    help
      This option enables the XSched scheduler, a custom scheduling mechanism
      designed for heterogeneous compute units (e.g., XPUs). It provides:
      - Priority-based task scheduling with latency-sensitive optimizations.
      - Integration with cgroups (via CGROUP_XCU) for resource isolation.

      Enable this only if your system requires advanced scheduling for XPU workloads.
      If unsure, say N.

config XCU_VSTREAM
    bool "Enable vstream SQ/CQ buffers maintaining for XPU"
    default n
    depends on XCU_SCHEDULER
    help
      This option enables virtual stream (vstream) support for XPUs, managing
      submission queues (SQ) and completion queues (CQ) in kernel space. Key features:
      - Zero-copy buffer management between user and kernel space.
      - Batch processing of XPU commands to reduce MMIO overhead.

      Requires XCU_SCHEDULER to be enabled. May increase kernel memory usage.
      Recommended for high-throughput XPU workloads. If unsure, say N.

config XSCHED_NR_CUS
    int "Number of CUs (a.k.a. XCUs) available to XSched mechanism"
    default 128
    depends on XCU_SCHEDULER
    help
      This option defines the maximum number of Compute Units (CUs) that can be
      managed by the XSched scheduler, consider changing this value proportionally
      to the number of available XCU cores.

config XCU_SCHED_RT
    bool "XCU RT scheduling class"
    default y
    depends on XCU_SCHEDULER
    help
      Enable support for the RT scheduling class in the XCU scheduler.

      This option allows XCU to schedule tasks using real-time priorities
      (XSCHED_TYPE_RT). When enabled, tasks in RT cgroups can be assigned
      deterministic priorities and will be scheduled ahead of CFS tasks.

      Unless you are using RT workloads that rely on strict priority-based
      scheduling within XCU, it is recommended to keep the default setting.

config XCU_SCHED_CFS
    bool "XCU CFS scheduling class"
    default n
    depends on XCU_SCHEDULER
    select CGROUP_XCU
    help
      Enable support for the CFS scheduling class in the XCU scheduler.

      This option allows the XCU scheduler to manage tasks using a fair-share
      scheduling model similar to the Completely Fair Scheduler (CFS).
      XCU-CFS provides proportional CPU sharing based on weights and supports
      hierarchical control through cgroups.

      Enable this option if you want to run workloads that rely on fair,
      weight-based CPU distribution within the XCU scheduling framework.
      If your workload does not require proportional sharing or uses only the
      RT scheduling class, you may leave this disabled.

config CGROUP_XCU
    bool "XCU bandwidth control and group scheduling for xsched_cfs"
    default n
    depends on XCU_SCHEDULER && XCU_SCHED_CFS
    help
      This option enables the extended Compute Unit (XCU) resource controller for
      CFS task groups, providing hierarchical scheduling and fine-grained bandwidth
      allocation capabilities. Key features include:
      - Proportional XCU time distribution across cgroups based on shares/quotas
      - Nested group scheduling with latency isolation
      - Integration with xsched_cfs for fair CPU resource management

      KABI impact:
      Enabling this option adds a new xsched entry (SUBSYS(xcu)) into
      cgroup_subsys.h, which increases CGROUP_SUBSYS_COUNT in enum
      cgroup_subsys_id. This change directly affects the layout of core
      kernel structures such as struct css_set (subsys, e_cset_node) and
      struct cgroup (subsys, e_csets). Since these structures are widely
      referenced by multiple interfaces, enabling this option will
      introduce extensive KABI changes.

      Required for systems requiring fine-grained resource control in cgroups.
      If unsure, say N.
