From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org, Thomas Huth <thuth@redhat.com>,
qemu-arm@nongnu.org, Sergey Kambalin <serg.oker@gmail.com>
Subject: Re: [PATCH 03/15] hw/timer/arm_timer: Add missing sp804_unrealize() handler
Date: Tue, 4 Jul 2023 16:43:28 +0200 [thread overview]
Message-ID: <a986f942-a49f-032a-a50b-ae9dca3996c6@linaro.org> (raw)
In-Reply-To: <CAFEAcA8ZXZ1x9ruh5DuFF+xMM+75W-dcjHJQXQLBcqi0i-peHQ@mail.gmail.com>
On 8/6/23 16:41, Peter Maydell wrote:
> On Wed, 31 May 2023 at 21:36, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>>
>> Release the IRQs allocated in sp804_realize() in the
>> corresponding sp804_unrealize() handler.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> hw/timer/arm_timer.c | 10 ++++++++++
>> 1 file changed, 10 insertions(+)
>> +static void sp804_unrealize(DeviceState *dev)
>> +{
>> + SP804State *s = SP804(dev);
>> +
>> + for (unsigned i = 0; i < ARRAY_SIZE(s->timer); i++) {
>> + qemu_free_irq(s->timer[i]->irq);
>> + }
>> +}
>
> I don't really see the purpose in this. It doesn't actually
> avoid a leak if we ever destroy an SP804, because
> s->timer[i] itself is memory allocated by arm_timer_init()
> which we don't clean up (the arm_timer_state not being
> a qdev). If we did convert arm_timer_state to qdev
> then these interrupts should turn into being sysbus irqs
> and gpio inputs on the relevant devices. (In fact if you
> were willing to take the migration-compat hit you
> could just have the sp804 create a 2 input OR gate and
> wire the arm_timer irqs up to it and use the output
> of the OR gate as the sp804 outbound interrupt line.)
Thank for the suggestion, I didn't notice the OR.
next prev parent reply other threads:[~2023-07-04 14:44 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230531203559.29140-1-philmd@linaro.org>
[not found] ` <20230531203559.29140-16-philmd@linaro.org>
2023-06-03 18:07 ` [PATCH 15/15] hw/timer/arm_timer: QOM'ify ARM_TIMER Mark Cave-Ayland
2023-06-03 18:12 ` Mark Cave-Ayland
2023-06-05 10:16 ` Philippe Mathieu-Daudé
2023-06-05 10:20 ` Philippe Mathieu-Daudé
2023-06-05 10:28 ` Peter Maydell
[not found] ` <20230531203559.29140-2-philmd@linaro.org>
2023-06-08 14:35 ` [PATCH 01/15] hw/timer/arm_timer: Declare QOM types using DEFINE_TYPES() macro Peter Maydell
[not found] ` <20230531203559.29140-3-philmd@linaro.org>
2023-06-08 14:36 ` [PATCH 02/15] hw/timer/arm_timer: Move SP804 code around Peter Maydell
[not found] ` <20230531203559.29140-4-philmd@linaro.org>
2023-06-08 14:41 ` [PATCH 03/15] hw/timer/arm_timer: Add missing sp804_unrealize() handler Peter Maydell
2023-07-04 14:43 ` Philippe Mathieu-Daudé [this message]
[not found] ` <20230531203559.29140-5-philmd@linaro.org>
2023-06-08 14:41 ` [PATCH 04/15] hw/timer/arm_timer: Remove pointless cast from void * Peter Maydell
[not found] ` <20230531203559.29140-6-philmd@linaro.org>
2023-06-08 14:42 ` [PATCH 05/15] hw/timer/arm_timer: CamelCase rename icp_pit_state -> IntegratorPitState Peter Maydell
[not found] ` <20230531203559.29140-7-philmd@linaro.org>
2023-06-08 14:44 ` [PATCH 06/15] hw/timer/arm_timer: CamelCase rename arm_timer_state -> ArmTimerState Peter Maydell
[not found] ` <20230531203559.29140-8-philmd@linaro.org>
2023-06-08 14:46 ` [PATCH 07/15] hw/timer/arm_timer: Extract arm_timer_reset() Peter Maydell
2023-07-04 10:01 ` Philippe Mathieu-Daudé
[not found] ` <20230531203559.29140-9-philmd@linaro.org>
2023-06-08 14:49 ` [PATCH 08/15] hw/timer/arm_timer: Rename arm_timer_init() -> arm_timer_new() Peter Maydell
[not found] ` <20230531203559.29140-10-philmd@linaro.org>
2023-06-08 14:50 ` [PATCH 09/15] hw/timer/arm_timer: Convert ArmTimerState::freq to uint32_t type Peter Maydell
[not found] ` <20230531203559.29140-11-philmd@linaro.org>
2023-06-08 14:50 ` [PATCH 10/15] hw/timer/arm_timer: Use array of frequency in SP804State Peter Maydell
[not found] ` <20230531203559.29140-12-philmd@linaro.org>
2023-06-08 14:51 ` [PATCH 11/15] hw/timer/arm_timer: Iterate on timers using for() loop statement Peter Maydell
[not found] ` <20230531203559.29140-13-philmd@linaro.org>
2023-06-08 15:00 ` [PATCH 12/15] hw/timer/arm_timer: Pass timer output IRQ as parameter to arm_timer_new Peter Maydell
2023-07-04 14:29 ` Philippe Mathieu-Daudé
[not found] ` <20230531203559.29140-14-philmd@linaro.org>
2023-06-08 15:09 ` [PATCH 13/15] hw/timer/arm_timer: Fix misuse of SysBus IRQ in IcpPitState Peter Maydell
2023-07-04 14:25 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a986f942-a49f-032a-a50b-ae9dca3996c6@linaro.org \
--to=philmd@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=serg.oker@gmail.com \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).