[PATCH 4/9] mci: add RPMB support

Sascha Hauer s.hauer at pengutronix.de
Tue Mar 18 04:33:05 PDT 2025


On Mon, Mar 17, 2025 at 04:18:32PM +0100, Ahmad Fatoum wrote:
> Hello Sascha,
> 
> On 3/12/25 13:16, Sascha Hauer wrote:
> > +
> > +int mci_rpmb_route_frames(struct mci *mci, void *req, unsigned long reqlen,
> > +			  void *rsp, unsigned long rsplen)
> > +{
> > +	/*
> > +	 * Whoever crafted the data supplied to this function knows how to
> > +	 * format the PRMB frames and which response is expected. If
> > +	 * there's some unexpected mismatch it's more helpful to report an
> > +	 * error immediately than trying to guess what was the intention
> > +	 * and possibly just delay an eventual error which will be harder
> > +	 * to track down.
> > +	 */
> > +	void *rpmb_data = NULL;
> > +	int ret;
> > +
> > +	mci_blk_part_switch(mci->rpmb_part);
> > +
> > +	if (!IS_ALIGNED((uintptr_t)req, ARCH_DMA_MINALIGN)) {
> 
> Even if alignment happens to be correct, there is no guarantee that
> there is no other data sharing a cache line.

reqlen is expected to be a single block of 512 bytes, so indeed when req
is aligned then the end is cacheline aligned as well. We could check
reqlen as well, but I actually never ran into this case, so we can just
return an error for now as you suggested.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list