aboutsummaryrefslogtreecommitdiff
path: root/target-ppc/kvm.c
diff options
context:
space:
mode:
authorAlexey Kardashevskiy <aik@ozlabs.ru>2014-07-11 01:03:41 +1000
committerAlexander Graf <agraf@suse.de>2014-07-15 16:11:59 +0200
commit658fa66b8192e4b755880609f2845aef9797d048 (patch)
treee0b6828a7b60a1ab3da592fed1103bc0e4a0d04b /target-ppc/kvm.c
parente938ba0c35b0a6732a380b712b0f19511375a6a4 (diff)
spapr: Move RMA memory region registration code
PPC970 does not support VRMA (virtual RMA) so real memory required for SLOF to execute must be allocated by the KVM_ALLOCATE_RMA ioctl. Later this memory is used as a part of the guest RAM area. The RMA allocating code also registers a memory region for this piece of RAM. We are going to simplify memory regions layout: RMA memory region will be a subregion in the RAM memory region, both starting from zero. This way we will not have to take care of start address alignment for the piece of RAM next to the RMA. This moves memory region business closer to the RAM memory region creation/allocation code. As this is a mechanical patch, no change in behaviour is expected. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> [agraf: fix compilation on non-kvm systems] Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'target-ppc/kvm.c')
-rw-r--r--target-ppc/kvm.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 2d87108d8b..42718f77ae 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -1580,13 +1580,11 @@ int kvmppc_smt_threads(void)
}
#ifdef TARGET_PPC64
-off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem)
+off_t kvmppc_alloc_rma(void **rma)
{
- void *rma;
off_t size;
int fd;
struct kvm_allocate_rma ret;
- MemoryRegion *rma_region;
/* If cap_ppc_rma == 0, contiguous RMA allocation is not supported
* if cap_ppc_rma == 1, contiguous RMA allocation is supported, but
@@ -1609,17 +1607,12 @@ off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem)
size = MIN(ret.rma_size, 256ul << 20);
- rma = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
- if (rma == MAP_FAILED) {
+ *rma = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
+ if (*rma == MAP_FAILED) {
fprintf(stderr, "KVM: Error mapping RMA: %s\n", strerror(errno));
return -1;
};
- rma_region = g_new(MemoryRegion, 1);
- memory_region_init_ram_ptr(rma_region, NULL, name, size, rma);
- vmstate_register_ram_global(rma_region);
- memory_region_add_subregion(sysmem, 0, rma_region);
-
return size;
}