Message ID | 20191105091056.9541-15-guoheyi@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add SDEI support for arm64 | expand |
On Tue, 5 Nov 2019 17:10:56 +0800 Heyi Guo <guoheyi@huawei.com> wrote: > Add SDEI table if SDEI is enabled, so that guest OS can get aware and > utilize the interfaces. > > Signed-off-by: Heyi Guo <guoheyi@huawei.com> > Cc: Peter Maydell <peter.maydell@linaro.org> > Cc: Dave Martin <Dave.Martin@arm.com> > Cc: Marc Zyngier <marc.zyngier@arm.com> > Cc: Mark Rutland <mark.rutland@arm.com> > Cc: James Morse <james.morse@arm.com> > Cc: Shannon Zhao <shannon.zhaosl@gmail.com> > Cc: "Michael S. Tsirkin" <mst@redhat.com> > Cc: Igor Mammedov <imammedo@redhat.com> > --- > > Notes: > v2: > - Drop SDEI table definition and add comments > > hw/arm/virt-acpi-build.c | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c > index 4cd50175e0..73d3f8cd15 100644 > --- a/hw/arm/virt-acpi-build.c > +++ b/hw/arm/virt-acpi-build.c > @@ -32,6 +32,7 @@ > #include "trace.h" > #include "hw/core/cpu.h" > #include "target/arm/cpu.h" > +#include "target/arm/sdei.h" > #include "hw/acpi/acpi-defs.h" > #include "hw/acpi/acpi.h" > #include "hw/nvram/fw_cfg.h" > @@ -475,6 +476,26 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) > "IORT", table_data->len - iort_start, 0, NULL, NULL); > } > > +/* > + * ACPI spec 6.2 Software Delegated Exception Interface (SDEI). > + * (Revision 1.0) > + * "SDEI" was reserved in ACPI 6.2. See "Links to ACPI-Related Documents" > + * (http://uefi.org/acpi) under the heading "Software > + * Delegated Exceptions Interface." The definition is under > + * "10 Appendix C: ACPI table definitions for SDEI" in the linked document. > + * > + * This is a dummy table to expose platform SDEI capbility to OS. > + */ > +static void > +build_sdei(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) > +{ > + int sdei_start = table_data->len; > + > + (void)acpi_data_push(table_data, sizeof(AcpiTableHeader)); > + build_header(linker, table_data, (void *)(table_data->data + sdei_start), > + "SDEI", table_data->len - sdei_start, 1, NULL, NULL); > +} > + > static void > build_spcr(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) > { > @@ -825,6 +846,11 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables) > acpi_add_table(table_offsets, tables_blob); > build_spcr(tables_blob, tables->linker, vms); > > + if (sdei_enabled) { globals shouldn't be introduced in new code > + acpi_add_table(table_offsets, tables_blob); > + build_sdei(tables_blob, tables->linker, vms); > + } > + > if (ms->numa_state->num_nodes > 0) { > acpi_add_table(table_offsets, tables_blob); > build_srat(tables_blob, tables->linker, vms);
On 2019/11/12 22:52, Igor Mammedov wrote: > On Tue, 5 Nov 2019 17:10:56 +0800 > Heyi Guo <guoheyi@huawei.com> wrote: > >> Add SDEI table if SDEI is enabled, so that guest OS can get aware and >> utilize the interfaces. >> >> Signed-off-by: Heyi Guo <guoheyi@huawei.com> >> Cc: Peter Maydell <peter.maydell@linaro.org> >> Cc: Dave Martin <Dave.Martin@arm.com> >> Cc: Marc Zyngier <marc.zyngier@arm.com> >> Cc: Mark Rutland <mark.rutland@arm.com> >> Cc: James Morse <james.morse@arm.com> >> Cc: Shannon Zhao <shannon.zhaosl@gmail.com> >> Cc: "Michael S. Tsirkin" <mst@redhat.com> >> Cc: Igor Mammedov <imammedo@redhat.com> >> --- >> >> Notes: >> v2: >> - Drop SDEI table definition and add comments >> >> hw/arm/virt-acpi-build.c | 26 ++++++++++++++++++++++++++ >> 1 file changed, 26 insertions(+) >> >> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c >> index 4cd50175e0..73d3f8cd15 100644 >> --- a/hw/arm/virt-acpi-build.c >> +++ b/hw/arm/virt-acpi-build.c >> @@ -32,6 +32,7 @@ >> #include "trace.h" >> #include "hw/core/cpu.h" >> #include "target/arm/cpu.h" >> +#include "target/arm/sdei.h" >> #include "hw/acpi/acpi-defs.h" >> #include "hw/acpi/acpi.h" >> #include "hw/nvram/fw_cfg.h" >> @@ -475,6 +476,26 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) >> "IORT", table_data->len - iort_start, 0, NULL, NULL); >> } >> >> +/* >> + * ACPI spec 6.2 Software Delegated Exception Interface (SDEI). >> + * (Revision 1.0) >> + * "SDEI" was reserved in ACPI 6.2. See "Links to ACPI-Related Documents" >> + * (http://uefi.org/acpi) under the heading "Software >> + * Delegated Exceptions Interface." The definition is under >> + * "10 Appendix C: ACPI table definitions for SDEI" in the linked document. >> + * >> + * This is a dummy table to expose platform SDEI capbility to OS. >> + */ >> +static void >> +build_sdei(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) >> +{ >> + int sdei_start = table_data->len; >> + >> + (void)acpi_data_push(table_data, sizeof(AcpiTableHeader)); >> + build_header(linker, table_data, (void *)(table_data->data + sdei_start), >> + "SDEI", table_data->len - sdei_start, 1, NULL, NULL); >> +} >> + >> static void >> build_spcr(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) >> { >> @@ -825,6 +846,11 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables) >> acpi_add_table(table_offsets, tables_blob); >> build_spcr(tables_blob, tables->linker, vms); >> >> + if (sdei_enabled) { > globals shouldn't be introduced in new code OK. For this feature depends on KVM, does it make sense to add a flag to struct VirtMachineState? Thanks, HG > >> + acpi_add_table(table_offsets, tables_blob); >> + build_sdei(tables_blob, tables->linker, vms); >> + } >> + >> if (ms->numa_state->num_nodes > 0) { >> acpi_add_table(table_offsets, tables_blob); >> build_srat(tables_blob, tables->linker, vms); > > . >
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 4cd50175e0..73d3f8cd15 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -32,6 +32,7 @@ #include "trace.h" #include "hw/core/cpu.h" #include "target/arm/cpu.h" +#include "target/arm/sdei.h" #include "hw/acpi/acpi-defs.h" #include "hw/acpi/acpi.h" #include "hw/nvram/fw_cfg.h" @@ -475,6 +476,26 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) "IORT", table_data->len - iort_start, 0, NULL, NULL); } +/* + * ACPI spec 6.2 Software Delegated Exception Interface (SDEI). + * (Revision 1.0) + * "SDEI" was reserved in ACPI 6.2. See "Links to ACPI-Related Documents" + * (http://uefi.org/acpi) under the heading "Software + * Delegated Exceptions Interface." The definition is under + * "10 Appendix C: ACPI table definitions for SDEI" in the linked document. + * + * This is a dummy table to expose platform SDEI capbility to OS. + */ +static void +build_sdei(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) +{ + int sdei_start = table_data->len; + + (void)acpi_data_push(table_data, sizeof(AcpiTableHeader)); + build_header(linker, table_data, (void *)(table_data->data + sdei_start), + "SDEI", table_data->len - sdei_start, 1, NULL, NULL); +} + static void build_spcr(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) { @@ -825,6 +846,11 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables) acpi_add_table(table_offsets, tables_blob); build_spcr(tables_blob, tables->linker, vms); + if (sdei_enabled) { + acpi_add_table(table_offsets, tables_blob); + build_sdei(tables_blob, tables->linker, vms); + } + if (ms->numa_state->num_nodes > 0) { acpi_add_table(table_offsets, tables_blob); build_srat(tables_blob, tables->linker, vms);
Add SDEI table if SDEI is enabled, so that guest OS can get aware and utilize the interfaces. Signed-off-by: Heyi Guo <guoheyi@huawei.com> Cc: Peter Maydell <peter.maydell@linaro.org> Cc: Dave Martin <Dave.Martin@arm.com> Cc: Marc Zyngier <marc.zyngier@arm.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: James Morse <james.morse@arm.com> Cc: Shannon Zhao <shannon.zhaosl@gmail.com> Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Igor Mammedov <imammedo@redhat.com> --- Notes: v2: - Drop SDEI table definition and add comments hw/arm/virt-acpi-build.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)