// SPDX-License-Identifier: GPL-2.0-only /* Copyright(c) 2022 Intel Corporation. All rights reserved. */ #include <linux/debugfs.h> #include <linux/device.h> #include <linux/module.h> #include <linux/pci.h>
#include"cxlmem.h" #include"cxlpci.h"
/** * DOC: cxl mem * * CXL memory endpoint devices and switches are CXL capable devices that are * participating in CXL.mem protocol. Their functionality builds on top of the * CXL.io protocol that allows enumerating and configuring components via * standard PCI mechanisms. * * The cxl_mem driver owns kicking off the enumeration of this CXL.mem * capability. With the detection of a CXL capable endpoint, the driver will * walk up to find the platform specific port it is connected to, and determine * if there are intervening switches in the path. If there are switches, a * secondary action is to enumerate those (implemented in cxl_core). Finally the * cxl_mem driver adds the device it is bound to as a CXL endpoint-port for use * in higher level operations.
*/
/* * Now that the path to the root is established record all the * intervening ports in the chain.
*/ for (iter = parent_port, down = NULL; !is_cxl_root(iter);
down = iter, iter = to_cxl_port(iter->dev.parent)) { struct cxl_ep *ep;
ep = cxl_ep_load(iter, cxlmd);
ep->next = down;
}
/* Note: endpoint port component registers are derived from @cxlds */
endpoint = devm_cxl_add_port(host, &cxlmd->dev, CXL_RESOURCE_NONE,
parent_dport); if (IS_ERR(endpoint)) return PTR_ERR(endpoint);
rc = cxl_endpoint_autoremove(cxlmd, endpoint); if (rc) return rc;
/* * Someone is trying to reattach this device after it lost its port * connection (an endpoint port previously registered by this memdev was * disabled). This racy check is ok because if the port is still gone, * no harm done, and if the port hierarchy comes back it will re-trigger * this probe. Port rescan and memdev detach work share the same * single-threaded workqueue.
*/ if (work_pending(&cxlmd->detach_work)) return -EBUSY;
/* * The kernel may be operating out of CXL memory on this device, * there is no spec defined way to determine whether this device * preserves contents over suspend, and there is no simple way * to arrange for the suspend image to avoid CXL memory which * would setup a circular dependency between PCI resume and save * state restoration. * * TODO: support suspend when all the regions this device is * hosting are locked and covered by the system address map, * i.e. platform firmware owns restoring the HDM configuration * that it locked.
*/
cxl_mem_active_inc(); return devm_add_action_or_reset(dev, enable_suspend, NULL);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.