mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 00:30:52 +07:00
7d374b2090
There is a repeated pattern in multiple drivers where they want to switch the bandwidth between zero and some other value. This is happening often in the suspend/resume callbacks. Let's add helper functions to enable and disable the path, so that callers don't have to take care of remembering the bandwidth values and handle this in the framework instead. With this patch the users can call icc_disable() and icc_enable() to lower their bandwidth request to zero and then restore it back to it's previous value. Suggested-by: Evan Green <evgreen@chromium.org> Suggested-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org> Reviewed-by: Matthias Kaehlcke <mka@chromium.org> Link: https://lore.kernel.org/r/20200507120846.8354-1-georgi.djakov@linaro.org Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
45 lines
1.2 KiB
C
45 lines
1.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Interconnect framework internal structs
|
|
*
|
|
* Copyright (c) 2019, Linaro Ltd.
|
|
* Author: Georgi Djakov <georgi.djakov@linaro.org>
|
|
*/
|
|
|
|
#ifndef __DRIVERS_INTERCONNECT_INTERNAL_H
|
|
#define __DRIVERS_INTERCONNECT_INTERNAL_H
|
|
|
|
/**
|
|
* struct icc_req - constraints that are attached to each node
|
|
* @req_node: entry in list of requests for the particular @node
|
|
* @node: the interconnect node to which this constraint applies
|
|
* @dev: reference to the device that sets the constraints
|
|
* @enabled: indicates whether the path with this request is enabled
|
|
* @tag: path tag (optional)
|
|
* @avg_bw: an integer describing the average bandwidth in kBps
|
|
* @peak_bw: an integer describing the peak bandwidth in kBps
|
|
*/
|
|
struct icc_req {
|
|
struct hlist_node req_node;
|
|
struct icc_node *node;
|
|
struct device *dev;
|
|
bool enabled;
|
|
u32 tag;
|
|
u32 avg_bw;
|
|
u32 peak_bw;
|
|
};
|
|
|
|
/**
|
|
* struct icc_path - interconnect path structure
|
|
* @name: a string name of the path (useful for ftrace)
|
|
* @num_nodes: number of hops (nodes)
|
|
* @reqs: array of the requests applicable to this path of nodes
|
|
*/
|
|
struct icc_path {
|
|
const char *name;
|
|
size_t num_nodes;
|
|
struct icc_req reqs[];
|
|
};
|
|
|
|
#endif
|