aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2012-12-03 16:42:13 +0000
committerAlexander Graf <agraf@suse.de>2012-12-14 13:12:55 +0100
commit8b1853e7d8c2bf8c6a9f023ab98ba0e8a38bd086 (patch)
tree762f9e6c05e342f2a198216f32a8d710a846f0db
parent3eddc1be1ccb26387f8f960f8a3d8c417064a91f (diff)
downloadqemu-8b1853e7d8c2bf8c6a9f023ab98ba0e8a38bd086.zip
qemu-8b1853e7d8c2bf8c6a9f023ab98ba0e8a38bd086.tar.gz
qemu-8b1853e7d8c2bf8c6a9f023ab98ba0e8a38bd086.tar.bz2
pseries: Don't allow TCE (iommu) tables to be registered with duplicate LIOBNs
The PAPR specification requires that every bus or device mediated by the IOMMU have a unique Logical IO Bus Number (LIOBN). This patch adds a check to enforce this, which will help catch errors in configuration earlier. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
-rw-r--r--hw/spapr_iommu.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/spapr_iommu.c b/hw/spapr_iommu.c
index 02d78cc..3011b25 100644
--- a/hw/spapr_iommu.c
+++ b/hw/spapr_iommu.c
@@ -120,6 +120,12 @@ DMAContext *spapr_tce_new_dma_context(uint32_t liobn, size_t window_size)
{
sPAPRTCETable *tcet;
+ if (spapr_tce_find_by_liobn(liobn)) {
+ fprintf(stderr, "Attempted to create TCE table with duplicate"
+ " LIOBN 0x%x\n", liobn);
+ return NULL;
+ }
+
if (!window_size) {
return NULL;
}