|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 3/4] vpci: shrink critical section in vpci_{read/write}
From: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
Shrink critical section in vpci_{read/write} as racing calls to
vpci_{read,write}_hw() shouldn't be a problem. Those are just wrappers
around pci_conf_{read,write} functions, and the required locking (in
case of using the IO ports) is already taken care in pci_conf_{read,write}.
Please note, that we anyways split 64bit writes into two 32bit ones
without taking the lock for the whole duration of the access, so it is
possible to see a partially updated state as a result of a 64bit write:
the PCI(e) specification don't seem to specify whether the ECAM is allowed
to split memory transactions into multiple Configuration Requests and
whether those could then interleave with requests from a different CPU.
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
---
New in v6
---
xen/drivers/vpci/vpci.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c
index 657697fe3406..fb0947179b79 100644
--- a/xen/drivers/vpci/vpci.c
+++ b/xen/drivers/vpci/vpci.c
@@ -370,6 +370,7 @@ uint32_t vpci_read(pci_sbdf_t sbdf, unsigned int reg,
unsigned int size)
break;
ASSERT(data_offset < size);
}
+ spin_unlock(&pdev->vpci->lock);
if ( data_offset < size )
{
@@ -379,7 +380,6 @@ uint32_t vpci_read(pci_sbdf_t sbdf, unsigned int reg,
unsigned int size)
data = merge_result(data, tmp_data, size - data_offset, data_offset);
}
- spin_unlock(&pdev->vpci->lock);
return data & (0xffffffff >> (32 - 8 * size));
}
@@ -475,13 +475,12 @@ void vpci_write(pci_sbdf_t sbdf, unsigned int reg,
unsigned int size,
break;
ASSERT(data_offset < size);
}
+ spin_unlock(&pdev->vpci->lock);
if ( data_offset < size )
/* Tailing gap, write the remaining. */
vpci_write_hw(sbdf, reg + data_offset, size - data_offset,
data >> (data_offset * 8));
-
- spin_unlock(&pdev->vpci->lock);
}
/* Helper function to check an access size and alignment on vpci space. */
--
2.25.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |