From patchwork Fri Sep 21 11:19:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasilis Liaskovitis X-Patchwork-Id: 1491451 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 65A7CDF28C for ; Fri, 21 Sep 2012 11:19:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933104Ab2IULTN (ORCPT ); Fri, 21 Sep 2012 07:19:13 -0400 Received: from mail-bk0-f46.google.com ([209.85.214.46]:34843 "EHLO mail-bk0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933102Ab2IULTL (ORCPT ); Fri, 21 Sep 2012 07:19:11 -0400 Received: by bkuw11 with SMTP id w11so744561bku.19 for ; Fri, 21 Sep 2012 04:19:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent :x-gm-message-state; bh=JZnGA4yBNvZSf9Ji4zkLal16/xcBuBNmg0867ghOeIA=; b=olYjxmsr4NnsVcEx9yX7f+dXEl2fbOAn4XNrwdNq3DAwcMcLCwM0J+vfGNXz7bsI4U L3cN1nduxyeCwCZZw4+t7kOwCPjOeMTbkvNZ26FmwKSsaCd82IWMyGPUL5DBrF3psfl5 oOHBUT5MO97sbSTeOP2ohe1KVn66VLfGXSspDXEOgqp9ZkWhv1KYb7S/7Cjn2LNkA8/U 8+Z35wSTUgJLVz8Ikt2MbEbHnieQ7Ou/1HLq7XGb/KKXTxgU9iOXJl98Xg0V6Bh/ZD84 DnZS41kk9+J5m/C6lW06m0qwgwt7XmzuTw3YNu4EO4SE2ctmExmekVh2N1IW8EXVYKIA gTXw== Received: by 10.204.15.195 with SMTP id l3mr1956518bka.66.1348226349892; Fri, 21 Sep 2012 04:19:09 -0700 (PDT) Received: from dhcp-192-168-178-175.profitbricks.localdomain ([62.217.45.26]) by mx.google.com with ESMTPS id p2sm6067824bkw.3.2012.09.21.04.19.09 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 21 Sep 2012 04:19:09 -0700 (PDT) Date: Fri, 21 Sep 2012 13:19:07 +0200 From: Vasilis Liaskovitis To: qemu-devel@nongnu.org, kvm@vger.kernel.org, seabios@seabios.org Cc: avi@redhat.com, anthony@codemonkey.ws, kevin@koconnor.net, wency@cn.fujitsu.com, kraxel@redhat.com, eblake@redhat.com, blauwirbel@gmail.com, gleb@redhat.com, imammedo@redhat.com Subject: [RFC PATCH v3 19/19] alternative: Introduce paravirt interface QEMU_CFG_PCI_WINDOW Message-ID: <20120921111907.GC2133@dhcp-192-168-178-175.profitbricks.localdomain> References: <1348226255-4226-1-git-send-email-vasilis.liaskovitis@profitbricks.com> <1348226255-4226-20-git-send-email-vasilis.liaskovitis@profitbricks.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1348226255-4226-20-git-send-email-vasilis.liaskovitis@profitbricks.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Gm-Message-State: ALoCoQki0OinmrGUIaocK9rKK0zAU/4RZ8w8BV8l89lLMZv7h07daFRbgXLffyY71V9+z4UY8EGf Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Qemu already calculates the 32-bit and 64-bit PCI starting offsets based on initial memory and hotplug-able dimms. This info needs to be passed to Seabios for PCI initialization. Signed-off-by: Vasilis Liaskovitis --- docs/specs/fwcfg.txt | 9 +++++++++ hw/fw_cfg.h | 1 + hw/pc_piix.c | 10 ++++++++++ 3 files changed, 20 insertions(+), 0 deletions(-) diff --git a/docs/specs/fwcfg.txt b/docs/specs/fwcfg.txt index 55f96d9..d9fa215 100644 --- a/docs/specs/fwcfg.txt +++ b/docs/specs/fwcfg.txt @@ -26,3 +26,12 @@ 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. + +FW_CFG_PCI_WINDOW paravirt info +-------------------- +QEMU passes the starting address for the 32-bit and 64-bit PCI windows to BIOS. +The following layouts are followed: + +-------------------------------- +pcimem32_start | pcimem64_start | +-------------------------------- diff --git a/hw/fw_cfg.h b/hw/fw_cfg.h index 856bf91..6c8c151 100644 --- a/hw/fw_cfg.h +++ b/hw/fw_cfg.h @@ -27,6 +27,7 @@ #define FW_CFG_SETUP_SIZE 0x17 #define FW_CFG_SETUP_DATA 0x18 #define FW_CFG_FILE_DIR 0x19 +#define FW_CFG_PCI_WINDOW 0x1a #define FW_CFG_FILE_FIRST 0x20 #define FW_CFG_FILE_SLOTS 0x10 diff --git a/hw/pc_piix.c b/hw/pc_piix.c index d1fd276..034761f 100644 --- a/hw/pc_piix.c +++ b/hw/pc_piix.c @@ -44,6 +44,7 @@ #include "memory.h" #include "exec-memory.h" #include "dimm.h" +#include "fw_cfg.h" #ifdef CONFIG_XEN # include #endif @@ -149,6 +150,7 @@ static void pc_init1(MemoryRegion *system_memory, MemoryRegion *pci_memory; MemoryRegion *rom_memory; void *fw_cfg = NULL; + uint64_t *pci_window_fw_cfg; pc_cpus_init(cpu_model); @@ -205,6 +207,14 @@ static void pc_init1(MemoryRegion *system_memory, ? 0 : ((uint64_t)1 << 62)), pci_memory, ram_memory); + + pci_window_fw_cfg = g_malloc0(2 * 8); + pci_window_fw_cfg[0] = cpu_to_le64(below_4g_mem_size + + below_4g_hp_mem_size); + pci_window_fw_cfg[1] = cpu_to_le64(0x100000000ULL + above_4g_mem_size + + above_4g_hp_mem_size); + fw_cfg_add_bytes(fw_cfg, FW_CFG_PCI_WINDOW, + (uint8_t *)pci_window_fw_cfg, 2 * 8); } else { pci_bus = NULL; i440fx_state = NULL;