mbox series

[v2,0/3] Fix io accessors for KVM

Message ID 20250618065828.1312146-1-ilias.apalodimas@linaro.org
Headers show
Series Fix io accessors for KVM | expand

Message

Ilias Apalodimas June 18, 2025, 6:58 a.m. UTC
Instructions that lead ito an exception in the hypervisor can't modify two
CPU registers at once for the ARM ISA.

These instructions cannot be emulated by KVM as they do not produce
syndrome information data that KVM can use to infer the destination
register, the faulting address, whether it was a load or store, or
if it's a 32 or 64 bit general-purpose register.
As a result an external abort is injected from QEMU, via ext_dabt_pending.

Patch #1 prepares some function for the modified macros
Patch #2 modifies the macros
Patch #3 enables the functionality for armv7/8 QEMU

Changes since v1:
- Split the function modification in its own patch
- Don't limit the changes to v8 only

Ilias Apalodimas (3):
  nxp: Prepare macros for KVM changes
  arm: io.h: Fix io accessors for KVM
  qemu: arm: Enable virtualizable IO accesors

 arch/arm/Kconfig             |  12 +++
 arch/arm/include/asm/io.h    | 152 ++++++++++++++++++++++++++---------
 configs/qemu_arm64_defconfig |   1 +
 configs/qemu_arm_defconfig   |   1 +
 drivers/spi/fsl_dspi.c       |   6 +-
 include/fsl_ifc.h            |  24 +++---
 6 files changed, 142 insertions(+), 54 deletions(-)

--
2.43.0

Comments

Jerome Forissier June 18, 2025, 11:03 a.m. UTC | #1
On 6/18/25 08:58, Ilias Apalodimas wrote:
> Instructions that lead ito an exception in the hypervisor can't modify two
> CPU registers at once for the ARM ISA.
> 
> These instructions cannot be emulated by KVM as they do not produce
> syndrome information data that KVM can use to infer the destination
> register, the faulting address, whether it was a load or store, or
> if it's a 32 or 64 bit general-purpose register.
> As a result an external abort is injected from QEMU, via ext_dabt_pending.
> 
> Patch #1 prepares some function for the modified macros
> Patch #2 modifies the macros
> Patch #3 enables the functionality for armv7/8 QEMU

Again, IMHO this is more complex than necessary because you're combining
the KVM fix with some code refactoring. Patch #1 can be dropped altogether
and patch #2 can be simplified (from "2 files changed, 123 insertions(+),
39 deletions(-)" to "2 files changed, 97 insertions(+)". Unless I missed
something? Please see [1]. Of course it also passes the LVM test ;)

[1] https://source.denx.de/u-boot/custodians/u-boot-net/-/pipelines/26751.
Ilias Apalodimas June 18, 2025, 12:04 p.m. UTC | #2
Hi Jerome,

On Wed, 18 Jun 2025 at 14:03, Jerome Forissier
<jerome.forissier@linaro.org> wrote:
>
>
>
> On 6/18/25 08:58, Ilias Apalodimas wrote:
> > Instructions that lead ito an exception in the hypervisor can't modify two
> > CPU registers at once for the ARM ISA.
> >
> > These instructions cannot be emulated by KVM as they do not produce
> > syndrome information data that KVM can use to infer the destination
> > register, the faulting address, whether it was a load or store, or
> > if it's a 32 or 64 bit general-purpose register.
> > As a result an external abort is injected from QEMU, via ext_dabt_pending.
> >
> > Patch #1 prepares some function for the modified macros
> > Patch #2 modifies the macros
> > Patch #3 enables the functionality for armv7/8 QEMU
>
> Again, IMHO this is more complex than necessary because you're combining
> the KVM fix with some code refactoring. Patch #1 can be dropped altogether
> and patch #2 can be simplified (from "2 files changed, 123 insertions(+),
> 39 deletions(-)" to "2 files changed, 97 insertions(+)". Unless I missed
> something? Please see [1]. Of course it also passes the LVM test ;)

No you aren't. I just kept it as is because Tom said he was fine and
makes the final code easier to read, rather than having 2 macros doing
the same thing.

Thanks
/Ilias
>
> [1] https://source.denx.de/u-boot/custodians/u-boot-net/-/pipelines/26751.
>
> --
> Jerome
>
> >
> > Changes since v1:
> > - Split the function modification in its own patch
> > - Don't limit the changes to v8 only
> >
> > Ilias Apalodimas (3):
> >   nxp: Prepare macros for KVM changes
> >   arm: io.h: Fix io accessors for KVM
> >   qemu: arm: Enable virtualizable IO accesors
> >
> >  arch/arm/Kconfig             |  12 +++
> >  arch/arm/include/asm/io.h    | 152 ++++++++++++++++++++++++++---------
> >  configs/qemu_arm64_defconfig |   1 +
> >  configs/qemu_arm_defconfig   |   1 +
> >  drivers/spi/fsl_dspi.c       |   6 +-
> >  include/fsl_ifc.h            |  24 +++---
> >  6 files changed, 142 insertions(+), 54 deletions(-)
> >
> > --
> > 2.43.0
> >