-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plat/synquacer: enable SCMI support #1856
plat/synquacer: enable SCMI support #1856
Conversation
Can one of the admins verify this patch? |
This pull request modifies subsystem(s) maintained by @b49020. Can you please review the changes? |
IP Review +1 |
jenkins: test this please |
The CI failure is due to a MISRA defect we can ignore. |
#include <lib/mmio.h> | ||
|
||
/* SCMI vendor specific protocol */ | ||
#define SCMI_SYS_VENDOR_EXT_PROTO_ID 0x80 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only difference from scmi_private.h. Would suggest to add this to the scmi_private.h and remove this file.
|
||
#include <sq_common.h> | ||
|
||
int scmi_get_draminfo(void *p, struct draminfo *info); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can go at the end of scmi.h. Create a section for vendor extensions using code comments and add this there.
int status; | ||
int reserved; | ||
struct draminfo info; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This structure can go in scmi.h at the end where a section for "vendor-specific" extensions can be created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have submitted updated commit.
I really hesitate to add this definitions into include/drivers/arm/css/scmi.h.
I also need to add very vendor specific "struct draminfo" definition here.
Instead of modifying scmi.h, I added drivers/arm/css/scmi/vendor/scmi_sq.h.
This file contains synquacer specific protocol definition.
If you prefer to modify scmi.h, I will do so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, what you have done is fine.
/* | ||
* API to set the SCMI vendor extension protocol | ||
*/ | ||
int scmi_get_draminfo(void *p, struct draminfo *info) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can go into a new file within the following folder drivers/arm/css/scmi/vendor/scmi_sq.c
.
/* Local power state for retention. Valid only for CPU power domains */ | ||
#define ARM_LOCAL_STATE_RET U(1) | ||
/* Local power state for OFF/power-down. Valid for CPU and cluster power domains */ | ||
#define ARM_LOCAL_STATE_OFF U(2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is introducing ARM platform layer dependency which might be a maintenance overhead in future. Currently the Power management for SCMI goes through a css_pm_scmi
which introduces this dependency. How about removing that dependancy by implementing the functionality in css_pm_scmi.c in synquancer which can then directly invoke SCMI driver ?
I think that would be clean solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like duplicating stuff. Shouldn't we try to make files under drivers/arm/css/scp/
generic for reuse in other platforms? Like renaming these macros to PLAT_* rather than ARM_* in common css_pm_scmi.c
. Or else if they need to be platform specific then move them to plat/arm
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The css_scp
layer will have platform implementation details like the power levels available on the platform , the mapping between PSCI power state to SCP power state which makes it difficult to make it generic. The SCMI driver is generic where as css-scp
is ARM platform specific.
Or else if they need to be platform specific then move them to plat/arm.
Hmm, I see your point. It used to be within plat/arm
previously and was not intended to be generic. But I agree atleast the scp
folder should should be within platform directory. The scmi
folder can go into drivers/
folder. I will create a task to do that internally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good.
plat/socionext/synquacer/sq_psci.c
Outdated
@@ -33,12 +35,16 @@ uintptr_t sq_sec_entrypoint; | |||
|
|||
int sq_pwr_domain_on(u_register_t mpidr) | |||
{ | |||
#if SQ_USE_SCMI_DRIVER | |||
css_scp_on(mpidr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As stated in my previous comment, instead of calling this function, implement a synq_scmi_on() function. This function can directly call the required SCMI driver.
5bf9729
to
18099e2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think all reference to CSS
in macro names and functions can be removed. See my comments.
|
||
#include <sq_common.h> | ||
|
||
const uint32_t plat_css_core_pos_to_scmi_dmn_id_map[PLATFORM_CORE_COUNT] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think all the contents of this file can move to sq_pm_scmi.c
This array can just be called sq_core_pos_to_scmi_dmn_id[]
|
||
static scmi_channel_plat_info_t sq_scmi_plat_info = { | ||
.scmi_mbx_mem = SQ_SCMI_PAYLOAD_BASE, | ||
.db_reg_addr = PLAT_CSS_MHU_BASE + MHU_CPU_INTR_S_SET_OFFSET, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think you need to use any CSS
macro anymore. This can be PLAT_SQ_MHU_BASE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PLAT_CSS_MHU_BASE is used in include/drivers/arm/css/css_mhu_doorbell.h, and I still need
this macro to use generic MHU driver.
So, I submit separate commit to rename PLAT_CSS_MHU_BASE to PLAT_MHUV2_BASE.
I think it is not the best solution, but it is minimal modification without modifying much under plat/arm.
.ring_doorbell = &mhu_ring_doorbell, | ||
}; | ||
|
||
scmi_channel_plat_info_t *plat_css_get_scmi_info() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You dont need this wrapper function anymore.
void __init plat_arm_pwrc_setup(void)
{
channel.info = &sq_scmi_plat_info;
...
return &sq_scmi_plat_info; | ||
} | ||
|
||
void plat_arm_gic_cpuif_disable(void) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is not needed anymore
return 0; | ||
} | ||
|
||
void __init plat_arm_pwrc_setup(void) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function can be plat_sq_pwrc_setup()
@@ -41,27 +41,27 @@ void mhu_secure_message_start(unsigned int slot_id) | |||
bakery_lock_get(&sq_lock); | |||
|
|||
/* Make sure any previous command has finished */ | |||
while (mmio_read_32(PLAT_SQ_MHU_BASE + CPU_INTR_S_STAT) & | |||
while (mmio_read_32(PLAT_CSS_MHU_BASE + CPU_INTR_S_STAT) & |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is not required as per my comments below.
panic(); | ||
} | ||
wfi(); | ||
ERROR("CSS set power state: operation not handled.\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove CSS
from print messages.
* The global handle for invoking the SCMI driver APIs after the driver | ||
* has been initialized. | ||
*/ | ||
void *sq_scmi_handle; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The handle can be static now.
#define PLAT_MAX_PWR_LVL U(1) | ||
/* System power domain level */ | ||
#define CSS_SYSTEM_PWR_DMN_LVL SQ_PWR_LVL2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This macro is not required I think.
@@ -69,7 +81,7 @@ | |||
|
|||
#define DRAMINFO_BASE 0x2E00FFC0 | |||
|
|||
#define PLAT_SQ_MHU_BASE 0x45000000 | |||
#define PLAT_CSS_MHU_BASE 0x45000000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to change the name of macro.
18099e2
to
287aab0
Compare
This pull request modifies subsystem(s) maintained by @npoushin, @thomas-arm. Can you please review the changes? |
Thank you for your comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Build tested, looks ok for sgi575
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from few nitpicks, this patch-set looks good to me. So:
Acked-by: Sumit Garg <sumit.garg@linaro.org>
plat/socionext/synquacer/sq_psci.c
Outdated
@@ -11,6 +11,8 @@ | |||
|
|||
#include <arch_helpers.h> | |||
#include <common/debug.h> | |||
#include <drivers/arm/css/css_scp.h> | |||
#include <drivers/arm/css/scmi.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need these includes now?
plat/socionext/synquacer/platform.mk
Outdated
-I$(PLAT_PATH)/drivers/mhu | ||
-I$(PLAT_PATH)/drivers/mhu \ | ||
-Idrivers/arm/css/scmi \ | ||
-Idrivers/arm/css/scmi/vendor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use tabs for indentation similar to other places.
#define SQ_CORE_PWR_STATE(state) (state)->pwr_domain_state[SQ_PWR_LVL0] | ||
#define SQ_CLUSTER_PWR_STATE(state) (state)->pwr_domain_state[SQ_PWR_LVL1] | ||
#define SQ_SYSTEM_PWR_STATE(state) ((PLAT_MAX_PWR_LVL > SQ_PWR_LVL1) ?\ | ||
(state)->pwr_domain_state[SQ_PWR_LVL2] : 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since these macros are defined here, we can remove their duplicate definition from sq_psci.c
and rather include this header file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look fine. Please let us know if you intend to fix the nits mentioned by @b49020 .
jenkins: test this please |
Enable the SCMI protocol support in SynQuacer platform. Aside from power domain, system power and apcore management protocol, this commit adds the vendor specific protocol(0x80). This vendor specific protocol is used to get the dram mapping information from SCP. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
MHU doorbell driver requires arm platform specific macro "PLAT_CSS_MHU_BASE". Rename it to "PLAT_MHUV2_BASE", so that platforms other than arm can use generic MHU doorbell driver. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
287aab0
to
cf6c30e
Compare
I addressed comments, please kindly check. |
Enable the SCMI protocol support in SynQuacer platform.
Aside from power domain, system power and apcore management protocol,
this commit adds the vendor specific protocol(0x80).
This vendor specific protocol is used to get the dram mapping information
from SCP.
This commit also exposes scmi_handle to outside of drivers/arm/css/scmi,
to issue the SCMI vendor specific procotol from platform dependent code.
Signed-off-by: Masahisa Kojima masahisa.kojima@linaro.org