nman external-symbol improvements
Driver model memory-usage reporting
patman test-reporting improvements
Add bloblist design goals
This commit is contained in:
Tom Rini
2022-07-08 14:39:07 -04:00
59 changed files with 1694 additions and 380 deletions

View File

@@ -11,6 +11,7 @@
#define _DM_DEVICE_H
#include <dm/ofnode.h>
#include <dm/tag.h>
#include <dm/uclass-id.h>
#include <fdtdec.h>
#include <linker_lists.h>
@@ -546,6 +547,30 @@ void *dev_get_parent_priv(const struct udevice *dev);
*/
void *dev_get_uclass_priv(const struct udevice *dev);
/**
* dev_get_attach_ptr() - Get the value of an attached pointed tag
*
* The tag is assumed to hold a pointer, if it exists
*
* @dev: Device to look at
* @tag: Tag to access
* @return value of tag, or NULL if there is no tag of this type
*/
void *dev_get_attach_ptr(const struct udevice *dev, enum dm_tag_t tag);
/**
* dev_get_attach_size() - Get the size of an attached tag
*
* Core tags have an automatic-allocation mechanism where the allocated size is
* defined by the device, parent or uclass. This returns the size associated
* with a particular tag
*
* @dev: Device to look at
* @tag: Tag to access
* @return size of auto-allocated data, 0 if none
*/
int dev_get_attach_size(const struct udevice *dev, enum dm_tag_t tag);
/**
* dev_get_parent() - Get the parent of a device
*

View File

@@ -1181,6 +1181,33 @@ int ofnode_write_string(ofnode node, const char *propname, const char *value);
*/
int ofnode_set_enabled(ofnode node, bool value);
/**
* ofnode_get_phy_node() - Get PHY node for a MAC (if not fixed-link)
*
* This function parses PHY handle from the Ethernet controller's ofnode
* (trying all possible PHY handle property names), and returns the PHY ofnode.
*
* Before this is used, ofnode_phy_is_fixed_link() should be checked first, and
* if the result to that is true, this function should not be called.
*
* @eth_node: ofnode belonging to the Ethernet controller
* Return: ofnode of the PHY, if it exists, otherwise an invalid ofnode
*/
ofnode ofnode_get_phy_node(ofnode eth_node);
/**
* ofnode_read_phy_mode() - Read PHY connection type from a MAC node
*
* This function parses the "phy-mode" / "phy-connection-type" property and
* returns the corresponding PHY interface type.
*
* @mac_node: ofnode containing the property
* Return: one of PHY_INTERFACE_MODE_* constants, PHY_INTERFACE_MODE_NA on
* error
*/
phy_interface_t ofnode_read_phy_mode(ofnode mac_node);
#if CONFIG_IS_ENABLED(DM)
/**
* ofnode_conf_read_bool() - Read a boolean value from the U-Boot config
*
@@ -1218,30 +1245,21 @@ int ofnode_conf_read_int(const char *prop_name, int default_val);
*/
const char *ofnode_conf_read_str(const char *prop_name);
/**
* ofnode_get_phy_node() - Get PHY node for a MAC (if not fixed-link)
*
* This function parses PHY handle from the Ethernet controller's ofnode
* (trying all possible PHY handle property names), and returns the PHY ofnode.
*
* Before this is used, ofnode_phy_is_fixed_link() should be checked first, and
* if the result to that is true, this function should not be called.
*
* @eth_node: ofnode belonging to the Ethernet controller
* Return: ofnode of the PHY, if it exists, otherwise an invalid ofnode
*/
ofnode ofnode_get_phy_node(ofnode eth_node);
#else /* CONFIG_DM */
static inline bool ofnode_conf_read_bool(const char *prop_name)
{
return false;
}
/**
* ofnode_read_phy_mode() - Read PHY connection type from a MAC node
*
* This function parses the "phy-mode" / "phy-connection-type" property and
* returns the corresponding PHY interface type.
*
* @mac_node: ofnode containing the property
* Return: one of PHY_INTERFACE_MODE_* constants, PHY_INTERFACE_MODE_NA on
* error
*/
phy_interface_t ofnode_read_phy_mode(ofnode mac_node);
static inline int ofnode_conf_read_int(const char *prop_name, int default_val)
{
return default_val;
}
static inline const char *ofnode_conf_read_str(const char *prop_name)
{
return NULL;
}
#endif /* CONFIG_DM */
#endif

View File

@@ -9,11 +9,49 @@
#ifndef _DM_ROOT_H_
#define _DM_ROOT_H_
#include <dm/tag.h>
struct udevice;
/* Head of the uclass list if CONFIG_OF_PLATDATA_INST is enabled */
extern struct list_head uclass_head;
/**
* struct dm_stats - Information about driver model memory usage
*
* @total_size: All data
* @dev_count: Number of devices
* @dev_size: Size of all devices (just the struct udevice)
* @dev_name_size: Bytes used by device names
* @uc_count: Number of uclasses
* @uc_size: Size of all uclasses (just the struct uclass)
* @tag_count: Number of tags
* @tag_size: Bytes used by all tags
* @uc_attach_count: Number of uclasses with attached data (priv)
* @uc_attach_size: Total size of that attached data
* @attach_count_total: Total number of attached data items for all udevices and
* uclasses
* @attach_size_total: Total number of bytes of attached data
* @attach_count: Number of devices with attached, for each type
* @attach_size: Total number of bytes of attached data, for each type
*/
struct dm_stats {
int total_size;
int dev_count;
int dev_size;
int dev_name_size;
int uc_count;
int uc_size;
int tag_count;
int tag_size;
int uc_attach_count;
int uc_attach_size;
int attach_count_total;
int attach_size_total;
int attach_count[DM_TAG_ATTACH_COUNT];
int attach_size[DM_TAG_ATTACH_COUNT];
};
/**
* dm_root() - Return pointer to the top of the driver tree
*
@@ -141,4 +179,11 @@ static inline int dm_remove_devices_flags(uint flags) { return 0; }
*/
void dm_get_stats(int *device_countp, int *uclass_countp);
/**
* dm_get_mem() - Get stats on memory usage in driver model
*
* @stats: Place to put the information
*/
void dm_get_mem(struct dm_stats *stats);
#endif

View File

@@ -10,11 +10,23 @@
#include <linux/list.h>
#include <linux/types.h>
struct dm_stats;
struct udevice;
enum dm_tag_t {
/* Types of core tags that can be attached to devices */
DM_TAG_PLAT,
DM_TAG_PARENT_PLAT,
DM_TAG_UC_PLAT,
DM_TAG_PRIV,
DM_TAG_PARENT_PRIV,
DM_TAG_UC_PRIV,
DM_TAG_DRIVER_DATA,
DM_TAG_ATTACH_COUNT,
/* EFI_LOADER */
DM_TAG_EFI = 0,
DM_TAG_EFI = DM_TAG_ATTACH_COUNT,
DM_TAG_COUNT,
};
@@ -107,4 +119,22 @@ int dev_tag_del(struct udevice *dev, enum dm_tag_t tag);
*/
int dev_tag_del_all(struct udevice *dev);
/**
* dev_tag_collect_stats() - Collect information on driver model performance
*
* This collects information on how driver model is performing. For now it only
* includes memory usage
*
* @stats: Place to put the collected information
*/
void dev_tag_collect_stats(struct dm_stats *stats);
/**
* tag_get_name() - Get the name of a tag
*
* @tag: Tag to look up, which must be valid
* Returns: Name of tag
*/
const char *tag_get_name(enum dm_tag_t tag);
#endif /* _DM_TAG_H */

View File

@@ -92,6 +92,13 @@ struct dm_test_uclass_priv {
int total_add;
};
/**
* struct dm_test_uclass_plat - private plat data for test uclass
*/
struct dm_test_uclass_plat {
char dummy[32];
};
/**
* struct dm_test_parent_data - parent's information on each child
*

View File

@@ -6,6 +6,8 @@
#ifndef __DM_UTIL_H
#define __DM_UTIL_H
struct dm_stats;
#if CONFIG_IS_ENABLED(DM_WARN)
#define dm_warn(fmt...) log(LOGC_DM, LOGL_WARNING, ##fmt)
#else
@@ -25,7 +27,7 @@ struct list_head;
int list_count_items(struct list_head *head);
/* Dump out a tree of all devices */
void dm_dump_all(void);
void dm_dump_tree(void);
/* Dump out a list of uclasses and their devices */
void dm_dump_uclass(void);
@@ -48,6 +50,13 @@ void dm_dump_driver_compat(void);
/* Dump out a list of drivers with static platform data */
void dm_dump_static_driver_info(void);
/**
* dm_dump_mem() - Dump stats on memory usage in driver model
*
* @mem: Stats to dump
*/
void dm_dump_mem(struct dm_stats *stats);
#if CONFIG_IS_ENABLED(OF_PLATDATA_INST) && CONFIG_IS_ENABLED(READ_ONLY)
void *dm_priv_to_rw(void *priv);
#else