From nobody Thu Dec 18 22:20:43 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1593795562; cv=none; d=zohomail.com; s=zohoarc; b=XojHwXhYtMKj8L7FEYUnYqUPApfRM2asEdV1ttZh/H9I/R3h32iXdcSR9DY5eLRLlom4uoDS/DH+91gJvLjC2YO5JxTMacMjD/cWzzB0+CeUq/RfC4gjTpCoYBa43vgYB3R0yuP2E5iraqvLpgwzIBDnRD2S3BEf9rbRZuMSr0I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593795562; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=T17rWK5CCU0ZUANk3vqpHki4UbNYDej3t8lSuYskTdY=; b=F587xwik3WtO5guijYFSrR7t6q3TD/KtD6gwJOkAX8H6t+BQLpdTM1h/43DW+A8TpiFGXpfII6o1VCHSWyu+NLbr/x33WgCfkJE+uhbfPyYv+7I98cicWvSxbbqGSsZJ8pqRG9jfNep/nrvi49GXt4ArJ24QWYk4CSduIfBPmqU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 159379556271440.22871251123206; Fri, 3 Jul 2020 09:59:22 -0700 (PDT) Received: from localhost ([::1]:47340 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jrP21-0005eW-Ba for importer@patchew.org; Fri, 03 Jul 2020 12:59:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49992) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jrOx8-0004cO-MM for qemu-devel@nongnu.org; Fri, 03 Jul 2020 12:54:18 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:50681) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jrOx6-0005f3-Ri for qemu-devel@nongnu.org; Fri, 03 Jul 2020 12:54:18 -0400 Received: by mail-wm1-x32d.google.com with SMTP id l17so32636679wmj.0 for ; Fri, 03 Jul 2020 09:54:16 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id j15sm5574224wrx.69.2020.07.03.09.54.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 09:54:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=T17rWK5CCU0ZUANk3vqpHki4UbNYDej3t8lSuYskTdY=; b=LDpLqQQgCjEL9GPjFpb8U/YkdUKmHKibZZMPFcHOPyj0Qvn0oo9RuVsu9gIIE3XnPw /clCffpqEkE1G/XhHNJ9QWxXK/UzzayxrcYnrYtu9OnTmHqp2uUV9ovWmibpNWfZhae1 +6wUej3mSCKeparKNsqZLOuhwqZKHd0C8Bu7FKF7PPYKwCO016qhezBrfHDgHFqshhT7 qn5V6lxKhHGEv4O+35+y9xc3TWhZ1bXa18Fo7iUIGolZzbEsJcMcZKDpE+sBzlZrgX12 53rb7oDX6vH/fBsRkGt2V4pxMwzvWlEOX9XKZJEsOl6x63QY7MSSJ4/zY21xzzxb7GVT rcug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=T17rWK5CCU0ZUANk3vqpHki4UbNYDej3t8lSuYskTdY=; b=iLz5FslZmzgk4//zCMQ6YcYBhbaL9cDt6mi/cAjil/T8ufNI/7OnEW/dx+nmv2LG94 ZOGywFdFcBtfS6ofKFVQ72zVpDMTFRJBziU+/GQvUZ7Z++Fgg3K6dMs+NylwmU4D93lt Vydl3UL0Ksf7wi0/jBJCt1QezKmiHq7dYYOBqPoi8M6OCN8ojuDzBRSGHlFPLxioxz3g eHPfBzLmldxR1qK3ZFQrcghcmcjyRuJsBn1BU5uFSHq419PR0VPD2IIfcFAn1eSk54Hc T0dMWomfUnqQHN/nHIyYiFwPuTo9Om/klrZ8q6PxEv9vhpIdeDsMSoQP+PcMuKtTgot/ 7P7g== X-Gm-Message-State: AOAM531eJ3uUoe8rvKyHuyyBFkafi06mVnTo92djW72wJH7bmkB1fzYJ /trXSwBwSpS9KPFAaKrinrZlaRYhm+jKbA== X-Google-Smtp-Source: ABdhPJw67F2scitmVzwAEFoLXMbMmj8XZnST7sLroewvmV68dc2WlN1sOvyr3Vr+ZW6xbZg1SOJLXg== X-Received: by 2002:a7b:c5c4:: with SMTP id n4mr36674691wmk.67.1593795255133; Fri, 03 Jul 2020 09:54:15 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 07/34] virtio-iommu-pci: Add array of Interval properties Date: Fri, 3 Jul 2020 17:53:38 +0100 Message-Id: <20200703165405.17672-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200703165405.17672-1-peter.maydell@linaro.org> References: <20200703165405.17672-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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=_AUTOLEARN 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Eric Auger The machine may need to pass reserved regions to the virtio-iommu-pci device (such as the MSI window on x86 or the MSI doorbells on ARM). So let's add an array of Interval properties. Note: if some reserved regions are already set by the machine code - which should be the case in general -, the length of the property array is already set and prevents the end-user from modifying them. For example, attempting to use: -device virtio-iommu-pci,\ len-reserved-regions=3D1,reserved-regions[0]=3D0xfee00000:0xfeefffff:1 would result in the following error message: qemu-system-aarch64: -device virtio-iommu-pci,addr=3D0xa, len-reserved-regions=3D1,reserved-regions[0]=3D0xfee00000:0xfeefffff:1: array size property len-reserved-regions may not be set more than once Otherwise, for example, adding two reserved regions is achieved using the following options: -device virtio-iommu-pci,addr=3D0xa,len-reserved-regions=3D2,\ reserved-regions[0]=3D0xfee00000:0xfeefffff:1,\ reserved-regions[1]=3D0x1000000:100ffff:1 Signed-off-by: Eric Auger Reviewed-by: Michael S. Tsirkin Reviewed-by: Jean-Philippe Brucker Reviewed-by: Peter Xu Message-id: 20200629070404.10969-5-eric.auger@redhat.com Signed-off-by: Peter Maydell --- hw/virtio/virtio-iommu-pci.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c index 4588361d6b3..592abc9279c 100644 --- a/hw/virtio/virtio-iommu-pci.c +++ b/hw/virtio/virtio-iommu-pci.c @@ -33,6 +33,9 @@ struct VirtIOIOMMUPCI { =20 static Property virtio_iommu_pci_properties[] =3D { DEFINE_PROP_UINT32("class", VirtIOPCIProxy, class_code, 0), + DEFINE_PROP_ARRAY("reserved-regions", VirtIOIOMMUPCI, + vdev.nb_reserved_regions, vdev.reserved_regions, + qdev_prop_reserved_region, ReservedRegion), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -40,6 +43,7 @@ static void virtio_iommu_pci_realize(VirtIOPCIProxy *vpci= _dev, Error **errp) { VirtIOIOMMUPCI *dev =3D VIRTIO_IOMMU_PCI(vpci_dev); DeviceState *vdev =3D DEVICE(&dev->vdev); + VirtIOIOMMU *s =3D VIRTIO_IOMMU(vdev); =20 if (!qdev_get_machine_hotplug_handler(DEVICE(vpci_dev))) { MachineClass *mc =3D MACHINE_GET_CLASS(qdev_get_machine()); @@ -54,6 +58,13 @@ static void virtio_iommu_pci_realize(VirtIOPCIProxy *vpc= i_dev, Error **errp) "-no-acpi\n"); return; } + for (int i =3D 0; i < s->nb_reserved_regions; i++) { + if (s->reserved_regions[i].type !=3D VIRTIO_IOMMU_RESV_MEM_T_RESER= VED && + s->reserved_regions[i].type !=3D VIRTIO_IOMMU_RESV_MEM_T_MSI) { + error_setg(errp, "reserved region %d has an invalid type", i); + error_append_hint(errp, "Valid values are 0 and 1\n"); + } + } object_property_set_link(OBJECT(dev), OBJECT(pci_get_bus(&vpci_dev->pci_dev)), "primary-bus", &error_abort); --=20 2.20.1