mbox series

[v3,0/3] Add extioi virt extension support

Message ID 20240521123225.231072-1-gaosong@loongson.cn (mailing list archive)
Headers show
Series Add extioi virt extension support | expand

Message

gaosong May 21, 2024, 12:32 p.m. UTC
On LoongArch, IRQs can be routed to four vcpus with hardware extioi.
This patch adds the extioi virt extension support so that the IRQ can
route to 256 vcpus.

v3:
- Split patch2 to two small patch.
- remove unused code.
- loongarch_extioi_reset() clear status without checking virt extioi
  features.
- Link to v2: https://patchew.org/QEMU/20240514090756.988096-1-gaosong@loongson.cn/

v2:
- Split the patch to two small patch.
- Drop 'RFC' title. extioi virt extension suport only enable on kvm
  mode and  the extioi driver need patch[1].
  but this series do not affect the old codes in any way.
- Link to v1: https://lore.kernel.org/all/20240116022526.498613-1-gaosong@loongson.cn/#r

[1]: https://gitee.com/openeuler/kernel/commit/5d97cff72f91f4f20a536efd60eca75bfcb78a64

Thanks.
Song Gao

Song Gao (3):
  hw/intc/loongarch_extioi: Add extioi virt extension definition
  hw/loongarch/virt: Enable extioi virt extension
  hw/loongarch/virt: Use MemTxAttrs interface for misc ops

 include/hw/intc/loongarch_extioi.h |  21 ++++++
 include/hw/loongarch/virt.h        |   2 +
 target/loongarch/cpu.h             |   1 +
 hw/intc/loongarch_extioi.c         |  88 +++++++++++++++++++++-
 hw/loongarch/virt.c                | 116 +++++++++++++++++++++++++----
 5 files changed, 210 insertions(+), 18 deletions(-)

Comments

Jiaxun Yang May 23, 2024, 11:50 p.m. UTC | #1
在2024年5月21日五月 下午1:32,Song Gao写道:
> On LoongArch, IRQs can be routed to four vcpus with hardware extioi.
> This patch adds the extioi virt extension support so that the IRQ can
> route to 256 vcpus.

Hi Song,

Sorry for chime in here, I'm a little bit confused by this series, can
you give me a little bit of context behind?

I don't see this functionality on 3A5000/3A6000's user manual, so is this
some sort of undocumented hardware feature?

I checked openEuler kernel patch you referred, it seems like this applies to
hypervisor mode only. I suppose it should be handled by KVM subsystem in
kernel, why do we need this in user mode device emulation?

Currently, LoongArch's in-kernel irqchip functionality does not include such
feature, can we see KVM side support for this, or at least a draft specification?

Thanks
- Jiaxun

>
> v3:
> - Split patch2 to two small patch.
> - remove unused code.
> - loongarch_extioi_reset() clear status without checking virt extioi
>   features.
> - Link to v2: 
> https://patchew.org/QEMU/20240514090756.988096-1-gaosong@loongson.cn/
>
> v2:
> - Split the patch to two small patch.
> - Drop 'RFC' title. extioi virt extension suport only enable on kvm
>   mode and  the extioi driver need patch[1].
>   but this series do not affect the old codes in any way.
> - Link to v1: 
> https://lore.kernel.org/all/20240116022526.498613-1-gaosong@loongson.cn/#r
>
> [1]: 
> https://gitee.com/openeuler/kernel/commit/5d97cff72f91f4f20a536efd60eca75bfcb78a64
>
> Thanks.
> Song Gao
>
> Song Gao (3):
>   hw/intc/loongarch_extioi: Add extioi virt extension definition
>   hw/loongarch/virt: Enable extioi virt extension
>   hw/loongarch/virt: Use MemTxAttrs interface for misc ops
>
>  include/hw/intc/loongarch_extioi.h |  21 ++++++
>  include/hw/loongarch/virt.h        |   2 +
>  target/loongarch/cpu.h             |   1 +
>  hw/intc/loongarch_extioi.c         |  88 +++++++++++++++++++++-
>  hw/loongarch/virt.c                | 116 +++++++++++++++++++++++++----
>  5 files changed, 210 insertions(+), 18 deletions(-)
>
> -- 
> 2.34.1
bibo mao May 24, 2024, 1:23 a.m. UTC | #2
Song will online next week.
Please correct me if there is something wrong, song.

On 2024/5/24 上午7:50, Jiaxun Yang wrote:
> 
> 
> 在2024年5月21日五月 下午1:32,Song Gao写道:
>> On LoongArch, IRQs can be routed to four vcpus with hardware extioi.
>> This patch adds the extioi virt extension support so that the IRQ can
>> route to 256 vcpus.
> 
> Hi Song,
> 
> Sorry for chime in here, I'm a little bit confused by this series, can
> you give me a little bit of context behind?
Currently interrupt can be routed to only 4 vcpus with one HW extioi. On 
virt machine, there are 256 vcpus even more in future.

Extioi virt extension is introduced here to route irq to more vcpus.
> 
> I don't see this functionality on 3A5000/3A6000's user manual, so is this
> some sort of undocumented hardware feature?
No, it is not real HW, it is Extioi virt extension, it is virt machine 
model only.

> 
> I checked openEuler kernel patch you referred, it seems like this applies to
> hypervisor mode only. I suppose it should be handled by KVM subsystem in
> kernel, why do we need this in user mode device emulation?
Will do when irqchip is emulated in kernel. Now irqchip is emulated in 
userspace, so it is implemented in userspace firstly.

However it is necessary to emulate in userspace. User can select to 
whether to emulate irqchip in userspace or kernel space, user space 
emulation is easy to debug, kernel space has higher performance. Both 
need extioi virt extension.
> 
> Currently, LoongArch's in-kernel irqchip functionality does not include such
> feature, can we see KVM side support for this, or at least a draft specification?
yeap, maybe more documentation need written for the extioi virt 
extension model.

We are preparing to port irqchip to kernel space, this function will be 
added in kernel space also.


Regards
Bibo Mao
> 
> Thanks
> - Jiaxun
> 
>>
>> v3:
>> - Split patch2 to two small patch.
>> - remove unused code.
>> - loongarch_extioi_reset() clear status without checking virt extioi
>>    features.
>> - Link to v2:
>> https://patchew.org/QEMU/20240514090756.988096-1-gaosong@loongson.cn/
>>
>> v2:
>> - Split the patch to two small patch.
>> - Drop 'RFC' title. extioi virt extension suport only enable on kvm
>>    mode and  the extioi driver need patch[1].
>>    but this series do not affect the old codes in any way.
>> - Link to v1:
>> https://lore.kernel.org/all/20240116022526.498613-1-gaosong@loongson.cn/#r
>>
>> [1]:
>> https://gitee.com/openeuler/kernel/commit/5d97cff72f91f4f20a536efd60eca75bfcb78a64
>>
>> Thanks.
>> Song Gao
>>
>> Song Gao (3):
>>    hw/intc/loongarch_extioi: Add extioi virt extension definition
>>    hw/loongarch/virt: Enable extioi virt extension
>>    hw/loongarch/virt: Use MemTxAttrs interface for misc ops
>>
>>   include/hw/intc/loongarch_extioi.h |  21 ++++++
>>   include/hw/loongarch/virt.h        |   2 +
>>   target/loongarch/cpu.h             |   1 +
>>   hw/intc/loongarch_extioi.c         |  88 +++++++++++++++++++++-
>>   hw/loongarch/virt.c                | 116 +++++++++++++++++++++++++----
>>   5 files changed, 210 insertions(+), 18 deletions(-)
>>
>> -- 
>> 2.34.1
>