Linux I2C development
 help / color / mirror / Atom feed
From: "Brigham Campbell" <me@brighamcampbell.com>
To: "Stephen Horvath" <s.horvath@outlook.com.au>,
	"Wolfram Sang" <wsa+renesas@sang-engineering.com>,
	"Jean Delvare" <jdelvare@suse.de>,
	"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>
Cc: "Guenter Roeck" <linux@roeck-us.net>,
	"Kamil Aronowski" <kamil.aronowski@3mdeb.com>
Subject: Re: [PATCH i2c-tools v3 1/8] decode-dimms: Implement DDR5 checksum parsing
Date: Tue, 07 Jul 2026 23:33:24 -0600	[thread overview]
Message-ID: <DJSY0M2NCF0S.Y3YUOZXTH3FI@brighamcampbell.com> (raw)
In-Reply-To: <20260629-ddr5-v3-1-07f45075a51a@outlook.com.au>

Hello!

I'm cross-referencing the code you've written with JEDEC Standard No.
400-5D.01. If I have any questions, they will likely be because of
perceived discrepancies between your code and the standard. Please know
the following:

 * I'm not very familiar with perl
 * I'm not familiar with this JEDEC standard
 * I have compiled your code, but have been unable to test it

Please treat my feedback with healthy skepticism. Keep the above in mind
when reviewing any feedback I have on other patches in this series.

On Mon Jun 29, 2026 at 1:10 AM MDT, Stephen Horvath wrote:
> @@ -2402,7 +2403,12 @@ sub spd_sizes($)
>  	my $bytes = shift;
>  	my $type = $bytes->[2];
>  
> -	if ($type == 12 || $type == 14 || $type == 16 || $type == 17) {
> +	if ($type == 18 || $type == 19 || $type == 20 || $type == 21) {
> +		# DDR5
> +		my $spd_len = 256 * ((($bytes->[0] >> 4) & 7) + 1);

Shouldn't this actually be as follows (exponent and no +1):
		my $spd_len = 2 ** (7 + (($bytes->[0] >> 4) & 7));

Reading the datasheet, it looks like your algorithm only happens to work
for the particular value which we expect SPD5118 devices to have
(0b011). This makes me suspect that the algorithm for DDR4 may also be
wrong, but I don't have the datasheet pulled up...

See Section 8.1.1.

> +		my $used = $spd_len;
> +		return ($spd_len, $used);
> +	} elsif ($type == 12 || $type == 14 || $type == 16 || $type == 17) {
>  		# DDR4
>  		my $spd_len = 256 * (($bytes->[0] >> 4) & 7);
>  		my $used = 128 * ($bytes->[0] & 15);
> @@ -2684,6 +2698,12 @@ for my $i (0 .. $#dimm) {
>  		 $dimm[$i]->{chk_spd}, $dimm[$i]->{chk_calc}) =
>  			checksum(\@bytes);
>  	} else {
> +

No need for this empty line.

> +		# Check for DDR5 protocol type 18, 19, 20, 21 and size >= 512
> +		if ($bytes[2] >= 18 && $bytes[2] <= 21 && ($bytes[0] & 0x70) >= 0x30) {
> +			# DDR5's checksum is at 510-511
> +			push(@bytes, readspd(@bytes, 512, $dimm[$i]->{file}));
> +		}
>  		($dimm[$i]->{chk_label}, $dimm[$i]->{chk_valid},
>  		 $dimm[$i]->{chk_spd}, $dimm[$i]->{chk_calc}) =
>  			check_crc(\@bytes);

Thanks,
-- 
Brigham Campbell
https://brighamcampbell.com


  reply	other threads:[~2026-07-08  5:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-29  7:09 [PATCH i2c-tools v3 0/8] decode-dimms: Implement DDR5 decoding Stephen Horvath
2026-06-29  7:10 ` [PATCH i2c-tools v3 1/8] decode-dimms: Implement DDR5 checksum parsing Stephen Horvath
2026-07-08  5:33   ` Brigham Campbell [this message]
2026-07-09 12:21     ` Stephen Horvath
2026-06-29  7:10 ` [PATCH i2c-tools v3 2/8] decode-dimms: Decode DDR5 Manufacturer Data Stephen Horvath
2026-07-08  6:48   ` Brigham Campbell
2026-06-29  7:10 ` [PATCH i2c-tools v3 3/8] decode-dimms: Decode timings and other data for DDR5 Stephen Horvath
2026-07-09 13:59   ` Brigham Campbell
2026-06-29  7:10 ` [PATCH i2c-tools v3 5/8] decode-dimms: Add basic decoding of type specific information " Stephen Horvath
2026-06-29  7:10 ` [PATCH i2c-tools v3 4/8] decode-dimms: Decode DDR5 common module information Stephen Horvath
2026-06-29  7:10 ` [PATCH i2c-tools v3 6/8] decode-dimms: Add second level separator Stephen Horvath
2026-06-29  7:10 ` [PATCH i2c-tools v3 7/8] decode-dimms: Decode DDR5 error log Stephen Horvath
2026-06-29  7:10 ` [PATCH i2c-tools v3 8/8] decode-dimms: Add DDR5 XMP 3.0 and EXPO decoding Stephen Horvath
2026-06-29  9:05 ` [PATCH i2c-tools v3 0/8] decode-dimms: Implement DDR5 decoding Wolfram Sang
2026-06-29 13:40   ` Stephen Horvath

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=DJSY0M2NCF0S.Y3YUOZXTH3FI@brighamcampbell.com \
    --to=me@brighamcampbell.com \
    --cc=jdelvare@suse.de \
    --cc=kamil.aronowski@3mdeb.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=s.horvath@outlook.com.au \
    --cc=wsa+renesas@sang-engineering.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