All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steffen Eiden <seiden@linux.ibm.com>
To: Marc Zyngier <maz@kernel.org>, Oliver Upton <oupton@kernel.org>,
	Fuad Tabba <fuad.tabba@linux.dev>,
	Joey Gouly <joey.gouly@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Zenghui Yu <yuzenghui@huawei.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Andreas Grapentin <gra@linux.ibm.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Janosch Frank <frankja@linux.ibm.com>,
	Claudio Imbrenda <imbrenda@linux.ibm.com>,
	David Hildenbrand <david@kernel.org>,
	Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>,
	Friedrich Welter <fritz@linux.ibm.com>,
	Gautam Gala <ggala@linux.ibm.com>,
	Hariharan Mari <hari55@linux.ibm.com>,
	Hendrik Brueckner <brueckner@linux.ibm.com>,
	Nico Boehr <nrb@linux.ibm.com>,
	Ulrich Weigand <Ulrich.Weigand@de.ibm.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Paolo Bonzini <pbonzini@redhat.com>
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, Steffen Eiden <seiden@linux.ibm.com>
Subject: [PATCH 00/12] KVM: s390: arm64: SMCCC, timers and IRQ line
Date: Wed, 02 Dec 2026 15:11:38 +0100	[thread overview]
Message-ID: <20261202-smccc-v1-0-48340e2737b6@linux.ibm.com> (raw)

Add SMCCC/PSCI support, the arm64 architected timers, WFx* handling and
the userspace IRQ line for KVM/arm64 on s390. The arm64 SMCCC, timer and
vCPU power management code is shared with s390 and wired into the s390
KVM module.

This is the third 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. The second series built the system
register layer [1]. This series adds the guest CPU management layer on
top. Power management with PSCI, full SMCCC handling, the architected
timers and interrupt injection from userspace.

This series depends on the second series [1], on the vCPU kick
enabling series [2], and on the vgic stubs patch [3]

PATCH 04 and 05 can be squashed into series 2 [1] and will be when I
send v5. I just did not want to send a respin after a few days w/o much
comments.

Changes in detail:

arm64:

Prepare headers and code for sharing with s390: guard arm64 headers
that reside in include/ such that s390 can consume them, and move
a few things/ The moves add a bit of churn in the diff but reduce the
number of shared sections required for the timer from seven to two.

Share the SMCCC related files (hypercalls, psci, trng, pvtime) as a
whole.Share the timer functionality that is architecture agnostic. As
timers work differently on s390 only a subset can be reused. Share the
functions for managing SMP guests.

s390:

Implement the mp_state plumbing for arm64 guests backed by the shared
power-off/suspend infrastructure and the MPIDR data used for SMP guest
management.

Use the shared arm64 code for handling SMCCCs and implement the final
host-side plumbing, removing the primitive SYSTEM_OFF only
implementation.

Add support for the arm64 architected timers (virtual and physical) of
an arm64 guest. The SAE block holds the timer control registers, and
ISTATUS in CTL is set when a timer condition is met. The shared arm64
arch_timer.c is built with s390-specific backends: CTL and CVAL are
accessed through vcpu_{read,write}_sys_reg(), and the guest counter is
obtained with PTFF QAGPT from the guest physical time offset (GPTO) in
the SAE block.

Trap WFx* and handle them in kvm_handle_wfx(). A vCPU halted in WFI or
WFIT is woken by a background hrtimer armed for the earliest of the
enabled guest timer expiries and the WFIT deadline; on expiry the
hrtimer raises KVM_REQ_UNBLOCK and wakes the vCPU.

There is no in-kernel irqchip (yet!), so timer output level changes
cannot be injected. After each guest exit handled in the kernel,
including a timer interception (SAE_ICPTR_TIMER), ISTATUS in CTL is
compared with the level last seen by userspace and the vCPU exits with
KVM_EXIT_INTR on a change. On vCPU reset both timers are disabled and
unmasked.

Implement the IRQ line for the !irqchip_in_kernel case, i.e. interrupt
injection from userspace.

A branch with this series at kernel.org is available [4].

	Steffen

[1] https://lore.kernel.org/all/20261127-sysreg-v4-0-a6318d18aab5@linux.ibm.com
[2] https://lore.kernel.org/all/20261125-vcpu_kick-v1-0-a203b01ab957@linux.ibm.com
[3] https://lore.kernel.org/all/20261125-kvm_vgic_stubs-v1-1-c53ca2c5959a@linux.ibm.com
[4] https://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git/log/?h=sae

---
Andreas Grapentin (1):
      KVM: s390: arm64: Add IRQ line

Gautam Gala (2):
      KVM: s390: arm64: Provide timer infrastructure
      KVM: s390: arm64: Trap WFx

Steffen Eiden (9):
      arm64: Prepare for sharing with s390
      arm64: Share timer and smccc functionality with s390
      KVM: arm64: Share timer and smccc code with s390
      KVM: s390: arm64: Use register shadow helper
      KVM: s390: arm64: Shadow the guest timer CVAL registers
      KVM: s390: arm64: Use mpstate for guests
      KVM: s390: arm64: Enable full smccc support
      KVM: s390: arm64: Report fwregs to userspace
      KVM: s390: arm64: Integrate guest timer

 arch/arm64/include/asm/kvm_emulate.h   |   4 +-
 arch/arm64/include/asm/kvm_host.h      |  40 +++---
 arch/arm64/include/asm/kvm_mmu.h       |   2 +
 arch/arm64/include/asm/pvclock-abi.h   |   1 +
 arch/arm64/kvm/arch_timer.c            |  95 +++++++-------
 arch/arm64/kvm/arm.c                   |  25 +++-
 arch/arm64/kvm/hypercalls.c            |   4 +
 arch/arm64/kvm/psci.c                  |   3 +
 arch/arm64/kvm/pvtime.c                |   2 +
 arch/arm64/kvm/trng.c                  |   2 +
 arch/s390/include/arm64/kvm_emulate.h  |   6 +
 arch/s390/include/asm/kvm_host_arm64.h |  45 ++++++-
 arch/s390/kvm/Kconfig                  |   1 +
 arch/s390/kvm/arm64/Makefile           |   7 +-
 arch/s390/kvm/arm64/Makefile.gen       |   7 +-
 arch/s390/kvm/arm64/arch_timer.c       | 226 ++++++++++++++++++++++++++++++++
 arch/s390/kvm/arm64/arm.c              | 227 ++++++++++++++++++++++++++++++---
 arch/s390/kvm/arm64/guest.c            |  14 ++
 arch/s390/kvm/arm64/handle_exit.c      | 105 ++++++++++-----
 arch/s390/kvm/arm64/hypercalls.c       |  32 +++++
 arch/s390/kvm/arm64/psci.c             |  20 +++
 arch/s390/kvm/arm64/pvtime.c           |  15 +++
 arch/s390/kvm/arm64/reset.c            |  14 +-
 arch/s390/kvm/arm64/sys_regs.c         |   8 +-
 arch/s390/kvm/arm64/trace.h            |  45 +++++++
 arch/s390/kvm/arm64/trng.c             |  12 ++
 arch/s390/tools/Makefile.arm64h        |   2 +
 include/kvm/arm_hypercalls.h           |   3 +
 include/kvm/arm_psci.h                 |   3 +
 29 files changed, 836 insertions(+), 134 deletions(-)

base-commit: 9437ee8b6cf607e883b36e44bd755968daaebd48
change-id: 20261127-smccc-c8cb09f78ebc
prerequisite-message-id: 20261105-insn-v2-1-ff27987aa212@linux.ibm.com
prerequisite-patch-id: ed28ef94c9056cb81bb738f1b54745d012cb613f
prerequisite-change-id: 20261106-sysreg-d6adf0cd34d4:v4
prerequisite-patch-id: ed28ef94c9056cb81bb738f1b54745d012cb613f
prerequisite-patch-id: 4f6b2386967522be268f77ca6eb9487a3503dc96
prerequisite-patch-id: 539f1138a427fddb952a5f7a0691e8acd974d0fb
prerequisite-patch-id: 3e9b8384f07ff18911f48eabe625a1c0507a5e96
prerequisite-patch-id: fc58c00a1006ecffd045728020ef01308022ac03
prerequisite-patch-id: 2c22bad7059a38c4ea01ca774d0c0b49cea27fba
prerequisite-patch-id: c809f818609fed0a0f8ccb1721b96f5329505543
prerequisite-patch-id: b35581eba719557148ea84232698457adc8c8cc4
prerequisite-patch-id: 0b8792bac82c24bfac0b5912d2eec5da32413747
prerequisite-patch-id: 58fb40b78dd793ca3b24cadadad8868bc54aa20e
prerequisite-patch-id: d986b0811f1feac0678eb135ce5c44140748431b
prerequisite-patch-id: 0e3d84b8259a175fceb67b01bc37c1830805636b
prerequisite-patch-id: 53a6741f3c6ec60c798995ccbf4d2b293619ec34
prerequisite-patch-id: b71ccf22e4cb8fccf4ca9eea558af14163b256db
prerequisite-patch-id: bba91e0c077b1f308e2ec914a54399f775d9090d
prerequisite-patch-id: 9be57897346558cd0bea61d946d85d3ba9a17f2e
prerequisite-patch-id: f4ae3a54ce24b78e335eb1f019b971419d82720a
prerequisite-patch-id: cc8dfe5b2b8a3f28b3c29b1a10827d99f987694d
prerequisite-patch-id: f27d96dacb5c7dadc01f1cc72158b8b3f64d7053
prerequisite-patch-id: 1c69a0380267279633c8ba33bf1d30c13877e033
prerequisite-patch-id: 20ac948d6ec4bfd4b9c3d053bcb0fcb3fe067486
prerequisite-patch-id: db6b83091a6107dbfd9c4311af14fadf1534375f
prerequisite-patch-id: af30d541a7cabea0981dfe79276d1e9991a8c91a
prerequisite-patch-id: 5eead648d962cbdc9f45ce40538f174faedd5775
prerequisite-patch-id: 97589af6c7ac9efe15c371883511fc05d4f1c870
prerequisite-patch-id: f661ef5923e8026fab81d73e596006ac30d5cbac
prerequisite-message-id: 20261125-kvm_vgic_stubs-v1-1-c53ca2c5959a@linux.ibm.com
prerequisite-patch-id: bd1a0c1fa7ff80d9edd5fff5258d8af1de06d7d7
prerequisite-message-id: 20261125-vcpu_kick-v1-0-a203b01ab957@linux.ibm.com
prerequisite-patch-id: 90cb98820a1c6fec2085ca6830827f90c6b659ab
prerequisite-patch-id: 36feb5c5ca141ca0a94f60e8cc27e3969f3ebefd


             reply	other threads:[~2026-12-02 14:12 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 14:11 Steffen Eiden [this message]
2026-12-02 14:11 ` [PATCH 01/12] arm64: Prepare for sharing with s390 Steffen Eiden
2026-12-02 14:11 ` [PATCH 02/12] arm64: Share timer and smccc functionality " Steffen Eiden
2026-12-02 14:11 ` [PATCH 03/12] KVM: arm64: Share timer and smccc code " Steffen Eiden
2026-12-02 14:11 ` [PATCH 04/12] KVM: s390: arm64: Use register shadow helper Steffen Eiden
2026-12-02 14:11 ` [PATCH 05/12] KVM: s390: arm64: Shadow the guest timer CVAL registers Steffen Eiden
2026-12-02 14:11 ` [PATCH 06/12] KVM: s390: arm64: Use mpstate for guests Steffen Eiden
2026-12-02 14:11 ` [PATCH 07/12] KVM: s390: arm64: Enable full smccc support Steffen Eiden
2026-12-02 14:35   ` sashiko-bot
2026-12-02 14:11 ` [PATCH 08/12] KVM: s390: arm64: Report fwregs to userspace Steffen Eiden
2026-12-02 14:11 ` [PATCH 09/12] KVM: s390: arm64: Provide timer infrastructure Steffen Eiden
2026-12-02 14:26   ` sashiko-bot
2026-12-02 14:11 ` [PATCH 10/12] KVM: s390: arm64: Integrate guest timer Steffen Eiden
2026-12-02 14:34   ` sashiko-bot
2026-12-02 14:11 ` [PATCH 11/12] KVM: s390: arm64: Trap WFx Steffen Eiden
2026-12-02 14:11 ` [PATCH 12/12] KVM: s390: arm64: Add IRQ line Steffen Eiden
2026-12-02 14:54   ` sashiko-bot
2026-12-02 14:54 ` [PATCH 00/12] KVM: s390: arm64: SMCCC, timers and " sashiko-bot

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=20261202-smccc-v1-0-48340e2737b6@linux.ibm.com \
    --to=seiden@linux.ibm.com \
    --cc=Ulrich.Weigand@de.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=arnd@arndb.de \
    --cc=borntraeger@linux.ibm.com \
    --cc=brueckner@linux.ibm.com \
    --cc=catalin.marinas@arm.com \
    --cc=david@kernel.org \
    --cc=frankja@linux.ibm.com \
    --cc=fritz@linux.ibm.com \
    --cc=fuad.tabba@linux.dev \
    --cc=ggala@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=gra@linux.ibm.com \
    --cc=hari55@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=joey.gouly@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=nrb@linux.ibm.com \
    --cc=oupton@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=suzuki.poulose@arm.com \
    --cc=svens@linux.ibm.com \
    --cc=will@kernel.org \
    --cc=yuzenghui@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.