summary refs log tree commit diff stats
path: root/include/hw/s390x
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2024-12-19 15:41:07 +0100
committerDavid Hildenbrand <david@redhat.com>2024-12-21 15:59:59 +0100
commit27221b69a3ea49339a1f82b9622126f3928e0915 (patch)
tree007331160db0ffde936775c1d0c7a121cd415f36 /include/hw/s390x
parent3c6fb557d295949bea291c3bf88ee9c83392e78c (diff)
downloadfocaccia-qemu-27221b69a3ea49339a1f82b9622126f3928e0915.tar.gz
focaccia-qemu-27221b69a3ea49339a1f82b9622126f3928e0915.zip
s390x: introduce s390_get_memory_limit()
Let's add s390_get_memory_limit(), to query what has been successfully
set via s390_set_memory_limit(). Allow setting the limit only once.

We'll remember the limit in the machine state. Move
s390_set_memory_limit() to machine code, merging it into
set_memory_limit(), because this really is a machine property.

Message-ID: <20241219144115.2820241-7-david@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Diffstat (limited to 'include/hw/s390x')
-rw-r--r--include/hw/s390x/s390-virtio-ccw.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/hw/s390x/s390-virtio-ccw.h b/include/hw/s390x/s390-virtio-ccw.h
index 996864a34e..de04336c5a 100644
--- a/include/hw/s390x/s390-virtio-ccw.h
+++ b/include/hw/s390x/s390-virtio-ccw.h
@@ -29,10 +29,18 @@ struct S390CcwMachineState {
     bool dea_key_wrap;
     bool pv;
     uint8_t loadparm[8];
+    uint64_t memory_limit;
 
     SCLPDevice *sclp;
 };
 
+static inline uint64_t s390_get_memory_limit(S390CcwMachineState *s390ms)
+{
+    /* We expect to be called only after the limit was set. */
+    assert(s390ms->memory_limit);
+    return s390ms->memory_limit;
+}
+
 #define S390_PTF_REASON_NONE (0x00 << 8)
 #define S390_PTF_REASON_DONE (0x01 << 8)
 #define S390_PTF_REASON_BUSY (0x02 << 8)