^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (C) 2012 Intel Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Author: Liu Jinsong <jinsong.liu@intel.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Author: Jiang Yunhong <yunhong.jiang@intel.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/acpi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <xen/acpi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <xen/interface/platform.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <asm/xen/hypercall.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define PREFIX "ACPI:xen_memory_hotplug:"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) struct acpi_memory_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) u64 start_addr; /* Memory Range start physical addr */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) u64 length; /* Memory Range length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) unsigned short caching; /* memory cache attribute */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) unsigned short write_protect; /* memory read/write attribute */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) /* copied from buffer getting from _CRS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) unsigned int enabled:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) struct acpi_memory_device {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) struct acpi_device *device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) struct list_head res_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) static bool acpi_hotmem_initialized __read_mostly;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) static int xen_hotadd_memory(int pxm, struct acpi_memory_info *info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) int rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) struct xen_platform_op op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) op.cmd = XENPF_mem_hotadd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) op.u.mem_add.spfn = info->start_addr >> PAGE_SHIFT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) op.u.mem_add.epfn = (info->start_addr + info->length) >> PAGE_SHIFT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) op.u.mem_add.pxm = pxm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) rc = HYPERVISOR_dom0_op(&op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) pr_err(PREFIX "Xen Hotplug Memory Add failed on "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) "0x%lx -> 0x%lx, _PXM: %d, error: %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) (unsigned long)info->start_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) (unsigned long)(info->start_addr + info->length),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) pxm, rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) static int xen_acpi_memory_enable_device(struct acpi_memory_device *mem_device)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) int pxm, result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) int num_enabled = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) struct acpi_memory_info *info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) if (!mem_device)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) pxm = xen_acpi_get_pxm(mem_device->device->handle);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) if (pxm < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) return pxm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) list_for_each_entry(info, &mem_device->res_list, list) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) if (info->enabled) { /* just sanity check...*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) num_enabled++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) if (!info->length)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) result = xen_hotadd_memory(pxm, info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) if (result)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) info->enabled = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) num_enabled++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) if (!num_enabled)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) acpi_memory_get_resource(struct acpi_resource *resource, void *context)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) struct acpi_memory_device *mem_device = context;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) struct acpi_resource_address64 address64;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) struct acpi_memory_info *info, *new;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) status = acpi_resource_to_address64(resource, &address64);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) if (ACPI_FAILURE(status) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) (address64.resource_type != ACPI_MEMORY_RANGE))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) return AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) list_for_each_entry(info, &mem_device->res_list, list) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) if ((info->caching == address64.info.mem.caching) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) (info->write_protect == address64.info.mem.write_protect) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) (info->start_addr + info->length == address64.address.minimum)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) info->length += address64.address.address_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) return AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) new = kzalloc(sizeof(struct acpi_memory_info), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) if (!new)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) return AE_ERROR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) INIT_LIST_HEAD(&new->list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) new->caching = address64.info.mem.caching;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) new->write_protect = address64.info.mem.write_protect;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) new->start_addr = address64.address.minimum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) new->length = address64.address.address_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) list_add_tail(&new->list, &mem_device->res_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) return AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) struct acpi_memory_info *info, *n;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) if (!list_empty(&mem_device->res_list))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) status = acpi_walk_resources(mem_device->device->handle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) METHOD_NAME__CRS, acpi_memory_get_resource, mem_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) list_for_each_entry_safe(info, n, &mem_device->res_list, list)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) kfree(info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) INIT_LIST_HEAD(&mem_device->res_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) static int acpi_memory_get_device(acpi_handle handle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) struct acpi_memory_device **mem_device)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) struct acpi_device *device = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) int result = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) acpi_scan_lock_acquire();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) acpi_bus_get_device(handle, &device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) if (acpi_device_enumerated(device))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) goto end;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) * Now add the notified device. This creates the acpi_device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) * and invokes .add function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) result = acpi_bus_scan(handle);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) if (result) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) pr_warn(PREFIX "ACPI namespace scan failed\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) result = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) device = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) acpi_bus_get_device(handle, &device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) if (!acpi_device_enumerated(device)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) pr_warn(PREFIX "Missing device object\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) result = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) end:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) *mem_device = acpi_driver_data(device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) if (!(*mem_device)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) pr_err(PREFIX "driver data not found\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) result = -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) acpi_scan_lock_release();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) return result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) static int acpi_memory_check_device(struct acpi_memory_device *mem_device)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) unsigned long long current_status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) /* Get device present/absent information from the _STA */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->device->handle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) "_STA", NULL, ¤t_status)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) * Check for device status. Device should be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) * present/enabled/functioning.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) if (!((current_status & ACPI_STA_DEVICE_PRESENT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) && (current_status & ACPI_STA_DEVICE_ENABLED)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) && (current_status & ACPI_STA_DEVICE_FUNCTIONING)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) static int acpi_memory_disable_device(struct acpi_memory_device *mem_device)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) pr_debug(PREFIX "Xen does not support memory hotremove\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) return -ENOSYS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) struct acpi_memory_device *mem_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) struct acpi_device *device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) switch (event) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) case ACPI_NOTIFY_BUS_CHECK:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) ACPI_DEBUG_PRINT((ACPI_DB_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) "\nReceived BUS CHECK notification for device\n"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) fallthrough;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) case ACPI_NOTIFY_DEVICE_CHECK:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) if (event == ACPI_NOTIFY_DEVICE_CHECK)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) ACPI_DEBUG_PRINT((ACPI_DB_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) "\nReceived DEVICE CHECK notification for device\n"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) if (acpi_memory_get_device(handle, &mem_device)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) pr_err(PREFIX "Cannot find driver data\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) ost_code = ACPI_OST_SC_SUCCESS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) case ACPI_NOTIFY_EJECT_REQUEST:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) ACPI_DEBUG_PRINT((ACPI_DB_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) "\nReceived EJECT REQUEST notification for device\n"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) acpi_scan_lock_acquire();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) if (acpi_bus_get_device(handle, &device)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) acpi_scan_lock_release();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) pr_err(PREFIX "Device doesn't exist\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) mem_device = acpi_driver_data(device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) if (!mem_device) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) acpi_scan_lock_release();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) pr_err(PREFIX "Driver Data is NULL\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) * TBD: implement acpi_memory_disable_device and invoke
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) * acpi_bus_remove if Xen support hotremove in the future
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) acpi_memory_disable_device(mem_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) acpi_scan_lock_release();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) ACPI_DEBUG_PRINT((ACPI_DB_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) "Unsupported event [0x%x]\n", event));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) /* non-hotplug event; possibly handled by other handler */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) (void) acpi_evaluate_ost(handle, event, ost_code, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) static int xen_acpi_memory_device_add(struct acpi_device *device)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) int result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) struct acpi_memory_device *mem_device = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) if (!device)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) mem_device = kzalloc(sizeof(struct acpi_memory_device), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) if (!mem_device)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) INIT_LIST_HEAD(&mem_device->res_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) mem_device->device = device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) sprintf(acpi_device_name(device), "%s", ACPI_MEMORY_DEVICE_NAME);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) sprintf(acpi_device_class(device), "%s", ACPI_MEMORY_DEVICE_CLASS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) device->driver_data = mem_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) /* Get the range from the _CRS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) result = acpi_memory_get_device_resources(mem_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) if (result) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) kfree(mem_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) return result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) * For booting existed memory devices, early boot code has recognized
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) * memory area by EFI/E820. If DSDT shows these memory devices on boot,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) * hotplug is not necessary for them.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) * For hot-added memory devices during runtime, it need hypercall to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) * Xen hypervisor to add memory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) if (!acpi_hotmem_initialized)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) if (!acpi_memory_check_device(mem_device))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) result = xen_acpi_memory_enable_device(mem_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) return result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) static int xen_acpi_memory_device_remove(struct acpi_device *device)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) struct acpi_memory_device *mem_device = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) if (!device || !acpi_driver_data(device))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) mem_device = acpi_driver_data(device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) kfree(mem_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) * Helper function to check for memory device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) static acpi_status is_memory_device(acpi_handle handle)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) char *hardware_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) struct acpi_device_info *info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) status = acpi_get_object_info(handle, &info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) if (ACPI_FAILURE(status))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) return status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) if (!(info->valid & ACPI_VALID_HID)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) kfree(info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) return AE_ERROR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) hardware_id = info->hardware_id.string;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) if ((hardware_id == NULL) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) (strcmp(hardware_id, ACPI_MEMORY_DEVICE_HID)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) status = AE_ERROR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) kfree(info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) return status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) acpi_memory_register_notify_handler(acpi_handle handle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) u32 level, void *ctxt, void **retv)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) status = is_memory_device(handle);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) if (ACPI_FAILURE(status))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) return AE_OK; /* continue */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) acpi_memory_device_notify, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) /* continue */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) return AE_OK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) acpi_memory_deregister_notify_handler(acpi_handle handle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) u32 level, void *ctxt, void **retv)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) status = is_memory_device(handle);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) if (ACPI_FAILURE(status))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) return AE_OK; /* continue */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) status = acpi_remove_notify_handler(handle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) ACPI_SYSTEM_NOTIFY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) acpi_memory_device_notify);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) return AE_OK; /* continue */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) static const struct acpi_device_id memory_device_ids[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) {ACPI_MEMORY_DEVICE_HID, 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) {"", 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) MODULE_DEVICE_TABLE(acpi, memory_device_ids);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) static struct acpi_driver xen_acpi_memory_device_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) .name = "acpi_memhotplug",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) .class = ACPI_MEMORY_DEVICE_CLASS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) .ids = memory_device_ids,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) .ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) .add = xen_acpi_memory_device_add,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) .remove = xen_acpi_memory_device_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) static int __init xen_acpi_memory_device_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) int result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) if (!xen_initial_domain())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) /* unregister the stub which only used to reserve driver space */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) xen_stub_memory_device_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) result = acpi_bus_register_driver(&xen_acpi_memory_device_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) if (result < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) xen_stub_memory_device_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) ACPI_UINT32_MAX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) acpi_memory_register_notify_handler,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) NULL, NULL, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) pr_warn(PREFIX "walk_namespace failed\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) acpi_bus_unregister_driver(&xen_acpi_memory_device_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) xen_stub_memory_device_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) acpi_hotmem_initialized = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) static void __exit xen_acpi_memory_device_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) if (!xen_initial_domain())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) ACPI_UINT32_MAX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) acpi_memory_deregister_notify_handler,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) NULL, NULL, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) if (ACPI_FAILURE(status))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) pr_warn(PREFIX "walk_namespace failed\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) acpi_bus_unregister_driver(&xen_acpi_memory_device_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) * stub reserve space again to prevent any chance of native
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) * driver loading.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) xen_stub_memory_device_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) module_init(xen_acpi_memory_device_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) module_exit(xen_acpi_memory_device_exit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) ACPI_MODULE_NAME("xen-acpi-memhotplug");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) MODULE_AUTHOR("Liu Jinsong <jinsong.liu@intel.com>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) MODULE_DESCRIPTION("Xen Hotplug Mem Driver");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) MODULE_LICENSE("GPL");