From nobody Sun Feb 8 09:12:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linux.intel.com ARC-Seal: i=1; a=rsa-sha256; t=1557729621; cv=none; d=zoho.com; s=zohoarc; b=SRmRgogpJkgstrSRo/dPX/CCQ0WjwP3R0v1YC5ImQ+p4KNndES5fCQJ7fP7IuQK68nYdqj13jyIF0741d5No4Pq5uDv0u/j84QLZoifay6I9SG+gMxU2ZvgOBUigKQdts2KXs1kA/c7irttl0w2c7WTjnbUlYl+btJ8Zh55N8UI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557729621; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=O2w6EQFCGsHGYVb53oaz/B0bG5/xjAysObvJSA0BnUE=; b=AKZR0hUjaWL7PQrypHYKJsZoIfp2VqGXV7Je2Weu8GlfKKYd4AlpVVMKLkz66oQhsg8t8wtBiFnclGfULkzhTbkvADt5tRbZYFuDyQp0KXQDXLwSIQIkyTA8HN14mkgxzDOiPWYaJAqcyefgaMCKIPDGSXGwIjF5zrbwHTKTtlA= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557729621316601.8050751805027; Sun, 12 May 2019 23:40:21 -0700 (PDT) Received: from localhost ([127.0.0.1]:51972 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQ4dG-0005Q8-DM for importer@patchew.org; Mon, 13 May 2019 02:40:18 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37356) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQ4Zs-0002mj-UF for qemu-devel@nongnu.org; Mon, 13 May 2019 02:36:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQ4KK-000509-F8 for qemu-devel@nongnu.org; Mon, 13 May 2019 02:20:46 -0400 Received: from mga07.intel.com ([134.134.136.100]:24552) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hQ4KJ-0004ds-BF for qemu-devel@nongnu.org; Mon, 13 May 2019 02:20:43 -0400 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 May 2019 23:20:43 -0700 Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by orsmga003.jf.intel.com with ESMTP; 12 May 2019 23:20:41 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 From: Wei Yang To: qemu-devel@nongnu.org Date: Mon, 13 May 2019 14:19:13 +0800 Message-Id: <20190513061913.9284-10-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190513061913.9284-1-richardw.yang@linux.intel.com> References: <20190513061913.9284-1-richardw.yang@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 134.134.136.100 Subject: [Qemu-devel] [RFC PATCH 9/9] hw/acpi: implement madt_main to manipulate main madt table X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yang.zhong@intel.com, ehabkost@redhat.com, mst@redhat.com, Wei Yang , pbonzini@redhat.com, imammedo@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Different arch would handle the main madt table differently. Add a helper function to achieve this goal. Signed-off-by: Wei Yang --- hw/acpi/piix4.c | 1 + hw/i386/acpi-build.c | 13 +++++++++++-- hw/isa/lpc_ich9.c | 1 + include/hw/acpi/acpi_dev_interface.h | 1 + include/hw/i386/pc.h | 1 + 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index f4336b9238..d7d097daee 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -723,6 +723,7 @@ static void piix4_pm_class_init(ObjectClass *klass, voi= d *data) adevc->ospm_status =3D piix4_ospm_status; adevc->send_event =3D piix4_send_gpe; adevc->madt_sub =3D i386_madt_sub; + adevc->madt_main =3D i386_madt_main; } =20 static const TypeInfo piix4_pm_info =3D { diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 74a34e297e..e73e9fddee 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -454,6 +454,14 @@ madt_operations i386_madt_sub =3D { [ACPI_APIC_LOCAL_NMI] =3D pc_madt_nmi_entry, }; =20 +void i386_madt_main(GArray *entry, void *opaque) +{ + AcpiMultipleApicTable *madt =3D opaque; + + madt->local_apic_address =3D cpu_to_le32(APIC_DEFAULT_ADDRESS); + madt->flags =3D cpu_to_le32(1); +} + static void build_madt(GArray *table_data, BIOSLinker *linker, PCMachineState *pcms, struct madt_input *input) @@ -466,8 +474,9 @@ build_madt(GArray *table_data, BIOSLinker *linker, PCMa= chineState *pcms, void *opaque; =20 madt =3D acpi_data_push(table_data, sizeof *madt); - madt->local_apic_address =3D cpu_to_le32(APIC_DEFAULT_ADDRESS); - madt->flags =3D cpu_to_le32(1); + if (adevc->madt_main) { + adevc->madt_main(table_data, madt); + } =20 for (i =3D 0; ; i++) { sub_id =3D input[i].sub_id; diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index efb0fd8e94..21afd1a12d 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -812,6 +812,7 @@ static void ich9_lpc_class_init(ObjectClass *klass, voi= d *data) adevc->ospm_status =3D ich9_pm_ospm_status; adevc->send_event =3D ich9_send_gpe; adevc->madt_sub =3D i386_madt_sub; + adevc->madt_main =3D i386_madt_main; } =20 static const TypeInfo ich9_lpc_info =3D { diff --git a/include/hw/acpi/acpi_dev_interface.h b/include/hw/acpi/acpi_de= v_interface.h index 3a3a12d543..d3b216544d 100644 --- a/include/hw/acpi/acpi_dev_interface.h +++ b/include/hw/acpi/acpi_dev_interface.h @@ -52,6 +52,7 @@ typedef struct AcpiDeviceIfClass { /* */ void (*ospm_status)(AcpiDeviceIf *adev, ACPIOSTInfoList ***list); void (*send_event)(AcpiDeviceIf *adev, AcpiEventStatusBits ev); + madt_operation madt_main; madt_operation *madt_sub; } AcpiDeviceIfClass; #endif diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index db4ec693d3..6b7dd060ac 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -282,6 +282,7 @@ void pc_system_firmware_init(PCMachineState *pcms, Memo= ryRegion *rom_memory); void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid, const CPUArchIdList *apic_ids, GArray *entry); extern madt_operations i386_madt_sub; +void i386_madt_main(GArray *entry, void *opaque); =20 /* e820 types */ #define E820_RAM 1 --=20 2.19.1