linux-edac.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
Cc: linux-edac@vger.kernel.org, git@amd.com,
	devicetree@vger.kernel.org, sai.krishna.potthuri@amd.com,
	krzysztof.kozlowski@linaro.org, robh+dt@kernel.org,
	conor+dt@kernel.org, tony.luck@intel.com, james.morse@arm.com,
	mchehab@kernel.org, rric@kernel.org, michal.simek@amd.com
Subject: Re: [PATCH v8 2/2] EDAC/versal: Add a Xilinx Versal memory controller driver
Date: Tue, 19 Sep 2023 19:03:56 +0200	[thread overview]
Message-ID: <20230919165927.GEZQnTb9gr5X13sJuD@fat_crate.local> (raw)
In-Reply-To: <20230804121924.18615-3-shubhrajyoti.datta@amd.com>

On Fri, Aug 04, 2023 at 05:49:24PM +0530, Shubhrajyoti Datta wrote:
> +config EDAC_VERSAL
> +	tristate "Xilinx Versal DDR Memory Controller"
> +	depends on ARCH_ZYNQMP || COMPILE_TEST
> +	help
> +	  Support for error detection and correction on the Xilinx Versal DDR
> +	  memory controller.
> +
> +	  Report both single bit errors (CE) and double bit errors (UE).
> +	  Support injecting both correctable and uncorrectable errors for debug
> +	  purpose using sysfs entries.

          Report both single bit errors (CE) and double bit errors (UE).
          Support injecting both correctable and uncorrectable errors
          for debugging purposes.


> +/**
> + * struct ecc_error_info - ECC error log information.
> + * @burstpos:		Burst position.
> + * @lrank:		Logical Rank number.
> + * @rank:		Rank number.
> + * @group:		Group number.
> + * @bank:		Bank number.
> + * @col:		Column number.
> + * @row:		Row number.
> + * @rowhi:		Row number higher bits.
> + * @i:			ECC error info.
> + */
> +union ecc_error_info {
> +	struct {
> +		u64 burstpos:3;
> +		u64 lrank:3;
> +		u64 rank:2;
> +		u64 group:2;
> +		u64 bank:2;
> +		u64 col:10;
> +		u64 row:10;
> +		u32 rowhi;
> +	};
> +	u64 i;
> +};

I missed this the last time but, if this is supposed to be a union of
sizeof(u64), why aren't you doing this:

union ecc_error_info {
        struct {
                u32 burstpos:3;
                u32 lrank:3;
                u32 rank:2;
                u32 group:2;
                u32 bank:2;
                u32 col:10;
                u32 row:10;
                u32 rowhi;
        };
        u64 i;
} __packed;

i.e., the struct should have two u32's - the first one is the bitfield
and the second one is rowhi and the "overloaded" one is the u64 i.

And also it should be packed even though this shouldn't be needed in
this case but still.

Ditto for the other unions.

> +
> +union edac_info {
> +	struct {
> +		u32 row0:6;
> +		u32 row1:6;
> +		u32 row2:6;
> +		u32 row3:6;
> +		u32 row4:6;
> +		u32 reserved:2;
> +	};
> +	struct {
> +		u32 col1:6;
> +		u32 col2:6;
> +		u32 col3:6;
> +		u32 col4:6;
> +		u32 col5:6;
> +		u32 reservedcol:2;
> +	};
> +	u32 i;
> +};

...

> +	/* Unlock the PCSR registers */
> +	writel(PCSR_UNLOCK_VAL, ddrmc_base + XDDR_PCSR_OFFSET);
> +
> +	writel(0, ddrmc_base + ECCR0_CERR_STAT_OFFSET);
> +	writel(0, ddrmc_base + ECCR1_CERR_STAT_OFFSET);
> +	writel(0, ddrmc_base + ECCR0_UERR_STAT_OFFSET);
> +	writel(0, ddrmc_base + ECCR1_UERR_STAT_OFFSET);
> +
> +	/* Lock the PCSR registers */
> +	writel(1, ddrmc_base + XDDR_PCSR_OFFSET);

I still don't know what this locking and unlocking is all about and why
it is needed...

Btw, you must always make sure your stuff builds:

drivers/edac/versal_edac.c: In function 'mc_remove':
drivers/edac/versal_edac.c:1035:9: error: implicit declaration of function 'disable_intr'; did you mean 'disable_irq'? [-Werror=implicit-function-declaration]
 1035 |         disable_intr(priv);
      |         ^~~~~~~~~~~~
      |         disable_irq


Otherwise it looks to me like you haven't tested it and if that is the
case, I'll simply ignore it.

So make sure you build-test and test your stuff before submitting.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

  reply	other threads:[~2023-09-19 17:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-04 12:19 [PATCH v8 0/2] edac: xilinx: Added EDAC support for Xilinx DDR controller Shubhrajyoti Datta
2023-08-04 12:19 ` [PATCH v8 1/2] dt-bindings: memory-controllers: Add support for Xilinx Versal EDAC for DDRMC Shubhrajyoti Datta
2023-08-04 12:19 ` [PATCH v8 2/2] EDAC/versal: Add a Xilinx Versal memory controller driver Shubhrajyoti Datta
2023-09-19 17:03   ` Borislav Petkov [this message]
2023-09-22 12:41     ` Datta, Shubhrajyoti

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=20230919165927.GEZQnTb9gr5X13sJuD@fat_crate.local \
    --to=bp@alien8.de \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=git@amd.com \
    --cc=james.morse@arm.com \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-edac@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=michal.simek@amd.com \
    --cc=robh+dt@kernel.org \
    --cc=rric@kernel.org \
    --cc=sai.krishna.potthuri@amd.com \
    --cc=shubhrajyoti.datta@amd.com \
    --cc=tony.luck@intel.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;
as well as URLs for NNTP newsgroup(s).