From nobody Wed Oct 23 00:28:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1729387964; cv=none; d=zohomail.com; s=zohoarc; b=Vb/EqbrJSPXkHVCuedsFaw/C7qhqXb9om/5h1SP369VzoeXflJpIAsLDU0yamp8GyRtQle/svVCcAE2IkC8y6Fii8YSaLuqCrzAc0YNQwyKN01Ey8AfIz5wbMBluhOIgETDhyZ1n2P5VuNnurvov+Bu1PkKs8WX6y44p9ljyEHI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729387964; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ey7HfAekLGxyqECeeQ9yO9q/ZbgAlhuT7LSC45nKb9M=; b=MEHqJE2mLs2GHzKdu1kOoCa1SdJmeClRuWlA+tDhfBiAYS9MmmGPLeSFhc73ULvIyuZI2H05A9Ya1Y4sHLbZcNt4yrg/CJ2+PgVdIUQeX4eO/e4ZArvITwqo7RqdozmIrZqKBWrg9sUgzjFEbW8PPLBfGCQbaEaoS4wWlbyzN2A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1729387964764951.2570553698744; Sat, 19 Oct 2024 18:32:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t2Kll-0008LL-57; Sat, 19 Oct 2024 21:30:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t2Klj-0008Ic-AJ; Sat, 19 Oct 2024 21:30:07 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t2Klh-0005N7-9z; Sat, 19 Oct 2024 21:30:07 -0400 Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49JNtSE5022219; Sun, 20 Oct 2024 01:30:04 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 42c5fsk1sv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 20 Oct 2024 01:30:03 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 49K11XmK005906; Sun, 20 Oct 2024 01:30:03 GMT Received: from smtprelay04.wdc07v.mail.ibm.com ([172.16.1.71]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 428651k9gu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 20 Oct 2024 01:30:03 +0000 Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay04.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 49K1U12S42729886 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 20 Oct 2024 01:30:01 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A0C565805D; Sun, 20 Oct 2024 01:30:01 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E86EE5805A; Sun, 20 Oct 2024 01:30:00 +0000 (GMT) Received: from localhost.localdomain (unknown [9.61.54.50]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Sun, 20 Oct 2024 01:30:00 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=ey7HfAekLGxyqECee Q9yO9q/ZbgAlhuT7LSC45nKb9M=; b=LcmoLVYWyIJ71LOINrXgx+CFoDs8ZDMd1 nWnJ6AJ9Bp6zbKYtGMnmX+sTSxSV6a/HFWkAWaxFXT7hq3+6a7qvM4Xi+4ZQdmNY HmziWGn6prY0XvlQB3fnqNsc6xl4FCAlNcCiYDZfLvlOYhEX8ow7+Nb5DFURPjs6 uhAJ7yCbhjYcdw0L7gHdwqvonmPP6bD8Sl8I+Ur+K5ewRoQ8xtcm8zLmRnVIX6Qk T6mvZvCW1kGmzMMd1UEnjaT34x16RG2HO6z+yM5THjJLJTSVmJiox8YDoavLFfhm dToQvoJb1DcSytT6ahTV4YW/dSrdHzzOaKAASC3CEk/g0o38lp9Ag== From: jrossi@linux.ibm.com To: qemu-devel@nongnu.org, qemu-s390x@nongnu.org, thuth@redhat.com Cc: frankja@linux.ibm.com, jrossi@linux.ibm.com Subject: [PATCH v5 03/19] pc-bios/s390-ccw: Link the netboot code into the main s390-ccw.img binary Date: Sat, 19 Oct 2024 21:29:37 -0400 Message-ID: <20241020012953.1380075-4-jrossi@linux.ibm.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241020012953.1380075-1-jrossi@linux.ibm.com> References: <20241020012953.1380075-1-jrossi@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 6oKf06RbwFuhT4qzW01CIcWaXDw5rPcN X-Proofpoint-ORIG-GUID: 6oKf06RbwFuhT4qzW01CIcWaXDw5rPcN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_01,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 impostorscore=0 clxscore=1015 mlxscore=0 malwarescore=0 bulkscore=0 lowpriorityscore=0 adultscore=0 phishscore=0 priorityscore=1501 spamscore=0 mlxlogscore=896 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2410200009 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.158.5; envelope-from=jrossi@linux.ibm.com; helo=mx0b-001b2d01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1729387966800116600 Content-Type: text/plain; charset="utf-8" From: Jared Rossi We originally built a separate binary for the netboot code since it was considered as experimental and we could not be sure that the necessary SLOF module had been checked out. Time passed, the code proved its usefulness, and the build system nowadays makes sure that the SLOF module is checked out if you have a s390x compiler available for building the s390-ccw bios. So there is no real compelling reason anymore to keep the netboot code in a separate binary. Linking the code together with the main s390-ccw.img will make future enhancements much easier, like supporting more than one boot device. Co-authored by: Thomas Huth Signed-off-by: Jared Rossi --- pc-bios/s390-ccw/netboot.mak | 14 -------------- pc-bios/s390-ccw/cio.h | 2 ++ pc-bios/s390-ccw/iplb.h | 4 ++-- pc-bios/s390-ccw/s390-ccw.h | 3 +++ pc-bios/s390-ccw/virtio.h | 1 - pc-bios/s390-ccw/bootmap.c | 2 +- pc-bios/s390-ccw/main.c | 10 +++++++--- pc-bios/s390-ccw/netmain.c | 15 ++------------- pc-bios/s390-ccw/Makefile | 13 +++++++------ 9 files changed, 24 insertions(+), 40 deletions(-) diff --git a/pc-bios/s390-ccw/netboot.mak b/pc-bios/s390-ccw/netboot.mak index d2b3d8ee74..0a24257ff4 100644 --- a/pc-bios/s390-ccw/netboot.mak +++ b/pc-bios/s390-ccw/netboot.mak @@ -1,18 +1,4 @@ =20 -NETOBJS :=3D start.o sclp.o cio.o virtio.o virtio-net.o jump2ipl.o netmain= .o - -LIBNET_INC :=3D -I$(SLOF_DIR)/lib/libnet - -NETLDFLAGS :=3D $(LDFLAGS) -Wl,-Ttext=3D0x7800000 - -$(NETOBJS): EXTRA_CFLAGS +=3D $(LIBC_INC) $(LIBNET_INC) - -s390-netboot.elf: $(NETOBJS) libnet.a libc.a - $(call quiet-command,$(CC) $(NETLDFLAGS) -o $@ $^,Linking) - -s390-netboot.img: s390-netboot.elf - $(call quiet-command,$(STRIP) --strip-unneeded $< -o $@,Stripping $< into) - # libc files: =20 LIBC_CFLAGS =3D $(EXTRA_CFLAGS) $(CFLAGS) $(LIBC_INC) $(LIBNET_INC) \ diff --git a/pc-bios/s390-ccw/cio.h b/pc-bios/s390-ccw/cio.h index 8b18153deb..6a5e86ba01 100644 --- a/pc-bios/s390-ccw/cio.h +++ b/pc-bios/s390-ccw/cio.h @@ -361,6 +361,8 @@ typedef struct CcwSearchIdData { uint8_t record; } __attribute__((packed)) CcwSearchIdData; =20 +extern SubChannelId net_schid; + int enable_mss_facility(void); void enable_subchannel(SubChannelId schid); uint16_t cu_type(SubChannelId schid); diff --git a/pc-bios/s390-ccw/iplb.h b/pc-bios/s390-ccw/iplb.h index cb6ac8a880..3758698468 100644 --- a/pc-bios/s390-ccw/iplb.h +++ b/pc-bios/s390-ccw/iplb.h @@ -87,9 +87,9 @@ extern IplParameterBlock iplb __attribute__((__aligned__(= PAGE_SIZE))); struct QemuIplParameters { uint8_t qipl_flags; uint8_t reserved1[3]; - uint64_t netboot_start_addr; + uint64_t reserved2; uint32_t boot_menu_timeout; - uint8_t reserved2[12]; + uint8_t reserved3[12]; } __attribute__ ((packed)); typedef struct QemuIplParameters QemuIplParameters; =20 diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h index 6f6d95d170..6abb34e563 100644 --- a/pc-bios/s390-ccw/s390-ccw.h +++ b/pc-bios/s390-ccw/s390-ccw.h @@ -55,6 +55,9 @@ void write_iplb_location(void); unsigned int get_loadparm_index(void); void main(void); =20 +/* netmain.c */ +void netmain(void); + /* sclp.c */ void sclp_print(const char *string); void sclp_set_write_mask(uint32_t receive_mask, uint32_t send_mask); diff --git a/pc-bios/s390-ccw/virtio.h b/pc-bios/s390-ccw/virtio.h index 85bd9d1695..6f9a558ff5 100644 --- a/pc-bios/s390-ccw/virtio.h +++ b/pc-bios/s390-ccw/virtio.h @@ -253,7 +253,6 @@ struct VDev { uint8_t scsi_dev_heads; bool scsi_device_selected; ScsiDevice selected_scsi_device; - uint64_t netboot_start_addr; uint32_t max_transfer; uint32_t guest_features[2]; }; diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c index 3cc79706be..414c3f1b47 100644 --- a/pc-bios/s390-ccw/bootmap.c +++ b/pc-bios/s390-ccw/bootmap.c @@ -929,7 +929,7 @@ void zipl_load(void) } =20 if (virtio_get_device_type() =3D=3D VIRTIO_ID_NET) { - jump_to_IPL_code(vdev->netboot_start_addr); + netmain(); } =20 ipl_scsi(); diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c index 203df20965..fc44da3161 100644 --- a/pc-bios/s390-ccw/main.c +++ b/pc-bios/s390-ccw/main.c @@ -38,8 +38,13 @@ LowCore *lowcore; /* Yes, this *is* a pointer to address= 0 */ */ void write_subsystem_identification(void) { - lowcore->subchannel_id =3D blk_schid.sch_id; - lowcore->subchannel_nr =3D blk_schid.sch_no; + if (cutype =3D=3D CU_TYPE_VIRTIO && virtio_get_device_type() =3D=3D VI= RTIO_ID_NET) { + lowcore->subchannel_id =3D net_schid.sch_id; + lowcore->subchannel_nr =3D net_schid.sch_no; + } else { + lowcore->subchannel_id =3D blk_schid.sch_id; + lowcore->subchannel_nr =3D blk_schid.sch_no; + } lowcore->io_int_parm =3D 0; } =20 @@ -231,7 +236,6 @@ static int virtio_setup(void) switch (vdev->senseid.cu_model) { case VIRTIO_ID_NET: puts("Network boot device detected"); - vdev->netboot_start_addr =3D qipl.netboot_start_addr; return 0; case VIRTIO_ID_BLOCK: ret =3D virtio_blk_setup_device(blk_schid); diff --git a/pc-bios/s390-ccw/netmain.c b/pc-bios/s390-ccw/netmain.c index 509119be15..bc6ad8695f 100644 --- a/pc-bios/s390-ccw/netmain.c +++ b/pc-bios/s390-ccw/netmain.c @@ -41,7 +41,6 @@ #define DEFAULT_TFTP_RETRIES 20 =20 extern char _start[]; -void write_iplb_location(void) {} =20 #define KERNEL_ADDR ((void *)0L) #define KERNEL_MAX_SIZE ((long)_start) @@ -50,10 +49,9 @@ void write_iplb_location(void) {} /* STSI 3.2.2 offset of first vmdb + offset of uuid inside vmdb */ #define STSI322_VMDB_UUID_OFFSET ((8 + 12) * 4) =20 -IplParameterBlock iplb __attribute__((aligned(PAGE_SIZE))); static char cfgbuf[2048]; =20 -static SubChannelId net_schid =3D { .one =3D 1 }; +SubChannelId net_schid =3D { .one =3D 1 }; static uint8_t mac[6]; static uint64_t dest_timer; =20 @@ -438,15 +436,6 @@ static int net_try_direct_tftp_load(filename_ip_t *fn_= ip) return rc; } =20 -void write_subsystem_identification(void) -{ - SubChannelId *schid =3D (SubChannelId *) 184; - uint32_t *zeroes =3D (uint32_t *) 188; - - *schid =3D net_schid; - *zeroes =3D 0; -} - static bool find_net_dev(Schib *schib, int dev_no) { int i, r; @@ -509,7 +498,7 @@ static void virtio_setup(void) IPL_assert(found, "No virtio net device found"); } =20 -void main(void) +void netmain(void) { filename_ip_t fn_ip; int rc, fnlen; diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile index 3f4232636e..cf6859823a 100644 --- a/pc-bios/s390-ccw/Makefile +++ b/pc-bios/s390-ccw/Makefile @@ -32,19 +32,20 @@ QEMU_DGFLAGS =3D -MMD -MP -MT $@ -MF $(@D)/$(*F).d =20 .PHONY : all clean build-all distclean =20 -OBJECTS =3D start.o main.o bootmap.o jump2ipl.o sclp.o menu.o \ - virtio.o virtio-scsi.o virtio-blkdev.o cio.o dasd-ipl.o +OBJECTS =3D start.o main.o bootmap.o jump2ipl.o sclp.o menu.o netmain.o \ + virtio.o virtio-net.o virtio-scsi.o virtio-blkdev.o cio.o dasd-ipl.o =20 SLOF_DIR :=3D $(SRC_PATH)/../../roms/SLOF =20 LIBC_INC :=3D -nostdinc -I$(SLOF_DIR)/lib/libc/include +LIBNET_INC :=3D -I$(SLOF_DIR)/lib/libnet =20 EXTRA_CFLAGS +=3D -Wall EXTRA_CFLAGS +=3D -ffreestanding -fno-delete-null-pointer-checks -fno-comm= on -fPIE EXTRA_CFLAGS +=3D -fwrapv -fno-strict-aliasing -fno-asynchronous-unwind-ta= bles EXTRA_CFLAGS +=3D -msoft-float EXTRA_CFLAGS +=3D -std=3Dgnu99 -EXTRA_CFLAGS +=3D $(LIBC_INC) +EXTRA_CFLAGS +=3D $(LIBC_INC) $(LIBNET_INC) LDFLAGS +=3D -Wl,-pie -nostdlib -z noexecstack =20 cc-test =3D $(CC) -Werror $1 -c -o /dev/null -xc /dev/null >/dev/null 2>/d= ev/null @@ -62,9 +63,9 @@ config-cc.mak: Makefile =20 include $(SRC_PATH)/netboot.mak =20 -build-all: s390-ccw.img s390-netboot.img +build-all: s390-ccw.img =20 -s390-ccw.elf: $(OBJECTS) libc.a +s390-ccw.elf: $(OBJECTS) libnet.a libc.a $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $^,Linking) =20 s390-ccw.img: s390-ccw.elf @@ -72,7 +73,7 @@ s390-ccw.img: s390-ccw.elf =20 $(OBJECTS): Makefile =20 -ALL_OBJS =3D $(sort $(OBJECTS) $(NETOBJS) $(LIBCOBJS) $(LIBNETOBJS)) +ALL_OBJS =3D $(sort $(OBJECTS) $(LIBCOBJS) $(LIBNETOBJS)) -include $(ALL_OBJS:%.o=3D%.d) =20 clean: --=20 2.45.1