ISARef Multi-ISA & Silicon Reference
45,419 ISA items · 105,907 timings · 913 microarchs · 15,555 chips · 105 sources
Arch:
Tier:

srmcfg

T1 riscv register register
Supervisor Resource Management Configuration
SourceRISC-V Official Unified Database (riscv-unified-db) (riscv_unified_db)
Reliability TierT1 — Official Specification
ISA / Silicon ScopeRISC-V Privileged (Ssqosid)
RV32 / RV64 (Ratified & Standard Extensions)
License & VersionApache-2.0 / CC-BY-4.0
main
Upstreamhttps://github.com/riscv/riscv-unified-db
PrivilegeS
ExtensionsSsqosid

Summary

The srmcfg register is used to configure a Resource Control ID (RCID) and a Monitoring Counter ID (MCID). Both RCID and MCID are WARL fields.

Syntax / Encoding

CSR 0x181 (S-mode, RW)

Bitfields (2)

BitsFieldDescription
27:16MCIDThe MCID is used to identify a counter to monitor resource usage.
11:0RCIDThe RCID is used to determine the resource allocations (e.g., cache occupancy limits, memory bandwidth limits, etc.) to enforce.

Reference Notes

The `srmcfg` register is used to configure a Resource Control ID (`RCID`) and a Monitoring Counter ID (`MCID`).
Both `RCID` and `MCID` are WARL fields.

The `RCID` and `MCID` accompany each request made by the hart to shared resource controllers.
The `RCID` is used to determine the resource allocations (e.g., cache occupancy limits, memory bandwidth limits, etc.) to enforce.
The `MCID` is used to identify a counter to monitor resource usage.

The `RCID` and `MCID` configured in the `srmcfg` CSR apply to all privilege modes of software execution on that hart by default,
but this behavior may be overridden by future extensions.

If extension `Smstateen` is implemented together with `Ssqosid`, then `Ssqosid` also requires the `SRMCFG` bit in `mstateen0` to be implemented.
If `mstateen0.SRMCFG` is `0`, attempts to access `srmcfg` in privilege modes less privileged than M-mode raise an illegal-instruction exception.

If `mstateen0.SRMCFG` is `1` or if extension `Smstateen` is not implemented, attempts to access `srmcfg` when `V=1` raise a virtual-instruction exception.

A reset value of `0` is suggested for the `RCID` field, matching resource controllers' default behavior of associating all capacity with `RCID=0`.

The `MCID` reset value does not affect functionality and may be implementation-defined.

Typically, fewer bits are allocated for `RCID` (e.g., to support tens of `RCID`s) than for `MCID` (e.g., to support hundreds of `MCID`s).

A common `RCID` is usually used to group apps or VMs, pooling resource allocations to meet collective SLAs.

If an SLA breach occurs, unique `MCID`s enable granular monitoring, aiding decisions on resource adjustment,
associating a different `RCID` with a subset of members, or migrating members to other machines.
The larger pool of `MCID`s speeds up this analysis.

The `RCID` and `MCID` in `srmcfg` apply across all privilege levels on the hart.
Typically, higher-privilege modes don't modify `srmcfg`, as they often serve lower-privileged tasks.
If differentiation is needed, higher privilege code can update `srmcfg` and restore it before returning to a lower privilege level.

In VM environments, hypervisors usually manage resource allocations, keeping the Guest OS out of QoS flows.
If needed, the hypervisor can virtualize the `srmcfg` CSR for a VM using the virtual-instruction exceptions triggered upon Guest access.

If the direct selection of `RCID` and `MCID` by the VM becomes common and emulation overhead is an issue,
future extensions may allow VS-mode to use a selector for a hypervisor-configured set of CSRs holding `RCID` and `MCID` values designated for that Guest OS use.

During context switches, the supervisor may choose to execute with the `srmcfg` of the outgoing context to attribute the execution to it.
Prior to restoring the new context, it switches to the new VM’s `srmcfg`.
The supervisor can also use a separate configuration for execution not to be attributed to either context.