From patchwork Fri Dec 10 17:04:11 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: 522749 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp2834183imb; Fri, 10 Dec 2021 09:12:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJyHCC+umAcPuy7zK2TSm+JWo7wjj7KNwokeKxgghgE5YYs8htm5Td0rhRnIf+WgeEVeaIyU X-Received: by 2002:adf:ea8c:: with SMTP id s12mr15366156wrm.535.1639156346551; Fri, 10 Dec 2021 09:12:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639156346; cv=none; d=google.com; s=arc-20160816; b=UJDuqdjjHNqFvINtyGJ99RhgRcf5EaduIGWWdzC/kzjorZnucNtkdpt4VJ8C7jJKn1 s/YLI04NC3RodFF6O7XhtO1Y6FeR5JIcfEXD24fRCWC489dmAmddGvlQMjAavjYf9Ure t2qzHe8pncqEhykm7vU4zuhC1BfSVYd8eRKRflrA9Yh6do/0ifg26FZeqln5wW0sclth IjDQUXWobv+ckXVuoEx49tHH5UWRGjnjTRG9Z4R8sdFIcfSleGsJK5/AP5XBIi1AlHRC fRiIZvzB0+f32cnYu9EOYUR5CJYRM1ggaFqUFdUOWMT6Dh2BACixU/hOb/T87Velobae 4i6w== 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=eT4rNPLFVR6cVRrKRWEc6vQ7I4D2oIIXC1EjnaeFLfw=; b=HBb5P8R8tXg3Zfh39nraBhTTRGOwsGc7+h2wBY428f02DTzRh53ZFDRTl4Br7YMnFf oK7fv97V0HXafCznX57c4mLwNdWqGZXZR213SAXb6ebhPnnwUPjMqX08IX7ZJ8kHDgCe zWY1cqNgRDu2h6f6+YltP0xhew8JTC/7xPWsopro/8LXUli8SUMdgUuycBDeGT55q9iF VEOFkxcfyFO3hCgbyf5NpI2cUyJ0VdGibTmM/lWGryYMs2ucEM61v4Vj1ZdTKMGwcLTM +KXHtEcdGIhMMNURMvNSfAJmdR/O8QBBcj5wkWv05mO/vkIsPYhVoFlWgf1dCAJjaNyZ KeWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=m6VTRGLI; spf=none (google.com: qemu-devel-bounces+patch=linaro.org@nongnu.org does not designate permitted sender hosts) 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 v5si7781622wrx.47.2021.12.10.09.12.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Dec 2021 09:12:26 -0800 (PST) Received-SPF: none (google.com: qemu-devel-bounces+patch=linaro.org@nongnu.org does not designate permitted sender hosts) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=m6VTRGLI; spf=none (google.com: qemu-devel-bounces+patch=linaro.org@nongnu.org does not designate permitted sender hosts) 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]:54372 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mvjRZ-0007Hs-HY for patch@linaro.org; Fri, 10 Dec 2021 12:12:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40362) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mvjLT-0005qP-BF for qemu-devel@nongnu.org; Fri, 10 Dec 2021 12:06:07 -0500 Received: from [2a00:1450:4864:20::529] (port=38910 helo=mail-ed1-x529.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mvjLN-0006Sx-UZ for qemu-devel@nongnu.org; Fri, 10 Dec 2021 12:06:03 -0500 Received: by mail-ed1-x529.google.com with SMTP id x10so14586064edd.5 for ; Fri, 10 Dec 2021 09:06:01 -0800 (PST) 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=eT4rNPLFVR6cVRrKRWEc6vQ7I4D2oIIXC1EjnaeFLfw=; b=m6VTRGLIYPWf6T4kpr0Z9k52Xt/DXBOo27KioYt4qyJ+8XLPC1xYpJi32ElZv2Zvky v5eJPMl+NbMVg55KCd851NYpmsWNLXyJvXZ4SQ4uuoGEGYcO1idzPZxi1zPzi/JXadiZ pMbek/sDtyaLMX+nTl9qwHDo4f4n1uPPsmWN2OJM2j6BnNJYO3TG6brfeIgZvIcbfa9u 1+omUoyqxk4n8LLOkaGxxxGdUr2l/v6BuwTnvhy+Bqfyy/VQsJeFjoBsmNLhyj9Qd6mX L95xU0N1YzOVoNsVo0gl6QrhDBLeaxQfsSeuapbnFnfmuDJF1dVbSNoZeeO1Mb4C9yQc TJgA== 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=eT4rNPLFVR6cVRrKRWEc6vQ7I4D2oIIXC1EjnaeFLfw=; b=rjKPJp4hwEg0/ZLkhmat7PkxC6aYPdpuONvDcV6xERWY40xYYgJ3fChBdX6yHd0qY4 uhv79Ji9EZqBv7RWw2YAPk3UpZ5vyZIe4l9qDpD7pHeQwOfqQ3zNAbsAKsToMiFN+KaH jY54s0u+QjGRRq+JR4ad3bXx1acQ4W2DSEPfe8ChzRGWWhBFcvApNjdmMYbB018RiXCL yEw4hRbQrNw6vf6bYm7IPfjOm0eitSws1juJCDXfQWvNPL7xqFWXpf0bL4gK93fzZM43 88Bh5okESSFqBfNgjjS6jFtztRCVLfmW4jYVfwDCgW8z7tkcYcJ4IDIDJUgY+dPaNgPw Gu+Q== X-Gm-Message-State: AOAM531rzb+Z86LsqYXiD12t+nTcZ4XcOf1X7CFuvUDd8TlVmjFSGFni 7caXrxJQp76a8FPrJ3oaHOT6VA== X-Received: by 2002:a17:906:9253:: with SMTP id c19mr26201996ejx.63.1639155958151; Fri, 10 Dec 2021 09:05:58 -0800 (PST) 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 x7sm1860661edd.28.2021.12.10.09.05.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 09:05:57 -0800 (PST) From: Jean-Philippe Brucker To: mst@redhat.com, imammedo@redhat.com, peter.maydell@linaro.org, shannon.zhaosl@gmail.com Subject: [PATCH v7 3/8] hw/arm/virt: Reject instantiation of multiple IOMMUs Date: Fri, 10 Dec 2021 17:04:11 +0000 Message-Id: <20211210170415.583179-4-jean-philippe@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20211210170415.583179-1-jean-philippe@linaro.org> References: <20211210170415.583179-1-jean-philippe@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::529 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::529; envelope-from=jean-philippe@linaro.org; helo=mail-ed1-x529.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ani@anisinha.ca, eric.auger@redhat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org, Jean-Philippe Brucker 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 --- hw/arm/virt.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 53941e4aac..608a0a78f0 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2494,6 +2494,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;