Re: Booting host on a P2020RDB freescale board

2011-12-05 Thread Aashish Mittal
Aashish Mittal aashish.mittal4u at gmail.com writes: Hi The issue has been fixed. The issue was that the mount point set in bootargs was wrong, it should have been /dev/ram . Sorry for all the trouble. Thanks Aashish Mittal -- To unsubscribe from this list: send the line unsubscribe kvm-ppc

[PATCH 02/28] kvm tools: Only build/init i8042 on x86

2011-12-05 Thread Matt Evans
Not every architecture has an i8042 kbd controller, so only use this when building for x86. Signed-off-by: Matt Evans m...@ozlabs.org --- tools/kvm/Makefile |2 +- tools/kvm/builtin-run.c |2 ++ 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/tools/kvm/Makefile

[PATCH 03/28] kvm tools: Add Makefile parameter for kernel include path

2011-12-05 Thread Matt Evans
This patch adds an 'I' parameter to override the default kernel include path of '../../include'. Signed-off-by: Matt Evans m...@ozlabs.org --- tools/kvm/Makefile |9 +++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/kvm/Makefile b/tools/kvm/Makefile index

[PATCH 07/28] kvm tools: Move 'kvm__recommended_cpus' to arch-specific code

2011-12-05 Thread Matt Evans
Architectures can recommend/count/determine number of CPUs differently, so move this out of generic code. Signed-off-by: Matt Evans m...@ozlabs.org --- tools/kvm/kvm.c | 30 -- tools/kvm/x86/kvm.c | 30 ++ 2 files changed, 30

[PATCH 08/28] kvm tools: Fix KVM_RUN exit code check

2011-12-05 Thread Matt Evans
kvm_cpu__run() currently die()s if KVM_RUN returns non-zero. Some architectures may return positive values in non-error cases, whereas real errors are always negative return values. Check for those instead. Signed-off-by: Matt Evans m...@ozlabs.org --- tools/kvm/kvm-cpu.c |2 +- 1 files

[PATCH 09/28] kvm tools: Add kvm__arch_periodic_poll()

2011-12-05 Thread Matt Evans
Currently, the SIGALRM handler calls device poll functions (for serial, virtio console) directly. Which devices are present and which require polling is a system-specific decision, so create a new function called from common code move the x86-specific poll calls into it. Signed-off-by: Matt

[PATCH 11/28] kvm tools: kvm.c needs to include sys/stat.h for mkdir

2011-12-05 Thread Matt Evans
Fix a missing include. Signed-off-by: Matt Evans m...@ozlabs.org --- tools/kvm/kvm.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/tools/kvm/kvm.c b/tools/kvm/kvm.c index e526483..33243f1 100644 --- a/tools/kvm/kvm.c +++ b/tools/kvm/kvm.c @@ -8,6 +8,7 @@ #include

[PATCH 12/28] kvm tools: Move arch-specific cmdline init into kvm__arch_set_cmdline()

2011-12-05 Thread Matt Evans
Different systems will want different base kernel commandlines, e.g. non-x86 systems probably don't need noapic, i8042.* etc., so set the commandline up in arch-specific code. Then, if the resulting commandline is empty, don't strcat a space onto the front. Signed-off-by: Matt Evans

[PATCH 13/28] kvm tools: Add CONSOLE_HV term type and allow it to be selected

2011-12-05 Thread Matt Evans
This patch paves the way for adding a hypervisor console, useful on systems that support one out of the box yet don't have either serial port or virtio console support (e.g. kernels expecting POWER SPAPR). Signed-off-by: Matt Evans m...@ozlabs.org --- tools/kvm/builtin-run.c |8 ++--

[PATCH 14/28] kvm tools: Fix term_getc(), term_getc_iov() endian bugs

2011-12-05 Thread Matt Evans
term_getc()'s int c has one byte written into it (at its lowest address) by read_in_full(). This is expected to be the least significant byte, but that isn't the case on BE! Use correct type, unsigned char. A similar issue exists in term_getc_iov(), which needs to write a char to the iov rather

[PATCH 15/28] kvm tools: Allow initrd_check() to match a cpio

2011-12-05 Thread Matt Evans
cpios are valid as initrds too, so allow them through the check. Signed-off-by: Matt Evans m...@ozlabs.org --- tools/kvm/kvm.c |8 +--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/kvm/kvm.c b/tools/kvm/kvm.c index 33243f1..457de1a 100644 --- a/tools/kvm/kvm.c +++

[PATCH 17/28] kvm tools: Only call symbol__init() if we have BFD

2011-12-05 Thread Matt Evans
CONFIG_HAS_BFD is optional, symbol.c inclusion is optional -- so make its init call dependent on CONFIG_HAS_BFD. Signed-off-by: Matt Evans m...@ozlabs.org --- tools/kvm/builtin-run.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/tools/kvm/builtin-run.c

[PATCH 16/28] kvm tools: Allow load_flat_binary() to load an initrd alongside

2011-12-05 Thread Matt Evans
This patch passes the initrd fd and commandline to load_flat_binary(), which may be used to load both the kernel an initrd (stashing or inserting the commandline as appropriate) in the same way that load_bzimage() does. This is especially useful when load_bzimage() is unused for a particular

[PATCH 18/28] kvm tools: Initialise PCI before devices start getting registered with PCI

2011-12-05 Thread Matt Evans
Re-arrange pci__init() in builtin-run such that it comes before devices are initialised. Signed-off-by: Matt Evans m...@ozlabs.org --- tools/kvm/builtin-run.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/kvm/builtin-run.c b/tools/kvm/builtin-run.c index

[PATCH 19/28] kvm tools: Perform CPU and firmware setup after devices are added

2011-12-05 Thread Matt Evans
Currently some devices (in this case kbd, fb, vesa) are initialised after CPU/firmware setup. On some platforms (e.g. PPC) kvm__arch_setup_firmware() may be making a device tree. Any devices added after this point will be missed! Tiny refactor of builtin-run.c, moving timer start, firmware

[PATCH 21/28] kvm tools: Add --hugetlbfs option to specify memory path

2011-12-05 Thread Matt Evans
Some architectures may want to use hugetlbfs to mmap() their guest memory, so allow a path to be specified on the commandline and pass it to kvm__arch_init(). Signed-off-by: Matt Evans m...@ozlabs.org --- tools/kvm/builtin-run.c |4 +++- tools/kvm/include/kvm/kvm.h |4 ++--

[PATCH 22/28] kvm tools: Move PCI_MAX_DEVICES to pci.h

2011-12-05 Thread Matt Evans
Other pieces of kvmtool may be interested in PCI_MAX_DEVICES. Signed-off-by: Matt Evans m...@ozlabs.org --- tools/kvm/include/kvm/pci.h |1 + tools/kvm/pci.c |1 - 2 files changed, 1 insertions(+), 1 deletions(-) diff --git a/tools/kvm/include/kvm/pci.h

[PATCH 23/28] kvm tools: Endian-sanitise pci.h and PCI device setup

2011-12-05 Thread Matt Evans
vesa, pci-shmem and virtio-pci devices need to set up config space with little-endian conversions (as config space is LE). The pci_config_address bitfield also needs to be reversed when building on BE systems. Signed-off-by: Matt Evans m...@ozlabs.org --- tools/kvm/hw/pci-shmem.c | 23

[PATCH 24/28] kvm tools: Fix virtio-pci endian bug when reading VIRTIO_PCI_QUEUE_NUM

2011-12-05 Thread Matt Evans
The field size is currently wrong, read into a 32bit word instead of 16. This casues trouble when BE. Signed-off-by: Matt Evans m...@ozlabs.org --- tools/kvm/virtio/pci.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/tools/kvm/virtio/pci.c b/tools/kvm/virtio/pci.c

[PATCH 25/28] kvm tools: Correctly set virtio-pci bar_size and remove hardwired address

2011-12-05 Thread Matt Evans
The BAR addresses are set up fine, but missed the bar_size[] array which is now updated correspondingly. Use PCI_IO_SIZE instead of '0x100'. Signed-off-by: Matt Evans m...@ozlabs.org --- tools/kvm/virtio/pci.c |7 +-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git

[PATCH 26/28] kvm tools: Add pci__config_{rd,wr}(), pci__find_dev() and fix PCI config register addressing

2011-12-05 Thread Matt Evans
This allows config space access in a more natural manner than clunky x86 IO ports, and is useful for other architectures. Furthermore, the actual registers were only accessed in 32bit chunks; other systems (e.g. PPC) allow smaller accesses so that, for example, the 16-bit config field can be

[PATCH 27/28] kvm tools: Arch-specific define for PCI MMIO allocation area

2011-12-05 Thread Matt Evans
pci_get_io_space_block() used to grab addresses from KVM_32BIT_GAP_START + 0x100, 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 m...@ozlabs.org --- tools/kvm/pci.c |

KVM: PPC: booke: Improve timer register emulation breaks Book3s HV

2011-12-05 Thread Paul Mackerras
I'm not sure why yet, but commit 8a97c432 (KVM: PPC: booke: Improve timer register emulation) in Alex's kvm-ppc-next branch is breaking Book3S HV KVM on POWER7. Guest cpus fail to spin up, and even with just one cpu, the guest stalls every so often. If I stop the guest and inspect the state with

[PATCH 1/8] kvm tools: Add initial SPAPR PPC64 architecture support

2011-12-05 Thread Matt Evans
This patch adds a new arch directory, powerpc, basic file structure, register setup and where necessary stubs out arch-specific functions (e.g. interrupts, runloop exits) that later patches will provide. The target is an SPAPR-compliant PPC64 machine (i.e. pSeries); there is no support for PPC32

[PATCH 2/8] kvm tools: Generate SPAPR PPC64 guest device tree

2011-12-05 Thread Matt Evans
The generated DT is the bare minimum structure required for SPAPR (on which subsequent patches for VIO, XICS, PCI etc. will build); root node, cpus, memory. Some aspects are currently hardwired for simplicity, for example advertised page sizes, HPT size, SLB size, VMX/DFP, etc. Future support of

[PATCH 3/8] kvm tools: Add SPAPR PPC64 hcall rtascall structure

2011-12-05 Thread Matt Evans
This patch adds the basic structure for HV calls, their registration and some of the simpler calls. A similar layout for RTAS calls is also added, again with some of the simpler RTAS calls used by the guest. The SPAPR RTAS stub is generated inline. Also, nodes for RTAS are added to the device

[PATCH 5/8] kvm tools: Add PPC64 XICS interrupt controller support

2011-12-05 Thread Matt Evans
This patch adds XICS emulation code (heavily borrowed from QEMU), and wires this into kvm_cpu__irq() to fire a CPU IRQ via KVM. A device tree entry is also added. IPIs work, xics_alloc_irqnum() is added to allocate an external IRQ (which will later be used by the PHB PCI code) and finally,

[PATCH 6/8] kvm tools: Add PPC64 PCI Host Bridge

2011-12-05 Thread Matt Evans
This provides the PCI bridge, definitions for the address layout of the windows and wires in IRQs. Once PCI devices are all registered, they are enumerated and DT nodes generated for each. Signed-off-by: Matt Evans m...@ozlabs.org --- tools/kvm/powerpc/include/kvm/kvm-arch.h |3 +

[PATCH 8/8] kvm tools: Make virtio-pci's ioeventfd__add_event() fall back gracefully if ioeventfds unavailable

2011-12-05 Thread Matt Evans
PPC KVM doesn't yet support ioeventfds, so don't bomb out/die. virtio-pci is able to function if it instead uses normal IO port notification. Signed-off-by: Matt Evans m...@ozlabs.org --- tools/kvm/include/kvm/ioeventfd.h |3 ++- tools/kvm/ioeventfd.c | 12 +---

[PATCH] powerpc: Provide a way for KVM to indicate that NV GPR values are lost

2011-12-05 Thread Paul Mackerras
This fixes a problem where a CPU thread coming out of nap mode can think it has valid values in the nonvolatile GPRs (r14 - r31) as saved away in power7_idle, but in fact the values have been trashed because the thread was used for KVM in the mean time. The result is that the thread crashes

Re: [PATCH 00/28] kvm tools: Prepare kvmtool for another architecture

2011-12-05 Thread Matt Evans
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

[PATCH 11/13] KVM: Add barriers to allow mmu_notifier_retry to be used locklessly

2011-12-05 Thread Paul Mackerras
This adds an smp_wmb in kvm_mmu_notifier_invalidate_range_end() and an smp_rmb in mmu_notifier_retry() so that mmu_notifier_retry() will give the correct answer when called without kvm-mmu_lock being held. PowerPC Book3S HV KVM wants to use a bitlock per guest page rather than a single global

[PATCH 01/13] KVM: PPC: Move kvm_vcpu_ioctl_[gs]et_one_reg down to platform-specific code

2011-12-05 Thread Paul Mackerras
This moves the get/set_one_reg implementation down from powerpc.c into booke.c, book3s_pr.c and book3s_hv.c. This avoids #ifdefs in C code, but more importantly, it fixes a bug on Book3s HV where we were accessing beyond the end of the kvm_vcpu struct (via the to_book3s() macro) and corrupting

[PATCH 0/13] KVM: PPC: Update Book3S HV memory handling

2011-12-05 Thread Paul Mackerras
This series of patches updates the Book3S-HV KVM code that manages the guest hashed page table (HPT) to enable several things: * MMIO emulation and MMIO pass-through * Use of small pages (4kB or 64kB, depending on config) to back the guest memory * Pageable guest memory - i.e. backing pages

[PATCH 09/13] KVM: PPC: Maintain a doubly-linked list of guest HPTEs for each gfn

2011-12-05 Thread Paul Mackerras
This expands the reverse mapping array to contain two links for each HPTE which are used to link together HPTEs that correspond to the same guest logical page. Each circular list of HPTEs is pointed to by the rmap array entry for the guest logical page, pointed to by the relevant memslot. Links

[PATCH 06/13] KVM: PPC: Only get pages when actually needed, not in prepare_memory_region()

2011-12-05 Thread Paul Mackerras
This removes the code from kvmppc_core_prepare_memory_region() that looked up the VMA for the region being added and called hva_to_page to get the pfns for the memory. We have no guarantee that there will be anything mapped there at the time of the KVM_SET_USER_MEMORY_REGION ioctl call; userspace

[PATCH 03/13] KVM: PPC: Keep page physical addresses in per-slot arrays

2011-12-05 Thread Paul Mackerras
This allocates an array for each memory slot that is added to store the physical addresses of the pages in the slot. This array is vmalloc'd and accessed in kvmppc_h_enter using real_vmalloc_addr(). This allows us to remove the ram_pginfo field from the kvm_arch struct, and removes the 64GB guest

[PATCH 04/13] KVM: PPC: Add an interface for pinning guest pages in Book3s HV guests

2011-12-05 Thread Paul Mackerras
This adds two new functions, kvmppc_pin_guest_page() and kvmppc_unpin_guest_page(), and uses them to pin the guest pages where the guest has registered areas of memory for the hypervisor to update, (i.e. the per-cpu virtual processor areas, SLB shadow buffers and dispatch trace logs) and then

[PATCH 02/13] KVM: PPC: Keep a record of HV guest view of hashed page table entries

2011-12-05 Thread Paul Mackerras
This adds an array that parallels the guest hashed page table (HPT), that is, it has one entry per HPTE, used to store the guest's view of the second doubleword of the corresponding HPTE. The first doubleword in the HPTE is the same as the guest's idea of it, so we don't need to store a copy, but

[PATCH 05/13] KVM: PPC: Make the H_ENTER hcall more reliable

2011-12-05 Thread Paul Mackerras
At present, our implementation of H_ENTER only makes one try at locking each slot that it looks at, and doesn't even retry the ldarx/stdcx. atomic update sequence that it uses to attempt to lock the slot. Thus it can return the H_PTEG_FULL error unnecessarily, particularly when the H_EXACT flag

[PATCH 10/13] KVM: PPC: Implement MMIO emulation support for Book3S HV guests

2011-12-05 Thread Paul Mackerras
This provides the low-level support for MMIO emulation in Book3S HV guests. When the guest tries to map a page which is not covered by any memslot, that page is taken to be an MMIO emulation page. Instead of inserting a valid HPTE, we insert an HPTE that has the valid bit clear but another

[PATCH 08/13] KVM: PPC: Allow I/O mappings in memory slots

2011-12-05 Thread Paul Mackerras
This provides for the case where userspace maps an I/O device into the address range of a memory slot using a VM_PFNMAP mapping. In that case, we work out the pfn from vma-vm_pgoff, and record the cache enable bits from vma-vm_page_prot in two low-order bits in the slot_phys array entries. Then,

[PATCH 12/13] KVM: PPC: Implement MMU notifiers for Book3S HV guests

2011-12-05 Thread Paul Mackerras
This adds the infrastructure to enable us to page out pages underneath a Book3S HV guest, on processors that support virtualized partition memory, that is, POWER7. Instead of pinning all the guest's pages, we now look in the host userspace Linux page tables to find the mapping for a given guest

[PATCH 13/13] KVM: PPC: Allow for read-only pages backing a Book3S HV guest

2011-12-05 Thread Paul Mackerras
With this, if a guest does an H_ENTER with a read/write HPTE on a page which is currently read-only, we make the actual HPTE inserted be a read-only version of the HPTE. We now intercept protection faults as well as HPTE not found faults, and for a protection fault we work out whether it should

[PATCH 07/13] KVM: PPC: Allow use of small pages to back Book3S HV guests

2011-12-05 Thread Paul Mackerras
This relaxes the requirement that the guest memory be provided as 16MB huge pages, allowing it to be provided as normal memory, i.e. in pages of PAGE_SIZE bytes (4k or 64k). To allow this, we index the kvm-arch.slot_phys[] arrays with a small page index, even if huge pages are being used, and use