[PATCH v5 0/2] target/loongarch: Add loongson binary translation feature

Bibo Mao posted 2 patches 1 month, 3 weeks ago
target/loongarch/cpu.c                |  24 ++++++
target/loongarch/cpu.h                |  18 ++++
target/loongarch/kvm/kvm.c            | 119 +++++++++++++++++++++++++-
target/loongarch/loongarch-qmp-cmds.c |   2 +-
target/loongarch/machine.c            |  24 ++++++
5 files changed, 185 insertions(+), 2 deletions(-)
[PATCH v5 0/2] target/loongarch: Add loongson binary translation feature
Posted by Bibo Mao 1 month, 3 weeks ago
Loongson Binary Translation (LBT) is used to accelerate binary
translation. LBT feature is added in kvm mode, not supported in TCG
mode since it is not emulated.

Here lbt=on/off property is added to parse command line to
enable/disable lbt feature. Also fix registers relative lbt are saved
and restored during migration.

---
v4 ... v5:
  1. Define structure element eflags in structure LoongArchBT as
     uint32_t; in kernel eflags is defined as u64, however with
     ptrace and gdb interface it is defined u32, here defined as
     uint32_t to keep consistent from user view.
  2. sync patch with latest qemu version.

v3 ... v4:
  1. Verify and enable LBT feature in function kvm_arch_init_vcpu()
     rather than loongarch_cpu_post_init(), since LBT feature is only
     effective in kvm mode and function kvm_feature_supported() can be
     defined as static.
  2. Define structure element ftop in structure LoongArchBT as uint32_t
     to keep consist with kernel and real HW.

v2 ... v3:
  1. Property lbt is added only if kvm is enabled
  2. Use feature variable lbt with OnOffAuto type, rather than feature
     bitmap flags default_features and forced_features

v1 ... v2:
  1. Add LBT register saving and restoring in vmstate
  2. Add two pseudo feature flags: default_features and forced_features
---
Bibo Mao (2):
  target/loongarch: Add loongson binary translation feature
  target/loongarch: Implement lbt registers save/restore function

 target/loongarch/cpu.c                |  24 ++++++
 target/loongarch/cpu.h                |  18 ++++
 target/loongarch/kvm/kvm.c            | 119 +++++++++++++++++++++++++-
 target/loongarch/loongarch-qmp-cmds.c |   2 +-
 target/loongarch/machine.c            |  24 ++++++
 5 files changed, 185 insertions(+), 2 deletions(-)


base-commit: 3b14a767eaca3df5534a162851f04787b363670e
-- 
2.39.3
Re: [PATCH v5 0/2] target/loongarch: Add loongson binary translation feature
Posted by gaosong 1 month ago
在 2024/9/29 下午3:04, Bibo Mao 写道:
> Loongson Binary Translation (LBT) is used to accelerate binary
> translation. LBT feature is added in kvm mode, not supported in TCG
> mode since it is not emulated.
>
> Here lbt=on/off property is added to parse command line to
> enable/disable lbt feature. Also fix registers relative lbt are saved
> and restored during migration.
>
> ---
> v4 ... v5:
>    1. Define structure element eflags in structure LoongArchBT as
>       uint32_t; in kernel eflags is defined as u64, however with
>       ptrace and gdb interface it is defined u32, here defined as
>       uint32_t to keep consistent from user view.
>    2. sync patch with latest qemu version.
>
> v3 ... v4:
>    1. Verify and enable LBT feature in function kvm_arch_init_vcpu()
>       rather than loongarch_cpu_post_init(), since LBT feature is only
>       effective in kvm mode and function kvm_feature_supported() can be
>       defined as static.
>    2. Define structure element ftop in structure LoongArchBT as uint32_t
>       to keep consist with kernel and real HW.
>
> v2 ... v3:
>    1. Property lbt is added only if kvm is enabled
>    2. Use feature variable lbt with OnOffAuto type, rather than feature
>       bitmap flags default_features and forced_features
>
> v1 ... v2:
>    1. Add LBT register saving and restoring in vmstate
>    2. Add two pseudo feature flags: default_features and forced_features
> ---
> Bibo Mao (2):
>    target/loongarch: Add loongson binary translation feature
>    target/loongarch: Implement lbt registers save/restore function
>
>   target/loongarch/cpu.c                |  24 ++++++
>   target/loongarch/cpu.h                |  18 ++++
>   target/loongarch/kvm/kvm.c            | 119 +++++++++++++++++++++++++-
>   target/loongarch/loongarch-qmp-cmds.c |   2 +-
>   target/loongarch/machine.c            |  24 ++++++
>   5 files changed, 185 insertions(+), 2 deletions(-)
>
>
> base-commit: 3b14a767eaca3df5534a162851f04787b363670e
Reviewed-by: Song Gao <gaosong@loongson.cn>

Thanks.
Song Gao