[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8781578d-7323-43c2-ad75-35bed142916f@lunn.ch>
Date: Sun, 16 Jun 2024 21:03:40 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Yojana Mallik <y-mallik@...com>
Cc: schnelle@...ux.ibm.com, wsa+renesas@...g-engineering.com,
diogo.ivo@...mens.com, rdunlap@...radead.org, horms@...nel.org,
vigneshr@...com, rogerq@...com, danishanwar@...com,
pabeni@...hat.com, kuba@...nel.org, edumazet@...gle.com,
davem@...emloft.net, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, srk@...com, rogerq@...nel.org,
Siddharth Vadapalli <s-vadapalli@...com>
Subject: Re: [PATCH net-next v2 2/3] net: ethernet: ti: Register the RPMsg
driver as network device
> As i said in my previous message. Forget about the A54->R5. Think
> about a generic architecture. You have an RPMSG facility using the API
> described in the documentation. You have a block of shared
> memory. That memory could be VRAM, it could be a dual port SRAM, a PCI
> BAR region, or some DDR which both CPU have mapped into their address
> space. Design a protocol around that. This might mean you need to
> modify your firmware. It might mean you need to throw away your
> firmware and start again. But for mainline, we want something generic
> which any vendor can use with a wide range of hardware, with as few
> assumptions as possible.
Just adding to my own email. You might want to split the overall
problem into two. It could be, you have 95% of the code in a generic
driver framework. You instantiate it by calling something like:
void *cookie rpmsg_ethernet_shared_mem_create(struct rpmsg_endpoint *ept,
void __iomem *shared_memory,
size_t size);
The cookie is then used with
int rpmsg_ethernet_cb(cookie, void *data, int len);
which gets called from the rpmsg .callback function.
You then have a vendor specific part which is responsible for creating
the rpmsg endpoint, finding the shared memory, and mapping it into the
address space ready for use.
All data structures inside the shared memory need to be position
independent, since there is no guaranteed the CPUs have it mapped to
the same address, or even have the same size addresses. The easy way
to do that is specify everything as offsets to the base of the memory,
making it easy to validate the offset is actually within the shared
memory.
As i said, i've not used rpmsg, so this might in practice need to be
different. But the basic idea should be O.K, a vendor specific chunk
of code to do the basic setup, and then hand over the memory and RPMSG
endpoint to generic code which does all the real work.
Andrew
Powered by blists - more mailing lists