Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BF2A4C4708E for ; Tue, 3 Jan 2023 21:50:36 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.470769.730383 (Exim 4.92) (envelope-from ) id 1pCpAt-00031H-1D; Tue, 03 Jan 2023 21:50:23 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 470769.730383; Tue, 03 Jan 2023 21:50:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pCpAs-00031A-Up; Tue, 03 Jan 2023 21:50:22 +0000 Received: by outflank-mailman (input) for mailman id 470769; Tue, 03 Jan 2023 21:50:22 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pCpAr-000314-QI for xen-devel@lists.xenproject.org; Tue, 03 Jan 2023 21:50:22 +0000 Received: from sonic314-20.consmr.mail.gq1.yahoo.com (sonic314-20.consmr.mail.gq1.yahoo.com [98.137.69.83]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 9c5d08b8-8bb0-11ed-b8d0-410ff93cb8f0; Tue, 03 Jan 2023 22:50:18 +0100 (CET) Received: from sonic.gate.mail.ne1.yahoo.com by sonic314.consmr.mail.gq1.yahoo.com with HTTP; Tue, 3 Jan 2023 21:50:15 +0000 Received: by hermes--production-ne1-7b69748c4d-gv5kc (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 81c81d8f73da6f85953acc29cd3f8c46; Tue, 03 Jan 2023 21:50:11 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 9c5d08b8-8bb0-11ed-b8d0-410ff93cb8f0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1672782615; bh=MuT9WQEKaC6d5FTK4Spmmmji5WG4CNUMm8s9sH9M3Ko=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From:Subject:Reply-To; b=fZ9+7V+JUVWcviXErNxRBhy7rIrayNLgYtb2o+MyMD2fHbuRDCVfiWvQzSfYWfm41mRh5HU2GZgkYMTar+g3iJUKlGRiJx2mag5njYkyVWAYDeowegtR9gthrV8DbSomjSTQaSg+4vjn2D0ia6+XTUnXlPbxd7pv5zG6EAgT3awW0wAZz/0rzNc2eDDCr5PHxe8pV984CeU9GJEN9X2Y+Vftn/l2AzLWZGY74g2wZchKo2woUpKP+5Shx9leyB5uMI2hK0+GutgSBWWNeWPLzN+P5O9eiI7zK32SHX2ceXrVjiPOMIYgnBRrxiZKoVYd/eCA9zhakpxfE9YQgKKM8A== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1672782615; bh=fsWlUl+B0IEOHQXXH6HoSZbHVIhMRyVbJAlb1IU7XRr=; h=X-Sonic-MF:Date:Subject:To:From:From:Subject; b=YS6wTKRBBk9kNivnCoUIkmrdr8N+uvWDCZ43eCWLk0jpXMjwilt41nZVpGns/GRMnsmP3kRbVoH0u0BLDwL9PWcDOAbHvdBKqVNPwFUfc+rLby38rtEdc/Mi79wEwoRElc3fOxq0A/pXVVPdvBVXh9CwnCp7cOcWlKFArPBaoVV/D2P1oMDG+dk+zjGMORCJKbewxBEpFikkt0ceu0uX6NZAu1gLNVa9lpj6hPDaWOAnKXJOSWMKI5YaaqhXMMD6IZdgtunuTVCmc/nOzLeacEv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SNftlj2vgzmCVtPLhYo1s.KlbGHl X2EAu_BOdlw.3rE.SdMfRtcTLIiOrk8umNvQhGk2A1xriRpRnMCTsyPPkdcF.P2zQE02LoIU1xOT ozU6p4hmKxHp7ChXY9HXBsP9fH9oFLARfdNVVBizBdg6QHUiNUW2eVq4jKPn99HDu4uR6hCskX0f 0xH_sUVP2JNfUyqEZChU- X-Sonic-MF: Message-ID: Date: Tue, 3 Jan 2023 16:50:09 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH v6] xen/pt: reserve PCI slot 2 for Intel igd-passthru Content-Language: en-US To: qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" , Stefano Stabellini , Anthony Perard , Paul Durrant , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum , xen-devel@lists.xenproject.org References: <830263507e8f1a24a94f81909d5102c4b204e938.1672615492.git.brchuckz.ref@aol.com> <830263507e8f1a24a94f81909d5102c4b204e938.1672615492.git.brchuckz@aol.com> <20230102124605-mutt-send-email-mst@kernel.org> <20230103081456.1d676b8e.alex.williamson@redhat.com> From: Chuck Zmudzinski In-Reply-To: <20230103081456.1d676b8e.alex.williamson@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Mailer: WebService/1.1.20982 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol On 1/3/2023 10:14 AM, Alex Williamson wrote: > On Mon, 2 Jan 2023 18:10:24 -0500 > Chuck Zmudzinski wrote: > > > On 1/2/23 12:46 PM, Michael S. Tsirkin wrote: > > > On Sun, Jan 01, 2023 at 06:52:03PM -0500, Chuck Zmudzinski wrote: > > > > Intel specifies that the Intel IGD must occupy slot 2 on the PCI bus, > > > > as noted in docs/igd-assign.txt in the Qemu source code. > > > > ... > > > > Signed-off-by: Chuck Zmudzinski > > > > > > I'm not sure why is the issue xen specific. Can you explain? > > > Doesn't it affect kvm too? > > > > Recall from docs/igd-assign.txt that there are two modes for > > igd passthrough: legacy and upt, and the igd needs to be > > at slot 2 only when using legacy mode which gives one > > single guest exclusive access to the Intel igd. > > > > It's only xen specific insofar as xen does not have support > > for the upt mode so xen must use legacy mode which > > requires the igd to be at slot 2. I am not an expert with > > UPT mode never fully materialized for direct assignment, the folks at > Intel championing this scenario left. Thanks for clarifying that for me. > > > kvm, but if I understand correctly, with kvm one can use > > the upt mode with the Intel i915 kvmgt kernel module > > and in that case the guest will see a virtual Intel gpu > > that can be at any arbitrary slot when using kvmgt, and > > also, in that case, more than one guest can access the > > igd through the kvmgt kernel module. > > This is true, IIRC an Intel vGPU does not need to be in slot 2. > > > Again, I am not an expert and do not have as much > > experience with kvm, but if I understand correctly it is > > possible to use the legacy mode with kvm and I think you > > are correct that if one uses kvm in legacy mode and without > > using the Intel i915 kvmgt kernel module, then it would be > > necessary to reserve slot 2 for the igd on kvm. > > It's necessary to configure the assigned IGD at slot 2 to make it > functional, yes, but I don't really understand this notion of > "reserving" slot 2. If something occupies address 00:02.0 in the > config, it's the user's or management tool's responsibility to move it > to make this configuration functional. Why does QEMU need to play a > part in reserving this bus address. IGD devices are not generally > hot-pluggable either, so it doesn't seem we need to reserve an address > in case an IGD device is added dynamically later. As I said in earlier message in this thread, the xenlight toolstack (libxl) that is provided as the default toolstack for building xen guests with pci passthrough is not the most flexible management tool, and that is why, in the case of xen, it is simpler to reserve slot 2 while qemu assigns the slot addresses of the qemu emulated pci devices so that the igd can use slot 2. IIRC, In hw/pci/pci.c, once the slot value is assigned, it is constant and cannot be changed later on by a management tool. > > > Your question makes me curious, and I have not been able > > to determine if anyone has tried igd passthrough using > > legacy mode on kvm with recent versions of linux and qemu. > > Yes, it works. > > > I will try reproducing the problem on kvm in legacy mode with > > current versions of linux and qemu and report my findings. > > With kvm, there might be enough flexibility to specify the > > slot number for every pci device in the guest. Such a > > I think this is always the recommendation, libvirt will do this by > default in order to make sure the configuration is reproducible. This > is what we generally rely on for kvm/vfio IGD assignment to place the > GPU at the correct address. > > > capability is not available using the xenlight toolstack > > for managing xen guests, so I have been using this patch > > to ensure that the Intel igd is at slot 2 with xen guests > > created by the xenlight toolstack. > > Seems like a deficiency in xenlight. I'm not sure why QEMU should take > on this burden to support support tool stacks that lack such basic > features. So you would prefer to patch xenlight (libxl) to make it flexible enough to properly handle this case of legacy igd passthrough. > > > The patch as is will only fix the problem on xen, so if the > > problem exists on kvm also, I agree that the patch should > > be modified to also fix it on kvm. > > AFAICT, it's not a problem on kvm/vfio because we generally make use of > invocations that specify bus addresses for each device by default, > making this a configuration requirement for the user or management tool > stack. Thanks, Unfortunately, and as I mentioned in an earlier message on this thread, the xenlight management tool stack (libxl) is not so flexible and does not make it so easy for the administrator to specify the bus address of each device, and that is why either this patch is needed for igd legacy passtrhough on xen, or the libxl management tool needs to be patched so it is flexible enough to enable the slot addresses to be assigned correctly using that tool instead of relying on qemu to reserve slot 2 for the igd. If there is a consensus that this should be fixed in libxl instead of in qemu, I will work on a patch to libxl, but I will wait a while for some feedback from the xen people before I do that. Thanks for your feedback, Chuck