s390x: keep hint on virtio managing size
authorAlexander Graf <agraf@suse.de>
Wed, 13 Apr 2011 08:55:11 +0000 (10:55 +0200)
committerAlexander Graf <agraf@suse.de>
Fri, 20 May 2011 15:35:12 +0000 (17:35 +0200)
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 <agraf@suse.de>
hw/s390-virtio-bus.c
hw/s390-virtio-bus.h
target-s390x/cpu.h

index bb49e393ec8bdfa0c2e5447606a58abd1edf5c4b..d4a12f75318ed42fd2e059a37e9082bcb6e3551e 100644 (file)
@@ -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;
index edf6d045708d05a0a225e4e8fa92330ff4ac08d1..0c412d08e1510e53774da4a81546ba1a72dd20e6 100644 (file)
@@ -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;
index 79aa6c995f9a7f91c19e559a570e267b98cfc2f5..00939a3658f7bc7083946d383276dfaec54ab774 100644 (file)
@@ -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