From: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
To: Thomas Huth <thuth@redhat.com>,
"Collin L. Walling" <walling@linux.vnet.ibm.com>,
qemu-s390x@nongnu.org, qemu-devel@nongnu.org
Cc: frankja@linux.vnet.ibm.com, cohuck@redhat.com, david@redhat.com,
alifm@linux.vnet.ibm.com, borntraeger@de.ibm.com,
eblake@redhat.com
Subject: Re: [Qemu-devel] [qemu-s390x] [PATCH v8 05/13] s390-ccw: move auxiliary IPL data to separate location
Date: Thu, 22 Feb 2018 09:38:42 +0100 [thread overview]
Message-ID: <971a8588-95fc-f569-3183-cfa0e2ce67c5@linux.vnet.ibm.com> (raw)
In-Reply-To: <022d14c9-8b5f-dc32-7efa-b3a53a7b898d@redhat.com>
On 22.02.2018 05:40, Thomas Huth wrote:
> On 21.02.2018 20:35, Collin L. Walling wrote:
>> The s390-ccw firmware needs some information in support of the
>> boot process which is not available on the native machine.
>> Examples are the netboot firmware load address and now the
>> boot menu parameters.
>>
>> While storing that data in unused fields of the IPL parameter block
>> works, that approach could create problems if the parameter block
>> definition should change in the future. Because then a guest could
>> overwrite these fields using the set IPLB diagnose.
>>
>> In fact the data in question is of more global nature and not really
>> tied to an IPL device, so separating it is rather logical.
>>
>> This commit introduces a new structure to hold firmware relevant
>> IPL parameters set by QEMU. The data is stored at location 204 (dec)
>> and can contain up to 7 32-bit words. This area is available to
>> programming in the z/Architecture Principles of Operation and
>> can thus safely be used by the firmware until the IPL has completed.
>>
>> Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
>> Signed-off-by: Collin L. Walling <walling@linux.vnet.ibm.com>
>> ---
>> hw/s390x/ipl.c | 18 +++++++++++++++++-
>> hw/s390x/ipl.h | 25 +++++++++++++++++++++++--
>> pc-bios/s390-ccw/iplb.h | 18 ++++++++++++++++--
>> pc-bios/s390-ccw/main.c | 6 +++++-
>> 4 files changed, 61 insertions(+), 6 deletions(-)
>>
>> diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
>> index 0d06fc1..79f5a58 100644
>> --- a/hw/s390x/ipl.c
>> +++ b/hw/s390x/ipl.c
>> @@ -399,6 +399,21 @@ void s390_reipl_request(void)
>> qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
>> }
>>
>> +static void s390_ipl_prepare_qipl(S390CPU *cpu)
>> +{
>> + S390IPLState *ipl = get_ipl_device();
>> + uint8_t *addr;
>> + uint64_t len = 4096;
>> +
>> + addr = cpu_physical_memory_map(cpu->env.psa, &len, 1);
>> + if (!addr || len < QIPL_ADDRESS + sizeof(QemuIplParameters)) {
>> + error_report("Cannot set QEMU IPL parameters");
>> + return;
>> + }
>> + memcpy(addr + QIPL_ADDRESS, &ipl->qipl, sizeof(QemuIplParameters));
>> + cpu_physical_memory_unmap(addr, len, 1, len);
>> +}
>> +
>> void s390_ipl_prepare_cpu(S390CPU *cpu)
>> {
>> S390IPLState *ipl = get_ipl_device();
>> @@ -418,8 +433,9 @@ void s390_ipl_prepare_cpu(S390CPU *cpu)
>> error_report_err(err);
>> vm_stop(RUN_STATE_INTERNAL_ERROR);
>> }
>> - ipl->iplb.ccw.netboot_start_addr = cpu_to_be64(ipl->start_addr);
>> + ipl->qipl.netboot_start_addr = cpu_to_be64(ipl->start_addr);
>> }
>> + s390_ipl_prepare_qipl(cpu);
>> }
>>
>> static void s390_ipl_reset(DeviceState *dev)
>> diff --git a/hw/s390x/ipl.h b/hw/s390x/ipl.h
>> index 8a705e0..08926a3 100644
>> --- a/hw/s390x/ipl.h
>> +++ b/hw/s390x/ipl.h
>> @@ -16,8 +16,7 @@
>> #include "cpu.h"
>>
>> struct IplBlockCcw {
>> - uint64_t netboot_start_addr;
>> - uint8_t reserved0[77];
>> + uint8_t reserved0[85];
>> uint8_t ssid;
>> uint16_t devno;
>> uint8_t vm_flags;
>> @@ -90,6 +89,27 @@ void s390_ipl_prepare_cpu(S390CPU *cpu);
>> IplParameterBlock *s390_ipl_get_iplb(void);
>> void s390_reipl_request(void);
>>
>> +#define QIPL_ADDRESS 0xcc
>> +
>> +/*
>> + * The QEMU IPL Parameters will be stored at absolute address
>> + * 204 (0xcc) which means it is 32-bit word aligned but not
>> + * double-word aligned.
>> + * Placement of data fields in this area must account for
>> + * their alignment needs. E.g., netboot_start_address must
>> + * have an offset of n * 8 bytes within the struct in order
>> + * to keep it double-word aligned.
>
> Should that rather be "4 + n * 8" instead of "n * 8" ?
I wonder if I ever get that comment right. You're correct of course.
>
> Apart from that, patch looks good to me now, so once you've fixed the
> comment (if necessary):
>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
>
--
Regards,
Viktor Mihajlovski
next prev parent reply other threads:[~2018-02-22 8:38 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-21 19:35 [Qemu-devel] [PATCH v8 00/13] Interactive Boot Menu for DASD and SCSI Guests on s390x Collin L. Walling
2018-02-21 19:35 ` [Qemu-devel] [PATCH v8 01/13] s390-ccw: refactor boot map table code Collin L. Walling
2018-02-21 19:35 ` [Qemu-devel] [PATCH v8 02/13] s390-ccw: refactor eckd_block_num to use CHS Collin L. Walling
2018-02-21 19:35 ` [Qemu-devel] [PATCH v8 03/13] s390-ccw: refactor IPL structs Collin L. Walling
2018-02-21 19:35 ` [Qemu-devel] [PATCH v8 04/13] s390-ccw: update libc Collin L. Walling
2018-02-22 4:30 ` [Qemu-devel] [qemu-s390x] " Thomas Huth
2018-02-21 19:35 ` [Qemu-devel] [PATCH v8 05/13] s390-ccw: move auxiliary IPL data to separate location Collin L. Walling
2018-02-22 4:40 ` [Qemu-devel] [qemu-s390x] " Thomas Huth
2018-02-22 8:38 ` Viktor Mihajlovski [this message]
2018-02-21 19:35 ` [Qemu-devel] [PATCH v8 06/13] s390-ccw: parse and set boot menu options Collin L. Walling
2018-02-22 5:32 ` [Qemu-devel] [qemu-s390x] " Thomas Huth
2018-02-21 19:35 ` [Qemu-devel] [PATCH v8 07/13] s390-ccw: set up interactive boot menu parameters Collin L. Walling
2018-02-21 19:35 ` [Qemu-devel] [PATCH v8 08/13] s390-ccw: read stage2 boot loader data to find menu Collin L. Walling
2018-02-21 19:35 ` [Qemu-devel] [PATCH v8 09/13] s390-ccw: print zipl boot menu Collin L. Walling
2018-02-21 19:35 ` [Qemu-devel] [PATCH v8 10/13] s390-ccw: read user input for boot index via the SCLP console Collin L. Walling
2018-02-21 19:35 ` [Qemu-devel] [PATCH v8 11/13] s390-ccw: set cp_receive mask only when needed and consume pending service irqs Collin L. Walling
2018-02-22 6:19 ` [Qemu-devel] [qemu-s390x] " Thomas Huth
2018-02-21 19:35 ` [Qemu-devel] [PATCH v8 12/13] s390-ccw: use zipl values when no boot menu options are present Collin L. Walling
2018-02-22 6:27 ` [Qemu-devel] [qemu-s390x] " Thomas Huth
2018-02-21 19:35 ` [Qemu-devel] [PATCH v8 13/13] s390-ccw: interactive boot menu for scsi Collin L. Walling
2018-02-22 6:34 ` [Qemu-devel] [qemu-s390x] " Thomas Huth
2018-02-22 11:51 ` [Qemu-devel] [PATCH v8 00/13] Interactive Boot Menu for DASD and SCSI Guests on s390x Christian Borntraeger
2018-02-22 12:23 ` Viktor Mihajlovski
2018-02-22 15:40 ` [Qemu-devel] [qemu-s390x] " Collin L. Walling
2018-02-22 15:44 ` Christian Borntraeger
2018-02-22 16:45 ` Collin L. Walling
2018-02-22 19:40 ` Collin L. Walling
2018-02-23 10:07 ` Thomas Huth
2018-02-23 10:11 ` Christian Borntraeger
2018-02-23 14:57 ` Collin L. Walling
2018-02-23 14:59 ` Collin L. Walling
2018-02-23 15:01 ` Christian Borntraeger
2018-02-22 12:42 ` Thomas Huth
2018-02-23 8:53 ` [Qemu-devel] " Christian Borntraeger
2018-02-23 10:17 ` Thomas Huth
2018-02-23 11:50 ` Viktor Mihajlovski
2018-02-23 13:33 ` Thomas Huth
2018-02-23 15:03 ` Collin L. Walling
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=971a8588-95fc-f569-3183-cfa0e2ce67c5@linux.vnet.ibm.com \
--to=mihajlov@linux.vnet.ibm.com \
--cc=alifm@linux.vnet.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=eblake@redhat.com \
--cc=frankja@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=thuth@redhat.com \
--cc=walling@linux.vnet.ibm.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).