Skip to content

Commit 42ff700

Browse files
mikel-armbbgregkh
authored andcommitted
coresight: syscfg: Add registration and feature loading for cs devices
API for individual devices to register with the syscfg management system is added. Devices register with matching information, and any features or configurations that match will be loaded into the device. The feature and configuration loading is extended so that on load these are loaded into any currently registered devices. This allows configuration loading after devices have been registered. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mike Leach <[email protected]> Signed-off-by: Mathieu Poirier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 85e2414 commit 42ff700

File tree

4 files changed

+461
-1
lines changed

4 files changed

+461
-1
lines changed

drivers/hwtracing/coresight/coresight-config.h

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,102 @@ struct cscfg_config_desc {
139139
const u64 *presets; /* nr_presets * nr_total_params */
140140
};
141141

142+
/**
143+
* config register instance - part of a loaded feature.
144+
* maps register values to csdev driver structures
145+
*
146+
* @reg_desc: value to use when setting feature on device / store for
147+
* readback of volatile values.
148+
* @driver_regval: pointer to internal driver element used to set the value
149+
* in hardware.
150+
*/
151+
struct cscfg_regval_csdev {
152+
struct cscfg_regval_desc reg_desc;
153+
void *driver_regval;
154+
};
155+
156+
/**
157+
* config parameter instance - part of a loaded feature.
158+
*
159+
* @feat_csdev: parent feature
160+
* @reg_csdev: register value updated by this parameter.
161+
* @current_value: current value of parameter - may be set by user via
162+
* sysfs, or modified during device operation.
163+
* @val64: true if 64 bit value
164+
*/
165+
struct cscfg_parameter_csdev {
166+
struct cscfg_feature_csdev *feat_csdev;
167+
struct cscfg_regval_csdev *reg_csdev;
168+
u64 current_value;
169+
bool val64;
170+
};
171+
172+
/**
173+
* Feature instance loaded into a CoreSight device.
174+
*
175+
* When a feature is loaded into a specific device, then this structure holds
176+
* the connections between the register / parameter values used and the
177+
* internal data structures that are written when the feature is enabled.
178+
*
179+
* Since applying a feature modifies internal data structures in the device,
180+
* then we have a reference to the device spinlock to protect access to these
181+
* structures (@drv_spinlock).
182+
*
183+
* @feat_desc: pointer to the static descriptor for this feature.
184+
* @csdev: parent CoreSight device instance.
185+
* @node: list entry into feature list for this device.
186+
* @drv_spinlock: device spinlock for access to driver register data.
187+
* @nr_params: number of parameters.
188+
* @params_csdev: current parameter values on this device
189+
* @nr_regs: number of registers to be programmed.
190+
* @regs_csdev: Programming details for the registers
191+
*/
192+
struct cscfg_feature_csdev {
193+
const struct cscfg_feature_desc *feat_desc;
194+
struct coresight_device *csdev;
195+
struct list_head node;
196+
spinlock_t *drv_spinlock;
197+
int nr_params;
198+
struct cscfg_parameter_csdev *params_csdev;
199+
int nr_regs;
200+
struct cscfg_regval_csdev *regs_csdev;
201+
};
202+
203+
/**
204+
* Configuration instance when loaded into a CoreSight device.
205+
*
206+
* The instance contains references to loaded features on this device that are
207+
* used by the configuration.
208+
*
209+
* @config_desc:reference to the descriptor for this configuration
210+
* @csdev: parent coresight device for this configuration instance.
211+
* @enabled: true if configuration is enabled on this device.
212+
* @node: list entry within the coresight device
213+
* @nr_feat: Number of features on this device that are used in the
214+
* configuration.
215+
* @feats_csdev:references to the device features to enable.
216+
*/
217+
struct cscfg_config_csdev {
218+
const struct cscfg_config_desc *config_desc;
219+
struct coresight_device *csdev;
220+
bool enabled;
221+
struct list_head node;
222+
int nr_feat;
223+
struct cscfg_feature_csdev *feats_csdev[0];
224+
};
225+
226+
/**
227+
* Coresight device operations.
228+
*
229+
* Registered coresight devices provide these operations to manage feature
230+
* instances compatible with the device hardware and drivers
231+
*
232+
* @load_feat: Pass a feature descriptor into the device and create the
233+
* loaded feature instance (struct cscfg_feature_csdev).
234+
*/
235+
struct cscfg_csdev_feat_ops {
236+
int (*load_feat)(struct coresight_device *csdev,
237+
struct cscfg_feature_csdev *feat_csdev);
238+
};
239+
142240
#endif /* _CORESIGHT_CORESIGHT_CONFIG_H */

0 commit comments

Comments
 (0)