lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4EC21E8E.5050003@ericsson.com>
Date:	Tue, 15 Nov 2011 09:10:54 +0100
From:	Niklas Söderlund 
	<niklas.soderlund@...csson.com>
To:	Borislav Petkov <bp@...64.org>
CC:	Tony Luck <tony.luck@...il.com>,
	"dougthompson@...ssion.com" <dougthompson@...ssion.com>,
	"linux-edac@...r.kernel.org" <linux-edac@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] amd64_edac: Fix K8 revD and later chip select sizes

On Mon 14 Nov 2011 05:54:59 PM CET, Borislav Petkov wrote:
>
> Fix DRAM chip select sizes calculation for K8, revisions D and E.
>
> Reported-by: Niklas Söderlund<niklas.soderlund@...csson.com
> Link: http://lkml.kernel.org/r/1320849178-23340-1-git-send-email-niklas.soderlund@ericsson.com
> Signed-off-by: Borislav Petkov<borislav.petkov@....com>
> ---
>
> @Niklas: would you please verify this patch fixes your issue?
>
> Thanks.
>
>   drivers/edac/amd64_edac.c |   32 ++++++++++++++++++++++++++++----
>   1 files changed, 28 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
> index c9eee6d..6a83d49 100644
> --- a/drivers/edac/amd64_edac.c
> +++ b/drivers/edac/amd64_edac.c
> @@ -1132,12 +1132,36 @@ static int k8_dbam_to_chip_select(struct amd64_pvt *pvt, u8 dct,
>   		return ddr2_cs_size(cs_mode, dclr&  WIDTH_128);
>   	}
>   	else if (pvt->ext_model>= K8_REV_D) {
> +		unsigned diff;
>   		WARN_ON(cs_mode>  10);
>
> -		if (cs_mode == 3 || cs_mode == 8)
> -			return 32<<  (cs_mode - 1);
> -		else
> -			return 32<<  cs_mode;
> +		/*
> +		 * the below calculation, besides trying to win an obfuscated C
> +		 * contest, maps cs_mode values to DIMM chip select sizes. The
> +		 * mappings are:
> +		 *
> +		 * cs_mode	CS size (mb)
> +		 * =======	============
> +		 * 0		32
> +		 * 1		64
> +		 * 2		128
> +		 * 3		128
> +		 * 4		256
> +		 * 5		512
> +		 * 6		256
> +		 * 7		512
> +		 * 8		1024
> +		 * 9		1024
> +		 * 10		2048
> +		 *
> +		 * Basically, it calculates a value with which to shift the
> +		 * smallest CS size of 32MB.
> +		 *
> +		 * ddr[23]_cs_size have a similar purpose.
> +		 */
> +		diff = cs_mode/3 + (unsigned)(cs_mode>  5);
> +
> +		return 32<<  (cs_mode - diff);
>   	}
>   	else {
>   		WARN_ON(cs_mode>  6);

Hi Borislav,

Yes the patch fixes my problem, but it truly is obfuscated C.

Thanks
// Niklas
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ