Commit 1834703b authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'edac_updates_for_v7.1_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras

Pull EDAC updates from Borislav Petkov:

 - amd64_edac: Add support for AMD Zen 3 (family 19h, models 40h–4fh)

 - i10nm: Add GNR error information decoder support as an alternative to
   the firmware decoder

 - versalnet: Restructure the init/teardown logic for correct and more
   readable error handling. Also, fix two memory leaks and a resource
   leak

 - Convert several internal structs to use bounded flex arrays, enabling
   the kernel's runtime checker to catch out-of-bounds memory accesses

 - Mark various sysfs attribute tables read-only, preventing accidental
   modification at runtime

 - The usual fixes and cleanups across the subsystem

* tag 'edac_updates_for_v7.1_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras:
  EDAC/mc: Use kzalloc_flex()
  EDAC/ie31200: Make rpl_s_cfg static
  EDAC/i10nm: Fix spelling mistake "readd" -> "read"
  EDAC/versalnet: Fix device_node leak in mc_probe()
  EDAC/versalnet: Fix memory leak in remove and probe error paths
  EDAC/amd64: Add support for family 19h, models 40h-4fh
  EDAC/i10nm: Add driver decoder for Granite Rapids server
  EDAC/sb: Use kzalloc_flex()
  EDAC/i7core: Use kzalloc_flex()
  EDAC/mpc85xx: Constify device sysfs attributes
  EDAC/device: Allow addition of const sysfs attributes
  EDAC/pci_sysfs: Constify instance sysfs attributes
  EDAC/device: Constify info sysfs attributes
  EDAC/device: Drop unnecessary and dangerous casts of attributes
  EDAC/device: Drop unused macro to_edacdev_attr()
  EDAC/altera: Drop unused field eccmgr_sysfs_attr
  EDAC/versalnet: Refactor memory controller initialization and cleanup
parents 60b8d4d4 4db9a984
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -172,7 +172,6 @@ struct altr_sdram_prv_data {
	int ecc_irq_clr_mask;
	int ecc_cnt_rst_offset;
	int ecc_cnt_rst_mask;
	struct edac_dev_sysfs_attribute *eccmgr_sysfs_attr;
	int ecc_enable_mask;
	int ce_set_mask;
	int ue_set_mask;
+3 −0
Original line number Diff line number Diff line
@@ -3863,6 +3863,9 @@ static int per_family_init(struct amd64_pvt *pvt)
				pvt->max_mcs		= 8;
			}
			break;
		case 0x40 ... 0x4f:
			pvt->max_mcs			= 4;
			break;
		case 0x60 ... 0x6f:
			pvt->flags.zn_regs_v2		= 1;
			break;
+1 −1
Original line number Diff line number Diff line
@@ -163,7 +163,7 @@ struct edac_device_ctl_info {
	 * If attributes are desired, then set to array of attributes
	 * If no attributes are desired, leave NULL
	 */
	struct edac_dev_sysfs_attribute *sysfs_attributes;
	const struct edac_dev_sysfs_attribute *sysfs_attributes;

	/* pointer to main 'edac' subsys in sysfs */
	const struct bus_type *edac_subsys;
+10 −14
Original line number Diff line number Diff line
@@ -21,8 +21,6 @@
#define EDAC_DEVICE_SYMLINK	"device"

#define to_edacdev(k) container_of(k, struct edac_device_ctl_info, kobj)
#define to_edacdev_attr(a) container_of(a, struct edacdev_attribute, attr)


/*
 * Set of edac_device_ctl_info attribute store/show functions
@@ -111,14 +109,14 @@ struct ctl_info_attribute {
};

#define to_ctl_info(k) container_of(k, struct edac_device_ctl_info, kobj)
#define to_ctl_info_attr(a) container_of(a,struct ctl_info_attribute,attr)
#define to_ctl_info_attr(a) container_of_const(a, struct ctl_info_attribute, attr)

/* Function to 'show' fields from the edac_dev 'ctl_info' structure */
static ssize_t edac_dev_ctl_info_show(struct kobject *kobj,
				struct attribute *attr, char *buffer)
{
	struct edac_device_ctl_info *edac_dev = to_ctl_info(kobj);
	struct ctl_info_attribute *ctl_info_attr = to_ctl_info_attr(attr);
	const struct ctl_info_attribute *ctl_info_attr = to_ctl_info_attr(attr);

	if (ctl_info_attr->show)
		return ctl_info_attr->show(edac_dev, buffer);
@@ -131,7 +129,7 @@ static ssize_t edac_dev_ctl_info_store(struct kobject *kobj,
				const char *buffer, size_t count)
{
	struct edac_device_ctl_info *edac_dev = to_ctl_info(kobj);
	struct ctl_info_attribute *ctl_info_attr = to_ctl_info_attr(attr);
	const struct ctl_info_attribute *ctl_info_attr = to_ctl_info_attr(attr);

	if (ctl_info_attr->store)
		return ctl_info_attr->store(edac_dev, buffer, count);
@@ -145,7 +143,7 @@ static const struct sysfs_ops device_ctl_info_ops = {
};

#define CTL_INFO_ATTR(_name,_mode,_show,_store)        \
static struct ctl_info_attribute attr_ctl_info_##_name = {      \
static const struct ctl_info_attribute attr_ctl_info_##_name = {      \
	.attr = {.name = __stringify(_name), .mode = _mode },   \
	.show   = _show,                                        \
	.store  = _store,                                       \
@@ -163,7 +161,7 @@ CTL_INFO_ATTR(poll_msec, S_IRUGO | S_IWUSR,
	edac_device_ctl_poll_msec_show, edac_device_ctl_poll_msec_store);

/* Base Attributes of the EDAC_DEVICE ECC object */
static struct attribute *device_ctrl_attrs[] = {
static const struct attribute *const device_ctrl_attrs[] = {
	&attr_ctl_info_panic_on_ue.attr,
	&attr_ctl_info_log_ue.attr,
	&attr_ctl_info_log_ce.attr,
@@ -575,8 +573,7 @@ static void edac_device_delete_block(struct edac_device_ctl_info *edac_dev,
		for (i = 0; i < block->nr_attribs; i++, sysfs_attrib++) {

			/* remove each block_attrib file */
			sysfs_remove_file(&block->kobj,
				(struct attribute *) sysfs_attrib);
			sysfs_remove_file(&block->kobj, &sysfs_attrib->attr);
		}
	}

@@ -726,7 +723,7 @@ static void edac_device_delete_instances(struct edac_device_ctl_info *edac_dev)
static int edac_device_add_main_sysfs_attributes(
			struct edac_device_ctl_info *edac_dev)
{
	struct edac_dev_sysfs_attribute *sysfs_attrib;
	const struct edac_dev_sysfs_attribute *sysfs_attrib;
	int err = 0;

	sysfs_attrib = edac_dev->sysfs_attributes;
@@ -736,7 +733,7 @@ static int edac_device_add_main_sysfs_attributes(
		 */
		while (sysfs_attrib->attr.name != NULL) {
			err = sysfs_create_file(&edac_dev->kobj,
				(struct attribute*) sysfs_attrib);
				&sysfs_attrib->attr);
			if (err)
				goto err_out;

@@ -755,7 +752,7 @@ static int edac_device_add_main_sysfs_attributes(
static void edac_device_remove_main_sysfs_attributes(
			struct edac_device_ctl_info *edac_dev)
{
	struct edac_dev_sysfs_attribute *sysfs_attrib;
	const struct edac_dev_sysfs_attribute *sysfs_attrib;

	/* if there are main attributes, defined, remove them. First,
	 * point to the start of the array and iterate over it
@@ -764,8 +761,7 @@ static void edac_device_remove_main_sysfs_attributes(
	sysfs_attrib = edac_dev->sysfs_attributes;
	if (sysfs_attrib) {
		while (sysfs_attrib->attr.name != NULL) {
			sysfs_remove_file(&edac_dev->kobj,
					(struct attribute *) sysfs_attrib);
			sysfs_remove_file(&edac_dev->kobj, &sysfs_attrib->attr);
			sysfs_attrib++;
		}
	}
+3 −7
Original line number Diff line number Diff line
@@ -203,7 +203,6 @@ static void mci_release(struct device *dev)
		kfree(mci->csrows);
	}
	kfree(mci->pvt_info);
	kfree(mci->layers);
	kfree(mci);
}

@@ -361,13 +360,12 @@ struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num,
			per_rank = true;
	}

	mci = kzalloc_obj(struct mem_ctl_info);
	mci = kzalloc_flex(*mci, layers, n_layers);
	if (!mci)
		return NULL;

	mci->layers = kzalloc_objs(struct edac_mc_layer, n_layers);
	if (!mci->layers)
		goto error;
	mci->n_layers = n_layers;
	memcpy(mci->layers, layers, sizeof(*layer) * n_layers);

	mci->dev.release = mci_release;
	device_initialize(&mci->dev);
@@ -379,8 +377,6 @@ struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num,
	/* setup index and various internal pointers */
	mci->mc_idx = mc_num;
	mci->tot_dimms = tot_dimms;
	mci->n_layers = n_layers;
	memcpy(mci->layers, layers, sizeof(*layer) * n_layers);
	mci->nr_csrows = tot_csrows;
	mci->num_cschannel = tot_channels;
	mci->csbased = per_rank;
Loading