geopm  3.1.1.dev296+g5916b956
GEOPM - Global Extensible Open Power Manager
MSRIO.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 - 2024 Intel Corporation
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
6 #ifndef MSRIO_HPP_INCLUDE
7 #define MSRIO_HPP_INCLUDE
8 
9 #include <cstdint>
10 #include <vector>
11 #include <memory>
12 
13 namespace geopm
14 {
15  class MSRIO
16  {
17  public:
18  enum m_driver_e {
22  };
23 
24  MSRIO() = default;
25  virtual ~MSRIO() = default;
31  virtual uint64_t read_msr(int cpu_idx,
32  uint64_t offset) = 0;
45  virtual void write_msr(int cpu_idx,
46  uint64_t offset,
47  uint64_t raw_value,
48  uint64_t write_mask) = 0;
52  virtual int create_batch_context(void) = 0;
60  virtual int add_read(int cpu_idx, uint64_t offset) = 0;
68  virtual int add_read(int cpu_idx, uint64_t offset, int batch_ctx) = 0;
74  virtual void read_batch(void) = 0;
80  virtual void read_batch(int batch_ctx) = 0;
90  virtual int add_write(int cpu_idx, uint64_t offset) = 0;
100  virtual int add_write(int cpu_idx, uint64_t offset, int batch_ctx) = 0;
104  virtual void adjust(int batch_idx,
105  uint64_t value,
106  uint64_t write_mask) = 0;
111  virtual void adjust(int batch_idx,
112  uint64_t value,
113  uint64_t write_mask,
114  int batch_ctx) = 0;
120  virtual uint64_t sample(int batch_idx) const = 0;
127  virtual uint64_t sample(int batch_idx, int batch_ctx) const = 0;
130  virtual void write_batch(void) = 0;
133  virtual void write_batch(int batch_ctx) = 0;
136  static std::unique_ptr<MSRIO> make_unique(int driver_type);
141  virtual uint64_t system_write_mask(uint64_t offset) = 0;
142  };
143 }
144 
145 #endif
Definition: MSRIO.hpp:16
virtual void read_batch(int batch_ctx)=0
Batch read a set of MSRs configured by a previous call to the batch_config() method....
virtual uint64_t read_msr(int cpu_idx, uint64_t offset)=0
Read from a single MSR on a CPU.
virtual uint64_t sample(int batch_idx) const =0
Read the full 64-bit value of the MSR that was previously added to the MSRIO with add_read()....
virtual uint64_t system_write_mask(uint64_t offset)=0
Return the system write mask for a given offset.
virtual int add_read(int cpu_idx, uint64_t offset, int batch_ctx)=0
Extend the set of MSRs for batch read with a single offset.
virtual int create_batch_context(void)=0
Add a new batch context to the set of managed contexts.
virtual ~MSRIO()=default
virtual int add_read(int cpu_idx, uint64_t offset)=0
Extend the set of MSRs for batch read with a single offset. Note: uses the default batch context.
virtual void write_msr(int cpu_idx, uint64_t offset, uint64_t raw_value, uint64_t write_mask)=0
Write to a single MSR on a CPU.
virtual uint64_t sample(int batch_idx, int batch_ctx) const =0
Read the full 64-bit value of the MSR that was previously added to the MSRIO with add_read()....
virtual int add_write(int cpu_idx, uint64_t offset)=0
Add another offset to the list of MSRs to be written in batch. Note: uses the default batch context.
static std::unique_ptr< MSRIO > make_unique(int driver_type)
Returns a unique_ptr to a concrete object constructed using the underlying implementation.
Definition: MSRIO.cpp:30
virtual void write_batch(void)=0
Write all adjusted values. Note: uses the default batch context.
virtual void read_batch(void)=0
Batch read a set of MSRs configured by a previous call to the batch_config() method....
virtual void write_batch(int batch_ctx)=0
Write all adjusted values.
virtual void adjust(int batch_idx, uint64_t value, uint64_t write_mask, int batch_ctx)=0
Adjust a value that was previously added with the add_write() method.
virtual int add_write(int cpu_idx, uint64_t offset, int batch_ctx)=0
Add another offset to the list of MSRs to be written in batch.
m_driver_e
Definition: MSRIO.hpp:18
@ M_DRIVER_MSR
Definition: MSRIO.hpp:20
@ M_NUM_DRIVER
Definition: MSRIO.hpp:21
@ M_DRIVER_MSRSAFE
Definition: MSRIO.hpp:19
virtual void adjust(int batch_idx, uint64_t value, uint64_t write_mask)=0
Adjust a value that was previously added with the add_write() method. Note: uses the default batch co...
MSRIO()=default
Definition: Agg.cpp:20