#
b0d56e3c |
| 01-Jul-2022 |
Jean-Philippe Brucker <jean-philippe.brucker@arm.com> |
virtio: Add support for modern virtio-pci
Add support for modern virtio-pci implementation (based on the 1.0 virtio spec). We add a new transport, alongside MMIO and PCI-legacy. This is now the defa
virtio: Add support for modern virtio-pci
Add support for modern virtio-pci implementation (based on the 1.0 virtio spec). We add a new transport, alongside MMIO and PCI-legacy. This is now the default when selecting PCI, but users can still select the legacy transport for all virtio devices by passing "--virtio-legacy" on the command-line.
The main change in modern PCI is the way we address virtqueues, using 64-bit values instead of PFNs. To keep the queue configuration atomic the device also gets a "queue enable" register. Configuration is also made extensible by more feature bits and PCI capabilities. Scalability is improved as well, as devices can have notification registers for each virtqueue on separate pages. However this implementation keeps a single notification register.
Signed-off-by: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com> Link: https://lore.kernel.org/r/20220701142434.75170-9-jean-philippe.brucker@arm.com Signed-off-by: Will Deacon <will@kernel.org>
show more ...
|
#
39181fc6 |
| 12-Oct-2021 |
Alexandru Elisei <alexandru.elisei@arm.com> |
vfio/pci: Align MSIX Table and PBA size to guest maximum page size
When allocating MMIO space for the MSI-X table, kvmtool rounds the allocation to the host's page size to make it as easy as possibl
vfio/pci: Align MSIX Table and PBA size to guest maximum page size
When allocating MMIO space for the MSI-X table, kvmtool rounds the allocation to the host's page size to make it as easy as possible for the guest to map the table to a page, if it wants to (and doesn't do BAR reassignment, like the x86 architecture for example). However, the host's page size can differ from the guest's on architectures which support multiple page sizes. For example, arm64 supports three different page size, and it is possible for the host to be using 4k pages, while the guest is using 64k pages.
To make sure the allocation is always aligned to a guest's page size, round it up to the maximum architectural page size. Do the same for the pending bit array if it lives in its own BAR.
Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com> Reviewed-by: Andre Przywara <andre.przywara@arm.com> Link: https://lore.kernel.org/r/20211012132510.42134-8-alexandru.elisei@arm.com Signed-off-by: Will Deacon <will@kernel.org>
show more ...
|
#
854aa2ef |
| 14-Apr-2020 |
Julien Thierry <julien.thierry@arm.com> |
ioport: pci: Move port allocations to PCI devices
The dynamic ioport allocation with IOPORT_EMPTY is currently only used by PCI devices. Other devices use fixed ports for which they request registra
ioport: pci: Move port allocations to PCI devices
The dynamic ioport allocation with IOPORT_EMPTY is currently only used by PCI devices. Other devices use fixed ports for which they request registration to the ioport API.
PCI ports need to be in the PCI IO space and there is no reason ioport API should know a PCI port is being allocated and needs to be placed in PCI IO space. This currently just happens to be the case.
Move the responsability of dynamic allocation of ioports from the ioport API to PCI.
In the future, if other types of devices also need dynamic ioport allocation, they'll have to figure out the range of ports they are allowed to use.
Reviewed-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Julien Thierry <julien.thierry@arm.com> [Renamed functions for clarity] Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com> Signed-off-by: Will Deacon <will@kernel.org>
show more ...
|
#
ed83730f |
| 04-Apr-2018 |
Jean-Philippe Brucker <jean-philippe.brucker@arm.com> |
ioeventfd: Don't register on the PIO bus if the arch doesn't support it
virtio/pci.c registers a notification ioeventfd on both PIO and MMIO buses. But architectures other than x86 cannot differenti
ioeventfd: Don't register on the PIO bus if the arch doesn't support it
virtio/pci.c registers a notification ioeventfd on both PIO and MMIO buses. But architectures other than x86 cannot differentiate MMIO from PIO traps, and the kernel always calls kvm_io_bus_read/write with KVM_MMIO_BUS as argument.
As a result kvmtool's ioeventfd isn't used with virtio PCI, because the kernel can't find it and all accesses to the doorbell return to userspace. To fix it, don't set the PIO flag if the architecture doesn't support it.
Fixes: a508ea95f954 ("virtio/pci: Use port I/O for configuration registers by default") Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
show more ...
|
#
1cbb2c50 |
| 01-Jun-2015 |
Andre Przywara <andre.przywara@arm.com> |
kvmtool: remove kvm/segment.h
This header just holds three trivial functions, but pulls in linux/types.h, which calls for trouble when compiling BIOS files on x86-64 multiarch machines. Remove unnec
kvmtool: remove kvm/segment.h
This header just holds three trivial functions, but pulls in linux/types.h, which calls for trouble when compiling BIOS files on x86-64 multiarch machines. Remove unnecessary includes and move the definitions into the files where they are used.
Signed-off-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
show more ...
|
#
b5a5cd67 |
| 28-May-2014 |
Andreas Herrmann <andreas.herrmann@caviumnetworks.com> |
kvm tools: Provide per arch macro to specify type for KVM_CREATE_VM
This is is usually 0 for most archs. On mips we have two types. TE (type 0) and MIPS-VZ (type 1). Default to 1 on mips.
Signed-of
kvm tools: Provide per arch macro to specify type for KVM_CREATE_VM
This is is usually 0 for most archs. On mips we have two types. TE (type 0) and MIPS-VZ (type 1). Default to 1 on mips.
Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
show more ...
|
#
d97dadec |
| 04-Feb-2014 |
Will Deacon <will.deacon@arm.com> |
kvm tools: ARM: allow default virtio transport to be passed on cmdline
This patch changes VIRTIO_DEFAULT_TRANS to take a struct kvm parameter, allowing architectures to choose the default transport
kvm tools: ARM: allow default virtio transport to be passed on cmdline
This patch changes VIRTIO_DEFAULT_TRANS to take a struct kvm parameter, allowing architectures to choose the default transport dynamically.
For ARM, this is driven by an arch-specific cmdline option.
Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
show more ...
|
#
9dc5430c |
| 04-Feb-2014 |
Will Deacon <will.deacon@arm.com> |
kvm tools: irq: make irq__alloc_line generic
All architectures are now doing the same thing for irq__alloc_line:
1. Initialise a global counter to some fixed offset 2. Return the current value
kvm tools: irq: make irq__alloc_line generic
All architectures are now doing the same thing for irq__alloc_line:
1. Initialise a global counter to some fixed offset 2. Return the current value of the counter and increment it
This is better off in core code, with each architecture specifying the initial offset, which is specific to the interrupt controller being used by the guest.
Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
show more ...
|
#
b403f2f7 |
| 04-Feb-2014 |
Will Deacon <will.deacon@arm.com> |
kvm tools: pci: register 24-bit configuration space below MMIO region
Rather than performing all config accesses via ioports, map in a 24-bit memory-mapped configuration space directly below the PCI
kvm tools: pci: register 24-bit configuration space below MMIO region
Rather than performing all config accesses via ioports, map in a 24-bit memory-mapped configuration space directly below the PCI MMIO region.
This will allow architectures to support PCI without having to support legacy ioports in the guest kernel. Instead, kvm tool can forward the config accesses directly to the relevant ioport config callbacks.
Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
show more ...
|
#
dbfef850 |
| 01-May-2013 |
Will Deacon <will.deacon@arm.com> |
kvm tools: allow ioports to be offset from 0
Architectures without a legacy ioport may wish to emulate one, but not at address 0x0.
This patch introduces KVM_IOPORT_AREA, which each architecture de
kvm tools: allow ioports to be offset from 0
Architectures without a legacy ioport may wish to emulate one, but not at address 0x0.
This patch introduces KVM_IOPORT_AREA, which each architecture defines to be the start of the ioport region (i.e. where port addresses are offset from).
Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
show more ...
|
#
f412251f |
| 22-Nov-2012 |
Will Deacon <will.deacon@arm.com> |
kvm tools: teach guest_flat_to_host about memory banks starting above 0
Running a guest with multiple banks of memory based above 0 causes the guest_flat_to_host address conversion to fail, as it is
kvm tools: teach guest_flat_to_host about memory banks starting above 0
Running a guest with multiple banks of memory based above 0 causes the guest_flat_to_host address conversion to fail, as it is assumed that guest memory addresses are offset linearly from 0.
This patch changes the translation function so that the kvm_mem_bank structures registered by kvm__register_mem are used to translate guest addresses, rather than use an offset from the start of host memory.
Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
show more ...
|
#
ae06ce71 |
| 12-Nov-2012 |
Will Deacon <will.deacon@arm.com> |
kvm tools: allow arch to specify default virtio transport
Some architectures may provide only a restricted PCI implementation and therefore prefer MMIO as the transport for virtio devices.
This pat
kvm tools: allow arch to specify default virtio transport
Some architectures may provide only a restricted PCI implementation and therefore prefer MMIO as the transport for virtio devices.
This patch allows the arch backend to specify the default virtio transport. Some devices (e.g. net) allow the transport to be overriden by the user and are left alone by this change.
Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
show more ...
|
#
42ac24f9 |
| 05-Sep-2012 |
Sasha Levin <levinsasha928@gmail.com> |
kvm tools: split struct kvm into arch specific part
Move all the non-arch specific members into a generic struct, and the arch specific members into a arch specific kvm_arch. This prevents code dupl
kvm tools: split struct kvm into arch specific part
Move all the non-arch specific members into a generic struct, and the arch specific members into a arch specific kvm_arch. This prevents code duplication across different archs.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
show more ...
|
#
3ebd8e0b |
| 17-Jul-2012 |
Michael Ellerman <michael@ellerman.id.au> |
kvm tools: Remember page size as kvm->ram_pagesize
On some powerpc platforms we need to make sure we only advertise page sizes to the guest which are <= the size of the pages backing guest RAM.
So
kvm tools: Remember page size as kvm->ram_pagesize
On some powerpc platforms we need to make sure we only advertise page sizes to the guest which are <= the size of the pages backing guest RAM.
So have mmap_hugetblfs() save the hugetblfs page size for us, and also teach mmap_anon_or_hugetblfs() to set the page size for anonymous mmap.
Acked-by: Matt Evans <matt@ozlabs.org> Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Pekka Enberg <penberg@kernel.org>
show more ...
|
#
2b86c276 |
| 07-Apr-2012 |
Asias He <asias.hejun@gmail.com> |
kvm tools: Introduce KVM_VIRTIO_MMIO_AREA
This area is used for virtio-mmio.
Signed-off-by: Asias He <asias.hejun@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
|
#
dfb2e458 |
| 04-Feb-2012 |
Cyrill Gorcunov <gorcunov@openvz.org> |
kvm tool: Make kvm structure to carry name copy
If default guest name is used (which is the default case) the kvm might end up carrying the pointer to a name which is allocated on stack.
kvm_cmd_ru
kvm tool: Make kvm structure to carry name copy
If default guest name is used (which is the default case) the kvm might end up carrying the pointer to a name which is allocated on stack.
kvm_cmd_run_init (on stack) default_name kvm__init(..., default_name) kvm->name = default_name
So make it to carry a copy of name.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
show more ...
|
#
f7abc4cd |
| 06-Jan-2012 |
Hongyong Zang <zanghongyong@huawei.com> |
kvm tool: Change kvm->ram_size to real mapped size.
If a guest's ram_size exceeds KVM_32BIT_GAP_START, the corresponding kvm tool's virtual address size should be (ram_size + KVM_32BIT_GAP_SIZE), ra
kvm tool: Change kvm->ram_size to real mapped size.
If a guest's ram_size exceeds KVM_32BIT_GAP_START, the corresponding kvm tool's virtual address size should be (ram_size + KVM_32BIT_GAP_SIZE), rather than ram_size. Use macro define KVM_32BIT_MAX_MEM_SIZE instead of magic number "0x100000000ULL".
Signed-off-by: Hongyong Zang <zanghongyong@huawei.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
show more ...
|
#
7021c50b |
| 22-Dec-2011 |
Asias He <asias.hejun@gmail.com> |
kvm tools: Introduce KVM_IPC_VMSTATE IPC cmd
This can be used to get vm status information:
vm is running or paused.
Signed-off-by: Asias He <asias.hejun@gmail.com> Signed-off-by: Pekka Enberg <pe
kvm tools: Introduce KVM_IPC_VMSTATE IPC cmd
This can be used to get vm status information:
vm is running or paused.
Signed-off-by: Asias He <asias.hejun@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
show more ...
|
#
e2077857 |
| 15-Dec-2011 |
Matt Evans <matt@ozlabs.org> |
kvm tools: Remove KVM_NR_CPUS
The KVM_NR_CPUS define is only really used to statically size the global kvm_cpus array, which can just as easily be allocated on startup. There is some checking of th
kvm tools: Remove KVM_NR_CPUS
The KVM_NR_CPUS define is only really used to statically size the global kvm_cpus array, which can just as easily be allocated on startup. There is some checking of the -c <nr cpus> value given against NR_CPUs but this is later again checked against a dynamically-determined limit from KVM_CAP_MAX_VCPUS anyway. The hardwired limit is arbitrary and not strictly necessary.
This patch removes the #define, replacing the statically-sized array with a malloc; the array is kvm->nrcpus+1 in size so that any iterator can halt at the end (this is done in kvm_cpu__reboot, which doesn't have access to a struct kvm* and therefore kvm->nrcpus).
An unused #define in x86/mptable.c is also removed.
Signed-off-by: Matt Evans <matt@ozlabs.org> Signed-off-by: Pekka Enberg <penberg@kernel.org>
show more ...
|
#
40f2fd06 |
| 09-Dec-2011 |
Matt Evans <matt@ozlabs.org> |
kvm tools: Arch-specific define for PCI MMIO allocation area
pci_get_io_space_block() used to grab addresses from KVM_32BIT_GAP_START + 0x1000000, which is x86-specific. Create a new define, KVM_PC
kvm tools: Arch-specific define for PCI MMIO allocation area
pci_get_io_space_block() used to grab addresses from KVM_32BIT_GAP_START + 0x1000000, which is x86-specific. Create a new define, KVM_PCI_MMIO_AREA, to specify a bus address these allocations can come from.
Signed-off-by: Matt Evans <matt@ozlabs.org> Signed-off-by: Pekka Enberg <penberg@kernel.org>
show more ...
|
#
af7b0868 |
| 06-Dec-2011 |
Matt Evans <matt@ozlabs.org> |
kvm tools: Split x86 arch-specific bits into x86/
Create a new arch-specific subdirectory to contain architecture-specific code and includes.
The Makefile now adds various arch-specific objects bas
kvm tools: Split x86 arch-specific bits into x86/
Create a new arch-specific subdirectory to contain architecture-specific code and includes.
The Makefile now adds various arch-specific objects based on detected architecture. That aside, this patch should only contain code moves. These include:
- x86-specific kvm_cpu setup, kernel loading, memory setup etc. now in x86/kvm{-cpu}.c - BIOS now lives in x86/bios/ - ioport setup - KVM extensions are asserted in arch-specific kvm.c now, so each architecture can manage its own dependencies. - Various architecture-specific #defines are moved into $(ARCH)/include/kvm{-cpu}.h such as struct kvm_cpu, KVM_NR_CPUS, KVM_32BIT_GAP_SIZE.
Signed-off-by: Matt Evans <matt@ozlabs.org> Signed-off-by: Pekka Enberg <penberg@kernel.org>
show more ...
|