Skip to content
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

Ipc reduced structures #19877

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

mif1-nordic
Copy link

@mif1-nordic mif1-nordic commented Jan 13, 2025

Depends on #19449

@mif1-nordic mif1-nordic requested review from a team as code owners January 13, 2025 13:47
@NordicBuilder
Copy link
Contributor

NordicBuilder commented Jan 13, 2025

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff

All manifest checks OK

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@NordicBuilder
Copy link
Contributor

NordicBuilder commented Jan 13, 2025

CI Information

To view the history of this post, clich the 'edited' button above
Build number: 16

Inputs:

Sources:

sdk-nrf: PR head: b749c232705f1364ec7a50ab7493b65b5d40715c

more details

sdk-nrf:

PR head: b749c232705f1364ec7a50ab7493b65b5d40715c
merge base: a14701baea486b7d65771ad3b9826719c60633dd
target head (main): cb640677e0fd450e4d90db9803fd0325f58a2921
Diff

Github labels

Enabled Name Description
ci-disabled Disable the ci execution
ci-all-test Run all of ci, no test spec filtering will be done
ci-force-downstream Force execution of downstream even if twister fails
ci-run-twister Force run twister
ci-run-zephyr-twister Force run zephyr twister
List of changed files detected by CI (8)
applications
│  ├── sdp
│  │  ├── mspi
│  │  │  ├── boards
│  │  │  │  │ nrf54l15dk_nrf54l15_cpuflpr.conf
│  │  │  ├── src
│  │  │  │  ├── hrt
│  │  │  │  │  ├── hrt.c
│  │  │  │  │  ├── hrt.h
│  │  │  │  │  │ hrt.s
│  │  │  │  │ main.c
cmake
│  │ sdp.cmake
drivers
│  ├── mspi
│  │  │ mspi_nrfe.c
include
│  ├── drivers
│  │  ├── mspi
│  │  │  │ nrfe_mspi.h

Outputs:

Toolchain

Version: 342151af73
Build docker image: docker-dtr.nordicsemi.no/sw-production/ncs-build:342151af73_912848a074

Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped; ⚠️ Quarantine

  • ◻️ Toolchain - Skipped: existing toolchain is used
  • ✅ Build twister
  • ❌ Integration tests
    • ✅ test-sdk-audio
    • ❌ desktop52_verification
    • ❌ test-fw-nrfconnect-boot
    • ✅ test-fw-nrfconnect-apps
    • ✅ test_ble_nrf_config
    • ✅ test-fw-nrfconnect-ble_mesh
    • ✅ test-fw-nrfconnect-ble_samples
    • ✅ test-fw-nrfconnect-chip
    • ✅ test-fw-nrfconnect-nfc
    • ✅ test-fw-nrfconnect-nrf-iot_libmodem-nrf
    • ✅ test-fw-nrfconnect-nrf-iot_serial_lte_modem
    • ✅ test-fw-nrfconnect-nrf-iot_zephyr_lwm2m
    • ✅ test-fw-nrfconnect-nrf-iot_samples
    • ✅ test-fw-nrfconnect-nrf-iot_lwm2m
    • ✅ doc-internal
    • ✅ test-fw-nrfconnect-nrf-iot_thingy91
    • ✅ test-fw-nrfconnect-nrf_crypto
    • ✅ test-fw-nrfconnect-rpc
    • ✅ test-fw-nrfconnect-rs
    • ✅ test-fw-nrfconnect-fem
    • ✅ test-fw-nrfconnect-tfm
    • ✅ test-fw-nrfconnect-thread
    • ✅ test-fw-nrfconnect-zigbee
    • ✅ test-sdk-find-my
    • ✅ test-fw-nrfconnect-nrf-iot_mosh
    • ✅ test-fw-nrfconnect-nrf-iot_positioning
    • ✅ test-sdk-sidewalk
    • ✅ test-sdk-wifi
    • ✅ test-low-level
    • ❌ test-fw-nrfconnect-nrf-iot_nrf_provisioning
    • ✅ test-sdk-pmic-samples
    • ✅ test-sdk-mcuboot
    • ✅ test-sdk-dfu
    • ✅ test-fw-nrfconnect-ps
    • ✅ test-secdom-samples-public

Note: This message is automatically posted and updated by the CI

@mif1-nordic mif1-nordic force-pushed the Ipc_Reduced_Structures branch from 3f4fe33 to 860ba08 Compare January 13, 2025 13:57
drivers/mspi/mspi_nrfe.c Outdated Show resolved Hide resolved
drivers/mspi/mspi_nrfe.c Outdated Show resolved Hide resolved
drivers/mspi/mspi_nrfe.c Outdated Show resolved Hide resolved
@mif1-nordic mif1-nordic force-pushed the Ipc_Reduced_Structures branch from 860ba08 to 49791bb Compare January 14, 2025 16:11
@masz-nordic masz-nordic added this to the 3.0.0 milestone Jan 14, 2025
@mif1-nordic mif1-nordic force-pushed the Ipc_Reduced_Structures branch 3 times, most recently from bcbe9c9 to 51738bc Compare January 15, 2025 12:51
@github-actions github-actions bot added changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. and removed manifest labels Jan 15, 2025
@NordicBuilder
Copy link
Contributor

You can find the documentation preview for this PR at this link.

Note: This comment is automatically posted by the Documentation Publish GitHub Action.

@mif1-nordic mif1-nordic force-pushed the Ipc_Reduced_Structures branch 3 times, most recently from b2f47e9 to 461afba Compare January 15, 2025 15:29
@@ -44,3 +44,5 @@ CONFIG_SYS_CLOCK_EXISTS=n

CONFIG_OUTPUT_DISASSEMBLY=y
CONFIG_COMMON_LIBC_MALLOC=n

CONFIG_COMPILER_OPT="-fshort-enums"
Copy link
Contributor

Choose a reason for hiding this comment

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

why exactly is short-enums required ?

I see no comments on this.

Copy link
Author

Choose a reason for hiding this comment

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

This was introduced in previous PR #19449 but it is required for IPC.
APP is transfering structures containing enums to VPR and APP is configured to have short enums so VPR couldn't read them.

Copy link
Contributor

@magp-nordic magp-nordic left a comment

Choose a reason for hiding this comment

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

Revied only the new structures definitions.

Comment on lines +74 to +79
typedef struct {
nrfe_mspi_opcode_t opcode; /* nrfe_mspi_opcode */
uint32_t command;
uint32_t address;
uint32_t num_bytes;
} nrfe_mspi_xfer_packet_t;
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is data?

Copy link
Author

Choose a reason for hiding this comment

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

As I don't know the data size I couldn't add it as a field to the structure, so the data is appended at the end of structure when sending is through IPC to VPR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why not send a pointer to the data then? I do not like that data is hidden in this solution

enum mspi_duplex duplex;
enum mspi_io_mode io_mode;
enum mspi_cpp_mode cpp;
enum mspi_endian endian;
Copy link
Contributor

Choose a reason for hiding this comment

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

I would remove endianness, right now we only support big-endian.

Copy link
Author

Choose a reason for hiding this comment

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

yes, but as we've discussed in the meeting about these structures some of the fields we are not using right now but will be used in the future

uint8_t command_length;
uint8_t address_length;
uint8_t ce_num; //vio number
enum mspi_duplex duplex;
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as endianness, we only support half-duplex for now.

Copy link
Author

Choose a reason for hiding this comment

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

yes, but as we've discussed in the meeting about these structures some of the fields we are not using right now but will be used in the future

Copy link
Contributor

@magp-nordic magp-nordic Jan 17, 2025

Choose a reason for hiding this comment

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

But why add them now? They can be added when we add support for other modes, so when those fields can actually be used. It's not like those structures need to have everything included now, they can be changed in the future.
Also, I am afraid, that if we add it now and then we release it that way, some people may try to use it, because they will think other modes are supported.

enum mspi_cpp_mode cpp;
enum mspi_endian endian;
bool hold_ce;
nrfe_mspi_polarity_t ce_polarities[NRFE_MSPI_CE_PINS_MAX];
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we sending multiple CE polarities, if there is only one CE (ce_num)?

Copy link
Author

Choose a reason for hiding this comment

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

we have to send polarities of all the pins so that VPR knows how to set them to inactive state when sending data to only one of them. ce_num is the index of the device with which we want to talk.

Copy link
Contributor

@magp-nordic magp-nordic Jan 17, 2025

Choose a reason for hiding this comment

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

I guess we have different understandings of the configuration phase, so let me explain my point of view. Zephyr's MSPI driver API has two configuration functions: mspi_config and mspi_dev_config. mspi_config is used to configure the driver itself (doc: "Configure a MSPI controller."), and it takes data from DTS, which makes sense because the driver can be limited by the hardware (DTS files are supposed to describe hardware). So in DTS files you have specified CE lines that COULD be used by the driver user, meaning which hardware pins can be used by the driver as CE. Not all of them have to be used, it is just a possibility on a given soc.
Then, we also have mspi_dev_config, which should be used to configure a peripheral MSPI device (doc: "Configure a MSPI controller with device-specific parameters."), and it takes the mspi_dev_cfg structure (which is specified by the driver's user), which contains info, which CE PIN should be used, of the ones that are possible, and its polarity. So, we can set the pin to its inactive state in the driver as soon as the device is configured by the user.
I would assume, that all devices should or even must be configured before the first TX/RX happens, because I cannot imagine a scenario when some device has to be configured after we've already sent something to another device. If there is such case, let me know, it is possible I am not aware of something. But otherwise, I would send just one pin number and one pin polarity in nrfe_mspi_xfer_config_t. Sure, there might be a case for specifying the polarity of all possible CE pins at once, which we do not know of yet, but IF such case appears, THEN we will worry about it.

nrfe_mspi_opcode_t opcode; /* nrfe_mspi_opcode */
uint8_t command_length;
uint8_t address_length;
uint8_t ce_num; //vio number
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: you can just rename it to ce_vio_pin or ce_vio_num, instead of adding this comment.

pinctrl_soc_pin_t pin[NRFE_MSPI_PINS_MAX];
} nrfe_mspi_pinctrl_soc_pin_t;

typedef struct {
nrfe_mspi_opcode_t opcode; /* nrfe_mspi_opcode */
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you tried that it works when opcode is defined as an enum in these structures, instead of uint8_t? I am skeptical about it, especially because I just checked -fshort-enums compiler option that you use, and I can't find it as an option for RISC-V, only for ARM. And you add it as a compilation flag in FLPR config file.

typedef struct __packed {
uint8_t opcode; /* nrfe_mspi_opcode */
typedef enum {
NRFE_MSPI_POL_UNDEFINED = 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this state needed? mspi_dev_cfg has both the CE number (so which CE should be used for this device) and CE polarity, so we can set the inactive level immediately when configuring a device.

NRFE_MSPI_TX,
NRFE_MSPI_TXRX,
NRFE_MSPI_CONFIG_PINS, /*nrfe_mspi_pinctrl_soc_pin_t*/
NRFE_MSPI_CONFIG_XFER, /*nrfe_mspi_xfer_config_t*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I would rename it to NRFE_MSPI_CONFIG_DEV, because it is more similar to mspi_dev_cfg than to mspi_xfer.

@mif1-nordic mif1-nordic force-pushed the Ipc_Reduced_Structures branch from 000dcf7 to 61ce62d Compare January 16, 2025 12:19
kobj-types-enum.h was generated after VPR
asm_gen, moved asm_gen to POST_BUILD.

Signed-off-by: Michal Frankiewicz <[email protected]>
@mif1-nordic mif1-nordic force-pushed the Ipc_Reduced_Structures branch from 61ce62d to 3d095bb Compare January 16, 2025 14:42
jaz1-nordic and others added 2 commits January 16, 2025 15:50
added mode support for SINGLE,QUAD,QUAD_1_4_4,QUAD_1_1_4
and custom Ipc mspi structures

Signed-off-by: Michal Frankiewicz <[email protected]>
Signed-off-by: Jakub Zymelka <[email protected]>
Added reactions to all mspi Ipc messages but
NRFE_MSPI_TXRX and NRFE_MSPI_TX. The data is stored
in local structures for later use.

Signed-off-by: Michal Frankiewicz <[email protected]>
@mif1-nordic mif1-nordic force-pushed the Ipc_Reduced_Structures branch from 3d095bb to dffb578 Compare January 16, 2025 15:17
@NordicBuilder
Copy link
Contributor

NordicBuilder commented Jan 16, 2025

Memory footprint analysis revealed the following potential issues

applications.nrf_desktop.zdebug[nrf5340dk/nrf5340/cpuapp]: RAM size increased by 512[B] in comparison to the main[874962f] branch. - link (cc: @MarekPieta)
applications.nrf_desktop.zrelease[nrf54h20dk/nrf54h20/cpuapp]: RAM size increased by 816[B] in comparison to the main[874962f] branch. - link (cc: @MarekPieta)
applications.nrf_desktop.zrelease[nrf54h20dk/nrf54h20/cpuapp]: ROM size increased by 612[B] in comparison to the main[874962f] branch. - link (cc: @MarekPieta)
sample.matter.template.debug[nrf52840dk/nrf52840]: ROM size increased by 2932[B] in comparison to the main[874962f] branch. - link (cc: @kkasperczyk-no @ArekBalysNordic @markaj-nordic)
applications.nrf_desktop.zdebug.uart[nrf54h20dk/nrf54h20/cpuapp]: RAM size increased by 816[B] in comparison to the main[874962f] branch. - link (cc: @MarekPieta)
applications.nrf_desktop.zdebug.uart[nrf54h20dk/nrf54h20/cpuapp]: ROM size increased by 608[B] in comparison to the main[874962f] branch. - link (cc: @MarekPieta)
sample.matter.template.release[nrf52840dk/nrf52840]: ROM size increased by 2872[B] in comparison to the main[874962f] branch. - link (cc: @kkasperczyk-no @ArekBalysNordic @markaj-nordic)
applications.nrf_desktop.zrelease[nrf5340dk/nrf5340/cpuapp]: RAM size increased by 512[B] in comparison to the main[874962f] branch. - link (cc: @MarekPieta)
sample.matter.template.release[nrf5340dk/nrf5340/cpuapp]: ROM size increased by 2872[B] in comparison to the main[874962f] branch. - link (cc: @kkasperczyk-no @ArekBalysNordic @markaj-nordic)
applications.nrf_desktop.zdebug_nrf21540ek_multicore[nrf5340dk/nrf5340/cpuapp]: RAM size increased by 512[B] in comparison to the main[874962f] branch. - link (cc: @MarekPieta)
sample.matter.template.debug[nrf7002dk/nrf5340/cpuapp]: High ROM usage: 912202[B] - link (cc: @kkasperczyk-no @ArekBalysNordic @markaj-nordic)
sample.matter.template.debug[nrf5340dk/nrf5340/cpuapp]: ROM size increased by 2936[B] in comparison to the main[874962f] branch. - link (cc: @kkasperczyk-no @ArekBalysNordic @markaj-nordic)
sample.matter.template.release[nrf7002dk/nrf5340/cpuapp]: High ROM usage: 821030[B] - link (cc: @kkasperczyk-no @ArekBalysNordic @markaj-nordic)

Note: This message is automatically posted and updated by the CI (latest/sdk-nrf/PR-19877/16)

Added MSPI_TX reaction to NRFE_MSPI_TXRX and NRFE_MSPI_TX.
Added HRT mspi TX functionality.

Signed-off-by: Michal Frankiewicz <[email protected]>
@mif1-nordic mif1-nordic force-pushed the Ipc_Reduced_Structures branch from dffb578 to e5039ce Compare January 17, 2025 07:43
Implemented smaller structures and reduced ammount of opcodes in IPC

Signed-off-by: Michal Frankiewicz <[email protected]>
@mif1-nordic mif1-nordic force-pushed the Ipc_Reduced_Structures branch from e5039ce to a674e62 Compare January 17, 2025 09:56
Implemented smaller structures and reduced ammount of opcodes in IPC

Signed-off-by: Michal Frankiewicz <[email protected]>
@mif1-nordic mif1-nordic force-pushed the Ipc_Reduced_Structures branch from a674e62 to b749c23 Compare January 17, 2025 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants