From patchwork Fri Sep 21 11:17:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasilis Liaskovitis X-Patchwork-Id: 185705 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 264572C007A for ; Fri, 21 Sep 2012 21:35:44 +1000 (EST) Received: from localhost ([::1]:51171 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TF1GU-0002qA-VQ for incoming@patchwork.ozlabs.org; Fri, 21 Sep 2012 07:19:22 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57714) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TF1F7-00007x-U8 for qemu-devel@nongnu.org; Fri, 21 Sep 2012 07:17:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TF1F0-0003u8-IR for qemu-devel@nongnu.org; Fri, 21 Sep 2012 07:17:57 -0400 Received: from mail-bk0-f45.google.com ([209.85.214.45]:44993) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TF1F0-0003r3-9h for qemu-devel@nongnu.org; Fri, 21 Sep 2012 07:17:50 -0400 Received: by mail-bk0-f45.google.com with SMTP id jg9so1317036bkc.4 for ; Fri, 21 Sep 2012 04:17:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=GJnyeuwP7jHGpyS0Rcvmlu/dRiKbk/CYk1N1Vh48KcM=; b=eeIjmsjMExBLN6dsVaecwhEHss3vArScPcdC3vtF5XWjDtOKd00SufoGf0waCEdjGP EDmfCUVlE8RSu6TGUlZxwZGRctRi9QC7as9ZR0oazyB/AtchDipjk2OY/bark2dPF+KX w6NTxeu2HNYXxFVdCXUkxtEyhaXejFbHVsEEyLwNB61pneN3tn6V1Yiws6t5cCrBB03p HBx0gXYRNMpN0eXNZUou3QODrWoq7ubZfZSggdxqenuPEMycTy9pPL3Nf0dwT/N5i4wV hCuTg145qTIdgqX8BteHgpslE1nMui8Z+UxX3kUF+nRJo03IoFtTouZ1iQIJ22B/UCTS QM6w== Received: by 10.204.130.10 with SMTP id q10mr1953820bks.90.1348226269674; Fri, 21 Sep 2012 04:17:49 -0700 (PDT) Received: from dhcp-192-168-178-175.ri.profitbricks.localdomain ([62.217.45.26]) by mx.google.com with ESMTPS id x13sm5271435bkv.16.2012.09.21.04.17.48 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 21 Sep 2012 04:17:49 -0700 (PDT) From: Vasilis Liaskovitis To: qemu-devel@nongnu.org, kvm@vger.kernel.org, seabios@seabios.org Date: Fri, 21 Sep 2012 13:17:25 +0200 Message-Id: <1348226255-4226-10-git-send-email-vasilis.liaskovitis@profitbricks.com> X-Mailer: git-send-email 1.7.9 In-Reply-To: <1348226255-4226-1-git-send-email-vasilis.liaskovitis@profitbricks.com> References: <1348226255-4226-1-git-send-email-vasilis.liaskovitis@profitbricks.com> X-Gm-Message-State: ALoCoQlnCXA7IBV6OCWlkY2Q+gjP2Ld2ngmB5lm6zck3aZtvjsUw2/698ybj1ab3Kr+hL7fKV/f+ X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.214.45 Cc: Vasilis Liaskovitis , gleb@redhat.com, blauwirbel@gmail.com, kevin@koconnor.net, avi@redhat.com, anthony@codemonkey.ws, imammedo@redhat.com, eblake@redhat.com, kraxel@redhat.com Subject: [Qemu-devel] [RFC PATCH v3 09/19] pc: Add dimm paravirt SRAT info 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 The numa_fw_cfg paravirt interface is extended to include SRAT information for all hotplug-able dimms. There are 3 words for each hotplug-able memory slot, denoting start address, size and node proximity. The new info is appended after existing numa info, so that the fw_cfg layout does not break. This information is used by Seabios to build hotplug memory device objects at runtime. nb_numa_nodes is set to 1 by default (not 0), so that we always pass srat info to SeaBIOS. v1->v2: Dimm SRAT info (#dimms) is appended at end of existing numa fw_cfg in order not to break existing layout Documentation of the new fwcfg layout is included in docs/specs/fwcfg.txt Signed-off-by: Vasilis Liaskovitis --- docs/specs/fwcfg.txt | 28 ++++++++++++++++++++++++++++ hw/pc.c | 14 ++++++++++++-- 2 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 docs/specs/fwcfg.txt diff --git a/docs/specs/fwcfg.txt b/docs/specs/fwcfg.txt new file mode 100644 index 0000000..55f96d9 --- /dev/null +++ b/docs/specs/fwcfg.txt @@ -0,0 +1,28 @@ +QEMU<->BIOS Paravirt Documentation +-------------------------------------- + +This document describes paravirt data structures passed from QEMU to BIOS. + +FW_CFG_NUMA paravirt info +-------------------- +The SRAT info passed from QEMU to BIOS has the following layout: + +----------------------------------------------------------------------------------------------- +#nodes | cpu0_pxm | cpu1_pxm | ... | cpulast_pxm | node0_mem | node1_mem | ... | nodelast_mem + +----------------------------------------------------------------------------------------------- +#dimms | dimm0_start | dimm0_sz | dimm0_pxm | ... | dimmlast_start | dimmlast_sz | dimmlast_pxm + +Entry 0 contains the number of numa nodes (nb_numa_nodes). + +Entries 1..max_cpus: The next max_cpus entries describe node proximity for each +one of the vCPUs in the system. + +Entries max_cpus+1..max_cpus+nb_numa_nodes+1: The next nb_numa_nodes entries +describe the memory size for each one of the NUMA nodes in the system. + +Entry max_cpus+nb_numa_nodes+1 contains the number of memory dimms (nb_hp_dimms) + +The last 3 * nb_hp_dimms entries are organized in triplets: Each triplet contains +the physical address offset, size (in bytes), and node proximity for the +respective dimm. diff --git a/hw/pc.c b/hw/pc.c index 2c9664d..f2604ae 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -598,6 +598,7 @@ static void *bochs_bios_init(void) uint8_t *smbios_table; size_t smbios_len; uint64_t *numa_fw_cfg; + uint64_t *hp_dimms_fw_cfg; int i, j; register_ioport_write(0x400, 1, 2, bochs_bios_write, NULL); @@ -632,8 +633,10 @@ static void *bochs_bios_init(void) /* allocate memory for the NUMA channel: one (64bit) word for the number * of nodes, one word for each VCPU->node and one word for each node to * hold the amount of memory. + * Finally one word for the number of hotplug memory slots and three words + * for each hotplug memory slot (start address, size and node proximity). */ - numa_fw_cfg = g_malloc0((1 + max_cpus + nb_numa_nodes) * 8); + numa_fw_cfg = g_malloc0((2 + max_cpus + nb_numa_nodes + 3 * nb_hp_dimms) * 8); numa_fw_cfg[0] = cpu_to_le64(nb_numa_nodes); for (i = 0; i < max_cpus; i++) { for (j = 0; j < nb_numa_nodes; j++) { @@ -646,8 +649,15 @@ static void *bochs_bios_init(void) for (i = 0; i < nb_numa_nodes; i++) { numa_fw_cfg[max_cpus + 1 + i] = cpu_to_le64(node_mem[i]); } + + numa_fw_cfg[1 + max_cpus + nb_numa_nodes] = cpu_to_le64(nb_hp_dimms); + + hp_dimms_fw_cfg = numa_fw_cfg + 2 + max_cpus + nb_numa_nodes; + if (nb_hp_dimms) + setup_fwcfg_hp_dimms(hp_dimms_fw_cfg); + fw_cfg_add_bytes(fw_cfg, FW_CFG_NUMA, (uint8_t *)numa_fw_cfg, - (1 + max_cpus + nb_numa_nodes) * 8); + (2 + max_cpus + nb_numa_nodes + 3 * nb_hp_dimms) * 8); return fw_cfg; }