Commit c405aa3e authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'libnvdimm-for-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm

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
...@@ -12633,6 +12633,8 @@ F: drivers/rtc/rtc-opal.c ...@@ -12633,6 +12633,8 @@ F: drivers/rtc/rtc-opal.c
F: drivers/scsi/ibmvscsi/ F: drivers/scsi/ibmvscsi/
F: drivers/tty/hvc/hvc_opal.c F: drivers/tty/hvc/hvc_opal.c
F: drivers/watchdog/wdrtas.c F: drivers/watchdog/wdrtas.c
F: include/linux/papr_scm.h
F: include/uapi/linux/papr_pdsm.h
F: tools/testing/selftests/powerpc F: tools/testing/selftests/powerpc
N: /pmac N: /pmac
N: powermac N: powermac
......
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
#include <linux/nd.h> #include <linux/nd.h>
#include <asm/plpar_wrappers.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/mce.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include <linux/perf_event.h> #include <linux/perf_event.h>
...@@ -29,46 +30,6 @@ ...@@ -29,46 +30,6 @@
(1ul << ND_CMD_SET_CONFIG_DATA) | \ (1ul << ND_CMD_SET_CONFIG_DATA) | \
(1ul << ND_CMD_CALL)) (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 holding a single performance metric */
struct papr_scm_perf_stat { struct papr_scm_perf_stat {
u8 stat_id[8]; u8 stat_id[8];
......
...@@ -818,7 +818,7 @@ static const struct attribute_group *dax_mapping_attribute_groups[] = { ...@@ -818,7 +818,7 @@ static const struct attribute_group *dax_mapping_attribute_groups[] = {
NULL, NULL,
}; };
static struct device_type dax_mapping_type = { static const struct device_type dax_mapping_type = {
.release = dax_mapping_release, .release = dax_mapping_release,
.groups = dax_mapping_attribute_groups, .groups = dax_mapping_attribute_groups,
}; };
...@@ -1204,7 +1204,6 @@ static ssize_t mapping_store(struct device *dev, struct device_attribute *attr, ...@@ -1204,7 +1204,6 @@ static ssize_t mapping_store(struct device *dev, struct device_attribute *attr,
if (rc) if (rc)
return rc; return rc;
rc = -ENXIO;
rc = down_write_killable(&dax_region_rwsem); rc = down_write_killable(&dax_region_rwsem);
if (rc) if (rc)
return rc; return rc;
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <linux/blk-integrity.h>
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/device.h> #include <linux/device.h>
...@@ -1499,6 +1500,7 @@ static int btt_blk_init(struct btt *btt) ...@@ -1499,6 +1500,7 @@ static int btt_blk_init(struct btt *btt)
struct queue_limits lim = { struct queue_limits lim = {
.logical_block_size = btt->sector_size, .logical_block_size = btt->sector_size,
.max_hw_sectors = UINT_MAX, .max_hw_sectors = UINT_MAX,
.max_integrity_segments = 1,
}; };
int rc; int rc;
...@@ -1514,10 +1516,12 @@ static int btt_blk_init(struct btt *btt) ...@@ -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_NONROT, btt->btt_disk->queue);
blk_queue_flag_set(QUEUE_FLAG_SYNCHRONOUS, btt->btt_disk->queue); blk_queue_flag_set(QUEUE_FLAG_SYNCHRONOUS, btt->btt_disk->queue);
if (btt_meta_size(btt)) { if (btt_meta_size(btt) && IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY)) {
rc = nd_integrity_init(btt->btt_disk, btt_meta_size(btt)); struct blk_integrity bi = {
if (rc) .tuple_size = btt_meta_size(btt),
goto out_cleanup_disk; .tag_size = btt_meta_size(btt),
};
blk_integrity_register(btt->btt_disk, &bi);
} }
set_capacity(btt->btt_disk, btt->nlba * btt->sector_size >> 9); set_capacity(btt->btt_disk, btt->nlba * btt->sector_size >> 9);
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include <linux/export.h> #include <linux/export.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <linux/blk-integrity.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/ndctl.h> #include <linux/ndctl.h>
...@@ -508,35 +507,6 @@ int nvdimm_bus_add_badrange(struct nvdimm_bus *nvdimm_bus, u64 addr, u64 length) ...@@ -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); 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) static __init int libnvdimm_init(void)
{ {
int rc; int rc;
......
...@@ -489,7 +489,6 @@ enum nd_async_mode { ...@@ -489,7 +489,6 @@ enum nd_async_mode {
ND_ASYNC, ND_ASYNC,
}; };
int nd_integrity_init(struct gendisk *disk, unsigned long meta_size);
void wait_nvdimm_bus_probe_idle(struct device *dev); void wait_nvdimm_bus_probe_idle(struct device *dev);
void nd_device_register(struct device *dev); void nd_device_register(struct device *dev);
void nd_device_unregister(struct device *dev, enum nd_async_mode mode); void nd_device_unregister(struct device *dev, enum nd_async_mode mode);
......
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef __LINUX_PAPR_SCM_H
#define __LINUX_PAPR_SCM_H
/* 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))
#define PAPR_PMEM_SAVE_FAILED (1ULL << (63 - 10))
/* 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_PMEM_SAVE_MASK (PAPR_PMEM_SAVE_FAILED)
#define PAPR_SCM_PERF_STATS_EYECATCHER __stringify(SCMSTATS)
#define PAPR_SCM_PERF_STATS_VERSION 0x1
#endif /* __LINUX_PAPR_SCM_H */
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#include <nd-core.h> #include <nd-core.h>
#include <linux/printk.h> #include <linux/printk.h>
#include <linux/seq_buf.h> #include <linux/seq_buf.h>
#include <linux/papr_scm.h>
#include <uapi/linux/papr_pdsm.h>
#include "../watermark.h" #include "../watermark.h"
#include "nfit_test.h" #include "nfit_test.h"
...@@ -830,12 +832,11 @@ static int ndtest_bus_register(struct ndtest_priv *p) ...@@ -830,12 +832,11 @@ static int ndtest_bus_register(struct ndtest_priv *p)
return 0; return 0;
} }
static int ndtest_remove(struct platform_device *pdev) static void ndtest_remove(struct platform_device *pdev)
{ {
struct ndtest_priv *p = to_ndtest_priv(&pdev->dev); struct ndtest_priv *p = to_ndtest_priv(&pdev->dev);
nvdimm_bus_unregister(p->bus); nvdimm_bus_unregister(p->bus);
return 0;
} }
static int ndtest_probe(struct platform_device *pdev) static int ndtest_probe(struct platform_device *pdev)
...@@ -882,7 +883,7 @@ static const struct platform_device_id ndtest_id[] = { ...@@ -882,7 +883,7 @@ static const struct platform_device_id ndtest_id[] = {
static struct platform_driver ndtest_driver = { static struct platform_driver ndtest_driver = {
.probe = ndtest_probe, .probe = ndtest_probe,
.remove = ndtest_remove, .remove_new = ndtest_remove,
.driver = { .driver = {
.name = KBUILD_MODNAME, .name = KBUILD_MODNAME,
}, },
......
...@@ -5,37 +5,6 @@ ...@@ -5,37 +5,6 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/libnvdimm.h> #include <linux/libnvdimm.h>
/* 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 not persisted from previous IPL */
#define PAPR_PMEM_EMPTY (1ULL << (63 - 3))
#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))
/* Bits status indicators for health bitmap indicating unarmed dimm */
#define PAPR_PMEM_UNARMED_MASK (PAPR_PMEM_UNARMED | \
PAPR_PMEM_HEALTH_UNHEALTHY)
#define PAPR_PMEM_SAVE_FAILED (1ULL << (63 - 10))
/* 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_PMEM_SAVE_MASK (PAPR_PMEM_SAVE_FAILED)
struct ndtest_config; struct ndtest_config;
struct ndtest_priv { struct ndtest_priv {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment