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

Re: [PATCH RFC] vPCI: account for hidden devices in modify_bars()

  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 14 Sep 2021 12:12:12 +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; bh=ByWGbETjwnvuTkWHHaztDcj1odn98swWY3HS7XHbdmg=; b=QYgUEZH/gCFaVTmMhVGvCASuZDfTnpngQWvXeIGjedh+E5dbdRE0ts/uNVK45s9XJqSI6h4GjeAup9jKyEjVJha0MlcjGvDphHMJmIEnmrwmGehIp6XTN7y/K+b4GQDZQxaGgOwMAN1AesrnJ+HcSxuhDqAyDybrqKbOwT1NXciY2L3Kdu718WkbLblYMXnNDLX8jqbeMLzdaHRC/jqhiZ2YBbMLT7WpSTRQ4U6EBJ+WAhwtxkRzeOWczaupHg9tMkRDxU44ejEUGxUHqW4gC5TUxaehvongLGk6cVc3V2S7NlbtjLBvGFamGlwJ5WZNkZ8hNinbUj2lq5C6gfgwFQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BGGtxP4zvItdyzcIOrIYSts2nMULKasb6YJLUOyKmDzwzpcVVG1ILwq0QytFjjG4oKOU1CgFHrdx9SCDoNGXIpT0jB/AUe5LP26f+bQRXeuWE7QEufvQ8235Sz+wbB1b4v+cILpdhb4Ww6m2vWfQwObcX67iNjruOcawhsK+9630RUIhYe32h89RzQhG40zjGVN7AUMKK3UzMj6f9ilsv5+d1Q2ZIVA9JKUamtGR87QOgDbWzUmMvZf4T0PglmL2PcHMKPJ3YhGo5/vX1+EsPnMlEAk0ns7530w0k2lc7p9ECisMHYA2VgTqjuvzeE0eRgejSGQR4rxy1lcp1AaCXw==
  • Authentication-results: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=suse.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 14 Sep 2021 10:12:25 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 14.09.2021 12:00, Roger Pau Monné wrote:
> On Mon, Aug 30, 2021 at 03:04:55PM +0200, Jan Beulich wrote:
>> Hidden devices (e.g. an add-in PCI serial card used for Xen's serial
>> console) are associated with DomXEN, not Dom0. This means that while
>> looking for overlapping BARs such devices cannot be found on Dom0's
>> list of devices; DomXEN's list also needs to be scanned.
> Thanks for looking into this, I certainly didn't take hidden devices
> into account for vPCI dom0.
>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>> ---
>> RFC: Patch intentionally mis-formatted, as the necessary re-indentation
>>      would make the diff difficult to read. At this point I'd merely
>>      like to gather input towards possible better approaches to solve
>>      the issue (not the least because quite possibly there are further
>>      places needing changing).
> I have a couple of questions, AFAICT we currently hide the serial
> console and/or the VGA adapter if it's in use by Xen.
> I wonder whether we need to add vPCI handlers for those:
> setup_one_hwdom_device will attempt to add vPCI handlers to the hidden
> device because of the temporary override of pdev->domain done in
> _setup_hwdom_pci_devices, but I think that for hidden devices we
> shouldn't add vPCI handlers. We should instead block PCI config space
> access from dom0 to the device so that it doesn't mess with Xen usage.

The answer to this follows (I think) from the one below.

> It's also not clear why does Xen want to have those hidden devices
> partly controlled by dom0, as it would seem to me that dom0 interfering
> with hidden devices in use by Xen can only lead to trouble.

Dom0 can't interfere as long as it can only read from the device.
Restricting accesses to reads is one of the purposes of "hiding"
(the other is to make it impossible to assign these to a DomU). Not
allowing Dom0 to read from such devices would lead to wrong PCI
device discovery - some devices would be missing (which may or may
not be merely a cosmetic issue). If the missing device is a multi-
function one at function 0, other devices in the same slot may also
not be found by Dom0 (depending on whether it looks at non-zero
function numbers in this case).




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