Skip to content

Commit

Permalink
hw/i386/acpi-build: Use pc_madt_cpu_entry() directly
Browse files Browse the repository at this point in the history
This is x86-specific code, so there is no advantage in using
pc_madt_cpu_entry() behind an architecture-agnostic interface.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230908084234.17642-2-shentey@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
shentok authored and mstsirkin committed Oct 4, 2023
1 parent 886e0a5 commit f4a06e5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
3 changes: 1 addition & 2 deletions hw/i386/acpi-build.c
Original file line number Diff line number Diff line change
Expand Up @@ -2547,8 +2547,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)

acpi_add_table(table_offsets, tables_blob);
acpi_build_madt(tables_blob, tables->linker, x86ms,
ACPI_DEVICE_IF(x86ms->acpi_dev), x86ms->oem_id,
x86ms->oem_table_id);
x86ms->oem_id, x86ms->oem_table_id);

#ifdef CONFIG_ACPI_ERST
{
Expand Down
5 changes: 2 additions & 3 deletions hw/i386/acpi-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,13 @@ build_xrupt_override(GArray *entry, uint8_t src, uint32_t gsi, uint16_t flags)
* 5.2.8 Multiple APIC Description Table
*/
void acpi_build_madt(GArray *table_data, BIOSLinker *linker,
X86MachineState *x86ms, AcpiDeviceIf *adev,
X86MachineState *x86ms,
const char *oem_id, const char *oem_table_id)
{
int i;
bool x2apic_mode = false;
MachineClass *mc = MACHINE_GET_CLASS(x86ms);
const CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids(MACHINE(x86ms));
AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_GET_CLASS(adev);
AcpiTable table = { .sig = "APIC", .rev = 3, .oem_id = oem_id,
.oem_table_id = oem_table_id };

Expand All @@ -111,7 +110,7 @@ void acpi_build_madt(GArray *table_data, BIOSLinker *linker,
build_append_int_noprefix(table_data, 1 /* PCAT_COMPAT */, 4); /* Flags */

for (i = 0; i < apic_ids->len; i++) {
adevc->madt_cpu(i, apic_ids, table_data, false);
pc_madt_cpu_entry(i, apic_ids, table_data, false);
if (apic_ids->cpus[i].arch_id > 254) {
x2apic_mode = true;
}
Expand Down
3 changes: 1 addition & 2 deletions hw/i386/acpi-common.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
#ifndef HW_I386_ACPI_COMMON_H
#define HW_I386_ACPI_COMMON_H

#include "hw/acpi/acpi_dev_interface.h"
#include "hw/acpi/bios-linker-loader.h"
#include "hw/i386/x86.h"

/* Default IOAPIC ID */
#define ACPI_BUILD_IOAPIC_ID 0x0

void acpi_build_madt(GArray *table_data, BIOSLinker *linker,
X86MachineState *x86ms, AcpiDeviceIf *adev,
X86MachineState *x86ms,
const char *oem_id, const char *oem_table_id);

#endif
3 changes: 1 addition & 2 deletions hw/i386/acpi-microvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,7 @@ static void acpi_build_microvm(AcpiBuildTables *tables,

acpi_add_table(table_offsets, tables_blob);
acpi_build_madt(tables_blob, tables->linker, X86_MACHINE(machine),
ACPI_DEVICE_IF(x86ms->acpi_dev), x86ms->oem_id,
x86ms->oem_table_id);
x86ms->oem_id, x86ms->oem_table_id);

#ifdef CONFIG_ACPI_ERST
{
Expand Down

0 comments on commit f4a06e5

Please sign in to comment.