From patchwork Wed Oct 20 17:27:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 516033 Delivered-To: patch@linaro.org Received: by 2002:ac0:cd8c:0:0:0:0:0 with SMTP id d12csp2040478imp; Wed, 20 Oct 2021 10:51:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNoa/0SgnMLp4BoKoD+G3LgwPbIR2sdMYVk4qevghALuFmt+X5YSUM0NIJi1cddgIwyNSV X-Received: by 2002:ab0:655a:: with SMTP id x26mr824173uap.133.1634752291600; Wed, 20 Oct 2021 10:51:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634752291; cv=none; d=google.com; s=arc-20160816; b=nSpQiy9B5VsqByTDO9IQRioEisRqtDqstgCkyVWGTq2rd40pclzGSYUuGFLgniYrQb MuVREFhzBc5lumHSUz/v2TK10y1m3FONGPAz+TlruFUyx3J4gkiF9gxxRy8NRAd6wqaV mB9OtlKxTA7GN8EyImdIDHYVDPBTfHfOihOB4I0i/bWpqxI8ETFNHUx6Ng53UzoD6uLY /DQGb+u1titCW40Eqa0cvuRjGR+dN+N3bL9MJ9ErJmu9cj6OOwl4Q1aSQySzvhVd3t1M gexCoeSJ0WpeijecLK7DF67nI+p3RC1ZVQlTHE7LBMVqQW+0VDzKCaz+I2DGxEhXJAc/ wP9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=c2ZO3QF7aKiu/qtLjz0/gkgshbB0NhJBsLRiXAH1moU=; b=gAQlX6SA/HVHN/xaq4pRkb3aCzFyf7est80I2S44tO/E+FyE4T8UjP4ehu9/CIA0Vs Wdh7WdkLCW5LLGWQGJJURMgIyhwbThUY5apzz1M1/Scp27ubGuz/TgYZqgbr4SL7K6vw GLe20hWPmnogYf8Y5bRiK1yGTUMOz/Ohzt81e+tStZ51mY32x85EVNy1A2LUDWeoUwtT ReWTkz/a5sys9eGStpv+iiR7rQnusooPqL6SSfRorhKubz3P9woL87yt9Aux5RDYK8zA U2ZvAVrfQ8mJv0mJKiiQPJDUZU1Zem0WEPXH6pvp5fT3yNbUUfr//y/E8D3rvVgD0v75 CrDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=F5LghO36; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o43si2872909uad.62.2021.10.20.10.51.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Oct 2021 10:51:31 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=F5LghO36; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:33326 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdFkQ-0006rs-Vr for patch@linaro.org; Wed, 20 Oct 2021 13:51:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37508) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdFUa-0005CD-Ja for qemu-devel@nongnu.org; Wed, 20 Oct 2021 13:35:08 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:46952) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mdFUY-0002d8-DG for qemu-devel@nongnu.org; Wed, 20 Oct 2021 13:35:08 -0400 Received: by mail-wr1-x434.google.com with SMTP id k7so39555wrd.13 for ; Wed, 20 Oct 2021 10:35:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=c2ZO3QF7aKiu/qtLjz0/gkgshbB0NhJBsLRiXAH1moU=; b=F5LghO364b6+pB6hJTsifG9M6OQl9putRZaeVKAN+amfgH+H1EiqiyVwoQTM9SWLjU RjzR0tWx8v+3fV+NEWU1sYlTvcoSzWAC3jw7kfuZAGYnnl645u1gqq1R0AkyzyGsWZWL X5qC5cvLVTxvpctmICwWCdDZqGlRi46AxLflTVXJnHdS2jOxyhDX9lAJw5Q/mfwrqkg1 j20KOnjmBSM7n28U2FSUp+mNCCPIUQcoPjmRb6311imXE8WURHAoW7GwV8Fi7RCEfDCZ VJXmJJlSx0t/hElO0So5nUOTSPntvCmhI0tCxLdddBqAB6590QFGgpVLSTRGegJDCP22 2UGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=c2ZO3QF7aKiu/qtLjz0/gkgshbB0NhJBsLRiXAH1moU=; b=RewwKzLvJg8H4O6YsCeJRbg5sysfgub0nCpcwoL4U0ay3x46QhUkijL2XD0XizTi0x JZ0q9Gll8BeI5qZhH9eYADZWBG0ZEkDoFOukBzMBJXs9gfxErE7sZUc9ooOCRcczJCmo +T0BQKOwOl6cRxxx/GA+hPPc23OCL9dckJTcB+VC/Th8qpuE5uf0aZGEaQCc1lhWnT1x 7mgR7RawCqBNwbI3sNZo3l0ctq+E25dsc0DCCkkVniCjng+fvct3sFrO/q/n0qTYHTIH ZzS7jZdMTgNzCwdTIzAzY2oI8ZD2rB+hJU3fafwlsg2cfpkEibhgroYl8WEVfwDijJaR Hzqg== X-Gm-Message-State: AOAM530Wmo77PCFWw5VkSKwLODbmYDILGqVAbbSIkaTfxFqWPxFfTrXo 1v8UVmkGWQ3IhNBTLIb17TxN5A== X-Received: by 2002:a5d:58ca:: with SMTP id o10mr726675wrf.358.1634751305058; Wed, 20 Oct 2021 10:35:05 -0700 (PDT) Received: from localhost.localdomain (cpc92880-cmbg19-2-0-cust679.5-4.cable.virginm.net. [82.27.106.168]) by smtp.gmail.com with ESMTPSA id n7sm2662270wrp.17.2021.10.20.10.35.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 10:35:04 -0700 (PDT) From: Jean-Philippe Brucker To: mst@redhat.com, imammedo@redhat.com, peter.maydell@linaro.org Subject: [PATCH v5 07/12] hw/arm/virt: Reject instantiation of multiple IOMMUs Date: Wed, 20 Oct 2021 18:27:41 +0100 Message-Id: <20211020172745.620101-8-jean-philippe@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211020172745.620101-1-jean-philippe@linaro.org> References: <20211020172745.620101-1-jean-philippe@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=jean-philippe@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jean-Philippe Brucker , ehabkost@redhat.com, eric.auger@redhat.com, jasowang@redhat.com, richard.henderson@linaro.org, qemu-devel@nongnu.org, peterx@redhat.com, shannon.zhaosl@gmail.com, qemu-arm@nongnu.org, ani@anisinha.ca, pbonzini@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We do not support instantiating multiple IOMMUs. Before adding a virtio-iommu, check that no other IOMMU is present. This will detect both "iommu=smmuv3" machine parameter and another virtio-iommu instance. Fixes: 70e89132c9 ("hw/arm/virt: Add the virtio-iommu device tree mappings") Reviewed-by: Eric Auger Reviewed-by: Igor Mammedov Signed-off-by: Jean-Philippe Brucker Reviewed-by: Igor Mammedov --- hw/arm/virt.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.33.0 diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 3da7a86e37..25db8d4262 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2441,6 +2441,11 @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev, hwaddr db_start = 0, db_end = 0; char *resv_prop_str; + if (vms->iommu != VIRT_IOMMU_NONE) { + error_setg(errp, "virt machine does not support multiple IOMMUs"); + return; + } + switch (vms->msi_controller) { case VIRT_MSI_CTRL_NONE: return;