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

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


  • To: Roger Pau Monne <roger.pau@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 24 Oct 2022 13:19:22 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=r8kZznpgOg5CqY/vO6wbKyA14Iki5cPMQ5lTivfHkHg=; b=SBdvT9r4kXj+sJlW1yNEF8ZlWey50K5QqiZGfpTWzIfRPO6LdwnyJ2jfn3SnLZBRgZHNDKAC9b5+wn7p8cyhyYz2kRrroG/w6m7G+Qkh5nR2BV8I72RW8/8eaO018p9vS9g0uQdNIdH82v3U5LwwMVSr8KBKQzzN9OVLwc3mnvbxm2yRWQ0WXmNo3i0zNkKjlm2bkciUGopG10QQY8J7o7b/TFYfbIFtKjpRs6egLmMyA6dsm5mMs39WSNtvFak8HchQxcukfyZRM24dUsj9IpL3Jh/8hJStuJUSdD+smkhHMncvrbliOsDcH7X7SqhkjoSSu2d2uIBaWhM9p42qkA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gZAk5fdYMq4mrTpbe7/ge5UguUqSHnl172nZ4ALV0MGLiapCLFgtI5jZtpZ68uWvFFpOt7zXJSyXL7o2Gd952fG0Nkq5d7xEiyifJIOa1irqmzXRIFy+wy5zpX7W7XRBxIZ29TcgFiNxsZ9vb+jOXpRYPGOAhuzFqffCuHOE1lyesIP0hht9/k9klbfYhKn68tbhaMbJZ7nbjta6XafOq9K4aZQQurJZVrRb048E7AszPufkW6nzklg0V6iKgjUz/2d8i6pYt50ySy3/KLPets7EDKZSuQoUmE1sJnkDS3iRDvZgNbR2KJYYxdCJ57PG42YpRd4lWiju+ZLcsyIQEQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Paul Durrant <paul@xxxxxxx>
  • Delivery-date: Mon, 24 Oct 2022 11:19:33 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 20.10.2022 11:46, 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.

Which makes me wonder: How do things work then? Dom0 then still can't
access the BAR address range, can it? Plus with this adjustment, is
...

>  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.

... this (in particular "restores the behavior") a valid description
of this change?

> 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
> 
> And memory decoding enabled by the firmware.  With the current code
> (or any of the previous fix proposals), Xen would still disable memory
> decoding for the device, and the system will freeze when attempting to
> set EFI vars.

Isn't the latter (BAR at address 0) yet another problem? I have to admit
that I'm uncertain in how far it is a good idea to try to make Xen look
to work on such a system ...

Jan



 


Rackspace

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