From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B135606A332 for ; Fri, 4 Dec 2026 13:44:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=syn8f1Mz; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=Njb3BG/B DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=1UB7Ftn3n9IDdYAlOxYYuCJy7JJI4LDK0syGboHhoMU=; b=syn8f1MzS/nt2p jv6mrc4FteSMEGQhRO6Sp0OFN8XAjt+uXRYfpWYlywK62VAuT5GgCXWYWIHoGjvhRAqH0KeUSc5jZ PziZT7Bb8P0QY+XrL8zMZdPG6XGiYJFHdaGqbqrRChOlQ/1MNcSUiMcpKopwBA27WEbptwCXFm8Tz eJtHrPi+MtyZYoIcTyz+7eDjRbxriSR4vuDE8X/U7wsQV2EafWhfIKmcEHe3c7dfd99KZJBWLcHNq 04NRGNq9c+lGKR/WATzhQSavAla+ru5C+LImvYTb22gZPQtYcTfBlw/asW2V1zMa2NCM6cnnAvMO5 5kd/kmdfCLN5G5zLq8JQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZTZr-00000000RfA-2c88; Fri, 04 Dec 2026 13:43:55 +0000 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZTZo-00000000ReG-36Ia for linux-arm-kernel@lists.infradead.org; Fri, 04 Dec 2026 13:43:54 +0000 Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B4BZ29Z2002570; Fri, 4 Dec 2026 13:43:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pp1; bh=1UB7Ft n3n9IDdYAlOxYYuCJy7JJI4LDK0syGboHhoMU=; b=Njb3BG/BBUO7U2hlIHjdaM UERKKYto1dRjX3DRWInUQE64Nt1+Np5q9xRAbDR+SgIPcyHsDOIIHYrqdQccXBDP 7RLiVOX+IvBcTppAFWSQ8ub/px+BmXk11JFkLI4Q79yXO6EnVH7YRj4LgjOhNrcu bnvybNhk4Q5lpab9+j+TloDic6qHK2uf2XrEtv7SY40VFLcOz3CmpiayFTs8ajjr 3cbA3UAQUC1Qls16yRYf+r0Yhwr0UVT/KGNS4dcBHFBd1BYvr5xe+iAnRSbHo4p3 bilekcI3pjOrWqEYmJfv+KP0lQcWRn8BJ6sCja1YEpljg6p+EXh8eWnE3+SUnAOQ == Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4jbqgg1yw3-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 04 Dec 2026 13:43:26 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 6B4BJNBn3120332; Fri, 4 Dec 2026 13:43:25 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4jbnggj81n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Dec 2026 13:43:25 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 6B4DhHQE56164778 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 4 Dec 2026 13:43:17 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EC5F62004B; Fri, 4 Dec 2026 13:43:16 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4A72620040; Fri, 4 Dec 2026 13:43:16 +0000 (GMT) Received: from [9.68.16.159] (unknown [9.68.16.159]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 4 Dec 2026 13:43:16 +0000 (GMT) Message-ID: Date: Fri, 4 Dec 2026 14:43:15 +0100 X-Archived-By: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 00/25] KVM: s390: arm64: System Registers To: Steffen Eiden , Marc Zyngier , Oliver Upton , Fuad Tabba , Joey Gouly , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Mark Rutland , Andreas Grapentin , Janosch Frank , Claudio Imbrenda , David Hildenbrand , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Sven Schnelle , Friedrich Welter , Gautam Gala , Hariharan Mari , Hendrik Brueckner , Nico Boehr , Ulrich Weigand , Arnd Bergmann , Paolo Bonzini Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-s390@vger.kernel.org, Nina Schoetterl-Glausch , Jens Remus References: <20261127-sysreg-v4-0-a6318d18aab5@linux.ibm.com> Content-Language: en-US From: Christian Borntraeger In-Reply-To: <20261127-sysreg-v4-0-a6318d18aab5@linux.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: YpJQp-iyK9eFfgfCk21RwLErm9c6p-cm X-Proofpoint-Spam-Info: AW1haW4tMjYxMjA0MDA1NCBTYWx0ZWRfX0tuWGoBCvEiL 4xCN7rCKZI7MQZiOlqSLDtTmsXKqMbdCSkpxkLOrZsaxYAZ3Dl4qQ/BJwAwPJQZ0cy+wlM+teLr 4pKSDrL0aR6/8mo/jzDFR3EtJgPFziM= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjA0MDA1NCBTYWx0ZWRfX2eVw7Z/O/5yM 59j8BAv+cwGnkc0mOUO42MeS+dKNpXCB8onVGIZett+jtTYd7UreWq//lgY4PFiwDyiPCU3xH/S VyiJmwdmAnK1jh091MDMj+D4S30oEdZkaewMsrDSLpRoA/qsVWYeH3vLj488uQgjDuJIiZxO1X2 f/OfWZYE1TLSMcWREA1H9qnsX7lHc2RIyhhfZ7gCiufuwNI39eKCXFXQJa/VCLES602w1ER666t vjig8icgZo6J9AD8sLPqZcTixj/ZtdVVI/0BSSMFRYarsK0TYeqJIKBnYOtuQAwvXqCrrvI17qo CLlXDwP22UUkbgqeUtBcDn0MqHTLZ32AX9F7YX4mL4buvEZ2CLQlJE/eekyrCR9rmNQP7+LpOG8 IhHXUpDVVtrNkEh6EW8325JjnSSfBy1wnjIAteNzbsNFyUgUjjmd9JuQXDltkNN3fGfqmMAfKuc 7+eNMry8NNLVi1YDnrw== X-Authority-Analysis: v=2.4 cv=PaJqFShd c=1 sm=1 tr=0 ts=6b12c37e cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=PY6uMlIniNe_lD44Dn4A:9 a=tp4kGABQoYN-z-1a:21 a=QEXdDO2ut3YA:10 X-Proofpoint-GUID: YpJQp-iyK9eFfgfCk21RwLErm9c6p-cm X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-04_02,2026-12-03_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 adultscore=0 clxscore=1015 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612040054 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261204_054352_936731_C912B0A9 X-CRM114-Status: GOOD ( 48.20 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Am 27.11.26 um 15:22 schrieb Steffen Eiden: > Add system register handling for KVM/arm64 on s390. Share KVM/arm64 > code, introduce ARM guest management functions for s390 hosts, and > implement host system register & exception handling. > > This is the second series on the way to arm64 guests on s390. The first > series laid the KVM foundation (basic module, vCPU run, simple page > faults) and is included in v7.4. This series builds the system register > layer on top and closes the biggest of the remaining gaps towards a > functional guest support. > > On top of master this series requires one patch[1] not yet merged in > order to build clean. > > The series applies without those patches on master but the build will > fail or trigger warnings w/o those patches. > > Regarding merging: > > Patches 1-10 can/should go via the KVM/arm64 tree. Note that PATCH 8 is > an s390 patch but is is required so be at this position. Otherwise, s390 > will not compile when patch 10 is applied until patch 18. And I cannot > palce it before as the patch needs some stuff from the just shared > headers in PATCH 07. > > Patches 11-25 can then be picked by KVM/s390. Those require the > perquisite patch [1] mentioned above. > > A branch with the prerequisite and this series is available at > kernel.org [2]. Another series may be added on top to that branch soon. > > Changes in detail: > > arm64: > > Refactor the id register fields in arch_vcpu into a dedicated structure > such that it can be reused by s390. Refactor detection of the number of > sysregs. Mark sysreg related code as shared. > > A few code pieces are moved inside arm headers/code to reduce the amount > of shared sections. This adds a bit of churn in the diff but reduces the > shared marker __churn__ at the end. > > The shared regions deliberately contain more code and more headers than > s390 currently needs. Larger contiguous regions mean less churn whenever > the surrounding arm64 code changes. Some of this code will be used by > later series anyways. Some of the shared code will probably never be > reused by s390 at all. I trust the compiler to remove it. The reduced > churn outweighs this drawback. Since unused function checking is > disabled for shared code [3], sharing more than required does not > introduce warnings once everything is merged. > > s390: > > Add s390 instruction support for ARM guest management: easr/sasr for > system register access, QAAF for feature queries, and ptff extensions > for guest time handling. > > Implement complete sysreg handling for s390 including feature > sanitisation, register enumeration and access, exception injection, and > finalized page fault handling. For now s390 maintains its own sysreg > table but I intend to share the table with arm as soon as possible. > > Emulation: > > Guest accesses to ID registers are trapped and served from a sanitized > copy of the QAAF query results, using the ID register sanitisation and > finalisation infrastructure shared with arm64. Userspace sees and > controls guest ID registers with the usual semantics. After the first > vCPU run the values are final. All other system registers live in the > SAE save area and are accessed by the host via EASR/SASR, either on > guest traps or through the one-reg/two-reg UAPI. The save area itself is > initialized from the QAAF-provided initial save area. > > Exception handling: > > Unsupported or invalid guest actions now raise proper arm64 exceptions > instead of failing exits. Page faults beyond the guest's address limits > are injected as address size faults or synchronous external aborts, > mirroring arm64's kvm_handle_guest_abort() injected faults re-enter the > guest with the pending exception instead of exiting to userspace. > > Features and userspace: > > SVE is offered to guests at 128-bit vector length, backed by s390's > Vector Extension. Pointer authentication is passed through where > hardware support exists. The AEF capabilities are reported under > /sys/firmware/aef/, including the raw QAAF query results. > > Steffen > > [1] https://lore.kernel.org/all/20261105-insn-v2-1-ff27987aa212@linux.ibm.com > [2] https://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git/log/?h=sae > > --- > Changes in v4: > arm64: > - split up id register refactroing into two: defineing helpers, then > creating the new struct (marc) > - New patch "arm64: vdso: Define ARM64_S390_COMMON=1 for all vdso builds" > to fix the arm64 (compat) vDSO build, which dies on -Wundef/-Werror > when the sharing marker is unset. > - OSLSR conversion: also update the tools copy of sysreg.h > > s390: > - The guest PT offset (EPD) is now tracked per-VM instead of per-vcpu. > - vcpu_reset_hcrx() is now non-static, runs after the feature set has > been restricted (vcpu run pid change), and sets HCRX_EL2_MSCEn > unconditionally, depending on MOPS > - Feature sanitisation: ARM64_HAS_HCR_NV1 no longer probes > ID_AA64MMFR4_EL1.E2H0 and reports false, matching the other > non-emulatable capabilities. > - AEF sysfs: dropped the redundant sae_avail/ptff_avail/edat2_avail > attributes > - Authorship fixes: range-check asm macro patch is solely authored by > Jens Remus. SVE patch authorship now credits Friedrich Welter. > - more smaller issues resolved > > - Collected Reviewed-by tags from Joey Goulyand rebased onto master > - Link to v3: https://lore.kernel.org/r/20261106-sysreg-v3-0-75e95980fb10@linux.ibm.com > > Changes in v3: > - rebase into 7.4-rc2 (including the first batch of arm on s390 patches) > - guard style changed from `#ifdef ARM64_S390_COMMON` to `#if ARM64_S390_COMMON == 1` > - Improve and clarify commit messages > arm64: > - generate OSLSR definitions > - consolidate more shared sections by: > - moving some code in beforehand > - deliberately adding more code/header than required. > due to [3] there will not be any unused warnings when merged. > - reduce sharing churn > > s390 > - streamline sasr/easr instruction generation and use > - aef_info() aggregate removed; new minimal aef_usable()/aef_gisrsa() API > - qaaf enum numbering reorganized, on reserved field was incorrectly > identified as a register. > - aef.c no longer aggregates or gates on CONFIG_KVM_S390_ARM64. > - spectre.c stubs replaced with real queries of sanitized ID regs. > - Many new sys_reg_descs entries > - QAAF init save area: save area now memcpy'd from cached aef_gisrsa() > instead of kvm_vcpu_init_save_area() > - improved pagefault handling > - reworked SVE helpers > - fixed various smaller bugs > - Link to v2: https://lore.kernel.org/all/20260831145536.913567-1-seiden@linux.ibm.com/ > > Changes in v2: > - rework the entire sharing code concept to use marker instead of moving > code. > > --- > Friedrich Welter (1): > KVM: s390: arm64: Implement SVE for arm guests > > Jens Remus (1): > s390: Add range check asm macro > > Steffen Eiden (23): > KVM: arm64: Route VM ID register accesses through helpers > KVM: arm64: Refactor idreg caching into dedicated structure > KVM: arm64: Extract number of sys_reg_desc into a constant > arm64: sysreg: Convert OSLSR to automatic register generation > arm64: vdso: Define ARM64_S390_COMMON=1 for all vdso builds > arm64: Prepare headers for sysreg sharing with s390 > arm64: Share system register related headers and functions with s390 > KVM: s390: arm64: Prepare for sharing arm64 SVE and ftr-reg code > KVM: arm64: Prepare sys_regs.c for sharing with s390 > KVM: arm64: Share system register code with s390 > s390: tools: Share arm64/kvm headers > s390: Read/write ARM system registers > s390: Query arm guest time > KVM: s390: arm64: Query Available Arm features > KVM: s390: arm64: Verify machine feature set before loading > KVM: s390: arm64: Implement feature sanitisation > KVM: s390: arm64: Implement arm system register managing infrastructure > KVM: s390: arm64: Integrate system registers into the host > KVM: s390: arm64: Use QAAF init save area > KVM: s390: arm64: Implement exception injection > KVM: s390: arm64: Finalize page fault handling > KVM: s390: arm64: Promote PTRAUTH capability > s390: Report AEF features to sysfs > > Documentation/ABI/testing/sysfs-firmware-aef | 51 ++ > arch/arm64/include/asm/cache.h | 3 + > arch/arm64/include/asm/cputype.h | 3 + > arch/arm64/include/asm/kvm_emulate.h | 5 +- > arch/arm64/include/asm/kvm_host.h | 101 +++- > arch/arm64/include/asm/spectre.h | 13 +- > arch/arm64/include/asm/sysreg.h | 12 +- > arch/arm64/kernel/vdso32/Makefile | 2 + > arch/arm64/kvm/arm.c | 3 + > arch/arm64/kvm/config.c | 12 +- > arch/arm64/kvm/guest.c | 11 +- > arch/arm64/kvm/hyp/nvhe/pkvm.c | 10 +- > arch/arm64/kvm/hyp/nvhe/sys_regs.c | 5 +- > arch/arm64/kvm/sys_regs.c | 113 ++-- > arch/arm64/kvm/sys_regs.h | 1 + > arch/arm64/tools/sysreg | 14 + > arch/s390/include/arm64/kvm_emulate.h | 2 + > arch/s390/include/arm64/kvm_hyp.h | 18 + > arch/s390/include/arm64/kvm_nested.h | 5 + > arch/s390/include/arm64/sys_regs.h | 9 + > arch/s390/include/asm/aef.h | 12 + > arch/s390/include/asm/insn-common-asm.h | 28 + > arch/s390/include/asm/kvm_host_arm64.h | 238 +++++++- > arch/s390/include/asm/kvm_host_arm64_types.h | 115 ++++ > arch/s390/include/asm/sae-asm.h | 45 ++ > arch/s390/include/asm/sae.h | 93 +++ > arch/s390/include/asm/timex.h | 53 ++ > arch/s390/kernel/Makefile | 2 +- > arch/s390/kernel/aef.c | 192 +++++++ > arch/s390/kernel/dis.c | 1 + > arch/s390/kvm/arm64/Makefile | 7 +- > arch/s390/kvm/arm64/Makefile.gen | 3 +- > arch/s390/kvm/arm64/arm.c | 107 +++- > arch/s390/kvm/arm64/exception.c | 109 ++++ > arch/s390/kvm/arm64/feature.c | 178 ++++++ > arch/s390/kvm/arm64/feature.h | 97 ++++ > arch/s390/kvm/arm64/guest.c | 268 ++++++++- > arch/s390/kvm/arm64/handle_exit.c | 1 + > arch/s390/kvm/arm64/inject_fault.c | 65 ++- > arch/s390/kvm/arm64/mmu.c | 74 ++- > arch/s390/kvm/arm64/qaaf.c | 85 +++ > arch/s390/kvm/arm64/qaaf.h | 12 + > arch/s390/kvm/arm64/reset.c | 72 +++ > arch/s390/kvm/arm64/spectre.c | 51 ++ > arch/s390/kvm/arm64/sys_regs.c | 831 +++++++++++++++++++++++++++ > arch/s390/kvm/arm64/trace.h | 50 ++ > arch/s390/tools/Makefile.arm64h | 11 +- > arch/s390/tools/opcodes.txt | 3 + > include/kvm/arm_arch_timer.h | 3 + > tools/arch/arm64/include/asm/sysreg.h | 12 +- > 50 files changed, 3052 insertions(+), 159 deletions(-) > > base-commit: 9437ee8b6cf607e883b36e44bd755968daaebd48 > change-id: 20261106-sysreg-d6adf0cd34d4 > prerequisite-message-id: 20261105-insn-v2-1-ff27987aa212@linux.ibm.com > prerequisite-patch-id: ed28ef94c9056cb81bb738f1b54745d012cb613f So I queued 11-25 (with 18 and 19 as v5) plus the kerneldoc fixup from Heiko to kvms390/next.