Skip to content

Commit df2ac21

Browse files
s390x: remember the maximum page size
Let's remember the value (successfully) set via s390_set_max_pagesize(). This will be helpful to reject hotplugged memory devices that would exceed this initially set page size. Handle it just like how we handle s390_get_memory_limit(), storing it in the machine, and moving the handling to machine code. Message-ID: <[email protected]> Acked-by: Michael S. Tsirkin <[email protected]> Reviewed-by: Thomas Huth <[email protected]> Signed-off-by: David Hildenbrand <[email protected]>
1 parent a056332 commit df2ac21

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

hw/s390x/s390-virtio-ccw.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,16 @@ static void s390_set_memory_limit(S390CcwMachineState *s390ms,
143143
s390ms->memory_limit = new_limit;
144144
}
145145

146+
static void s390_set_max_pagesize(S390CcwMachineState *s390ms,
147+
uint64_t pagesize)
148+
{
149+
assert(!s390ms->max_pagesize && pagesize);
150+
if (kvm_enabled()) {
151+
kvm_s390_set_max_pagesize(pagesize, &error_fatal);
152+
}
153+
s390ms->max_pagesize = pagesize;
154+
}
155+
146156
static void s390_memory_init(MachineState *machine)
147157
{
148158
S390CcwMachineState *s390ms = S390_CCW_MACHINE(machine);
@@ -191,7 +201,7 @@ static void s390_memory_init(MachineState *machine)
191201
* Configure the maximum page size. As no memory devices were created
192202
* yet, this is the page size of initial memory only.
193203
*/
194-
s390_set_max_pagesize(qemu_maxrampagesize(), &error_fatal);
204+
s390_set_max_pagesize(s390ms, qemu_maxrampagesize());
195205
/* Initialize storage key device */
196206
s390_skeys_init();
197207
/* Initialize storage attributes device */

include/hw/s390x/s390-virtio-ccw.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ struct S390CcwMachineState {
3030
bool pv;
3131
uint8_t loadparm[8];
3232
uint64_t memory_limit;
33+
uint64_t max_pagesize;
3334

3435
SCLPDevice *sclp;
3536
};

target/s390x/cpu-sysemu.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,6 @@ unsigned int s390_cpu_set_state(uint8_t cpu_state, S390CPU *cpu)
255255
return s390_count_running_cpus();
256256
}
257257

258-
void s390_set_max_pagesize(uint64_t pagesize, Error **errp)
259-
{
260-
if (kvm_enabled()) {
261-
kvm_s390_set_max_pagesize(pagesize, errp);
262-
}
263-
}
264-
265258
void s390_cmma_reset(void)
266259
{
267260
if (kvm_enabled()) {

target/s390x/cpu.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,6 @@ static inline void s390_do_cpu_load_normal(CPUState *cs, run_on_cpu_data arg)
881881

882882
/* cpu.c */
883883
void s390_crypto_reset(void);
884-
void s390_set_max_pagesize(uint64_t pagesize, Error **errp);
885884
void s390_cmma_reset(void);
886885
void s390_enable_css_support(S390CPU *cpu);
887886
void s390_do_cpu_set_diag318(CPUState *cs, run_on_cpu_data arg);

0 commit comments

Comments
 (0)