soc: qcom: smp2p: Add support for remoteproc early attach
Subsystems (2)
v3 cover soc: qcom: smp2p: Add support for remoteproc early attach
Some remoteproc will boot during earlier boot stages, add callback .irq_get_irqchip_state for remoteproc to check the states in smp2p and mark the state "attached", also add smp2p v2 support.
---
Changes in v3:
- Update commit message.
- Clean up macros for smp2p version.
- Update description for smp2p version 2.
- Update version negotiation to accomodate version 2.
- Address other minor comments from v2.
- Link to v2: https://lore.kernel.org/all/[email protected]
Changes in v2:
- Update condition to check version 2 in qcom_smp2p_start_in().
- Add more comment to describe above condition.
- Add description for version v1 and v2 of smp2p.
- Check validity of in_version.
- Link to v1: https://lore.kernel.org/all/[email protected]
---
Chris Lew (2):
soc: qcom: smp2p: Add irqchip state support
soc: qcom: smp2p: Add support for smp2p v2
drivers/soc/qcom/smp2p.c | 103 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 99 insertions(+), 4 deletions(-)
---
base-commit: fcb70a56f4d81450114034b2c61f48ce7444a0e2
change-id: 20251127-smp2pv2-bb88f617b5b0
Best regards,
Signature · 1 line
Deepak Kumar Singh <[email protected]>
PATCH v3 1/2 soc: qcom: smp2p: Add irqchip state support
From: Chris Lew <[email protected]>
A remoteproc booted during earlier boot stages such as UEFI or the bootloader, may need to be attached to without restarting the remoteproc hardware. To do this the remoteproc will need to check the ready and handover states in smp2p without an interrupt notification. Create qcom_smp2p_start_in() to initialize the shadow state without notifying clients because these early events happened in the past.
Add support for the .irq_get_irqchip_state callback so remoteproc can read the current state of the fatal, ready and handover bits.
--- drivers/soc/qcom/smp2p.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)
drivers/soc/qcom/smp2p.c +55 -0
@@ -222,6 +222,39 @@ static void qcom_smp2p_negotiate(struct qcom_smp2p *smp2p) } } +static void qcom_smp2p_start_in (struct qcom_smp2p *smp2p) +{ +unsigned int smem_id = smp2p->smem_items[SMP2P_INBOUND ]; +unsigned int pid = smp2p->remote_pid; +char buf[SMP2P_MAX_ENTRY_NAME ]; +struct smp2p_smem_item *in; +struct smp2p_entry *entry; +size_t size; +int i; + + in =qcom_smem_get (pid, smem_id, &size); +if (IS_ERR (in)) +return ; + + smp2p->in = in; + +/* Check if version is initialized by the remote. */ +if (in->version ==0 ) +return ; + +for (i = smp2p->valid_entries; i < in->valid_entries; i++) { +list_for_each_entry (entry, &smp2p->inbound, node) { +memcpy (buf, in->entries[i].name,sizeof (buf)); +if (!strcmp (buf, entry->name)) { + entry->value = &in->entries[i].value; + entry->last_value =readl (entry->value); +break ; + } + } + } + smp2p->valid_entries = i; +} +static void qcom_smp2p_notify_in (struct qcom_smp2p *smp2p) {struct smp2p_smem_item *in;
@@ -368,12 +401,31 @@ static void smp2p_irq_print_chip(struct irq_data *irqd, struct seq_file *p)seq_printf (p,"%8s" ,dev_name (entry->smp2p->dev)); } +static int smp2p_irq_get_irqchip_state (struct irq_data *irqd,enum irqchip_irq_state which, +bool *state) +{ +struct smp2p_entry *entry =irq_data_get_irq_chip_data (irqd); +u32 val; + +if (which !=IRQCHIP_STATE_LINE_LEVEL ) +return -EINVAL ; + +if (!entry->value) +return -ENODEV ; + + val =readl (entry->value); + *state = !!(val &BIT (irqd_to_hwirq (irqd))); + +return 0 ; +} +static struct irq_chip smp2p_irq_chip = { .name ="smp2p" , .irq_mask = smp2p_mask_irq, .irq_unmask = smp2p_unmask_irq, .irq_set_type = smp2p_set_irq_type, .irq_print_chip = smp2p_irq_print_chip, + .irq_get_irqchip_state = smp2p_irq_get_irqchip_state, }; static int smp2p_irq_map(struct irq_domain *d,
@@ -618,6 +670,9 @@ static int qcom_smp2p_probe(struct platform_device *pdev) } } +/* Check inbound entries in the case of early boot processor */ +qcom_smp2p_start_in (smp2p); +/* Kick the outgoing edge after allocating entries */ qcom_smp2p_kick (smp2p);
Signature · 1 line
2.34.1
Re: [PATCH v3 1/2] soc: qcom: smp2p: Add irqchip state support
Quoted 39 lines · Deepak Kumar Singh
From: Chris Lew <[email protected]>
A remoteproc booted during earlier boot stages such as UEFI or the bootloader, may need to be attached to without restarting the remoteproc hardware. To do this the remoteproc will need to check the ready and handover states in smp2p without an interrupt notification. Create
qcom_smp2p_start_in()to initialize the shadow state without notifying clients because these early events happened in the past.Add support for the .irq_get_irqchip_state callback so remoteproc can read the current state of the fatal, ready and handover bits.
Signed-off-by Chris Lew <[email protected]>Signed-off-by Deepak Kumar Singh <[email protected]>--- drivers/soc/qcom/smp2p.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)drivers/soc/qcom/smp2p.c +13
-0@@ -222,6 +222,39 @@ static void qcom_smp2p_negotiate(struct qcom_smp2p *smp2p) } } +static void qcom_smp2p_start_in (struct qcom_smp2p *smp2p) +{ +unsigned int smem_id = smp2p->smem_items[SMP2P_INBOUND ]; +unsigned int pid = smp2p->remote_pid; +char buf[SMP2P_MAX_ENTRY_NAME ]; +struct smp2p_smem_item *in; +struct smp2p_entry *entry; +size_t size; +int i; + + in =qcom_smem_get (pid, smem_id, &size); +if (IS_ERR (in)) +return ;
drivers/soc/qcom/smp2p.c static void qcom_smp2p_negotiate(struct qcom_smp2p *smp2p) · line 247
Quoted 10 lines
drivers/soc/qcom/smp2p.c +10
-0+ + smp2p->in = in; + +/* Check if version is initialized by the remote. */ +if (in->version ==0 ) +return ; + +for (i = smp2p->valid_entries; i < in->valid_entries; i++) { +list_for_each_entry (entry, &smp2p->inbound, node) { +memcpy (buf, in->entries[i].name,sizeof (buf));
Is there a reason for this copy at all?
[...]
drivers/soc/qcom/smp2p.c static int qcom_smp2p_probe(struct platform_device *pdev) · line 673
Quoted 1 line
drivers/soc/qcom/smp2p.c +1
-0+/* Check inbound entries in the case of early boot processor */
"in case a remote processor has already been started"?
Konrad
Re: [PATCH v3 1/2] soc: qcom: smp2p: Add irqchip state support
Quoted 43 lines · Konrad Dybcio
Quoted 42 lines · Deepak Kumar Singh
From: Chris Lew <[email protected]>
A remoteproc booted during earlier boot stages such as UEFI or the bootloader, may need to be attached to without restarting the remoteproc hardware. To do this the remoteproc will need to check the ready and handover states in smp2p without an interrupt notification. Create
qcom_smp2p_start_in()to initialize the shadow state without notifying clients because these early events happened in the past.Add support for the .irq_get_irqchip_state callback so remoteproc can read the current state of the fatal, ready and handover bits.
Signed-off-by Chris Lew <[email protected]>Signed-off-by Deepak Kumar Singh <[email protected]>--- drivers/soc/qcom/smp2p.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)drivers/soc/qcom/smp2p.c +16
-0@@ -222,6 +222,39 @@ static void qcom_smp2p_negotiate(struct qcom_smp2p *smp2p) } } +static void qcom_smp2p_start_in (struct qcom_smp2p *smp2p) +{ +unsigned int smem_id = smp2p->smem_items[SMP2P_INBOUND ]; +unsigned int pid = smp2p->remote_pid; +char buf[SMP2P_MAX_ENTRY_NAME ]; +struct smp2p_smem_item *in; +struct smp2p_entry *entry; +size_t size; +int i; + + in =qcom_smem_get (pid, smem_id, &size); +if (IS_ERR (in)) +return ; + + smp2p->in = in; +
Quoted 8 lines
drivers/soc/qcom/smp2p.c static void qcom_smp2p_negotiate(struct qcom_smp2p *smp2p) · line 247
Quoted 7 lines
drivers/soc/qcom/smp2p.c +7
-0+/* Check if version is initialized by the remote. */ +if (in->version ==0 ) +return ; + +for (i = smp2p->valid_entries; i < in->valid_entries; i++) { +list_for_each_entry (entry, &smp2p->inbound, node) { +memcpy (buf, in->entries[i].name,sizeof (buf));Is there a reason for this copy at all?
I don't see a compelling reason. This code snippet is same as present in qcom_smp2p_notify_in().
Quoted 4 lines
[...]
drivers/soc/qcom/smp2p.c static int qcom_smp2p_probe(struct platform_device *pdev) · line 673
Quoted 1 line
drivers/soc/qcom/smp2p.c +1
-0+/* Check inbound entries in the case of early boot processor */ "in case a remote processor has already been started"?
This i can update in case new patch set is required.
Quoted 2 lines
Konrad
Re: [PATCH v3 1/2] soc: qcom: smp2p: Add irqchip state support
Quoted 52 lines · Deepak Kumar Singh
Quoted 42 lines · Konrad Dybcio
Quoted 41 lines · Deepak Kumar Singh
From: Chris Lew <[email protected]>
A remoteproc booted during earlier boot stages such as UEFI or the bootloader, may need to be attached to without restarting the remoteproc hardware. To do this the remoteproc will need to check the ready and handover states in smp2p without an interrupt notification. Create
qcom_smp2p_start_in()to initialize the shadow state without notifying clients because these early events happened in the past.Add support for the .irq_get_irqchip_state callback so remoteproc can read the current state of the fatal, ready and handover bits.
Signed-off-by Chris Lew <[email protected]>Signed-off-by Deepak Kumar Singh <[email protected]>--- drivers/soc/qcom/smp2p.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)drivers/soc/qcom/smp2p.c +16
-0@@ -222,6 +222,39 @@ static void qcom_smp2p_negotiate(struct qcom_smp2p *smp2p) } } +static void qcom_smp2p_start_in (struct qcom_smp2p *smp2p) +{ +unsigned int smem_id = smp2p->smem_items[SMP2P_INBOUND ]; +unsigned int pid = smp2p->remote_pid; +char buf[SMP2P_MAX_ENTRY_NAME ]; +struct smp2p_smem_item *in; +struct smp2p_entry *entry; +size_t size; +int i; + + in =qcom_smem_get (pid, smem_id, &size); +if (IS_ERR (in)) +return ; + + smp2p->in = in; +Quoted 8 lines
drivers/soc/qcom/smp2p.c static void qcom_smp2p_negotiate(struct qcom_smp2p *smp2p) · line 247
Quoted 7 lines
drivers/soc/qcom/smp2p.c +7
-0+/* Check if version is initialized by the remote. */ +if (in->version ==0 ) +return ; + +for (i = smp2p->valid_entries; i < in->valid_entries; i++) { +list_for_each_entry (entry, &smp2p->inbound, node) { +memcpy (buf, in->entries[i].name,sizeof (buf));Is there a reason for this copy at all?
Quoted 2 lines
I don't see a compelling reason. This code snippet is same as present in
qcom_smp2p_notify_in().
My understanding was that we do this copy because we don't want to do a strcmp on memory that the remote could change at any time. Maybe it's overkill but I thought it was considered good practice and as Deepak mentioned, it is similarly present in qcom_smp2p_notify_in().
Quoted 7 lines
Quoted 4 lines
[...]
drivers/soc/qcom/smp2p.c static int qcom_smp2p_probe(struct platform_device *pdev) · line 673
Quoted 1 line
drivers/soc/qcom/smp2p.c +1
-0+/* Check inbound entries in the case of early boot processor */ "in case a remote processor has already been started"?
This i can update in case new patch set is required.
Quoted 2 lines
Konrad
Re: [PATCH v3 1/2] soc: qcom: smp2p: Add irqchip state support
Quoted 53 lines · Chris Lew
Quoted 52 lines · Deepak Kumar Singh
Quoted 50 lines · Konrad Dybcio
Quoted 38 lines · Deepak Kumar Singh
From: Chris Lew <[email protected]>
A remoteproc booted during earlier boot stages such as UEFI or the bootloader, may need to be attached to without restarting the remoteproc hardware. To do this the remoteproc will need to check the ready and handover states in smp2p without an interrupt notification. Create
qcom_smp2p_start_in()to initialize the shadow state without notifying clients because these early events happened in the past.Add support for the .irq_get_irqchip_state callback so remoteproc can read the current state of the fatal, ready and handover bits.
Signed-off-by Chris Lew <[email protected]>Signed-off-by Deepak Kumar Singh <[email protected]>--- drivers/soc/qcom/smp2p.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)drivers/soc/qcom/smp2p.c +13
-0@@ -222,6 +222,39 @@ static void qcom_smp2p_negotiate(struct qcom_smp2p *smp2p) } } +static void qcom_smp2p_start_in (struct qcom_smp2p *smp2p) +{ +unsigned int smem_id = smp2p->smem_items[SMP2P_INBOUND ]; +unsigned int pid = smp2p->remote_pid; +char buf[SMP2P_MAX_ENTRY_NAME ]; +struct smp2p_smem_item *in; +struct smp2p_entry *entry; +size_t size; +int i; + + in =qcom_smem_get (pid, smem_id, &size); +if (IS_ERR (in)) +return ;drivers/soc/qcom/smp2p.c static void qcom_smp2p_negotiate(struct qcom_smp2p *smp2p) · line 246
Quoted 10 lines
drivers/soc/qcom/smp2p.c +10
-0+ + smp2p->in = in; + +/* Check if version is initialized by the remote. */ +if (in->version ==0 ) +return ; + +for (i = smp2p->valid_entries; i < in->valid_entries; i++) { +list_for_each_entry (entry, &smp2p->inbound, node) { +memcpy (buf, in->entries[i].name,sizeof (buf));Is there a reason for this copy at all?
Quoted 7 lines
Quoted 2 lines
I don't see a compelling reason. This code snippet is same as present in
qcom_smp2p_notify_in().My understanding was that we do this copy because we don't want to do a strcmp on memory that the remote could change at any time. Maybe it's overkill but I thought it was considered good practice and as Deepak mentioned, it is similarly present in
qcom_smp2p_notify_in().
Ok, right, I didn't take that into account
Konrad
Re: [PATCH v3 1/2] soc: qcom: smp2p: Add irqchip state support
In reply to Chris LewQuoted 52 lines · Chris Lew
Quoted 51 lines · Deepak Kumar Singh
Quoted 50 lines · Konrad Dybcio
Quoted 38 lines · Deepak Kumar Singh
From: Chris Lew <[email protected]>
A remoteproc booted during earlier boot stages such as UEFI or the bootloader, may need to be attached to without restarting the remoteproc hardware. To do this the remoteproc will need to check the ready and handover states in smp2p without an interrupt notification. Create
qcom_smp2p_start_in()to initialize the shadow state without notifying clients because these early events happened in the past.Add support for the .irq_get_irqchip_state callback so remoteproc can read the current state of the fatal, ready and handover bits.
Signed-off-by Chris Lew <[email protected]>Signed-off-by Deepak Kumar Singh <[email protected]>--- drivers/soc/qcom/smp2p.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)drivers/soc/qcom/smp2p.c +13
-0@@ -222,6 +222,39 @@ static void qcom_smp2p_negotiate(struct qcom_smp2p *smp2p) } } +static void qcom_smp2p_start_in (struct qcom_smp2p *smp2p) +{ +unsigned int smem_id = smp2p->smem_items[SMP2P_INBOUND ]; +unsigned int pid = smp2p->remote_pid; +char buf[SMP2P_MAX_ENTRY_NAME ]; +struct smp2p_smem_item *in; +struct smp2p_entry *entry; +size_t size; +int i; + + in =qcom_smem_get (pid, smem_id, &size); +if (IS_ERR (in)) +return ;drivers/soc/qcom/smp2p.c static void qcom_smp2p_negotiate(struct qcom_smp2p *smp2p) · line 246
Quoted 10 lines
drivers/soc/qcom/smp2p.c +10
-0+ + smp2p->in = in; + +/* Check if version is initialized by the remote. */ +if (in->version ==0 ) +return ; + +for (i = smp2p->valid_entries; i < in->valid_entries; i++) { +list_for_each_entry (entry, &smp2p->inbound, node) { +memcpy (buf, in->entries[i].name,sizeof (buf));Is there a reason for this copy at all?
Quoted 13 lines
Quoted 2 lines
I don't see a compelling reason. This code snippet is same as present in
qcom_smp2p_notify_in().My understanding was that we do this copy because we don't want to do a strcmp on memory that the remote could change at any time. Maybe it's overkill but I thought it was considered good practice and as Deepak mentioned, it is similarly present in
qcom_smp2p_notify_in().Quoted 6 lines
Quoted 4 lines
[...]
drivers/soc/qcom/smp2p.c static int qcom_smp2p_probe(struct platform_device *pdev) · line 673
Quoted 1 line
drivers/soc/qcom/smp2p.c +1
-0+/* Check inbound entries in the case of early boot processor */ "in case a remote processor has already been started"?
This i can update in case new patch set is required.
Quoted 1 line
Konrad
Are you expecting new patch for this update or current one is ok?
Deepak
Quoted 1 line
Quoted 1 line
Quoted 1 line
Re: [PATCH v3 1/2] soc: qcom: smp2p: Add irqchip state support
Quoted 61 lines · Deepak Kumar Singh
Quoted 59 lines · Chris Lew
Quoted 51 lines · Deepak Kumar Singh
Quoted 42 lines · Konrad Dybcio
Quoted 41 lines · Deepak Kumar Singh
From: Chris Lew <[email protected]>
A remoteproc booted during earlier boot stages such as UEFI or the bootloader, may need to be attached to without restarting the remoteproc hardware. To do this the remoteproc will need to check the ready and handover states in smp2p without an interrupt notification. Create
qcom_smp2p_start_in()to initialize the shadow state without notifying clients because these early events happened in the past.Add support for the .irq_get_irqchip_state callback so remoteproc can read the current state of the fatal, ready and handover bits.
Signed-off-by Chris Lew <[email protected]>Signed-off-by Deepak Kumar Singh <[email protected]>---
drivers/soc/qcom/smp2p.c| 55 ++++++++++++++++++++++++++++++++++++++++++++++++1 file changed, 55 insertions(+)drivers/soc/qcom/smp2p.c +16
-0@@ -222,6 +222,39 @@ static void qcom_smp2p_negotiate(struct qcom_smp2p *smp2p) } } +static void qcom_smp2p_start_in (struct qcom_smp2p *smp2p) +{ + unsigned int smem_id = smp2p->smem_items[SMP2P_INBOUND]; + unsigned int pid = smp2p->remote_pid; + char buf[SMP2P_MAX_ENTRY_NAME]; + struct smp2p_smem_item *in; + struct smp2p_entry *entry; + size_t size; + int i; + + in = qcom_smem_get(pid, smem_id, &size); + if (IS_ERR(in)) + return; + + smp2p->in = in; +Quoted 8 lines
drivers/soc/qcom/smp2p.c static void qcom_smp2p_negotiate(struct qcom_smp2p *smp2p) · line 247
Quoted 7 lines
drivers/soc/qcom/smp2p.c +7
-0+ /* Check if version is initialized by the remote. */ + if (in->version == 0) + return; + + for (i = smp2p->valid_entries; i < in->valid_entries; i++) { + list_for_each_entry(entry, &smp2p->inbound, node) { + memcpy(buf, in->entries[i].name, sizeof(buf));Is there a reason for this copy at all?
Quoted 2 lines
I don't see a compelling reason. This code snippet is same as present in
qcom_smp2p_notify_in().My understanding was that we do this copy because we don't want to do a strcmp on memory that the remote could change at any time. Maybe it's overkill but I thought it was considered good practice and as Deepak mentioned, it is similarly present in
qcom_smp2p_notify_in().
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
[...]
Quoted 1 line
+ /* Check inbound entries in the case of early boot processor */
"in case a remote processor has already been started"?
This i can update in case new patch set is required.
Quoted 1 line
Konrad
Are you expecting new patch for this update or current one is ok?
I don't have any more comments. Bjorn left a review on the previous version so I'd be happy to see him ack this
Konrad
PATCH v3 2/2 soc: qcom: smp2p: Add support for smp2p v2
In reply to Deepak Kumar SinghFrom: Chris Lew <[email protected]>
smp2p v2 adds support for allowing remote processors to write outbound smp2p items without completing the feature negotiation. This is required for processors that start before linux to write out signals like error and clock ready and unblock their bootup.
If a remote processor only supports v1, smp2p can version down by mirroring the peer version during the negotiation stage.
When using smp2p version 2, the remote does not wait for the ssr ack before setting the items. To accommodate this, set the last_value of all the entries to 0 when SSR is detected. This forces smp2p to detect the new values written by the remote. Because the SSR ack is skipped, the down transition of bits is missed in smp2p version 2.
--- drivers/soc/qcom/smp2p.c | 48 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-)
drivers/soc/qcom/smp2p.c +44 -4
@@ -36,6 +36,10 @@* The driver uses the Linux GPIO and interrupt framework to expose a virtual * GPIO for each outbound entry and a virtual interrupt controller for each * inbound entry. +* +* V2 of SMP2P allows remote processors to write to outbound smp2p items before +* the full smp2p connection is negotiated. This is important for processors +* started before linux runs. */ #define SMP2P_MAX_ENTRY 16
@@ -47,11 +51,12 @@#define SMP2P_MAGIC 0x504d5324#define SMP2P_ALL_FEATURES SMP2P_FEATURE_SSR_ACK +#define MAX_VERSION 2/** * struct smp2p_smem_item - in memory communication structure * @magic: magic number -* @version: version - must be 1 +* @version: version * @features: features flag - currently unused * @local_pid: processor id of sending end * @remote_pid: processor id of receiving end
@@ -180,14 +185,22 @@ static void qcom_smp2p_kick(struct qcom_smp2p *smp2p)static bool qcom_smp2p_check_ssr (struct qcom_smp2p *smp2p) {struct smp2p_smem_item *in = smp2p->in; +struct smp2p_entry *entry; +bool restart_done;bool restart;if (!smp2p->ssr_ack_enabled)return false; - restart = in->flags &BIT (SMP2P_FLAGS_RESTART_DONE_BIT ); + restart_done = in->flags &BIT (SMP2P_FLAGS_RESTART_DONE_BIT ); + restart = restart_done != smp2p->ssr_ack; +list_for_each_entry (entry, &smp2p->inbound, node) { +if (!entry->value) +continue ; + entry->last_value =0 ; + } -return restart != smp2p->ssr_ack; +return restart; }static void qcom_smp2p_do_ssr_ack (struct qcom_smp2p *smp2p)
@@ -219,9 +232,26 @@ static void qcom_smp2p_negotiate(struct qcom_smp2p *smp2p) smp2p->negotiation_done = true;trace_smp2p_negotiate (smp2p->dev, out->features); + }else if (in->version && in->version < out->version) { + out->version = in->version; +qcom_smp2p_kick (smp2p); } } +static int qcom_smp2p_in_version (struct qcom_smp2p *smp2p) +{ +unsigned int smem_id = smp2p->smem_items[SMP2P_INBOUND ]; +unsigned int pid = smp2p->remote_pid; +struct smp2p_smem_item *in; +size_t size; + + in =qcom_smem_get (pid, smem_id, &size); +if (IS_ERR (in)) +return 0 ; + +return in->version; +} +static void qcom_smp2p_start_in (struct qcom_smp2p *smp2p) {unsigned int smem_id = smp2p->smem_items[SMP2P_INBOUND ];
@@ -516,6 +546,7 @@ static int qcom_smp2p_alloc_outbound_item(struct qcom_smp2p *smp2p)struct smp2p_smem_item *out;unsigned smem_id = smp2p->smem_items[SMP2P_OUTBOUND ];unsigned pid = smp2p->remote_pid; +u8 in_version;int ret; ret =qcom_smem_alloc (pid, smem_id,sizeof (*out));
@@ -537,12 +568,21 @@ static int qcom_smp2p_alloc_outbound_item(struct qcom_smp2p *smp2p) out->valid_entries =0 ; out->features =SMP2P_ALL_FEATURES ; + in_version =qcom_smp2p_in_version (smp2p); +if (in_version >MAX_VERSION ) { +dev_err (smp2p->dev,"Unsupported smp2p version %d\n" , in_version); +return -EINVAL ; + } +/* * Make sure the rest of the header is written before we validate the * item by writing a valid version number. */ wmb (); - out->version =1 ; +if (in_version && in_version <=2 ) + out->version = in_version; +else + out->version =2 ;qcom_smp2p_kick (smp2p);
Signature · 1 line
2.34.1
Quoted 5 lines · Deepak Kumar Singh
Some remoteproc will boot during earlier boot stages, add callback .irq_get_irqchip_state for remoteproc to check the states in smp2p and mark the state "attached", also add smp2p v2 support.
Applied, thanks!
[1/2] soc: qcom: smp2p: Add irqchip state support
commit: 8a9a7b9d14c21d060301a8dd4a676ccb4ade5870
[2/2] soc: qcom: smp2p: Add support for smp2p v2
commit: 42c4cf5d482813067789dd5ea2e33f3b7805e7e1Best regards,
Signature · 1 line
Bjorn Andersson <[email protected]>