kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/28] kvm tools: Prepare kvmtool for another architecture
@ 2011-12-06  3:35 Matt Evans
  2011-12-06  6:06 ` Matt Evans
  2011-12-06  8:56 ` Sasha Levin
  0 siblings, 2 replies; 3+ messages in thread
From: Matt Evans @ 2011-12-06  3:35 UTC (permalink / raw)
  To: kvm, kvm-ppc

Hi,


This patch series rearranges and tidies various parts of kvmtool to pave the way
for the addition of support for another architecture -- SPAPR PPC64.  A second
patch series will follow to present the PPC64 support.

kvmtool is extremely x86-specific, so a fair chunk of refactoring into "common
code" vs "architecture-specific code" is performed in this set.  It also has a
(refreshingly small) set of endian bugs that are fixed, plus assumptions about
the hardware presented to the guest.

I've started the series with the main meat-- moving/renaming things like bios,
CPU setup, guest address space layout, interrupts, ioports etc., into a new x86/
directory.  The Makefile determines an architecture and builds the appropriate
dir, devices, etc.

Follow-on patches change some of the mechanics, for example modifying the loop
around ioctl(KVM_RUN) so that whilst it stays generic, it calls into
arch-specific code to handle specific exit reasons, MMIO etc.  The builtin-run
initialisation path is rationalised so that PCI & IRQs are initialised before
devices, and all of this happens before arch-specific code is given the chance
to initialise any firmware and generate any device trees.

Most of this series is fairly trivial, in moving code, making definitions
arch-local or available via a header, endian sanitisation.  The PCI code changes
are probably most 'interesting', in that I have made the config space accesses
available to those not using the PC ioport access method, plus wrapped
initialisations of config space with cpu_to_leXX accesses.

If there's anything in this series that'll cause the world to end, or stain, do
let me know. :)


Cheers,


Matt



Matt Evans (28):
  kvm tools: Split x86 arch-specific bits into x86/
  kvm tools: Only build/init i8042 on x86
  kvm tools: Add Makefile parameter for kernel include path
  kvm tools: Re-arrange Makefile to heed CFLAGS before checking for
    optional libs
  kvm tools: 64-bit tidy; use PRIx64 when printf'ing u64s and link
    appropriately
  kvm tools: Add arch-specific KVM_RUN exit handling via
    kvm_cpu__handle_exit()
  kvm tools: Move 'kvm__recommended_cpus' to arch-specific code
  kvm tools: Fix KVM_RUN exit code check
  kvm tools: Add kvm__arch_periodic_poll()
  kvm tools: term.h needs to include stdbool.h
  kvm tools: kvm.c needs to include sys/stat.h for mkdir
  kvm tools: Move arch-specific cmdline init into
    kvm__arch_set_cmdline()
  kvm tools: Add CONSOLE_HV term type and allow it to be selected
  kvm tools: Fix term_getc(), term_getc_iov() endian bugs
  kvm tools: Allow initrd_check() to match a cpio
  kvm tools: Allow load_flat_binary() to load an initrd alongside
  kvm tools: Only call symbol__init() if we have BFD
  kvm tools: Initialise PCI before devices start getting registered
    with PCI
  kvm tools: Perform CPU and firmware setup after devices are added
  kvm tools: Init IRQs after determining nrcpus
  kvm tools: Add --hugetlbfs option to specify memory path
  kvm tools: Move PCI_MAX_DEVICES to pci.h
  kvm tools: Endian-sanitise pci.h and PCI device setup
  kvm tools: Fix virtio-pci endian bug when reading
    VIRTIO_PCI_QUEUE_NUM
  kvm tools: Correctly set virtio-pci bar_size and remove hardwired
    address
  kvm tools: Add pci__config_{rd,wr}(), pci__find_dev() and fix PCI
    config register addressing
  kvm tools: Arch-specific define for PCI MMIO allocation area
  kvm tools: Create arch-specific kvm_cpu__emulate_io()

 tools/kvm/Makefile                              |  139 +++++---
 tools/kvm/builtin-run.c                         |   82 +++--
 tools/kvm/builtin-stat.c                        |    4 +-
 tools/kvm/disk/core.c                           |    4 +-
 tools/kvm/hw/pci-shmem.c                        |   23 +-
 tools/kvm/hw/vesa.c                             |   15 +-
 tools/kvm/include/kvm/ioport.h                  |   13 +-
 tools/kvm/include/kvm/kvm-cpu.h                 |   30 +--
 tools/kvm/include/kvm/kvm.h                     |   62 +---
 tools/kvm/include/kvm/pci.h                     |   30 ++-
 tools/kvm/include/kvm/term.h                    |    2 +
 tools/kvm/ioport.c                              |   54 ---
 tools/kvm/kvm-cpu.c                             |  407 +---------------------
 tools/kvm/kvm.c                                 |  374 +-------------------
 tools/kvm/mmio.c                                |    4 +-
 tools/kvm/pci.c                                 |   76 +++--
 tools/kvm/term.c                                |    5 +-
 tools/kvm/virtio/pci.c                          |   51 ++--
 tools/kvm/{ => x86}/bios.c                      |    0
 tools/kvm/{ => x86}/bios/.gitignore             |    0
 tools/kvm/{ => x86}/bios/bios-rom.S             |    2 +-
 tools/kvm/{ => x86}/bios/e820.c                 |    0
 tools/kvm/{ => x86}/bios/entry.S                |    0
 tools/kvm/{ => x86}/bios/gen-offsets.sh         |    0
 tools/kvm/{ => x86}/bios/int10.c                |    0
 tools/kvm/{ => x86}/bios/int15.c                |    0
 tools/kvm/{ => x86}/bios/local.S                |    0
 tools/kvm/{ => x86}/bios/macro.S                |    0
 tools/kvm/{ => x86}/bios/memcpy.c               |    0
 tools/kvm/{ => x86}/bios/rom.ld.S               |    0
 tools/kvm/{ => x86}/cpuid.c                     |    0
 tools/kvm/{ => x86}/include/kvm/assembly.h      |    0
 tools/kvm/{ => x86}/include/kvm/barrier.h       |    0
 tools/kvm/{ => x86}/include/kvm/bios-export.h   |    0
 tools/kvm/{ => x86}/include/kvm/bios.h          |    0
 tools/kvm/{ => x86}/include/kvm/boot-protocol.h |    0
 tools/kvm/{ => x86}/include/kvm/cpufeature.h    |    0
 tools/kvm/{ => x86}/include/kvm/interrupt.h     |    0
 tools/kvm/x86/include/kvm/kvm-arch.h            |   64 ++++
 tools/kvm/x86/include/kvm/kvm-cpu-arch.h        |   33 ++
 tools/kvm/{ => x86}/include/kvm/mptable.h       |    0
 tools/kvm/{ => x86}/interrupt.c                 |    0
 tools/kvm/x86/ioport.c                          |   59 ++++
 tools/kvm/{ => x86}/irq.c                       |    0
 tools/kvm/x86/kvm-cpu.c                         |  425 +++++++++++++++++++++++
 tools/kvm/x86/kvm.c                             |  385 ++++++++++++++++++++
 tools/kvm/{ => x86}/mptable.c                   |    0
 47 files changed, 1287 insertions(+), 1056 deletions(-)
 rename tools/kvm/{ => x86}/bios.c (100%)
 rename tools/kvm/{ => x86}/bios/.gitignore (100%)
 rename tools/kvm/{ => x86}/bios/bios-rom.S (80%)
 rename tools/kvm/{ => x86}/bios/e820.c (100%)
 rename tools/kvm/{ => x86}/bios/entry.S (100%)
 rename tools/kvm/{ => x86}/bios/gen-offsets.sh (100%)
 rename tools/kvm/{ => x86}/bios/int10.c (100%)
 rename tools/kvm/{ => x86}/bios/int15.c (100%)
 rename tools/kvm/{ => x86}/bios/local.S (100%)
 rename tools/kvm/{ => x86}/bios/macro.S (100%)
 rename tools/kvm/{ => x86}/bios/memcpy.c (100%)
 rename tools/kvm/{ => x86}/bios/rom.ld.S (100%)
 rename tools/kvm/{ => x86}/cpuid.c (100%)
 rename tools/kvm/{ => x86}/include/kvm/assembly.h (100%)
 rename tools/kvm/{ => x86}/include/kvm/barrier.h (100%)
 rename tools/kvm/{ => x86}/include/kvm/bios-export.h (100%)
 rename tools/kvm/{ => x86}/include/kvm/bios.h (100%)
 rename tools/kvm/{ => x86}/include/kvm/boot-protocol.h (100%)
 rename tools/kvm/{ => x86}/include/kvm/cpufeature.h (100%)
 rename tools/kvm/{ => x86}/include/kvm/interrupt.h (100%)
 create mode 100644 tools/kvm/x86/include/kvm/kvm-arch.h
 create mode 100644 tools/kvm/x86/include/kvm/kvm-cpu-arch.h
 rename tools/kvm/{ => x86}/include/kvm/mptable.h (100%)
 rename tools/kvm/{ => x86}/interrupt.c (100%)
 create mode 100644 tools/kvm/x86/ioport.c
 rename tools/kvm/{ => x86}/irq.c (100%)
 create mode 100644 tools/kvm/x86/kvm-cpu.c
 create mode 100644 tools/kvm/x86/kvm.c
 rename tools/kvm/{ => x86}/mptable.c (100%)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 00/28] kvm tools: Prepare kvmtool for another architecture
  2011-12-06  3:35 [PATCH 00/28] kvm tools: Prepare kvmtool for another architecture Matt Evans
@ 2011-12-06  6:06 ` Matt Evans
  2011-12-06  8:56 ` Sasha Levin
  1 sibling, 0 replies; 3+ messages in thread
From: Matt Evans @ 2011-12-06  6:06 UTC (permalink / raw)
  To: kvm, kvm-ppc

On 06/12/11 14:35, Matt Evans wrote:

> This patch series rearranges and tidies various parts of kvmtool to pave the way
> for the addition of support for another architecture -- SPAPR PPC64.  A second
> patch series will follow to present the PPC64 support.

I forgot to mention, of course, that these two sets apply on top of 
git://github.com/penberg/linux-kvm.git master as of d5e6b9fa.

Also, I've have been testing PPC64 kvmtool using the book3s_hv KVM mode.


Matt

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 00/28] kvm tools: Prepare kvmtool for another architecture
  2011-12-06  3:35 [PATCH 00/28] kvm tools: Prepare kvmtool for another architecture Matt Evans
  2011-12-06  6:06 ` Matt Evans
@ 2011-12-06  8:56 ` Sasha Levin
  1 sibling, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2011-12-06  8:56 UTC (permalink / raw)
  To: Matt Evans; +Cc: kvm, kvm-ppc

Awesome work :)

I really like the clean split we'll have between arch specific and
generic code after this series.

Not only we get ppc support, you've also made it very easy to add future
support for more archs.

On Tue, 2011-12-06 at 14:35 +1100, Matt Evans wrote:
> Hi,
> 
> 
> This patch series rearranges and tidies various parts of kvmtool to pave the way
> for the addition of support for another architecture -- SPAPR PPC64.  A second
> patch series will follow to present the PPC64 support.
> 
> kvmtool is extremely x86-specific, so a fair chunk of refactoring into "common
> code" vs "architecture-specific code" is performed in this set.  It also has a
> (refreshingly small) set of endian bugs that are fixed, plus assumptions about
> the hardware presented to the guest.
> 
> I've started the series with the main meat-- moving/renaming things like bios,
> CPU setup, guest address space layout, interrupts, ioports etc., into a new x86/
> directory.  The Makefile determines an architecture and builds the appropriate
> dir, devices, etc.
> 
> Follow-on patches change some of the mechanics, for example modifying the loop
> around ioctl(KVM_RUN) so that whilst it stays generic, it calls into
> arch-specific code to handle specific exit reasons, MMIO etc.  The builtin-run
> initialisation path is rationalised so that PCI & IRQs are initialised before
> devices, and all of this happens before arch-specific code is given the chance
> to initialise any firmware and generate any device trees.
> 
> Most of this series is fairly trivial, in moving code, making definitions
> arch-local or available via a header, endian sanitisation.  The PCI code changes
> are probably most 'interesting', in that I have made the config space accesses
> available to those not using the PC ioport access method, plus wrapped
> initialisations of config space with cpu_to_leXX accesses.
> 
> If there's anything in this series that'll cause the world to end, or stain, do
> let me know. :)
> 
> 
> Cheers,
> 
> 
> Matt
> 
> 
> 
> Matt Evans (28):
>   kvm tools: Split x86 arch-specific bits into x86/
>   kvm tools: Only build/init i8042 on x86
>   kvm tools: Add Makefile parameter for kernel include path
>   kvm tools: Re-arrange Makefile to heed CFLAGS before checking for
>     optional libs
>   kvm tools: 64-bit tidy; use PRIx64 when printf'ing u64s and link
>     appropriately
>   kvm tools: Add arch-specific KVM_RUN exit handling via
>     kvm_cpu__handle_exit()
>   kvm tools: Move 'kvm__recommended_cpus' to arch-specific code
>   kvm tools: Fix KVM_RUN exit code check
>   kvm tools: Add kvm__arch_periodic_poll()
>   kvm tools: term.h needs to include stdbool.h
>   kvm tools: kvm.c needs to include sys/stat.h for mkdir
>   kvm tools: Move arch-specific cmdline init into
>     kvm__arch_set_cmdline()
>   kvm tools: Add CONSOLE_HV term type and allow it to be selected
>   kvm tools: Fix term_getc(), term_getc_iov() endian bugs
>   kvm tools: Allow initrd_check() to match a cpio
>   kvm tools: Allow load_flat_binary() to load an initrd alongside
>   kvm tools: Only call symbol__init() if we have BFD
>   kvm tools: Initialise PCI before devices start getting registered
>     with PCI
>   kvm tools: Perform CPU and firmware setup after devices are added
>   kvm tools: Init IRQs after determining nrcpus
>   kvm tools: Add --hugetlbfs option to specify memory path
>   kvm tools: Move PCI_MAX_DEVICES to pci.h
>   kvm tools: Endian-sanitise pci.h and PCI device setup
>   kvm tools: Fix virtio-pci endian bug when reading
>     VIRTIO_PCI_QUEUE_NUM
>   kvm tools: Correctly set virtio-pci bar_size and remove hardwired
>     address
>   kvm tools: Add pci__config_{rd,wr}(), pci__find_dev() and fix PCI
>     config register addressing
>   kvm tools: Arch-specific define for PCI MMIO allocation area
>   kvm tools: Create arch-specific kvm_cpu__emulate_io()
> 
>  tools/kvm/Makefile                              |  139 +++++---
>  tools/kvm/builtin-run.c                         |   82 +++--
>  tools/kvm/builtin-stat.c                        |    4 +-
>  tools/kvm/disk/core.c                           |    4 +-
>  tools/kvm/hw/pci-shmem.c                        |   23 +-
>  tools/kvm/hw/vesa.c                             |   15 +-
>  tools/kvm/include/kvm/ioport.h                  |   13 +-
>  tools/kvm/include/kvm/kvm-cpu.h                 |   30 +--
>  tools/kvm/include/kvm/kvm.h                     |   62 +---
>  tools/kvm/include/kvm/pci.h                     |   30 ++-
>  tools/kvm/include/kvm/term.h                    |    2 +
>  tools/kvm/ioport.c                              |   54 ---
>  tools/kvm/kvm-cpu.c                             |  407 +---------------------
>  tools/kvm/kvm.c                                 |  374 +-------------------
>  tools/kvm/mmio.c                                |    4 +-
>  tools/kvm/pci.c                                 |   76 +++--
>  tools/kvm/term.c                                |    5 +-
>  tools/kvm/virtio/pci.c                          |   51 ++--
>  tools/kvm/{ => x86}/bios.c                      |    0
>  tools/kvm/{ => x86}/bios/.gitignore             |    0
>  tools/kvm/{ => x86}/bios/bios-rom.S             |    2 +-
>  tools/kvm/{ => x86}/bios/e820.c                 |    0
>  tools/kvm/{ => x86}/bios/entry.S                |    0
>  tools/kvm/{ => x86}/bios/gen-offsets.sh         |    0
>  tools/kvm/{ => x86}/bios/int10.c                |    0
>  tools/kvm/{ => x86}/bios/int15.c                |    0
>  tools/kvm/{ => x86}/bios/local.S                |    0
>  tools/kvm/{ => x86}/bios/macro.S                |    0
>  tools/kvm/{ => x86}/bios/memcpy.c               |    0
>  tools/kvm/{ => x86}/bios/rom.ld.S               |    0
>  tools/kvm/{ => x86}/cpuid.c                     |    0
>  tools/kvm/{ => x86}/include/kvm/assembly.h      |    0
>  tools/kvm/{ => x86}/include/kvm/barrier.h       |    0
>  tools/kvm/{ => x86}/include/kvm/bios-export.h   |    0
>  tools/kvm/{ => x86}/include/kvm/bios.h          |    0
>  tools/kvm/{ => x86}/include/kvm/boot-protocol.h |    0
>  tools/kvm/{ => x86}/include/kvm/cpufeature.h    |    0
>  tools/kvm/{ => x86}/include/kvm/interrupt.h     |    0
>  tools/kvm/x86/include/kvm/kvm-arch.h            |   64 ++++
>  tools/kvm/x86/include/kvm/kvm-cpu-arch.h        |   33 ++
>  tools/kvm/{ => x86}/include/kvm/mptable.h       |    0
>  tools/kvm/{ => x86}/interrupt.c                 |    0
>  tools/kvm/x86/ioport.c                          |   59 ++++
>  tools/kvm/{ => x86}/irq.c                       |    0
>  tools/kvm/x86/kvm-cpu.c                         |  425 +++++++++++++++++++++++
>  tools/kvm/x86/kvm.c                             |  385 ++++++++++++++++++++
>  tools/kvm/{ => x86}/mptable.c                   |    0
>  47 files changed, 1287 insertions(+), 1056 deletions(-)
>  rename tools/kvm/{ => x86}/bios.c (100%)
>  rename tools/kvm/{ => x86}/bios/.gitignore (100%)
>  rename tools/kvm/{ => x86}/bios/bios-rom.S (80%)
>  rename tools/kvm/{ => x86}/bios/e820.c (100%)
>  rename tools/kvm/{ => x86}/bios/entry.S (100%)
>  rename tools/kvm/{ => x86}/bios/gen-offsets.sh (100%)
>  rename tools/kvm/{ => x86}/bios/int10.c (100%)
>  rename tools/kvm/{ => x86}/bios/int15.c (100%)
>  rename tools/kvm/{ => x86}/bios/local.S (100%)
>  rename tools/kvm/{ => x86}/bios/macro.S (100%)
>  rename tools/kvm/{ => x86}/bios/memcpy.c (100%)
>  rename tools/kvm/{ => x86}/bios/rom.ld.S (100%)
>  rename tools/kvm/{ => x86}/cpuid.c (100%)
>  rename tools/kvm/{ => x86}/include/kvm/assembly.h (100%)
>  rename tools/kvm/{ => x86}/include/kvm/barrier.h (100%)
>  rename tools/kvm/{ => x86}/include/kvm/bios-export.h (100%)
>  rename tools/kvm/{ => x86}/include/kvm/bios.h (100%)
>  rename tools/kvm/{ => x86}/include/kvm/boot-protocol.h (100%)
>  rename tools/kvm/{ => x86}/include/kvm/cpufeature.h (100%)
>  rename tools/kvm/{ => x86}/include/kvm/interrupt.h (100%)
>  create mode 100644 tools/kvm/x86/include/kvm/kvm-arch.h
>  create mode 100644 tools/kvm/x86/include/kvm/kvm-cpu-arch.h
>  rename tools/kvm/{ => x86}/include/kvm/mptable.h (100%)
>  rename tools/kvm/{ => x86}/interrupt.c (100%)
>  create mode 100644 tools/kvm/x86/ioport.c
>  rename tools/kvm/{ => x86}/irq.c (100%)
>  create mode 100644 tools/kvm/x86/kvm-cpu.c
>  create mode 100644 tools/kvm/x86/kvm.c
>  rename tools/kvm/{ => x86}/mptable.c (100%)
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 

Sasha.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-12-06  8:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-06  3:35 [PATCH 00/28] kvm tools: Prepare kvmtool for another architecture Matt Evans
2011-12-06  6:06 ` Matt Evans
2011-12-06  8:56 ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).