From patchwork Tue Jul 10 20:22:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 170279 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8E0672C0089 for ; Wed, 11 Jul 2012 06:22:41 +1000 (EST) Received: from localhost ([::1]:36777 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SogxD-0005ZN-Cl for incoming@patchwork.ozlabs.org; Tue, 10 Jul 2012 16:22:39 -0400 Received: from eggs.gnu.org ([208.118.235.92]:42821) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sogwo-00057L-FN for qemu-devel@nongnu.org; Tue, 10 Jul 2012 16:22:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sogwh-0001uT-2T for qemu-devel@nongnu.org; Tue, 10 Jul 2012 16:22:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33153) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sogwg-0001ti-QO for qemu-devel@nongnu.org; Tue, 10 Jul 2012 16:22:06 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6AKM4tF024947 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 10 Jul 2012 16:22:04 -0400 Received: from blackpad.lan.raisama.net (vpn1-4-185.gru2.redhat.com [10.97.4.185]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q6AKM4q3007729; Tue, 10 Jul 2012 16:22:04 -0400 Received: by blackpad.lan.raisama.net (Postfix, from userid 500) id 2BDC92044C1; Tue, 10 Jul 2012 17:22:48 -0300 (BRT) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Tue, 10 Jul 2012 17:22:20 -0300 Message-Id: <1341951743-2285-6-git-send-email-ehabkost@redhat.com> In-Reply-To: <1341951743-2285-1-git-send-email-ehabkost@redhat.com> References: <1341951743-2285-1-git-send-email-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Igor Mammedov , seabios@seabios.org, Gleb Natapov , Anthony Liguori Subject: [Qemu-devel] [QEMU RFC PATCH 5/7] pc: write lapic info (apic IDs) to fw_cfg so seabios can use it X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Eduardo Habkost --- hw/pc.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/hw/pc.c b/hw/pc.c index 3b8e469..dc95fb8 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -71,6 +71,7 @@ #define FW_CFG_IRQ0_OVERRIDE (FW_CFG_ARCH_LOCAL + 2) #define FW_CFG_E820_TABLE (FW_CFG_ARCH_LOCAL + 3) #define FW_CFG_HPET (FW_CFG_ARCH_LOCAL + 4) +#define FW_CFG_LAPIC_INFO (FW_CFG_ARCH_LOCAL + 5) #define MSI_ADDR_BASE 0xfee00000 @@ -87,6 +88,18 @@ struct e820_table { struct e820_entry entry[E820_NR_ENTRIES]; } QEMU_PACKED __attribute((__aligned__(4))); +struct lapic_info_entry { + uint8_t apic_id; + uint8_t reserved1; + uint16_t reserved2; + uint32_t reserved3; +} QEMU_PACKED; + +struct lapic_info_table { + uint64_t count; + struct lapic_info_entry entries[]; +} QEMU_PACKED; + static struct e820_table e820_table; struct hpet_fw_config hpet_cfg = {.count = UINT8_MAX}; @@ -652,6 +665,16 @@ static void *bochs_bios_init(void) fw_cfg_add_bytes(fw_cfg, FW_CFG_NUMA, (uint8_t *)numa_fw_cfg, (1 + max_cpus + nb_numa_nodes) * 8); + size_t lapic_info_size = sizeof(struct lapic_info_table) + \ + sizeof(struct lapic_info_entry) * max_cpus; + struct lapic_info_table *lapic_table = g_malloc0(lapic_info_size);; + lapic_table->count = max_cpus; + for (i = 0; i < max_cpus; i++) { + lapic_table->entries[i].apic_id = apic_id_for_cpu(i); + } + fw_cfg_add_bytes(fw_cfg, FW_CFG_LAPIC_INFO, (uint8_t *)lapic_table, + lapic_info_size); + return fw_cfg; }