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

Re: [PATCH for-4.17 v2 4/5] pci: do not disable memory decoding for devices


  • To: Roger Pau Monne <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • Date: Tue, 25 Oct 2022 14:57:57 +0000
  • Accept-language: en-GB, en-US
  • 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=xTpdg1PTu3TZ6wvysef5LNvFfeZKWgF4fzcJczYzVY0=; b=iB0hzssKvwtqdEWo4+hHxAaCS6Qb8nEuTvCt17UpkPjzlb2GCby8LekpzFj+w6F9EZbHl0uMXy9cHRuocc81Q99I2CUpVnsPs/Zdvngc0C0umKQ01tXhKc9aeC19BSob+ox0Hf5ZxzIo8DVHEESM2TXDRA2OOddM59UCMyCzD5GdBX5l9cXGJimIj2rd8uAjoYIwnWXbCtLrcSZ49YYuE+zeVaVttIeipoWHsIJ2AdRrT0iB8oZ12CFs24YRPPL3YPxkHhXiSlVgoxAx/esez9jpKPMDWA/0vFaefkI+ZQPj2p/kE+K3nTIMTb+U7P08YavCuZ26K0/qLQeDqzS2tQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NYu3DWEWKF/+7wUzLbLwL1byK16Q42IPzzD0JT6HLBbz3+0zGJVnFKJDdgfhc1I727b7TNL/E/vbMswhS2vsuptpEmqzPFghlecjj+u/SMXdmjsuFxEba9KemZ3t5wYF1xJVHJrMcvDfGVDJFjP4V7+ygXPBxJhetOK5ELBw3D8axjn3oUhWqT+18jKdV+1kAHSeiy9mw8acAX4b6EJWX4UezHbZ7Rg8Dy5yQCE/BHnvCRz+5vYNqgUV2i+f1bMRC/Vs736HGSqGQyYY/wFPiXg+Jj43GjrQts5S5hF8kwv/bOLHFtsQKfy6qbwpqu3eqvxBWW3ThJbSFra3Zorr7A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: "Henry.Wang@xxxxxxx" <Henry.Wang@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Paul Durrant <paul@xxxxxxx>
  • Delivery-date: Tue, 25 Oct 2022 14:58:15 +0000
  • Ironport-data: A9a23:0yAjK6owfKyBdReoPnHI6CjHkd9eBmIlZBIvgKrLsJaIsI4StFCzt garIBmPPf3cNGHyL9skaI/g90xUuMPWnNUyHABl/3g2EH9H9ZuZCYyVIHmrMnLJJKUvbq7FA +Y2MYCccZ9uHhcwgj/3b9ANeFEljfngqoLUUbKCYGYpLeNdYH9JoQp5nOIkiZJfj9G8Agec0 fv/uMSaM1K+s9JOGjt8B5mr9VU+4ZwehBtC5gZkPKgR4QeE/5UoJMl3yZ+ZfiOQrrZ8RoZWd 86bpJml82XQ+QsaC9/Nut4XpWVTH9Y+lSDX4pZnc/DKbipq/0Te4Y5iXBYoUm9Fii3hojxE4 I4lWapc6+seFvakdOw1C3G0GszlVEFM0OevzXOX6aR/w6BaGpdFLjoH4EweZOUlFuhL7W5m5 NgIMA0/Xgq6l8Wk2L7rE7JR3PQIM5y+VG8fkikIITDxK98DGcqGaYOToNhS0XE3m9xEGuvYa 4wBcz1zYR/cYhpJfFAKFJY5m+TujX76G9FagAvN+exrvC6OlUotitABM/KMEjCObexTklyVu STt+GPhDwtBHNee1SCE4jSngeqncSbTCNlCReblqKYCbFu72kwhBTBRcAeBvqOJtkGcYYIOO 1AF9X97xUQ13AnxJjXnZDWorXjBshMCVt54F+wh9BrL2qfS+xyeBGUPUnhGctNOnO87QyY7k GCAmdzBDCZq9raSTBq19L2ZsDezMig9NnIZaGkPSg5ty8HqvYUbnh/JCNF5H8aIYsbdHDjxx 3WAqnE4jrBL0soTjf3npxbAni6moYXPQkgt/ALLU2m57wR/Iom4e4iv7lud5vFFRGqEcmS8U LE/s5D2xIgz4VulzkRhnM1l8GmV2su4
  • Ironport-hdrordr: A9a23:4J+okangSa2vRTd8guAk0QIgNKnpDfOPimdD5ihNYBxZY6Wkfp +V8cjzhCWftN9OYhodcIi7SdK9qXO1z+8X3WGIVY3SETUOy1HYVr2KirGSjwEIeheOvNK1sJ 0NT0EQMqyWMbEXt6fHCUyDYq4dKbq8ge+VbIXlvhFQpGhRAskOgTuRSDzra3GeLzM2Z6bRYa Dsgvav0ADQHEj/AP7aOlA1G8z44/HbnpPvZhALQzQ97hOVsD+u4LnmVzCFwxY3SVp0sPYf2F mAtza8yrSosvm9xBOZ/XTU9Y5qlNzozcYGLNCQi/ISNi7nhm+TFcRcsvy5zXMISdOUmRMXee r30lMd1gNImjTsl1SO0FnQMs/boXATAjHZuAalaDDY0LHErXoBerZ8bMRiA1XkAgMbza9BOO gg5RPni7NHSRzHhyjz/N7OSlVjkVe1u2MrlaoJg2VYSpZ2Us4ZkWUzxjIjLH47JlON1Kk3VO 11SM3M7vdfdl2XK3jfo2l02dSpGnA+BA2PTEQOstGcl2E+pgEz82IIgMgE2nsQ/pM0TJdJo+ zCL6RzjblLCssbd7h0CusNSda+TmbNXRXPOmSPJkmPLtBOB1vd75rspLkl7uCjf5IFiJM0hZ TaSVtd8XU/fkr/YPf+qKGjMiq9NVlVcQ6duf22vaIJy4EUbICbQRGrWRQpj9aqpekZD4nSR+ uzUagmccPeEQ==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHY6IB1GZlo2uEODk66SxzrKqAIQ64fM1MA
  • Thread-topic: [PATCH for-4.17 v2 4/5] pci: do not disable memory decoding for devices

On 25/10/2022 15:44, Roger Pau Monne wrote:
> Commit 75cc460a1b added checks to ensure the position of the BARs from
> PCI devices don't overlap with regions defined on the memory map.
> When there's a collision memory decoding is left disabled for the
> device, assuming that dom0 will reposition the BAR if necessary and
> enable memory decoding.
>
> While this would be the case for devices being used by dom0, devices
> being used by the firmware itself that have no driver would usually be
> left with memory decoding disabled by dom0 if that's the state dom0
> found them in, and thus firmware trying to make use of them will not
> function correctly.
>
> The initial intent of 75cc460a1b was to prevent vPCI from creating
> MMIO mappings on the dom0 p2m over regions that would otherwise
> already have mappings established.  It's my view now that we likely
> went too far with 75cc460a1b, and Xen disabling memory decoding of
> devices (as buggy as they might be) is harmful, and reduces the set of
> hardware on which Xen works.
>
> This commits reverts most of 75cc460a1b, and instead adds checks to
> vPCI in order to prevent misplaced BARs from being added to the
> hardware domain p2m.  Signaling on whether BARs are mapped is tracked
> in the vpci structure, so that misplaced BARs are not mapped, and thus
> Xen won't attempt to unmap them when memory decoding is disabled.
>
> This restores the behavior of Xen for PV dom0 to the state it was
> previous to 75cc460a1b, while also introducing a more contained fix
> for the vPCI BAR mapping issues.
>
> Fixes: 75cc460a1b ('xen/pci: detect when BARs are not suitably positioned')
> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> ---
> AT Citrix we have a system with a device with the following BARs:
>
> BAR [0xfe010, 0xfe010] -> in a EfiMemoryMappedIO region
> BAR [0, 0x1fff] -> not positioned, outside host bridge window

This needs a bit more explanation (even if only in the email thread). 
The first item here is permitted under the UEFI spec, and exists on
production systems.  We've got several examples.

The second has only been seen on an SDP, and is hopefully a firmware bug
that doesn't get out to production, but we should boot nevertheless.

~Andrew

 


Rackspace

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