From: Jit Loon Lim <jit.loon.lim@intel.com>
To: u-boot@lists.denx.de
Cc: Jagan Teki <jagan@amarulasolutions.com>,
Vignesh R <vigneshr@ti.com>, Marek <marex@denx.de>,
Simon <simon.k.r.goldschmidt@gmail.com>,
Tien Fong <tien.fong.chee@intel.com>,
Kok Kiang <kok.kiang.hea@intel.com>,
Siew Chin <elly.siew.chin.lim@intel.com>,
Sin Hui <sin.hui.kho@intel.com>, Raaj <raaj.lokanathan@intel.com>,
Dinesh <dinesh.maniyam@intel.com>,
Boon Khai <boon.khai.ng@intel.com>,
Alif <alif.zakuan.yuslaimi@intel.com>,
Teik Heng <teik.heng.chong@intel.com>,
Hazim <muhammad.hazim.izzat.zamri@intel.com>,
Jit Loon Lim <jit.loon.lim@intel.com>,
Sieu Mun Tang <sieu.mun.tang@intel.com>,
Chee Hong Ang <chee.hong.ang@intel.com>
Subject: [PATCH 2/2] arch: arm: mach-socfpga: HSD #1508115548-2: Ensure bitstream address location not exceed 512MB
Date: Sun, 11 Sep 2022 23:06:27 +0800 [thread overview]
Message-ID: <20220911150627.32341-2-jit.loon.lim@intel.com> (raw)
In-Reply-To: <20220911150627.32341-1-jit.loon.lim@intel.com>
From: Chee Hong Ang <chee.hong.ang@intel.com>
Secure Device Manager(SDM) has only 512MB window address space to HPS
over PSI BE link. The default access range is 0x0 to 0x1FFFFFFF.
To allow SDM accessing the address space more than 512MB, SMMU has to be
setup for address translation.
U-Boot will not allow the fpga reconfiguration with any bitstream data
address exceed 512MB to proceed if PSI BE link address translation is not
setup in SMMU.
Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
Signed-off-by: Jit Loon Lim <jit.loon.lim@intel.com>
---
arch/arm/mach-socfpga/include/mach/smmu_s10.h | 6 ++++++
drivers/fpga/intel_sdm_mb.c | 13 +++++++++++++
2 files changed, 19 insertions(+)
diff --git a/arch/arm/mach-socfpga/include/mach/smmu_s10.h b/arch/arm/mach-socfpga/include/mach/smmu_s10.h
index dfcc99f82a..61157c03d6 100644
--- a/arch/arm/mach-socfpga/include/mach/smmu_s10.h
+++ b/arch/arm/mach-socfpga/include/mach/smmu_s10.h
@@ -30,6 +30,12 @@
#define SMMU_SID_SDM2HPS_PSI_BE 0
+#define SDM2HPS_PSI_BE_ADDR_BASE 0
+/* PSI BE 512MB address window */
+#define SDM2HPS_PSI_BE_WINDOW_SZ 0x20000000
+#define SDM2HPS_PSI_BE_ADDR_END \
+ (SDM2HPS_PSI_BE_ADDR_BASE + SDM2HPS_PSI_BE_WINDOW_SZ - 1)
+
void socfpga_init_smmu(void);
int is_smmu_bypass(void);
int is_smmu_stream_id_enabled(u32 stream_id);
diff --git a/drivers/fpga/intel_sdm_mb.c b/drivers/fpga/intel_sdm_mb.c
index f5fd9a14c2..a2191c1a16 100644
--- a/drivers/fpga/intel_sdm_mb.c
+++ b/drivers/fpga/intel_sdm_mb.c
@@ -9,6 +9,7 @@
#include <watchdog.h>
#include <asm/arch/mailbox_s10.h>
#include <asm/arch/smc_api.h>
+#include <asm/arch/smmu_s10.h>
#include <linux/delay.h>
#include <linux/intel-smc.h>
@@ -394,6 +395,18 @@ int intel_sdm_mb_load(Altera_desc *desc, const void *rbf_data, size_t rbf_size)
u32 resp_len = 2;
u32 resp_buf[2];
+ /*
+ * Don't start the FPGA reconfiguration if bitstream location exceed the
+ * PSI BE 512MB address window and SMMU is not setup for PSI BE address
+ * translation.
+ */
+ if (((u64)rbf_data + rbf_size) >= SDM2HPS_PSI_BE_ADDR_END &&
+ !is_smmu_stream_id_enabled(SMMU_SID_SDM2HPS_PSI_BE)) {
+ printf("Failed: Bitstream location must not exceed 0x%08x\n",
+ SDM2HPS_PSI_BE_ADDR_END);
+ return -EINVAL;
+ }
+
debug("Sending MBOX_RECONFIG...\n");
ret = mbox_send_cmd(MBOX_ID_UBOOT, MBOX_RECONFIG, MBOX_CMD_DIRECT, 0,
NULL, 0, &resp_len, resp_buf);
--
2.26.2
prev parent reply other threads:[~2022-09-11 15:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-11 15:06 [PATCH 1/2] arch: arm: mach-socfpga: HSD #1508115548-1: Add SMMU status and Stream ID checking functions Jit Loon Lim
2022-09-11 15:06 ` Jit Loon Lim [this message]
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=20220911150627.32341-2-jit.loon.lim@intel.com \
--to=jit.loon.lim@intel.com \
--cc=alif.zakuan.yuslaimi@intel.com \
--cc=boon.khai.ng@intel.com \
--cc=chee.hong.ang@intel.com \
--cc=dinesh.maniyam@intel.com \
--cc=elly.siew.chin.lim@intel.com \
--cc=jagan@amarulasolutions.com \
--cc=kok.kiang.hea@intel.com \
--cc=marex@denx.de \
--cc=muhammad.hazim.izzat.zamri@intel.com \
--cc=raaj.lokanathan@intel.com \
--cc=sieu.mun.tang@intel.com \
--cc=simon.k.r.goldschmidt@gmail.com \
--cc=sin.hui.kho@intel.com \
--cc=teik.heng.chong@intel.com \
--cc=tien.fong.chee@intel.com \
--cc=u-boot@lists.denx.de \
--cc=vigneshr@ti.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