[PATCH v5 00/13] LoongArch: KVM: Enhancement with eiointc emulation

Bibo Mao posted 13 patches 3 months, 1 week ago
Only 9 patches received!
There is a newer version of this series
arch/loongarch/include/asm/kvm_host.h |  12 +-
arch/loongarch/kvm/intc/eiointc.c     | 557 ++++----------------------
arch/loongarch/kvm/intc/ipi.c         |  28 +-
arch/loongarch/kvm/intc/pch_pic.c     |   4 +-
arch/loongarch/kvm/vcpu.c             |   8 +-
5 files changed, 102 insertions(+), 507 deletions(-)
[PATCH v5 00/13] LoongArch: KVM: Enhancement with eiointc emulation
Posted by Bibo Mao 3 months, 1 week ago
This series add generic eiointc 8 bytes access interface, so that 1/2/4/8
bytes access can use the generic 8 bytes access interface. It reduce
about 300 lines redundant code and make eiointc emulation driver simple
than ever.

---
v4 ... v5
  1. Rebase patch on latest kernel where bugfix of eiointc has been
     merged.
  2. Add generic eiointc 8 bytes access interface, 1/2/4/8 bytes access
     uses generic 8 bytes access interface.

v3 ... v4:
  1. Remove patch about enhancement and only keep bugfix relative
     patches.
  2. Remove INTC indication in the patch title.
  3. With access size, keep default case unchanged besides 1/2/4/8 since
     here all patches are bugfix
  4. Firstly check return value of copy_from_user() with error path,
     keep the same order with old patch in patch 4.

v2 ... v3:
  1. Add prefix INTC: in title of every patch.
  2. Fix array index overflow when emulate register EIOINTC_ENABLE
     writing operation.
  3. Add address alignment check with eiointc register access operation.

v1 ... v2:
  1. Add extra fix in patch 3 and patch 4, add num_cpu validation check
  2. Name of stat information keeps unchanged, only move it from VM stat
     to vCPU stat.
---
Bibo Mao (13):
  LoongArch: KVM: Use standard bitops API with eiointc
  LoongArch: KVM: Remove unused parameter len
  LoongArch: KVM: Add stat information with kernel irqchip
  LoongArch: KVM: Remove never called default case statement
  LoongArch: KVM: Rename loongarch_eiointc_readq with
    loongarch_eiointc_read
  LoongArch: KVM: Use generic read function loongarch_eiointc_read
  LoongArch: KVM: Remove some unnecessary local variables
  LoongArch: KVM: Use concise api __ffs()
  LoongArch: KVM: Replace eiointc_enable_irq() with eiointc_update_irq()
  LoongArch: KVM: Remove local variable offset
  LoongArch: KVM: Rename old_data with old
  LoongArch: KVM: Add generic function loongarch_eiointc_write()
  LoongArch: KVM: Use generic interface loongarch_eiointc_write()

 arch/loongarch/include/asm/kvm_host.h |  12 +-
 arch/loongarch/kvm/intc/eiointc.c     | 557 ++++----------------------
 arch/loongarch/kvm/intc/ipi.c         |  28 +-
 arch/loongarch/kvm/intc/pch_pic.c     |   4 +-
 arch/loongarch/kvm/vcpu.c             |   8 +-
 5 files changed, 102 insertions(+), 507 deletions(-)


base-commit: d0b3b7b22dfa1f4b515fd3a295b3fd958f9e81af
-- 
2.39.3
Re: [PATCH v5 00/13] LoongArch: KVM: Enhancement with eiointc emulation
Posted by Huacai Chen 3 months, 1 week ago
Hi, Bibo,

On Tue, Jul 1, 2025 at 11:08 AM Bibo Mao <maobibo@loongson.cn> wrote:
>
> This series add generic eiointc 8 bytes access interface, so that 1/2/4/8
> bytes access can use the generic 8 bytes access interface. It reduce
> about 300 lines redundant code and make eiointc emulation driver simple
> than ever.
>
> ---
> v4 ... v5
>   1. Rebase patch on latest kernel where bugfix of eiointc has been
>      merged.
>   2. Add generic eiointc 8 bytes access interface, 1/2/4/8 bytes access
>      uses generic 8 bytes access interface.
>
> v3 ... v4:
>   1. Remove patch about enhancement and only keep bugfix relative
>      patches.
>   2. Remove INTC indication in the patch title.
>   3. With access size, keep default case unchanged besides 1/2/4/8 since
>      here all patches are bugfix
>   4. Firstly check return value of copy_from_user() with error path,
>      keep the same order with old patch in patch 4.
>
> v2 ... v3:
>   1. Add prefix INTC: in title of every patch.
>   2. Fix array index overflow when emulate register EIOINTC_ENABLE
>      writing operation.
>   3. Add address alignment check with eiointc register access operation.
>
> v1 ... v2:
>   1. Add extra fix in patch 3 and patch 4, add num_cpu validation check
>   2. Name of stat information keeps unchanged, only move it from VM stat
>      to vCPU stat.
> ---
> Bibo Mao (13):
>   LoongArch: KVM: Use standard bitops API with eiointc
>   LoongArch: KVM: Remove unused parameter len
>   LoongArch: KVM: Add stat information with kernel irqchip
>   LoongArch: KVM: Remove never called default case statement
>   LoongArch: KVM: Rename loongarch_eiointc_readq with
>     loongarch_eiointc_read
>   LoongArch: KVM: Use generic read function loongarch_eiointc_read
>   LoongArch: KVM: Remove some unnecessary local variables
>   LoongArch: KVM: Use concise api __ffs()
>   LoongArch: KVM: Replace eiointc_enable_irq() with eiointc_update_irq()
>   LoongArch: KVM: Remove local variable offset
>   LoongArch: KVM: Rename old_data with old
>   LoongArch: KVM: Add generic function loongarch_eiointc_write()
>   LoongArch: KVM: Use generic interface loongarch_eiointc_write()
Patch5 and Patch6 can be squashed, Patch7 and Patch10 can be squashed,
Patch8 and Patch9 can be squshed, Patch12 and Patch13 can be squashed,
Patch11 is useless so can be removed.


Huacai

>
>  arch/loongarch/include/asm/kvm_host.h |  12 +-
>  arch/loongarch/kvm/intc/eiointc.c     | 557 ++++----------------------
>  arch/loongarch/kvm/intc/ipi.c         |  28 +-
>  arch/loongarch/kvm/intc/pch_pic.c     |   4 +-
>  arch/loongarch/kvm/vcpu.c             |   8 +-
>  5 files changed, 102 insertions(+), 507 deletions(-)
>
>
> base-commit: d0b3b7b22dfa1f4b515fd3a295b3fd958f9e81af
> --
> 2.39.3
>
Re: [PATCH v5 00/13] LoongArch: KVM: Enhancement with eiointc emulation
Posted by Bibo Mao 3 months ago

On 2025/7/1 下午6:48, Huacai Chen wrote:
> Hi, Bibo,
> 
> On Tue, Jul 1, 2025 at 11:08 AM Bibo Mao <maobibo@loongson.cn> wrote:
>>
>> This series add generic eiointc 8 bytes access interface, so that 1/2/4/8
>> bytes access can use the generic 8 bytes access interface. It reduce
>> about 300 lines redundant code and make eiointc emulation driver simple
>> than ever.
>>
>> ---
>> v4 ... v5
>>    1. Rebase patch on latest kernel where bugfix of eiointc has been
>>       merged.
>>    2. Add generic eiointc 8 bytes access interface, 1/2/4/8 bytes access
>>       uses generic 8 bytes access interface.
>>
>> v3 ... v4:
>>    1. Remove patch about enhancement and only keep bugfix relative
>>       patches.
>>    2. Remove INTC indication in the patch title.
>>    3. With access size, keep default case unchanged besides 1/2/4/8 since
>>       here all patches are bugfix
>>    4. Firstly check return value of copy_from_user() with error path,
>>       keep the same order with old patch in patch 4.
>>
>> v2 ... v3:
>>    1. Add prefix INTC: in title of every patch.
>>    2. Fix array index overflow when emulate register EIOINTC_ENABLE
>>       writing operation.
>>    3. Add address alignment check with eiointc register access operation.
>>
>> v1 ... v2:
>>    1. Add extra fix in patch 3 and patch 4, add num_cpu validation check
>>    2. Name of stat information keeps unchanged, only move it from VM stat
>>       to vCPU stat.
>> ---
>> Bibo Mao (13):
>>    LoongArch: KVM: Use standard bitops API with eiointc
>>    LoongArch: KVM: Remove unused parameter len
>>    LoongArch: KVM: Add stat information with kernel irqchip
>>    LoongArch: KVM: Remove never called default case statement
>>    LoongArch: KVM: Rename loongarch_eiointc_readq with
>>      loongarch_eiointc_read
>>    LoongArch: KVM: Use generic read function loongarch_eiointc_read
>>    LoongArch: KVM: Remove some unnecessary local variables
>>    LoongArch: KVM: Use concise api __ffs()
>>    LoongArch: KVM: Replace eiointc_enable_irq() with eiointc_update_irq()
>>    LoongArch: KVM: Remove local variable offset
>>    LoongArch: KVM: Rename old_data with old
>>    LoongArch: KVM: Add generic function loongarch_eiointc_write()
>>    LoongArch: KVM: Use generic interface loongarch_eiointc_write()
> Patch5 and Patch6 can be squashed, Patch7 and Patch10 can be squashed,
> Patch8 and Patch9 can be squshed, Patch12 and Patch13 can be squashed,
> Patch11 is useless so can be removed.
Thanks for reviewing, will do in this way.

Regards
Bibo Mao
> 
> 
> Huacai
> 
>>
>>   arch/loongarch/include/asm/kvm_host.h |  12 +-
>>   arch/loongarch/kvm/intc/eiointc.c     | 557 ++++----------------------
>>   arch/loongarch/kvm/intc/ipi.c         |  28 +-
>>   arch/loongarch/kvm/intc/pch_pic.c     |   4 +-
>>   arch/loongarch/kvm/vcpu.c             |   8 +-
>>   5 files changed, 102 insertions(+), 507 deletions(-)
>>
>>
>> base-commit: d0b3b7b22dfa1f4b515fd3a295b3fd958f9e81af
>> --
>> 2.39.3
>>