Skip to content
Snippets Groups Projects
  • Drew Fustini's avatar
    84a6d21b
    RISC-V: Add support for sqoscfg CSR · 84a6d21b
    Drew Fustini authored
    Add support for the sqoscfg CSR defined in the Ssqosid ISA extension
    (Supervisor-mode Quality of Service ID). The CSR contains two fields:
    
      - Resource Control ID (RCID) used determine resource allocation
      - Monitoring Counter ID (MCID) used to track resource usage
    
    Requests from a hart to shared resources like cache will be tagged with
    these IDs. This allows the usage of shared resources to be associated
    with the task currently running on the hart.
    
    A sqoscfg field is added to thread_struct and has the same format as the
    sqoscfg CSR. This allows the scheduler to set the hart's sqoscfg CSR to
    contain the RCID and MCID for the task that is being scheduled in. The
    sqoscfg CSR is only written to if the thread_struct.sqoscfg is different
    from the current value of the CSR.
    
    A per-cpu variable cpu_sqoscfg is used to mirror that state of the CSR.
    This is because access to L1D hot memory should be several times faster
    than a CSR read. Also, in the case of virtualization, accesses to this
    CSR are trapped in the hypervisor.
    
    Link: https://github.com/riscv-non-isa/riscv-cbqri/blob/main/riscv-cbqri.pdf
    
    
    Co-developed-by: default avatarKornel Dulęba <mindal@semihalf.com>
    Signed-off-by: default avatarKornel Dulęba <mindal@semihalf.com>
    Signed-off-by: default avatarDrew Fustini <dfustini@baylibre.com>
    84a6d21b
    History
    RISC-V: Add support for sqoscfg CSR
    Drew Fustini authored
    Add support for the sqoscfg CSR defined in the Ssqosid ISA extension
    (Supervisor-mode Quality of Service ID). The CSR contains two fields:
    
      - Resource Control ID (RCID) used determine resource allocation
      - Monitoring Counter ID (MCID) used to track resource usage
    
    Requests from a hart to shared resources like cache will be tagged with
    these IDs. This allows the usage of shared resources to be associated
    with the task currently running on the hart.
    
    A sqoscfg field is added to thread_struct and has the same format as the
    sqoscfg CSR. This allows the scheduler to set the hart's sqoscfg CSR to
    contain the RCID and MCID for the task that is being scheduled in. The
    sqoscfg CSR is only written to if the thread_struct.sqoscfg is different
    from the current value of the CSR.
    
    A per-cpu variable cpu_sqoscfg is used to mirror that state of the CSR.
    This is because access to L1D hot memory should be several times faster
    than a CSR read. Also, in the case of virtualization, accesses to this
    CSR are trapped in the hypervisor.
    
    Link: https://github.com/riscv-non-isa/riscv-cbqri/blob/main/riscv-cbqri.pdf
    
    
    Co-developed-by: default avatarKornel Dulęba <mindal@semihalf.com>
    Signed-off-by: default avatarKornel Dulęba <mindal@semihalf.com>
    Signed-off-by: default avatarDrew Fustini <dfustini@baylibre.com>