qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Eric Farman <farman@linux.ibm.com>, Cornelia Huck <cohuck@redhat.com>
Cc: Jason Herne <jjherne@linux.ibm.com>,
	Janosch Frank <frankja@linux.ibm.com>,
	Matthew Rosato <mjrosato@linux.ibm.com>,
	qemu-devel@nongnu.org,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	qemu-s390x@nongnu.org, Jared Rossi <jrossi@linux.ibm.com>
Subject: Re: [PATCH 2/2] pc-bios: s390x: Give precedence to reset PSW
Date: Fri, 20 Nov 2020 07:02:38 +0100	[thread overview]
Message-ID: <ba74a91a-b9a9-111f-e94a-31c81a883ef0@redhat.com> (raw)
In-Reply-To: <7f99cc7c-f74d-0721-3749-515208526bb0@linux.ibm.com>

On 19/11/2020 22.11, Eric Farman wrote:
> 
> 
> On 11/19/20 3:20 PM, Thomas Huth wrote:
>> On 19/11/2020 17.57, Eric Farman wrote:
>>> Let's look at the Reset PSW first instead of the contents of memory.
>>> It might be leftover from an earlier system boot when processing
>>> a chreipl.
>>>
>>> Signed-off-by: Eric Farman <farman@linux.ibm.com>
>>> ---
>>>   pc-bios/s390-ccw/jump2ipl.c | 20 ++++++++++----------
>>>   1 file changed, 10 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/pc-bios/s390-ccw/jump2ipl.c b/pc-bios/s390-ccw/jump2ipl.c
>>> index fbae45b03c..67b4afb6a0 100644
>>> --- a/pc-bios/s390-ccw/jump2ipl.c
>>> +++ b/pc-bios/s390-ccw/jump2ipl.c
>>> @@ -72,16 +72,6 @@ void jump_to_IPL_code(uint64_t address)
>>>     void jump_to_low_kernel(void)
>>>   {
>>> -    /*
>>> -     * If it looks like a Linux binary, i.e. there is the "S390EP" magic
>>> from
>>> -     * arch/s390/kernel/head.S here, then let's jump to the well-known
>>> Linux
>>> -     * kernel start address (when jumping to the PSW-at-zero address
>>> instead,
>>> -     * the kernel startup code fails when we booted from a network device).
>>> -     */
>>> -    if (!memcmp((char *)0x10008, "S390EP", 6)) {
>>> -        jump_to_IPL_code(KERN_IMAGE_START);
>>> -    }
>>> -
>>>       /* Trying to get PSW at zero address */
>>>       if (*((uint64_t *)0) & RESET_PSW_MASK) {
>>>           /*
>>> @@ -92,6 +82,16 @@ void jump_to_low_kernel(void)
>>>           jump_to_IPL_code(0);
>>>       }
>>>   +    /*
>>> +     * If it looks like a Linux binary, i.e. there is the "S390EP" magic
>>> from
>>> +     * arch/s390/kernel/head.S here, then let's jump to the well-known
>>> Linux
>>> +     * kernel start address (when jumping to the PSW-at-zero address
>>> instead,
>>> +     * the kernel startup code fails when we booted from a network device).
>>> +     */
>>> +    if (!memcmp((char *)0x10008, "S390EP", 6)) {
>>> +        jump_to_IPL_code(KERN_IMAGE_START);
>>> +    }
>>
>> That feels a little bit dangerous ... I assume the order has been that way
>> for a reason, e.g. I think we had to jump to KERN_IMAGE_START for some older
>> versions of the Linux kernel since the startup code that was referenced by
>> the PSW at address zero was not working in KVM...
> 
> Makes sense.  It does seem like a precarious piece of code.
> 
>>
>> What do you think about this alternate idea instead: Clear the memory at
>> location 0x10008 at the very beginning of the main() function (or maybe in
>> boot_setup())? 
> 
> This seems to work too (I put it in boot_setup(), prior to call to
> store_iplb()).

Great, can you send the patch before your holidays next week? (If you don't
have enough time, that's ok, too, it's trivial enough, so I think I could
write such a patch, too)

 Thomas



  reply	other threads:[~2020-11-20  6:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-19 16:57 [PATCH 0/2] pc-bios/s390 fixes for reboot-to-vfio-ccw Eric Farman
2020-11-19 16:57 ` [PATCH 1/2] pc-bios: s390x: Ensure Read IPL memory is clean Eric Farman
2020-11-19 20:06   ` Thomas Huth
2020-11-20  8:26   ` Janosch Frank
2020-11-20 14:39     ` Eric Farman
2020-11-20  9:26   ` Cornelia Huck
2020-11-19 16:57 ` [PATCH 2/2] pc-bios: s390x: Give precedence to reset PSW Eric Farman
2020-11-19 20:20   ` Thomas Huth
2020-11-19 21:11     ` Eric Farman
2020-11-20  6:02       ` Thomas Huth [this message]
2020-11-20 14:38         ` Eric Farman
2020-11-19 17:52 ` [PATCH 0/2] pc-bios/s390 fixes for reboot-to-vfio-ccw 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=ba74a91a-b9a9-111f-e94a-31c81a883ef0@redhat.com \
    --to=thuth@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=farman@linux.ibm.com \
    --cc=frankja@linux.ibm.com \
    --cc=jjherne@linux.ibm.com \
    --cc=jrossi@linux.ibm.com \
    --cc=mjrosato@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    /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).