Create a new property (x-has-hest-addr) and use it to detect if
the GHES table offsets can be calculated from the HEST address
(qemu 10.0 and upper) or via the legacy way via an offset obtained
from the hardware_errors firmware file.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
hw/acpi/generic_event_device.c | 1 +
hw/arm/virt-acpi-build.c | 18 ++++++++++++++++--
hw/core/machine.c | 2 ++
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c
index 5346cae573b7..14d8513a5440 100644
--- a/hw/acpi/generic_event_device.c
+++ b/hw/acpi/generic_event_device.c
@@ -318,6 +318,7 @@ static void acpi_ged_send_event(AcpiDeviceIf *adev, AcpiEventStatusBits ev)
static const Property acpi_ged_properties[] = {
DEFINE_PROP_UINT32("ged-event", AcpiGedState, ged_event_bitmap, 0),
+ DEFINE_PROP_BOOL("x-has-hest-addr", AcpiGedState, ghes_state.use_hest_addr, false),
};
static const VMStateDescription vmstate_memhp_state = {
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 4439252e1a75..9de51105a513 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -897,6 +897,10 @@ static const AcpiNotificationSourceId hest_ghes_notify[] = {
{ ACPI_HEST_SRC_ID_SYNC, ACPI_GHES_NOTIFY_SEA },
};
+static const AcpiNotificationSourceId hest_ghes_notify_9_2[] = {
+ { ACPI_HEST_SRC_ID_SYNC, ACPI_GHES_NOTIFY_SEA },
+};
+
static
void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables)
{
@@ -950,7 +954,9 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables)
build_dbg2(tables_blob, tables->linker, vms);
if (vms->ras) {
+ static const AcpiNotificationSourceId *notify;
AcpiGedState *acpi_ged_state;
+ unsigned int notify_sz;
AcpiGhesState *ags;
acpi_ged_state = ACPI_GED(object_resolve_path_type("", TYPE_ACPI_GED,
@@ -959,9 +965,17 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables)
ags = &acpi_ged_state->ghes_state;
acpi_add_table(table_offsets, tables_blob);
+
+ if (!ags->use_hest_addr) {
+ notify = hest_ghes_notify_9_2;
+ notify_sz = ARRAY_SIZE(hest_ghes_notify_9_2);
+ } else {
+ notify = hest_ghes_notify;
+ notify_sz = ARRAY_SIZE(hest_ghes_notify);
+ }
+
acpi_build_hest(ags, tables_blob, tables->hardware_errors,
- tables->linker, hest_ghes_notify,
- ARRAY_SIZE(hest_ghes_notify),
+ tables->linker, notify, notify_sz,
vms->oem_id, vms->oem_table_id);
}
}
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 02cff735b3fb..7a11e0f87b11 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -34,6 +34,7 @@
#include "hw/virtio/virtio-pci.h"
#include "hw/virtio/virtio-net.h"
#include "hw/virtio/virtio-iommu.h"
+#include "hw/acpi/generic_event_device.h"
#include "audio/audio.h"
GlobalProperty hw_compat_9_2[] = {
@@ -43,6 +44,7 @@ GlobalProperty hw_compat_9_2[] = {
{ "virtio-balloon-pci-non-transitional", "vectors", "0" },
{ "virtio-mem-pci", "vectors", "0" },
{ "migration", "multifd-clean-tls-termination", "false" },
+ { TYPE_ACPI_GED, "x-has-hest-addr", "false" },
};
const size_t hw_compat_9_2_len = G_N_ELEMENTS(hw_compat_9_2);
--
2.48.1
On Fri, 21 Feb 2025 15:35:17 +0100 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> wrote: > Create a new property (x-has-hest-addr) and use it to detect if > the GHES table offsets can be calculated from the HEST address > (qemu 10.0 and upper) or via the legacy way via an offset obtained > from the hardware_errors firmware file. > > Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> > Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > --- > hw/acpi/generic_event_device.c | 1 + > hw/arm/virt-acpi-build.c | 18 ++++++++++++++++-- > hw/core/machine.c | 2 ++ > 3 files changed, 19 insertions(+), 2 deletions(-) > > diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c > index 5346cae573b7..14d8513a5440 100644 > --- a/hw/acpi/generic_event_device.c > +++ b/hw/acpi/generic_event_device.c > @@ -318,6 +318,7 @@ static void acpi_ged_send_event(AcpiDeviceIf *adev, AcpiEventStatusBits ev) > > static const Property acpi_ged_properties[] = { > DEFINE_PROP_UINT32("ged-event", AcpiGedState, ged_event_bitmap, 0), > + DEFINE_PROP_BOOL("x-has-hest-addr", AcpiGedState, ghes_state.use_hest_addr, false), you below set it for 9.2 to false, so shouldn't it be set to true by default here? > }; > > static const VMStateDescription vmstate_memhp_state = { > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c > index 4439252e1a75..9de51105a513 100644 > --- a/hw/arm/virt-acpi-build.c > +++ b/hw/arm/virt-acpi-build.c > @@ -897,6 +897,10 @@ static const AcpiNotificationSourceId hest_ghes_notify[] = { > { ACPI_HEST_SRC_ID_SYNC, ACPI_GHES_NOTIFY_SEA }, > }; > > +static const AcpiNotificationSourceId hest_ghes_notify_9_2[] = { > + { ACPI_HEST_SRC_ID_SYNC, ACPI_GHES_NOTIFY_SEA }, > +}; > + > static > void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables) > { > @@ -950,7 +954,9 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables) > build_dbg2(tables_blob, tables->linker, vms); > > if (vms->ras) { > + static const AcpiNotificationSourceId *notify; > AcpiGedState *acpi_ged_state; > + unsigned int notify_sz; > AcpiGhesState *ags; > > acpi_ged_state = ACPI_GED(object_resolve_path_type("", TYPE_ACPI_GED, > @@ -959,9 +965,17 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables) > ags = &acpi_ged_state->ghes_state; > > acpi_add_table(table_offsets, tables_blob); > + > + if (!ags->use_hest_addr) { > + notify = hest_ghes_notify_9_2; > + notify_sz = ARRAY_SIZE(hest_ghes_notify_9_2); > + } else { > + notify = hest_ghes_notify; > + notify_sz = ARRAY_SIZE(hest_ghes_notify); > + } > + > acpi_build_hest(ags, tables_blob, tables->hardware_errors, > - tables->linker, hest_ghes_notify, > - ARRAY_SIZE(hest_ghes_notify), > + tables->linker, notify, notify_sz, > vms->oem_id, vms->oem_table_id); > } > } > diff --git a/hw/core/machine.c b/hw/core/machine.c > index 02cff735b3fb..7a11e0f87b11 100644 > --- a/hw/core/machine.c > +++ b/hw/core/machine.c > @@ -34,6 +34,7 @@ > #include "hw/virtio/virtio-pci.h" > #include "hw/virtio/virtio-net.h" > #include "hw/virtio/virtio-iommu.h" > +#include "hw/acpi/generic_event_device.h" > #include "audio/audio.h" > > GlobalProperty hw_compat_9_2[] = { > @@ -43,6 +44,7 @@ GlobalProperty hw_compat_9_2[] = { > { "virtio-balloon-pci-non-transitional", "vectors", "0" }, > { "virtio-mem-pci", "vectors", "0" }, > { "migration", "multifd-clean-tls-termination", "false" }, > + { TYPE_ACPI_GED, "x-has-hest-addr", "false" }, > }; > const size_t hw_compat_9_2_len = G_N_ELEMENTS(hw_compat_9_2); >
Em Wed, 26 Feb 2025 16:52:26 +0100 Igor Mammedov <imammedo@redhat.com> escreveu: > On Fri, 21 Feb 2025 15:35:17 +0100 > Mauro Carvalho Chehab <mchehab+huawei@kernel.org> wrote: > > > diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c > > index 5346cae573b7..14d8513a5440 100644 > > --- a/hw/acpi/generic_event_device.c > > +++ b/hw/acpi/generic_event_device.c > > @@ -318,6 +318,7 @@ static void acpi_ged_send_event(AcpiDeviceIf *adev, AcpiEventStatusBits ev) > > > > static const Property acpi_ged_properties[] = { > > DEFINE_PROP_UINT32("ged-event", AcpiGedState, ged_event_bitmap, 0), > > + DEFINE_PROP_BOOL("x-has-hest-addr", AcpiGedState, ghes_state.use_hest_addr, false), > > you below set it for 9.2 to false, so > shouldn't it be set to true by default here? Yes, but it is too early to do that here, as the DSDT table was not updated to contain the GED device. We're switching it to true later on, at patch 11:: d8c44ee13fbe ("arm/virt: Wire up a GED error device for ACPI / GHES") Thanks, Mauro
Em Thu, 27 Feb 2025 08:19:27 +0100 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> escreveu: > Em Wed, 26 Feb 2025 16:52:26 +0100 > Igor Mammedov <imammedo@redhat.com> escreveu: > > > On Fri, 21 Feb 2025 15:35:17 +0100 > > Mauro Carvalho Chehab <mchehab+huawei@kernel.org> wrote: > > > > > > diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c > > > index 5346cae573b7..14d8513a5440 100644 > > > --- a/hw/acpi/generic_event_device.c > > > +++ b/hw/acpi/generic_event_device.c > > > @@ -318,6 +318,7 @@ static void acpi_ged_send_event(AcpiDeviceIf *adev, AcpiEventStatusBits ev) > > > > > > static const Property acpi_ged_properties[] = { > > > DEFINE_PROP_UINT32("ged-event", AcpiGedState, ged_event_bitmap, 0), > > > + DEFINE_PROP_BOOL("x-has-hest-addr", AcpiGedState, ghes_state.use_hest_addr, false), > > > > you below set it for 9.2 to false, so > > shouldn't it be set to true by default here? > > Yes, but it is too early to do that here, as the DSDT table was not > updated to contain the GED device. > > We're switching it to true later on, at patch 11:: > > d8c44ee13fbe ("arm/virt: Wire up a GED error device for ACPI / GHES") Hmm... too many rebases that on my head things are becoming shady ;-) Originally, this was setting it to true, but you requested to move it to another patch during one of the patch reorder requests. Anyway, after all those rebases, I guess it is now safe to set it to true here without breaking bisectability. I'll move the hunk back to this patch. Thanks, Mauro
On Thu, 27 Feb 2025 08:26:38 +0100 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> wrote: > Em Thu, 27 Feb 2025 08:19:27 +0100 > Mauro Carvalho Chehab <mchehab+huawei@kernel.org> escreveu: > > > Em Wed, 26 Feb 2025 16:52:26 +0100 > > Igor Mammedov <imammedo@redhat.com> escreveu: > > > > > On Fri, 21 Feb 2025 15:35:17 +0100 > > > Mauro Carvalho Chehab <mchehab+huawei@kernel.org> wrote: > > > > > > > > > diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c > > > > index 5346cae573b7..14d8513a5440 100644 > > > > --- a/hw/acpi/generic_event_device.c > > > > +++ b/hw/acpi/generic_event_device.c > > > > @@ -318,6 +318,7 @@ static void acpi_ged_send_event(AcpiDeviceIf *adev, AcpiEventStatusBits ev) > > > > > > > > static const Property acpi_ged_properties[] = { > > > > DEFINE_PROP_UINT32("ged-event", AcpiGedState, ged_event_bitmap, 0), > > > > + DEFINE_PROP_BOOL("x-has-hest-addr", AcpiGedState, ghes_state.use_hest_addr, false), > > > > > > you below set it for 9.2 to false, so > > > shouldn't it be set to true by default here? > > > > Yes, but it is too early to do that here, as the DSDT table was not > > updated to contain the GED device. > > > > We're switching it to true later on, at patch 11:: > > > > d8c44ee13fbe ("arm/virt: Wire up a GED error device for ACPI / GHES") After sleeping on it, what you did here is totally correct. You are right, We can't really flip switch to true here since without 11/14 APEI will stop working properly. Perhaps add to commit message a note explaining why it's false in this patch and where it will be set to true. > > Hmm... too many rebases that on my head things are becoming shady ;-) > > Originally, this was setting it to true, but you requested to move it > to another patch during one of the patch reorder requests. > > Anyway, after all those rebases, I guess it is now safe to set it > to true here without breaking bisectability. I'll move the hunk back > to this patch. > > Thanks, > Mauro >
© 2016 - 2025 Red Hat, Inc.