Skip to content

[RFC] [Do not merge] ipc: support for sending ipc payload using registers added - #1339

Closed
lbetlej wants to merge 2 commits into
thesofproject:masterfrom
lbetlej:pm-state-set-registers
Closed

lbetlej wants to merge 2 commits into
thesofproject:masterfrom
lbetlej:pm-state-set-registers

Conversation

@lbetlej

@lbetlej lbetlej commented Apr 26, 2019

Copy link
Copy Markdown
Collaborator

cAVS HW while FW is in a D0ix state does not guarantee access from host CPU to a memory shared with DSP. To enforce D0ix->D0 transtion host has to send the message using IPC registers only. The change enforces that host driver has to control MSG/MSGEXT bits while operating on IPC registers.

Note that this PR is to review the idea to add register based communication for cAVS HW for low power management stat transitions. Specifically implementation of recreating IPC structures from register content is not finalized.

lbetlej added 2 commits April 26, 2019 10:37
The commit extends IPC interface between a driver and FW to support
new power flows to be used with keyword detection feature. A new
command is added to set request for power state transition request
explicitly & definition of D0ix in addtion to D0 , D3 states is added.

Signed-off-by: Lech Betlej <lech.betlej@linux.intel.com>
cAVS HW in a D0ix state does not guarantee access from host CPU to
a memory shared with DSP. To enforce D0ix->D0 transtion host has to
send the message using IPC registers only. The change enforces that
host driver has to control MSG/MSGEXT bits while operating on IPC
registers.

Signed-off-by: Lech Betlej <lech.betlej@linux.intel.com>
@lbetlej lbetlej added the ABI ABI change involved label Apr 26, 2019
@lbetlej
lbetlej requested review from a team, RanderWang, bardliao and xiulipan as code owners April 26, 2019 15:54
@lbetlej lbetlej changed the title [RFC] ipc: support for sending ipc payload using registers added [RFC] [Do not merge] ipc: support for sending ipc payload using registers added Apr 26, 2019
Comment thread src/include/sof/ipc.h
/* get posn offset by pipeline. */
int ipc_get_posn_offset(struct ipc *ipc, struct pipeline *pipe);

enum ipc_payload_location {

@jajanusz jajanusz Apr 30, 2019 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We add something globally that may not be widely supported. Shouldn't we just guard it with config for low power ipc and use it by default when available and fallback to mailbox on platforms that don't have lp ipc?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jajanusz I agree, all those defs are related to how the IPC data is transported on a specific set of platforms (Intel cAVS family). Therefore we should create another "transport" layer first and separate common upper logic, n both endpoints, the FW and the driver. Then, we may start introducing changes to the lower transport for Intel cAVS platform like the one proposed in the patch.

@plbossart plbossart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @lbetlej, see comments below

Comment thread src/include/uapi/ipc/pm.h
SOF_PM_STATE_D0 = 0, /* D0 only, also initial state */
SOF_PM_STATE_D3, /* D3 DSP subsystem is power gated*/
/* internal FW transitions across D0ix substates incl. D0 are allowed */
SOF_PM_STATE_D0ix,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we instead use a bitmap
Bit0: D0
Bit1: D3
Bit2: D0i1
Bit3: D0i2
Bit3: D0i3

This would keep the definitions for D0 and D3 and allow for new additions fairly easily.

@mmaka1 mmaka1 May 10, 2019 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plbossart I believe there is a similar concern about using bitmaps vs. "enums", part of the recent memory caps discussion (#1394 (comment)). Bitmap enables invalid combinations, not allowed when using enums (not necessarily coded as C enums if this is part of public inter processor API btw).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mmaka1 yes, I meant an explicit bitmap with the bit position defined, not an implicit one with the ':1: notation. In other words you have a uint32_t pm_state and its bits define state information.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plbossart @mmaka1 is the purpose of using bits to be able to specify supported power states e.g. as (D0 | D3 | D0i1)? In that case, yes, I also think using bits would make sense. However, if there's no plan to use such masks, I'm not sure bits make sense?. Sometimes also both are used like

enum {V1, V2, V3};
#define CAP_V1 BIT(V1)
#define CAP_V2 BIT(V2)
#define CAP_V3 BIT(V3)

#define SOF_IPC_PM_CLK_REQ SOF_CMD_TYPE(0x006)
#define SOF_IPC_PM_CORE_ENABLE SOF_CMD_TYPE(0x007)
#define SOF_IPC_PM_STATE_SET SOF_CMD_TYPE(0x008)
#define SOF_IPC_PM_STATE_GET SOF_CMD_TYPE(0x009)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we would want to deprecated CTX_SAVE and use STATE_SET(D3) instead. And likewise CTX_RESTORE would be STATE_SET(D0).

It's not clear if we need a _GET if there is a reply to SET? In what case would the kernel need to get a state that it didn't set in the first place?

Comment thread src/include/uapi/ipc/pm.h
enum sof_pm_pg {
SOF_PM_PG_ON = 0, /* Power gating enabled, */
SOF_PM_PG_OFF, /* Power gating disabled */
};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need these two definitions if we have boolean states for 'prevent_power_gating' and 'prevent_clock_gating'.

Or just like for power state should we have a bitfield that's extensible for power and clock gating?

Comment thread src/include/sof/ipc.h
/* register based communication */
uint32_t ipc_payload; /* SOF_IPC_PAYLOAD_... */
uint32_t reg1;
uint32_t reg2;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get why this is needed. I thought we would either
A) get the info directly from the memory windows
B) uncompress the information from the IPC register

In both cases, we'd handle the same structure in the end, so not sure why we would keep this information in a intermediate structure.

Comment thread src/include/sof/ipc.h
/* get posn offset by pipeline. */
int ipc_get_posn_offset(struct ipc *ipc, struct pipeline *pipe);

enum ipc_payload_location {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jajanusz I agree, all those defs are related to how the IPC data is transported on a specific set of platforms (Intel cAVS family). Therefore we should create another "transport" layer first and separate common upper logic, n both endpoints, the FW and the driver. Then, we may start introducing changes to the lower transport for Intel cAVS platform like the one proposed in the patch.

Comment thread src/include/uapi/ipc/pm.h
SOF_PM_STATE_D0 = 0, /* D0 only, also initial state */
SOF_PM_STATE_D3, /* D3 DSP subsystem is power gated*/
/* internal FW transitions across D0ix substates incl. D0 are allowed */
SOF_PM_STATE_D0ix,

@mmaka1 mmaka1 May 10, 2019 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plbossart I believe there is a similar concern about using bitmaps vs. "enums", part of the recent memory caps discussion (#1394 (comment)). Bitmap enables invalid combinations, not allowed when using enums (not necessarily coded as C enums if this is part of public inter processor API btw).

@lgirdwood

Copy link
Copy Markdown
Member

@lbetlej @mmaka1 can we use same regs/bits as CAVS version ?

@lbetlej lbetlej closed this Oct 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ABI ABI change involved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants