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

Re: [PATCH v5 06/14] vpci/header: implement guest BAR register handlers


  • To: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 3 Feb 2022 13:44:28 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=FiLxVk8iiEYG+at9BCceDO5cYQTAVRGZhU4E+w1O6uc=; b=kPh0Ja+UEsaDc+Fky++DYBxBzpTo4UVN/ASTB9X4L12wq9aAXA2wMa/0WRe9F4nTp0XaONzNwlG7hDy7tYitddsKZx/muMiyQ4M738hJdwCmpZQ8VgiJFjFHR8Ar8jfKNxWzW6snkijwLD/jNjhEgH2RlDOnqFMk5oVOGR8FovITvm98Xgy7uLqqAxQQqZQLehfFW2MCEBJtuTKwXxVF7IwIrcBsg7fpu4NSQU4C3zc6NqIiOgNtA9I0mAoWKrOxp1WuQykf9d+xcTTUB7czvP9O0QdPWe61kySUHqYuQHOTD/0S5LlLBGsjFCAk/KDFHtnH4qrC0FyAItD3D152jw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FQ6qdt6BQk0HSk9YtuKI/Goxptif6nFq1HWgl8shCEQIZMlWki6m6v6j0hffu7DYJl1yxSCdWc4XIx/xVRgdxzg95DQLA/nwA9K8qjbuo18IEbU0JYR3l6HEFK7RBfrNyevw7n7TMhDwsL3ZPjCcYITr3DUJp+hA7SE2REpSoJVxk+t2f50ax7zpVoKhgJsGrVpOe1DMSowK+a7nWFG56+4t++ypwVVjhcC5fo3gok+hWbop3mEED4eLr5psipXQUS+k8T43++GHbPOPBhIVfBSeb93xB7ZFqPgV76Fw74UbbWffprzwzNUPhdsOs4l/1sCmP4jdt72W36NnjXHChQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <Oleksandr_Tyshchenko@xxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Artem Mygaiev <Artem_Mygaiev@xxxxxxxx>, "andrew.cooper3@xxxxxxxxxx" <andrew.cooper3@xxxxxxxxxx>, "george.dunlap@xxxxxxxxxx" <george.dunlap@xxxxxxxxxx>, "paul@xxxxxxx" <paul@xxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>, "roger.pau@xxxxxxxxxx" <roger.pau@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>
  • Delivery-date: Thu, 03 Feb 2022 12:44:42 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 03.02.2022 13:36, Oleksandr Andrushchenko wrote:
> Hi, Bertrand!
> 
> On 26.11.21 14:19, Oleksandr Andrushchenko wrote:
>> Hi, Bertrand!
>>
>> On 25.11.21 18:28, Bertrand Marquis wrote:
>>> Hi Oleksandr,
>>>
>>>> On 25 Nov 2021, at 11:02, Oleksandr Andrushchenko <andr2000@xxxxxxxxx> 
>>>> wrote:
>>>>
>>>> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
>>>>
>>>> Add relevant vpci register handlers when assigning PCI device to a domain
>>>> and remove those when de-assigning. This allows having different
>>>> handlers for different domains, e.g. hwdom and other guests.
>>>>
>>>> Emulate guest BAR register values: this allows creating a guest view
>>>> of the registers and emulates size and properties probe as it is done
>>>> during PCI device enumeration by the guest.
>>>>
>>>> ROM BAR is only handled for the hardware domain and for guest domains
>>>> there is a stub: at the moment PCI expansion ROM handling is supported
>>>> for x86 only and it might not be used by other architectures without
>>>> emulating x86. Other use-cases may include using that expansion ROM before
>>>> Xen boots, hence no emulation is needed in Xen itself. Or when a guest
>>>> wants to use the ROM code which seems to be rare.
>>> In the generic code, bars for ioports are actually skipped (check code 
>>> before
>>> in header.c, in case of ioports there is a continue) and no handler is 
>>> registered for them.
>>> The consequence will be that a guest will access hardware when reading 
>>> those BARs.
>> Yes, this seems to be a valid point
> So, with the approach we have developed these days we will ignore all writes
> and return ~0 for reads for all unhandled ops, e.g. those which do not have 
> explicit
> register handlers employed. Thus, this case will fall into unhandled clause.

Except that I guess BARs are special in that reads may not return ~0,
or else the low bits carry a meaning we don't want to convey. Unused
BARs need to be hard-wired to 0, I think.

Jan




 


Rackspace

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