From: Cornelia Huck <cohuck@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>,
borntraeger@de.ibm.com, agraf@suse.de, rth@twiddle.net,
david@redhat.com, qemu-devel@nongnu.org, qemu-s390x@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/3] s390: Refactor IPL parameter block generation
Date: Fri, 6 Apr 2018 11:34:24 +0200 [thread overview]
Message-ID: <20180406113424.05b82448.cohuck@redhat.com> (raw)
In-Reply-To: <ad080c45-9bbe-43e3-1482-b291dd249a75@redhat.com>
On Fri, 6 Apr 2018 09:52:35 +0200
Thomas Huth <thuth@redhat.com> wrote:
> On 05.04.2018 17:07, Viktor Mihajlovski wrote:
> > Splitting out the the CCW device extraction allows reuse.
> >
> > Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
> > ---
> > hw/s390x/ipl.c | 81 ++++++++++++++++++++++++++++++++++++----------------------
> > 1 file changed, 51 insertions(+), 30 deletions(-)
> >
> > diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
> > index fdeaec3..58e33c5 100644
> > --- a/hw/s390x/ipl.c
> > +++ b/hw/s390x/ipl.c
> > @@ -279,44 +279,52 @@ static void s390_ipl_set_boot_menu(S390IPLState *ipl)
> > *timeout = cpu_to_be32(splash_time);
> > }
> >
> > +static CcwDevice *s390_get_ccw_device(DeviceState *dev_st)
> > +{
> > + CcwDevice *ccw_dev = NULL;
> > +
> > + if (dev_st) {
> > + VirtioCcwDevice *virtio_ccw_dev = (VirtioCcwDevice *)
> > + object_dynamic_cast(OBJECT(qdev_get_parent_bus(dev_st)->parent),
> > + TYPE_VIRTIO_CCW_DEVICE);
> > + if (virtio_ccw_dev) {
> > + ccw_dev = CCW_DEVICE(virtio_ccw_dev);
> > + } else {
> > + SCSIDevice *sd = (SCSIDevice *)
> > + object_dynamic_cast(OBJECT(dev_st),
> > + TYPE_SCSI_DEVICE);
> > + if (sd) {
> > + SCSIBus *bus = scsi_bus_from_device(sd);
> > + VirtIOSCSI *vdev = container_of(bus, VirtIOSCSI, bus);
> > + VirtIOSCSICcw *scsi_ccw = container_of(vdev, VirtIOSCSICcw,
> > + vdev);
> > +
> > + ccw_dev = (CcwDevice *)object_dynamic_cast(OBJECT(scsi_ccw),
> > + TYPE_CCW_DEVICE);
> > + }
> > + }
> > + }
> > + return ccw_dev;
> > +}
> > +
> > static bool s390_gen_initial_iplb(S390IPLState *ipl)
> > {
> > DeviceState *dev_st;
> > + CcwDevice *ccw_dev = NULL;
> >
> > dev_st = get_boot_device(0);
> > if (dev_st) {
> > - VirtioCcwDevice *virtio_ccw_dev = (VirtioCcwDevice *)
> > - object_dynamic_cast(OBJECT(qdev_get_parent_bus(dev_st)->parent),
> > - TYPE_VIRTIO_CCW_DEVICE);
> > + ccw_dev = s390_get_ccw_device(dev_st);
> > + }
> > +
> > + /*
> > + * Currently allow IPL only from CCW devices.
> > + */
> > + if (ccw_dev) {
> > SCSIDevice *sd = (SCSIDevice *) object_dynamic_cast(OBJECT(dev_st),
> > TYPE_SCSI_DEVICE);
>
> The SCSIDevice dynamic cast now has to be done twice ... but I guess
> that's ok (we're only doing this for the boot device, so it this should
> not be time-critical, right?).
Agreed, that does not matter.
>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
next prev parent reply other threads:[~2018-04-06 9:34 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-05 15:07 [Qemu-devel] [PATCH 0/3] s390: Fix virtio-scsi IPL quirks Viktor Mihajlovski
2018-04-05 15:07 ` [Qemu-devel] [PATCH 1/3] s390: Refactor IPL parameter block generation Viktor Mihajlovski
2018-04-05 16:21 ` Farhan Ali
2018-04-06 7:52 ` Thomas Huth
2018-04-06 9:34 ` Cornelia Huck [this message]
2018-04-05 15:07 ` [Qemu-devel] [PATCH 2/3] s390: Ensure IPL from SCSI works as expected Viktor Mihajlovski
2018-04-05 16:54 ` Farhan Ali
2018-04-06 8:37 ` Thomas Huth
2018-04-05 15:07 ` [Qemu-devel] [PATCH 3/3] s390: Do not pass inofficial IPL type to the guest Viktor Mihajlovski
2018-04-05 15:11 ` David Hildenbrand
2018-04-05 15:16 ` Viktor VM Mihajlovski
2018-04-06 9:28 ` Thomas Huth
2018-04-06 9:42 ` Cornelia Huck
2018-04-06 10:43 ` Viktor VM Mihajlovski
2018-04-06 10:56 ` Christian Borntraeger
2018-04-06 9:47 ` [Qemu-devel] [PATCH 0/3] s390: Fix virtio-scsi IPL quirks Cornelia Huck
2018-04-06 12:30 ` Christian Borntraeger
2018-04-06 12:34 ` 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=20180406113424.05b82448.cohuck@redhat.com \
--to=cohuck@redhat.com \
--cc=agraf@suse.de \
--cc=borntraeger@de.ibm.com \
--cc=david@redhat.com \
--cc=mihajlov@linux.vnet.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).