aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeir Fraser <keir@xen.org>2011-02-09 08:40:05 +0000
committerKeir Fraser <keir@xen.org>2011-02-09 08:40:05 +0000
commitf4b185362da47e1d9189ed3eb73cd8eca80c364e (patch)
tree6ff3fe9061048b6255fee5e89e7a63f9d840ef56
parent31960417a919c6d883547e1f6c73bd90f0d2ef03 (diff)
downloadxen-f4b185362da47e1d9189ed3eb73cd8eca80c364e.tar.gz
xen-f4b185362da47e1d9189ed3eb73cd8eca80c364e.tar.bz2
xen-f4b185362da47e1d9189ed3eb73cd8eca80c364e.zip
[VTD][QUIRK] add spin lock across snb pre/postamble functions
Added a spinlock across snb_vtd_ops_preamble() and snb_vtd_ops_postamble() to make modifications to IGD registers atomic. Continue keeping snb_igd_quirk default off. Signed-off-by: Allen Kay <allen.m.kay@intel.com>
-rw-r--r--xen/drivers/passthrough/vtd/quirks.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/xen/drivers/passthrough/vtd/quirks.c b/xen/drivers/passthrough/vtd/quirks.c
index ef6c8d0f29..0f7db71443 100644
--- a/xen/drivers/passthrough/vtd/quirks.c
+++ b/xen/drivers/passthrough/vtd/quirks.c
@@ -55,6 +55,7 @@ bool_t rwbf_quirk;
static int is_cantiga_b3;
static int is_snb_gfx;
static u8 *igd_reg_va;
+static spinlock_t igd_lock;
/*
* QUIRK to workaround Xen boot issue on Calpella/Ironlake OEM BIOS
@@ -98,6 +99,7 @@ static void cantiga_b3_errata_init(void)
static void snb_errata_init(void)
{
is_snb_gfx = IS_SNB_GFX(igd_id);
+ spin_lock_init(&igd_lock);
}
/*
@@ -225,7 +227,12 @@ void vtd_ops_preamble_quirk(struct iommu* iommu)
{
cantiga_vtd_ops_preamble(iommu);
if ( snb_igd_quirk )
+ {
+ spin_lock(&igd_lock);
+
+ /* match unlock in postamble */
snb_vtd_ops_preamble(iommu);
+ }
}
/*
@@ -234,7 +241,12 @@ void vtd_ops_preamble_quirk(struct iommu* iommu)
void vtd_ops_postamble_quirk(struct iommu* iommu)
{
if ( snb_igd_quirk )
+ {
snb_vtd_ops_postamble(iommu);
+
+ /* match the lock in preamble */
+ spin_unlock(&igd_lock);
+ }
}
/* initialize platform identification flags */