[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: Jan Beulich <jbeulich@xxxxxxxx>
- From: Huang Rui <ray.huang@xxxxxxx>
- Date: Tue, 21 Mar 2023 17:36:09 +0800
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.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=G6O+SpqqaInD7XyHgyeS+tF8D5u0zNWAXjzU6g2AX/M=; b=UufdGQL8gxwB/iShqCl5590hgwEgylvaZOIH7UswqvOACcdxUmxEMPXoUpzrq/LOGs1uuiD+4Rv0p5blbWRIS30nwtMKvaToUwImeSxgr/Vn2NVAZq8m7R+2CU+aV/JnP+aqIDtjngLqeKqZVyK0IUTqzVTxs5yu1vZIH8yHi4kmQde9xmx9Az9hTUvo8uFui01yVyLmI/YBbYaQPsB5qnfniKkhNfuOT0IiTAj9TYK46T2C9sLNdDE3FcqLrZ+vuc6V4VYR25G1tHwj4C+T6/18aFuE/VXh6NUEAjBAr3XuBIyYHBFDm2g6zLDZT+fK5lOSG18q0k3z+/PVuhWnLw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RzXuDvUnM5hfmes0La22d/LwdhPetIJynkd3d49Y6UqyHkrzKiVKWV3h1IXp8uLSr82EKZPruBHXeZV8vzn5sLcfeub0FCnI1+wSRCkbTFox1t9mtS15f4Nzlx9bX8X8X/cQMgGpxLwW1hRCc50z8dj8ATsCkhnKwn5XZ20pzuDobwMDh4E8ZItpuJP2I8R8Aoo45Csoa9Dz8Chg7hr4ojusVjR1E2HGvrOTeWHxlNx/C6GPEdObuc2Hg7qh7WRxGSTlxFchpmLJrHZ4OE0uXEDZG/Soh9NEoKSEYfFiGWa3doFsIyH4Oqk9vVWhc+WNlSu8ydOU9ZEU8gvqqc56tg==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.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:36:52 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
Hi Jan,
On Wed, Mar 15, 2023 at 12:02:35AM +0800, Jan Beulich wrote:
> On 12.03.2023 08:54, Huang Rui wrote:
> > From: Chen Jiqian <Jiqian.Chen@xxxxxxx>
> >
> > When dom0 is PVH and we want to passthrough gpu to guest,
> > we should allow BAR writes even through BAR is mapped. If
> > not, the value of BARs are not initialized when guest firstly
> > start.
>
> From this it doesn't become clear why a GPU would be special in this
> regard, or what (if any) prior bug there was. Are you suggesting ...
>
You're right. This is in fact a buggy we encountered while we start the
guest domU.
> > --- 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. And yes, it's temporary workaround, we should figure out
the root cause.
Thanks,
Ray
|