[PATCH v1 15/26] s390: Add functions to query arm guest time

Oliver Upton oupton at kernel.org
Tue Jun 2 14:33:08 PDT 2026


Hi Andreas,

On Tue, Jun 02, 2026 at 03:25:13PM +0200, Andreas Grapentin wrote:
> On Jun 01 26, Oliver Upton wrote:
> > > Add functions to convert between ARM guest time (LSB0) and s390 host
> > > time (MSB0) using new ptff function codes.
> > > 
> > > Co-developed-by: Nico Boehr <nrb at linux.ibm.com>
> > > Signed-off-by: Nico Boehr <nrb at linux.ibm.com>
> > > Signed-off-by: Steffen Eiden <seiden at linux.ibm.com>
> > > ---
> > >  arch/s390/include/asm/timex.h | 49 +++++++++++++++++++++++++++++++++++
> > >  arch/s390/kernel/time.c       |  1 +
> > >  arch/s390/kvm/arm64/arm.c     |  9 ++++++-
> > >  3 files changed, 58 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/arch/s390/include/asm/timex.h b/arch/s390/include/asm/timex.h
> > > index 49447b40f038..9ec22a28bbda 100644
> > > --- a/arch/s390/include/asm/timex.h
> > > +++ b/arch/s390/include/asm/timex.h
> > > @@ -99,6 +99,8 @@ extern unsigned char ptff_function_mask[16];
> > >  #define PTFF_QSI	0x02	/* query steering information */
> > >  #define PTFF_QPT	0x03	/* query physical clock */
> > >  #define PTFF_QUI	0x04	/* query UTC information */
> > > +#define PTFF_QAGTO	0x10	/* query arm guest time offset */
> > > +#define PTFF_QAGPT	0x11	/* query arm guest physical time offset */
> > 
> > Are these analogous to CNTVOFF_EL2 and CNTPOFF_EL2?
> 
> They are somewhat related -- we don't have the EL2 counter offset
> registers, but we still need to virtualize the guest counters, so
> instead we have to maintain the guest counter offset separately.
> 
> However, to determine the correct guest counter offset, we are using
> these new PTFF function codes to translate between the s390 and arm64
> architected counter domains.

Thanks for clarifying, I was trying to figure out how these functions
apply to the virtual and "physical" views of the counter inside the VM.

--
Best,
Oliver



More information about the linux-arm-kernel mailing list