@@ -86,6 +86,9 @@ static struct ndtest_dimm dimm_group2[] = {
86
86
.uuid_str = "ca0817e2-b618-11ea-9db3-507b9ddc0f72" ,
87
87
.physical_id = 0 ,
88
88
.num_formats = 1 ,
89
+ .flags = PAPR_PMEM_UNARMED | PAPR_PMEM_EMPTY |
90
+ PAPR_PMEM_SAVE_FAILED | PAPR_PMEM_SHUTDOWN_DIRTY |
91
+ PAPR_PMEM_HEALTH_FATAL ,
89
92
},
90
93
};
91
94
@@ -789,6 +792,40 @@ static umode_t ndtest_nvdimm_attr_visible(struct kobject *kobj,
789
792
return a -> mode ;
790
793
}
791
794
795
+ static ssize_t flags_show (struct device * dev ,
796
+ struct device_attribute * attr , char * buf )
797
+ {
798
+ struct nvdimm * nvdimm = to_nvdimm (dev );
799
+ struct ndtest_dimm * dimm = nvdimm_provider_data (nvdimm );
800
+ struct seq_buf s ;
801
+ u64 flags ;
802
+
803
+ flags = dimm -> flags ;
804
+
805
+ seq_buf_init (& s , buf , PAGE_SIZE );
806
+ if (flags & PAPR_PMEM_UNARMED_MASK )
807
+ seq_buf_printf (& s , "not_armed " );
808
+
809
+ if (flags & PAPR_PMEM_BAD_SHUTDOWN_MASK )
810
+ seq_buf_printf (& s , "flush_fail " );
811
+
812
+ if (flags & PAPR_PMEM_BAD_RESTORE_MASK )
813
+ seq_buf_printf (& s , "restore_fail " );
814
+
815
+ if (flags & PAPR_PMEM_SAVE_MASK )
816
+ seq_buf_printf (& s , "save_fail " );
817
+
818
+ if (flags & PAPR_PMEM_SMART_EVENT_MASK )
819
+ seq_buf_printf (& s , "smart_notify " );
820
+
821
+
822
+ if (seq_buf_used (& s ))
823
+ seq_buf_printf (& s , "\n" );
824
+
825
+ return seq_buf_used (& s );
826
+ }
827
+ static DEVICE_ATTR_RO (flags );
828
+
792
829
static struct attribute * ndtest_nvdimm_attributes [] = {
793
830
& dev_attr_nvdimm_show_handle .attr ,
794
831
& dev_attr_vendor .attr ,
@@ -799,6 +836,7 @@ static struct attribute *ndtest_nvdimm_attributes[] = {
799
836
& dev_attr_formats .attr ,
800
837
& dev_attr_format .attr ,
801
838
& dev_attr_format1 .attr ,
839
+ & dev_attr_flags .attr ,
802
840
NULL ,
803
841
};
804
842
@@ -824,6 +862,9 @@ static int ndtest_dimm_register(struct ndtest_priv *priv,
824
862
set_bit (NDD_LABELING , & dimm_flags );
825
863
}
826
864
865
+ if (dimm -> flags & PAPR_PMEM_UNARMED_MASK )
866
+ set_bit (NDD_UNARMED , & dimm_flags );
867
+
827
868
dimm -> nvdimm = nvdimm_create (priv -> bus , dimm ,
828
869
ndtest_nvdimm_attribute_groups , dimm_flags ,
829
870
NDTEST_SCM_DIMM_CMD_MASK , 0 , NULL );
0 commit comments