public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Jim Snow <jim.snow@intel.com>,
	Lukasz Anaczkowski <lukasz.anaczkowski@intel.com>,
	Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
	Jiri Slaby <jslaby@suse.cz>, Vinson Lee <vlee@twopensource.com>
Subject: [PATCH 3.10 10/22] sb_edac: Fix erroneous bytes->gigabytes conversion
Date: Wed,  1 Jul 2015 11:40:15 -0700	[thread overview]
Message-ID: <20150701183942.424823938@linuxfoundation.org> (raw)
In-Reply-To: <20150701183942.019582154@linuxfoundation.org>

3.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jim Snow <jim.m.snow@intel.com>

commit 8c009100295597f23978c224aec5751a365bc965 upstream.

Signed-off-by: Jim Snow <jim.snow@intel.com>
Signed-off-by: Lukasz Anaczkowski <lukasz.anaczkowski@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Vinson Lee <vlee@twopensource.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/edac/sb_edac.c |   38 ++++++++++++++++++++------------------
 1 file changed, 20 insertions(+), 18 deletions(-)

--- a/drivers/edac/sb_edac.c
+++ b/drivers/edac/sb_edac.c
@@ -623,7 +623,7 @@ static void get_memory_layout(const stru
 	u32 reg;
 	u64 limit, prv = 0;
 	u64 tmp_mb;
-	u32 mb, kb;
+	u32 gb, mb;
 	u32 rir_way;
 
 	/*
@@ -636,8 +636,9 @@ static void get_memory_layout(const stru
 	pvt->tolm = GET_TOLM(reg);
 	tmp_mb = (1 + pvt->tolm) >> 20;
 
-	mb = div_u64_rem(tmp_mb, 1000, &kb);
-	edac_dbg(0, "TOLM: %u.%03u GB (0x%016Lx)\n", mb, kb, (u64)pvt->tolm);
+	gb = div_u64_rem(tmp_mb, 1024, &mb);
+	edac_dbg(0, "TOLM: %u.%03u GB (0x%016Lx)\n",
+		gb, (mb*1000)/1024, (u64)pvt->tolm);
 
 	/* Address range is already 45:25 */
 	pci_read_config_dword(pvt->pci_sad1, TOHM,
@@ -645,8 +646,9 @@ static void get_memory_layout(const stru
 	pvt->tohm = GET_TOHM(reg);
 	tmp_mb = (1 + pvt->tohm) >> 20;
 
-	mb = div_u64_rem(tmp_mb, 1000, &kb);
-	edac_dbg(0, "TOHM: %u.%03u GB (0x%016Lx)\n", mb, kb, (u64)pvt->tohm);
+	gb = div_u64_rem(tmp_mb, 1024, &mb);
+	edac_dbg(0, "TOHM: %u.%03u GB (0x%016Lx)\n",
+		gb, (mb*1000)/1024, (u64)pvt->tohm);
 
 	/*
 	 * Step 2) Get SAD range and SAD Interleave list
@@ -668,11 +670,11 @@ static void get_memory_layout(const stru
 			break;
 
 		tmp_mb = (limit + 1) >> 20;
-		mb = div_u64_rem(tmp_mb, 1000, &kb);
+		gb = div_u64_rem(tmp_mb, 1024, &mb);
 		edac_dbg(0, "SAD#%d %s up to %u.%03u GB (0x%016Lx) Interleave: %s reg=0x%08x\n",
 			 n_sads,
 			 get_dram_attr(reg),
-			 mb, kb,
+			 gb, (mb*1000)/1024,
 			 ((u64)tmp_mb) << 20L,
 			 INTERLEAVE_MODE(reg) ? "8:6" : "[8:6]XOR[18:16]",
 			 reg);
@@ -702,9 +704,9 @@ static void get_memory_layout(const stru
 			break;
 		tmp_mb = (limit + 1) >> 20;
 
-		mb = div_u64_rem(tmp_mb, 1000, &kb);
+		gb = div_u64_rem(tmp_mb, 1024, &mb);
 		edac_dbg(0, "TAD#%d: up to %u.%03u GB (0x%016Lx), socket interleave %d, memory interleave %d, TGT: %d, %d, %d, %d, reg=0x%08x\n",
-			 n_tads, mb, kb,
+			 n_tads, gb, (mb*1000)/1024,
 			 ((u64)tmp_mb) << 20L,
 			 (u32)TAD_SOCK(reg),
 			 (u32)TAD_CH(reg),
@@ -727,10 +729,10 @@ static void get_memory_layout(const stru
 					      tad_ch_nilv_offset[j],
 					      &reg);
 			tmp_mb = TAD_OFFSET(reg) >> 20;
-			mb = div_u64_rem(tmp_mb, 1000, &kb);
+			gb = div_u64_rem(tmp_mb, 1024, &mb);
 			edac_dbg(0, "TAD CH#%d, offset #%d: %u.%03u GB (0x%016Lx), reg=0x%08x\n",
 				 i, j,
-				 mb, kb,
+				 gb, (mb*1000)/1024,
 				 ((u64)tmp_mb) << 20L,
 				 reg);
 		}
@@ -752,10 +754,10 @@ static void get_memory_layout(const stru
 
 			tmp_mb = RIR_LIMIT(reg) >> 20;
 			rir_way = 1 << RIR_WAY(reg);
-			mb = div_u64_rem(tmp_mb, 1000, &kb);
+			gb = div_u64_rem(tmp_mb, 1024, &mb);
 			edac_dbg(0, "CH#%d RIR#%d, limit: %u.%03u GB (0x%016Lx), way: %d, reg=0x%08x\n",
 				 i, j,
-				 mb, kb,
+				 gb, (mb*1000)/1024,
 				 ((u64)tmp_mb) << 20L,
 				 rir_way,
 				 reg);
@@ -766,10 +768,10 @@ static void get_memory_layout(const stru
 						      &reg);
 				tmp_mb = RIR_OFFSET(reg) << 6;
 
-				mb = div_u64_rem(tmp_mb, 1000, &kb);
+				gb = div_u64_rem(tmp_mb, 1024, &mb);
 				edac_dbg(0, "CH#%d RIR#%d INTL#%d, offset %u.%03u GB (0x%016Lx), tgt: %d, reg=0x%08x\n",
 					 i, j, k,
-					 mb, kb,
+					 gb, (mb*1000)/1024,
 					 ((u64)tmp_mb) << 20L,
 					 (u32)RIR_RNK_TGT(reg),
 					 reg);
@@ -806,7 +808,7 @@ static int get_memory_error_data(struct
 	u8			ch_way,sck_way;
 	u32			tad_offset;
 	u32			rir_way;
-	u32			mb, kb;
+	u32			mb, gb;
 	u64			ch_addr, offset, limit, prv = 0;
 
 
@@ -1022,10 +1024,10 @@ static int get_memory_error_data(struct
 			continue;
 
 		limit = RIR_LIMIT(reg);
-		mb = div_u64_rem(limit >> 20, 1000, &kb);
+		gb = div_u64_rem(limit >> 20, 1024, &mb);
 		edac_dbg(0, "RIR#%d, limit: %u.%03u GB (0x%016Lx), way: %d\n",
 			 n_rir,
-			 mb, kb,
+			 gb, (mb*1000)/1024,
 			 limit,
 			 1 << RIR_WAY(reg));
 		if  (ch_addr <= limit)



  parent reply	other threads:[~2015-07-01 18:54 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-01 18:40 [PATCH 3.10 00/22] 3.10.83-stable review Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 01/22] fput: turn "list_head delayed_fput_list" into llist_head Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 02/22] get rid of s_files and files_lock Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 03/22] config: Enable NEED_DMA_MAP_STATE by default when SWIOTLB is selected Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 05/22] netfilter: Zero the tuple in nfnl_cthelper_parse_tuple() Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 06/22] include/linux/sched.h: dont use task->pid/tgid in same_thread_group/has_group_leader_pid Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 07/22] __ptrace_may_access() should not deny sub-threads Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 08/22] ACPICA: Utilities: Cleanup to convert physical address printing formats Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 09/22] ACPICA: Utilities: Cleanup to remove useless ACPI_PRINTF/FORMAT_xxx helpers Greg Kroah-Hartman
2015-07-01 18:40 ` Greg Kroah-Hartman [this message]
2015-07-01 18:40 ` [PATCH 3.10 11/22] hpsa: refine the pci enable/disable handling Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 12/22] hpsa: add missing pci_set_master in kdump path Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 13/22] fs: take i_mutex during prepare_binprm for set[ug]id executables Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 14/22] x86/microcode/intel: Guard against stack overflow in the loader Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 15/22] Btrfs: make xattr replace operations atomic Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 16/22] xfrm: Increase the garbage collector threshold Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 19/22] Re: [PATCH 3.10 14/46] d_walk() might skip too much Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 20/22] ARM: clk-imx6q: refine satas parent Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 21/22] KVM: nSVM: Check for NRIPS support before updating control field Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 22/22] bus: mvebu: pass the coherency availability information at init time Greg Kroah-Hartman
2015-07-01 20:31 ` [PATCH 3.10 00/22] 3.10.83-stable review Guenter Roeck
2015-07-01 20:41   ` Greg Kroah-Hartman
2015-07-01 22:35 ` Shuah Khan
2015-07-01 23:17   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150701183942.424823938@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=jim.snow@intel.com \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukasz.anaczkowski@intel.com \
    --cc=mchehab@osg.samsung.com \
    --cc=stable@vger.kernel.org \
    --cc=vlee@twopensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox