From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=34925 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OGZlb-0001lf-3h for qemu-devel@nongnu.org; Mon, 24 May 2010 11:40:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OGZlZ-0003Ig-CD for qemu-devel@nongnu.org; Mon, 24 May 2010 11:40:34 -0400 Received: from 8bytes.org ([88.198.83.132]:54671) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OGZlZ-0003IN-55 for qemu-devel@nongnu.org; Mon, 24 May 2010 11:40:33 -0400 Date: Mon, 24 May 2010 17:40:30 +0200 From: Joerg Roedel Message-ID: <20100524154030.GE1237@8bytes.org> References: <1274363407-24862-1-git-send-email-eduard.munteanu@linux360.ro> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1274363407-24862-1-git-send-email-eduard.munteanu@linux360.ro> Subject: [Qemu-devel] Re: [RFC PATCH] AMD IOMMU emulation List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduard - Gabriel Munteanu Cc: aliguori@us.ibm.com, avi@redhat.com, kvm@vger.kernel.org, qemu-devel@nongnu.org Hi Eduard, On Thu, May 20, 2010 at 04:50:07PM +0300, Eduard - Gabriel Munteanu wrote: > + --enable-amd-iommu-emul) amd_iommu="yes" > + ;; A compile-time option is a good idea. > +/* MMIO registers */ > +#define MMIO_DEVICE_TABLE 0x0000 > +#define MMIO_COMMAND_BASE 0x0008 > +#define MMIO_EVENT_BASE 0x0010 > +#define MMIO_CONTROL 0x0018 > +#define MMIO_EXCL_BASE 0x0020 > +#define MMIO_EXCL_LIMIT 0x0028 > +#define MMIO_COMMAND_HEAD 0x2000 > +#define MMIO_COMMAND_TAIL 0x2008 > +#define MMIO_EVENT_HEAD 0x2010 > +#define MMIO_EVENT_TAIL 0x2018 > +#define MMIO_STATUS 0x2020 > + > +#define MMIO_SIZE 0x2028 This size should be a power-of-two value. In this case probably 0x4000. > +#define MMIO_DEVTAB_SIZE_MASK ((1UL << 12) - 1) > +#define MMIO_DEVTAB_BASE_MASK (((1UL << 52) - 1) & ~MMIO_DEVTAB_SIZE_MASK) You must use ULL to be 32bit safe. This is also true for the defines below. [...] Otherwise the code looks good so far. Seems like the next step should be some work on a qemu dma-layer where you can hook the translation into. Joerg