From patchwork Fri Dec 14 12:13:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [11/40] pseries: Don't allow TCE (iommu) tables to be registered with duplicate LIOBNs Date: Fri, 14 Dec 2012 02:13:27 -0000 From: Alexander Graf X-Patchwork-Id: 206433 Message-Id: <1355487236-27451-12-git-send-email-agraf@suse.de> To: "qemu-ppc@nongnu.org List" Cc: qemu-devel qemu-devel , David Gibson From: David Gibson 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 Signed-off-by: Alexander Graf --- hw/spapr_iommu.c | 6 ++++++ 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; }