From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] libkvm-s390 Date: Sun, 13 Jul 2008 11:29:49 +0300 Message-ID: <4879BCFD.9030806@qumranet.com> References: <1215797386.6014.4.camel@cotte.boeblingen.de.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm , Olaf Schnapper , Christian Borntraeger , Hollis Blanchard To: Carsten Otte Return-path: Received: from il.qumranet.com ([212.179.150.194]:13148 "EHLO il.qumranet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751153AbYGMI3v (ORCPT ); Sun, 13 Jul 2008 04:29:51 -0400 In-Reply-To: <1215797386.6014.4.camel@cotte.boeblingen.de.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: Carsten Otte wrote: > This patch makes libkvm build and work on s390. It should be a noop for > all other architectures. > > Signed-off-by: Carsten Otte > --- > Index: kvm-userspace/libkvm/config-s390x.mak > =================================================================== > --- /dev/null > +++ kvm-userspace/libkvm/config-s390x.mak > @@ -0,0 +1,6 @@ > + > +LIBDIR := /lib > +CFLAGS += > +CFLAGS += -D__s390x__ > + > +libkvm-$(ARCH)-objs := libkvm-s390x.o > Index: kvm-userspace/libkvm/libkvm-s390x.c > =================================================================== > --- /dev/null > +++ kvm-userspace/libkvm/libkvm-s390x.c > @@ -0,0 +1,98 @@ > +/* > + * This header is for functions & variables that will ONLY be > + * used inside libkvm for s390x. > + * THESE ARE NOT EXPOSED TO THE USER AND ARE ONLY FOR USE > + * WITHIN LIBKVM. > + * > It isn't a header. > + * derived from libkvm-powerpc.c > + * > So it the comment above. So much for our review. > + * Copyright 2008 IBM Corporation > + * Authors: > + * Carsten Otte > + * > + * This work is licensed under the GNU LGPL license, version 2. > + */ > + > +#include "libkvm.h" > +#include > +#include > +#include > + > +int handle_dcr(struct kvm_run *run, kvm_context_t kvm, int vcpu) > +{ > + fprintf(stderr, "%s: Operation not supported\n", __FUNCTION__); > + return -1; > +} > + > +int kvm_alloc_kernel_memory(kvm_context_t kvm, unsigned long memory, > + void **vm_mem) > +{ > + fprintf(stderr, "%s: Operation not supported\n", __FUNCTION__); > + return -1; > +} > + > +void *kvm_create_kernel_phys_mem(kvm_context_t kvm, unsigned long phys_start, > + unsigned long len, int log, int writable) > +{ > + fprintf(stderr, "%s: Operation not supported\n", __FUNCTION__); > + return NULL; > +} > + > +void kvm_show_code(kvm_context_t kvm, int vcpu) > +{ > + fprintf(stderr, "%s: Operation not supported\n", __FUNCTION__); > +} > + > +void kvm_show_regs(kvm_context_t kvm, int vcpu) > +{ > + struct kvm_regs regs; > + int i; > + > + if (kvm_get_regs(kvm, vcpu, ®s)) > + return; > + /* > + fprintf(stderr,"guest vcpu #%d\n", vcpu); > + fprintf(stderr,"pc: %016"PRIx64" msr: %016"PRIx64"\n", > + regs.pc, regs.msr); > + fprintf(stderr,"lr: %016"PRIx64" ctr: %016"PRIx64"\n", > + regs.lr, regs.ctr); > + fprintf(stderr,"srr0: %016"PRIx64" srr1: %016"PRIx64"\n", > + regs.srr0, regs.srr1); > + for (i=0; i<32; i+=4) > + { > + fprintf(stderr, "gpr%02d: %016"PRIx64" %016"PRIx64" %016"PRIx64 > + " %016"PRIx64"\n", i, > + regs.gpr[i], > + regs.gpr[i+1], > + regs.gpr[i+2], > + regs.gpr[i+3]); > + } > + > + fflush(stdout); > + */ > +} > + > +int kvm_arch_create(kvm_context_t kvm, unsigned long phys_mem_bytes, > + void **vm_mem) > +{ > + return 0; > +} > + > +int kvm_arch_create_default_phys_mem(kvm_context_t kvm, > + unsigned long phys_mem_bytes, > + void **vm_mem) > +{ > + return 0; > +} > + > +int kvm_arch_run(struct kvm_run *run, kvm_context_t kvm, int vcpu) > +{ > + int ret = 0; > + > + switch (run->exit_reason){ > + default: > + ret = 1; > + break; > + } > + return ret; > +} > Index: kvm-userspace/Makefile > =================================================================== > --- kvm-userspace.orig/Makefile > +++ kvm-userspace/Makefile > @@ -5,7 +5,7 @@ DESTDIR= > > rpmrelease = devel > > -sane-arch = $(subst i386,x86,$(subst x86_64,x86,$(ARCH))) > +sane-arch = $(subst i386,x86,$(subst x86_64,x86,$(subst s390x,s390,$(ARCH)))) > > .PHONY: kernel user libkvm qemu bios vgabios extboot clean libfdt > > Index: kvm-userspace/libkvm/kvm-common.h > =================================================================== > --- kvm-userspace.orig/libkvm/kvm-common.h > +++ kvm-userspace/libkvm/kvm-common.h > @@ -18,8 +18,15 @@ > > /* FIXME: share this number with kvm */ > /* FIXME: or dynamically alloc/realloc regions */ > +#ifndef __s390x__ > #define KVM_MAX_NUM_MEM_REGIONS 8u > +#define MAX_VCPUS 64 > 16 > +#else > +#define KVM_MAX_NUM_MEM_REGIONS 1u > #define MAX_VCPUS 16 > 64 > +#define LIBKVM_S390_ORIGIN (0UL) > Thought you got rid of that? -- error compiling committee.c: too many arguments to function