mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-27 01:55:16 +07:00
9a3d7fd275
Here is the "big" set of driver core patches for 5.5-rc1 There's a few minor cleanups and fixes in here, but the majority of the patches in here fall into two buckets: - debugfs api cleanups and fixes - driver core device link support for boot dependancy issues The debugfs api cleanups are working to slowly refactor the debugfs apis so that it is even harder to use incorrectly. That work has been happening for the past few kernel releases and will continue over time, it's a long-term project/goal The driver core device link support missed 5.4 by just a bit, so it's been sitting and baking for many months now. It's from Saravana Kannan to help resolve the problems that DT-based systems have at boot time with dependancy graphs and kernel modules. Turns out that no one has actually tried to build a generic arm64 kernel with loads of modules and have it "just work" for a variety of platforms (like a distro kernel) The big problem turned out to be a lack of depandancy information between different areas of DT entries, and the work here resolves that problem and now allows devices to boot properly, and quicker than a monolith kernel. All of these patches have been in linux-next for a long time with no reported issues. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -----BEGIN PGP SIGNATURE----- iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCXd6m6Q8cZ3JlZ0Brcm9h aC5jb20ACgkQMUfUDdst+yntJQCcCqg6RQ7LTdHuZv1ETeefXlsfk00An1Jtean6 42bWGx52bGFvAcpjWy8R =P7hq -----END PGP SIGNATURE----- Merge tag 'driver-core-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull driver core updates from Greg KH: "Here is the "big" set of driver core patches for 5.5-rc1 There's a few minor cleanups and fixes in here, but the majority of the patches in here fall into two buckets: - debugfs api cleanups and fixes - driver core device link support for boot dependancy issues The debugfs api cleanups are working to slowly refactor the debugfs apis so that it is even harder to use incorrectly. That work has been happening for the past few kernel releases and will continue over time, it's a long-term project/goal The driver core device link support missed 5.4 by just a bit, so it's been sitting and baking for many months now. It's from Saravana Kannan to help resolve the problems that DT-based systems have at boot time with dependancy graphs and kernel modules. Turns out that no one has actually tried to build a generic arm64 kernel with loads of modules and have it "just work" for a variety of platforms (like a distro kernel). The big problem turned out to be a lack of dependency information between different areas of DT entries, and the work here resolves that problem and now allows devices to boot properly, and quicker than a monolith kernel. All of these patches have been in linux-next for a long time with no reported issues" * tag 'driver-core-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (68 commits) tracing: Remove unnecessary DEBUG_FS dependency of: property: Add device link support for interrupt-parent, dmas and -gpio(s) debugfs: Fix !DEBUG_FS debugfs_create_automount of: property: Add device link support for "iommu-map" of: property: Fix the semantics of of_is_ancestor_of() i2c: of: Populate fwnode in of_i2c_get_board_info() drivers: base: Fix Kconfig indentation firmware_loader: Fix labels with comma for builtin firmware driver core: Allow device link operations inside sync_state() driver core: platform: Declare ret variable only once cpu-topology: declare parse_acpi_topology in <linux/arch_topology.h> crypto: hisilicon: no need to check return value of debugfs_create functions driver core: platform: use the correct callback type for bus_find_device firmware_class: make firmware caching configurable driver core: Clarify documentation for fwnode_operations.add_links() mailbox: tegra: Fix superfluous IRQ error message net: caif: Fix debugfs on 64-bit platforms mac80211: Use debugfs_create_xul() helper media: c8sectpfe: no need to check return value of debugfs_create functions of: property: Add device link support for iommus, mboxes and io-channels ...
174 lines
6.8 KiB
C
174 lines
6.8 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* fwnode.h - Firmware device node object handle type definition.
|
|
*
|
|
* Copyright (C) 2015, Intel Corporation
|
|
* Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
|
|
*/
|
|
|
|
#ifndef _LINUX_FWNODE_H_
|
|
#define _LINUX_FWNODE_H_
|
|
|
|
#include <linux/types.h>
|
|
|
|
struct fwnode_operations;
|
|
struct device;
|
|
|
|
struct fwnode_handle {
|
|
struct fwnode_handle *secondary;
|
|
const struct fwnode_operations *ops;
|
|
struct device *dev;
|
|
};
|
|
|
|
/**
|
|
* struct fwnode_endpoint - Fwnode graph endpoint
|
|
* @port: Port number
|
|
* @id: Endpoint id
|
|
* @local_fwnode: reference to the related fwnode
|
|
*/
|
|
struct fwnode_endpoint {
|
|
unsigned int port;
|
|
unsigned int id;
|
|
const struct fwnode_handle *local_fwnode;
|
|
};
|
|
|
|
#define NR_FWNODE_REFERENCE_ARGS 8
|
|
|
|
/**
|
|
* struct fwnode_reference_args - Fwnode reference with additional arguments
|
|
* @fwnode:- A reference to the base fwnode
|
|
* @nargs: Number of elements in @args array
|
|
* @args: Integer arguments on the fwnode
|
|
*/
|
|
struct fwnode_reference_args {
|
|
struct fwnode_handle *fwnode;
|
|
unsigned int nargs;
|
|
u64 args[NR_FWNODE_REFERENCE_ARGS];
|
|
};
|
|
|
|
/**
|
|
* struct fwnode_operations - Operations for fwnode interface
|
|
* @get: Get a reference to an fwnode.
|
|
* @put: Put a reference to an fwnode.
|
|
* @device_is_available: Return true if the device is available.
|
|
* @device_get_match_data: Return the device driver match data.
|
|
* @property_present: Return true if a property is present.
|
|
* @property_read_int_array: Read an array of integer properties. Return zero on
|
|
* success, a negative error code otherwise.
|
|
* @property_read_string_array: Read an array of string properties. Return zero
|
|
* on success, a negative error code otherwise.
|
|
* @get_name: Return the name of an fwnode.
|
|
* @get_name_prefix: Get a prefix for a node (for printing purposes).
|
|
* @get_parent: Return the parent of an fwnode.
|
|
* @get_next_child_node: Return the next child node in an iteration.
|
|
* @get_named_child_node: Return a child node with a given name.
|
|
* @get_reference_args: Return a reference pointed to by a property, with args
|
|
* @graph_get_next_endpoint: Return an endpoint node in an iteration.
|
|
* @graph_get_remote_endpoint: Return the remote endpoint node of a local
|
|
* endpoint node.
|
|
* @graph_get_port_parent: Return the parent node of a port node.
|
|
* @graph_parse_endpoint: Parse endpoint for port and endpoint id.
|
|
* @add_links: Called after the device corresponding to the fwnode is added
|
|
* using device_add(). The function is expected to create device
|
|
* links to all the suppliers of the device that are available at
|
|
* the time this function is called. The function must NOT stop
|
|
* at the first failed device link if other unlinked supplier
|
|
* devices are present in the system. This is necessary for the
|
|
* driver/bus sync_state() callbacks to work correctly.
|
|
*
|
|
* For example, say Device-C depends on suppliers Device-S1 and
|
|
* Device-S2 and the dependency is listed in that order in the
|
|
* firmware. Say, S1 gets populated from the firmware after
|
|
* late_initcall_sync(). Say S2 is populated and probed way
|
|
* before that in device_initcall(). When C is populated, if this
|
|
* add_links() function doesn't continue past a "failed linking to
|
|
* S1" and continue linking C to S2, then S2 will get a
|
|
* sync_state() callback before C is probed. This is because from
|
|
* the perspective of S2, C was never a consumer when its
|
|
* sync_state() evaluation is done. To avoid this, the add_links()
|
|
* function has to go through all available suppliers of the
|
|
* device (that corresponds to this fwnode) and link to them
|
|
* before returning.
|
|
*
|
|
* If some suppliers are not yet available (indicated by an error
|
|
* return value), this function will be called again when other
|
|
* devices are added to allow creating device links to any newly
|
|
* available suppliers.
|
|
*
|
|
* Return 0 if device links have been successfully created to all
|
|
* the known suppliers of this device or if the supplier
|
|
* information is not known.
|
|
*
|
|
* Return -ENODEV if the suppliers needed for probing this device
|
|
* have not been registered yet (because device links can only be
|
|
* created to devices registered with the driver core).
|
|
*
|
|
* Return -EAGAIN if some of the suppliers of this device have not
|
|
* been registered yet, but none of those suppliers are necessary
|
|
* for probing the device.
|
|
*/
|
|
struct fwnode_operations {
|
|
struct fwnode_handle *(*get)(struct fwnode_handle *fwnode);
|
|
void (*put)(struct fwnode_handle *fwnode);
|
|
bool (*device_is_available)(const struct fwnode_handle *fwnode);
|
|
const void *(*device_get_match_data)(const struct fwnode_handle *fwnode,
|
|
const struct device *dev);
|
|
bool (*property_present)(const struct fwnode_handle *fwnode,
|
|
const char *propname);
|
|
int (*property_read_int_array)(const struct fwnode_handle *fwnode,
|
|
const char *propname,
|
|
unsigned int elem_size, void *val,
|
|
size_t nval);
|
|
int
|
|
(*property_read_string_array)(const struct fwnode_handle *fwnode_handle,
|
|
const char *propname, const char **val,
|
|
size_t nval);
|
|
const char *(*get_name)(const struct fwnode_handle *fwnode);
|
|
const char *(*get_name_prefix)(const struct fwnode_handle *fwnode);
|
|
struct fwnode_handle *(*get_parent)(const struct fwnode_handle *fwnode);
|
|
struct fwnode_handle *
|
|
(*get_next_child_node)(const struct fwnode_handle *fwnode,
|
|
struct fwnode_handle *child);
|
|
struct fwnode_handle *
|
|
(*get_named_child_node)(const struct fwnode_handle *fwnode,
|
|
const char *name);
|
|
int (*get_reference_args)(const struct fwnode_handle *fwnode,
|
|
const char *prop, const char *nargs_prop,
|
|
unsigned int nargs, unsigned int index,
|
|
struct fwnode_reference_args *args);
|
|
struct fwnode_handle *
|
|
(*graph_get_next_endpoint)(const struct fwnode_handle *fwnode,
|
|
struct fwnode_handle *prev);
|
|
struct fwnode_handle *
|
|
(*graph_get_remote_endpoint)(const struct fwnode_handle *fwnode);
|
|
struct fwnode_handle *
|
|
(*graph_get_port_parent)(struct fwnode_handle *fwnode);
|
|
int (*graph_parse_endpoint)(const struct fwnode_handle *fwnode,
|
|
struct fwnode_endpoint *endpoint);
|
|
int (*add_links)(const struct fwnode_handle *fwnode,
|
|
struct device *dev);
|
|
};
|
|
|
|
#define fwnode_has_op(fwnode, op) \
|
|
((fwnode) && (fwnode)->ops && (fwnode)->ops->op)
|
|
#define fwnode_call_int_op(fwnode, op, ...) \
|
|
(fwnode ? (fwnode_has_op(fwnode, op) ? \
|
|
(fwnode)->ops->op(fwnode, ## __VA_ARGS__) : -ENXIO) : \
|
|
-EINVAL)
|
|
|
|
#define fwnode_call_bool_op(fwnode, op, ...) \
|
|
(fwnode_has_op(fwnode, op) ? \
|
|
(fwnode)->ops->op(fwnode, ## __VA_ARGS__) : false)
|
|
|
|
#define fwnode_call_ptr_op(fwnode, op, ...) \
|
|
(fwnode_has_op(fwnode, op) ? \
|
|
(fwnode)->ops->op(fwnode, ## __VA_ARGS__) : NULL)
|
|
#define fwnode_call_void_op(fwnode, op, ...) \
|
|
do { \
|
|
if (fwnode_has_op(fwnode, op)) \
|
|
(fwnode)->ops->op(fwnode, ## __VA_ARGS__); \
|
|
} while (false)
|
|
#define get_dev_from_fwnode(fwnode) get_device((fwnode)->dev)
|
|
|
|
#endif
|