From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=50664 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OmJqL-0001IA-IT for qemu-devel@nongnu.org; Fri, 20 Aug 2010 01:08:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OmJnW-0006zO-5C for qemu-devel@nongnu.org; Fri, 20 Aug 2010 01:05:50 -0400 Received: from mail.valinux.co.jp ([210.128.90.3]:44380) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmJnV-0006z4-JI for qemu-devel@nongnu.org; Fri, 20 Aug 2010 01:05:46 -0400 Date: Fri, 20 Aug 2010 14:15:05 +0900 From: Isaku Yamahata Subject: Re: [Qemu-devel] Template for developing a Qemu device with PCIe?and MSI-X Message-ID: <20100820051505.GC31720@valinux.co.jp> References: <20100819170140.10dc216a@shadowfax.no-ip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100819170140.10dc216a@shadowfax.no-ip.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Adnan Khaleel Cc: qemu-devel@nongnu.org On Thu, Aug 19, 2010 at 12:01:40PM -0500, Adnan Khaleel wrote: > Hi Isaku, thank you very much for your very detailed response. I have a few > questions, see below. > > Thanks again, > > Adnan > > > Qemu doesn't support pcie at the moment. > Only partial patches have been merged, still more patches have to > be merged for pcie to fully work. The following repo is available. > > git clone http://people.valinux.co.jp/~yamahata/qemu/q35/qemu > git clone http://people.valinux.co.jp/~yamahata/qemu/q35/seabios > git clone http://people.valinux.co.jp/~yamahata/qemu/q35/vgabios > > Note: patched seabios and vgabios are needed, you have to pass ACPI DSDT > for q35. > example: > qemu-system-x86_64 -M pc_q35 -acpitable load_header,data=roms/seabios/src/ > q35-acpi-dsdt.aml > > This repo is for those who want to try/develop pcie support, > not for upstream merge. So they include patches unsuitable for upstream. > > I'm looking at Qemu 0.12.3 and there are 2 files, pci_host.c and pcie_host.c. > Can you explain what these do? They are for configuration space. pci_host.c abstracts the emulation of indirect access to configuration space. On PC, ioport 0xcf8 and 0xcfc. pcie_host abtracts the emulation of access to MMCONFIG space. There is no user at the moment, though. > Also, I see virtio_pci.c is the only device that uses msi-x in qemu. Can you > explain what device this is trying to emulate? virtio is a paravirtual IO framework for kvm. There is no corresponding real hardware. > Also, will the support for PCIe be merged with the mail Qemu at some point? I've been trying it. Your help will be appreciated. > The repo includes pcie port switch emulator which utilize pcie and > MSI(not MSI-X). > > I guess I could use this as a template for my qemu device mode correct? Half yes. You need to be aware that port switch is pci-to-pci bridge which is slightly different from normal pci/pcie device. There is no emulator of pcie normal device at the moment. > The difference between PCI device and PCIe device is configuration > space size. > By setting PCIDeviceInfo::is_express = 1, you'll get 4K configuration > space. Helper functions for pcie are found in qemu/hw/pcie.c > For msi-x, see qemu/hw/msix.c. > > One last question, does the current implementation allow for 64bit BAR > addresses? Yes. 64bit BAR emulation was alread merged. seabios is also ready for it. -- yamahata