[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>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Christian König <christian.koenig@xxxxxxx>
  • Date: Mon, 13 Mar 2023 08:26:09 +0100
  • 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=x6E92zahT1FpEoqbvvrR9GBHNWdssWJ6+NBMhFJyT4s=; b=EcUW7mmhB/zRoLhQO0K2diT+HQ862Wx+KcjGdUpFc6/WUAICGQ10T+kX3cqbzDS+h6YmT83FmxtmX0JuG9WFf/e1EgkIO1RwQP6yhji57v2BNESifbEo5Y0ljYmLeUJDCH25wjA5U77o+6+i5vusmYVqqyr/1fAVTdHYXUC+u1IXq/t6LE52Wd0pNKgW9eve7E633gH5QbrDgNn6QzPE+mF7YAGlBXYsfYoG85x+XHInwIjQdKc2l6mcLUyiXqMkNxxKRosbTxfG/krEXGHlml2TYNvI1coN3JbtAEHa8LITLd88Eal/h1kQMzg+3eR+WtojmdZGyDXxChhAW8gPqQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DG41vwSdLUTtCMDGO5WY4spgRDN8aqaqnmEQMv426ubUwTqTR+WdExruW8EJ7wdsZi/r57DiwMEmVZqCyhalkIsx7fgWY7MURbBljViG06e9YNNIj3BEU0u05BJUS+WDM8VYp7dVToNCTNJPqNxqC3ZjLkbzcqwW7f3gX7vCsAt3JEYuqVYb6R1ESwbS8bNb4dzrX7gK1e+5VOIzZBYT2Ud3ocz5sapAFgCKZaNs067OPlYWlTiEK5SC9xUbgRuyTseFelyuGXct8eFs0TRBfG2WZ9dLAIbDpmarbFeZ+HJTa385UPLh8oe8G3hlv7S4nb+e2GvbRplHqp0SCr30IQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: Alex Deucher <alexander.deucher@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>
  • Delivery-date: Mon, 13 Mar 2023 07:26:35 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Am 13.03.23 um 08:23 schrieb Christian König:


Am 12.03.23 um 08:54 schrieb Huang Rui:
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.

Signed-off-by: Chen Jiqian <Jiqian.Chen@xxxxxxx>
Signed-off-by: Huang Rui <ray.huang@xxxxxxx>
---
  xen/drivers/vpci/header.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
index ec2e978a4e..918d11fbce 100644
--- 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 )

Checkpath.pl gives here:

ERROR: space prohibited after that open parenthesis '('
#115: FILE: xen/drivers/vpci/header.c:395:
+    if ( pci_conf_read16(pdev->sbdf, PCI_COMMAND) & PCI_COMMAND_MEMORY )

But I should probably mention that I'm not 100% sure if this code base uses kernel coding style!

Christian.


Christian.


      {
          /* If the value written is the current one avoid printing a warning. */
          if ( val != (uint32_t)(bar->addr >> (hi ? 32 : 0)) )





 


Rackspace

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