qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: qemu-devel@nongnu.org,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Alexander Graf <agraf@suse.de>,
	Farhan Ali <alifm@linux.vnet.ibm.com>,
	David Hildenbrand <david@redhat.com>,
	Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>,
	Alexey Kardashevskiy <aik@ozlabs.ru>
Subject: Re: [Qemu-devel] [PATCH v4 09/11] pc-bios/s390-ccw: Add core files for the network bootloading program
Date: Tue, 11 Jul 2017 16:30:11 +0200	[thread overview]
Message-ID: <20170711163011.1e1ddc30@dhcp-192-215.str.redhat.com> (raw)
In-Reply-To: <1499781397-19749-10-git-send-email-thuth@redhat.com>

On Tue, 11 Jul 2017 15:56:35 +0200
Thomas Huth <thuth@redhat.com> wrote:

> This is just a preparation for the next steps: Add a makefile and a
> stripped down copy of pc-bios/s390-ccw/main.c as a basis for the network
> bootloader program, linked against the libc from SLOF already (which we
> will need for SLOF's libnet). The networking code is not included yet.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  pc-bios/s390-ccw/Makefile    |  11 +++-
>  pc-bios/s390-ccw/netboot.mak |  41 +++++++++++++
>  pc-bios/s390-ccw/netmain.c   | 137 +++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 187 insertions(+), 2 deletions(-)
>  create mode 100644 pc-bios/s390-ccw/netboot.mak
>  create mode 100644 pc-bios/s390-ccw/netmain.c
> 

> diff --git a/pc-bios/s390-ccw/netmain.c b/pc-bios/s390-ccw/netmain.c
> new file mode 100644
> index 0000000..d604623
> --- /dev/null
> +++ b/pc-bios/s390-ccw/netmain.c
> @@ -0,0 +1,137 @@

(...)

> +static uint64_t get_timer_ms(void)
> +{
> +    uint64_t clk;
> +
> +    asm volatile(" stck %0 " : : "Q"(clk) : "memory");
> +
> +    /* Bit 51 is incrememented each microsecond */

s/incrememented/incremented/

> +    return (clk >> (63 - 51)) / 1000;
> +}

(...)

> +static bool find_net_dev(Schib *schib, int dev_no)
> +{
> +    int i, r;
> +
> +    for (i = 0; i < 0x10000; i++) {
> +        net_schid.sch_no = i;
> +        r = stsch_err(net_schid, schib);
> +        if (r == 3 || r == -EIO) {
> +            break;
> +        }
> +        if (!schib->pmcw.dnv) {
> +            continue;
> +        }
> +        if (!virtio_is_supported(net_schid)) {
> +            continue;
> +        }
> +        if (virtio_get_device_type() != VIRTIO_ID_NET) {
> +            continue;
> +        }
> +        if (dev_no < 0 || schib->pmcw.dev == dev_no) {
> +            return true;
> +        }
> +    }
> +
> +    return false;
> +}
> +
> +static void virtio_setup(void)
> +{
> +    Schib schib;
> +    int ssid;
> +    bool found = false;
> +    uint16_t dev_no;
> +
> +    /*
> +     * We unconditionally enable mss support. In every sane configuration,
> +     * this will succeed; and even if it doesn't, stsch_err() can deal
> +     * with the consequences.
> +     */
> +    enable_mss_facility();
> +
> +    if (store_iplb(&iplb)) {
> +        IPL_assert(iplb.pbt == S390_IPL_TYPE_CCW, "IPL_TYPE_CCW expected");
> +        dev_no = iplb.ccw.devno;
> +        debug_print_int("device no. ", dev_no);
> +        net_schid.ssid = iplb.ccw.ssid & 0x3;
> +        debug_print_int("ssid ", net_schid.ssid);
> +        found = find_net_dev(&schib, dev_no);
> +    } else {
> +        for (ssid = 0; ssid < 0x3; ssid++) {
> +            net_schid.ssid = ssid;
> +            found = find_net_dev(&schib, -1);
> +            if (found) {
> +                break;
> +            }
> +        }
> +    }
> +
> +    IPL_assert(found && virtio_get_device_type() == VIRTIO_ID_NET,

Is found && virtio_get_device_type() != VIRTIO_ID_NET even possible?

> +               "No virtio net device found");
> +}

Anyway, otherwise

Reviewed-by: Cornelia Huck <cohuck@redhat.com>

  reply	other threads:[~2017-07-11 14:30 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-11 13:56 [Qemu-devel] [PATCH v4 00/11] Implement network booting in the s390-ccw BIOS Thomas Huth
2017-07-11 13:56 ` [Qemu-devel] [PATCH v4 01/11] pc-bios/s390-ccw: Move libc functions to separate header Thomas Huth
2017-07-11 13:56 ` [Qemu-devel] [PATCH v4 02/11] pc-bios/s390-ccw: Move ebc2asc to sclp.c Thomas Huth
2017-07-11 13:56 ` [Qemu-devel] [PATCH v4 03/11] pc-bios/s390-ccw: Move virtio-block related functions into a separate file Thomas Huth
2017-07-11 13:56 ` [Qemu-devel] [PATCH v4 04/11] pc-bios/s390-ccw: Add a write() function for stdio Thomas Huth
2017-07-11 13:56 ` [Qemu-devel] [PATCH v4 05/11] pc-bios/s390-ccw: Move byteswap functions to a separate header Thomas Huth
2017-07-11 13:56 ` [Qemu-devel] [PATCH v4 06/11] pc-bios/s390-ccw: Remove unused structs from virtio.h Thomas Huth
2017-07-11 14:16   ` Cornelia Huck
2017-07-11 13:56 ` [Qemu-devel] [PATCH v4 07/11] pc-bios/s390-ccw: Add code for virtio feature negotiation Thomas Huth
2017-07-11 14:23   ` Cornelia Huck
2017-07-12  6:56     ` Thomas Huth
2017-07-11 13:56 ` [Qemu-devel] [PATCH v4 08/11] roms/SLOF: Update submodule to latest status Thomas Huth
2017-07-11 13:56 ` [Qemu-devel] [PATCH v4 09/11] pc-bios/s390-ccw: Add core files for the network bootloading program Thomas Huth
2017-07-11 14:30   ` Cornelia Huck [this message]
2017-07-11 13:56 ` [Qemu-devel] [PATCH v4 10/11] pc-bios/s390-ccw: Add virtio-net driver code Thomas Huth
2017-07-11 14:32   ` Cornelia Huck
2017-07-11 13:56 ` [Qemu-devel] [PATCH v4 11/11] pc-bios/s390-ccw: Link libnet into the netboot image and do the TFTP load Thomas Huth
2017-07-11 14:33   ` Cornelia Huck
2017-07-11 14:59 ` [Qemu-devel] [PATCH v4 00/11] Implement network booting in the s390-ccw BIOS no-reply
2017-07-12  8:33 ` Christian Borntraeger
2017-07-12 10:53   ` Thomas Huth
2017-07-12 11:08     ` Viktor Mihajlovski

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=20170711163011.1e1ddc30@dhcp-192-215.str.redhat.com \
    --to=cohuck@redhat.com \
    --cc=agraf@suse.de \
    --cc=aik@ozlabs.ru \
    --cc=alifm@linux.vnet.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=david@redhat.com \
    --cc=mihajlov@linux.vnet.ibm.com \
    --cc=qemu-devel@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).