memdev.c (bcc79ea34398845d814170ddc06a457b35ae1975) | memdev.c (cf1f6877b088cd9ddeb5f3db8ade3a61e3a3f9eb) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* Copyright(c) 2020 Intel Corporation. */ 3 4#include <linux/device.h> 5#include <linux/slab.h> 6#include <linux/idr.h> 7#include <linux/pci.h> 8#include <cxlmem.h> --- 85 unchanged lines hidden (view full) --- 94{ 95 struct cxl_memdev *cxlmd = to_cxl_memdev(dev); 96 struct cxl_dev_state *cxlds = cxlmd->cxlds; 97 98 return sysfs_emit(buf, "%#llx\n", cxlds->serial); 99} 100static DEVICE_ATTR_RO(serial); 101 | 1// SPDX-License-Identifier: GPL-2.0-only 2/* Copyright(c) 2020 Intel Corporation. */ 3 4#include <linux/device.h> 5#include <linux/slab.h> 6#include <linux/idr.h> 7#include <linux/pci.h> 8#include <cxlmem.h> --- 85 unchanged lines hidden (view full) --- 94{ 95 struct cxl_memdev *cxlmd = to_cxl_memdev(dev); 96 struct cxl_dev_state *cxlds = cxlmd->cxlds; 97 98 return sysfs_emit(buf, "%#llx\n", cxlds->serial); 99} 100static DEVICE_ATTR_RO(serial); 101 |
102static ssize_t numa_node_show(struct device *dev, struct device_attribute *attr, 103 char *buf) 104{ 105 return sprintf(buf, "%d\n", dev_to_node(dev)); 106} 107static DEVICE_ATTR_RO(numa_node); 108 |
|
102static struct attribute *cxl_memdev_attributes[] = { 103 &dev_attr_serial.attr, 104 &dev_attr_firmware_version.attr, 105 &dev_attr_payload_max.attr, 106 &dev_attr_label_storage_size.attr, | 109static struct attribute *cxl_memdev_attributes[] = { 110 &dev_attr_serial.attr, 111 &dev_attr_firmware_version.attr, 112 &dev_attr_payload_max.attr, 113 &dev_attr_label_storage_size.attr, |
114 &dev_attr_numa_node.attr, |
|
107 NULL, 108}; 109 110static struct attribute *cxl_memdev_pmem_attributes[] = { 111 &dev_attr_pmem_size.attr, 112 NULL, 113}; 114 115static struct attribute *cxl_memdev_ram_attributes[] = { 116 &dev_attr_ram_size.attr, 117 NULL, 118}; 119 | 115 NULL, 116}; 117 118static struct attribute *cxl_memdev_pmem_attributes[] = { 119 &dev_attr_pmem_size.attr, 120 NULL, 121}; 122 123static struct attribute *cxl_memdev_ram_attributes[] = { 124 &dev_attr_ram_size.attr, 125 NULL, 126}; 127 |
128static umode_t cxl_memdev_visible(struct kobject *kobj, struct attribute *a, 129 int n) 130{ 131 if (!IS_ENABLED(CONFIG_NUMA) && a == &dev_attr_numa_node.attr) 132 return 0; 133 return a->mode; 134} 135 |
|
120static struct attribute_group cxl_memdev_attribute_group = { 121 .attrs = cxl_memdev_attributes, | 136static struct attribute_group cxl_memdev_attribute_group = { 137 .attrs = cxl_memdev_attributes, |
138 .is_visible = cxl_memdev_visible, |
|
122}; 123 124static struct attribute_group cxl_memdev_ram_attribute_group = { 125 .name = "ram", 126 .attrs = cxl_memdev_ram_attributes, 127}; 128 129static struct attribute_group cxl_memdev_pmem_attribute_group = { --- 221 unchanged lines hidden --- | 139}; 140 141static struct attribute_group cxl_memdev_ram_attribute_group = { 142 .name = "ram", 143 .attrs = cxl_memdev_ram_attributes, 144}; 145 146static struct attribute_group cxl_memdev_pmem_attribute_group = { --- 221 unchanged lines hidden --- |