@@ -52,95 +52,138 @@ enum pmu_metrics {
52
52
53
53
// Enum for message types between user space and kernel module
54
54
enum dpf_msg_type {
55
- DPF_MSG_INIT = 0 , // API version negotiation
56
- DPF_MSG_CORE_RANGE = 1 , // Core range configuration
57
- DPF_MSG_DDRBW_SET = 2 , // DDR bandwidth setting
58
- DPF_MSG_CORE_WEIGHT = 3 ,// Core weight assignment
59
- DPF_MSG_TUNING = 4 , // Tuning control
60
- DPF_MSG_MSR_READ = 5 , // Read MSR values
61
- DPF_MSG_PMU_READ = 6 // Read PMU values
62
- };
63
-
64
- // Message structures
55
+ DPF_MSG_INIT = 0 , // API version negotiation
56
+ DPF_MSG_CORE_RANGE = 1 , // Core range configuration
57
+ DPF_MSG_DDRBW_SET = 2 , // DDR bandwidth setting
58
+ DPF_MSG_CORE_WEIGHT = 3 , // Core weight assignment
59
+ DPF_MSG_TUNING = 4 , // Tuning control
60
+ DPF_MSG_MSR_READ = 5 , // Read MSR values
61
+ DPF_MSG_PMU_READ = 6 , // Read PMU values
62
+ DPF_MSG_DDR_CONFIG = 7 , // DDR configuration
63
+ DPF_MSG_DDR_BW_READ = 8 //DDR BW READ
64
+ };
65
+
66
+ // Common message header
65
67
struct dpf_msg_header {
66
68
__u32 type ; // Message type (from dpf_msg_type)
67
69
__u32 payload_size ; // Size of payload following the header
68
70
};
69
71
72
+ // Request structure for API version
70
73
struct dpf_req_init {
71
74
struct dpf_msg_header header ;
72
75
};
73
76
77
+ // Response structure for API version
74
78
struct dpf_resp_init {
75
79
struct dpf_msg_header header ;
76
80
__u32 version ; // Returned API version
77
81
};
78
82
83
+ // Request structure for core range
79
84
struct dpf_core_range {
80
85
struct dpf_msg_header header ;
81
86
__u32 core_start ; // First core in range
82
87
__u32 core_end ; // Last core in range
83
88
};
84
89
90
+ // Response structure for core range
85
91
struct dpf_resp_core_range {
86
92
struct dpf_msg_header header ;
87
93
__u32 core_start ; // Confirmed first core
88
94
__u32 core_end ; // Confirmed last core
89
95
__u32 thread_count ; // Number of threads (cores) in range
90
96
};
91
97
98
+ // Request structure for core weights
92
99
struct dpf_core_weight {
93
100
struct dpf_msg_header header ;
94
101
__u32 count ; // Number of weights
95
102
__u32 weights []; // Flexible array of core weights
96
103
};
97
104
105
+ // Response structure for core weights
98
106
struct dpf_resp_core_weight {
99
107
struct dpf_msg_header header ;
100
108
__u32 count ; // Number of confirmed weights
101
109
__u32 confirmed_weights []; // Flexible array of confirmed weights
102
110
};
103
111
112
+ // Request structure for tuning
104
113
struct dpf_req_tuning {
105
114
struct dpf_msg_header header ;
106
115
__u32 enable ; // Enable tuning (non-zero) or disable (0)
107
116
};
108
117
118
+ // Response structure for tuning
109
119
struct dpf_resp_tuning {
110
120
struct dpf_msg_header header ;
111
121
__u32 status ; // Tuning status (e.g., enabled/disabled)
112
122
};
113
123
124
+ // Request structure for DDR bandwidth setting
114
125
struct dpf_ddrbw_set {
115
126
struct dpf_msg_header header ;
116
127
__u32 set_value ; // DDR bandwidth value to set (MB/s)
117
128
};
118
129
130
+ // Response structure for DDR bandwidth setting
119
131
struct dpf_resp_ddrbw_set {
120
132
struct dpf_msg_header header ;
121
133
__u32 confirmed_value ; // Confirmed DDR bandwidth value
122
134
};
123
135
136
+ // Request structure for MSR read
124
137
struct dpf_msr_read {
125
138
struct dpf_msg_header header ;
126
139
__u32 core_id ; // Core ID to read MSRs from
127
140
};
128
141
142
+ // Response structure for MSR read
129
143
struct dpf_resp_msr_read {
130
144
struct dpf_msg_header header ;
131
145
__u64 msr_values [NR_OF_MSR ]; // Array of MSR values
132
146
};
133
147
148
+ // Request structure for PMU read
134
149
struct dpf_pmu_read {
135
150
struct dpf_msg_header header ;
136
151
__u32 core_id ; // Core ID to read PMU from
137
152
};
138
153
154
+ // Response structure for PMU read
139
155
struct dpf_resp_pmu_read {
140
156
struct dpf_msg_header header ;
141
157
__u64 pmu_values [PMU_COUNTERS ]; // Array of PMU counter values
142
158
};
143
159
160
+ // Request structure for DDR configuration
161
+ struct dpf_ddr_config {
162
+ struct dpf_msg_header header ;
163
+ __u64 bar_address ; // BAR address for DDR config space
164
+ __u32 cpu_type ; // CPU type (e.g., DDR_CLIENT, DDR_GRR_SRF)
165
+ __u32 num_controllers ; // Number of DDR controllers
166
+ };
167
+
168
+ // Response structure for DDR configuration
169
+ struct dpf_resp_ddr_config {
170
+ struct dpf_msg_header header ;
171
+ __u64 confirmed_bar ; // Confirmed BAR address
172
+ __u32 confirmed_type ; // Confirmed CPU type
173
+ };
174
+
175
+ // Request structure for reading DDR bandwidth
176
+ struct dpf_ddr_bw_read {
177
+ struct dpf_msg_header header ;
178
+ };
179
+
180
+ // Response structure for reading DDR bandwidth
181
+ struct dpf_resp_ddr_bw_read {
182
+ struct dpf_msg_header header ;
183
+ uint64_t read_bw ;
184
+ uint64_t write_bw ;
185
+ };
186
+
144
187
// Core state structure
145
188
struct core_state_s {
146
189
uint64_t pmu_result [PMU_COUNTERS ]; // Delta since last PMU read (mapped to pmu_metrics)
@@ -160,6 +203,7 @@ int msr_load(int core_id);
160
203
int msr_update (int core_id );
161
204
int pmu_update (int core_id );
162
205
206
+ // Functions for reading and writing MSRs
163
207
int msr_set_l2xq (int core_id , int value );
164
208
int msr_get_l2xq (int core_id );
165
209
int msr_set_l3xq (int core_id , int value );
0 commit comments