[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] xen/pt: Avoid initializing BARs from the host ones


  • To: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Mon, 9 May 2022 13:23:44 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VffK7Rx0PzdI8/ZOYnCDg0VcwYzuxbAC5a3rXo9jS8E=; b=gWqszc9NQ7Yrj/8FH6R+ToefXaCEtAp/Dm6DiO3t1jb+mdfqXOiqyAPbhNeO1QkrpMsuOeLOMsYxOdsIsc+53p894UIVDuDHjQIye+tmA/yuhGeoKDWSOgVYfd3EkF5FMJREOCC5XkM841P5PYhfH4jZcxkPqYGAp4WSIES+RP5DhZIOmPcfkeZ4Dd789FBKn2refpNqizBeMsagJKvmnZD9IhzvRxSDmaqXMA/Z54tX/ffb8BWkc1ijUlbTf4lB/NDqxZFrTJbsqDi0qYGosaayy4XYT/Y/651eJc2NgjTo6Qd868xugZpNRxAsKn2WXTobzLN65DNBi48YPAWZ6g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hDhtDFtvtCntXY50n+O6h0RqxcYerV8+MP2fn/i9reVVCjN9A4YkVr0TOQ/x8f0+L7ABvz5CcgDx/KTNm13p1J/upjnrcKYG2z4DEcrJgWCGK3W74MHGAW35HLktF39gkYjB+rDVQ0zajepqvlVHUhffi4CnY+kMIXpalopX/sR7QeGHI0ODNukVghnj/ZIctThaUtoW6gDQiN4mDdO+djpkPLRkn7l2kc3N2uZ6/j+x6dvAHTLSUiofQ2LNaOm3CxVUKPawMQ7xDTfB2Hsfz5cigD4zVIwwWoSFtFrJWqa88o28t96FW8/JKBwZxPZSYzQKAgOI5l6wGSQ4ZHdDVg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, "qemu-devel@xxxxxxxxxx" <qemu-devel@xxxxxxxxxx>
  • Delivery-date: Mon, 09 May 2022 11:24:18 +0000
  • Ironport-data: A9a23:CQom3asC+0hDRaIkDdf2Z2hywOfnVFxfMUV32f8akzHdYApBsoF/q tZmKTuCO/7YZGD3eIhza9nj8kgH68XWndVmSFZp+C08Qn9H+JbJXdiXEBz9bniYRiHhoOOLz Cm8hv3odp1coqr0/0/1WlTZhSAgk/nOHNIQMcacUsxLbVYMpBwJ1FQywobVvqYy2YLjW17V6 IuryyHiEATNNwBcYzp8B52r8HuDjNyq0N/PlgVjDRzjlAa2e0g9VPrzF4noR5fLatA88tqBb /TC1NmEElbxpH/BPD8HfoHTKSXmSpaKVeSHZ+E/t6KK2nCurQRquko32WZ1he66RFxlkvgoo Oihu6BcRi8yJ6rWxsgAViVGUAV+NOpGv7DcJnag5Jn7I03uKxMAwt1IJWRvZMgz3b8yBmtDs /sFNDoKcxaPwfqsx662QfVtgcJlK9T3OIQYuTdryjSx4fQOGMifBfmVo4IGmm5v2KiiHt6HD yYdQSBoYxnaJQVGJ38cCY4knffujX76G9FdgA3O/vRuuDSLpOB3+Oi8d96FJdiJfPdIrEuSn FPi1T3lXChPYbRzzhLAqBpAnNTnjS79HY4fCrC83vprm0GIgHweDgUMUlm2quX/jVSxM/pEM FAd8Ccqqak09WSoQ8P7Uhn+p2SL1jYEUsdUO/037keK0KW8yx+UA3VBQjNfZdgOssgwSjo3k FiTkLvU6SdHtbSUTTeW8e6SpDbrYCwNdzZdO2kDUBcP5MTlrMcrlBXTQ91/EamzyNroBTX3x DPMpy8771kOsfM2O2yA1Qivq1qRSlLhEGbZOi2/srqZ0z5E
  • Ironport-hdrordr: A9a23:CEDAp6PZmBFKZMBcT13155DYdb4zR+YMi2TDiHoddfUFSKalfp 6V98jztSWatN/eYgBEpTmlAtj5fZq8z+8N3WB1B9uftWbd2FdAQLsSjrcKhgeQYBEWldQtqZ uIEZIOb+EYZGIS5aia3OD7KadH/DDuytHUuQ609QYIcegFUdAD0+8vYTzraHGeCTM2c6YRJd 653I5qtjCgcXMYYoCSAWQEZfHKo5numIj9aRALKhY74E3W5AnYoILSIly95FMzQjlPybAt/S zslBH43Lyqt7WexgXH32HewpxKkJ/Ky8dFBuaLls8JQw+cwzqAVcBEYfmvrTo1qOag5BIDl8 TNmQ4pO4BJ53bYbgiO0G7Q8jil9Axrx27pyFeej3emi9f+XigGB81Igp8cWgfF6mI71esMnJ 5j7ia8jd56HBnAlCPy65zjTBdxjHe5pnIkjKo6k2Ffa40Dc7VcxLZvsX+9KK1wUh4S1bpXUd WHVKrnlbZrmBKhHjrkV1BUsZORti9ZJGbEfqAA0vbloQS+0koJjXfw//Zv4EvoxKhNNKWs2N 60Q5iAtIs+OvP+PpgNc9vof6OMexzwaCOJFl6uCnLaM4xCE07xivfMkcYIDaeRCdc18Kc=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, May 09, 2022 at 10:39:32AM +0000, Ross Lagerwall wrote:
> > From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
> > Sent: Monday, May 9, 2022 10:28 AM
> > To: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
> > Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx <xen-devel@xxxxxxxxxxxxxxxxxxxx>; 
> > Stefano Stabellini <sstabellini@xxxxxxxxxx>; Anthony Perard 
> > <anthony.perard@xxxxxxxxxx>; Paul Durrant <paul@xxxxxxx>; 
> > qemu-devel@xxxxxxxxxx <qemu-devel@xxxxxxxxxx>
> > Subject: Re: [PATCH] xen/pt: Avoid initializing BARs from the host ones 
> >  
> > On Wed, Apr 27, 2022 at 05:38:12PM +0100, Ross Lagerwall via wrote:
> > > The BAR emulated register definition does not set emu_mask because it
> > > varies depending on bar_flag.  If emu_mask is not set, then the BAR is
> > > initialized based on the host value which causes the BAR to be initially
> > > mapped at whatever value the host device was using. Although it does
> > > eventually get mapped at the correct location, it causes unnecessary
> > > mapping/unmappings.
> > 
> > Would it be possible to just unset the memory decoding bit in the
> > command register if it's set?
> 
> I don't think that would be sufficient since AFAICT qemu does not read that
> bit so will still call into Xen to update memory mappings, etc.

Hm, but this seems wrong?  QEMU should not set memory mappings if the
memory decoding bit is unset.  While the bit will be set for the
underlying physical device, it shouldn't be set in the emulated
command register provided to the guest, and hence no mappings should
be established until that bit is set by the guest.

In the description you mention not using the host BAR positions, which
is fine, but you also need to prevent mappings from being created
until the guest has positioned the BARs and enabled the memory
decoding bit, or else you end up positioning the BARs wrongly has QEMU
has no knowledge of where should BARs reside.

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.