From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ingo Molnar Subject: Re: [PATCH 2/2] kvm tools: Add MMIO address mapper Date: Tue, 17 May 2011 09:42:33 +0200 Message-ID: <20110517074233.GH22305@elte.hu> References: <1305615515-13913-1-git-send-email-levinsasha928@gmail.com> <1305615515-13913-2-git-send-email-levinsasha928@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: penberg@kernel.org, asias.hejun@gmail.com, prasadjoshi124@gmail.com, gorcunov@gmail.com, kvm@vger.kernel.org, john@jfloren.net To: Sasha Levin Return-path: Received: from mx2.mail.elte.hu ([157.181.151.9]:49134 "EHLO mx2.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752687Ab1EQHmm (ORCPT ); Tue, 17 May 2011 03:42:42 -0400 Content-Disposition: inline In-Reply-To: <1305615515-13913-2-git-send-email-levinsasha928@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: * Sasha Levin wrote: > When we have a MMIO exit, we need to find which device > has registered to use the accessed MMIO space. > > The mapper maps ranges of guest physical addresses to > callback functions. > > Implementation is based on an interval red-black tree. > > Signed-off-by: Sasha Levin > --- > tools/kvm/include/kvm/kvm.h | 2 + > tools/kvm/mmio.c | 79 +++++++++++++++++++++++++++++++++++++++++- > 2 files changed, 79 insertions(+), 2 deletions(-) > > diff --git a/tools/kvm/include/kvm/kvm.h b/tools/kvm/include/kvm/kvm.h > index b310d50..d9943bf 100644 > --- a/tools/kvm/include/kvm/kvm.h > +++ b/tools/kvm/include/kvm/kvm.h > @@ -44,6 +44,8 @@ void kvm__stop_timer(struct kvm *kvm); > void kvm__irq_line(struct kvm *kvm, int irq, int level); > bool kvm__emulate_io(struct kvm *kvm, u16 port, void *data, int direction, int size, u32 count); > bool kvm__emulate_mmio(struct kvm *kvm, u64 phys_addr, u8 *data, u32 len, u8 is_write); > +bool kvm__register_mmio(u64 phys_addr, u64 phys_addr_len, void (*kvm_mmio_callback_fn)(u64 addr, u8 *data, u32 len, u8 is_write)); > +bool kvm__deregister_mmio(u64 phys_addr); > > /* > * Debugging > diff --git a/tools/kvm/mmio.c b/tools/kvm/mmio.c > index 848267d..fab6489 100644 > --- a/tools/kvm/mmio.c > +++ b/tools/kvm/mmio.c > @@ -1,7 +1,48 @@ > #include "kvm/kvm.h" > +#include "kvm/interval-rbtree.h" > > #include > +#include > + > #include > +#include > + > +#define MMIO_NODE(n) container_of(n, struct mmio_mapping, node) Please make this lowercase, mmio_node() or mmio_entry(). Other than that: Acked-by: Ingo Molnar Thanks, Ingo