From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH 03/12] Switch build system to accompanied kernel headers Date: Tue, 14 Jun 2011 13:32:40 +0200 Message-ID: <4DF746D8.1040106@siemens.com> References: <4DF74444.1050007@siemens.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Avi Kivity , Marcelo Tosatti , "kvm@vger.kernel.org" , "qemu-devel@nongnu.org" To: Alexander Graf Return-path: Received: from david.siemens.de ([192.35.17.14]:24013 "EHLO david.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756236Ab1FNLcu (ORCPT ); Tue, 14 Jun 2011 07:32:50 -0400 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On 2011-06-14 13:28, Alexander Graf wrote: > > On 14.06.2011, at 13:21, Jan Kiszka wrote: > >> On 2011-06-14 13:11, Alexander Graf wrote: >>> >>> On 08.06.2011, at 16:10, Jan Kiszka wrote: >>> >>> This helps reducing our build-time checks for feature support in the >>> available Linux kernel headers. And it helps users that do not have >>> sufficiently recent headers installed on their build machine. >>> >>> Consequently, the patch removes and build-time checks for kvm and vhost >>> in configure, the --kerneldir switch, and KVM_CFLAGS. Kernel headers are >>> supposed to be provided by QEMU only. >>> >>> s390 needs some extra love as it carries redefinitions from kernel >>> headers. >>> >>> Yes. I was wondering if we should unconditionally include the kernel headers there. The problem I'm seeing there is that I don't know if that would work fine on non-Linux hosts, as that code definitely gets compiled there, while KVM code is not. >>> >>> >>> >>> [...] >>> >>> diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h >>> index 4e5c391..b5e587f 100644 >>> --- a/target-s390x/cpu.h >>> +++ b/target-s390x/cpu.h >>> @@ -313,16 +313,6 @@ CPUState *s390_cpu_addr2state(uint16_t cpu_addr); >>> /* from s390-virtio-bus */ >>> extern const target_phys_addr_t virtio_size; >>> >>> -#ifndef KVM_S390_SIGP_STOP >>> -#define KVM_S390_SIGP_STOP 0 >>> -#define KVM_S390_PROGRAM_INT 0 >>> -#define KVM_S390_SIGP_SET_PREFIX 0 >>> -#define KVM_S390_RESTART 0 >>> -#define KVM_S390_INT_VIRTIO 0 >>> -#define KVM_S390_INT_SERVICE 0 >>> -#define KVM_S390_INT_EMERGENCY 0 >>> -#endif >>> - >>> #endif >>> void cpu_lock(void); >>> void cpu_unlock(void); >>> diff --git a/target-s390x/op_helper.c b/target-s390x/op_helper.c >>> index db03a79..9429698 100644 >>> --- a/target-s390x/op_helper.c >>> +++ b/target-s390x/op_helper.c >>> @@ -23,6 +23,7 @@ >>> #include "helpers.h" >>> #include >>> #include "kvm.h" >>> +#include >>> >>> Have you tried to compile this on non-Linux? >> >> Sorry, I don't have "non-Linux" around. :) Do you expect build problems >> with that header? Why? > > Do you have a git tree handy? I can give a Mac build a try then. Try git://git.kiszka.org/qemu-kvm.git queues/kvm-upstream > >> BTW, if you depend on KVM_* constants for non-KVM builds, that looks a >> bit fishy to me. Why is that code built at all in that setup? > > The reason for that is that I didn't want to clutter the emulation code with #ifdefs: > > static void program_interrupt(CPUState *env, uint32_t code, int ilc) > { > qemu_log("program interrupt at %#" PRIx64 "\n", env->psw.addr); > > if (kvm_enabled()) { > kvm_s390_interrupt(env, KVM_S390_PROGRAM_INT, code); > } else { > env->int_pgm_code = code; > env->int_pgm_ilc = ilc; > env->exception_index = EXCP_PGM; > cpu_loop_exit(); > } > } > > This breaks compilation when KVM_S390_PROGRAM_INT is not defined. I'm very open to suggestions on how to improve this though :). Callbacks? See cpu_interrupt_handler e.g. Jan -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:60341) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWRrT-0005pE-Mt for qemu-devel@nongnu.org; Tue, 14 Jun 2011 07:32:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QWRrR-0000Nk-Ib for qemu-devel@nongnu.org; Tue, 14 Jun 2011 07:32:47 -0400 Received: from david.siemens.de ([192.35.17.14]:18916) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWRrQ-0000Mt-Vo for qemu-devel@nongnu.org; Tue, 14 Jun 2011 07:32:45 -0400 Message-ID: <4DF746D8.1040106@siemens.com> Date: Tue, 14 Jun 2011 13:32:40 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <4DF74444.1050007@siemens.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 03/12] Switch build system to accompanied kernel headers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: Marcelo Tosatti , Avi Kivity , "kvm@vger.kernel.org" , "qemu-devel@nongnu.org" On 2011-06-14 13:28, Alexander Graf wrote: > > On 14.06.2011, at 13:21, Jan Kiszka wrote: > >> On 2011-06-14 13:11, Alexander Graf wrote: >>> >>> On 08.06.2011, at 16:10, Jan Kiszka wrote: >>> >>> This helps reducing our build-time checks for feature support in the >>> available Linux kernel headers. And it helps users that do not have >>> sufficiently recent headers installed on their build machine. >>> >>> Consequently, the patch removes and build-time checks for kvm and vhost >>> in configure, the --kerneldir switch, and KVM_CFLAGS. Kernel headers are >>> supposed to be provided by QEMU only. >>> >>> s390 needs some extra love as it carries redefinitions from kernel >>> headers. >>> >>> Yes. I was wondering if we should unconditionally include the kernel headers there. The problem I'm seeing there is that I don't know if that would work fine on non-Linux hosts, as that code definitely gets compiled there, while KVM code is not. >>> >>> >>> >>> [...] >>> >>> diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h >>> index 4e5c391..b5e587f 100644 >>> --- a/target-s390x/cpu.h >>> +++ b/target-s390x/cpu.h >>> @@ -313,16 +313,6 @@ CPUState *s390_cpu_addr2state(uint16_t cpu_addr); >>> /* from s390-virtio-bus */ >>> extern const target_phys_addr_t virtio_size; >>> >>> -#ifndef KVM_S390_SIGP_STOP >>> -#define KVM_S390_SIGP_STOP 0 >>> -#define KVM_S390_PROGRAM_INT 0 >>> -#define KVM_S390_SIGP_SET_PREFIX 0 >>> -#define KVM_S390_RESTART 0 >>> -#define KVM_S390_INT_VIRTIO 0 >>> -#define KVM_S390_INT_SERVICE 0 >>> -#define KVM_S390_INT_EMERGENCY 0 >>> -#endif >>> - >>> #endif >>> void cpu_lock(void); >>> void cpu_unlock(void); >>> diff --git a/target-s390x/op_helper.c b/target-s390x/op_helper.c >>> index db03a79..9429698 100644 >>> --- a/target-s390x/op_helper.c >>> +++ b/target-s390x/op_helper.c >>> @@ -23,6 +23,7 @@ >>> #include "helpers.h" >>> #include >>> #include "kvm.h" >>> +#include >>> >>> Have you tried to compile this on non-Linux? >> >> Sorry, I don't have "non-Linux" around. :) Do you expect build problems >> with that header? Why? > > Do you have a git tree handy? I can give a Mac build a try then. Try git://git.kiszka.org/qemu-kvm.git queues/kvm-upstream > >> BTW, if you depend on KVM_* constants for non-KVM builds, that looks a >> bit fishy to me. Why is that code built at all in that setup? > > The reason for that is that I didn't want to clutter the emulation code with #ifdefs: > > static void program_interrupt(CPUState *env, uint32_t code, int ilc) > { > qemu_log("program interrupt at %#" PRIx64 "\n", env->psw.addr); > > if (kvm_enabled()) { > kvm_s390_interrupt(env, KVM_S390_PROGRAM_INT, code); > } else { > env->int_pgm_code = code; > env->int_pgm_ilc = ilc; > env->exception_index = EXCP_PGM; > cpu_loop_exit(); > } > } > > This breaks compilation when KVM_S390_PROGRAM_INT is not defined. I'm very open to suggestions on how to improve this though :). Callbacks? See cpu_interrupt_handler e.g. Jan -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux