mbox series

[v11,kvmtool,0/8] KVMTOOL RISC-V Support

Message ID 20211119124515.89439-1-anup.patel@wdc.com (mailing list archive)
Headers show
Series KVMTOOL RISC-V Support | expand

Message

Anup Patel Nov. 19, 2021, 12:45 p.m. UTC
This series adds RISC-V support for KVMTOOL and it is based on the
Linux-5.16-rc1. The KVM RISC-V patches have been merged in the Linux
kernel since 5.16-rc1.

The KVMTOOL RISC-V patches can be found in riscv_master branch at:
https//github.com/kvm-riscv/kvmtool.git

Changes since v10:
 - Updated PLIC CLAIM write emulation in PATCH5 to ignore writes when
   interrupt is disabled for the PLIC context. This behaviour is as-per
   definition of interrupt completion process in the RISC-V PLIC spec.

Changes since v9:
 - Rebased on recent commit 39181fc6429f4e9e71473284940e35857b42772a
 - Sync-up headers with Linux-5.16-rc1

Changes since v8:
 - Rebased on recent commit 2e7380db438defbc5aa24652fe10b7bf99822355
 - Sync-up headers with latest KVM RISC-V v20 series which is based
   on Linux-5.15-rc3
 - Fixed PLIC context CLAIM register emulation in PATCH5

Changes since v7:
 - Rebased on recent commit 25c1dc6c4942ff0949c08780fcad6b324fec6bf7
 - Sync-up headers with latest KVM RISC-V v19 series which is based
   on Linux-5.14-rc3

Changes since v6:
 - Rebased on recent commit 117d64953228afa90b52f6e1b4873770643ffdc9
 - Sync-up headers with latest KVM RISC-V v17 series which is based
   on Linux-5.12-rc5

Changes since v5:
 - Sync-up headers with latest KVM RISC-V v16 series which is based
   on Linux-5.11-rc3

Changes since v4:
 - Rebased on recent commit 90b2d3adadf218dfc6bdfdfcefe269843360223c
 - Sync-up headers with latest KVM RISC-V v15 series which is based
   on Linux-5.10-rc3

Changes since v3:
 - Rebased on recent commit 351d931f496aeb2e97b8daa44c943d8b59351d07
 - Improved kvm_cpu__show_registers() implementation

Changes since v2:
 - Support compiling KVMTOOL for both RV32 and RV64 systems using
   a multilib toolchain
 - Fix kvm_cpu__arch_init() for RV32 system

Changes since v1:
 - Use linux/sizes.h in kvm/kvm-arch.h
 - Added comment in kvm/kvm-arch.h about why PCI config space is 256M
 - Remove forward declaration of "struct kvm" from kvm/kvm-cpu-arch.h
 - Fixed placement of DTB and INITRD in guest RAM
 - Use __riscv_xlen instead of sizeof(unsigned long) in __kvm_reg_id()

Anup Patel (8):
  update_headers: Sync-up ABI headers with Linux-5.16-rc1
  riscv: Initial skeletal support
  riscv: Implement Guest/VM arch functions
  riscv: Implement Guest/VM VCPU arch functions
  riscv: Add PLIC device emulation
  riscv: Generate FDT at runtime for Guest/VM
  riscv: Handle SBI calls forwarded to user space
  riscv: Generate PCI host DT node

 INSTALL                             |   7 +-
 Makefile                            |  24 +-
 arm/aarch64/include/asm/kvm.h       |  56 ++-
 include/linux/kvm.h                 | 441 ++++++++++++++++++++-
 powerpc/include/asm/kvm.h           |  10 +
 riscv/fdt.c                         | 195 ++++++++++
 riscv/include/asm/kvm.h             | 128 +++++++
 riscv/include/kvm/barrier.h         |  14 +
 riscv/include/kvm/fdt-arch.h        |   8 +
 riscv/include/kvm/kvm-arch.h        |  89 +++++
 riscv/include/kvm/kvm-config-arch.h |  15 +
 riscv/include/kvm/kvm-cpu-arch.h    |  51 +++
 riscv/include/kvm/sbi.h             |  48 +++
 riscv/ioport.c                      |   7 +
 riscv/irq.c                         |  13 +
 riscv/kvm-cpu.c                     | 490 ++++++++++++++++++++++++
 riscv/kvm.c                         | 174 +++++++++
 riscv/pci.c                         | 109 ++++++
 riscv/plic.c                        | 571 ++++++++++++++++++++++++++++
 util/update_headers.sh              |   2 +-
 x86/include/asm/kvm.h               |  64 +++-
 21 files changed, 2497 insertions(+), 19 deletions(-)
 create mode 100644 riscv/fdt.c
 create mode 100644 riscv/include/asm/kvm.h
 create mode 100644 riscv/include/kvm/barrier.h
 create mode 100644 riscv/include/kvm/fdt-arch.h
 create mode 100644 riscv/include/kvm/kvm-arch.h
 create mode 100644 riscv/include/kvm/kvm-config-arch.h
 create mode 100644 riscv/include/kvm/kvm-cpu-arch.h
 create mode 100644 riscv/include/kvm/sbi.h
 create mode 100644 riscv/ioport.c
 create mode 100644 riscv/irq.c
 create mode 100644 riscv/kvm-cpu.c
 create mode 100644 riscv/kvm.c
 create mode 100644 riscv/pci.c
 create mode 100644 riscv/plic.c

Comments

Anup Patel Dec. 11, 2021, 7:28 a.m. UTC | #1
Hi Marc, Hi Will,

On Fri, Nov 19, 2021 at 6:15 PM Anup Patel <anup.patel@wdc.com> wrote:
>
> This series adds RISC-V support for KVMTOOL and it is based on the
> Linux-5.16-rc1. The KVM RISC-V patches have been merged in the Linux
> kernel since 5.16-rc1.
>
> The KVMTOOL RISC-V patches can be found in riscv_master branch at:
> https//github.com/kvm-riscv/kvmtool.git

Ping ?
Do you have further comments on this series ?

Regards,
Anup

>
> Changes since v10:
>  - Updated PLIC CLAIM write emulation in PATCH5 to ignore writes when
>    interrupt is disabled for the PLIC context. This behaviour is as-per
>    definition of interrupt completion process in the RISC-V PLIC spec.
>
> Changes since v9:
>  - Rebased on recent commit 39181fc6429f4e9e71473284940e35857b42772a
>  - Sync-up headers with Linux-5.16-rc1
>
> Changes since v8:
>  - Rebased on recent commit 2e7380db438defbc5aa24652fe10b7bf99822355
>  - Sync-up headers with latest KVM RISC-V v20 series which is based
>    on Linux-5.15-rc3
>  - Fixed PLIC context CLAIM register emulation in PATCH5
>
> Changes since v7:
>  - Rebased on recent commit 25c1dc6c4942ff0949c08780fcad6b324fec6bf7
>  - Sync-up headers with latest KVM RISC-V v19 series which is based
>    on Linux-5.14-rc3
>
> Changes since v6:
>  - Rebased on recent commit 117d64953228afa90b52f6e1b4873770643ffdc9
>  - Sync-up headers with latest KVM RISC-V v17 series which is based
>    on Linux-5.12-rc5
>
> Changes since v5:
>  - Sync-up headers with latest KVM RISC-V v16 series which is based
>    on Linux-5.11-rc3
>
> Changes since v4:
>  - Rebased on recent commit 90b2d3adadf218dfc6bdfdfcefe269843360223c
>  - Sync-up headers with latest KVM RISC-V v15 series which is based
>    on Linux-5.10-rc3
>
> Changes since v3:
>  - Rebased on recent commit 351d931f496aeb2e97b8daa44c943d8b59351d07
>  - Improved kvm_cpu__show_registers() implementation
>
> Changes since v2:
>  - Support compiling KVMTOOL for both RV32 and RV64 systems using
>    a multilib toolchain
>  - Fix kvm_cpu__arch_init() for RV32 system
>
> Changes since v1:
>  - Use linux/sizes.h in kvm/kvm-arch.h
>  - Added comment in kvm/kvm-arch.h about why PCI config space is 256M
>  - Remove forward declaration of "struct kvm" from kvm/kvm-cpu-arch.h
>  - Fixed placement of DTB and INITRD in guest RAM
>  - Use __riscv_xlen instead of sizeof(unsigned long) in __kvm_reg_id()
>
> Anup Patel (8):
>   update_headers: Sync-up ABI headers with Linux-5.16-rc1
>   riscv: Initial skeletal support
>   riscv: Implement Guest/VM arch functions
>   riscv: Implement Guest/VM VCPU arch functions
>   riscv: Add PLIC device emulation
>   riscv: Generate FDT at runtime for Guest/VM
>   riscv: Handle SBI calls forwarded to user space
>   riscv: Generate PCI host DT node
>
>  INSTALL                             |   7 +-
>  Makefile                            |  24 +-
>  arm/aarch64/include/asm/kvm.h       |  56 ++-
>  include/linux/kvm.h                 | 441 ++++++++++++++++++++-
>  powerpc/include/asm/kvm.h           |  10 +
>  riscv/fdt.c                         | 195 ++++++++++
>  riscv/include/asm/kvm.h             | 128 +++++++
>  riscv/include/kvm/barrier.h         |  14 +
>  riscv/include/kvm/fdt-arch.h        |   8 +
>  riscv/include/kvm/kvm-arch.h        |  89 +++++
>  riscv/include/kvm/kvm-config-arch.h |  15 +
>  riscv/include/kvm/kvm-cpu-arch.h    |  51 +++
>  riscv/include/kvm/sbi.h             |  48 +++
>  riscv/ioport.c                      |   7 +
>  riscv/irq.c                         |  13 +
>  riscv/kvm-cpu.c                     | 490 ++++++++++++++++++++++++
>  riscv/kvm.c                         | 174 +++++++++
>  riscv/pci.c                         | 109 ++++++
>  riscv/plic.c                        | 571 ++++++++++++++++++++++++++++
>  util/update_headers.sh              |   2 +-
>  x86/include/asm/kvm.h               |  64 +++-
>  21 files changed, 2497 insertions(+), 19 deletions(-)
>  create mode 100644 riscv/fdt.c
>  create mode 100644 riscv/include/asm/kvm.h
>  create mode 100644 riscv/include/kvm/barrier.h
>  create mode 100644 riscv/include/kvm/fdt-arch.h
>  create mode 100644 riscv/include/kvm/kvm-arch.h
>  create mode 100644 riscv/include/kvm/kvm-config-arch.h
>  create mode 100644 riscv/include/kvm/kvm-cpu-arch.h
>  create mode 100644 riscv/include/kvm/sbi.h
>  create mode 100644 riscv/ioport.c
>  create mode 100644 riscv/irq.c
>  create mode 100644 riscv/kvm-cpu.c
>  create mode 100644 riscv/kvm.c
>  create mode 100644 riscv/pci.c
>  create mode 100644 riscv/plic.c
>
> --
> 2.25.1
>
Marc Zyngier Dec. 11, 2021, 2:21 p.m. UTC | #2
On Sat, 11 Dec 2021 07:28:49 +0000,
Anup Patel <anup@brainfault.org> wrote:
> 
> Hi Marc, Hi Will,
> 
> On Fri, Nov 19, 2021 at 6:15 PM Anup Patel <anup.patel@wdc.com> wrote:
> >
> > This series adds RISC-V support for KVMTOOL and it is based on the
> > Linux-5.16-rc1. The KVM RISC-V patches have been merged in the Linux
> > kernel since 5.16-rc1.
> >
> > The KVMTOOL RISC-V patches can be found in riscv_master branch at:
> > https//github.com/kvm-riscv/kvmtool.git
> 
> Ping ?
> Do you have further comments on this series ?

Not much on my side, apart that it is a bit annoying that some of the
support is actually an almost exact copy of the arm code (PCI being a
striking example). It would have been nice to see some effort to make
the code common, although it isn't a blocker on my side.

Thanks,

	M.
Anup Patel Dec. 13, 2021, 4:12 a.m. UTC | #3
On Sat, Dec 11, 2021 at 7:51 PM Marc Zyngier <maz@kernel.org> wrote:
>
> On Sat, 11 Dec 2021 07:28:49 +0000,
> Anup Patel <anup@brainfault.org> wrote:
> >
> > Hi Marc, Hi Will,
> >
> > On Fri, Nov 19, 2021 at 6:15 PM Anup Patel <anup.patel@wdc.com> wrote:
> > >
> > > This series adds RISC-V support for KVMTOOL and it is based on the
> > > Linux-5.16-rc1. The KVM RISC-V patches have been merged in the Linux
> > > kernel since 5.16-rc1.
> > >
> > > The KVMTOOL RISC-V patches can be found in riscv_master branch at:
> > > https//github.com/kvm-riscv/kvmtool.git
> >
> > Ping ?
> > Do you have further comments on this series ?
>
> Not much on my side, apart that it is a bit annoying that some of the
> support is actually an almost exact copy of the arm code (PCI being a
> striking example). It would have been nice to see some effort to make
> the code common, although it isn't a blocker on my side.

Thanks Marc.

I agree with you. The code sharing between ARM and RISC-V support
needs to be improved. We have more stuff to be added after this series
so I will prioritize code sharing.

Regards,
Anup


>
> Thanks,
>
>         M.
>
> --
> Without deviation from the norm, progress is not possible.
Will Deacon Dec. 14, 2021, 3:18 p.m. UTC | #4
On Fri, 19 Nov 2021 18:15:07 +0530, Anup Patel wrote:
> This series adds RISC-V support for KVMTOOL and it is based on the
> Linux-5.16-rc1. The KVM RISC-V patches have been merged in the Linux
> kernel since 5.16-rc1.
> 
> The KVMTOOL RISC-V patches can be found in riscv_master branch at:
> https//github.com/kvm-riscv/kvmtool.git
> 
> [...]

Applied to kvmtool (master), thanks!

[1/8] update_headers: Sync-up ABI headers with Linux-5.16-rc1
      https://git.kernel.org/will/kvmtool/c/5968b5ff26bb
[2/8] riscv: Initial skeletal support
      https://git.kernel.org/will/kvmtool/c/2e99678314c2
[3/8] riscv: Implement Guest/VM arch functions
      https://git.kernel.org/will/kvmtool/c/867159a7963b
[4/8] riscv: Implement Guest/VM VCPU arch functions
      https://git.kernel.org/will/kvmtool/c/42bfe448c1c3
[5/8] riscv: Add PLIC device emulation
      https://git.kernel.org/will/kvmtool/c/762224e47cc2
[6/8] riscv: Generate FDT at runtime for Guest/VM
      https://git.kernel.org/will/kvmtool/c/7c9aac003925
[7/8] riscv: Handle SBI calls forwarded to user space
      https://git.kernel.org/will/kvmtool/c/721da166a698
[8/8] riscv: Generate PCI host DT node
      https://git.kernel.org/will/kvmtool/c/cdd7d8cc0109

Cheers,