1 // SPDX-License-Identifier: GPL-2.0-only
2 /* Copyright(c) 2021 Intel Corporation. All rights reserved. */
3 #include <linux/platform_device.h>
4 #include <linux/module.h>
5 #include <linux/device.h>
6 #include <linux/kernel.h>
7 #include <linux/acpi.h>
9 #include <linux/node.h>
10 #include <asm/div64.h>
14 #define CXL_RCRB_SIZE SZ_8K
16 struct cxl_cxims_data {
18 u64 xormaps[] __counted_by(nr_maps);
21 static const guid_t acpi_cxl_qtg_id_guid =
22 GUID_INIT(0xF365F9A6, 0xA7DE, 0x4071,
23 0xA6, 0x6A, 0xB4, 0x0C, 0x0B, 0x4F, 0x8E, 0x52);
26 * Find a targets entry (n) in the host bridge interleave list.
27 * CXL Specification 3.0 Table 9-22
29 static int cxl_xor_calc_n(u64 hpa, struct cxl_cxims_data *cximsd, int iw,
35 /* IW: 2,4,6,8,12,16 begin building 'n' using xormaps */
37 for (i = 0; i < cximsd->nr_maps; i++)
38 n |= (hweight64(hpa & cximsd->xormaps[i]) & 1) << i;
40 /* IW: 3,6,12 add a modulo calculation to 'n' */
41 if (!is_power_of_2(iw)) {
42 if (ways_to_eiw(iw, &eiw))
44 hpa &= GENMASK_ULL(51, eiw + ig);
45 n |= do_div(hpa, 3) << i;
50 static struct cxl_dport *cxl_hb_xor(struct cxl_root_decoder *cxlrd, int pos)
52 struct cxl_cxims_data *cximsd = cxlrd->platform_data;
53 struct cxl_switch_decoder *cxlsd = &cxlrd->cxlsd;
54 struct cxl_decoder *cxld = &cxlsd->cxld;
55 int ig = cxld->interleave_granularity;
56 int iw = cxld->interleave_ways;
60 if (dev_WARN_ONCE(&cxld->dev,
61 cxld->interleave_ways != cxlsd->nr_targets,
62 "misconfigured root decoder\n"))
65 hpa = cxlrd->res->start + pos * ig;
67 /* Entry (n) is 0 for no interleave (iw == 1) */
69 n = cxl_xor_calc_n(hpa, cximsd, iw, ig);
74 return cxlrd->cxlsd.target[n];
77 struct cxl_cxims_context {
79 struct cxl_root_decoder *cxlrd;
82 static int cxl_parse_cxims(union acpi_subtable_headers *header, void *arg,
83 const unsigned long end)
85 struct acpi_cedt_cxims *cxims = (struct acpi_cedt_cxims *)header;
86 struct cxl_cxims_context *ctx = arg;
87 struct cxl_root_decoder *cxlrd = ctx->cxlrd;
88 struct cxl_decoder *cxld = &cxlrd->cxlsd.cxld;
89 struct device *dev = ctx->dev;
90 struct cxl_cxims_data *cximsd;
91 unsigned int hbig, nr_maps;
94 rc = eig_to_granularity(cxims->hbig, &hbig);
98 /* Does this CXIMS entry apply to the given CXL Window? */
99 if (hbig != cxld->interleave_granularity)
102 /* IW 1,3 do not use xormaps and skip this parsing entirely */
103 if (is_power_of_2(cxld->interleave_ways))
104 /* 2, 4, 8, 16 way */
105 nr_maps = ilog2(cxld->interleave_ways);
108 nr_maps = ilog2(cxld->interleave_ways / 3);
110 if (cxims->nr_xormaps < nr_maps) {
111 dev_dbg(dev, "CXIMS nr_xormaps[%d] expected[%d]\n",
112 cxims->nr_xormaps, nr_maps);
116 cximsd = devm_kzalloc(dev, struct_size(cximsd, xormaps, nr_maps),
120 cximsd->nr_maps = nr_maps;
121 memcpy(cximsd->xormaps, cxims->xormap_list,
122 nr_maps * sizeof(*cximsd->xormaps));
123 cxlrd->platform_data = cximsd;
128 static unsigned long cfmws_to_decoder_flags(int restrictions)
130 unsigned long flags = CXL_DECODER_F_ENABLE;
132 if (restrictions & ACPI_CEDT_CFMWS_RESTRICT_TYPE2)
133 flags |= CXL_DECODER_F_TYPE2;
134 if (restrictions & ACPI_CEDT_CFMWS_RESTRICT_TYPE3)
135 flags |= CXL_DECODER_F_TYPE3;
136 if (restrictions & ACPI_CEDT_CFMWS_RESTRICT_VOLATILE)
137 flags |= CXL_DECODER_F_RAM;
138 if (restrictions & ACPI_CEDT_CFMWS_RESTRICT_PMEM)
139 flags |= CXL_DECODER_F_PMEM;
140 if (restrictions & ACPI_CEDT_CFMWS_RESTRICT_FIXED)
141 flags |= CXL_DECODER_F_LOCK;
146 static int cxl_acpi_cfmws_verify(struct device *dev,
147 struct acpi_cedt_cfmws *cfmws)
149 int rc, expected_len;
152 if (cfmws->interleave_arithmetic != ACPI_CEDT_CFMWS_ARITHMETIC_MODULO &&
153 cfmws->interleave_arithmetic != ACPI_CEDT_CFMWS_ARITHMETIC_XOR) {
154 dev_err(dev, "CFMWS Unknown Interleave Arithmetic: %d\n",
155 cfmws->interleave_arithmetic);
159 if (!IS_ALIGNED(cfmws->base_hpa, SZ_256M)) {
160 dev_err(dev, "CFMWS Base HPA not 256MB aligned\n");
164 if (!IS_ALIGNED(cfmws->window_size, SZ_256M)) {
165 dev_err(dev, "CFMWS Window Size not 256MB aligned\n");
169 rc = eiw_to_ways(cfmws->interleave_ways, &ways);
171 dev_err(dev, "CFMWS Interleave Ways (%d) invalid\n",
172 cfmws->interleave_ways);
176 expected_len = struct_size(cfmws, interleave_targets, ways);
178 if (cfmws->header.length < expected_len) {
179 dev_err(dev, "CFMWS length %d less than expected %d\n",
180 cfmws->header.length, expected_len);
184 if (cfmws->header.length > expected_len)
185 dev_dbg(dev, "CFMWS length %d greater than expected %d\n",
186 cfmws->header.length, expected_len);
192 * Note, @dev must be the first member, see 'struct cxl_chbs_context'
193 * and mock_acpi_table_parse_cedt()
195 struct cxl_cfmws_context {
197 struct cxl_port *root_port;
198 struct resource *cxl_res;
203 * cxl_acpi_evaluate_qtg_dsm - Retrieve QTG ids via ACPI _DSM
204 * @handle: ACPI handle
205 * @coord: performance access coordinates
206 * @entries: number of QTG IDs to return
207 * @qos_class: int array provided by caller to return QTG IDs
209 * Return: number of QTG IDs returned, or -errno for errors
211 * Issue QTG _DSM with accompanied bandwidth and latency data in order to get
212 * the QTG IDs that are suitable for the performance point in order of most
213 * suitable to least suitable. Write back array of QTG IDs and return the
214 * actual number of QTG IDs written back.
217 cxl_acpi_evaluate_qtg_dsm(acpi_handle handle, struct access_coordinate *coord,
218 int entries, int *qos_class)
220 union acpi_object *out_obj, *out_buf, *obj;
221 union acpi_object in_array[4] = {
222 [0].integer = { ACPI_TYPE_INTEGER, coord->read_latency },
223 [1].integer = { ACPI_TYPE_INTEGER, coord->write_latency },
224 [2].integer = { ACPI_TYPE_INTEGER, coord->read_bandwidth },
225 [3].integer = { ACPI_TYPE_INTEGER, coord->write_bandwidth },
227 union acpi_object in_obj = {
229 .type = ACPI_TYPE_PACKAGE,
231 .elements = in_array,
234 int count, pkg_entries, i;
241 out_obj = acpi_evaluate_dsm(handle, &acpi_cxl_qtg_id_guid, 1, 1, &in_obj);
245 if (out_obj->type != ACPI_TYPE_PACKAGE) {
250 /* Check Max QTG ID */
251 obj = &out_obj->package.elements[0];
252 if (obj->type != ACPI_TYPE_INTEGER) {
257 max_qtg = obj->integer.value;
259 /* It's legal to have 0 QTG entries */
260 pkg_entries = out_obj->package.count;
261 if (pkg_entries <= 1) {
266 /* Retrieve QTG IDs package */
267 obj = &out_obj->package.elements[1];
268 if (obj->type != ACPI_TYPE_PACKAGE) {
273 pkg_entries = obj->package.count;
274 count = min(entries, pkg_entries);
275 for (i = 0; i < count; i++) {
278 out_buf = &obj->package.elements[i];
279 if (out_buf->type != ACPI_TYPE_INTEGER) {
284 qtg_id = out_buf->integer.value;
285 if (qtg_id > max_qtg)
286 pr_warn("QTG ID %u greater than MAX %u\n",
289 qos_class[i] = qtg_id;
298 static int cxl_acpi_qos_class(struct cxl_root *cxl_root,
299 struct access_coordinate *coord, int entries,
302 struct device *dev = cxl_root->port.uport_dev;
305 if (!dev_is_platform(dev))
308 handle = ACPI_HANDLE(dev);
312 return cxl_acpi_evaluate_qtg_dsm(handle, coord, entries, qos_class);
315 static const struct cxl_root_ops acpi_root_ops = {
316 .qos_class = cxl_acpi_qos_class,
319 static int __cxl_parse_cfmws(struct acpi_cedt_cfmws *cfmws,
320 struct cxl_cfmws_context *ctx)
322 int target_map[CXL_DECODER_MAX_INTERLEAVE];
323 struct cxl_port *root_port = ctx->root_port;
324 struct resource *cxl_res = ctx->cxl_res;
325 struct cxl_cxims_context cxims_ctx;
326 struct cxl_root_decoder *cxlrd;
327 struct device *dev = ctx->dev;
328 cxl_calc_hb_fn cxl_calc_hb;
329 struct cxl_decoder *cxld;
330 unsigned int ways, i, ig;
331 struct resource *res;
334 rc = cxl_acpi_cfmws_verify(dev, cfmws);
336 dev_err(dev, "CFMWS range %#llx-%#llx not registered\n",
338 cfmws->base_hpa + cfmws->window_size - 1);
342 rc = eiw_to_ways(cfmws->interleave_ways, &ways);
345 rc = eig_to_granularity(cfmws->granularity, &ig);
348 for (i = 0; i < ways; i++)
349 target_map[i] = cfmws->interleave_targets[i];
351 res = kzalloc(sizeof(*res), GFP_KERNEL);
355 res->name = kasprintf(GFP_KERNEL, "CXL Window %d", ctx->id++);
359 res->start = cfmws->base_hpa;
360 res->end = cfmws->base_hpa + cfmws->window_size - 1;
361 res->flags = IORESOURCE_MEM;
363 /* add to the local resource tracking to establish a sort order */
364 rc = insert_resource(cxl_res, res);
368 if (cfmws->interleave_arithmetic == ACPI_CEDT_CFMWS_ARITHMETIC_MODULO)
369 cxl_calc_hb = cxl_hb_modulo;
371 cxl_calc_hb = cxl_hb_xor;
373 cxlrd = cxl_root_decoder_alloc(root_port, ways, cxl_calc_hb);
375 return PTR_ERR(cxlrd);
377 cxld = &cxlrd->cxlsd.cxld;
378 cxld->flags = cfmws_to_decoder_flags(cfmws->restrictions);
379 cxld->target_type = CXL_DECODER_HOSTONLYMEM;
380 cxld->hpa_range = (struct range) {
384 cxld->interleave_ways = ways;
386 * Minimize the x1 granularity to advertise support for any
387 * valid region granularity
390 ig = CXL_DECODER_MIN_GRANULARITY;
391 cxld->interleave_granularity = ig;
393 if (cfmws->interleave_arithmetic == ACPI_CEDT_CFMWS_ARITHMETIC_XOR) {
394 if (ways != 1 && ways != 3) {
395 cxims_ctx = (struct cxl_cxims_context) {
399 rc = acpi_table_parse_cedt(ACPI_CEDT_TYPE_CXIMS,
400 cxl_parse_cxims, &cxims_ctx);
403 if (!cxlrd->platform_data) {
404 dev_err(dev, "No CXIMS for HBIG %u\n", ig);
411 cxlrd->qos_class = cfmws->qtg_id;
413 rc = cxl_decoder_add(cxld, target_map);
416 put_device(&cxld->dev);
418 rc = cxl_decoder_autoremove(dev, cxld);
428 static int cxl_parse_cfmws(union acpi_subtable_headers *header, void *arg,
429 const unsigned long end)
431 struct acpi_cedt_cfmws *cfmws = (struct acpi_cedt_cfmws *)header;
432 struct cxl_cfmws_context *ctx = arg;
433 struct device *dev = ctx->dev;
436 rc = __cxl_parse_cfmws(cfmws, ctx);
439 "Failed to add decode range: [%#llx - %#llx] (%d)\n",
441 cfmws->base_hpa + cfmws->window_size - 1, rc);
443 dev_dbg(dev, "decode range: node: %d range [%#llx - %#llx]\n",
444 phys_to_target_node(cfmws->base_hpa), cfmws->base_hpa,
445 cfmws->base_hpa + cfmws->window_size - 1);
447 /* never fail cxl_acpi load for a single window failure */
451 __mock struct acpi_device *to_cxl_host_bridge(struct device *host,
454 struct acpi_device *adev = to_acpi_device(dev);
456 if (!acpi_pci_find_root(adev->handle))
459 if (strcmp(acpi_device_hid(adev), "ACPI0016") == 0)
464 /* Note, @dev is used by mock_acpi_table_parse_cedt() */
465 struct cxl_chbs_context {
467 unsigned long long uid;
468 resource_size_t base;
472 static int cxl_get_chbs_iter(union acpi_subtable_headers *header, void *arg,
473 const unsigned long end)
475 struct cxl_chbs_context *ctx = arg;
476 struct acpi_cedt_chbs *chbs;
478 if (ctx->base != CXL_RESOURCE_NONE)
481 chbs = (struct acpi_cedt_chbs *) header;
483 if (ctx->uid != chbs->uid)
486 ctx->cxl_version = chbs->cxl_version;
490 if (chbs->cxl_version == ACPI_CEDT_CHBS_VERSION_CXL11 &&
491 chbs->length != CXL_RCRB_SIZE)
494 ctx->base = chbs->base;
499 static int cxl_get_chbs(struct device *dev, struct acpi_device *hb,
500 struct cxl_chbs_context *ctx)
502 unsigned long long uid;
505 rc = acpi_evaluate_integer(hb->handle, METHOD_NAME__UID, NULL, &uid);
507 dev_err(dev, "unable to retrieve _UID\n");
511 dev_dbg(dev, "UID found: %lld\n", uid);
512 *ctx = (struct cxl_chbs_context) {
515 .base = CXL_RESOURCE_NONE,
516 .cxl_version = UINT_MAX,
519 acpi_table_parse_cedt(ACPI_CEDT_TYPE_CHBS, cxl_get_chbs_iter, ctx);
524 static int get_genport_coordinates(struct device *dev, struct cxl_dport *dport)
526 struct acpi_device *hb = to_cxl_host_bridge(NULL, dev);
530 if (kstrtou32(acpi_device_uid(hb), 0, &uid))
533 rc = acpi_get_genport_coordinates(uid, dport->hb_coord);
537 /* Adjust back to picoseconds from nanoseconds */
538 for (int i = 0; i < ACCESS_COORDINATE_MAX; i++) {
539 dport->hb_coord[i].read_latency *= 1000;
540 dport->hb_coord[i].write_latency *= 1000;
546 static int add_host_bridge_dport(struct device *match, void *arg)
550 struct device *bridge;
551 struct cxl_dport *dport;
552 struct cxl_chbs_context ctx;
553 struct acpi_pci_root *pci_root;
554 struct cxl_port *root_port = arg;
555 struct device *host = root_port->dev.parent;
556 struct acpi_device *hb = to_cxl_host_bridge(host, match);
561 rc = cxl_get_chbs(match, hb, &ctx);
565 if (ctx.cxl_version == UINT_MAX) {
566 dev_warn(match, "No CHBS found for Host Bridge (UID %lld)\n",
571 if (ctx.base == CXL_RESOURCE_NONE) {
572 dev_warn(match, "CHBS invalid for Host Bridge (UID %lld)\n",
577 pci_root = acpi_pci_find_root(hb->handle);
578 bridge = pci_root->bus->bridge;
581 * In RCH mode, bind the component regs base to the dport. In
582 * VH mode it will be bound to the CXL host bridge's port
583 * object later in add_host_bridge_uport().
585 if (ctx.cxl_version == ACPI_CEDT_CHBS_VERSION_CXL11) {
586 dev_dbg(match, "RCRB found for UID %lld: %pa\n", ctx.uid,
588 dport = devm_cxl_add_rch_dport(root_port, bridge, ctx.uid,
591 dport = devm_cxl_add_dport(root_port, bridge, ctx.uid,
596 return PTR_ERR(dport);
598 ret = get_genport_coordinates(match, dport);
600 dev_dbg(match, "Failed to get generic port perf coordinates.\n");
606 * A host bridge is a dport to a CFMWS decode and it is a uport to the
607 * dport (PCIe Root Ports) in the host bridge.
609 static int add_host_bridge_uport(struct device *match, void *arg)
611 struct cxl_port *root_port = arg;
612 struct device *host = root_port->dev.parent;
613 struct acpi_device *hb = to_cxl_host_bridge(host, match);
614 struct acpi_pci_root *pci_root;
615 struct cxl_dport *dport;
616 struct cxl_port *port;
617 struct device *bridge;
618 struct cxl_chbs_context ctx;
619 resource_size_t component_reg_phys;
625 pci_root = acpi_pci_find_root(hb->handle);
626 bridge = pci_root->bus->bridge;
627 dport = cxl_find_dport_by_dev(root_port, bridge);
629 dev_dbg(host, "host bridge expected and not found\n");
634 dev_info(bridge, "host supports CXL (restricted)\n");
638 rc = cxl_get_chbs(match, hb, &ctx);
642 if (ctx.cxl_version == ACPI_CEDT_CHBS_VERSION_CXL11) {
644 "CXL CHBS version mismatch, skip port registration\n");
648 component_reg_phys = ctx.base;
649 if (component_reg_phys != CXL_RESOURCE_NONE)
650 dev_dbg(match, "CHBCR found for UID %lld: %pa\n",
651 ctx.uid, &component_reg_phys);
653 rc = devm_cxl_register_pci_bus(host, bridge, pci_root->bus);
657 port = devm_cxl_add_port(host, bridge, component_reg_phys, dport);
659 return PTR_ERR(port);
661 dev_info(bridge, "host supports CXL\n");
666 static int add_root_nvdimm_bridge(struct device *match, void *data)
668 struct cxl_decoder *cxld;
669 struct cxl_port *root_port = data;
670 struct cxl_nvdimm_bridge *cxl_nvb;
671 struct device *host = root_port->dev.parent;
673 if (!is_root_decoder(match))
676 cxld = to_cxl_decoder(match);
677 if (!(cxld->flags & CXL_DECODER_F_PMEM))
680 cxl_nvb = devm_cxl_add_nvdimm_bridge(host, root_port);
681 if (IS_ERR(cxl_nvb)) {
682 dev_dbg(host, "failed to register pmem\n");
683 return PTR_ERR(cxl_nvb);
685 dev_dbg(host, "%s: add: %s\n", dev_name(&root_port->dev),
686 dev_name(&cxl_nvb->dev));
690 static struct lock_class_key cxl_root_key;
692 static void cxl_acpi_lock_reset_class(void *dev)
694 device_lock_reset_class(dev);
697 static void del_cxl_resource(struct resource *res)
703 static void cxl_set_public_resource(struct resource *priv, struct resource *pub)
705 priv->desc = (unsigned long) pub;
708 static struct resource *cxl_get_public_resource(struct resource *priv)
710 return (struct resource *) priv->desc;
713 static void remove_cxl_resources(void *data)
715 struct resource *res, *next, *cxl = data;
717 for (res = cxl->child; res; res = next) {
718 struct resource *victim = cxl_get_public_resource(res);
721 remove_resource(res);
724 remove_resource(victim);
728 del_cxl_resource(res);
733 * add_cxl_resources() - reflect CXL fixed memory windows in iomem_resource
734 * @cxl_res: A standalone resource tree where each CXL window is a sibling
736 * Walk each CXL window in @cxl_res and add it to iomem_resource potentially
737 * expanding its boundaries to ensure that any conflicting resources become
738 * children. If a window is expanded it may then conflict with a another window
739 * entry and require the window to be truncated or trimmed. Consider this
742 * |-- "CXL Window 0" --||----- "CXL Window 1" -----|
743 * |--------------- "System RAM" -------------|
745 * ...where platform firmware has established as System RAM resource across 2
746 * windows, but has left some portion of window 1 for dynamic CXL region
747 * provisioning. In this case "Window 0" will span the entirety of the "System
748 * RAM" span, and "CXL Window 1" is truncated to the remaining tail past the end
749 * of that "System RAM" resource.
751 static int add_cxl_resources(struct resource *cxl_res)
753 struct resource *res, *new, *next;
755 for (res = cxl_res->child; res; res = next) {
756 new = kzalloc(sizeof(*new), GFP_KERNEL);
759 new->name = res->name;
760 new->start = res->start;
762 new->flags = IORESOURCE_MEM;
763 new->desc = IORES_DESC_CXL;
766 * Record the public resource in the private cxl_res tree for
769 cxl_set_public_resource(res, new);
771 insert_resource_expand_to_fit(&iomem_resource, new);
774 while (next && resource_overlaps(new, next)) {
775 if (resource_contains(new, next)) {
776 struct resource *_next = next->sibling;
778 remove_resource(next);
779 del_cxl_resource(next);
782 next->start = new->end + 1;
788 static int pair_cxl_resource(struct device *dev, void *data)
790 struct resource *cxl_res = data;
793 if (!is_root_decoder(dev))
796 for (p = cxl_res->child; p; p = p->sibling) {
797 struct cxl_root_decoder *cxlrd = to_cxl_root_decoder(dev);
798 struct cxl_decoder *cxld = &cxlrd->cxlsd.cxld;
799 struct resource res = {
800 .start = cxld->hpa_range.start,
801 .end = cxld->hpa_range.end,
802 .flags = IORESOURCE_MEM,
805 if (resource_contains(p, &res)) {
806 cxlrd->res = cxl_get_public_resource(p);
814 static int cxl_acpi_probe(struct platform_device *pdev)
817 struct resource *cxl_res;
818 struct cxl_root *cxl_root;
819 struct cxl_port *root_port;
820 struct device *host = &pdev->dev;
821 struct acpi_device *adev = ACPI_COMPANION(host);
822 struct cxl_cfmws_context ctx;
824 device_lock_set_class(&pdev->dev, &cxl_root_key);
825 rc = devm_add_action_or_reset(&pdev->dev, cxl_acpi_lock_reset_class,
830 cxl_res = devm_kzalloc(host, sizeof(*cxl_res), GFP_KERNEL);
833 cxl_res->name = "CXL mem";
836 cxl_res->flags = IORESOURCE_MEM;
838 cxl_root = devm_cxl_add_root(host, &acpi_root_ops);
839 if (IS_ERR(cxl_root))
840 return PTR_ERR(cxl_root);
841 root_port = &cxl_root->port;
843 rc = bus_for_each_dev(adev->dev.bus, NULL, root_port,
844 add_host_bridge_dport);
848 rc = devm_add_action_or_reset(host, remove_cxl_resources, cxl_res);
852 ctx = (struct cxl_cfmws_context) {
854 .root_port = root_port,
857 rc = acpi_table_parse_cedt(ACPI_CEDT_TYPE_CFMWS, cxl_parse_cfmws, &ctx);
861 rc = add_cxl_resources(cxl_res);
866 * Populate the root decoders with their related iomem resource,
869 device_for_each_child(&root_port->dev, cxl_res, pair_cxl_resource);
872 * Root level scanned with host-bridge as dports, now scan host-bridges
873 * for their role as CXL uports to their CXL-capable PCIe Root Ports.
875 rc = bus_for_each_dev(adev->dev.bus, NULL, root_port,
876 add_host_bridge_uport);
880 if (IS_ENABLED(CONFIG_CXL_PMEM))
881 rc = device_for_each_child(&root_port->dev, root_port,
882 add_root_nvdimm_bridge);
886 /* In case PCI is scanned before ACPI re-trigger memdev attach */
891 static const struct acpi_device_id cxl_acpi_ids[] = {
895 MODULE_DEVICE_TABLE(acpi, cxl_acpi_ids);
897 static const struct platform_device_id cxl_test_ids[] = {
901 MODULE_DEVICE_TABLE(platform, cxl_test_ids);
903 static struct platform_driver cxl_acpi_driver = {
904 .probe = cxl_acpi_probe,
906 .name = KBUILD_MODNAME,
907 .acpi_match_table = cxl_acpi_ids,
909 .id_table = cxl_test_ids,
912 static int __init cxl_acpi_init(void)
914 return platform_driver_register(&cxl_acpi_driver);
917 static void __exit cxl_acpi_exit(void)
919 platform_driver_unregister(&cxl_acpi_driver);
923 /* load before dax_hmem sees 'Soft Reserved' CXL ranges */
924 subsys_initcall(cxl_acpi_init);
925 module_exit(cxl_acpi_exit);
926 MODULE_LICENSE("GPL v2");
927 MODULE_IMPORT_NS(CXL);
928 MODULE_IMPORT_NS(ACPI);