All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: Gregory Haskins <ghaskins-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH 5/5] KVM: Add support for in-kernel LAPIC model
Date: Sun, 22 Apr 2007 12:04:14 +0300	[thread overview]
Message-ID: <462B250E.6050603@qumranet.com> (raw)
In-Reply-To: <20070420030931.12408.88158.stgit-5CR4LY5GPkvLDviKLk5550HKjMygAv58XqFh9Ls21Oc@public.gmane.org>

Gregory Haskins wrote:
> Signed-off-by: Gregory Haskins <ghaskins-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
> ---
>
>  drivers/kvm/Makefile   |    2 
>  drivers/kvm/kernint.c  |  168 +++++
>  drivers/kvm/kvm.h      |   14 
>  drivers/kvm/kvm_main.c |  142 +++++
>  drivers/kvm/lapic.c    | 1472 ++++++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/kvm.h    |   16 -
>  6 files changed, 1808 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/kvm/Makefile b/drivers/kvm/Makefile
> index 540afbc..1aad737 100644
> --- a/drivers/kvm/Makefile
> +++ b/drivers/kvm/Makefile
> @@ -2,7 +2,7 @@
>  # Makefile for Kernel-based Virtual Machine module
>  #
>  
> -kvm-objs := kvm_main.o mmu.o x86_emulate.o userint.o
> +kvm-objs := kvm_main.o mmu.o x86_emulate.o userint.o lapic.o kernint.o
>  obj-$(CONFIG_KVM) += kvm.o
>  kvm-intel-objs = vmx.o
>  obj-$(CONFIG_KVM_INTEL) += kvm-intel.o
> diff --git a/drivers/kvm/kernint.c b/drivers/kvm/kernint.c
> new file mode 100644
> index 0000000..979a4aa
> --- /dev/null
> +++ b/drivers/kvm/kernint.c
> @@ -0,0 +1,168 @@
> +/*
> + * Kernel Interrupt IRQ device
> + *
> + * Provides a model for connecting in-kernel interrupt resources to a VCPU.
> + * 
> + * A typical modern x86 processor has the concept of an internal Local-APIC 
> + * and some external signal pins.  The way in which interrupts are injected is
> + * dependent on whether software enables the LAPIC or not.  When enabled,
> + * interrupts are acknowledged through the LAPIC.  Otherwise they are through
> + * an externally connected PIC (typically an i8259 on the BSP)  
> + *
> + * Copyright (C) 2007 Novell
> + *
> + * Authors:
> + *   Gregory Haskins <ghaskins-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2.  See
> + * the COPYING file in the top-level directory.
> + *
> + */
> +
> +#include "kvm.h"
> +
> +extern int kvm_kern_lapic_init(struct kvm_vcpu *vcpu, 
> +			       struct kvm_irqdevice *irq_dev);
> +struct kvm_kernint {
> +	spinlock_t                    lock;
> +	atomic_t                      ref_count;
> +	struct kvm_vcpu              *vcpu;
> +	struct kvm_irqdevice         *self_irq;
> +	struct kvm_irqdevice         *ext_irq;
> +	struct kvm_irqdevice          apic_irq;
> +	struct kvm_lapic             *apic_dev;
> +
> +};
>   

This is nice.  I don't think a ref count is really necessary though, as 
the configuration is fairly static.

>  struct kvm_stat {
> @@ -570,6 +574,9 @@ extern struct kvm_arch_ops *kvm_arch_ops;
>  int kvm_init_arch(struct kvm_arch_ops *ops, struct module *module);
>  void kvm_exit_arch(void);
>  
> +int kvm_apicbus_send(struct kvm *kvm, int dest, int trig_mode, int level, 
> +		     int dest_mode, int delivery_mode, int vector);
> +
>   

Pack'em into a struct?


[... actual lapic code ...]

>  struct kvm_cpuid_entry {
>  	__u32 function;
>  	__u32 eax;
> @@ -284,6 +295,9 @@ struct kvm_signal_mask {
>  #define KVM_CREATE_VCPU           _IO(KVMIO,  0x41)
>  #define KVM_GET_DIRTY_LOG         _IOW(KVMIO, 0x42, struct kvm_dirty_log)
>  #define KVM_SET_MEMORY_ALIAS      _IOW(KVMIO, 0x43, struct kvm_memory_alias)
> +#define KVM_ENABLE_KERNEL_PIC     _IOW(KVMIO, 0x44, __u32)
> +#define KVM_ISA_INTERRUPT         _IOW(KVMIO, 0x45, struct kvm_interrupt)
> +#define KVM_APIC_MSG		  _IOW(KVMIO, 0x46, struct kvm_apic_msg)
>  
>  /*
>   * ioctls for vcpu fds
> @@ -302,5 +316,5 @@ struct kvm_signal_mask {
>  #define KVM_SET_SIGNAL_MASK       _IOW(KVMIO,  0x8b, struct kvm_signal_mask)
>  #define KVM_GET_FPU               _IOR(KVMIO,  0x8c, struct kvm_fpu)
>  #define KVM_SET_FPU               _IOW(KVMIO,  0x8d, struct kvm_fpu)
> -
> +#define KVM_APIC_RESET		  _IO(KVMIO,   0x8e)
>  #endif
>
>   

You need to advertise the lapic ioctls via KVM_CHECK_EXTENSION.

Overall looks good.

-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

  parent reply	other threads:[~2007-04-22  9:04 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-20  3:09 KVM: Patch series for in-kernel APIC support Gregory Haskins
     [not found] ` <20070420030905.12408.40403.stgit-5CR4LY5GPkvLDviKLk5550HKjMygAv58XqFh9Ls21Oc@public.gmane.org>
2007-04-20  3:09   ` [PATCH 1/5] Adds support for in-kernel mmio handlers Gregory Haskins
2007-04-20  3:09   ` [PATCH 2/5] KVM: Add irqdevice object Gregory Haskins
     [not found]     ` <20070420030916.12408.80159.stgit-5CR4LY5GPkvLDviKLk5550HKjMygAv58XqFh9Ls21Oc@public.gmane.org>
2007-04-22  8:42       ` Avi Kivity
     [not found]         ` <462B1FD8.4080004-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-04-23 13:58           ` Gregory Haskins
     [not found]             ` <462C8333.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-04-24  9:09               ` Avi Kivity
     [not found]                 ` <462DC954.1020400-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-04-26 14:37                   ` Gregory Haskins
     [not found]                     ` <463080C8.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-04-26 16:26                       ` Avi Kivity
2007-04-20  3:09   ` [PATCH 3/5] KVM: Adds ability to preepmt an executing VCPU Gregory Haskins
     [not found]     ` <20070420030921.12408.97321.stgit-5CR4LY5GPkvLDviKLk5550HKjMygAv58XqFh9Ls21Oc@public.gmane.org>
2007-04-22  8:50       ` Avi Kivity
     [not found]         ` <462B21C7.2060007-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-04-23 15:42           ` Gregory Haskins
     [not found]             ` <462C9B94.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-04-24  9:17               ` Avi Kivity
     [not found]                 ` <462DCB3E.6070802-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-04-26 14:40                   ` Gregory Haskins
2007-04-20  3:09   ` [PATCH 4/5] KVM: Local-APIC interface cleanup Gregory Haskins
     [not found]     ` <20070420030926.12408.27637.stgit-5CR4LY5GPkvLDviKLk5550HKjMygAv58XqFh9Ls21Oc@public.gmane.org>
2007-04-22  8:54       ` Avi Kivity
     [not found]         ` <462B22AE.4090108-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-04-23 15:55           ` Gregory Haskins
     [not found]             ` <462C9EAE.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-04-24  9:26               ` Avi Kivity
     [not found]                 ` <462DCD31.4030108-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-04-26 14:43                   ` Gregory Haskins
2007-04-20  3:09   ` [PATCH 5/5] KVM: Add support for in-kernel LAPIC model Gregory Haskins
     [not found]     ` <20070420030931.12408.88158.stgit-5CR4LY5GPkvLDviKLk5550HKjMygAv58XqFh9Ls21Oc@public.gmane.org>
2007-04-22  9:04       ` Avi Kivity [this message]
     [not found]         ` <462B250E.6050603-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-04-23 15:57           ` Gregory Haskins
2007-04-22  9:06   ` KVM: Patch series for in-kernel APIC support Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=462B250E.6050603@qumranet.com \
    --to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
    --cc=ghaskins-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.