Subject: Re: [PATCH v13 3/4] gpio: rpmsg: add generic rpmsg GPIO driver

From: "Padhi, Beleswar" <[email-masked]>
Date: Wed, 29 Apr 2026 20:05:40 +0530

On 4/28/2026 10:06 PM, Shenwei Wang wrote:
>
>> -----Original Message-----
>> From: Padhi, Beleswar <[email-masked]>
>> Sent: Tuesday, April 28, 2026 10:53 AM
>> To: Shenwei Wang <[email-masked]>; Linus Walleij
>> <[email-masked]>; Bartosz Golaszewski <[email-masked]>; Jonathan Corbet
>> <[email-masked]>; Rob Herring <[email-masked]>; Krzysztof Kozlowski
>> <[email-masked]>; Conor Dooley <[email-masked]>; Bjorn Andersson
>> <[email-masked]>; Mathieu Poirier <[email-masked]>; Frank Li
>> <[email-masked]>; Sascha Hauer <[email-masked]>
>> Cc: Shuah Khan <[email-masked]>; [email-masked]; linux-
>> [email-masked]; [email-masked]; Pengutronix Kernel Team
>> <[email-masked]>; Fabio Estevam <[email-masked]>; Peng Fan
>> <[email-masked]>; [email-masked]; linux-
>> [email-masked]; [email-masked]; linux-arm-
>> [email-masked]; dl-linux-imx <[email-masked]>; Bartosz
>> Golaszewski <[email-masked]>; Andrew Lunn <[email-masked]>
>> Subject: [EXT] Re: [PATCH v13 3/4] gpio: rpmsg: add generic rpmsg GPIO driver
>>>> Nothing extra in my opinion. rpmsg_create_ept() just creates a
>>>> dynamic local endpoint address for Linux's usage. The firmware just
>>>> has to make sure to reply to the same endpoint address where it
>>>> received the message. This should already be in place IMO, because
>>>> currently you are sending all messages in the default
>>> Since rpmsg_create_ept creates a new local endpoint address on the
>>> Linux side, how is the remote system expected to learn and use this
>>> new address for communication if no additional logic is added on the remote
>> side?
>>
>>
>> Remote side learns the endpoint when it receives any message from Linux from
>> the dynamic endpoint.
>>
>> Lets say rpmsg_create_ept() allocates a dynamic local ept of 1026. When you
>> send the message from this endpoint, the standard rpmsg header would have:
>>
>>       85 struct rpmsg_hdr {
>>       86         __rpmsg32 src; // 1026
>>       87         __rpmsg32 dst; // rpdev->dst (e.g. 400)
>>       88         __rpmsg32 reserved;
>>       89         __rpmsg16 len;
>>       90         __rpmsg16 flags;
>>       91         u8 data[];
>>       92 } __packed;
>>
>> Remote side tracks the dynamic endpoint by reading src = 1026. And while
>> sending the response it fills the header as:
>>
>>       85 struct rpmsg_hdr {
>>       86         __rpmsg32 src; // 400
>>       87         __rpmsg32 dst; // 1026
>>       88         __rpmsg32 reserved;
>>       89         __rpmsg16 len;
>>       90         __rpmsg16 flags;
>>       91         u8 data[];
>>       92 } __packed;
>>
> This explains how reply messages work in this scenario: the remote side can simply send
> the response back to the source address of the incoming message.
>
> How does this work for notification messages initiated by the remote side? Should the remote
> system need to add additional logic to track the source address based on the GPIO instance?

You should already have the tracking logic in firmware. How else are you
sending the notification messages from firmware with your current v13
implementation? Are you assuming the channel address to be always the
same? If so, this is a bug and should be fixed in firmware because the
address is generated dynamically. For example, if another core announces
its name service first, then the channel address for your core would be
different and the functionality would break.

Instead, you should have a map of ept to port idx in the firmware side
when you receive a message from Linux (just like we would maintain it
in struct rpmsg_gpio_port in Linux too).

Thanks,
Beleswar

[...]