qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Andrew Jones <drjones@redhat.com>
Cc: Al Stone <al.stone@linaro.org>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Leif Lindholm <leif.lindholm@linaro.org>,
	Shannon Zhao <shannon.zhao@linaro.org>
Subject: Re: [Qemu-devel] [PATCH v3 2/2] hw/arm/virt-acpi-build: Add DBG2 table
Date: Tue, 15 Sep 2015 17:45:24 +0100	[thread overview]
Message-ID: <CAFEAcA8LnbwbzLxYNzWqaUTHHGePTRPYEEiWpM5dr3wqOw5kUw@mail.gmail.com> (raw)
In-Reply-To: <20150915164232.GC3165@hawk.localdomain>

On 15 September 2015 at 17:42, Andrew Jones <drjones@redhat.com> wrote:
> On Tue, Sep 15, 2015 at 03:44:41PM +0100, Leif Lindholm wrote:
>> Add a DBG2 table, describing the pl011 UART.
>>
>> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
>> ---
>>  hw/arm/virt-acpi-build.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++-
>>  1 file changed, 87 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
>> index 9088248..763d531 100644
>> --- a/hw/arm/virt-acpi-build.c
>> +++ b/hw/arm/virt-acpi-build.c
>> @@ -351,6 +351,89 @@ build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt)
>>      return rsdp_table;
>>  }
>>
>> +static int
>> +dbg2_addresses_size(int num_addr)
>> +{
>> +    return num_addr * (sizeof(struct AcpiGenericAddress) + sizeof(uint32_t));
>> +}
>> +
>> +static int
>> +dbg2_dev_length(int num_addr, const char *namepath, int oemdata_length)
>> +{
>> +    int size;
>> +
>> +    size = sizeof(AcpiDebugPort2Device);
>> +    size += dbg2_addresses_size(num_addr);
>> +    size += strlen(namepath) + 1;
>> +    size += oemdata_length;
>> +
>> +    return size;
>> +}
>
> I think macros should suffice for the above helpers.

...but if you can write them as functions then why not do so?
The compiler's smart enough to inline as appropriate, and it's
not like performance is critical with one-time ACPI table
building anyhow.

Incidentally putting a linebreak before the function name is
not the usual QEMU style for function definitions.

thanks
-- PMM

      reply	other threads:[~2015-09-15 16:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-15 14:44 [Qemu-devel] [PATCH v3 0/2] ACPI/arm-virt: add DBG2 Leif Lindholm
2015-09-15 14:44 ` [Qemu-devel] [PATCH v3 1/2] ACPI: Add definitions for the DBG2 table Leif Lindholm
2015-09-15 14:44 ` [Qemu-devel] [PATCH v3 2/2] hw/arm/virt-acpi-build: Add " Leif Lindholm
2015-09-15 16:42   ` Andrew Jones
2015-09-15 16:45     ` Peter Maydell [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=CAFEAcA8LnbwbzLxYNzWqaUTHHGePTRPYEEiWpM5dr3wqOw5kUw@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=al.stone@linaro.org \
    --cc=drjones@redhat.com \
    --cc=leif.lindholm@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=shannon.zhao@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).