Lines Matching +full:row +full:- +full:hold

9  *	http://www.anime.net/~goemon/linux-ecc/
64 struct mem_ctl_info *mci = dimm->mci; in edac_dimm_info_location()
68 for (i = 0; i < mci->n_layers; i++) { in edac_dimm_info_location()
70 edac_layer_name[mci->layers[i].type], in edac_dimm_info_location()
71 dimm->location[i]); in edac_dimm_info_location()
73 len -= n; in edac_dimm_info_location()
84 edac_dbg(4, " channel->chan_idx = %d\n", chan->chan_idx); in edac_mc_dump_channel()
86 edac_dbg(4, " channel->csrow = %p\n", chan->csrow); in edac_mc_dump_channel()
87 edac_dbg(4, " channel->dimm = %p\n", chan->dimm); in edac_mc_dump_channel()
94 if (!dimm->nr_pages) in edac_mc_dump_dimm()
99 edac_dbg(4, "%s%i: %smapped as virtual row %d, chan %d\n", in edac_mc_dump_dimm()
100 dimm->mci->csbased ? "rank" : "dimm", in edac_mc_dump_dimm()
101 dimm->idx, location, dimm->csrow, dimm->cschannel); in edac_mc_dump_dimm()
103 edac_dbg(4, " dimm->label = '%s'\n", dimm->label); in edac_mc_dump_dimm()
104 edac_dbg(4, " dimm->nr_pages = 0x%x\n", dimm->nr_pages); in edac_mc_dump_dimm()
105 edac_dbg(4, " dimm->grain = %d\n", dimm->grain); in edac_mc_dump_dimm()
110 edac_dbg(4, "csrow->csrow_idx = %d\n", csrow->csrow_idx); in edac_mc_dump_csrow()
112 edac_dbg(4, " csrow->first_page = 0x%lx\n", csrow->first_page); in edac_mc_dump_csrow()
113 edac_dbg(4, " csrow->last_page = 0x%lx\n", csrow->last_page); in edac_mc_dump_csrow()
114 edac_dbg(4, " csrow->page_mask = 0x%lx\n", csrow->page_mask); in edac_mc_dump_csrow()
115 edac_dbg(4, " csrow->nr_channels = %d\n", csrow->nr_channels); in edac_mc_dump_csrow()
116 edac_dbg(4, " csrow->channels = %p\n", csrow->channels); in edac_mc_dump_csrow()
117 edac_dbg(4, " csrow->mci = %p\n", csrow->mci); in edac_mc_dump_csrow()
123 edac_dbg(3, "\tmci->mtype_cap = %lx\n", mci->mtype_cap); in edac_mc_dump_mci()
124 edac_dbg(3, "\tmci->edac_ctl_cap = %lx\n", mci->edac_ctl_cap); in edac_mc_dump_mci()
125 edac_dbg(3, "\tmci->edac_cap = %lx\n", mci->edac_cap); in edac_mc_dump_mci()
126 edac_dbg(4, "\tmci->edac_check = %p\n", mci->edac_check); in edac_mc_dump_mci()
127 edac_dbg(3, "\tmci->nr_csrows = %d, csrows = %p\n", in edac_mc_dump_mci()
128 mci->nr_csrows, mci->csrows); in edac_mc_dump_mci()
129 edac_dbg(3, "\tmci->nr_dimms = %d, dimms = %p\n", in edac_mc_dump_mci()
130 mci->tot_dimms, mci->dimms); in edac_mc_dump_mci()
131 edac_dbg(3, "\tdev = %p\n", mci->pdev); in edac_mc_dump_mci()
133 mci->mod_name, mci->ctl_name); in edac_mc_dump_mci()
134 edac_dbg(3, "\tpvt_info = %p\n\n", mci->pvt_info); in edac_mc_dump_mci()
146 [MEM_SDR] = "Unbuffered-SDR",
147 [MEM_RDR] = "Registered-SDR",
148 [MEM_DDR] = "Unbuffered-DDR",
149 [MEM_RDDR] = "Registered-DDR",
151 [MEM_DDR2] = "Unbuffered-DDR2",
152 [MEM_FB_DDR2] = "FullyBuffered-DDR2",
153 [MEM_RDDR2] = "Registered-DDR2",
155 [MEM_DDR3] = "Unbuffered-DDR3",
156 [MEM_RDDR3] = "Registered-DDR3",
157 [MEM_LRDDR3] = "Load-Reduced-DDR3-RAM",
158 [MEM_LPDDR3] = "Low-Power-DDR3-RAM",
159 [MEM_DDR4] = "Unbuffered-DDR4",
160 [MEM_RDDR4] = "Registered-DDR4",
161 [MEM_LPDDR4] = "Low-Power-DDR4-RAM",
162 [MEM_LRDDR4] = "Load-Reduced-DDR4-RAM",
163 [MEM_DDR5] = "Unbuffered-DDR5",
164 [MEM_RDDR5] = "Registered-DDR5",
165 [MEM_LRDDR5] = "Load-Reduced-DDR5-RAM",
166 [MEM_NVDIMM] = "Non-volatile-RAM",
167 [MEM_WIO2] = "Wide-IO-2",
168 [MEM_HBM2] = "High-bandwidth-memory-Gen2",
169 [MEM_HBM3] = "High-bandwidth-memory-Gen3",
175 put_device(&mci->dev); in _edac_mc_free()
182 int i, chn, row; in mci_release() local
184 if (mci->dimms) { in mci_release()
185 for (i = 0; i < mci->tot_dimms; i++) in mci_release()
186 kfree(mci->dimms[i]); in mci_release()
187 kfree(mci->dimms); in mci_release()
190 if (mci->csrows) { in mci_release()
191 for (row = 0; row < mci->nr_csrows; row++) { in mci_release()
192 csr = mci->csrows[row]; in mci_release()
196 if (csr->channels) { in mci_release()
197 for (chn = 0; chn < mci->num_cschannel; chn++) in mci_release()
198 kfree(csr->channels[chn]); in mci_release()
199 kfree(csr->channels); in mci_release()
203 kfree(mci->csrows); in mci_release()
205 kfree(mci->pvt_info); in mci_release()
206 kfree(mci->layers); in mci_release()
212 unsigned int tot_channels = mci->num_cschannel; in edac_mc_alloc_csrows()
213 unsigned int tot_csrows = mci->nr_csrows; in edac_mc_alloc_csrows()
214 unsigned int row, chn; in edac_mc_alloc_csrows() local
219 mci->csrows = kcalloc(tot_csrows, sizeof(*mci->csrows), GFP_KERNEL); in edac_mc_alloc_csrows()
220 if (!mci->csrows) in edac_mc_alloc_csrows()
221 return -ENOMEM; in edac_mc_alloc_csrows()
223 for (row = 0; row < tot_csrows; row++) { in edac_mc_alloc_csrows()
226 csr = kzalloc(sizeof(**mci->csrows), GFP_KERNEL); in edac_mc_alloc_csrows()
228 return -ENOMEM; in edac_mc_alloc_csrows()
230 mci->csrows[row] = csr; in edac_mc_alloc_csrows()
231 csr->csrow_idx = row; in edac_mc_alloc_csrows()
232 csr->mci = mci; in edac_mc_alloc_csrows()
233 csr->nr_channels = tot_channels; in edac_mc_alloc_csrows()
234 csr->channels = kcalloc(tot_channels, sizeof(*csr->channels), in edac_mc_alloc_csrows()
236 if (!csr->channels) in edac_mc_alloc_csrows()
237 return -ENOMEM; in edac_mc_alloc_csrows()
242 chan = kzalloc(sizeof(**csr->channels), GFP_KERNEL); in edac_mc_alloc_csrows()
244 return -ENOMEM; in edac_mc_alloc_csrows()
246 csr->channels[chn] = chan; in edac_mc_alloc_csrows()
247 chan->chan_idx = chn; in edac_mc_alloc_csrows()
248 chan->csrow = csr; in edac_mc_alloc_csrows()
258 unsigned int row, chn, idx; in edac_mc_alloc_dimms() local
265 mci->dimms = kcalloc(mci->tot_dimms, sizeof(*mci->dimms), GFP_KERNEL); in edac_mc_alloc_dimms()
266 if (!mci->dimms) in edac_mc_alloc_dimms()
267 return -ENOMEM; in edac_mc_alloc_dimms()
270 row = 0; in edac_mc_alloc_dimms()
272 for (idx = 0; idx < mci->tot_dimms; idx++) { in edac_mc_alloc_dimms()
277 chan = mci->csrows[row]->channels[chn]; in edac_mc_alloc_dimms()
279 dimm = kzalloc(sizeof(**mci->dimms), GFP_KERNEL); in edac_mc_alloc_dimms()
281 return -ENOMEM; in edac_mc_alloc_dimms()
282 mci->dimms[idx] = dimm; in edac_mc_alloc_dimms()
283 dimm->mci = mci; in edac_mc_alloc_dimms()
284 dimm->idx = idx; in edac_mc_alloc_dimms()
289 len = sizeof(dimm->label); in edac_mc_alloc_dimms()
290 p = dimm->label; in edac_mc_alloc_dimms()
291 n = scnprintf(p, len, "mc#%u", mci->mc_idx); in edac_mc_alloc_dimms()
293 len -= n; in edac_mc_alloc_dimms()
294 for (layer = 0; layer < mci->n_layers; layer++) { in edac_mc_alloc_dimms()
296 edac_layer_name[mci->layers[layer].type], in edac_mc_alloc_dimms()
299 len -= n; in edac_mc_alloc_dimms()
300 dimm->location[layer] = pos[layer]; in edac_mc_alloc_dimms()
304 chan->dimm = dimm; in edac_mc_alloc_dimms()
305 dimm->csrow = row; in edac_mc_alloc_dimms()
306 dimm->cschannel = chn; in edac_mc_alloc_dimms()
309 if (mci->layers[0].is_virt_csrow) { in edac_mc_alloc_dimms()
311 if (chn == mci->num_cschannel) { in edac_mc_alloc_dimms()
313 row++; in edac_mc_alloc_dimms()
316 row++; in edac_mc_alloc_dimms()
317 if (row == mci->nr_csrows) { in edac_mc_alloc_dimms()
318 row = 0; in edac_mc_alloc_dimms()
324 for (layer = mci->n_layers - 1; layer >= 0; layer--) { in edac_mc_alloc_dimms()
326 if (pos[layer] < mci->layers[layer].size) in edac_mc_alloc_dimms()
369 mci->layers = kcalloc(n_layers, sizeof(struct edac_mc_layer), GFP_KERNEL); in edac_mc_alloc()
370 if (!mci->layers) in edac_mc_alloc()
373 mci->pvt_info = kzalloc(sz_pvt, GFP_KERNEL); in edac_mc_alloc()
374 if (!mci->pvt_info) in edac_mc_alloc()
377 mci->dev.release = mci_release; in edac_mc_alloc()
378 device_initialize(&mci->dev); in edac_mc_alloc()
381 mci->mc_idx = mc_num; in edac_mc_alloc()
382 mci->tot_dimms = tot_dimms; in edac_mc_alloc()
383 mci->n_layers = n_layers; in edac_mc_alloc()
384 memcpy(mci->layers, layers, sizeof(*layer) * n_layers); in edac_mc_alloc()
385 mci->nr_csrows = tot_csrows; in edac_mc_alloc()
386 mci->num_cschannel = tot_channels; in edac_mc_alloc()
387 mci->csbased = per_rank; in edac_mc_alloc()
395 mci->op_state = OP_ALLOC; in edac_mc_alloc()
428 /* Caller must hold mem_ctls_mutex */
439 if (mci->pdev == dev) in __find_mci_by_dev()
476 if (mci->op_state != OP_RUNNING_POLL) { in edac_mc_workq_function()
482 mci->edac_check(mci); in edac_mc_workq_function()
487 edac_queue_work(&mci->work, msecs_to_jiffies(edac_mc_get_poll_msec())); in edac_mc_workq_function()
506 if (mci->op_state == OP_RUNNING_POLL) in edac_mc_reset_delay_period()
507 edac_mod_work(&mci->work, value); in edac_mc_reset_delay_period()
516 * assign a unique value to mci->mc_idx.
529 p = __find_mci_by_dev(mci->pdev); in add_mc_to_global_list()
536 if (p->mc_idx >= mci->mc_idx) { in add_mc_to_global_list()
537 if (unlikely(p->mc_idx == mci->mc_idx)) in add_mc_to_global_list()
545 list_add_tail_rcu(&mci->link, insert_before); in add_mc_to_global_list()
550 "%s (%s) %s %s already assigned %d\n", dev_name(p->pdev), in add_mc_to_global_list()
551 edac_dev_name(mci), p->mod_name, p->ctl_name, p->mc_idx); in add_mc_to_global_list()
556 "bug in low-level driver: attempt to assign\n" in add_mc_to_global_list()
557 " duplicate mc_idx %d in %s()\n", p->mc_idx, __func__); in add_mc_to_global_list()
563 list_del_rcu(&mci->link); in del_mc_from_global_list()
569 INIT_LIST_HEAD(&mci->link); in del_mc_from_global_list()
583 if (mci->mc_idx == idx) in edac_mc_find()
600 /* FIXME - should a warning be printed if no error detection? correction? */
604 int ret = -EINVAL; in edac_mc_add_mc_with_groups()
615 for (i = 0; i < mci->nr_csrows; i++) { in edac_mc_add_mc_with_groups()
616 struct csrow_info *csrow = mci->csrows[i]; in edac_mc_add_mc_with_groups()
620 for (j = 0; j < csrow->nr_channels; j++) in edac_mc_add_mc_with_groups()
621 nr_pages += csrow->channels[j]->dimm->nr_pages; in edac_mc_add_mc_with_groups()
625 for (j = 0; j < csrow->nr_channels; j++) in edac_mc_add_mc_with_groups()
626 if (csrow->channels[j]->dimm->nr_pages) in edac_mc_add_mc_with_groups()
627 edac_mc_dump_channel(csrow->channels[j]); in edac_mc_add_mc_with_groups()
636 if (edac_mc_owner && edac_mc_owner != mci->mod_name) { in edac_mc_add_mc_with_groups()
637 ret = -EPERM; in edac_mc_add_mc_with_groups()
645 mci->start_time = jiffies; in edac_mc_add_mc_with_groups()
647 mci->bus = edac_get_sysfs_subsys(); in edac_mc_add_mc_with_groups()
655 if (mci->edac_check) { in edac_mc_add_mc_with_groups()
656 mci->op_state = OP_RUNNING_POLL; in edac_mc_add_mc_with_groups()
658 INIT_DELAYED_WORK(&mci->work, edac_mc_workq_function); in edac_mc_add_mc_with_groups()
659 edac_queue_work(&mci->work, msecs_to_jiffies(edac_mc_get_poll_msec())); in edac_mc_add_mc_with_groups()
662 mci->op_state = OP_RUNNING_INTERRUPT; in edac_mc_add_mc_with_groups()
668 mci->mod_name, mci->ctl_name, mci->dev_name, in edac_mc_add_mc_with_groups()
669 edac_op_state_to_string(mci->op_state)); in edac_mc_add_mc_with_groups()
671 edac_mc_owner = mci->mod_name; in edac_mc_add_mc_with_groups()
701 mci->op_state = OP_OFFLINE; in edac_mc_del_mc()
708 if (mci->edac_check) in edac_mc_del_mc()
709 edac_stop_work(&mci->work); in edac_mc_del_mc()
715 "Removed device %d for %s %s: DEV %s\n", mci->mc_idx, in edac_mc_del_mc()
716 mci->mod_name, mci->ctl_name, edac_dev_name(mci)); in edac_mc_del_mc()
753 /* FIXME - should return -1 */
756 struct csrow_info **csrows = mci->csrows; in edac_mc_find_csrow_by_page()
757 int row, i, j, n; in edac_mc_find_csrow_by_page() local
759 edac_dbg(1, "MC%d: 0x%lx\n", mci->mc_idx, page); in edac_mc_find_csrow_by_page()
760 row = -1; in edac_mc_find_csrow_by_page()
762 for (i = 0; i < mci->nr_csrows; i++) { in edac_mc_find_csrow_by_page()
765 for (j = 0; j < csrow->nr_channels; j++) { in edac_mc_find_csrow_by_page()
766 struct dimm_info *dimm = csrow->channels[j]->dimm; in edac_mc_find_csrow_by_page()
767 n += dimm->nr_pages; in edac_mc_find_csrow_by_page()
773 mci->mc_idx, in edac_mc_find_csrow_by_page()
774 csrow->first_page, page, csrow->last_page, in edac_mc_find_csrow_by_page()
775 csrow->page_mask); in edac_mc_find_csrow_by_page()
777 if ((page >= csrow->first_page) && in edac_mc_find_csrow_by_page()
778 (page <= csrow->last_page) && in edac_mc_find_csrow_by_page()
779 ((page & csrow->page_mask) == in edac_mc_find_csrow_by_page()
780 (csrow->first_page & csrow->page_mask))) { in edac_mc_find_csrow_by_page()
781 row = i; in edac_mc_find_csrow_by_page()
786 if (row == -1) in edac_mc_find_csrow_by_page()
791 return row; in edac_mc_find_csrow_by_page()
806 int pos[EDAC_MAX_LAYERS] = { e->top_layer, e->mid_layer, e->low_layer }; in edac_inc_ce_error()
810 mci->ce_mc += e->error_count; in edac_inc_ce_error()
813 dimm->ce_count += e->error_count; in edac_inc_ce_error()
815 mci->ce_noinfo_count += e->error_count; in edac_inc_ce_error()
820 int pos[EDAC_MAX_LAYERS] = { e->top_layer, e->mid_layer, e->low_layer }; in edac_inc_ue_error()
824 mci->ue_mc += e->error_count; in edac_inc_ue_error()
827 dimm->ue_count += e->error_count; in edac_inc_ue_error()
829 mci->ue_noinfo_count += e->error_count; in edac_inc_ue_error()
840 e->error_count, e->msg, in edac_ce_error()
841 *e->msg ? " " : "", in edac_ce_error()
842 e->label, e->location, e->page_frame_number, e->offset_in_page, in edac_ce_error()
843 e->grain, e->syndrome, in edac_ce_error()
844 *e->other_detail ? " - " : "", in edac_ce_error()
845 e->other_detail); in edac_ce_error()
850 if (mci->scrub_mode == SCRUB_SW_SRC) { in edac_ce_error()
856 * devices are mapped. This mapping is MC-dependent in edac_ce_error()
859 * then be mapped to a virtual page - which can then in edac_ce_error()
862 remapped_page = mci->ctl_page_to_phys ? in edac_ce_error()
863 mci->ctl_page_to_phys(mci, e->page_frame_number) : in edac_ce_error()
864 e->page_frame_number; in edac_ce_error()
866 edac_mc_scrub_block(remapped_page, e->offset_in_page, e->grain); in edac_ce_error()
877 e->error_count, e->msg, in edac_ue_error()
878 *e->msg ? " " : "", in edac_ue_error()
879 e->label, e->location, e->page_frame_number, e->offset_in_page, in edac_ue_error()
880 e->grain, in edac_ue_error()
881 *e->other_detail ? " - " : "", in edac_ue_error()
882 e->other_detail); in edac_ue_error()
889 e->msg, in edac_ue_error()
890 *e->msg ? " " : "", in edac_ue_error()
891 e->label, e->location, e->page_frame_number, e->offset_in_page, in edac_ue_error()
892 e->grain, in edac_ue_error()
893 *e->other_detail ? " - " : "", in edac_ue_error()
894 e->other_detail); in edac_ue_error()
898 static void edac_inc_csrow(struct edac_raw_error_desc *e, int row, int chan) in edac_inc_csrow() argument
901 enum hw_event_mc_err_type type = e->type; in edac_inc_csrow()
902 u16 count = e->error_count; in edac_inc_csrow()
904 if (row < 0) in edac_inc_csrow()
907 edac_dbg(4, "csrow/channel to increment: (%d,%d)\n", row, chan); in edac_inc_csrow()
910 mci->csrows[row]->ce_count += count; in edac_inc_csrow()
912 mci->csrows[row]->channels[chan]->ce_count += count; in edac_inc_csrow()
914 mci->csrows[row]->ue_count += count; in edac_inc_csrow()
923 /* Sanity-check driver-supplied grain value. */ in edac_raw_mc_handle_error()
924 if (WARN_ON_ONCE(!e->grain)) in edac_raw_mc_handle_error()
925 e->grain = 1; in edac_raw_mc_handle_error()
927 grain_bits = fls_long(e->grain - 1); in edac_raw_mc_handle_error()
931 trace_mc_event(e->type, e->msg, e->label, e->error_count, in edac_raw_mc_handle_error()
932 mci->mc_idx, e->top_layer, e->mid_layer, in edac_raw_mc_handle_error()
933 e->low_layer, in edac_raw_mc_handle_error()
934 (e->page_frame_number << PAGE_SHIFT) | e->offset_in_page, in edac_raw_mc_handle_error()
935 grain_bits, e->syndrome, e->other_detail); in edac_raw_mc_handle_error()
937 if (e->type == HW_EVENT_ERR_CORRECTED) in edac_raw_mc_handle_error()
958 int row = -1, chan = -1; in edac_mc_handle_error() local
961 struct edac_raw_error_desc *e = &mci->error_desc; in edac_mc_handle_error()
965 edac_dbg(3, "MC%d\n", mci->mc_idx); in edac_mc_handle_error()
969 e->error_count = error_count; in edac_mc_handle_error()
970 e->type = type; in edac_mc_handle_error()
971 e->top_layer = top_layer; in edac_mc_handle_error()
972 e->mid_layer = mid_layer; in edac_mc_handle_error()
973 e->low_layer = low_layer; in edac_mc_handle_error()
974 e->page_frame_number = page_frame_number; in edac_mc_handle_error()
975 e->offset_in_page = offset_in_page; in edac_mc_handle_error()
976 e->syndrome = syndrome; in edac_mc_handle_error()
978 e->msg = msg ?: ""; in edac_mc_handle_error()
979 e->other_detail = other_detail ?: ""; in edac_mc_handle_error()
986 for (i = 0; i < mci->n_layers; i++) { in edac_mc_handle_error()
987 if (pos[i] >= (int)mci->layers[i].size) { in edac_mc_handle_error()
991 edac_layer_name[mci->layers[i].type], in edac_mc_handle_error()
992 pos[i], mci->layers[i].size); in edac_mc_handle_error()
999 pos[i] = -1; in edac_mc_handle_error()
1010 * On FB-DIMM memory controllers, for uncorrected errors, it is common in edac_mc_handle_error()
1016 p = e->label; in edac_mc_handle_error()
1018 end = p + sizeof(e->label); in edac_mc_handle_error()
1022 if (top_layer >= 0 && top_layer != dimm->location[0]) in edac_mc_handle_error()
1024 if (mid_layer >= 0 && mid_layer != dimm->location[1]) in edac_mc_handle_error()
1026 if (low_layer >= 0 && low_layer != dimm->location[2]) in edac_mc_handle_error()
1030 if (dimm->grain > e->grain) in edac_mc_handle_error()
1031 e->grain = dimm->grain; in edac_mc_handle_error()
1034 * If the error is memory-controller wide, there's no need to in edac_mc_handle_error()
1039 if (!dimm->nr_pages) in edac_mc_handle_error()
1044 p = e->label; in edac_mc_handle_error()
1047 p += scnprintf(p, end - p, "%s%s", prefix, dimm->label); in edac_mc_handle_error()
1056 mci->csbased ? "rank" : "dimm", in edac_mc_handle_error()
1057 dimm->csrow, dimm->cschannel); in edac_mc_handle_error()
1058 if (row == -1) in edac_mc_handle_error()
1059 row = dimm->csrow; in edac_mc_handle_error()
1060 else if (row >= 0 && row != dimm->csrow) in edac_mc_handle_error()
1061 row = -2; in edac_mc_handle_error()
1063 if (chan == -1) in edac_mc_handle_error()
1064 chan = dimm->cschannel; in edac_mc_handle_error()
1065 else if (chan >= 0 && chan != dimm->cschannel) in edac_mc_handle_error()
1066 chan = -2; in edac_mc_handle_error()
1070 strscpy(e->label, "any memory", sizeof(e->label)); in edac_mc_handle_error()
1071 else if (!*e->label) in edac_mc_handle_error()
1072 strscpy(e->label, "unknown memory", sizeof(e->label)); in edac_mc_handle_error()
1074 edac_inc_csrow(e, row, chan); in edac_mc_handle_error()
1077 p = e->location; in edac_mc_handle_error()
1078 end = p + sizeof(e->location); in edac_mc_handle_error()
1081 for (i = 0; i < mci->n_layers; i++) { in edac_mc_handle_error()
1085 p += scnprintf(p, end - p, "%s%s:%d", prefix, in edac_mc_handle_error()
1086 edac_layer_name[mci->layers[i].type], pos[i]); in edac_mc_handle_error()