From: Janosch Frank <frankja@linux.ibm.com>
To: Thomas Huth <thuth@redhat.com>, qemu-devel@nongnu.org
Cc: borntraeger@de.ibm.com, qemu-s390x@nongnu.org, cohuck@redhat.com,
david@redhat.com
Subject: Re: [PATCH v4 5/9] pc-bios: s390x: Rename and use PSW_MASK_ZMODE constant
Date: Mon, 22 Jun 2020 15:01:00 +0200 [thread overview]
Message-ID: <85aa0f86-a83a-6d1f-6c4d-26f62daee975@linux.ibm.com> (raw)
In-Reply-To: <5990e65c-732a-e3c1-bd4c-1fb870e8f567@redhat.com>
[-- Attachment #1.1: Type: text/plain, Size: 3350 bytes --]
On 6/22/20 1:40 PM, Thomas Huth wrote:
> On 22/06/2020 09.42, Janosch Frank wrote:
>> ZMODE has a lot of ambiguity with the ESAME architecture mode, but is
>> actually 64 bit addressing.
>>
>> As PSW_MASK_64 is now effectively 33 bit long and the PSWLegacy struct
>> has 2 32 bit members, let's also use a unsigned long pointer in
>> dasd-ipl.c instead when oring the constant into a 8 byte PSW.
>>
>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
>> Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>
>> Reviewed-by: David Hildenbrand <david@redhat.com>
>> ---
>> pc-bios/s390-ccw/dasd-ipl.c | 5 ++---
>> pc-bios/s390-ccw/s390-arch.h | 2 +-
>> 2 files changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/pc-bios/s390-ccw/dasd-ipl.c b/pc-bios/s390-ccw/dasd-ipl.c
>> index 0fc879bb8e..0dbad051a2 100644
>> --- a/pc-bios/s390-ccw/dasd-ipl.c
>> +++ b/pc-bios/s390-ccw/dasd-ipl.c
>> @@ -206,7 +206,7 @@ static void run_ipl2(SubChannelId schid, uint16_t cutype, uint32_t addr)
>> */
>> void dasd_ipl(SubChannelId schid, uint16_t cutype)
>> {
>> - PSWLegacy *pswl = (PSWLegacy *) 0x00;
>> + unsigned long *pswl = 0x0;
>
> ... or we could use the "lowcore" pointer from s390-arch.h ... though
> that's PSWLegacy again...
>
>> uint32_t ipl2_addr;
>>
>> /* Construct Read IPL CCW and run it to read IPL1 from boot disk */
>> @@ -229,7 +229,6 @@ void dasd_ipl(SubChannelId schid, uint16_t cutype)
>> run_ipl2(schid, cutype, ipl2_addr);
>>
>> /* Transfer control to the guest operating system */
>> - pswl->mask |= PSW_MASK_EAMODE; /* Force z-mode */
>
> Wait, PSW_MASK_EAMODE was 0x0000000100000000 and ->mask was only a
> 32-bit value ... how was that ever supposed to work correctly?
>
>> - pswl->addr |= PSW_MASK_BAMODE; /* ... */
>> + *pswl |= PSW_MASK_64; /* Force 64 bit addressing */
>
> So is this even a bug fix and not only a cosmetic change?
>
> ... the whole logic here looks fishy to me ... do we need this PSW
> modification at all? Shouldn't the guest decide which mode it wants to
> use in its startup code?
>
> Thomas
Looking at jump_to_low_kernel(), jump_to_IPL_code and jump_to_IPL_2 I
think we can remove this line completely.
jump_to_IPL_code() prepares its own PSW and jumps to jump_to_IPL_2() via
diag308 subcode 1.
jump_to_IPL_2() fetches the saved PSW and does a br to the PSW address
so the mask completely goes to waste anyway.
DASD passthrough is rarely used so nobody looks at that code anymore. I
need to ask Jason about the intention behind those lines.
>
>
>> jump_to_low_kernel();
>> }
>> diff --git a/pc-bios/s390-ccw/s390-arch.h b/pc-bios/s390-ccw/s390-arch.h
>> index 5f36361c02..73852029d4 100644
>> --- a/pc-bios/s390-ccw/s390-arch.h
>> +++ b/pc-bios/s390-ccw/s390-arch.h
>> @@ -29,7 +29,7 @@ _Static_assert(sizeof(struct PSWLegacy) == 8, "PSWLegacy size incorrect");
>> #define PSW_MASK_WAIT 0x0002000000000000ULL
>> #define PSW_MASK_EAMODE 0x0000000100000000ULL
>> #define PSW_MASK_BAMODE 0x0000000080000000ULL
>> -#define PSW_MASK_ZMODE (PSW_MASK_EAMODE | PSW_MASK_BAMODE)
>> +#define PSW_MASK_64 (PSW_MASK_EAMODE | PSW_MASK_BAMODE)
>>
>> /* Low core mapping */
>> typedef struct LowCore {
>>
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2020-06-22 13:02 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-22 7:42 [PATCH v4 0/9] pc-bios: s390x: Cleanup part 1 Janosch Frank
2020-06-22 7:42 ` [PATCH v4 1/9] pc-bios: s390x: cio.c cleanup and compile fix Janosch Frank
2020-06-22 7:42 ` [PATCH v4 2/9] pc-bios: s390x: Consolidate timing functions into time.h Janosch Frank
2020-06-22 10:02 ` Thomas Huth
2020-06-22 10:04 ` Thomas Huth
2020-06-22 7:42 ` [PATCH v4 3/9] pc-bios: s390x: Move sleep and yield to helper.h Janosch Frank
2020-06-22 10:05 ` Thomas Huth
2020-06-22 11:10 ` David Hildenbrand
2020-06-22 7:42 ` [PATCH v4 4/9] pc-bios: s390x: Get rid of magic offsets into the lowcore Janosch Frank
2020-06-22 7:42 ` [PATCH v4 5/9] pc-bios: s390x: Rename and use PSW_MASK_ZMODE constant Janosch Frank
2020-06-22 11:40 ` Thomas Huth
2020-06-22 13:01 ` Janosch Frank [this message]
2020-06-22 7:42 ` [PATCH v4 6/9] pc-bios: s390x: Use PSW masks where possible and introduce PSW_MASK_SHORT_ADDR Janosch Frank
2020-06-22 7:42 ` [PATCH v4 7/9] pc-bios: s390x: Move panic() into header and add infinite loop Janosch Frank
2020-06-22 11:48 ` Thomas Huth
2020-06-22 7:42 ` [PATCH v4 8/9] pc-bios: s390x: Use ebcdic2ascii table Janosch Frank
2020-06-22 7:42 ` [PATCH v4 9/9] pc-bios: s390x: Make u32 ptr check explicit Janosch Frank
2020-06-22 8:06 ` [PATCH v4 0/9] pc-bios: s390x: Cleanup part 1 no-reply
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=85aa0f86-a83a-6d1f-6c4d-26f62daee975@linux.ibm.com \
--to=frankja@linux.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--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).