From patchwork Tue Aug 6 08:42:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 13754557 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A8A0F679E5; Tue, 6 Aug 2024 08:45:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722933944; cv=none; b=nINae/h+sfK7vK03J03jvkoDLgy6Xq0B99g5dEfp3OMNF99JUCY0NdlmAC4LijtTmqlLr0rNwhyJi6o5Bm9oFHCcDnk1K+Xa0E9W5zqU6HRUShJxxEvJ6INrVXKrU50YCfz4wV/rjgQkqWc9vOCJ0tj8TJFCYtA+KR932SL/lLk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722933944; c=relaxed/simple; bh=GDCEd+uxBo+NyloX59NtIQrsJlFhdlVt1ncnxJWiF/0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TMOugs+JaLyOL912vvmi4MD7rDj2zqsAtk4nTG+661m4SVC6ahCVsjPFHjhm9QyJC/zMCr9UCfDwv4AxIoLDAqfIy+zfvDjx9KUw4e2SrplCSDxoD3GayAToijTGZxJPY6ZRJJWc2+hDn2vICs71Z3JdBa8YNdVM4bUZFZkN/pc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=TjkThTR8; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="TjkThTR8" Received: from pps.filterd (m0353727.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4766xQLn009641; Tue, 6 Aug 2024 08:45:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=pp1; bh=y1rmss2YgB9YN 2uXTB3SbNlKgoNknimXl+auw1HYzKI=; b=TjkThTR8NiF8XBsDePet1TKomLErt vs22UlvY5VJ48UAI0tdbfgXokzq1uuMf9+OxhpLfrdVJX5y7uoAVyd4zKsMJwhqJ we1ek2y2PG12hYe4uiss7Daqzq6ku2v0mcM6TD9syuJ3SI2wNZJRI6fR/D0IcN4P exePaq+/okpKfphWvb7UE3mpwqRp32NDXmrf2UYjSUZuher0LtfFLKOYU5pxR92t K+1ludSmpweRzuSZWZYwx7+fHBg7ye9Hwe3SachSPbrYs4erZDAGuy1LDkskjxTQ cVoqMd2NSV8xMaUGCxCcDLbKYwRzXya3NNrsmrBOP8a3Zumcg/eExeEhQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 40uf1fr7g6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Aug 2024 08:45:40 +0000 (GMT) Received: from m0353727.ppops.net (m0353727.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 4768je7o006731; Tue, 6 Aug 2024 08:45:40 GMT Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 40uf1fr7g2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Aug 2024 08:45:40 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 4766UT3p018822; Tue, 6 Aug 2024 08:45:39 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 40sxvu30w6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Aug 2024 08:45:39 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4768jXYp53084618 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 6 Aug 2024 08:45:35 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 91B1520043; Tue, 6 Aug 2024 08:45:33 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 60F9B20067; Tue, 6 Aug 2024 08:45:33 +0000 (GMT) Received: from a46lp67.lnxne.boe (unknown [9.152.108.100]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 6 Aug 2024 08:45:33 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, nrb@linux.ibm.com, schlameuss@linux.ibm.com, nsg@linux.ibm.com, npiggin@gmail.com, mhartmay@linux.ibm.com Subject: [kvm-unit-tests PATCH v2 1/4] s390x/Makefile: Split snippet makefile rules into new file Date: Tue, 6 Aug 2024 08:42:27 +0000 Message-ID: <20240806084409.169039-2-frankja@linux.ibm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240806084409.169039-1-frankja@linux.ibm.com> References: <20240806084409.169039-1-frankja@linux.ibm.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 3-_LBpwLpUCxXtnkyH9bVgAk7K9GRbAw X-Proofpoint-ORIG-GUID: IBFA4_s1cgVqJhmBlT6Mi6IMFamLcIDz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-06_06,2024-08-02_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 impostorscore=0 malwarescore=0 bulkscore=0 mlxlogscore=738 lowpriorityscore=0 suspectscore=0 adultscore=0 mlxscore=0 spamscore=0 phishscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2408060060 It's time to move the snippet related Makefile parts into a new file to make s390x/Makefile less busy. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Reviewed-by: Christoph Schlameuss --- s390x/Makefile | 38 ++++---------------------------------- s390x/snippets/Makefile | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 34 deletions(-) create mode 100644 s390x/snippets/Makefile diff --git a/s390x/Makefile b/s390x/Makefile index 784818b2..aa55b470 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -119,9 +119,11 @@ asmlib = $(TEST_DIR)/cstart64.o $(TEST_DIR)/cpu.o FLATLIBS = $(libcflat) +# Snippets SNIPPET_DIR = $(TEST_DIR)/snippets snippet_asmlib = $(SNIPPET_DIR)/c/cstart.o snippet_lib = $(snippet_asmlib) lib/auxinfo.o +include $(SNIPPET_DIR)/Makefile # perquisites (=guests) for the snippet hosts. # $(TEST_DIR)/.elf: snippets = $(SNIPPET_DIR)//.gbin @@ -146,38 +148,6 @@ else snippet-hdr-obj = endif -# the asm/c snippets %.o have additional generated files as dependencies -$(SNIPPET_DIR)/asm/%.o: $(SNIPPET_DIR)/asm/%.S $(asm-offsets) - $(CC) $(CFLAGS) -c -nostdlib -o $@ $< - -$(SNIPPET_DIR)/c/%.o: $(SNIPPET_DIR)/c/%.c $(asm-offsets) - $(CC) $(CFLAGS) -c -nostdlib -o $@ $< - -$(SNIPPET_DIR)/asm/%.elf: $(SNIPPET_DIR)/asm/%.o $(SNIPPET_DIR)/asm/flat.lds - $(CC) $(LDFLAGS) -o $@ -T $(SNIPPET_DIR)/asm/flat.lds $< - -$(SNIPPET_DIR)/asm/%.gbin: $(SNIPPET_DIR)/asm/%.elf - $(OBJCOPY) -O binary -j ".rodata" -j ".lowcore" -j ".text" -j ".data" -j ".bss" --set-section-flags .bss=alloc,load,contents $< $@ - truncate -s '%4096' $@ - -$(SNIPPET_DIR)/c/%.elf: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) $(SNIPPET_DIR)/c/flat.lds - $(CC) $(LDFLAGS) -o $@ -T $(SNIPPET_DIR)/c/flat.lds $< $(snippet_lib) $(FLATLIBS) - -$(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.elf - $(OBJCOPY) -O binary -j ".rodata" -j ".lowcore" -j ".text" -j ".data" -j ".bss" --set-section-flags .bss=alloc,load,contents $< $@ - truncate -s '%4096' $@ - -%.hdr: %.gbin $(HOST_KEY_DOCUMENT) - $(GEN_SE_HEADER) -k $(HOST_KEY_DOCUMENT) -c $<,0x0,0x00000000000000420000000000000000 --psw-addr 0x4000 -o $@ - -.SECONDARY: -%.gobj: %.gbin - $(OBJCOPY) -I binary -O elf64-s390 -B "s390:64-bit" $< $@ - -.SECONDARY: -%.hdr.obj: %.hdr - $(OBJCOPY) -I binary -O elf64-s390 -B "s390:64-bit" $< $@ - lds-autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d -MT $@ %.lds: %.lds.S $(asm-offsets) $(CPP) $(lds-autodepend-flags) $(CPPFLAGS) -P -C -o $@ $< @@ -231,8 +201,8 @@ $(snippet_asmlib): $$(patsubst %.o,%.S,$$@) $(asm-offsets) $(CC) $(CFLAGS) -c -nostdlib -o $@ $< -arch_clean: asm_offsets_clean - $(RM) $(TEST_DIR)/*.{o,elf,bin,lds} $(SNIPPET_DIR)/*/*.{o,elf,*bin,*obj,hdr,lds} $(SNIPPET_DIR)/asm/.*.d $(TEST_DIR)/.*.d lib/s390x/.*.d $(comm-key) +arch_clean: asm_offsets_clean snippet_clean + $(RM) $(TEST_DIR)/*.{o,elf,bin,lds} $(TEST_DIR)/.*.d lib/s390x/.*.d $(comm-key) generated-files = $(asm-offsets) $(tests:.elf=.o) $(asmlib) $(cflatobjs): $(generated-files) diff --git a/s390x/snippets/Makefile b/s390x/snippets/Makefile new file mode 100644 index 00000000..8d79165e --- /dev/null +++ b/s390x/snippets/Makefile @@ -0,0 +1,34 @@ +# the asm/c snippets %.o have additional generated files as dependencies +$(SNIPPET_DIR)/asm/%.o: $(SNIPPET_DIR)/asm/%.S $(asm-offsets) + $(CC) $(CFLAGS) -c -nostdlib -o $@ $< + +$(SNIPPET_DIR)/c/%.o: $(SNIPPET_DIR)/c/%.c $(asm-offsets) + $(CC) $(CFLAGS) -c -nostdlib -o $@ $< + +$(SNIPPET_DIR)/asm/%.elf: $(SNIPPET_DIR)/asm/%.o $(SNIPPET_DIR)/asm/flat.lds + $(CC) $(LDFLAGS) -o $@ -T $(SNIPPET_DIR)/asm/flat.lds $< + +$(SNIPPET_DIR)/asm/%.gbin: $(SNIPPET_DIR)/asm/%.elf + $(OBJCOPY) -O binary -j ".rodata" -j ".lowcore" -j ".text" -j ".data" -j ".bss" --set-section-flags .bss=alloc,load,contents $< $@ + truncate -s '%4096' $@ + +$(SNIPPET_DIR)/c/%.elf: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) $(SNIPPET_DIR)/c/flat.lds + $(CC) $(LDFLAGS) -o $@ -T $(SNIPPET_DIR)/c/flat.lds $< $(snippet_lib) $(FLATLIBS) + +$(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.elf + $(OBJCOPY) -O binary -j ".rodata" -j ".lowcore" -j ".text" -j ".data" -j ".bss" --set-section-flags .bss=alloc,load,contents $< $@ + truncate -s '%4096' $@ + +%.hdr: %.gbin $(HOST_KEY_DOCUMENT) + $(GEN_SE_HEADER) -k $(HOST_KEY_DOCUMENT) -c $<,0x0,0x00000000000000420000000000000000 --psw-addr 0x4000 -o $@ + +.SECONDARY: +%.gobj: %.gbin + $(OBJCOPY) -I binary -O elf64-s390 -B "s390:64-bit" $< $@ + +.SECONDARY: +%.hdr.obj: %.hdr + $(OBJCOPY) -I binary -O elf64-s390 -B "s390:64-bit" $< $@ + +snippet_clean: + $(RM) $(SNIPPET_DIR)/*/*.{o,elf,*bin,*obj,hdr,lds} $(SNIPPET_DIR)/asm/.*.d From patchwork Tue Aug 6 08:42:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 13754560 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF33813A884; Tue, 6 Aug 2024 08:45:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722933949; cv=none; b=FjAKoW5t+QKt5aDul1tks0hCGaI8/lJr+k0R2M3m+rrH9RqK42YjhAZPFaLdn/8AEjMrxdhflNreUL+s8sNoq4f9z1ZSPRY5IPElwec5dW9ySc4lkvoLs3ElFFkDGgSV3JCmJcv0GJIS8W5bpFcDqR4CRWwsOKRfJ1KF66i4S+s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722933949; c=relaxed/simple; bh=noIaPItZwjlk1PNP9giz5EN1knZ5OX5VbJ8ji4+7Tco=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mV/NvX0jtku0zUIVOBg1rN2TXUXOYc9dydMJKQ+cdtQFfnSABRMGtsWVB+GxIgCN0nkemw0x5NXoIlSSbyCjanOLDeW1d1z0xtvyuWJ5Xu4XGjSPQ9sqqD50Pe6/AtzH0gCGNabY7IpsM43wDPhrw+rHIytmNypPQaZUM0i2cnc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=h8EGCOZl; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="h8EGCOZl" Received: from pps.filterd (m0353723.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4766wXmH002535; Tue, 6 Aug 2024 08:45:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=pp1; bh=LxlGasScveNEJ SO9FqswPeTgcieOeDFP8kNH0QVHkYA=; b=h8EGCOZl/QQvXnPh9nQY/0+SJz7ic tW5c+3pELfCThG7HUcB9//vV0Cxzf3y2Jp/Dza8KcE9fyWTVWgOwnrFHwmqXfdoQ P+eaAeyqlTWsDK2E5RCFlqINVJsd600gE9j40kgBW0h1ON+qsOT7Zhtncat9Fgwt AmGA8vi16O82IDRsTI5tKNgBS20invK3myiMIDSU69AczGz+IZ4+e8yROmLs9vLN oyuZ4uzny7q+xRm8WH5V7lFKNpdn76jhPBsa2D+0OwqQneVVMrjUQkZpQ9STkHEL o2oeKSBA8A51ZeLp4zrB12ky53wKhlTFQCDQAPpWZkDbwfmW4kWrjfzew== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 40uf1hr7aa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Aug 2024 08:45:40 +0000 (GMT) Received: from m0353723.ppops.net (m0353723.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 4768jeMP019908; Tue, 6 Aug 2024 08:45:40 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 40uf1hr7a6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Aug 2024 08:45:40 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 47673t0M024311; Tue, 6 Aug 2024 08:45:39 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 40sy90jwm2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Aug 2024 08:45:39 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4768jXRk56230324 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 6 Aug 2024 08:45:35 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C995820067; Tue, 6 Aug 2024 08:45:33 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 98C882006A; Tue, 6 Aug 2024 08:45:33 +0000 (GMT) Received: from a46lp67.lnxne.boe (unknown [9.152.108.100]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 6 Aug 2024 08:45:33 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, nrb@linux.ibm.com, schlameuss@linux.ibm.com, nsg@linux.ibm.com, npiggin@gmail.com, mhartmay@linux.ibm.com Subject: [kvm-unit-tests PATCH v2 2/4] s390x/Makefile: Add more comments Date: Tue, 6 Aug 2024 08:42:28 +0000 Message-ID: <20240806084409.169039-3-frankja@linux.ibm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240806084409.169039-1-frankja@linux.ibm.com> References: <20240806084409.169039-1-frankja@linux.ibm.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 5_B23k4QLYgiPH0VnXup8PuWcqeh_bFj X-Proofpoint-ORIG-GUID: ubEib-Q9ZX73pK4W09T0ioEbTfux_qxe X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-06_06,2024-08-02_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 priorityscore=1501 malwarescore=0 impostorscore=0 lowpriorityscore=0 bulkscore=0 mlxscore=0 suspectscore=0 clxscore=1015 spamscore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2408060060 More comments in Makefiles can only make them more approachable. Signed-off-by: Janosch Frank Reviewed-by: Christoph Schlameuss Reviewed-by: Claudio Imbrenda --- s390x/Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/s390x/Makefile b/s390x/Makefile index aa55b470..f09bccfc 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -49,12 +49,15 @@ pv-tests += $(TEST_DIR)/pv-diags.elf pv-tests += $(TEST_DIR)/pv-icptcode.elf pv-tests += $(TEST_DIR)/pv-ipl.elf +# Add PV host tests if we're able to generate them +# The host key document and a tool to generate SE headers are the prerequisite ifneq ($(HOST_KEY_DOCUMENT),) ifneq ($(GEN_SE_HEADER),) tests += $(pv-tests) endif endif +# Add binary flat images for use in non-KVM hypervisors tests_binary = $(patsubst %.elf,%.bin,$(tests)) ifneq ($(HOST_KEY_DOCUMENT),) tests_pv_binary = $(patsubst %.bin,%.pv.bin,$(tests_binary)) @@ -140,6 +143,7 @@ $(TEST_DIR)/pv-icptcode.elf: pv-snippets += $(SNIPPET_DIR)/asm/loop.gbin $(TEST_DIR)/pv-icptcode.elf: pv-snippets += $(SNIPPET_DIR)/asm/pv-icpt-vir-timing.gbin $(TEST_DIR)/pv-ipl.elf: pv-snippets += $(SNIPPET_DIR)/asm/pv-diag-308.gbin +# Add PV tests and snippets if GEN_SE_HEADER is set ifneq ($(GEN_SE_HEADER),) snippets += $(pv-snippets) tests += $(pv-tests) @@ -148,6 +152,7 @@ else snippet-hdr-obj = endif +# Generate loader script lds-autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d -MT $@ %.lds: %.lds.S $(asm-offsets) $(CPP) $(lds-autodepend-flags) $(CPPFLAGS) -P -C -o $@ $< From patchwork Tue Aug 6 08:42:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 13754561 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF382165F00; Tue, 6 Aug 2024 08:45:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722933950; cv=none; b=dLPRdKcbkUcm0D5g3koYGcCh9Sr1W0ssqRCUAXbJ7z6EyrIp6CvDU1uM2UnlDezZ8m4YE8DMnJuyVhKXBYWug2OoQ1lxG87QsHJBqo3Y9HqtxSYAeJzPK3BDZbjq3qoxV7hYPhEZ4J1biUJOpZVJ2eJDbGqo9D7zg52BF3A8O4c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722933950; c=relaxed/simple; bh=vg5jQk8ALzIT1vMNHuWTbLofNttsS1PYgGyBZ1prI0M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=A2MxElizjF5zcHuN7fMezitpJg9iiEqtlciDsYKbxhV9Ssa/aXtVnFRF8Ej/j/nWFt9N9SWC3bRt0r8hxkdnGJxO8uGsQki+vUeZ2j4mTkPeWcGkVucIHpW/jJkYPA0H0T+9AHXkhbLs0DWMBf/tnTLq+LbKUrWENyjZk4XM50E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=mwLm6qfx; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="mwLm6qfx" 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 4762e9U7015943; Tue, 6 Aug 2024 08:45:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=pp1; bh=rjC2lYFt+mJQA b7369Rl8ct2OpLXCjLW/0Y99IE+6LA=; b=mwLm6qfxPAMubhTqM/LIJkslisgLI ZBJI1pp+1BG+zQqIsGY8d9XrEgj3toe4KkxSnjiNJdI9h4o7JM8i5LuTZKMPRZbY ySxTBgPOzCsAvZrY5SHqHkunNY7Mx8wuBjmco+DVVty82WEzpCzPbSx1BpsziJzv IyFBIseZzBZFPvdW1IbFwTsqFzFnVO3xoSimoqi5m/6TxSyzPETuN6ZfwX8yO0zF Y8y0UD5QSeV1er36pLVVUQHa38fb5HA5NXvFgaUnGf/f7MEsubbbRp6NdWqRr0JM 1XrBnJFCRZxj203omRDJZvLISpZPOwMM3XnPNFv0pj8GOFQy4t5rvBy2w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 40ub2x0nax-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Aug 2024 08:45:40 +0000 (GMT) Received: from m0356516.ppops.net (m0356516.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 4768htlN004170; Tue, 6 Aug 2024 08:45:40 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 40ub2x0nav-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Aug 2024 08:45:40 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 4767s7ZW024136; Tue, 6 Aug 2024 08:45:39 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 40syvpasak-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Aug 2024 08:45:39 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4768jYl045613412 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 6 Aug 2024 08:45:36 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0E3ED2006A; Tue, 6 Aug 2024 08:45:34 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D0DF12006B; Tue, 6 Aug 2024 08:45:33 +0000 (GMT) Received: from a46lp67.lnxne.boe (unknown [9.152.108.100]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 6 Aug 2024 08:45:33 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, nrb@linux.ibm.com, schlameuss@linux.ibm.com, nsg@linux.ibm.com, npiggin@gmail.com, mhartmay@linux.ibm.com Subject: [kvm-unit-tests PATCH v2 3/4] s390x: Move SIE assembly into new file Date: Tue, 6 Aug 2024 08:42:29 +0000 Message-ID: <20240806084409.169039-4-frankja@linux.ibm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240806084409.169039-1-frankja@linux.ibm.com> References: <20240806084409.169039-1-frankja@linux.ibm.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: GX1IoXdcQer3dO9DpCmlbqI2kRzNPwOZ X-Proofpoint-ORIG-GUID: 2UAeRiDi0g7_6I5dpUM7bI-vm3-t1u7h X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-06_06,2024-08-02_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 mlxscore=0 impostorscore=0 suspectscore=0 phishscore=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2408060060 In contrast to the other functions in cpu.S it's quite lengthy so let's split it off. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Reviewed-by: Christoph Schlameuss --- s390x/Makefile | 2 +- s390x/{cpu.S => cpu-sie.S} | 59 +---------------------------------- s390x/cpu.S | 64 -------------------------------------- 3 files changed, 2 insertions(+), 123 deletions(-) copy s390x/{cpu.S => cpu-sie.S} (56%) diff --git a/s390x/Makefile b/s390x/Makefile index f09bccfc..97a74514 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -118,7 +118,7 @@ cflatobjs += lib/s390x/fault.o OBJDIRS += lib/s390x -asmlib = $(TEST_DIR)/cstart64.o $(TEST_DIR)/cpu.o +asmlib = $(TEST_DIR)/cstart64.o $(TEST_DIR)/cpu.o $(TEST_DIR)/cpu-sie.o FLATLIBS = $(libcflat) diff --git a/s390x/cpu.S b/s390x/cpu-sie.S similarity index 56% copy from s390x/cpu.S copy to s390x/cpu-sie.S index 9155b044..9370b5c0 100644 --- a/s390x/cpu.S +++ b/s390x/cpu-sie.S @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * s390x assembly library + * s390x SIE assembly library * * Copyright (c) 2019 IBM Corp. * @@ -8,59 +8,6 @@ * Janosch Frank */ #include -#include - -#include "macros.S" - -/* - * load_reset calling convention: - * %r2 subcode (0 or 1) - */ -.globl diag308_load_reset -diag308_load_reset: - SAVE_REGS_STACK - /* Backup current PSW mask, as we have to restore it on success */ - epsw %r0, %r1 - st %r0, GEN_LC_SW_INT_PSW - st %r1, GEN_LC_SW_INT_PSW + 4 - /* Load reset psw mask (short psw, 64 bit) */ - lg %r0, reset_psw - /* Load the success label address */ - larl %r1, 0f - /* Or it to the mask */ - ogr %r0, %r1 - /* Store it at the reset PSW location (real 0x0) */ - stg %r0, 0 - stg %r15, GEN_LC_SW_INT_GRS + 15 * 8 - /* Do the reset */ - diag %r0,%r2,0x308 - /* Failure path */ - xgr %r2, %r2 - br %r14 - /* Success path */ - /* load a cr0 that has the AFP control bit which enables all FPRs */ -0: larl %r1, initial_cr0 - lctlg %c0, %c0, 0(%r1) - lg %r15, GEN_LC_SW_INT_GRS + 15 * 8 - RESTORE_REGS_STACK - lhi %r2, 1 - larl %r0, 1f - stg %r0, GEN_LC_SW_INT_PSW + 8 - lpswe GEN_LC_SW_INT_PSW -1: br %r14 - -/* Sets up general registers and cr0 when a new cpu is brought online. */ -.globl smp_cpu_setup_state -smp_cpu_setup_state: - xgr %r1, %r1 - lmg %r0, %r15, GEN_LC_SW_INT_GRS - lctlg %c0, %c0, GEN_LC_SW_INT_CRS - /* We should only go once through cpu setup and not for every restart */ - stg %r14, GEN_LC_RESTART_NEW_PSW + 8 - larl %r14, 0f - lpswe GEN_LC_SW_INT_PSW - /* If the function returns, just loop here */ -0: j 0 /* * sie64a calling convention: @@ -125,7 +72,3 @@ sie_exit: .globl sie_exit_gregs sie_exit_gregs: br %r14 - - .align 8 -reset_psw: - .quad 0x0008000180000000 diff --git a/s390x/cpu.S b/s390x/cpu.S index 9155b044..2ff4b8e1 100644 --- a/s390x/cpu.S +++ b/s390x/cpu.S @@ -62,70 +62,6 @@ smp_cpu_setup_state: /* If the function returns, just loop here */ 0: j 0 -/* - * sie64a calling convention: - * %r2 pointer to sie control block - * %r3 guest register save area - */ -.globl sie64a -sie64a: - # Save host grs, fprs, fpc - stmg %r0,%r14,SIE_SAVEAREA_HOST_GRS(%r3) # save kernel registers - .irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 - std \i, \i * 8 + SIE_SAVEAREA_HOST_FPRS(%r3) - .endr - stfpc SIE_SAVEAREA_HOST_FPC(%r3) - - stctg %c1, %c1, SIE_SAVEAREA_HOST_ASCE(%r3) - lctlg %c1, %c1, SIE_SAVEAREA_GUEST_ASCE(%r3) - - # Store scb and save_area pointer into stack frame - stg %r2,__SF_SIE_CONTROL(%r15) # save control block pointer - stg %r3,__SF_SIE_SAVEAREA(%r15) # save guest register save area -.globl sie_entry_gregs -sie_entry_gregs: - # Load guest's gprs, fprs and fpc - .irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 - ld \i, \i * 8 + SIE_SAVEAREA_GUEST_FPRS(%r3) - .endr - lfpc SIE_SAVEAREA_GUEST_FPC(%r3) - lmg %r0,%r13,SIE_SAVEAREA_GUEST_GRS(%r3) - - # Move scb ptr into r14 for the sie instruction - lg %r14,__SF_SIE_CONTROL(%r15) - -.globl sie_entry -sie_entry: - sie 0(%r14) - nopr 7 - nopr 7 - nopr 7 - -.globl sie_exit -sie_exit: - # Load guest register save area - lg %r14,__SF_SIE_SAVEAREA(%r15) - - # Restore the host asce - lctlg %c1, %c1, SIE_SAVEAREA_HOST_ASCE(%r14) - - # Store guest's gprs, fprs and fpc - stmg %r0,%r13,SIE_SAVEAREA_GUEST_GRS(%r14) # save guest gprs 0-13 - .irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 - std \i, \i * 8 + SIE_SAVEAREA_GUEST_FPRS(%r14) - .endr - stfpc SIE_SAVEAREA_GUEST_FPC(%r14) - - # Restore host's gprs, fprs and fpc - .irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 - ld \i, \i * 8 + SIE_SAVEAREA_HOST_FPRS(%r14) - .endr - lfpc SIE_SAVEAREA_HOST_FPC(%r14) - lmg %r0,%r14,SIE_SAVEAREA_HOST_GRS(%r14) # restore kernel registers -.globl sie_exit_gregs -sie_exit_gregs: - br %r14 - .align 8 reset_psw: .quad 0x0008000180000000 From patchwork Tue Aug 6 08:42:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 13754558 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 157B013A884; Tue, 6 Aug 2024 08:45:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722933944; cv=none; b=C/v8kkW3gq5Vq5Pfjth3S5KHKDoXf4i7Zk2MtFhnyWABm1WFG22UabLiePDZ0fG101mbaFuvR5rAl7GpR1rCjohgOWOCaC+nZJgr0PMe9rWAAbws8Ou8vtNWQOn6o6Uu2IzII3ge5FSsMezlThNaLy7s2jp60hNTJ5m3bzsvO0A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722933944; c=relaxed/simple; bh=WGR3hVrE69zuyTKMQ12gWY3P2OgFAtl1JhhMDb+St94=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tThR7+TpY5UZBpB2JQndEV61aYRE1uMYCU6LI+izQTEqmmWJWWibk2CGV94PbCMWpLJLU3hJ6kLYxOLLXbx/Ujf0j2ChOTgC3arwezu6j7TrmzVVr8L555WebEcpOedx+7bri/+vIW9Z3zSNzH8NNqc3KgV09PIJnQN/K/yuY6I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=PeKe1+En; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="PeKe1+En" Received: from pps.filterd (m0353727.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4766wlfs009256; Tue, 6 Aug 2024 08:45:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=pp1; bh=8anzQFlMAVEfs F/gw1ln2T5PLdXa31SXHBwsZcQlXZ0=; b=PeKe1+En7YK373oDPfQum/UEUbdUE P1aTDoJ8hh7Irn1LEBwVav4mMldLr+r7FVzAydhazd2hnAggzjfnvnt7bwzcDm7z /Cqu9xgcktIQKxmtSz1CKN4numMFW+UkJUVmpIh++pdcFgIwqmZ4o59v3Fjjq8Zr RwJ5Roaf23uPBHfpy+kL198EAv8gP2Khlu36FsQXPt2s9SZQeltZAIGmRkT3TdSH nS7k4L04OcqeuRyuYEkaLNg7cD5FGSG/wPCQwoCln4A5eeAHqDYthBJDn3D8U4rc GIuX90CuqktbTOU15Y5QSj/LHPGIFw2jRBwIFrpFzBdeLHFD4nCZrze7Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 40uf1fr7g9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Aug 2024 08:45:41 +0000 (GMT) Received: from m0353727.ppops.net (m0353727.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 4768jeaE006844; Tue, 6 Aug 2024 08:45:40 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 40uf1fr7g3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Aug 2024 08:45:40 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 4765Rhgg006406; Tue, 6 Aug 2024 08:45:39 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 40t13mafaq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Aug 2024 08:45:39 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4768jYVa56623550 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 6 Aug 2024 08:45:36 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4CB072004F; Tue, 6 Aug 2024 08:45:34 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 15EA82006C; Tue, 6 Aug 2024 08:45:34 +0000 (GMT) Received: from a46lp67.lnxne.boe (unknown [9.152.108.100]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 6 Aug 2024 08:45:34 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, nrb@linux.ibm.com, schlameuss@linux.ibm.com, nsg@linux.ibm.com, npiggin@gmail.com, mhartmay@linux.ibm.com Subject: [kvm-unit-tests PATCH v2 4/4] lib: s390x: Split SIE fw structs from lib structs Date: Tue, 6 Aug 2024 08:42:30 +0000 Message-ID: <20240806084409.169039-5-frankja@linux.ibm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240806084409.169039-1-frankja@linux.ibm.com> References: <20240806084409.169039-1-frankja@linux.ibm.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Nel3TucFG4GmRCGTHZiJ_ckFVmJ5vAGJ X-Proofpoint-ORIG-GUID: 9BrTM_TbPRaidfrJw82CanwlaF8uFTnt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-06_06,2024-08-02_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 impostorscore=0 malwarescore=0 bulkscore=0 mlxlogscore=999 lowpriorityscore=0 suspectscore=0 adultscore=0 mlxscore=0 spamscore=0 phishscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2408060060 The SIE control block is huge and takes up too much space. Let's split the hardware definitions from sie.h into its own header, so that sie.h will only contain library functions and structs Signed-off-by: Janosch Frank Reviewed-by: Christoph Schlameuss Reviewed-by: Claudio Imbrenda --- lib/s390x/{sie.h => asm/sie-arch.h} | 58 +------ lib/s390x/sie.h | 231 +--------------------------- 2 files changed, 4 insertions(+), 285 deletions(-) copy lib/s390x/{sie.h => asm/sie-arch.h} (81%) diff --git a/lib/s390x/sie.h b/lib/s390x/asm/sie-arch.h similarity index 81% copy from lib/s390x/sie.h copy to lib/s390x/asm/sie-arch.h index c1724cf2..4911c988 100644 --- a/lib/s390x/sie.h +++ b/lib/s390x/asm/sie-arch.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef _S390X_SIE_H_ -#define _S390X_SIE_H_ +#ifndef _S390X_SIE_ARCH_H_ +#define _S390X_SIE_ARCH_H_ #include #include @@ -235,56 +235,4 @@ struct esca_block { struct esca_entry cpu[256]; }; -struct vm_uv { - uint64_t vm_handle; - uint64_t vcpu_handle; - uint64_t asce; - void *conf_base_stor; - void *conf_var_stor; - void *cpu_stor; -}; - -struct vm_save_regs { - uint64_t asce; - uint64_t grs[16]; - uint64_t fprs[16]; - uint32_t fpc; -}; - -/* We might be able to nestle all of this into the stack frame. But - * having a dedicated save area that saves more than the s390 ELF ABI - * defines leaves us more freedom in the implementation. -*/ -struct vm_save_area { - struct vm_save_regs guest; - struct vm_save_regs host; -}; - -struct vm { - struct kvm_s390_sie_block *sblk; - struct vm_save_area save_area; - struct esca_block *sca; /* System Control Area */ - uint8_t *crycb; /* Crypto Control Block */ - struct vm_uv uv; /* PV UV information */ - /* Ptr to first guest page */ - uint8_t *guest_mem; - bool validity_expected; -}; - -extern void sie_entry(void); -extern void sie_exit(void); -extern void sie_entry_gregs(void); -extern void sie_exit_gregs(void); -extern void sie64a(struct kvm_s390_sie_block *sblk, struct vm_save_area *save_area); -void sie(struct vm *vm); -void sie_expect_validity(struct vm *vm); -uint16_t sie_get_validity(struct vm *vm); -void sie_check_validity(struct vm *vm, uint16_t vir_exp); -void sie_handle_validity(struct vm *vm); -void sie_guest_sca_create(struct vm *vm); -void sie_guest_create(struct vm *vm, uint64_t guest_mem, uint64_t guest_mem_len); -void sie_guest_destroy(struct vm *vm); - -uint8_t *sie_guest_alloc(uint64_t guest_size); - -#endif /* _S390X_SIE_H_ */ +#endif /* _S390X_SIE_ARCH_H_ */ diff --git a/lib/s390x/sie.h b/lib/s390x/sie.h index c1724cf2..f13e698f 100644 --- a/lib/s390x/sie.h +++ b/lib/s390x/sie.h @@ -4,236 +4,7 @@ #include #include - -#define CPUSTAT_STOPPED 0x80000000 -#define CPUSTAT_WAIT 0x10000000 -#define CPUSTAT_ECALL_PEND 0x08000000 -#define CPUSTAT_STOP_INT 0x04000000 -#define CPUSTAT_IO_INT 0x02000000 -#define CPUSTAT_EXT_INT 0x01000000 -#define CPUSTAT_RUNNING 0x00800000 -#define CPUSTAT_RETAINED 0x00400000 -#define CPUSTAT_TIMING_SUB 0x00020000 -#define CPUSTAT_SIE_SUB 0x00010000 -#define CPUSTAT_RRF 0x00008000 -#define CPUSTAT_SLSV 0x00004000 -#define CPUSTAT_SLSR 0x00002000 -#define CPUSTAT_ZARCH 0x00000800 -#define CPUSTAT_MCDS 0x00000100 -#define CPUSTAT_KSS 0x00000200 -#define CPUSTAT_SM 0x00000080 -#define CPUSTAT_IBS 0x00000040 -#define CPUSTAT_GED2 0x00000010 -#define CPUSTAT_G 0x00000008 -#define CPUSTAT_GED 0x00000004 -#define CPUSTAT_J 0x00000002 -#define CPUSTAT_P 0x00000001 - -struct kvm_s390_sie_block { - uint32_t cpuflags; /* 0x0000 */ - uint32_t : 1; /* 0x0004 */ - uint32_t prefix : 18; - uint32_t : 1; - uint32_t ibc : 12; - uint8_t reserved08[4]; /* 0x0008 */ -#define PROG_IN_SIE (1<<0) - uint32_t prog0c; /* 0x000c */ -union { - uint8_t reserved10[16]; /* 0x0010 */ - struct { - uint64_t pv_handle_cpu; - uint64_t pv_handle_config; - }; - }; -#define PROG_BLOCK_SIE (1<<0) -#define PROG_REQUEST (1<<1) - uint32_t prog20; /* 0x0020 */ - uint8_t reserved24[4]; /* 0x0024 */ - uint64_t cputm; /* 0x0028 */ - uint64_t ckc; /* 0x0030 */ - uint64_t epoch; /* 0x0038 */ - uint32_t svcc; /* 0x0040 */ -#define LCTL_CR0 0x8000 -#define LCTL_CR6 0x0200 -#define LCTL_CR9 0x0040 -#define LCTL_CR10 0x0020 -#define LCTL_CR11 0x0010 -#define LCTL_CR14 0x0002 - uint16_t lctl; /* 0x0044 */ - int16_t icpua; /* 0x0046 */ -#define ICTL_OPEREXC 0x80000000 -#define ICTL_PINT 0x20000000 -#define ICTL_LPSW 0x00400000 -#define ICTL_STCTL 0x00040000 -#define ICTL_ISKE 0x00004000 -#define ICTL_SSKE 0x00002000 -#define ICTL_RRBE 0x00001000 -#define ICTL_TPROT 0x00000200 - uint32_t ictl; /* 0x0048 */ -#define ECA_CEI 0x80000000 -#define ECA_IB 0x40000000 -#define ECA_SIGPI 0x10000000 -#define ECA_MVPGI 0x01000000 -#define ECA_AIV 0x00200000 -#define ECA_VX 0x00020000 -#define ECA_PROTEXCI 0x00002000 -#define ECA_APIE 0x00000008 -#define ECA_SII 0x00000001 - uint32_t eca; /* 0x004c */ -#define ICPT_INST 0x04 -#define ICPT_PROGI 0x08 -#define ICPT_INSTPROGI 0x0C -#define ICPT_EXTREQ 0x10 -#define ICPT_EXTINT 0x14 -#define ICPT_IOREQ 0x18 -#define ICPT_WAIT 0x1c -#define ICPT_VALIDITY 0x20 -#define ICPT_STOP 0x28 -#define ICPT_OPEREXC 0x2C -#define ICPT_PARTEXEC 0x38 -#define ICPT_IOINST 0x40 -#define ICPT_KSS 0x5c -#define ICPT_INT_ENABLE 0x64 -#define ICPT_PV_INSTR 0x68 -#define ICPT_PV_NOTIFY 0x6c -#define ICPT_PV_PREF 0x70 - uint8_t icptcode; /* 0x0050 */ - uint8_t icptstatus; /* 0x0051 */ - uint16_t ihcpu; /* 0x0052 */ - uint8_t reserved54; /* 0x0054 */ -#define IICTL_CODE_NONE 0x00 -#define IICTL_CODE_MCHK 0x01 -#define IICTL_CODE_EXT 0x02 -#define IICTL_CODE_IO 0x03 -#define IICTL_CODE_RESTART 0x04 -#define IICTL_CODE_SPECIFICATION 0x10 -#define IICTL_CODE_OPERAND 0x11 - uint8_t iictl; /* 0x0055 */ - uint16_t ipa; /* 0x0056 */ - uint32_t ipb; /* 0x0058 */ - uint32_t scaoh; /* 0x005c */ -#define FPF_BPBC 0x20 - uint8_t fpf; /* 0x0060 */ -#define ECB_GS 0x40 -#define ECB_TE 0x10 -#define ECB_SPECI 0x08 -#define ECB_SRSI 0x04 -#define ECB_HOSTPROTINT 0x02 - uint8_t ecb; /* 0x0061 */ -#define ECB2_CMMA 0x80 -#define ECB2_IEP 0x20 -#define ECB2_PFMFI 0x08 -#define ECB2_ESCA 0x04 - uint8_t ecb2; /* 0x0062 */ -#define ECB3_DEA 0x08 -#define ECB3_AES 0x04 -#define ECB3_RI 0x01 - uint8_t ecb3; /* 0x0063 */ - uint32_t scaol; /* 0x0064 */ - uint8_t sdf; /* 0x0068 */ - uint8_t epdx; /* 0x0069 */ - uint8_t reserved6a[2]; /* 0x006a */ - uint32_t todpr; /* 0x006c */ -#define GISA_FORMAT1 0x00000001 - uint32_t gd; /* 0x0070 */ - uint8_t reserved74[12]; /* 0x0074 */ - uint64_t mso; /* 0x0080 */ - uint64_t msl; /* 0x0088 */ - struct psw gpsw; /* 0x0090 */ - uint64_t gg14; /* 0x00a0 */ - uint64_t gg15; /* 0x00a8 */ - uint8_t reservedb0[8]; /* 0x00b0 */ -#define HPID_KVM 0x4 -#define HPID_VSIE 0x5 - uint8_t hpid; /* 0x00b8 */ - uint8_t reservedb9[7]; /* 0x00b9 */ - union { - struct { - uint32_t eiparams; /* 0x00c0 */ - uint16_t extcpuaddr; /* 0x00c4 */ - uint16_t eic; /* 0x00c6 */ - }; - uint64_t mcic; /* 0x00c0 */ - } __attribute__ ((__packed__)); - uint32_t reservedc8; /* 0x00c8 */ - uint16_t pgmilc; /* 0x00cc */ - uint16_t iprcc; /* 0x00ce */ - uint32_t dxc; /* 0x00d0 */ - uint16_t mcn; /* 0x00d4 */ - uint8_t perc; /* 0x00d6 */ - uint8_t peratmid; /* 0x00d7 */ - uint64_t peraddr; /* 0x00d8 */ - uint8_t eai; /* 0x00e0 */ - uint8_t peraid; /* 0x00e1 */ - uint8_t oai; /* 0x00e2 */ - uint8_t armid; /* 0x00e3 */ - uint8_t reservede4[4]; /* 0x00e4 */ - uint64_t tecmc; /* 0x00e8 */ - uint8_t reservedf0[12]; /* 0x00f0 */ -#define CRYCB_FORMAT_MASK 0x00000003 -#define CRYCB_FORMAT0 0x00000000 -#define CRYCB_FORMAT1 0x00000001 -#define CRYCB_FORMAT2 0x00000003 - uint32_t crycbd; /* 0x00fc */ - uint64_t gcr[16]; /* 0x0100 */ - union { - uint64_t gbea; /* 0x0180 */ - uint64_t sidad; - }; - uint8_t reserved188[8]; /* 0x0188 */ - uint64_t sdnxo; /* 0x0190 */ - uint8_t reserved198[8]; /* 0x0198 */ - uint32_t fac; /* 0x01a0 */ - uint8_t reserved1a4[20]; /* 0x01a4 */ - uint64_t cbrlo; /* 0x01b8 */ - uint8_t reserved1c0[8]; /* 0x01c0 */ -#define ECD_HOSTREGMGMT 0x20000000 -#define ECD_MEF 0x08000000 -#define ECD_ETOKENF 0x02000000 -#define ECD_ECC 0x00200000 - uint32_t ecd; /* 0x01c8 */ - uint8_t reserved1cc[18]; /* 0x01cc */ - uint64_t pp; /* 0x01de */ - uint8_t reserved1e6[2]; /* 0x01e6 */ - uint64_t itdba; /* 0x01e8 */ - uint64_t riccbd; /* 0x01f0 */ - uint64_t gvrd; /* 0x01f8 */ - uint64_t reserved200[48]; /* 0x0200 */ - uint64_t pv_grregs[16]; /* 0x0380 */ -} __attribute__((packed)); - -union esca_sigp_ctrl { - uint16_t value; - struct { - uint8_t c : 1; - uint8_t reserved: 7; - uint8_t scn; - }; -}; - -struct esca_entry { - union esca_sigp_ctrl sigp_ctrl; - uint16_t reserved1[3]; - uint64_t sda; - uint64_t reserved2[6]; -}; - -union ipte_control { - unsigned long val; - struct { - unsigned long k : 1; - unsigned long kh : 31; - unsigned long kg : 32; - }; -}; - -struct esca_block { - union ipte_control ipte_control; - uint64_t reserved1[7]; - uint64_t mcn[4]; - uint64_t reserved2[20]; - struct esca_entry cpu[256]; -}; +#include struct vm_uv { uint64_t vm_handle;