From: John Allen <john.allen@amd.com>
To: <bp@alien8.de>, <linux-edac@vger.kernel.org>,
<tony.luck@intel.com>, <yazen.ghannam@amd.com>
Cc: <linux-kernel@vger.kernel.org>, <avadhut.naik@amd.com>,
<muralidhara.mk@amd.com>, John Allen <john.allen@amd.com>
Subject: [PATCH v4 1/4] RAS/AMD/ATL: Read DRAM hole base early
Date: Mon, 6 May 2024 15:46:02 +0000 [thread overview]
Message-ID: <20240506154605.71814-2-john.allen@amd.com> (raw)
In-Reply-To: <20240506154605.71814-1-john.allen@amd.com>
Read DRAM hole base when constructing the address map as the value will
not change during run time.
Reviewed-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: John Allen <john.allen@amd.com>
---
v2:
- Fix compilation error. ctx->addr should read ctx->ret_addr.
- Improve commit description.
v3:
- Include "0x" prefix for dram_hole_base print
---
drivers/ras/amd/atl/core.c | 15 ++-------------
drivers/ras/amd/atl/internal.h | 2 ++
drivers/ras/amd/atl/system.c | 21 +++++++++++++++++++++
3 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/drivers/ras/amd/atl/core.c b/drivers/ras/amd/atl/core.c
index 6dc4e06305f7..63513d972c07 100644
--- a/drivers/ras/amd/atl/core.c
+++ b/drivers/ras/amd/atl/core.c
@@ -51,22 +51,11 @@ static bool legacy_hole_en(struct addr_ctx *ctx)
static int add_legacy_hole(struct addr_ctx *ctx)
{
- u32 dram_hole_base;
- u8 func = 0;
-
if (!legacy_hole_en(ctx))
return 0;
- if (df_cfg.rev >= DF4)
- func = 7;
-
- if (df_indirect_read_broadcast(ctx->node_id, func, 0x104, &dram_hole_base))
- return -EINVAL;
-
- dram_hole_base &= DF_DRAM_HOLE_BASE_MASK;
-
- if (ctx->ret_addr >= dram_hole_base)
- ctx->ret_addr += (BIT_ULL(32) - dram_hole_base);
+ if (ctx->ret_addr >= df_cfg.dram_hole_base)
+ ctx->ret_addr += (BIT_ULL(32) - df_cfg.dram_hole_base);
return 0;
}
diff --git a/drivers/ras/amd/atl/internal.h b/drivers/ras/amd/atl/internal.h
index 5de69e0bb0f9..1413c8ddc6c5 100644
--- a/drivers/ras/amd/atl/internal.h
+++ b/drivers/ras/amd/atl/internal.h
@@ -132,6 +132,8 @@ struct df_config {
/* Number of DRAM Address maps visible in a Coherent Station. */
u8 num_coh_st_maps;
+ u32 dram_hole_base;
+
/* Global flags to handle special cases. */
struct df_flags flags;
};
diff --git a/drivers/ras/amd/atl/system.c b/drivers/ras/amd/atl/system.c
index 701349e84942..a4314f5073ab 100644
--- a/drivers/ras/amd/atl/system.c
+++ b/drivers/ras/amd/atl/system.c
@@ -223,6 +223,21 @@ static int determine_df_rev(void)
return -EINVAL;
}
+static int get_dram_hole_base(void)
+{
+ u8 func = 0;
+
+ if (df_cfg.rev >= DF4)
+ func = 7;
+
+ if (df_indirect_read_broadcast(0, func, 0x104, &df_cfg.dram_hole_base))
+ return -EINVAL;
+
+ df_cfg.dram_hole_base &= DF_DRAM_HOLE_BASE_MASK;
+
+ return 0;
+}
+
static void get_num_maps(void)
{
switch (df_cfg.rev) {
@@ -266,6 +281,7 @@ static void dump_df_cfg(void)
pr_debug("num_coh_st_maps=%u", df_cfg.num_coh_st_maps);
+ pr_debug("dram_hole_base=0x%x", df_cfg.dram_hole_base);
pr_debug("flags.legacy_ficaa=%u", df_cfg.flags.legacy_ficaa);
pr_debug("flags.socket_id_shift_quirk=%u", df_cfg.flags.socket_id_shift_quirk);
}
@@ -282,6 +298,11 @@ int get_df_system_info(void)
get_num_maps();
+ if (get_dram_hole_base()) {
+ pr_warn("amd_atl: Failed to read DRAM hole base");
+ return -EINVAL;
+ }
+
dump_df_cfg();
return 0;
--
2.34.1
next prev parent reply other threads:[~2024-05-06 15:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-06 15:46 [PATCH v4 0/4] RAS: ATL: DF 4.5 NP2 Denormalization John Allen
2024-05-06 15:46 ` John Allen [this message]
2024-05-28 8:16 ` [PATCH v4 1/4] RAS/AMD/ATL: Read DRAM hole base early Borislav Petkov
2024-06-05 18:47 ` John Allen
2024-05-06 15:46 ` [PATCH v4 2/4] RAS/AMD/ATL: Expand helpers for adding and removing base and hole John Allen
2024-05-28 10:07 ` Borislav Petkov
2024-05-06 15:46 ` [PATCH v4 3/4] RAS/AMD/ATL: Validate address map when information is gathered John Allen
2024-05-28 10:11 ` Borislav Petkov
2024-05-06 15:46 ` [PATCH v4 4/4] RAS/AMD/ATL: Implement DF 4.5 NP2 denormalization John Allen
2024-05-28 10:23 ` Borislav Petkov
2024-06-03 21:01 ` John Allen
2024-06-03 21:06 ` Borislav Petkov
2024-05-08 15:51 ` [PATCH v4 0/4] RAS: ATL: DF 4.5 NP2 Denormalization Yazen Ghannam
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=20240506154605.71814-2-john.allen@amd.com \
--to=john.allen@amd.com \
--cc=avadhut.naik@amd.com \
--cc=bp@alien8.de \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=muralidhara.mk@amd.com \
--cc=tony.luck@intel.com \
--cc=yazen.ghannam@amd.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.