mbox series

[kvmtool,00/16] arm: Allow the user to define the memory layout

Message ID 1569245722-23375-1-git-send-email-alexandru.elisei@arm.com (mailing list archive)
Headers show
Series arm: Allow the user to define the memory layout | expand

Message

Alexandru Elisei Sept. 23, 2019, 1:35 p.m. UTC
The guest memory layout created by kvmtool is fixed: regular MMIO is below
1G, PCI MMIO is below 2G, and the RAM always starts at the 2G mark. Real
hardware can have a different memory layout, and being able to create a
specific memory layout can be very useful for testing the guest kernel.

This series allows the user the specify the memory layout for the
virtual machine by expanding the -m/--mem option to take an <addr>
parameter, and by adding architecture specific options to define the I/O
ports, regular MMIO and PCI MMIO memory regions.

The user defined memory regions are implemented in patch #16; I consider
the patch to be an RFC because I'm not really sure that my approach is the
correct one; for example, I decided to make the options arch dependent
because that seemed like the path of least resistance, but they could have
just as easily implemented as arch independent and each architecture
advertised having support for them via a define (like with RAM base
address).

Summary:
 * Patches 1-8 are fixes and cleanups.
 * Patch 9 implements the option for the user to specify the RAM base
   address, but the MMIO regions are left unchanged.
 * Patches 10-12 represent another round of cleanups.
 * Patch 13 implements a memory allocator that allows the user the specify
   any RAM address. The MMIO regions are allocated from the remaining
   address space.
 * Patches 14-15 are cleanups in preparation for the patch will allow the
   user to define the memory layout.
 * Patch 16 implements the option for the user to define the memory layout.

The series are based on previous work by Julien Grall [1].

[1] https://www.spinics.net/lists/kvm/msg179408.html

Alexandru Elisei (10):
  kvmtool: Add helper to sanitize arch specific KVM configuration
  kvmtool: Use MB consistently
  builtin-run.c: Always use virtual machine ram_size in bytes
  arm: Remove redundant define ARM_PCI_CFG_SIZE
  arm: Allow the user to specify RAM base address
  arm/pci: Remove unused ioports
  arm: Allow any base address for RAM
  arm: Move memory related code to memory.c
  kvmtool: Make the size@addr option parser globally visible
  arm: Allow the user to define the MMIO regions

Julien Grall (4):
  kvm__arch_init: Don't pass hugetlbfs_path and ram_size in parameter
  virtio/scsi: Allow to use multiple banks
  arm: Move anything related to RAM initialization in kvm__init_ram
  Fold kvm__init_ram call in kvm__arch_init and rename it

Suzuki K Poulose (2):
  arm: Allow use of hugepage with 16K pagesize host
  kvmtool: Allow standard size specifiers for memory

 Documentation/kvmtool.1                  |   4 +-
 Makefile                                 |   2 +-
 arm/aarch32/include/kvm/kvm-arch.h       |   2 +-
 arm/aarch64/include/kvm/kvm-arch.h       |   6 +-
 arm/allocator.c                          | 150 ++++++++++++++
 arm/gic.c                                |  30 +--
 arm/include/arm-common/allocator.h       |  25 +++
 arm/include/arm-common/kvm-arch.h        |  59 +++---
 arm/include/arm-common/kvm-config-arch.h |  25 +++
 arm/include/arm-common/memory.h          |  13 ++
 arm/kvm.c                                |  58 ++----
 arm/memory.c                             | 326 +++++++++++++++++++++++++++++++
 arm/pci.c                                |   7 +-
 builtin-run.c                            | 119 +++++++++--
 include/kvm/kvm-config.h                 |   5 +-
 include/kvm/kvm.h                        |   7 +-
 kvm.c                                    |  15 +-
 mips/include/kvm/kvm-arch.h              |   4 +
 mips/kvm.c                               |  14 +-
 pci.c                                    |  36 +++-
 powerpc/include/kvm/kvm-arch.h           |   4 +
 powerpc/kvm.c                            |  14 +-
 util/util.c                              |   2 +-
 virtio/mmio.c                            |   7 +
 virtio/scsi.c                            |  21 +-
 x86/include/kvm/kvm-arch.h               |   4 +
 x86/kvm.c                                |  35 ++--
 27 files changed, 843 insertions(+), 151 deletions(-)
 create mode 100644 arm/allocator.c
 create mode 100644 arm/include/arm-common/allocator.h
 create mode 100644 arm/include/arm-common/memory.h
 create mode 100644 arm/memory.c

Comments

Will Deacon Feb. 5, 2020, 5:16 p.m. UTC | #1
On Mon, Sep 23, 2019 at 02:35:06PM +0100, Alexandru Elisei wrote:
> The guest memory layout created by kvmtool is fixed: regular MMIO is below
> 1G, PCI MMIO is below 2G, and the RAM always starts at the 2G mark. Real
> hardware can have a different memory layout, and being able to create a
> specific memory layout can be very useful for testing the guest kernel.
> 
> This series allows the user the specify the memory layout for the
> virtual machine by expanding the -m/--mem option to take an <addr>
> parameter, and by adding architecture specific options to define the I/O
> ports, regular MMIO and PCI MMIO memory regions.
> 
> The user defined memory regions are implemented in patch #16; I consider
> the patch to be an RFC because I'm not really sure that my approach is the
> correct one; for example, I decided to make the options arch dependent
> because that seemed like the path of least resistance, but they could have
> just as easily implemented as arch independent and each architecture
> advertised having support for them via a define (like with RAM base
> address).

Do you plan to repost this with Andre's comments addressed?

Will
Alexandru Elisei Feb. 5, 2020, 5:18 p.m. UTC | #2
Hi,

On 2/5/20 5:16 PM, Will Deacon wrote:
> On Mon, Sep 23, 2019 at 02:35:06PM +0100, Alexandru Elisei wrote:
>> The guest memory layout created by kvmtool is fixed: regular MMIO is below
>> 1G, PCI MMIO is below 2G, and the RAM always starts at the 2G mark. Real
>> hardware can have a different memory layout, and being able to create a
>> specific memory layout can be very useful for testing the guest kernel.
>>
>> This series allows the user the specify the memory layout for the
>> virtual machine by expanding the -m/--mem option to take an <addr>
>> parameter, and by adding architecture specific options to define the I/O
>> ports, regular MMIO and PCI MMIO memory regions.
>>
>> The user defined memory regions are implemented in patch #16; I consider
>> the patch to be an RFC because I'm not really sure that my approach is the
>> correct one; for example, I decided to make the options arch dependent
>> because that seemed like the path of least resistance, but they could have
>> just as easily implemented as arch independent and each architecture
>> advertised having support for them via a define (like with RAM base
>> address).
> Do you plan to repost this with Andre's comments addressed?

The series will conflict with my other series which add support for assignable
BARs and PCIE. I am definitely still interested in reposting this because I think
it's very useful, and I'll do it after the other patches get merged.

Thank you for taking a look!

Thanks,
Alex
>
> Will
Marc Zyngier Feb. 6, 2020, 9:20 a.m. UTC | #3
On 2020-02-05 17:18, Alexandru Elisei wrote:
> Hi,
> 
> On 2/5/20 5:16 PM, Will Deacon wrote:
>> On Mon, Sep 23, 2019 at 02:35:06PM +0100, Alexandru Elisei wrote:
>>> The guest memory layout created by kvmtool is fixed: regular MMIO is 
>>> below
>>> 1G, PCI MMIO is below 2G, and the RAM always starts at the 2G mark. 
>>> Real
>>> hardware can have a different memory layout, and being able to create 
>>> a
>>> specific memory layout can be very useful for testing the guest 
>>> kernel.
>>> 
>>> This series allows the user the specify the memory layout for the
>>> virtual machine by expanding the -m/--mem option to take an <addr>
>>> parameter, and by adding architecture specific options to define the 
>>> I/O
>>> ports, regular MMIO and PCI MMIO memory regions.
>>> 
>>> The user defined memory regions are implemented in patch #16; I 
>>> consider
>>> the patch to be an RFC because I'm not really sure that my approach 
>>> is the
>>> correct one; for example, I decided to make the options arch 
>>> dependent
>>> because that seemed like the path of least resistance, but they could 
>>> have
>>> just as easily implemented as arch independent and each architecture
>>> advertised having support for them via a define (like with RAM base
>>> address).
>> Do you plan to repost this with Andre's comments addressed?
> 
> The series will conflict with my other series which add support for 
> assignable
> BARs and PCIE. I am definitely still interested in reposting this
> because I think
> it's very useful, and I'll do it after the other patches get merged.

I'd be happy to review the rebased version. I definitely need it to
support some of my most funky HW...

         M.