| [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, 14 Mar 2023 17:02:35 +0100Arc-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=noneArc-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=yV6FeKxjKGLBUI2qeemyWufcRSU0liDhLszqRzIDsa8=; b=BrnaDP+ABDSrRFIc6gMmI6RJz05iWFMetcj2gRHwrvbfqE2pTtgKoEHzhQ4fse75MU2J29+NeN8XJNH2vb5pitbZtDLfNM/gAJidp9mv2rxyl8BBi09TDuow4UNm6X9oMo2GwqvJO3X6+KpXRYZ8FP0TJrWRq5jx7n1XFqUCqhCbkoNxcq3ULBjq7YD7+s+MpE2767DClNEYzP3M1OZUam6GJybDXREhd/vsxlrbgAgPUzQJbUExxcWxC4ndn9YSO6JGgkse+OSkhzBBHpnLqmRF/ccf7GOG5t1OUEIpzHouLkR6ApYMHuwOdY6XHx2a9P77/5YV4QTe/lJ44EviYA==Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZYQKf3oPH3N3O29qnBda0nFgl6h+UCM9LWbC1ZOWUbOB3E3mGE8HLHDsXwQUCohbISecrup8AXPtu5gyHtKO8Tx3ZBMUi64cx5BjdtVB9Jtj9hWEa0Oo5BBKWLxFYBxjjKpja3SjdyY9n4L7qgN7/cIFFSfemn2YO1zhXZNrSIzpZWXRvf4WsrerUBQAV3AHzN6LNyw2/CWAqddPzxxhUsetK7/TwBnmE7rbhls/H3t8px5EwoBUdGtsriRYRHogQlIicbSha9fIivc7v4ShDLRYdXwiizRf7ncq2squKShoSl/pwUC1nOqjqhQ18kjgbYmQmeaQ7Fmxpa7wPCnq6g==Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;Cc: Alex Deucher <alexander.deucher@xxxxxxx>, Christian König <christian.koenig@xxxxxxx>, Stewart Hildebrand <Stewart.Hildebrand@xxxxxxx>, Xenia Ragiadakou <burzalodowa@xxxxxxxxx>, Honglei Huang <honglei1.huang@xxxxxxx>, Julia Zhang <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@xxxxxxxxxxxxxxxxxxxxDelivery-date: Tue, 14 Mar 2023 16:02:59 +0000List-id: Xen developer discussion <xen-devel.lists.xenproject.org> 
 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 ...
> --- 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).
Jan
 |