* Re: [SECURITY] MPC8xx serial RX buffer overlaps SPI descriptors in DPRAM
[not found] <179024275173.70674.16356876476594066413@proton.me>
@ 2026-09-25 4:30 ` Heiko Schocher
2026-11-27 15:08 ` [PATCH] serial: mpc8xx: prevent DPRAM overlap with SPI descriptors Jaeyeong Lee
1 sibling, 0 replies; 11+ messages in thread
From: Heiko Schocher @ 2026-09-25 4:30 UTC (permalink / raw)
To: Jaeyeong Lee, u-boot; +Cc: trini, christophe.leroy
Hello Jaeyeong Lee,
please use the new list:
u-boot@lists.u-boot-project.org
added the correct list to cc and dropped the old denx one,
Thanks!
bye,
Heiko
On 24.09.26 11:39, Jaeyeong Lee wrote:
> Hello U-Boot maintainers,
>
> I found an overlap between the MPC8xx serial receive buffer and the SPI buffer descriptors in DPRAM.
>
> Tested version
> ==============
>
> U-Boot v2026.10-rc5
> Commit: a06e89ab05eaa2b8344d521319399333cd760ae5
>
> Relevant configuration
> ======================
>
> CONFIG_MPC8xx=y
> CONFIG_MPC8XX_CONS=y
> CONFIG_SYS_SMC_RXBUFLEN=64
> CONFIG_SPI=y
> CONFIG_DM_SPI=y
> CONFIG_MPC8XX_SPI=y
>
> Summary
> =======
>
> The MPC8xx serial driver places struct serialbuffer at the fixed DPRAM address
> 0x800. The size of its rxbuf member is controlled by
> CONFIG_SYS_SMC_RXBUFLEN, which has no Kconfig range limiting it against other
> fixed DPRAM allocations.
>
> The MPC8xx SPI driver places its receive and transmit buffer descriptors at
> the fixed addresses 0x840 and 0x848.
>
> With CONFIG_SYS_SMC_RXBUFLEN=64, the serial receive buffer occupies addresses
> 0x814 through 0x853. This overlaps the complete 16-byte SPI descriptor region
> at 0x840 through 0x84f. Receiving 64 bytes through the SMC serial interface can
> therefore cause CPM DMA to overwrite both SPI descriptors.
>
> Technical details
> =================
>
> drivers/serial/serial_mpc8xx.c defines the serial DPRAM object as follows:
>
> struct serialbuffer {
> cbd_t rxbd;
> cbd_t txbd;
> uint rxindex;
> uchar rxbuf[CONFIG_SYS_SMC_RXBUFLEN];
> uchar txbuf;
> };
>
> The object starts at a fixed DPRAM address:
>
> #define CPM_SERIAL_BASE 0x0800
>
> rtx = (struct serialbuffer __iomem *)
> &cp->cp_dpmem[CPM_SERIAL_BASE];
>
> cbd_t is 8 bytes, so rxbuf begins at offset 20 in struct serialbuffer. The
> serial driver configures this address as the receive DMA buffer and uses the
> Kconfig value as the maximum receive length:
>
> out_be32(&rtx->rxbd.cbd_bufaddr, (__force uint)&rtx->rxbuf);
> out_be16(&up->smc_mrblr, CONFIG_SYS_SMC_RXBUFLEN);
>
> The SPI driver uses the following fixed addresses in the same DPRAM:
>
> #define CPM_SPI_BASE 0x0840
> #define CPM_SPI_BASE_RX CPM_SPI_BASE
> #define CPM_SPI_BASE_TX (CPM_SPI_BASE + sizeof(cbd_t))
>
> rbdf = (cbd_t __iomem *)&cp->cp_dpmem[CPM_SPI_BASE_RX];
> tbdf = (cbd_t __iomem *)&cp->cp_dpmem[CPM_SPI_BASE_TX];
>
> With CONFIG_SYS_SMC_RXBUFLEN=64, the resulting ranges are:
>
> serialbuffer base = 0x800
> serial rxbuf offset = 0x14
> serial rxbuf start = 0x814
> serial rxbuf end = 0x853
>
> SPI RX descriptor = 0x840 .. 0x847
> SPI TX descriptor = 0x848 .. 0x84f
>
> overlapping range = 0x840 .. 0x84f
> overlap size = 16 bytes
>
> The serial receive buffer reaches the SPI region whenever
> CONFIG_SYS_SMC_RXBUFLEN is greater than 44. The Kconfig option currently has
> no range constraint for this boundary.
>
> Reproduction
> ============
>
> 1. Configure U-Boot from CMPC885_defconfig.
> 2. Set the following options:
>
> CONFIG_SYS_SMC_RXBUFLEN=64
> CONFIG_MPC8XX_SPI=y
>
> 3. Initialize the serial and SPI drivers.
> 4. Write identifiable initial values to the SPI RX and TX descriptors.
> 5. Receive 64 bytes through the SMC serial RX path.
> 6. Inspect DPRAM addresses 0x840 through 0x84f.
>
> A reproduction using U-Boot's structure definitions and fixed DPRAM addresses
> confirmed that all 16 bytes of the two SPI descriptors change after the serial
> RX write:
>
> serial_rx=[0x814,0x853]
> spi_rx_descriptor=[0x840,0x847]
> spi_tx_descriptor=[0x848,0x84f]
> overlap=16
>
> SPI descriptors overwritten by configured serial RX buffer
>
> Impact
> ======
>
> Input received through the serial console can overwrite the following fields
> in both SPI descriptors:
>
> cbd_sc
> cbd_datlen
> cbd_bufaddr
>
> This can cause SPI transaction failures, timeouts, a U-Boot crash, or invalid
> memory accesses during subsequent SPI processing. Corruption of cbd_bufaddr
> may also affect the memory address used by SPI DMA.
>
> The confirmed result is the 16-byte DPRAM overlap and descriptor overwrite.
> I have not yet reproduced an end-to-end crash or arbitrary memory corruption
> on physical MPC8xx hardware.
>
> Regards,
> Jaeyeong Lee
>
--
Nabla Software Engineering
HRB 40522 Augsburg
Phone: +49 821 45592596
E-Mail: office@nabladev.com
Geschäftsführer : Stefano Babic
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] serial: mpc8xx: prevent DPRAM overlap with SPI descriptors
[not found] <179024275173.70674.16356876476594066413@proton.me>
2026-09-25 4:30 ` [SECURITY] MPC8xx serial RX buffer overlaps SPI descriptors in DPRAM Heiko Schocher
@ 2026-11-27 15:08 ` Jaeyeong Lee
2026-11-27 16:42 ` Christophe Leroy (CS GROUP)
1 sibling, 1 reply; 11+ messages in thread
From: Jaeyeong Lee @ 2026-11-27 15:08 UTC (permalink / raw)
To: Christophe Leroy, Bradley Morgan; +Cc: u-boot, Heiko Schocher, Tom Rini
The MPC8xx serial object starts at DPRAM offset 0x800 while the SPI
receive descriptor starts at 0x840. The serial receive buffer begins at
offset 0x14 and is followed by the one-byte transmit buffer.
Limit SYS_SMC_RXBUFLEN to 43 when MPC8XX_SPI is enabled. A value of 44
would put the transmit byte at 0x840, and larger values also overlap the
SPI descriptor with the receive buffer. Add a static assertion to keep
future layout changes from reintroducing the overlap.
Link: https://lore.kernel.org/u-boot/179024275173.70674.16356876476594066413@proton.me/
Signed-off-by: Jaeyeong Lee <lee@jaeyeong.cc>
---
drivers/serial/Kconfig | 4 ++++
drivers/serial/serial_mpc8xx.c | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 9ebc251d891..73c36ea79b0 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -1201,6 +1201,7 @@ config SYS_SMC_RXBUFLEN
int "Console Rx buffer length"
depends on MPC8XX_CONS
default 1
+ range 1 43 if MPC8XX_SPI
help
With CONFIG_SYS_SMC_RXBUFLEN it is possible to define
the maximum receive buffer length for the SMC.
@@ -1208,6 +1209,9 @@ config SYS_SMC_RXBUFLEN
If using CONFIG_SYS_SMC_RXBUFLEN also CONFIG_SYS_MAXIDLE
must be defined, to setup the maximum idle timeout for
the SMC.
+ When the MPC8XX SPI driver is enabled, the receive buffer is
+ limited so that it and the transmit byte do not overlap the
+ SPI buffer descriptors in dual-port RAM.
config SYS_MAXIDLE
int "maximum idle timeout"
diff --git a/drivers/serial/serial_mpc8xx.c b/drivers/serial/serial_mpc8xx.c
index 9ce3fc3d9ec..feb0c905594 100644
--- a/drivers/serial/serial_mpc8xx.c
+++ b/drivers/serial/serial_mpc8xx.c
@@ -36,6 +36,10 @@ struct serialbuffer {
uchar txbuf; /* tx buffers */
};
+static_assert(!IS_ENABLED(CONFIG_MPC8XX_SPI) ||
+ sizeof(struct serialbuffer) <= CPM_SPI_BASE - CPM_SERIAL_BASE,
+ "MPC8xx serial buffers overlap the SPI descriptors");
+
static void serial_setdivisor(cpm8xx_t __iomem *cp, int baudrate)
{
int divisor = (gd->cpu_clk + 8 * baudrate) / 16 / baudrate;
--
2.43.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] serial: mpc8xx: prevent DPRAM overlap with SPI descriptors
2026-11-27 15:08 ` [PATCH] serial: mpc8xx: prevent DPRAM overlap with SPI descriptors Jaeyeong Lee
@ 2026-11-27 16:42 ` Christophe Leroy (CS GROUP)
2026-11-27 17:09 ` Bradley Morgan
2026-11-27 23:22 ` [PATCH v2] serial: mpc8xx: cap SMC receive buffer length Jaeyeong Lee
0 siblings, 2 replies; 11+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2026-11-27 16:42 UTC (permalink / raw)
To: Jaeyeong Lee, Bradley Morgan; +Cc: u-boot, Heiko Schocher, Tom Rini
Hi Jaeyeong,
Le 27/11/2026 à 16:08, Jaeyeong Lee a écrit :
> [Vous ne recevez pas souvent de courriers de lee@jaeyeong.cc. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
>
> The MPC8xx serial object starts at DPRAM offset 0x800 while the SPI
> receive descriptor starts at 0x840. The serial receive buffer begins at
> offset 0x14 and is followed by the one-byte transmit buffer.
>
> Limit SYS_SMC_RXBUFLEN to 43 when MPC8XX_SPI is enabled. A value of 44
> would put the transmit byte at 0x840, and larger values also overlap the
> SPI descriptor with the receive buffer. Add a static assertion to keep
> future layout changes from reintroducing the overlap.
Not sure we need something so sophisticated. No defconfig redefines it
so everyone uses it likely with the default value of 1.
Just limit it to 32 regardless of whether SPI is active or not, that
should be enough. I don't like the idea of a dependency between the two
drivers.
We don't need that assert, it should be enough to put a comment close to
the definition of CPM_SPI_BASE.
Christophe
>
> Link: https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Fu-boot%2F179024275173.70674.16356876476594066413%40proton.me%2F&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7Cdff89d20fc924d5d92df08df4c98563f%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639313889303482082%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=%2BX3U4TMa8vSsaduwcMtKmvbp9U8ghNs1OgNAws11K1k%3D&reserved=0
> Signed-off-by: Jaeyeong Lee <lee@jaeyeong.cc>
> ---
> drivers/serial/Kconfig | 4 ++++
> drivers/serial/serial_mpc8xx.c | 4 ++++
> 2 files changed, 8 insertions(+)
>
> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
> index 9ebc251d891..73c36ea79b0 100644
> --- a/drivers/serial/Kconfig
> +++ b/drivers/serial/Kconfig
> @@ -1201,6 +1201,7 @@ config SYS_SMC_RXBUFLEN
> int "Console Rx buffer length"
> depends on MPC8XX_CONS
> default 1
> + range 1 43 if MPC8XX_SPI
> help
> With CONFIG_SYS_SMC_RXBUFLEN it is possible to define
> the maximum receive buffer length for the SMC.
> @@ -1208,6 +1209,9 @@ config SYS_SMC_RXBUFLEN
> If using CONFIG_SYS_SMC_RXBUFLEN also CONFIG_SYS_MAXIDLE
> must be defined, to setup the maximum idle timeout for
> the SMC.
> + When the MPC8XX SPI driver is enabled, the receive buffer is
> + limited so that it and the transmit byte do not overlap the
> + SPI buffer descriptors in dual-port RAM.
>
> config SYS_MAXIDLE
> int "maximum idle timeout"
> diff --git a/drivers/serial/serial_mpc8xx.c b/drivers/serial/serial_mpc8xx.c
> index 9ce3fc3d9ec..feb0c905594 100644
> --- a/drivers/serial/serial_mpc8xx.c
> +++ b/drivers/serial/serial_mpc8xx.c
> @@ -36,6 +36,10 @@ struct serialbuffer {
> uchar txbuf; /* tx buffers */
> };
>
> +static_assert(!IS_ENABLED(CONFIG_MPC8XX_SPI) ||
> + sizeof(struct serialbuffer) <= CPM_SPI_BASE - CPM_SERIAL_BASE,
> + "MPC8xx serial buffers overlap the SPI descriptors");
> +
> static void serial_setdivisor(cpm8xx_t __iomem *cp, int baudrate)
> {
> int divisor = (gd->cpu_clk + 8 * baudrate) / 16 / baudrate;
> --
> 2.43.0
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] serial: mpc8xx: prevent DPRAM overlap with SPI descriptors
2026-11-27 16:42 ` Christophe Leroy (CS GROUP)
@ 2026-11-27 17:09 ` Bradley Morgan
2026-11-28 8:00 ` Christophe Leroy (CS GROUP)
2026-11-27 23:22 ` [PATCH v2] serial: mpc8xx: cap SMC receive buffer length Jaeyeong Lee
1 sibling, 1 reply; 11+ messages in thread
From: Bradley Morgan @ 2026-11-27 17:09 UTC (permalink / raw)
To: Christophe Leroy (CS GROUP), Jaeyeong Lee
Cc: u-boot, Heiko Schocher, Tom Rini
On 27 November 2026 16:42:16 GMT, "Christophe Leroy (CS GROUP)"
<chleroy@kernel.org> wrote:
>Hi Jaeyeong,
>
>Le 27/11/2026 à 16:08, Jaeyeong Lee a écrit :
>> [Vous ne recevez pas souvent de courriers de lee@jaeyeong.cc. Découvrez
>pourquoi ceci est important à
>https://aka.ms/LearnAboutSenderIdentification ]
>>
>> The MPC8xx serial object starts at DPRAM offset 0x800 while the SPI
>> receive descriptor starts at 0x840. The serial receive buffer begins at
>> offset 0x14 and is followed by the one-byte transmit buffer.
>>
>> Limit SYS_SMC_RXBUFLEN to 43 when MPC8XX_SPI is enabled. A value of 44
>> would put the transmit byte at 0x840, and larger values also overlap the
>> SPI descriptor with the receive buffer. Add a static assertion to keep
>> future layout changes from reintroducing the overlap.
>
>Not sure we need something so sophisticated. No defconfig redefines it so
>everyone uses it likely with the default value of 1.
>
>Just limit it to 32 regardless of whether SPI is active or not, that
>should be enough. I don't like the idea of a dependency between the two
>drivers.
>
>We don't need that assert, it should be enough to put a comment close to
>the definition of CPM_SPI_BASE.
Not wrong. Thanks for the review
>
>Christophe
>
>>
>> Link:
>https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Fu-boot%2F179024275173.70674.16356876476594066413%40proton.me%2F&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7Cdff89d20fc924d5d92df08df4c98563f%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639313889303482082%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=%2BX3U4TMa8vSsaduwcMtKmvbp9U8ghNs1OgNAws11K1k%3D&reserved=0
Uhh, your mail client is not doing good things Christophe :(.
>> Signed-off-by: Jaeyeong Lee <lee@jaeyeong.cc>
>> ---
>> drivers/serial/Kconfig | 4 ++++
>> drivers/serial/serial_mpc8xx.c | 4 ++++
>> 2 files changed, 8 insertions(+)
>>
>> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
>> index 9ebc251d891..73c36ea79b0 100644
>> --- a/drivers/serial/Kconfig
>> +++ b/drivers/serial/Kconfig
>> @@ -1201,6 +1201,7 @@ config SYS_SMC_RXBUFLEN
>> int "Console Rx buffer length"
>> depends on MPC8XX_CONS
>> default 1
>> + range 1 43 if MPC8XX_SPI
>> help
>> With CONFIG_SYS_SMC_RXBUFLEN it is possible to define
>> the maximum receive buffer length for the SMC.
>> @@ -1208,6 +1209,9 @@ config SYS_SMC_RXBUFLEN
>> If using CONFIG_SYS_SMC_RXBUFLEN also CONFIG_SYS_MAXIDLE
>> must be defined, to setup the maximum idle timeout for
>> the SMC.
>> + When the MPC8XX SPI driver is enabled, the receive buffer is
>> + limited so that it and the transmit byte do not overlap the
>> + SPI buffer descriptors in dual-port RAM.
>>
>> config SYS_MAXIDLE
>> int "maximum idle timeout"
>> diff --git a/drivers/serial/serial_mpc8xx.c
>b/drivers/serial/serial_mpc8xx.c
>> index 9ce3fc3d9ec..feb0c905594 100644
>> --- a/drivers/serial/serial_mpc8xx.c
>> +++ b/drivers/serial/serial_mpc8xx.c
>> @@ -36,6 +36,10 @@ struct serialbuffer {
>> uchar txbuf; /* tx buffers */
>> };
>>
>> +static_assert(!IS_ENABLED(CONFIG_MPC8XX_SPI) ||
>> + sizeof(struct serialbuffer) <= CPM_SPI_BASE -
>CPM_SERIAL_BASE,
>> + "MPC8xx serial buffers overlap the SPI descriptors");
>> +
>> static void serial_setdivisor(cpm8xx_t __iomem *cp, int baudrate)
>> {
>> int divisor = (gd->cpu_clk + 8 * baudrate) / 16 / baudrate;
>> --
>> 2.43.0
>>
>>
>
>
--- Thanks!
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2] serial: mpc8xx: cap SMC receive buffer length
2026-11-27 16:42 ` Christophe Leroy (CS GROUP)
2026-11-27 17:09 ` Bradley Morgan
@ 2026-11-27 23:22 ` Jaeyeong Lee
2026-11-28 7:58 ` Christophe Leroy (CS GROUP)
` (2 more replies)
1 sibling, 3 replies; 11+ messages in thread
From: Jaeyeong Lee @ 2026-11-27 23:22 UTC (permalink / raw)
To: Christophe Leroy, Bradley Morgan; +Cc: u-boot, Heiko Schocher, Tom Rini
The MPC8xx serial object starts at DPRAM offset 0x800 while the SPI
receive descriptor starts at 0x840. The serial receive buffer begins
after two buffer descriptors and an index, and is followed by the
transmit byte.
Cap SYS_SMC_RXBUFLEN at 32 for all configurations. This keeps the
complete serial object below the SPI descriptor area without coupling
the serial configuration to the SPI driver. Document the constraint
next to the DPRAM layout.
Link: https://lore.kernel.org/u-boot/179024275173.70674.16356876476594066413@proton.me/
Signed-off-by: Jaeyeong Lee <lee@jaeyeong.cc>
---
Changes in v2:
- Cap SYS_SMC_RXBUFLEN at 32 regardless of whether SPI is enabled.
- Drop the static assertion and document the limit near CPM_SPI_BASE.
arch/powerpc/include/asm/cpm_8xx.h | 1 +
drivers/serial/Kconfig | 1 +
2 files changed, 2 insertions(+)
diff --git a/arch/powerpc/include/asm/cpm_8xx.h b/arch/powerpc/include/asm/cpm_8xx.h
index 98476cdf304..1bb44c9ab34 100644
--- a/arch/powerpc/include/asm/cpm_8xx.h
+++ b/arch/powerpc/include/asm/cpm_8xx.h
@@ -53,6 +53,7 @@
*/
#define CPM_SERIAL_BASE 0x0800
#define CPM_I2C_BASE 0x0820
+/* SYS_SMC_RXBUFLEN is limited so the serial buffer stays below this. */
#define CPM_SPI_BASE 0x0840
#define CPM_FEC_BASE 0x0860
#define CPM_SERIAL2_BASE 0x08E0
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 9ebc251d891..d4cf6f87c9e 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -1201,6 +1201,7 @@ config SYS_SMC_RXBUFLEN
int "Console Rx buffer length"
depends on MPC8XX_CONS
default 1
+ range 1 32
help
With CONFIG_SYS_SMC_RXBUFLEN it is possible to define
the maximum receive buffer length for the SMC.
--
2.43.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2] serial: mpc8xx: cap SMC receive buffer length
2026-11-27 23:22 ` [PATCH v2] serial: mpc8xx: cap SMC receive buffer length Jaeyeong Lee
@ 2026-11-28 7:58 ` Christophe Leroy (CS GROUP)
2026-11-30 5:19 ` Heiko Schocher
2026-11-30 19:32 ` Bradley Morgan
2 siblings, 0 replies; 11+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2026-11-28 7:58 UTC (permalink / raw)
To: Jaeyeong Lee, Bradley Morgan; +Cc: u-boot, Heiko Schocher, Tom Rini
Le 28/11/2026 à 00:22, Jaeyeong Lee a écrit :
> [Vous ne recevez pas souvent de courriers de lee@jaeyeong.cc. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
>
> The MPC8xx serial object starts at DPRAM offset 0x800 while the SPI
> receive descriptor starts at 0x840. The serial receive buffer begins
> after two buffer descriptors and an index, and is followed by the
> transmit byte.
>
> Cap SYS_SMC_RXBUFLEN at 32 for all configurations. This keeps the
> complete serial object below the SPI descriptor area without coupling
> the serial configuration to the SPI driver. Document the constraint
> next to the DPRAM layout.
>
> Link: https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Fu-boot%2F179024275173.70674.16356876476594066413%40proton.me%2F&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C2d5b319bd5914182870c08df4cdd659c%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639314185942705112%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=omHx0MG55AZhTdYuPm02i%2FExRbhgXMDawNlMkBZP5u8%3D&reserved=0
> Signed-off-by: Jaeyeong Lee <lee@jaeyeong.cc>
Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
> ---
> Changes in v2:
> - Cap SYS_SMC_RXBUFLEN at 32 regardless of whether SPI is enabled.
> - Drop the static assertion and document the limit near CPM_SPI_BASE.
>
> arch/powerpc/include/asm/cpm_8xx.h | 1 +
> drivers/serial/Kconfig | 1 +
> 2 files changed, 2 insertions(+)
>
> diff --git a/arch/powerpc/include/asm/cpm_8xx.h b/arch/powerpc/include/asm/cpm_8xx.h
> index 98476cdf304..1bb44c9ab34 100644
> --- a/arch/powerpc/include/asm/cpm_8xx.h
> +++ b/arch/powerpc/include/asm/cpm_8xx.h
> @@ -53,6 +53,7 @@
> */
> #define CPM_SERIAL_BASE 0x0800
> #define CPM_I2C_BASE 0x0820
We might have the same problem with CPM_I2C_BASE. But CPM_I2C_BASE is
nowhere used, last user was removed by commit 7ffce4f17fdb ("i2c:
powerpc: Remove use of CONFIG_HARD_I2C").
So I suggest you to send another patch to remove CPM_I2C_BASE and also
BD_IIC_START which hasn't been used since commit d6b11fd1f0ef ("powerpc:
remove MBX and MBX860T boards support")
> +/* SYS_SMC_RXBUFLEN is limited so the serial buffer stays below this. */
> #define CPM_SPI_BASE 0x0840
> #define CPM_FEC_BASE 0x0860
> #define CPM_SERIAL2_BASE 0x08E0
> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
> index 9ebc251d891..d4cf6f87c9e 100644
> --- a/drivers/serial/Kconfig
> +++ b/drivers/serial/Kconfig
> @@ -1201,6 +1201,7 @@ config SYS_SMC_RXBUFLEN
> int "Console Rx buffer length"
> depends on MPC8XX_CONS
> default 1
> + range 1 32
> help
> With CONFIG_SYS_SMC_RXBUFLEN it is possible to define
> the maximum receive buffer length for the SMC.
> --
> 2.43.0
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] serial: mpc8xx: prevent DPRAM overlap with SPI descriptors
2026-11-27 17:09 ` Bradley Morgan
@ 2026-11-28 8:00 ` Christophe Leroy (CS GROUP)
0 siblings, 0 replies; 11+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2026-11-28 8:00 UTC (permalink / raw)
To: Bradley Morgan, Jaeyeong Lee; +Cc: u-boot, Heiko Schocher, Tom Rini
Le 27/11/2026 à 18:09, Bradley Morgan a écrit :
>>>
>>> Link:
>> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Fu-boot%2F179024275173.70674.16356876476594066413%40proton.me%2F&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C300baad17d124fa815b808df4ca95947%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639313962410005122%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=qZvYyy84460lltAnoAvqOYpclpCa9IKMWkbaL59SfMU%3D&reserved=0
>
> Uhh, your mail client is not doing good things Christophe :(.
>
Yeah, not my client (That's thunderdird), but the email service from
Microsoft M365 which is used by my company.
Christophe
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] serial: mpc8xx: cap SMC receive buffer length
2026-11-27 23:22 ` [PATCH v2] serial: mpc8xx: cap SMC receive buffer length Jaeyeong Lee
2026-11-28 7:58 ` Christophe Leroy (CS GROUP)
@ 2026-11-30 5:19 ` Heiko Schocher
2026-11-30 16:15 ` Bradley Morgan
2026-11-30 19:32 ` Bradley Morgan
2 siblings, 1 reply; 11+ messages in thread
From: Heiko Schocher @ 2026-11-30 5:19 UTC (permalink / raw)
To: Jaeyeong Lee, Christophe Leroy, Bradley Morgan; +Cc: u-boot, Tom Rini
Hello Jaeyeong,
On 28.11.26 00:22, Jaeyeong Lee wrote:
> The MPC8xx serial object starts at DPRAM offset 0x800 while the SPI
> receive descriptor starts at 0x840. The serial receive buffer begins
> after two buffer descriptors and an index, and is followed by the
> transmit byte.
>
> Cap SYS_SMC_RXBUFLEN at 32 for all configurations. This keeps the
> complete serial object below the SPI descriptor area without coupling
> the serial configuration to the SPI driver. Document the constraint
> next to the DPRAM layout.
>
> Link: https://lore.kernel.org/u-boot/179024275173.70674.16356876476594066413@proton.me/
> Signed-off-by: Jaeyeong Lee <lee@jaeyeong.cc>
> ---
> Changes in v2:
> - Cap SYS_SMC_RXBUFLEN at 32 regardless of whether SPI is enabled.
> - Drop the static assertion and document the limit near CPM_SPI_BASE.
>
> arch/powerpc/include/asm/cpm_8xx.h | 1 +
> drivers/serial/Kconfig | 1 +
> 2 files changed, 2 insertions(+)
Thanks!
Reviewed-by: Heiko Schocher <hs@nabladev.com>
bye,
Heiko
--
Nabla Software Engineering
HRB 40522 Augsburg
Phone: +49 821 45592596
E-Mail: office@nabladev.com
Geschäftsführer : Stefano Babic
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] serial: mpc8xx: cap SMC receive buffer length
2026-11-30 5:19 ` Heiko Schocher
@ 2026-11-30 16:15 ` Bradley Morgan
2026-12-01 4:16 ` Heiko Schocher
0 siblings, 1 reply; 11+ messages in thread
From: Bradley Morgan @ 2026-11-30 16:15 UTC (permalink / raw)
To: Heiko Schocher, Jaeyeong Lee, Christophe Leroy; +Cc: u-boot, Tom Rini
On 30 November 2026 05:19:46 GMT, Heiko Schocher <hs@nabladev.com> wrote:
>Hello Jaeyeong,
>
>On 28.11.26 00:22, Jaeyeong Lee wrote:
>> The MPC8xx serial object starts at DPRAM offset 0x800 while the SPI
>> receive descriptor starts at 0x840. The serial receive buffer begins
>> after two buffer descriptors and an index, and is followed by the
>> transmit byte.
>>
>> Cap SYS_SMC_RXBUFLEN at 32 for all configurations. This keeps the
>> complete serial object below the SPI descriptor area without coupling
>> the serial configuration to the SPI driver. Document the constraint
>> next to the DPRAM layout.
>>
>> Link:
>https://lore.kernel.org/u-boot/179024275173.70674.16356876476594066413@proton.me/
>> Signed-off-by: Jaeyeong Lee <lee@jaeyeong.cc>
>> ---
>> Changes in v2:
>> - Cap SYS_SMC_RXBUFLEN at 32 regardless of whether SPI is enabled.
>> - Drop the static assertion and document the limit near CPM_SPI_BASE.
>>
>> arch/powerpc/include/asm/cpm_8xx.h | 1 +
>> drivers/serial/Kconfig | 1 +
>> 2 files changed, 2 insertions(+)
>
>Thanks!
>
>Reviewed-by: Heiko Schocher <hs@nabladev.com>
thanks for reviewing you lot, mind reviewing Jaeyeongs second patch? I
suggested
it being a series so it'll be easier for me to apply
>
>bye,
>Heiko
>
>
--- Thanks!
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] serial: mpc8xx: cap SMC receive buffer length
2026-11-27 23:22 ` [PATCH v2] serial: mpc8xx: cap SMC receive buffer length Jaeyeong Lee
2026-11-28 7:58 ` Christophe Leroy (CS GROUP)
2026-11-30 5:19 ` Heiko Schocher
@ 2026-11-30 19:32 ` Bradley Morgan
2 siblings, 0 replies; 11+ messages in thread
From: Bradley Morgan @ 2026-11-30 19:32 UTC (permalink / raw)
To: Christophe Leroy, Jaeyeong Lee
Cc: Bradley Morgan, u-boot, Heiko Schocher, Tom Rini
Applied to next at u-boot-ppc, Thanks!
[1/1] serial: mpc8xx: cap SMC receive buffer length
https://git.u-boot-project.org/u-boot/custodians/u-boot-ppc/-/commit/a670a4962ff49f1ad5678cc2f3c44f9ea7dd3628
---
Thanks!
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] serial: mpc8xx: cap SMC receive buffer length
2026-11-30 16:15 ` Bradley Morgan
@ 2026-12-01 4:16 ` Heiko Schocher
0 siblings, 0 replies; 11+ messages in thread
From: Heiko Schocher @ 2026-12-01 4:16 UTC (permalink / raw)
To: Bradley Morgan, Jaeyeong Lee, Christophe Leroy; +Cc: u-boot, Tom Rini
Hello Bradley,
On 30.11.26 17:15, Bradley Morgan wrote:
> On 30 November 2026 05:19:46 GMT, Heiko Schocher <hs@nabladev.com> wrote:
>> Hello Jaeyeong,
>>
>> On 28.11.26 00:22, Jaeyeong Lee wrote:
>>> The MPC8xx serial object starts at DPRAM offset 0x800 while the SPI
>>> receive descriptor starts at 0x840. The serial receive buffer begins
>>> after two buffer descriptors and an index, and is followed by the
>>> transmit byte.
>>>
>>> Cap SYS_SMC_RXBUFLEN at 32 for all configurations. This keeps the
>>> complete serial object below the SPI descriptor area without coupling
>>> the serial configuration to the SPI driver. Document the constraint
>>> next to the DPRAM layout.
>>>
>>> Link:
>> https://lore.kernel.org/u-boot/179024275173.70674.16356876476594066413@proton.me/
>>> Signed-off-by: Jaeyeong Lee <lee@jaeyeong.cc>
>>> ---
>>> Changes in v2:
>>> - Cap SYS_SMC_RXBUFLEN at 32 regardless of whether SPI is enabled.
>>> - Drop the static assertion and document the limit near CPM_SPI_BASE.
>>>
>>> arch/powerpc/include/asm/cpm_8xx.h | 1 +
>>> drivers/serial/Kconfig | 1 +
>>> 2 files changed, 2 insertions(+)
>>
>> Thanks!
>>
>> Reviewed-by: Heiko Schocher <hs@nabladev.com>
>
> thanks for reviewing you lot, mind reviewing Jaeyeongs second patch? I
> suggested
> it being a series so it'll be easier for me to apply
you mean:
"[PATCH] powerpc: mpc8xx: remove unused I2C DPRAM definitions"
looks fine, just added my Reviewed-by
bye,
Heiko
--
Nabla Software Engineering
HRB 40522 Augsburg
Phone: +49 821 45592596
E-Mail: office@nabladev.com
Geschäftsführer : Stefano Babic
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2026-12-01 4:16 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <179024275173.70674.16356876476594066413@proton.me>
2026-09-25 4:30 ` [SECURITY] MPC8xx serial RX buffer overlaps SPI descriptors in DPRAM Heiko Schocher
2026-11-27 15:08 ` [PATCH] serial: mpc8xx: prevent DPRAM overlap with SPI descriptors Jaeyeong Lee
2026-11-27 16:42 ` Christophe Leroy (CS GROUP)
2026-11-27 17:09 ` Bradley Morgan
2026-11-28 8:00 ` Christophe Leroy (CS GROUP)
2026-11-27 23:22 ` [PATCH v2] serial: mpc8xx: cap SMC receive buffer length Jaeyeong Lee
2026-11-28 7:58 ` Christophe Leroy (CS GROUP)
2026-11-30 5:19 ` Heiko Schocher
2026-11-30 16:15 ` Bradley Morgan
2026-12-01 4:16 ` Heiko Schocher
2026-11-30 19:32 ` Bradley Morgan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.