qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Halil Pasic <pasic@linux.ibm.com>, Thomas Huth <thuth@redhat.com>,
	Cornelia Huck <cohuck@redhat.com>,
	qemu-s390x@nongnu.org, qemu-devel@nongnu.org
Cc: Christian Borntraeger <borntraeger@de.ibm.com>,
	Viktor Mihajlovski <mihajlov@linux.ibm.com>,
	Marc Hartmayer <mhartmay@linux.ibm.com>,
	Janosch Frank <frankja@linux.ibm.com>,
	Richard Henderson <rth@twiddle.net>
Subject: Re: [PATCH 1/1] s390/ipl: sync back loadparm
Date: Tue, 25 Feb 2020 10:39:40 +0100	[thread overview]
Message-ID: <05f7dcf7-a0c7-8811-6b88-df86d5fa0974@redhat.com> (raw)
In-Reply-To: <20200224150213.21253-1-pasic@linux.ibm.com>

On 24.02.20 16:02, Halil Pasic wrote:
> We expose loadparm as a r/w machine property, but if loadparm is set by
> the guest via DIAG 308, we don't update the property. Having a
> disconnect between the guest view and the QEMU property is not nice in
> itself, but things get even worse for SCSI, where under certain
> circumstances (see 789b5a401b "s390: Ensure IPL from SCSI works as
> expected" for details) we call s390_gen_initial_iplb() on resets
> effectively overwriting the guest/user supplied loadparm with the stale
> value.
> 
> Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
> Fixes: 7104bae9de "hw/s390x: provide loadparm property for the machine"
> Reported-by: Marc Hartmayer <mhartmay@linux.ibm.com>
> Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
> Reviewed-by: Viktor Mihajlovski <mihajlov@linux.ibm.com>
> Tested-by: Marc Hartmayer <mhartmay@linux.ibm.com>
> ---
>  hw/s390x/ipl.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
> index 7773499d7f..97a279c1a5 100644
> --- a/hw/s390x/ipl.c
> +++ b/hw/s390x/ipl.c
> @@ -538,6 +538,26 @@ static bool is_virtio_scsi_device(IplParameterBlock *iplb)
>      return is_virtio_ccw_device_of_type(iplb, VIRTIO_ID_SCSI);
>  }
>  
> +static void update_machine_ipl_properties(IplParameterBlock *iplb)
> +{
> +    Object *mo = qdev_get_machine();

I'd just call this "machine".

> +
> +    /* Sync loadparm */
> +    if (iplb->flags & DIAG308_FLAGS_LP_VALID) {
> +        char ascii_loadparm[8];
> +        uint8_t *ebcdic_loadparm = iplb->loadparm;
> +        int i;
> +
> +        for (i = 0; i < 8 && ebcdic_loadparm[i]; i++) {
> +            ascii_loadparm[i] = ebcdic2ascii[(uint8_t) ebcdic_loadparm[i]];
> +        }
> +        ascii_loadparm[i] = 0;
> +        object_property_set_str(mo, ascii_loadparm, "loadparm", NULL);
> +    } else {
> +        object_property_set_str(mo, "", "loadparm", NULL);
> +    }

&error_abort instead of NULL, we certainly want to know if this would
ever surprisingly fail.

> +}
> +
>  void s390_ipl_update_diag308(IplParameterBlock *iplb)
>  {
>      S390IPLState *ipl = get_ipl_device();
> @@ -545,6 +565,7 @@ void s390_ipl_update_diag308(IplParameterBlock *iplb)
>      ipl->iplb = *iplb;
>      ipl->iplb_valid = true;
>      ipl->netboot = is_virtio_net_device(iplb);
> +    update_machine_ipl_properties(iplb);
>  }
>  

Somewhat I dislike this manual syncing (and converting back and forth),
but there seems to be no easy way around it.

-- 
Thanks,

David / dhildenb



  reply	other threads:[~2020-02-25  9:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-24 15:02 [PATCH 1/1] s390/ipl: sync back loadparm Halil Pasic
2020-02-25  9:39 ` David Hildenbrand [this message]
2020-02-25 11:56   ` Halil Pasic
2020-02-25 14:35     ` Viktor Mihajlovski
2020-02-25 14:47       ` Cornelia Huck
2020-03-05 12:44       ` Christian Borntraeger
2020-03-05 14:11         ` Halil Pasic
2020-03-05 14:25           ` Christian Borntraeger
2020-03-05 16:21             ` Christian Borntraeger
2020-03-06 13:57               ` Halil Pasic

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=05f7dcf7-a0c7-8811-6b88-df86d5fa0974@redhat.com \
    --to=david@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=mhartmay@linux.ibm.com \
    --cc=mihajlov@linux.ibm.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).