* [PATCH] hw/ssi/pnv_spi: Fix fifo8 memory leak on unrealize
@ 2025-12-16 15:45 Caleb Schlossin
2025-12-16 16:26 ` Miles Glenn
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Caleb Schlossin @ 2025-12-16 15:45 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, npiggin, adityag, milesg, alistair, chalapathi.v,
calebs
unrealize should free the fifo8 memory that was allocated by realize.
Fixes: 17befecda85 ("hw/ssi/pnv_spi: Replace PnvXferBuffer with Fifo8 structure")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Caleb Schlossin <calebs@linux.ibm.com>
---
hw/ssi/pnv_spi.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/hw/ssi/pnv_spi.c b/hw/ssi/pnv_spi.c
index f40e8836b9..5db440be9a 100644
--- a/hw/ssi/pnv_spi.c
+++ b/hw/ssi/pnv_spi.c
@@ -1176,6 +1176,13 @@ static void pnv_spi_realize(DeviceState *dev, Error **errp)
s, "xscom-spi", PNV10_XSCOM_PIB_SPIC_SIZE);
}
+static void pnv_spi_unrealize(DeviceState *dev)
+{
+ PnvSpi *s = PNV_SPI(dev);
+ fifo8_destroy(&s->tx_fifo);
+ fifo8_destroy(&s->rx_fifo);
+}
+
static int pnv_spi_dt_xscom(PnvXScomInterface *dev, void *fdt,
int offset)
{
@@ -1208,6 +1215,7 @@ static void pnv_spi_class_init(ObjectClass *klass, const void *data)
dc->desc = "PowerNV SPI";
dc->realize = pnv_spi_realize;
+ dc->unrealize = pnv_spi_unrealize;
device_class_set_legacy_reset(dc, do_reset);
device_class_set_props(dc, pnv_spi_properties);
}
--
2.47.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] hw/ssi/pnv_spi: Fix fifo8 memory leak on unrealize
2025-12-16 15:45 [PATCH] hw/ssi/pnv_spi: Fix fifo8 memory leak on unrealize Caleb Schlossin
@ 2025-12-16 16:26 ` Miles Glenn
2025-12-22 10:43 ` Chalapathi V
2026-01-19 6:57 ` Aditya Gupta
2 siblings, 0 replies; 5+ messages in thread
From: Miles Glenn @ 2025-12-16 16:26 UTC (permalink / raw)
To: Caleb Schlossin, qemu-devel
Cc: qemu-ppc, npiggin, adityag, alistair, chalapathi.v
Reviewed-by: Glenn Miles <milesg@linux.ibm.com>
Thanks,
Glenn
On Tue, 2025-12-16 at 09:45 -0600, Caleb Schlossin wrote:
> unrealize should free the fifo8 memory that was allocated by realize.
>
> Fixes: 17befecda85 ("hw/ssi/pnv_spi: Replace PnvXferBuffer with Fifo8 structure")
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> Signed-off-by: Caleb Schlossin <calebs@linux.ibm.com>
> ---
> hw/ssi/pnv_spi.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/hw/ssi/pnv_spi.c b/hw/ssi/pnv_spi.c
> index f40e8836b9..5db440be9a 100644
> --- a/hw/ssi/pnv_spi.c
> +++ b/hw/ssi/pnv_spi.c
> @@ -1176,6 +1176,13 @@ static void pnv_spi_realize(DeviceState *dev, Error **errp)
> s, "xscom-spi", PNV10_XSCOM_PIB_SPIC_SIZE);
> }
>
> +static void pnv_spi_unrealize(DeviceState *dev)
> +{
> + PnvSpi *s = PNV_SPI(dev);
> + fifo8_destroy(&s->tx_fifo);
> + fifo8_destroy(&s->rx_fifo);
> +}
> +
> static int pnv_spi_dt_xscom(PnvXScomInterface *dev, void *fdt,
> int offset)
> {
> @@ -1208,6 +1215,7 @@ static void pnv_spi_class_init(ObjectClass *klass, const void *data)
>
> dc->desc = "PowerNV SPI";
> dc->realize = pnv_spi_realize;
> + dc->unrealize = pnv_spi_unrealize;
> device_class_set_legacy_reset(dc, do_reset);
> device_class_set_props(dc, pnv_spi_properties);
> }
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] hw/ssi/pnv_spi: Fix fifo8 memory leak on unrealize
2025-12-16 15:45 [PATCH] hw/ssi/pnv_spi: Fix fifo8 memory leak on unrealize Caleb Schlossin
2025-12-16 16:26 ` Miles Glenn
@ 2025-12-22 10:43 ` Chalapathi V
2026-01-19 6:57 ` Aditya Gupta
2 siblings, 0 replies; 5+ messages in thread
From: Chalapathi V @ 2025-12-22 10:43 UTC (permalink / raw)
To: Caleb Schlossin, qemu-devel
Cc: qemu-ppc, npiggin, adityag, milesg, alistair, chalapathi.v
Reviewed-by: Chalapathi V<chalapathi.v@linux.ibm.com>
On 16/12/25 9:15 pm, Caleb Schlossin wrote:
> unrealize should free the fifo8 memory that was allocated by realize.
>
> Fixes: 17befecda85 ("hw/ssi/pnv_spi: Replace PnvXferBuffer with Fifo8 structure")
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> Signed-off-by: Caleb Schlossin <calebs@linux.ibm.com>
> ---
> hw/ssi/pnv_spi.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/hw/ssi/pnv_spi.c b/hw/ssi/pnv_spi.c
> index f40e8836b9..5db440be9a 100644
> --- a/hw/ssi/pnv_spi.c
> +++ b/hw/ssi/pnv_spi.c
> @@ -1176,6 +1176,13 @@ static void pnv_spi_realize(DeviceState *dev, Error **errp)
> s, "xscom-spi", PNV10_XSCOM_PIB_SPIC_SIZE);
> }
>
> +static void pnv_spi_unrealize(DeviceState *dev)
> +{
> + PnvSpi *s = PNV_SPI(dev);
> + fifo8_destroy(&s->tx_fifo);
> + fifo8_destroy(&s->rx_fifo);
> +}
> +
> static int pnv_spi_dt_xscom(PnvXScomInterface *dev, void *fdt,
> int offset)
> {
> @@ -1208,6 +1215,7 @@ static void pnv_spi_class_init(ObjectClass *klass, const void *data)
>
> dc->desc = "PowerNV SPI";
> dc->realize = pnv_spi_realize;
> + dc->unrealize = pnv_spi_unrealize;
> device_class_set_legacy_reset(dc, do_reset);
> device_class_set_props(dc, pnv_spi_properties);
> }
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] hw/ssi/pnv_spi: Fix fifo8 memory leak on unrealize
2025-12-16 15:45 [PATCH] hw/ssi/pnv_spi: Fix fifo8 memory leak on unrealize Caleb Schlossin
2025-12-16 16:26 ` Miles Glenn
2025-12-22 10:43 ` Chalapathi V
@ 2026-01-19 6:57 ` Aditya Gupta
2026-01-20 14:38 ` Caleb Schlossin
2 siblings, 1 reply; 5+ messages in thread
From: Aditya Gupta @ 2026-01-19 6:57 UTC (permalink / raw)
To: Caleb Schlossin
Cc: qemu-devel, qemu-ppc, npiggin, milesg, alistair, chalapathi.v
On 25/12/16 09:45AM, Caleb Schlossin wrote:
> unrealize should free the fifo8 memory that was allocated by realize.
>
> Fixes: 17befecda85 ("hw/ssi/pnv_spi: Replace PnvXferBuffer with Fifo8 structure")
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> Signed-off-by: Caleb Schlossin <calebs@linux.ibm.com>
Hello Caleb,
Sorry for the delayed review. The patch currently doesn't apply on
upstream, as there was a merge conflict with vmstate patch and this.
Can you send a v2, rebased on upstream ?
Thank you,
- Aditya G
> ---
> hw/ssi/pnv_spi.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/hw/ssi/pnv_spi.c b/hw/ssi/pnv_spi.c
> index f40e8836b9..5db440be9a 100644
> --- a/hw/ssi/pnv_spi.c
> +++ b/hw/ssi/pnv_spi.c
> @@ -1176,6 +1176,13 @@ static void pnv_spi_realize(DeviceState *dev, Error **errp)
> s, "xscom-spi", PNV10_XSCOM_PIB_SPIC_SIZE);
> }
>
> +static void pnv_spi_unrealize(DeviceState *dev)
> +{
> + PnvSpi *s = PNV_SPI(dev);
> + fifo8_destroy(&s->tx_fifo);
> + fifo8_destroy(&s->rx_fifo);
> +}
> +
> static int pnv_spi_dt_xscom(PnvXScomInterface *dev, void *fdt,
> int offset)
> {
> @@ -1208,6 +1215,7 @@ static void pnv_spi_class_init(ObjectClass *klass, const void *data)
>
> dc->desc = "PowerNV SPI";
> dc->realize = pnv_spi_realize;
> + dc->unrealize = pnv_spi_unrealize;
> device_class_set_legacy_reset(dc, do_reset);
> device_class_set_props(dc, pnv_spi_properties);
> }
> --
> 2.47.3
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] hw/ssi/pnv_spi: Fix fifo8 memory leak on unrealize
2026-01-19 6:57 ` Aditya Gupta
@ 2026-01-20 14:38 ` Caleb Schlossin
0 siblings, 0 replies; 5+ messages in thread
From: Caleb Schlossin @ 2026-01-20 14:38 UTC (permalink / raw)
To: Aditya Gupta
Cc: qemu-devel, qemu-ppc, npiggin, milesg, alistair, chalapathi.v
On 1/19/26 12:57 AM, Aditya Gupta wrote:
> On 25/12/16 09:45AM, Caleb Schlossin wrote:
>> unrealize should free the fifo8 memory that was allocated by realize.
>>
>> Fixes: 17befecda85 ("hw/ssi/pnv_spi: Replace PnvXferBuffer with Fifo8 structure")
>> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
>> Signed-off-by: Caleb Schlossin <calebs@linux.ibm.com>
>
> Hello Caleb,
>
> Sorry for the delayed review. The patch currently doesn't apply on
> upstream, as there was a merge conflict with vmstate patch and this.
>
> Can you send a v2, rebased on upstream ?
>
> Thank you,
> - Aditya G
>
Yup, I'll rebase and fix in v2.
Thanks,
Caleb
>> ---
>> hw/ssi/pnv_spi.c | 8 ++++++++
>> 1 file changed, 8 insertions(+)
>>
>> diff --git a/hw/ssi/pnv_spi.c b/hw/ssi/pnv_spi.c
>> index f40e8836b9..5db440be9a 100644
>> --- a/hw/ssi/pnv_spi.c
>> +++ b/hw/ssi/pnv_spi.c
>> @@ -1176,6 +1176,13 @@ static void pnv_spi_realize(DeviceState *dev, Error **errp)
>> s, "xscom-spi", PNV10_XSCOM_PIB_SPIC_SIZE);
>> }
>>
>> +static void pnv_spi_unrealize(DeviceState *dev)
>> +{
>> + PnvSpi *s = PNV_SPI(dev);
>> + fifo8_destroy(&s->tx_fifo);
>> + fifo8_destroy(&s->rx_fifo);
>> +}
>> +
>> static int pnv_spi_dt_xscom(PnvXScomInterface *dev, void *fdt,
>> int offset)
>> {
>> @@ -1208,6 +1215,7 @@ static void pnv_spi_class_init(ObjectClass *klass, const void *data)
>>
>> dc->desc = "PowerNV SPI";
>> dc->realize = pnv_spi_realize;
>> + dc->unrealize = pnv_spi_unrealize;
>> device_class_set_legacy_reset(dc, do_reset);
>> device_class_set_props(dc, pnv_spi_properties);
>> }
>> --
>> 2.47.3
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-01-20 14:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-16 15:45 [PATCH] hw/ssi/pnv_spi: Fix fifo8 memory leak on unrealize Caleb Schlossin
2025-12-16 16:26 ` Miles Glenn
2025-12-22 10:43 ` Chalapathi V
2026-01-19 6:57 ` Aditya Gupta
2026-01-20 14:38 ` Caleb Schlossin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox