[PATCH v1 1/2] firmware: scmi: use PAGE_SIZE alignement for ARM64

From: Peng Fan peng.fan@nxp.com
For ARMv7, the alignment could be SECTION size. But for ARM64, use PAGE_SIZE.
Signed-off-by: Peng Fan peng.fan@nxp.com Signed-off-by: Alice Guo alice.guo@nxp.com Reviewed-by: Ye Li ye.li@nxp.com --- drivers/firmware/scmi/smt.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/firmware/scmi/smt.c b/drivers/firmware/scmi/smt.c index 67d2f45002..e9d401f0da 100644 --- a/drivers/firmware/scmi/smt.c +++ b/drivers/firmware/scmi/smt.c @@ -29,6 +29,7 @@ int scmi_dt_get_smt_buffer(struct udevice *dev, struct scmi_smt *smt) int ret; struct ofnode_phandle_args args; struct resource resource; + u32 align_size __maybe_unused;
ret = dev_read_phandle_with_args(dev, "shmem", NULL, 0, 0, &args); if (ret) @@ -49,11 +50,15 @@ int scmi_dt_get_smt_buffer(struct udevice *dev, struct scmi_smt *smt) return -ENOMEM;
#ifdef CONFIG_ARM - if (dcache_status()) - mmu_set_region_dcache_behaviour(ALIGN_DOWN((uintptr_t)smt->buf, MMU_SECTION_SIZE), - ALIGN(smt->size, MMU_SECTION_SIZE), - DCACHE_OFF); - + if (dcache_status()) { + if (IS_ENABLED(CONFIG_ARM64)) + align_size = PAGE_SIZE; + else + align_size = MMU_SECTION_SIZE; + + mmu_set_region_dcache_behaviour(ALIGN_DOWN((uintptr_t)smt->buf, align_size), + ALIGN(smt->size, align_size), DCACHE_OFF); + } #endif
return 0;

From: Viorel Suman viorel.suman@nxp.com
Enable doorbel return to work iMX95 System Manager.
Signed-off-by: Viorel Suman viorel.suman@nxp.com Signed-off-by: Alice Guo alice.guo@nxp.com Reviewed-by: Ye Li ye.li@nxp.com --- drivers/firmware/scmi/smt.c | 3 +++ drivers/firmware/scmi/smt.h | 10 ++++++++++ 2 files changed, 13 insertions(+)
diff --git a/drivers/firmware/scmi/smt.c b/drivers/firmware/scmi/smt.c index e9d401f0da..98e07d3a16 100644 --- a/drivers/firmware/scmi/smt.c +++ b/drivers/firmware/scmi/smt.c @@ -49,6 +49,9 @@ int scmi_dt_get_smt_buffer(struct udevice *dev, struct scmi_smt *smt) if (!smt->buf) return -ENOMEM;
+ /* make this configurable as function of DTS property */ + scmi_smt_enable_intr(smt, true); + #ifdef CONFIG_ARM if (dcache_status()) { if (IS_ENABLED(CONFIG_ARM64)) diff --git a/drivers/firmware/scmi/smt.h b/drivers/firmware/scmi/smt.h index 9d669a6c92..768b0f4c8a 100644 --- a/drivers/firmware/scmi/smt.h +++ b/drivers/firmware/scmi/smt.h @@ -84,6 +84,16 @@ static inline void scmi_smt_put_channel(struct scmi_smt *smt) hdr->channel_status &= ~SCMI_SHMEM_CHAN_STAT_CHANNEL_ERROR; }
+static inline void scmi_smt_enable_intr(struct scmi_smt *smt, bool enable) +{ + struct scmi_smt_header *hdr = (void *)smt->buf; + + if (enable) + hdr->flags |= SCMI_SHMEM_FLAG_INTR_ENABLED; + else + hdr->flags &= ~SCMI_SHMEM_FLAG_INTR_ENABLED; +} + int scmi_dt_get_smt_buffer(struct udevice *dev, struct scmi_smt *smt);
/*

On Sun, Oct 06, 2024 at 03:07:02PM +0800, alice.guo@oss.nxp.com wrote:
From: Viorel Suman viorel.suman@nxp.com
Enable doorbel return to work iMX95 System Manager.
Signed-off-by: Viorel Suman viorel.suman@nxp.com Signed-off-by: Alice Guo alice.guo@nxp.com Reviewed-by: Ye Li ye.li@nxp.com
drivers/firmware/scmi/smt.c | 3 +++ drivers/firmware/scmi/smt.h | 10 ++++++++++ 2 files changed, 13 insertions(+)
diff --git a/drivers/firmware/scmi/smt.c b/drivers/firmware/scmi/smt.c index e9d401f0da..98e07d3a16 100644 --- a/drivers/firmware/scmi/smt.c +++ b/drivers/firmware/scmi/smt.c @@ -49,6 +49,9 @@ int scmi_dt_get_smt_buffer(struct udevice *dev, struct scmi_smt *smt) if (!smt->buf) return -ENOMEM;
- /* make this configurable as function of DTS property */
- scmi_smt_enable_intr(smt, true);
#ifdef CONFIG_ARM if (dcache_status()) { if (IS_ENABLED(CONFIG_ARM64)) diff --git a/drivers/firmware/scmi/smt.h b/drivers/firmware/scmi/smt.h index 9d669a6c92..768b0f4c8a 100644 --- a/drivers/firmware/scmi/smt.h +++ b/drivers/firmware/scmi/smt.h @@ -84,6 +84,16 @@ static inline void scmi_smt_put_channel(struct scmi_smt *smt) hdr->channel_status &= ~SCMI_SHMEM_CHAN_STAT_CHANNEL_ERROR; }
+static inline void scmi_smt_enable_intr(struct scmi_smt *smt, bool enable) +{
- struct scmi_smt_header *hdr = (void *)smt->buf;
- if (enable)
hdr->flags |= SCMI_SHMEM_FLAG_INTR_ENABLED;
- else
hdr->flags &= ~SCMI_SHMEM_FLAG_INTR_ENABLED;
+}
int scmi_dt_get_smt_buffer(struct udevice *dev, struct scmi_smt *smt);
Where is this being configured based on the DT? The only caller only passes "true" without a check anywhere.

On Sun, Oct 06, 2024 at 03:07:01PM +0800, alice.guo@oss.nxp.com wrote:
From: Peng Fan peng.fan@nxp.com
For ARMv7, the alignment could be SECTION size. But for ARM64, use PAGE_SIZE.
Signed-off-by: Peng Fan peng.fan@nxp.com Signed-off-by: Alice Guo alice.guo@nxp.com Reviewed-by: Ye Li ye.li@nxp.com
drivers/firmware/scmi/smt.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/firmware/scmi/smt.c b/drivers/firmware/scmi/smt.c index 67d2f45002..e9d401f0da 100644 --- a/drivers/firmware/scmi/smt.c +++ b/drivers/firmware/scmi/smt.c @@ -29,6 +29,7 @@ int scmi_dt_get_smt_buffer(struct udevice *dev, struct scmi_smt *smt) int ret; struct ofnode_phandle_args args; struct resource resource;
u32 align_size __maybe_unused;
ret = dev_read_phandle_with_args(dev, "shmem", NULL, 0, 0, &args); if (ret)
@@ -49,11 +50,15 @@ int scmi_dt_get_smt_buffer(struct udevice *dev, struct scmi_smt *smt) return -ENOMEM;
#ifdef CONFIG_ARM
- if (dcache_status())
mmu_set_region_dcache_behaviour(ALIGN_DOWN((uintptr_t)smt->buf, MMU_SECTION_SIZE),
ALIGN(smt->size, MMU_SECTION_SIZE),
DCACHE_OFF);
- if (dcache_status()) {
if (IS_ENABLED(CONFIG_ARM64))
align_size = PAGE_SIZE;
else
align_size = MMU_SECTION_SIZE;
mmu_set_region_dcache_behaviour(ALIGN_DOWN((uintptr_t)smt->buf, align_size),
ALIGN(smt->size, align_size), DCACHE_OFF);
- }
#endif
return 0;
You can move declaring align_size down to this stanza, no need to __maybe_unused it.
participants (2)
-
alice.guo@oss.nxp.com
-
Tom Rini