Commit c405aa3e authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull nvdimm updates from Ira Weiny:
 "The changes include removing duplicate code and updating the nvdimm
  tree to the current kernel interfaces such as using const for struct
  device_type and changing the platform remove callback signature"

* tag 'libnvdimm-for-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
  dax: remove redundant assignment to variable rc
  ndtest: Convert to platform remove callback returning void
  nvdimm/btt: always set max_integrity_segments
  nvdimm: remove nd_integrity_init
  dax: constify the struct device_type usage
  powerpc/papr_scm: Move duplicate definitions to common header files
parents a4946824 41147b00
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -12633,6 +12633,8 @@ F: drivers/rtc/rtc-opal.c
F:	drivers/scsi/ibmvscsi/
F:	drivers/tty/hvc/hvc_opal.c
F:	drivers/watchdog/wdrtas.c
F:	include/linux/papr_scm.h
F:	include/uapi/linux/papr_pdsm.h
F:	tools/testing/selftests/powerpc
N:	/pmac
N:	powermac
+2 −41
Original line number Diff line number Diff line
@@ -16,7 +16,8 @@
#include <linux/nd.h>

#include <asm/plpar_wrappers.h>
#include <asm/papr_pdsm.h>
#include <uapi/linux/papr_pdsm.h>
#include <linux/papr_scm.h>
#include <asm/mce.h>
#include <asm/unaligned.h>
#include <linux/perf_event.h>
@@ -29,46 +30,6 @@
	 (1ul << ND_CMD_SET_CONFIG_DATA) | \
	 (1ul << ND_CMD_CALL))

/* DIMM health bitmap indicators */
/* SCM device is unable to persist memory contents */
#define PAPR_PMEM_UNARMED                   (1ULL << (63 - 0))
/* SCM device failed to persist memory contents */
#define PAPR_PMEM_SHUTDOWN_DIRTY            (1ULL << (63 - 1))
/* SCM device contents are persisted from previous IPL */
#define PAPR_PMEM_SHUTDOWN_CLEAN            (1ULL << (63 - 2))
/* SCM device contents are not persisted from previous IPL */
#define PAPR_PMEM_EMPTY                     (1ULL << (63 - 3))
/* SCM device memory life remaining is critically low */
#define PAPR_PMEM_HEALTH_CRITICAL           (1ULL << (63 - 4))
/* SCM device will be garded off next IPL due to failure */
#define PAPR_PMEM_HEALTH_FATAL              (1ULL << (63 - 5))
/* SCM contents cannot persist due to current platform health status */
#define PAPR_PMEM_HEALTH_UNHEALTHY          (1ULL << (63 - 6))
/* SCM device is unable to persist memory contents in certain conditions */
#define PAPR_PMEM_HEALTH_NON_CRITICAL       (1ULL << (63 - 7))
/* SCM device is encrypted */
#define PAPR_PMEM_ENCRYPTED                 (1ULL << (63 - 8))
/* SCM device has been scrubbed and locked */
#define PAPR_PMEM_SCRUBBED_AND_LOCKED       (1ULL << (63 - 9))

/* Bits status indicators for health bitmap indicating unarmed dimm */
#define PAPR_PMEM_UNARMED_MASK (PAPR_PMEM_UNARMED |		\
				PAPR_PMEM_HEALTH_UNHEALTHY)

/* Bits status indicators for health bitmap indicating unflushed dimm */
#define PAPR_PMEM_BAD_SHUTDOWN_MASK (PAPR_PMEM_SHUTDOWN_DIRTY)

/* Bits status indicators for health bitmap indicating unrestored dimm */
#define PAPR_PMEM_BAD_RESTORE_MASK  (PAPR_PMEM_EMPTY)

/* Bit status indicators for smart event notification */
#define PAPR_PMEM_SMART_EVENT_MASK (PAPR_PMEM_HEALTH_CRITICAL | \
				    PAPR_PMEM_HEALTH_FATAL |	\
				    PAPR_PMEM_HEALTH_UNHEALTHY)

#define PAPR_SCM_PERF_STATS_EYECATCHER __stringify(SCMSTATS)
#define PAPR_SCM_PERF_STATS_VERSION 0x1

/* Struct holding a single performance metric */
struct papr_scm_perf_stat {
	u8 stat_id[8];
+1 −2
Original line number Diff line number Diff line
@@ -818,7 +818,7 @@ static const struct attribute_group *dax_mapping_attribute_groups[] = {
	NULL,
};

static struct device_type dax_mapping_type = {
static const struct device_type dax_mapping_type = {
	.release = dax_mapping_release,
	.groups = dax_mapping_attribute_groups,
};
@@ -1204,7 +1204,6 @@ static ssize_t mapping_store(struct device *dev, struct device_attribute *attr,
	if (rc)
		return rc;

	rc = -ENXIO;
	rc = down_write_killable(&dax_region_rwsem);
	if (rc)
		return rc;
+8 −4
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
#include <linux/highmem.h>
#include <linux/debugfs.h>
#include <linux/blkdev.h>
#include <linux/blk-integrity.h>
#include <linux/pagemap.h>
#include <linux/module.h>
#include <linux/device.h>
@@ -1499,6 +1500,7 @@ static int btt_blk_init(struct btt *btt)
	struct queue_limits lim = {
		.logical_block_size	= btt->sector_size,
		.max_hw_sectors		= UINT_MAX,
		.max_integrity_segments	= 1,
	};
	int rc;

@@ -1514,10 +1516,12 @@ static int btt_blk_init(struct btt *btt)
	blk_queue_flag_set(QUEUE_FLAG_NONROT, btt->btt_disk->queue);
	blk_queue_flag_set(QUEUE_FLAG_SYNCHRONOUS, btt->btt_disk->queue);

	if (btt_meta_size(btt)) {
		rc = nd_integrity_init(btt->btt_disk, btt_meta_size(btt));
		if (rc)
			goto out_cleanup_disk;
	if (btt_meta_size(btt) && IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY)) {
		struct blk_integrity bi = {
			.tuple_size	= btt_meta_size(btt),
			.tag_size	= btt_meta_size(btt),
		};
		blk_integrity_register(btt->btt_disk, &bi);
	}

	set_capacity(btt->btt_disk, btt->nlba * btt->sector_size >> 9);
+0 −30
Original line number Diff line number Diff line
@@ -7,7 +7,6 @@
#include <linux/export.h>
#include <linux/module.h>
#include <linux/blkdev.h>
#include <linux/blk-integrity.h>
#include <linux/device.h>
#include <linux/ctype.h>
#include <linux/ndctl.h>
@@ -508,35 +507,6 @@ int nvdimm_bus_add_badrange(struct nvdimm_bus *nvdimm_bus, u64 addr, u64 length)
}
EXPORT_SYMBOL_GPL(nvdimm_bus_add_badrange);

#ifdef CONFIG_BLK_DEV_INTEGRITY
int nd_integrity_init(struct gendisk *disk, unsigned long meta_size)
{
	struct blk_integrity bi;

	if (meta_size == 0)
		return 0;

	memset(&bi, 0, sizeof(bi));

	bi.tuple_size = meta_size;
	bi.tag_size = meta_size;

	blk_integrity_register(disk, &bi);
	blk_queue_max_integrity_segments(disk->queue, 1);

	return 0;
}
EXPORT_SYMBOL(nd_integrity_init);

#else /* CONFIG_BLK_DEV_INTEGRITY */
int nd_integrity_init(struct gendisk *disk, unsigned long meta_size)
{
	return 0;
}
EXPORT_SYMBOL(nd_integrity_init);

#endif

static __init int libnvdimm_init(void)
{
	int rc;
Loading