From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36382) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YREPs-0001l7-4M for qemu-devel@nongnu.org; Fri, 27 Feb 2015 01:28:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YREPo-0006N1-UU for qemu-devel@nongnu.org; Fri, 27 Feb 2015 01:28:52 -0500 Received: from mga01.intel.com ([192.55.52.88]:31110) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YREPo-0006Mv-Pe for qemu-devel@nongnu.org; Fri, 27 Feb 2015 01:28:48 -0500 Message-ID: <54F00E9C.5@intel.com> Date: Fri, 27 Feb 2015 14:28:44 +0800 From: "Chen, Tiejun" MIME-Version: 1.0 References: <1422839843-25622-1-git-send-email-tiejun.chen@intel.com> <20150202121940.GA28773@zion.uk.xensource.com> <21711.29549.892862.333392@mariner.uk.xensource.com> <54D01EAB.1020005@intel.com> <1422961628.9323.32.camel@citrix.com> <54D1770C.4020904@intel.com> <1423046493.17711.28.camel@citrix.com> <54D2C5E5.40407@intel.com> <1423129922.24924.46.camel@citrix.com> <54D41274.9090400@intel.com> <54D8537C.2080805@intel.com> <1423479910.23098.34.camel@citrix.com> <54DAC247.6080004@intel.com> <1424265750.27775.51.camel@citrix.com> <54EEBEBE.10108@intel.com> <1424967433.14641.96.camel@citrix.com> In-Reply-To: <1424967433.14641.96.camel@citrix.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [Xen-devel] [v2][PATCH] libxl: add one machine property to support IGD GFX passthrough List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ian Campbell Cc: Wei Liu , Ian Jackson , qemu-devel@nongnu.org, xen-devel@lists.xen.org, stefano.stabellini@citrix.com, kraxel@redhat.com On 2015/2/27 0:17, Ian Campbell wrote: > On Thu, 2015-02-26 at 14:35 +0800, Chen, Tiejun wrote: > >>> If we are going to do this then I think we need to arrange for the >>> interface to be able to express the need to force the workarounds for a >>> particular device. IOW a boolean will not suffice since it doesn't >>> indicate that IGD workarounds are needed. >>> >>> Probably it would be simplest to just leave this functionality out for >>> the time being and revisit if/when maintaining the list becomes an >>> annoyance or an end user trips over it. >>> >> >> You mean we should maintain one list to save all targeted devices, then >> tools uses ids as an index to lookup this list to pass something to qemu. > > I (think I) meant a list of pci vid:did in libxl, which is matched > against the devices passed to the domain (e.g. "pci = [...]" in xl cfg), > which then enables the igd workarounds, i.e. by passing the option to Yeah, this is exactly what I'm understanding. > qemu. > >> But actually one question that I have always been thinking about is, its >> really a responsibility of Xen to determine which device type should be >> passed by probing that pair of vendor and device ids? Xen is just one of >> so many approaches to qemu so such a rare workaround option can be >> passed actively by any user, instead of Xen. Furthermore, its becoming >> flexible as well to those cases we want to force overriding this. > > I'm not sure, but I think you are suggestion that qemu should autodetect > this situation, without being explicitly told "igd-passthru=on" on the > command line? > > If the qemu maintainers are amenable to that, and it's not already the > case that other components (e.g. hvmloader) need to be told about these > workarounds, then I suppose that would work. > >> So I think qemu should mainly plays this role. If qemu realizes we're >> passing through a IGD or other targeted device, it should post a warning >> or even error message to indicate what right behavior is needed, or what >> is that potential risk by default. > > Hrm, here it sounds more like you are suggesting that qemu should detect > and warn, rather than detect and do the right thing? > > I'm not sure how Qemu could indicate what the right behaviour is going > to be, it'll differ for different hypervisors or even for which Xen > toolstack (xl vs libvirt etc) is in use. > > Or maybe I've misunderstood? > IGD is a tricky case since Qemu has to construct a ISA bridge and host bridge before we pass IGD device. But we don't like to expose these two bridges unconditionally, and this is also why we need this option. Here I just mean when Qemu realizes IGD is passed through but without that appropriate option set, Qemu can post something to explicitly notify user that this option is needed in his case. But it may be a lazy idea. So now I think I'd better go back handling this on Xen side with your comments. As you said the Boolean doesn't suffice to indicate that IGD workarounds are needed. So I think we can reuse that existing bool 'gfx_passthru'. Firstly we can redefine this as string, - ("gfx_passthru", libxl_defbool), + ("gfx_passthru", string), Then + + if (libxl__is_igd_vga_passthru(gc, guest_config) || + (b_info->u.hvm.gfx_passthru && + strncmp(b_info->u.hvm.gfx_passthru, "igd", 3) == 0) ) { + machinearg = GCSPRINTF("%s,igd-passthru=on", machinearg); + } + Of course we need modify something else to align this change. Thanks Tiejun