From: Thomas Huth <thuth@redhat.com>
To: Janosch Frank <frankja@linux.ibm.com>, qemu-devel@nongnu.org
Cc: borntraeger@de.ibm.com, cohuck@redhat.com, david@redhat.com
Subject: Re: [RFC v5 12/12] pc-bios: s390x: Cleanup jump to ipl code
Date: Thu, 25 Jun 2020 14:58:00 +0200 [thread overview]
Message-ID: <48329294-4c31-a1fa-20fb-ef6bb13e8550@redhat.com> (raw)
In-Reply-To: <20200624075226.92728-13-frankja@linux.ibm.com>
On 24/06/2020 09.52, Janosch Frank wrote:
> jump_to_IPL_code takes a 64 bit address, masks it with the short psw
> address mask and later branches to it using a full 64 bit register.
>
> * As the masking is not necessary, let's remove it
> * Without the mask we can save the ipl address to a static 64 bit
> function ptr as we later branch to it
> * Let's also clean up the variable names and remove the now unneeded
> ResetInfo
>
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
> pc-bios/s390-ccw/jump2ipl.c | 27 +++++++++++----------------
> 1 file changed, 11 insertions(+), 16 deletions(-)
>
> diff --git a/pc-bios/s390-ccw/jump2ipl.c b/pc-bios/s390-ccw/jump2ipl.c
> index 767012bf0c..aef37cea76 100644
> --- a/pc-bios/s390-ccw/jump2ipl.c
> +++ b/pc-bios/s390-ccw/jump2ipl.c
> @@ -13,20 +13,15 @@
> #define KERN_IMAGE_START 0x010000UL
> #define RESET_PSW_MASK (PSW_MASK_SHORTPSW | PSW_MASK_64)
>
> -typedef struct ResetInfo {
> - uint64_t ipl_psw;
> - uint32_t ipl_continue;
> -} ResetInfo;
> -
> -static ResetInfo save;
> +static void (*ipl_continue)(void);
> +static uint64_t psw_save;
I wonder whether there was a reason for having ipl_continue in the
lowcore instead of using a simple static function pointer... Christian,
do you remember?
> static void jump_to_IPL_2(void)
> {
> - ResetInfo *current = 0;
> + uint64_t *psw_current = 0;
Mhh, what about using uint64_t *psw_current = (uint64_t *)lowcore
instead, to make it more more explicit?
> - void (*ipl)(void) = (void *) (uint64_t) current->ipl_continue;
> - *current = save;
> - ipl(); /* should not return */
> + *psw_current = psw_save;
> + ipl_continue(); /* should not return */
> }
>
> void jump_to_IPL_code(uint64_t address)
> @@ -46,15 +41,15 @@ void jump_to_IPL_code(uint64_t address)
> * content of non-BIOS memory after we loaded the guest, so we
> * save the original content and restore it in jump_to_IPL_2.
> */
> - ResetInfo *current = 0;
> + uint64_t *psw_current = 0;
dito.
> - save = *current;
> + psw_save = *psw_current;
>
> - current->ipl_psw = (uint64_t) &jump_to_IPL_2;
> - current->ipl_psw |= RESET_PSW_MASK;
> - current->ipl_continue = address & PSW_MASK_SHORT_ADDR;
> + *psw_current = (uint64_t) &jump_to_IPL_2;
> + *psw_current |= RESET_PSW_MASK;
> + ipl_continue = (void *)address;
>
> - debug_print_int("set IPL addr to", current->ipl_continue);
> + debug_print_int("set IPL addr to", (uint64_t)ipl_continue);
>
> /* Ensure the guest output starts fresh */
> sclp_print("\n");
>
The patch sounds like a good idea to me ... but since this code proofed
to be very fragile in the past, let's wait for Christian to say whether
there was a good reason for ipl_continue in the lowcore or not.
Thomas
next prev parent reply other threads:[~2020-06-25 13:08 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-24 7:52 [PATCH v5 00/12] pc-bios: s390x: Cleanup part 1 Janosch Frank
2020-06-24 7:52 ` [PATCH v5 01/12] pc-bios: s390x: cio.c cleanup and compile fix Janosch Frank
2020-06-29 15:50 ` Cornelia Huck
2020-06-24 7:52 ` [PATCH v5 02/12] pc-bios: s390x: Consolidate timing functions into time.h Janosch Frank
2020-06-24 14:13 ` David Hildenbrand
2020-06-24 7:52 ` [PATCH v5 03/12] pc-bios: s390x: Move sleep and yield to helper.h Janosch Frank
2020-06-24 7:52 ` [PATCH v5 04/12] pc-bios: s390x: Get rid of magic offsets into the lowcore Janosch Frank
2020-06-25 10:26 ` Thomas Huth
2020-06-29 15:52 ` Cornelia Huck
2020-06-24 7:52 ` [PATCH v5 05/12] pc-bios: s390x: Remove unneeded dasd-ipl.c reset psw mask changes Janosch Frank
2020-06-25 10:57 ` Thomas Huth
2020-06-25 11:09 ` Thomas Huth
2020-06-24 7:52 ` [PATCH v5 06/12] pc-bios: s390x: Rename PSW_MASK_ZMODE to PSW_MASK_64 Janosch Frank
2020-06-25 11:05 ` Thomas Huth
2020-06-24 7:52 ` [PATCH v5 07/12] pc-bios: s390x: Use PSW masks where possible and introduce PSW_MASK_SHORT_ADDR Janosch Frank
2020-06-25 11:39 ` Thomas Huth
2020-06-24 7:52 ` [PATCH v5 08/12] pc-bios: s390x: Move panic() into header and add infinite loop Janosch Frank
2020-06-24 7:52 ` [PATCH v5 09/12] pc-bios: s390x: Use ebcdic2ascii table Janosch Frank
2020-06-24 7:52 ` [PATCH v5 10/12] pc-bios: s390x: Make u32 ptr check explicit Janosch Frank
2020-06-24 7:52 ` [PATCH v5 11/12] pc-bios: s390x: Fix bootmap.c passing PSWs as addresses Janosch Frank
2020-06-25 12:46 ` Thomas Huth
2020-06-26 8:02 ` Janosch Frank
2020-06-24 7:52 ` [RFC v5 12/12] pc-bios: s390x: Cleanup jump to ipl code Janosch Frank
2020-06-25 12:58 ` Thomas Huth [this message]
2020-06-26 8:04 ` Janosch Frank
2020-06-24 8:06 ` [PATCH v5 00/12] pc-bios: s390x: Cleanup part 1 no-reply
2020-06-24 10:44 ` Cornelia Huck
2020-06-24 10:46 ` Thomas Huth
2020-06-24 10:57 ` Janosch Frank
2020-06-30 8:48 ` Thomas Huth
2020-06-24 11:08 ` 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=48329294-4c31-a1fa-20fb-ef6bb13e8550@redhat.com \
--to=thuth@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=qemu-devel@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).