From patchwork Wed May 4 12:09:33 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 94021 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6F5E7B6EEC for ; Wed, 4 May 2011 22:13:18 +1000 (EST) Received: from localhost ([::1]:42879 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QHax6-00029W-UB for incoming@patchwork.ozlabs.org; Wed, 04 May 2011 08:13:12 -0400 Received: from eggs.gnu.org ([140.186.70.92]:41804) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QHats-0005VH-IG for qemu-devel@nongnu.org; Wed, 04 May 2011 08:09:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QHatl-00086O-OR for qemu-devel@nongnu.org; Wed, 04 May 2011 08:09:52 -0400 Received: from cantor2.suse.de ([195.135.220.15]:46094 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QHatl-00084x-FT for qemu-devel@nongnu.org; Wed, 04 May 2011 08:09:45 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) by mx2.suse.de (Postfix) with ESMTP id CEB338765C; Wed, 4 May 2011 14:09:42 +0200 (CEST) From: Alexander Graf To: QEMU-devel Developers Date: Wed, 4 May 2011 14:09:33 +0200 Message-Id: <1304510982-30810-5-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1304510982-30810-1-git-send-email-agraf@suse.de> References: <1304510982-30810-1-git-send-email-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.15 Cc: peter.maydell@linaro.org, jan.kiszka@siemens.com, Aurelien Jarno , Richard Henderson Subject: [Qemu-devel] [PATCH 04/13] s390x: keep hint on virtio managing size 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 s390x virtio bus keeps management information on virtio after the top of the guest's RAM. We need to be able to tell the guest the size of its RAM (without virtio stuff), but also be able to trap when the guest accesses RAM outside of its scope (including virtio stuff). So we need a variable telling us the size of the virtio stuff, so we can calculate the highest available RAM address from that. While at it, also increase the maximum number of virtio pages, so we play along well with more recent kernels that spawn a ridiculous number of virtio console adapters. Signed-off-by: Alexander Graf --- v4 -> v5: - make virtio_size const --- hw/s390-virtio-bus.c | 3 +++ hw/s390-virtio-bus.h | 2 +- target-s390x/cpu.h | 3 +++ 3 files changed, 7 insertions(+), 1 deletions(-) diff --git a/hw/s390-virtio-bus.c b/hw/s390-virtio-bus.c index bb49e39..d4a12f7 100644 --- a/hw/s390-virtio-bus.c +++ b/hw/s390-virtio-bus.c @@ -60,6 +60,9 @@ static const VirtIOBindings virtio_s390_bindings; static ram_addr_t s390_virtio_device_num_vq(VirtIOS390Device *dev); +/* length of VirtIO device pages */ +const target_phys_addr_t virtio_size = S390_DEVICE_PAGES * TARGET_PAGE_SIZE; + VirtIOS390Bus *s390_virtio_bus_init(ram_addr_t *ram_size) { VirtIOS390Bus *bus; diff --git a/hw/s390-virtio-bus.h b/hw/s390-virtio-bus.h index edf6d04..0c412d0 100644 --- a/hw/s390-virtio-bus.h +++ b/hw/s390-virtio-bus.h @@ -33,7 +33,7 @@ #define VIRTIO_VQCONFIG_LEN 24 #define VIRTIO_RING_LEN (TARGET_PAGE_SIZE * 3) -#define S390_DEVICE_PAGES 256 +#define S390_DEVICE_PAGES 512 typedef struct VirtIOS390Device { DeviceState qdev; diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h index 79aa6c9..00939a3 100644 --- a/target-s390x/cpu.h +++ b/target-s390x/cpu.h @@ -310,6 +310,9 @@ static inline void kvm_s390_interrupt_internal(CPUState *env, int type, #endif CPUState *s390_cpu_addr2state(uint16_t cpu_addr); +/* from s390-virtio-bus */ +extern const target_phys_addr_t virtio_size; + #ifndef KVM_S390_SIGP_STOP #define KVM_S390_SIGP_STOP 0 #define KVM_S390_PROGRAM_INT 0