From: Peter Maydell <peter.maydell@linaro.org>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: "Mauro Carvalho Chehab" <mchehab+huawei@kernel.org>,
"Jonathan Cameron" <Jonathan.Cameron@huawei.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Ani Sinha" <anisinha@redhat.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Igor Mammedov" <imammedo@redhat.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Shannon Zhao" <shannon.zhaosl@gmail.com>,
"Yanan Wang" <wangyanan55@huawei.com>,
linux-edac@kernel.org, linux-kernel@vger.kernel.org,
qemu-arm@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH 1/6] arm/virt: Wire up GPIO error source for ACPI / GHES
Date: Thu, 11 Jul 2024 12:59:20 +0100 [thread overview]
Message-ID: <CAFEAcA-PYnZ-32MRX+PgvzhnoAV80zBKMYg61j2f=oHaGfwSsg@mail.gmail.com> (raw)
In-Reply-To: <20240711075332-mutt-send-email-mst@kernel.org>
On Thu, 11 Jul 2024 at 12:54, Michael S. Tsirkin <mst@redhat.com> wrote:
>
> On Thu, Jul 11, 2024 at 11:52:03AM +0200, Mauro Carvalho Chehab wrote:
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > Creates a GED - Generic Event Device and set a GPIO to
> > be used or error injection.
> >
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> > ---
> > hw/arm/virt-acpi-build.c | 29 +++++++++++++++++++++++++----
> > hw/arm/virt.c | 12 +++++++++++-
> > include/hw/boards.h | 1 +
> > 3 files changed, 37 insertions(+), 5 deletions(-)
> >
> > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> > index e10cad86dd73..b6f2e55014a2 100644
> > --- a/hw/arm/virt-acpi-build.c
> > +++ b/hw/arm/virt-acpi-build.c
> > @@ -63,6 +63,7 @@
> >
> > #define ARM_SPI_BASE 32
> >
> > +#define ACPI_GENERIC_EVENT_DEVICE "GEDD"
> > #define ACPI_BUILD_TABLE_SIZE 0x20000
> >
> > static void acpi_dsdt_add_cpus(Aml *scope, VirtMachineState *vms)
> > @@ -155,9 +156,14 @@ static void acpi_dsdt_add_gpio(Aml *scope, const MemMapEntry *gpio_memmap,
> >
> > Aml *aei = aml_resource_template();
> > /* Pin 3 for power button */
> > - const uint32_t pin_list[1] = {3};
> > + uint32_t pin = 3;
> > aml_append(aei, aml_gpio_int(AML_CONSUMER, AML_EDGE, AML_ACTIVE_HIGH,
> > - AML_EXCLUSIVE, AML_PULL_UP, 0, pin_list, 1,
> > + AML_EXCLUSIVE, AML_PULL_UP, 0, &pin, 1,
> > + "GPO0", NULL, 0));
> > + pin = 6;
> > + /* Pin 8 for generic error */
>
> For real? Code says 6, comment says 8.
>
> Comments must come before the code they comment, not after it,
> then this kind of thing won't happen.
It might also be nice to have a symbolic constant for the
pin number somewhere, so we don't rely on the magic number here and...
> > @@ -1014,6 +1021,8 @@ static void create_gpio_keys(char *fdt, DeviceState *pl061_dev,
> > {
> > gpio_key_dev = sysbus_create_simple("gpio-key", -1,
> > qdev_get_gpio_in(pl061_dev, 3));
> > + gpio_error_dev = sysbus_create_simple("gpio-key", -1,
> > + qdev_get_gpio_in(pl061_dev, 6));
...here being the same.
Then if the code says "pin = VIRT_GPIO_ERROR_PIN" or something
similar the comment isn't required because the code is clear
without it.
(This is already a problem for the power-button pin 3, so we could
do an initial cleanup patch to sort out pin 3 first).
thanks
-- PMM
next prev parent reply other threads:[~2024-07-11 11:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-11 9:52 [PATCH 0/6] Add ACPI CPER firmware first error injection for Arm Processor Mauro Carvalho Chehab
2024-07-11 9:52 ` [PATCH 1/6] arm/virt: Wire up GPIO error source for ACPI / GHES Mauro Carvalho Chehab
2024-07-11 11:54 ` Michael S. Tsirkin
2024-07-11 11:59 ` Peter Maydell [this message]
2024-07-11 9:52 ` [PATCH 2/6] acpi/ghes: Support GPIO error source Mauro Carvalho Chehab
2024-07-11 9:52 ` [PATCH 3/6] acpi/ghes: Add a logic to handle block addresses and FW first ARM processor error injection Mauro Carvalho Chehab
2024-07-11 9:52 ` [PATCH 4/6] target/arm: preserve mpidr value Mauro Carvalho Chehab
2024-07-11 9:52 ` [PATCH 5/6] acpi/ghes: update comments to point to newer ACPI specs Mauro Carvalho Chehab
2024-07-11 9:52 ` [PATCH 6/6] acpi/ghes: extend arm error injection logic Mauro Carvalho Chehab
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='CAFEAcA-PYnZ-32MRX+PgvzhnoAV80zBKMYg61j2f=oHaGfwSsg@mail.gmail.com' \
--to=peter.maydell@linaro.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=anisinha@redhat.com \
--cc=eduardo@habkost.net \
--cc=imammedo@redhat.com \
--cc=linux-edac@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcel.apfelbaum@gmail.com \
--cc=mchehab+huawei@kernel.org \
--cc=mst@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=shannon.zhaosl@gmail.com \
--cc=wangyanan55@huawei.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).