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

Re: [RFC XEN PATCH 2/6] vpci: accept BAR writes if dom0 is PVH


  • To: Huang Rui <ray.huang@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 21 Mar 2023 10:41:57 +0100
  • 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=cRLETKrmPFmeuv6Msyzw0vYfmB3716cf/eITO9505cc=; b=aB+2Aw+BWvX5TNGKCqkWC34dDiCVWKdeTmJfWwVja/ufbAjgsoZkrQFWohBJcvjIyo/kEAG/08fSPH51P2dhIrbIWRWcPpYQEI0oMf7hL+qzssrPgRbDP38ucdrRvLfpMAES3MH4c8WxOGnuPFYDrABwy2BOETibI2mRBo98vyr/EMEgwJ0nm8uoen/q2YK85jz5WQaVz82XJpHgytCFOXWCDtvA7RUQaSnvOpjcbRQVAsvx7VmrcDj5BCRhqsMPs7hBIRPy5oDay3dw/kuFaG4HXoCeCktKeHisf208PP0zIBulyvK+ebDa9Dvn4loNwAZ+DQDRFGZih1dmWGitPQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UQZiM5Pcw7mo+yXvW8A4n+gpI0GlTK6IKkibvEYPSMpAudXewQuFUjNGcWTFOPZm1DLPgqHUrafju+aNcUYo+eG5/YYmf1UqySXcc6N3VdW+g7yowx9aNmyrQXEagP9d5jxQwX/cBlNTUzq7nZvDifbWS6ijDf7RMXpWnypTOweAtLtm95RGe3cPoVg7aG9J4CJxATu0WP6JPf+MRnSGzQJ9pikoEnoYZA2Ls/mkoXAC3Q5mTpOBHJWcJd7E/tyfJf+YwEWGJrSdvgdqg1pJjMtFBiGoTHWT+p+31TsUUrnfZLvRpZgafjRU2jfgLPJViuXK7Tug9sQF9Y01KCj3Sg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: "Deucher, Alexander" <Alexander.Deucher@xxxxxxx>, "Koenig, Christian" <Christian.Koenig@xxxxxxx>, "Hildebrand, Stewart" <Stewart.Hildebrand@xxxxxxx>, Xenia Ragiadakou <burzalodowa@xxxxxxxxx>, "Huang, Honglei1" <Honglei1.Huang@xxxxxxx>, "Zhang, Julia" <Julia.Zhang@xxxxxxx>, "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 21 Mar 2023 09:42:17 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 21.03.2023 10:36, Huang Rui wrote:
> On Wed, Mar 15, 2023 at 12:02:35AM +0800, Jan Beulich wrote:
>> On 12.03.2023 08:54, Huang Rui wrote:
>>> --- a/xen/drivers/vpci/header.c
>>> +++ b/xen/drivers/vpci/header.c
>>> @@ -392,7 +392,7 @@ static void cf_check bar_write(
>>>       * Xen only cares whether the BAR is mapped into the p2m, so allow BAR
>>>       * writes as long as the BAR is not mapped into the p2m.
>>>       */
>>> -    if ( bar->enabled )
>>> +    if ( pci_conf_read16(pdev->sbdf, PCI_COMMAND) & PCI_COMMAND_MEMORY )
>>>      {
>>>          /* If the value written is the current one avoid printing a 
>>> warning. */
>>>          if ( val != (uint32_t)(bar->addr >> (hi ? 32 : 0)) )
>>
>> ... bar->enabled doesn't properly reflect the necessary state? It
>> generally shouldn't be necessary to look at the physical device's
>> state here.
>>
>> Furthermore when you make a change in a case like this, the
>> accompanying comment also needs updating (which might have clarified
>> what, if anything, has been wrong).
>>
> 
> That is the problem that we start domU at the first time, the enable flag
> will be set while the passthrough device would like to write the real pcie
> bar on the host.

A pass-through device (i.e. one already owned by a DomU) should never
be allowed to write to the real BAR. But it's not clear whether I'm not
misinterpreting what you said ...

> And yes, it's temporary workaround, we should figure out
> the root cause.

Right, that's the only way to approach this, imo.

Jan



 


Rackspace

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