From: David Hildenbrand <david@redhat.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>,
qemu-devel <qemu-devel@nongnu.org>,
Cornelia Huck <cohuck@redhat.com>
Cc: "Lukáš Doktor" <ldoktor@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Janosch Frank" <frankja@linux.ibm.com>,
"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
"Halil Pasic" <pasic@linux.ibm.com>,
qemu-s390x <qemu-s390x@nongnu.org>,
"Igor Mammedov" <imammedo@redhat.com>,
"Richard Henderson" <rth@twiddle.net>
Subject: Re: [PATCH v2] vl/s390: fixup ram sizes for compat machines
Date: Wed, 1 Apr 2020 14:04:17 +0200 [thread overview]
Message-ID: <ece23eb1-e977-55d8-ab7b-713f4af662ba@redhat.com> (raw)
In-Reply-To: <5f3f603e-6e1e-d157-554c-219e63fb438c@de.ibm.com>
> something like
>
> while ((sz >> increment_size) > MAX_STORAGE_INCREMENTS) {
> increment_size++;
> }
> newsz = sz >> increment_size << increment_size;
>
> if (sz != newsz) {
> qemu_printf("Ram size %" PRIu64 "MB was fixed up to %" PRIu64
Maybe warn_report()
> "MB to match machine restrictions. Consider updating "
> "the guest definition.\n",
> sz / MiB, newsz / MiB);
might be able to squeeze that into the previous line.
> }
> return newsz;
>
> ?
Much better.
>>
>>
>>> if (ret == -E2BIG) {
>>> error_setg(&err, "host supports a maximum of %" PRIu64 " GB",
>>> hw_limit / GiB);
>>> @@ -361,27 +361,20 @@ out:
>>> static void sclp_memory_init(SCLPDevice *sclp)
>>> {
>>> MachineState *machine = MACHINE(qdev_get_machine());
>>> + MachineClass *machine_class = MACHINE_GET_CLASS(qdev_get_machine());
>>> ram_addr_t initial_mem = machine->ram_size;
>>> int increment_size = 20;
>>>
>>> /* The storage increment size is a multiple of 1M and is a power of 2.
>>> - * The number of storage increments must be MAX_STORAGE_INCREMENTS or fewer.
>>> + * For some machine types, the number of storage increments must be
>>> + * MAX_STORAGE_INCREMENTS or fewer.
>>> * The variable 'increment_size' is an exponent of 2 that can be
>>> * used to calculate the size (in bytes) of an increment. */
>>> - while ((initial_mem >> increment_size) > MAX_STORAGE_INCREMENTS) {
>>> + while (machine_class->fixup_ram_size != NULL &&
>>> + (initial_mem >> increment_size) > MAX_STORAGE_INCREMENTS) {
>>> increment_size++;
>>> }
>>> sclp->increment_size = increment_size;
>>
>> IIRC one could define ram size in KB. Not sure if it is worth checking
>> against that.
>> [...]
>
> If this is not aligned to 1MB, that would already fail when registering the memslot, I think.
True, not sure how cryptic the error will be :)
LGTM
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2020-04-01 12:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-01 8:50 [PATCH v2] vl/s390: fixup ram sizes for compat machines Christian Borntraeger
2020-04-01 8:58 ` David Hildenbrand
2020-04-01 11:55 ` Christian Borntraeger
2020-04-01 12:04 ` David Hildenbrand [this message]
2020-04-01 12:07 ` Cornelia Huck
2020-04-01 10:13 ` Cornelia Huck
2020-04-01 11:01 ` Christian Borntraeger
2020-04-01 11:12 ` Cornelia Huck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ece23eb1-e977-55d8-ab7b-713f4af662ba@redhat.com \
--to=david@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=dgilbert@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=imammedo@redhat.com \
--cc=ldoktor@redhat.com \
--cc=pasic@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=rth@twiddle.net \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).