From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32974) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPnwv-0008CM-T5 for qemu-devel@nongnu.org; Wed, 20 Jul 2016 05:37:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPnwq-00006J-W7 for qemu-devel@nongnu.org; Wed, 20 Jul 2016 05:37:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36512) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPnwq-00006C-QX for qemu-devel@nongnu.org; Wed, 20 Jul 2016 05:37:48 -0400 References: <1468953778-15295-1-git-send-email-marcel@redhat.com> <20160720111604.1573d0b7.cornelia.huck@de.ibm.com> From: Marcel Apfelbaum Message-ID: <578F4668.4050402@redhat.com> Date: Wed, 20 Jul 2016 12:37:44 +0300 MIME-Version: 1.0 In-Reply-To: <20160720111604.1573d0b7.cornelia.huck@de.ibm.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH V2] hw/virtio-pci: fix virtio behaviour on modern (PCIe) machines List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cornelia Huck Cc: qemu-devel@nongnu.org, mst@redhat.com On 07/20/2016 12:16 PM, Cornelia Huck wrote: > On Tue, 19 Jul 2016 21:42:58 +0300 > Marcel Apfelbaum wrote: > >> Modern machines are expected to be used by newer setups with >> modern guests aiming the use of the latest features. >> >> Enable modern and disable legacy for virtio devices >> plugged into PCIe ports (Root ports or Downstream ports). >> Using the Virtio 1 mode will remove the limitation >> of the number of devices that can be attached to a machine >> by removing the need for the IO BAR. > Hi Cornelia, > Stupid question: Does this limitation show up for legacy and > transitional, but not for modern? > Yes, with PCIe we need to disable the IO Bars. Here is a short explanation: The root cause it the PCIe architecture being "point to point" rather than 'shared bus'. Each PCIe port supports only one device (multiple functions though) but is exposed as a PCI bridge. The firmware will assign a 4k IO window for each bridge if a device with IO BARs is attached to it. So the firmware will allocate a 4K IO range for each PCIe port -> for each device. Since the IO space is pretty limited we can support around 15 devices with IO BARs attached to PCIe ports. There are other ways to deal with the limitation like tweaking the firmware to assign a smaller IO window (no PCI compliant, but it should work) Looking only at the virtio scope, disabling legacy and enabling modern should be enough. > Would it make sense then to default to modern for PCIe and transitional > for non-PCIe? > Yes. this patch only does the first part (deals only with the PCIe limitation), but the next version will also include 'transitional' virtio as default for non PCIe slots. Thanks, Marcel > (The term "virtio-1" mode always confuses me a bit; this may be because > ccw unlike pci does not have modern-only devices - and even if we had, > basically the only difference would be that we'd disallow devices > without the VERSION_1 feature.) >