From patchwork Tue Dec 18 12:41:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasilis Liaskovitis X-Patchwork-Id: 207132 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 8F0C92C0080 for ; Wed, 19 Dec 2012 01:22:14 +1100 (EST) Received: from localhost ([::1]:57361 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkwW9-0000uE-5I for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2012 07:43:29 -0500 Received: from eggs.gnu.org ([208.118.235.92]:46244) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkwVQ-0008Sl-4C for qemu-devel@nongnu.org; Tue, 18 Dec 2012 07:42:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TkwVO-0008Vj-9i for qemu-devel@nongnu.org; Tue, 18 Dec 2012 07:42:43 -0500 Received: from mail-bk0-f52.google.com ([209.85.214.52]:50512) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkwVN-0008VU-MS for qemu-devel@nongnu.org; Tue, 18 Dec 2012 07:42:42 -0500 Received: by mail-bk0-f52.google.com with SMTP id w5so285720bku.39 for ; Tue, 18 Dec 2012 04:42:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=3pjFcXQgivgcQjV3gjrZLqwfEzCKKcCPffQVSqb5f9s=; b=A+bgPBGIY1IdUIlv1ZvXV2+wsREvf7sIgKuE1EoL5MKZg7XYWMhGNkW815swfNt2hZ oXnkcb7S5suLT+oE9CssC9JquKsrJfvCcnXKP800hc9O3yOCovvf5ceIoRkQi0Egw0FX fqCH1odim0a9be3lHQwYkwrChmTyM4qLsLiGrVL7L+x6idn0pPLb7Qa1jU1T61eFU/PM apXyelFCKAcwGo8hhQfV83Wd+Ja4AvGYEqAMerLDPV7IINokkGdVR26cT8TwN9su3OER CJ3utXZkjeqZrUaHAgFVxO47MZu0CzMwyshWx8xYmAy0k5qmiDh9pfOwqvUVsXwdWc9Q D2+g== X-Received: by 10.204.148.134 with SMTP id p6mr652320bkv.75.1355834560694; Tue, 18 Dec 2012 04:42:40 -0800 (PST) Received: from dhcp-192-168-178-175.ri.profitbricks.localdomain ([62.217.45.26]) by mx.google.com with ESMTPS id f24sm1169954bkv.7.2012.12.18.04.42.38 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 18 Dec 2012 04:42:39 -0800 (PST) From: Vasilis Liaskovitis To: qemu-devel@nongnu.org, seabios@seabios.org Date: Tue, 18 Dec 2012 13:41:46 +0100 Message-Id: <1355834518-17989-19-git-send-email-vasilis.liaskovitis@profitbricks.com> X-Mailer: git-send-email 1.7.9 In-Reply-To: <1355834518-17989-1-git-send-email-vasilis.liaskovitis@profitbricks.com> References: <1355834518-17989-1-git-send-email-vasilis.liaskovitis@profitbricks.com> X-Gm-Message-State: ALoCoQkRC6lRNvCWyiMgX73s3PYS/LU4QBHG38PUiVRP4Q1TFdZHHE8iyfBbGrhLXrhpiSHUSevj X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.214.52 Cc: Vasilis Liaskovitis , pingfank@linux.vnet.ibm.com, gleb@redhat.com, stefanha@gmail.com, jbaron@redhat.com, blauwirbel@gmail.com, kevin@koconnor.net, kraxel@redhat.com, anthony@codemonkey.ws Subject: [Qemu-devel] [RFC PATCH v4 18/30] Introduce paravirt interface QEMU_CFG_PCI_WINDOW 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 Qemu 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 --- hw/fw_cfg.h | 1 + hw/pc_piix.c | 10 ++++++++++ hw/pc_q35.c | 9 +++++++++ 3 files changed, 20 insertions(+), 0 deletions(-) diff --git a/hw/fw_cfg.h b/hw/fw_cfg.h index 619a394..8b48493 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 1a99852..b6633e8 100644 --- a/hw/pc_piix.c +++ b/hw/pc_piix.c @@ -48,6 +48,7 @@ # include #endif #include "piix_pci.h" +#include "fw_cfg.h" #define MAX_IDE_BUS 2 @@ -86,6 +87,7 @@ static void pc_init1(MemoryRegion *system_memory, MemoryRegion *pci_memory; MemoryRegion *rom_memory; void *fw_cfg = NULL; + uint64_t *pci_window_fw_cfg; I440FXState *i440fx_host; PIIX3State *piix3; @@ -141,6 +143,14 @@ static void pc_init1(MemoryRegion *system_memory, qdev_init_nofail(DEVICE(i440fx_host)); bochs_meminfo_bios_init(fw_cfg); + + pci_window_fw_cfg = g_malloc0(2 * 8); + pci_window_fw_cfg[0] = cpu_to_le64(i440fx_host->mch.below_4g_mem_size); + pci_window_fw_cfg[1] = cpu_to_le64(0x100000000ULL + + i440fx_host->mch.above_4g_mem_size); + fw_cfg_add_bytes(fw_cfg, FW_CFG_PCI_WINDOW, + (uint8_t *)pci_window_fw_cfg, 2 * 8); + i440fx_state = &i440fx_host->mch; pci_bus = i440fx_host->parent_obj.bus; /* Xen supports additional interrupt routes from the PCI devices to diff --git a/hw/pc_q35.c b/hw/pc_q35.c index 7ce0b53..e35814a 100644 --- a/hw/pc_q35.c +++ b/hw/pc_q35.c @@ -87,6 +87,7 @@ static void pc_q35_init(QEMUMachineInitArgs *args) PCIDevice *ahci; qemu_irq *cmos_s3; void *fw_cfg = NULL; + uint64_t *pci_window_fw_cfg; pc_cpus_init(cpu_model); @@ -139,6 +140,14 @@ static void pc_q35_init(QEMUMachineInitArgs *args) /* pci */ qdev_init_nofail(DEVICE(q35_host)); bochs_meminfo_bios_init(fw_cfg); + + pci_window_fw_cfg = g_malloc0(2 * 8); + pci_window_fw_cfg[0] = cpu_to_le64(MCH_HOST_BRIDGE_PCIEXBAR_DEFAULT); + pci_window_fw_cfg[1] = cpu_to_le64(0x100000000ULL + + q35_host->mch.above_4g_mem_size); + fw_cfg_add_bytes(fw_cfg, FW_CFG_PCI_WINDOW, + (uint8_t *)pci_window_fw_cfg, 2 * 8); + host_bus = q35_host->host.pci.bus; /* create ISA bus */ lpc = pci_create_simple_multifunction(host_bus, PCI_DEVFN(ICH9_LPC_DEV,