From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>,
qemu-arm <qemu-arm@nongnu.org>,
QEMU Developers <qemu-devel@nongnu.org>,
Leif Lindholm <leif.lindholm@linaro.org>
Subject: Re: [PATCH-for-5.0] hw/arm/sbsa-ref: Call qdev_get_gpio_in in place
Date: Fri, 6 Dec 2019 17:18:52 +0100 [thread overview]
Message-ID: <75d0cce3-de3e-08ac-0ecf-c97d93e30c8d@redhat.com> (raw)
In-Reply-To: <CAFEAcA-n=RKviDr9h+hCdwETN-Et5+A--v+HU_DuwqCQ2BWdDA@mail.gmail.com>
On 12/6/19 4:34 PM, Peter Maydell wrote:
> On Fri, 6 Dec 2019 at 07:23, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>>
>> Instead of filling an array of qemu_irq and passing it around,
>> directly call qdev_get_gpio_in() on the GIC.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>> I accept better patch subject suggestions :)
>> ---
>> hw/arm/sbsa-ref.c | 58 +++++++++++++++++++++++------------------------
>> 1 file changed, 29 insertions(+), 29 deletions(-)
>>
>> diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
>> index 27046cc284..30cb647551 100644
>> --- a/hw/arm/sbsa-ref.c
>> +++ b/hw/arm/sbsa-ref.c
>> @@ -328,7 +328,7 @@ static void create_secure_ram(SBSAMachineState *sms,
>> memory_region_add_subregion(secure_sysmem, base, secram);
>> }
>>
>> -static void create_gic(SBSAMachineState *sms, qemu_irq *pic)
>> +static DeviceState *create_gic(SBSAMachineState *sms)
>> {
>> unsigned int smp_cpus = MACHINE(sms)->smp.cpus;
>> DeviceState *gicdev;
>> @@ -403,12 +403,10 @@ static void create_gic(SBSAMachineState *sms, qemu_irq *pic)
>> qdev_get_gpio_in(cpudev, ARM_CPU_VFIQ));
>> }
>>
>> - for (i = 0; i < NUM_IRQS; i++) {
>> - pic[i] = qdev_get_gpio_in(gicdev, i);
>> - }
>> + return gicdev;
>
> If you make DeviceState *gic a field in SBSAMachineState then
> you don't need to pass it in as a parameter to all these
> functions. I think this code is mostly borrowed from the
> virt board, which is written the way it is because at the
> time we didn't have machine state structs which could
> own all the device structs etc for the devices on the board.
Great idea, thanks!
prev parent reply other threads:[~2019-12-06 18:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-06 7:22 [PATCH-for-5.0] hw/arm/sbsa-ref: Call qdev_get_gpio_in in place Philippe Mathieu-Daudé
2019-12-06 15:34 ` Peter Maydell
2019-12-06 16:18 ` Philippe Mathieu-Daudé [this message]
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=75d0cce3-de3e-08ac-0ecf-c97d93e30c8d@redhat.com \
--to=philmd@redhat.com \
--cc=leif.lindholm@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=radoslaw.biernacki@linaro.org \
/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).