From patchwork Fri Sep 3 14:32:02 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: 506529 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp1053808jai; Fri, 3 Sep 2021 07:33:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyl+dRGSWlMy1xP+WrebYxXeQDo+MdYFvqSbZI86aSOjcaMeSUB2kU3VVaAUCr/mXETgA5j X-Received: by 2002:a1c:31c2:: with SMTP id x185mr734884wmx.192.1630679628309; Fri, 03 Sep 2021 07:33:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630679628; cv=none; d=google.com; s=arc-20160816; b=EThzv2guxE8bhfJF/CJgqRrn0i/ulFNQQLptmYV4LmiErFN7VpR235YLTCDgc0SUgU 8Bi8PgK9meu8QPxU4vwSPo1ok9ntNxxPs+Vafkpu9LPpN5sx5mgHVVFw5aULdSIUZhTH rHFzKCr9wVK8XT7M5Xd95xPzLToyd+7G3jnCIs5yxisbMyRnX+jKDMK6uJjIXbLCMVOP 2SA6nduXp5R4aDSb/KEm3qPbYHhXx3ZWcK1wlXhO7FI4lYTNSyJ6kfjs5OExiX1z0XNm eUniyTvcNd4TAwmhgStd8Zx4kg45504Jn19x6PC4CLXYvJI0HtQANykT+TEp8gyTrCal to3w== 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=nocKA961ViPzNqbUH/x+1dP7BZ4tC2NX/d0OA0oqeeI=; b=msyhTYGnD2nctTDwHSaygvIn1Wyq6fCnpuawywRVD3H92CYGwITuiwvCx5QeGNSkdT KCQUB1EopUym3I+7f3P8XAUGuhj6BFWXtRk3Axt5ViHH/K60tRNH/zP2EOClSJ63gFU0 5Z6S+qxNovtDfe0veBhHdu1JAmEsKNciDIzekOZ2U5k9c3Qz0QukVnpue6p3gnhptC8+ dTPGSE/6Nq4RFREyw/rAtysR63bXrZqVIb/EpzkG3bAByWLK4p681jKho4QqPSN8jjvM J7QgidjKjGAuLYItJqs1ROjnt1Ohz1MYql4F5LIL6Y8VnQqv2Inr90/f0w+z2Ds8E0BB YM8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Z72J+lyA; 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 u8si5513894wml.3.2021.09.03.07.33.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Sep 2021 07:33:48 -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=Z72J+lyA; 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]:52672 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMAGJ-0004Gs-8o for patch@linaro.org; Fri, 03 Sep 2021 10:33:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36736) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMAFF-0004EH-GV for qemu-devel@nongnu.org; Fri, 03 Sep 2021 10:32:41 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:39897) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mMAFD-0005aA-3v for qemu-devel@nongnu.org; Fri, 03 Sep 2021 10:32:41 -0400 Received: by mail-wr1-x436.google.com with SMTP id z4so8523022wrr.6 for ; Fri, 03 Sep 2021 07:32:37 -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=nocKA961ViPzNqbUH/x+1dP7BZ4tC2NX/d0OA0oqeeI=; b=Z72J+lyA6EN0MFsMVh4ZMhzgY+KUuESJt3g/37stB11n6NNveCgVVPoJa3K4479imH WEanpDXkzlPZarmh0apMsoc9TtzHsd9R4lKE8Iz2g+D5+5q6LYMSjHIpwYQ/MHxxiqz4 Bpj/X5FoVYYH2TxJuitt38pTRk+gSkIW9+ZS69M4IoygN0yLCJWV/lvkJlm4m3KPjbVF HhCd646l3SXsbQJIMWvgRb4yNO3f5/zBeX7k3aAcVAR9k/QUxSw4WTdRFplY5rbqw0tL 6dMeFSC5BEhXj+Og4nP7rrLRS5CBJrr/jB8KEsOYQKufn/5jHfWvVIllDESEbwvv3Zj5 9U3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nocKA961ViPzNqbUH/x+1dP7BZ4tC2NX/d0OA0oqeeI=; b=IRGGVLnArmrqB6UV3/U6ZjGsEr8poidfmRU+d5LZkZXm74Sd8xrON0LQq570t2R8Wi ksJNHm4FI5z52yw/5pykZaP5PbxtRmmczaitRYm8ft18CCcu/w9diQhvWYm+xAT1r/Td cEepbgsUwd1nHglOtVfbcV73Ww8J2EtTMVQMQiF+eP07m/MQGzTuvEoUWJduglh1WFzZ laczibi/uIric4aS5TKGeCiC0WHr1XGREIHrMx5KAVBQjXIRO9De48cUexAuGEHZgJal aAmVVVQtfPhM4TbEqIQVxSel8uBiW0FHY75lTlCY7s+9cCNxXNWf1mreku5qINyMtMWh UgJw== X-Gm-Message-State: AOAM530Cg5WTTNIY5jHrVb9L9YaHEYFr7WabDVsOyEubX/ErXNNJNBGA 3Vf5lHHgbA4nxWqcnSp8xWKDYg== X-Received: by 2002:adf:cc92:: with SMTP id p18mr4650699wrj.98.1630679556696; Fri, 03 Sep 2021 07:32:36 -0700 (PDT) Received: from localhost.localdomain (19.11.114.78.rev.sfr.net. [78.114.11.19]) by smtp.gmail.com with ESMTPSA id z2sm4314843wma.45.2021.09.03.07.32.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 07:32:36 -0700 (PDT) From: Jean-Philippe Brucker To: eric.auger@redhat.com Subject: [PATCH v2 1/8] acpi: Add VIOT structure definitions Date: Fri, 3 Sep 2021 16:32:02 +0200 Message-Id: <20210903143208.2434284-2-jean-philippe@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210903143208.2434284-1-jean-philippe@linaro.org> References: <20210903143208.2434284-1-jean-philippe@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=jean-philippe@linaro.org; helo=mail-wr1-x436.google.com X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SORBS_WEB=1.5, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, ehabkost@redhat.com, mst@redhat.com, richard.henderson@linaro.org, qemu-devel@nongnu.org, shannon.zhaosl@gmail.com, Jean-Philippe Brucker , qemu-arm@nongnu.org, pbonzini@redhat.com, imammedo@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The ACPI Virtual I/O Translation table (VIOT) table describes I/O topology for paravirtual devices. At the moment it describes the relation between virtio-iommu devices and their endpoints. Add the structure definitions for VIOT. Signed-off-by: Jean-Philippe Brucker --- Following the latest spec draft, and related acpica change https://jpbrucker.net/virtio-iommu/viot/viot-v9.pdf https://github.com/acpica/acpica/commit/fc4e33319c1ee08f20f5c44853dd8426643f6dfd --- include/hw/acpi/acpi-defs.h | 60 +++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) -- 2.33.0 diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h index cf9f44299c..adbf7d7b77 100644 --- a/include/hw/acpi/acpi-defs.h +++ b/include/hw/acpi/acpi-defs.h @@ -618,4 +618,64 @@ struct AcpiIortRC { } QEMU_PACKED; typedef struct AcpiIortRC AcpiIortRC; +/* + * Virtual I/O Translation Table + */ +struct AcpiViot { + ACPI_TABLE_HEADER_DEF + uint16_t node_count; + uint16_t node_offset; + uint8_t reserved[8]; +} QEMU_PACKED; +typedef struct AcpiViot AcpiViot; + +#define ACPI_VIOT_NODE_HEADER_DEF /* Fields common to all nodes */ \ + uint8_t type; \ + uint8_t reserved; \ + uint16_t length; + +/* Values for node Type above */ +enum { + ACPI_VIOT_NODE_PCI_RANGE = 0x01, + ACPI_VIOT_NODE_MMIO = 0x02, + ACPI_VIOT_NODE_VIRTIO_IOMMU_PCI = 0x03, + ACPI_VIOT_NODE_VIRTIO_IOMMU_MMIO = 0x04, +}; + +struct AcpiViotPciRange { + ACPI_VIOT_NODE_HEADER_DEF + uint32_t endpoint_start; + uint16_t segment_start; + uint16_t segment_end; + uint16_t bdf_start; + uint16_t bdf_end; + uint16_t output_node; + uint8_t reserved1[6]; +} QEMU_PACKED; +typedef struct AcpiViotPciRange AcpiViotPciRange; + +struct AcpiViotMmio { + ACPI_VIOT_NODE_HEADER_DEF + uint32_t endpoint; + uint64_t base_address; + uint16_t output_node; + uint8_t reserved1[6]; +} QEMU_PACKED; +typedef struct AcpiViotMmio AcpiViotMmio; + +struct AcpiViotVirtioIommuPci { + ACPI_VIOT_NODE_HEADER_DEF + uint16_t segment; + uint16_t bdf; + uint8_t reserved1[8]; +} QEMU_PACKED; +typedef struct AcpiViotVirtioIommuPci AcpiViotVirtioIommuPci; + +struct AcpiViotVirtioIommuMmio { + ACPI_VIOT_NODE_HEADER_DEF + uint8_t reserved1[4]; + uint64_t base_address; +} QEMU_PACKED; +typedef struct AcpiViotVirtioIommuMmio AcpiViotVirtioIommuMmio; + #endif From patchwork Fri Sep 3 14:32:03 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: 506531 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp1053988jai; Fri, 3 Sep 2021 07:34:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvWZA1jJMfz0k5P0DeMlIfhY88bFP5q3D4nJym7xVROZji4YbKdnjWy+2nC5I6oore4y8l X-Received: by 2002:a1f:9d12:: with SMTP id g18mr2888644vke.0.1630679642981; Fri, 03 Sep 2021 07:34:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630679642; cv=none; d=google.com; s=arc-20160816; b=Afoe7PYAOi1+7o0WzNLamsr0haYtnQNEFVfEnJde2j8VLbQfobvcse8Bc8Y8sBF4yB rH6ZWA4+mhOF27WoE6pZyixOg2GRACadpdfa5pibxJaVTaW6dFR1P5iplbf4vFkzHQcG C4vprXRDnbuU4y+jX3SJx36ahZ7zjka9GNWWYNkf0L+F+QTg3wu1obQBLbxippQ+3WGq OSbRKjU0zToPDJtEWyCQf5s9CBEwQldMhC0hHIjC0/udC/i+O5nV3F87rBvxbQKycBfr R/arbobl7P6uJjZSDqE4plxMNNoH+TcL3C1q+TdbxYjc5pT6kecoo4TZDeUPgUhZgE+T k+IQ== 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=91/qGg18RB6/bn19u1deI7Dumr8/hl1/EFuBxe/LBsA=; b=uKLjP7IZxJxffhiN1weuWf2/et7Vv6YJNLRH/CVCOR7HhBy1ENGWbHAiPNrhg2x6ZG AfqzCRWjcSawj/g0JdnNOm5IymnhQJN583QJBLgmoBWDYRWaW0MRxagfWDOekWHcLAod /Us/Abm0ZWKgOajg3OUQ5VR+L1FmhryKCQjKTJf05a80F9C5mInSu2YXVsCXX5S2thTF PjM1lLFgMiyEsznDFi4lvJ0LgUQ7jleqszSS/agmSt2lMYUXdxqZ1+yZOHVhzStGNwRc Z40z6XqzImMYBRTGF4qYHxtH7DiTVkwWiBr1RHyaJ5+0YG8EoYVdoINvfIpilFbw2C72 LbFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=GYzpEXYD; 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 x9si2483001uad.234.2021.09.03.07.34.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Sep 2021 07:34:02 -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=GYzpEXYD; 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]:53910 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMAGY-0005CE-1p for patch@linaro.org; Fri, 03 Sep 2021 10:34:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36812) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMAFH-0004Ff-9Z for qemu-devel@nongnu.org; Fri, 03 Sep 2021 10:32:43 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:35377) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mMAFD-0005bA-93 for qemu-devel@nongnu.org; Fri, 03 Sep 2021 10:32:42 -0400 Received: by mail-wr1-x431.google.com with SMTP id i6so8536071wrv.2 for ; Fri, 03 Sep 2021 07:32:38 -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=91/qGg18RB6/bn19u1deI7Dumr8/hl1/EFuBxe/LBsA=; b=GYzpEXYD14LgPeAS2AVPxL0UJp0+fE94q6djBrXIziIiVB/3UJrc5CizCtAB/yeq71 6+JKIqk6NmhDIaeMS5ygx29mQ21jZsxuxfcncwlA0wWS0XWsbjvufpRxJs789or5YTWM 2R1HnQywnUw7BJlg1/lP4sKwOVv5l7vdYLdJ364ORENJDnufNBMFvjLV+OA3k3ozp/I6 7AgxcRKIDq/L29+lkmdYeH7rMLX+AP6UjwlnxFVYfVYcszMsF9bLA4x7dVNXdJ/xnvYT Evp7xhd0Atjsh66qZaqmKfCNHsHNlIR71k5h3+cO0wiOH81Hfmcp7zOBSXM9woXX0ce0 fYcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=91/qGg18RB6/bn19u1deI7Dumr8/hl1/EFuBxe/LBsA=; b=rg2SfXxwyh7eYBT3NJHcxCW66rhLBD2d6S+tF4CleXDBOKqNBWasVeaY6PJwHFz3p3 MuA3iPgEnT7+5cnN/gEJrpRjb5TssybEL0fAJAZhIQO1Uu13Je9mhikWIB/uJIpfothh kWtP568dGm3LMDrWXRD7OFctcLslSxWAWynAq5wP/A2+YiGxsUYdQvfrYnAJTsr7rPgy HBlL90uB5S5sW53AerQ0/ewtkghZGEvr7r6Z5AavgKjl2GF3rgyb0aNEHt9sOpnnM3uB +5eNRVh8hsLDvWcUNyRPRwaxSIUIrUJnnWAD6cNbwWDcmmDrCp49fKMa0fQ/FHvger1L Zw1w== X-Gm-Message-State: AOAM5339aGZ9ImSxtLpjcsy18DIHGHINr3oGlDeYWO+7raffvtpqjKws 11JOsaWJy+UXWGsY/+c0Za9ciA== X-Received: by 2002:a05:6000:1623:: with SMTP id v3mr4623938wrb.288.1630679557888; Fri, 03 Sep 2021 07:32:37 -0700 (PDT) Received: from localhost.localdomain (19.11.114.78.rev.sfr.net. [78.114.11.19]) by smtp.gmail.com with ESMTPSA id z2sm4314843wma.45.2021.09.03.07.32.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 07:32:37 -0700 (PDT) From: Jean-Philippe Brucker To: eric.auger@redhat.com Subject: [PATCH v2 2/8] hw/acpi: Add VIOT table Date: Fri, 3 Sep 2021 16:32:03 +0200 Message-Id: <20210903143208.2434284-3-jean-philippe@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210903143208.2434284-1-jean-philippe@linaro.org> References: <20210903143208.2434284-1-jean-philippe@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=jean-philippe@linaro.org; helo=mail-wr1-x431.google.com X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 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, RCVD_IN_SORBS_WEB=1.5, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, ehabkost@redhat.com, mst@redhat.com, richard.henderson@linaro.org, qemu-devel@nongnu.org, shannon.zhaosl@gmail.com, Jean-Philippe Brucker , qemu-arm@nongnu.org, pbonzini@redhat.com, imammedo@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Add a function that generates a Virtual I/O Translation table (VIOT), describing the topology of paravirtual IOMMUs. The table is created when instantiating a virtio-iommu device. It contains a virtio-iommu node and PCI Range nodes for endpoints managed by the IOMMU. By default, a single node describes all PCI devices. When passing the "default_bus_bypass_iommu" machine option and "bypass_iommu" PXB option, only buses that do not bypass the IOMMU are described by PCI Range nodes. Signed-off-by: Jean-Philippe Brucker --- hw/acpi/Kconfig | 4 ++ hw/acpi/viot.h | 13 +++++ hw/acpi/viot.c | 112 ++++++++++++++++++++++++++++++++++++++++++++ hw/acpi/meson.build | 1 + 4 files changed, 130 insertions(+) create mode 100644 hw/acpi/viot.h create mode 100644 hw/acpi/viot.c -- 2.33.0 diff --git a/hw/acpi/Kconfig b/hw/acpi/Kconfig index cfc4ede8d9..abad79c103 100644 --- a/hw/acpi/Kconfig +++ b/hw/acpi/Kconfig @@ -41,6 +41,10 @@ config ACPI_VMGENID default y depends on PC +config ACPI_VIOT + bool + depends on ACPI + config ACPI_HW_REDUCED bool select ACPI diff --git a/hw/acpi/viot.h b/hw/acpi/viot.h new file mode 100644 index 0000000000..4cef29a640 --- /dev/null +++ b/hw/acpi/viot.h @@ -0,0 +1,13 @@ +/* + * ACPI Virtual I/O Translation Table implementation + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#ifndef VIOT_H +#define VIOT_H + +void build_viot(GArray *table_data, BIOSLinker *linker, + uint16_t virtio_iommu_bdf, const char *oem_id, + const char *oem_table_id); + +#endif /* VIOT_H */ diff --git a/hw/acpi/viot.c b/hw/acpi/viot.c new file mode 100644 index 0000000000..81bb2e93ff --- /dev/null +++ b/hw/acpi/viot.c @@ -0,0 +1,112 @@ +/* + * ACPI Virtual I/O Translation table implementation + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#include "qemu/osdep.h" +#include "hw/acpi/acpi.h" +#include "hw/acpi/aml-build.h" +#include "hw/acpi/viot.h" +#include "hw/pci/pci.h" +#include "hw/pci/pci_host.h" + +struct viot_pci_ranges { + GArray *blob; + size_t count; + uint16_t output_node; +}; + +/* Build PCI range for a given PCI host bridge */ +static int viot_host_bridges(Object *obj, void *opaque) +{ + struct viot_pci_ranges *pci_ranges = opaque; + GArray *blob = pci_ranges->blob; + + if (object_dynamic_cast(obj, TYPE_PCI_HOST_BRIDGE)) { + PCIBus *bus = PCI_HOST_BRIDGE(obj)->bus; + + if (bus && !pci_bus_bypass_iommu(bus)) { + int min_bus, max_bus; + + pci_bus_range(bus, &min_bus, &max_bus); + + /* Type */ + build_append_int_noprefix(blob, ACPI_VIOT_NODE_PCI_RANGE, 1); + /* Reserved */ + build_append_int_noprefix(blob, 0, 1); + /* Length */ + build_append_int_noprefix(blob, sizeof(AcpiViotPciRange), 2); + /* Endpoint start */ + build_append_int_noprefix(blob, PCI_BUILD_BDF(min_bus, 0), 4); + /* PCI Segment start */ + build_append_int_noprefix(blob, 0, 2); + /* PCI Segment end */ + build_append_int_noprefix(blob, 0, 2); + /* PCI BDF start */ + build_append_int_noprefix(blob, PCI_BUILD_BDF(min_bus, 0), 2); + /* PCI BDF end */ + build_append_int_noprefix(blob, PCI_BUILD_BDF(max_bus, 0xff), 2); + /* Output node */ + build_append_int_noprefix(blob, pci_ranges->output_node, 2); + /* Reserved */ + build_append_int_noprefix(blob, 0, 6); + + pci_ranges->count++; + } + } + + return 0; +} + +/* + * Generate a VIOT table with one PCI-based virtio-iommu that manages PCI + * endpoints. + */ +void build_viot(GArray *table_data, BIOSLinker *linker, + uint16_t virtio_iommu_bdf, const char *oem_id, + const char *oem_table_id) +{ + /* virtio-iommu node follows the header */ + int viommu_off = sizeof(AcpiViot); + int viot_start = table_data->len; + struct viot_pci_ranges pci_ranges = { + .output_node = viommu_off, + .blob = g_array_new(false, true, 1), + }; + + /* Build the list of PCI ranges that this viommu manages */ + object_child_foreach_recursive(object_get_root(), viot_host_bridges, + &pci_ranges); + + /* VIOT header */ + acpi_data_push(table_data, sizeof(AcpiTableHeader)); + /* Node count */ + build_append_int_noprefix(table_data, pci_ranges.count + 1, 2); + /* Node offset */ + build_append_int_noprefix(table_data, viommu_off, 2); + /* Reserved */ + build_append_int_noprefix(table_data, 0, 8); + + /* Virtio-iommu based on virtio-pci */ + /* Type */ + build_append_int_noprefix(table_data, ACPI_VIOT_NODE_VIRTIO_IOMMU_PCI, 1); + /* Reserved */ + build_append_int_noprefix(table_data, 0, 1); + /* Length */ + build_append_int_noprefix(table_data, sizeof(AcpiViotVirtioIommuPci), 2); + /* PCI Segment */ + build_append_int_noprefix(table_data, 0, 2); + /* PCI BDF number */ + build_append_int_noprefix(table_data, virtio_iommu_bdf, 2); + /* Reserved */ + build_append_int_noprefix(table_data, 0, 8); + + /* PCI ranges found above */ + g_array_append_vals(table_data, pci_ranges.blob->data, + pci_ranges.blob->len); + g_array_free(pci_ranges.blob, true); + + build_header(linker, table_data, (void *)(table_data->data + viot_start), + "VIOT", table_data->len - viot_start, 0, oem_id, oem_table_id); +} + diff --git a/hw/acpi/meson.build b/hw/acpi/meson.build index 29f804d13e..a510988b27 100644 --- a/hw/acpi/meson.build +++ b/hw/acpi/meson.build @@ -16,6 +16,7 @@ acpi_ss.add(when: 'CONFIG_ACPI_HW_REDUCED', if_true: files('generic_event_device acpi_ss.add(when: 'CONFIG_ACPI_HMAT', if_true: files('hmat.c')) acpi_ss.add(when: 'CONFIG_ACPI_APEI', if_true: files('ghes.c'), if_false: files('ghes-stub.c')) acpi_ss.add(when: 'CONFIG_ACPI_X86', if_true: files('piix4.c', 'pcihp.c')) +acpi_ss.add(when: 'CONFIG_ACPI_VIOT', if_true: files('viot.c')) acpi_ss.add(when: 'CONFIG_ACPI_X86_ICH', if_true: files('ich9.c', 'tco.c')) acpi_ss.add(when: 'CONFIG_IPMI', if_true: files('ipmi.c'), if_false: files('ipmi-stub.c')) acpi_ss.add(when: 'CONFIG_PC', if_false: files('acpi-x86-stub.c')) From patchwork Fri Sep 3 14:32:04 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: 506532 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp1055561jai; Fri, 3 Sep 2021 07:36:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1guR6JuYWB+WGE8zXzaxXm0+xl6NcUTvoB0J4alzsWa2ZRzRxri3lNPn5bzpVbsSOfqh5 X-Received: by 2002:a05:6102:34c9:: with SMTP id a9mr3079675vst.26.1630679777959; Fri, 03 Sep 2021 07:36:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630679777; cv=none; d=google.com; s=arc-20160816; b=AtwpdMXjt1hEUbHZ0DoCW1nKOLR3lgnWwGiBwk55qBTSJeYt0dMJohvNEc/sh/BU6L 0stZktJINqSvYCw7t9H+xrl1KkRhjaVby325taItpLQUYbptKN1HoQfJLneSuqxqDzOU 05SAZcO2b3Y3ogeRz24RpYK9Pt23vmnvG/JhPRR9W3j5Ls4gf6EvQzs/uqoaQceCETi2 o5QAiuUt4IoziwLP5hq1UhWRl90xfEhk7HSNfruaGGXNe/HPCoJ4ezri3ayrRWQePpG5 KqkyoN/lLFYKON05dzywTceq813p6TFDtXWx0dhAfvoCM5FiGCIh3e4E0LHUB/yDr0Z3 H5IQ== 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=r/iDZlUIiWksCDGamgB0/fI2nOB2PJMcezNLmt9rDEI=; b=f8Uj6X4eywJWKTkeBBNXnztVErpSBJKJ9Z7jibcMqPxfY6H+V4ckzWaDCDmV616qWP YJMbHV3BR/T5wWLgFI3IPDMyCyhjaaa42BcEoc+3pLb3uEULaD3N185FpAtTdUWSkKoU FdzzBDBaaQFoetc4keOJG5KwUjyg6MKX4ihbfakXJ8LXCqNePSQ6Qys0wdw2YZDdp0X7 x7ntbK4suBkE878BLnWfsmKUoczCCNFmI+C1lqzvvciAGrwVJs4ygCznwLX0Tsv1d31K Ub38V1wqYd8FgqQWDeDSo3Bc1H1tC5qgpQyP4apGVBZbU0sD0gJGQivJ9nL7tTjfLUKc fRYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=lVKWnYEl; 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 126si1016672vkb.5.2021.09.03.07.36.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Sep 2021 07:36:17 -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=lVKWnYEl; 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]:34278 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMAIj-0002Q3-9J for patch@linaro.org; Fri, 03 Sep 2021 10:36:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36788) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMAFG-0004Es-Pe for qemu-devel@nongnu.org; Fri, 03 Sep 2021 10:32:42 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:41556) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mMAFE-0005cT-Bw for qemu-devel@nongnu.org; Fri, 03 Sep 2021 10:32:42 -0400 Received: by mail-wm1-x32b.google.com with SMTP id u15-20020a05600c19cf00b002f6445b8f55so3747130wmq.0 for ; Fri, 03 Sep 2021 07:32:39 -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=r/iDZlUIiWksCDGamgB0/fI2nOB2PJMcezNLmt9rDEI=; b=lVKWnYElYrSuBWv0TUfIYfmzM/s8V1xj5XgKHpsWvs6TqIz7taY6Zf0cirPp8/CKzw fxI21FKcDXOpgj9Q4897KWRnjuLwdyIkek7pDIOcFWT/qyDpfpgWENbZaECe7FHm+JgU N/inlyZIhkmQsl+lw2xyf9Dv/lGUAsbItGgiHWWulQqO/SxXrNkS03MQw/7yNZZY6qTm 27SkXiG5sBsLecD0/dHvCZm1LILm9DUoZ3wFy93HTSqshrAPHSRcPw+DgQ7Zt+ET6unX gduTqymw0BXWFxIy9qgB7RFK7o2dVzJ1Y36WvD+tJiqdnO1CPjJxuxn1ilJ4mRiy3dJY G0iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=r/iDZlUIiWksCDGamgB0/fI2nOB2PJMcezNLmt9rDEI=; b=lgkT1zrvps3npVUuUouGRxz+wOvNzFORH2s2hpWOqWfqXUvItEcdYsMSxbFsO2rF4I cLwhOY3VcjU6FxMtOMhUwhd9daScBUQzD9sSO2P8XeDDJ5iE84fILLAT4h27ODCkybr1 X+dbB+OaZfFrZAPtQJDsqm5009czH6ZhJMebGiO2r2PlXygsr+j8oJjIofojQULEX9Qx cBYY5FVi0UlAaxe11hXAL6/QOY5ey1JlgiO3UplcBHMo+OohJJdz7XgB/zNtuV5OkLKL ikuzcqEnJI8/U9uXm7ripVE06oacFGgubrzK9YoFsC/GIi6bdhYIEQqjGkP1WWulU4gX jfbQ== X-Gm-Message-State: AOAM531xCGQG3DICbayuDDuciqMlwHdiFRXprfhSCeiKY9bcip4pQ48f eKEx2d1i2opscD5P2PJ958stnw== X-Received: by 2002:a7b:c92b:: with SMTP id h11mr733449wml.62.1630679559088; Fri, 03 Sep 2021 07:32:39 -0700 (PDT) Received: from localhost.localdomain (19.11.114.78.rev.sfr.net. [78.114.11.19]) by smtp.gmail.com with ESMTPSA id z2sm4314843wma.45.2021.09.03.07.32.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 07:32:38 -0700 (PDT) From: Jean-Philippe Brucker To: eric.auger@redhat.com Subject: [PATCH v2 3/8] hw/arm/virt-acpi-build: Add VIOT table for virtio-iommu Date: Fri, 3 Sep 2021 16:32:04 +0200 Message-Id: <20210903143208.2434284-4-jean-philippe@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210903143208.2434284-1-jean-philippe@linaro.org> References: <20210903143208.2434284-1-jean-philippe@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=jean-philippe@linaro.org; helo=mail-wm1-x32b.google.com X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SORBS_WEB=1.5, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, ehabkost@redhat.com, mst@redhat.com, richard.henderson@linaro.org, qemu-devel@nongnu.org, shannon.zhaosl@gmail.com, Jean-Philippe Brucker , qemu-arm@nongnu.org, pbonzini@redhat.com, imammedo@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" When a virtio-iommu is instantiated, describe it using the ACPI VIOT table. Signed-off-by: Jean-Philippe Brucker --- hw/arm/Kconfig | 1 + hw/arm/virt-acpi-build.c | 7 +++++++ 2 files changed, 8 insertions(+) -- 2.33.0 Reviewed-by: Eric Auger diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index 4ba0aca067..7da0422446 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -29,6 +29,7 @@ config ARM_VIRT select ACPI_HW_REDUCED select ACPI_NVDIMM select ACPI_APEI + select ACPI_VIOT config CHEETAH bool diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 037cc1fd82..e2fa677d80 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -55,6 +55,7 @@ #include "kvm_arm.h" #include "migration/vmstate.h" #include "hw/acpi/ghes.h" +#include "hw/acpi/viot.h" #define ARM_SPI_BASE 32 @@ -849,6 +850,12 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables) } #endif + if (vms->iommu == VIRT_IOMMU_VIRTIO) { + acpi_add_table(table_offsets, tables_blob); + build_viot(tables_blob, tables->linker, vms->virtio_iommu_bdf, + vms->oem_id, vms->oem_table_id); + } + /* XSDT is pointed to by RSDP */ xsdt = tables_blob->len; build_xsdt(tables_blob, tables->linker, table_offsets, vms->oem_id, From patchwork Fri Sep 3 14:32:05 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: 506534 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp1057955jai; Fri, 3 Sep 2021 07:38:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwojCqttmD3Sgsb2J7tCjqp604rWVuojnQzuCfIH2Vz0xRTxbNe7SDI9+E+D0ViMQTWbp+R X-Received: by 2002:a1f:1c04:: with SMTP id c4mr2794071vkc.6.1630679921176; Fri, 03 Sep 2021 07:38:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630679921; cv=none; d=google.com; s=arc-20160816; b=WIS3603uynP014PhKlBdFd5iXYPuoPSn6gFrAq9vKnND1zCI/l6lFJ/rn/5lVYNQuE j/oKSYbOPX+FRIBImP5mtnmIoQfUMxWQMX6BdQMSLwPuyUZKzBfkVoCvnIt1p3Ks+XJj qe1xDOmVFHjdZrz3afeyAGHtGRhF0orjqwMfwqnQg/aenvFLdoRASSaFVN9V5wGPlxeg DDHfrhi6p9mSCvPnpdlyobtQ8ATPdeI5oNbdTTJszOKEA9s37ee/RV9PoERI7eJs1QaI cqJxt9YQSw+JyabWzM52Kpi6PwVT98dYPhyeKI41vFQ6KWdQhQbThnd3D+rzBXWu72jN pJyw== 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=eo54h4KkqnKKCP3+eSELsEpD4Rb9+IjUu6cLRetgdhQ=; b=CAS5u61QooWlb8/W6e+ezO6CJ6W095pOXvn5hyBKVCtIRjLt2WmKciowFAJrQxpu1+ 7D7NYYC1n3CcZ/svtucBa1YeLvBlrOQNppVJbrnLlW7svYRZDUZvY1mvM213UzpWEmPs gMtS2N3UZ4P5lYO7K/DMxCW+ZG8LKH6TsDoMpnf44wG0RE0Y/Lfrh/igyTbp4GcZX6rn bCOhbEvWI9N21HIsM7Mt01jy3M4XEVUfVQA/tv4cyIufg0x7SjPi+2aRmMlFWPhI+jJZ hhVpxFf9U0NFTA7STkz1qa90JgG2zyD0/s+6O0hb68Bql/2VJIlv8q6T+0RK3jNXn3xe ibYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ScgXm3RE; 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 a37si424977uax.138.2021.09.03.07.38.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Sep 2021 07:38:41 -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=ScgXm3RE; 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]:41546 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMAL2-0007HI-Hz for patch@linaro.org; Fri, 03 Sep 2021 10:38:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36838) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMAFI-0004IA-5t for qemu-devel@nongnu.org; Fri, 03 Sep 2021 10:32:44 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:46733) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mMAFF-0005dr-PE for qemu-devel@nongnu.org; Fri, 03 Sep 2021 10:32:43 -0400 Received: by mail-wr1-x433.google.com with SMTP id x6so8497059wrv.13 for ; Fri, 03 Sep 2021 07:32:41 -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=eo54h4KkqnKKCP3+eSELsEpD4Rb9+IjUu6cLRetgdhQ=; b=ScgXm3RESccpMpDfCMkTfu/IHJwp9dlW070uJ8iLHVbRvSdXp4cryVAFll4jU8a6R3 DLOIW0gJQKjE4TShxEQUPHPX9ZBto9wW8XZZdWZb8HIZmnPasOoqaPZ7ZwrxpNY1F1r8 rQSW9HKjic7Y41mSRv5Pm+o6nN6dy/4t1dsRHe5JKQo5zDt/eyCTRscOVRYhTKJE59/2 Ep31GDVp6nczQnA8R5UFPCqFqR/clb92b5+bL3Bffr+KjJp4SAX83JyClJVh3dHCkLe1 gZIJl2I7ICUAbNtyTcN40Linjxy91fOjOi5g+MJ5oCym4KckefZ7PYznusguQlOoSL8x hYAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eo54h4KkqnKKCP3+eSELsEpD4Rb9+IjUu6cLRetgdhQ=; b=J7s/MUozXU7bNYL18gymZo0wU1EDdnzkA011UKeM683OjccfmqVypPmkZ6T5/qOApN 8ZGNGt3Cy8BxgVaoS7fnDHhQbgsZffxcvHtGCZJQAiXvC/vYYUdYHzYjJUBp7/4mmCBI /6re/nuKwfkJhrMsvmLMfhqy/R+SEZsm6OrXdl0rEBOyyW4P+q08SfI1jpVVRnRyJlnA gLTZ/G0K8R01sZdLU442aUH1U5h8a40JW2+9ynfmmDY4gz/SuXLuCMsaBMf/ySC2BLGZ WbHu+xv7dGg0u+cYmdvWT+jwYigl4jigBp/jxIsVGuUuz4KfNj9z0n+h9XQMwOX8Dqnh sQPQ== X-Gm-Message-State: AOAM532ovdPhz7mjH70M5qTwU8OlhdjyNBm+n9LX+y10Fqf6ZQ0wOCgd 9wHZHaCsSRDDMWwNMYxUPhvpmA== X-Received: by 2002:adf:e449:: with SMTP id t9mr4429438wrm.135.1630679560389; Fri, 03 Sep 2021 07:32:40 -0700 (PDT) Received: from localhost.localdomain (19.11.114.78.rev.sfr.net. [78.114.11.19]) by smtp.gmail.com with ESMTPSA id z2sm4314843wma.45.2021.09.03.07.32.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 07:32:39 -0700 (PDT) From: Jean-Philippe Brucker To: eric.auger@redhat.com Subject: [PATCH v2 4/8] hw/arm/virt: Remove device tree restriction for virtio-iommu Date: Fri, 3 Sep 2021 16:32:05 +0200 Message-Id: <20210903143208.2434284-5-jean-philippe@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210903143208.2434284-1-jean-philippe@linaro.org> References: <20210903143208.2434284-1-jean-philippe@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=jean-philippe@linaro.org; helo=mail-wr1-x433.google.com X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 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, RCVD_IN_SORBS_WEB=1.5, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, ehabkost@redhat.com, mst@redhat.com, richard.henderson@linaro.org, qemu-devel@nongnu.org, shannon.zhaosl@gmail.com, Jean-Philippe Brucker , qemu-arm@nongnu.org, pbonzini@redhat.com, imammedo@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" virtio-iommu is now supported with ACPI VIOT as well as device tree. Remove the restriction that prevents from instantiating a virtio-iommu device under ACPI. Signed-off-by: Jean-Philippe Brucker --- hw/arm/virt.c | 10 ++-------- hw/virtio/virtio-iommu-pci.c | 7 ------- 2 files changed, 2 insertions(+), 15 deletions(-) -- 2.33.0 Reviewed-by: Eric Auger diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 81eda46b0b..b4598d3fe6 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2551,16 +2551,10 @@ static HotplugHandler *virt_machine_get_hotplug_handler(MachineState *machine, MachineClass *mc = MACHINE_GET_CLASS(machine); if (device_is_dynamic_sysbus(mc, dev) || - (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM))) { + object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM) || + object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) { return HOTPLUG_HANDLER(machine); } - if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) { - VirtMachineState *vms = VIRT_MACHINE(machine); - - if (!vms->bootinfo.firmware_loaded || !virt_is_acpi_enabled(vms)) { - return HOTPLUG_HANDLER(machine); - } - } return NULL; } diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c index 770c286be7..f30eb16cbf 100644 --- a/hw/virtio/virtio-iommu-pci.c +++ b/hw/virtio/virtio-iommu-pci.c @@ -48,16 +48,9 @@ static void virtio_iommu_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) VirtIOIOMMU *s = VIRTIO_IOMMU(vdev); if (!qdev_get_machine_hotplug_handler(DEVICE(vpci_dev))) { - MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine()); - - error_setg(errp, - "%s machine fails to create iommu-map device tree bindings", - mc->name); error_append_hint(errp, "Check your machine implements a hotplug handler " "for the virtio-iommu-pci device\n"); - error_append_hint(errp, "Check the guest is booted without FW or with " - "-no-acpi\n"); return; } for (int i = 0; i < s->nb_reserved_regions; i++) { From patchwork Fri Sep 3 14:32:06 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: 506530 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp1053934jai; Fri, 3 Sep 2021 07:34:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwznsQJZWIB4+zBMYANRx8+b4TftRcoMz2IvERpJrxCSgBEAW9+tqBbvBEnRgOaHG5CB8T5 X-Received: by 2002:a1c:791a:: with SMTP id l26mr726105wme.100.1630679641213; Fri, 03 Sep 2021 07:34:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630679641; cv=none; d=google.com; s=arc-20160816; b=SfQ2XuPspxgfYw6qKVgEeg5uJnbWSeMQm1BasW7Sgn1GCebOhAnmAUAffPH5Nf2usC rcAd0wTDymopX1xXMhkAh5rz31vkNP1BR5mGWEg7PBCTcDusv4BiEnqjXsERLtuavC0c S0fKeglJikh7hNuUd05H8qfYrU81LanVfOECYasqPsKbPjbUFSO+aMrnrBC/Zt4UOGd9 c8vK1bbvjam/1uUj6seNDp9jIhaUGFTl2g/eK2gQb3RRJycv34SlLVcNqO8rhOgo+7Cf nA/AO1N3RsEW8GFcbm7M70EkVXxK2gCMEFke9OCO0cknKbiTaZPrQLpjDvNemfC8XaM3 UYug== 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=UxcqYjdwb5grCsEtYCrZaLaggu6vBfiVHeFPBWbw7CM=; b=LuiaGeydE1TuSw2ncyJ4QNq5aXnDUEyw4kO7AZFnEmuFWMHlKFtRKSL8CxE1JHnxFE DN8Yu9eAa3ifILdPTJEL1qXKErS6W/T1GC+gGSqB7imJC9US+Dkds/txQZZNplkFU0+t 0nkwhtpxjCUZhYONc+KuHaJsAKwTsq7SNWhnNA/xM56R/1HCMRgak5933PRhFPLtfwCV RZVYOIFjq3ozvdIRIR0AhNc/bGM56eIMaV1GRLypifwaC9j1cr9mVnbQ5A+DUcVEQ/Uu l7Ax6I0Lrhj3T7aKR9kL9q1VhkjpUX5xbegh9ZHw1DUM+SX7kIqTxYafZjbPm/q5gZ7e y+sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=IIV+j1dS; 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 v16si5166206wrn.119.2021.09.03.07.34.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Sep 2021 07:34:01 -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=IIV+j1dS; 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]:53940 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMAGW-0005DS-6g for patch@linaro.org; Fri, 03 Sep 2021 10:34:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36860) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMAFI-0004JH-KG for qemu-devel@nongnu.org; Fri, 03 Sep 2021 10:32:45 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:38472) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mMAFG-0005eI-Rf for qemu-devel@nongnu.org; Fri, 03 Sep 2021 10:32:44 -0400 Received: by mail-wm1-x329.google.com with SMTP id k5-20020a05600c1c8500b002f76c42214bso3923203wms.3 for ; Fri, 03 Sep 2021 07:32:42 -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=UxcqYjdwb5grCsEtYCrZaLaggu6vBfiVHeFPBWbw7CM=; b=IIV+j1dSH7z4li39LHeHXAEnltDMk8/0yqjw3UGhfTaou44HOQt01kRTmhHTbqbbhS dOqkINoUG3zl8a5fk5ugqT4AxUiZ311Q0zm0kmsTZ5QaJNt3V2v+WUBqobInRJzJIprR OUDypIGqYuC74QcEDsrUAWOdiMckpab4lu0riCvmPqfNGwBIKqOTx8Bl1c8ag5VAbHV4 bFMvnhJ+OyIBu3mrNHcQyf5XfkiSwfgGCy1gA55qruSsqDWNZjrnN6e8r0r6x0PBfJZr t8bmNKekRLCMTmEirEVmmEcEdnfVeY9O7Qk1a97Jj+jsXkDTn6M2z7KkjoQr0hjJzHop Gv3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UxcqYjdwb5grCsEtYCrZaLaggu6vBfiVHeFPBWbw7CM=; b=Iu2hmUT2YMjF8fBv+RtNzn6pkRmpPc1nepFah2b4jxqi0YxaCJEDZugPfTixdnV0lR kzoPj7BYzgDS9zKnq8aXQaxYGQyUufF+CQjUfx0bCkR7o6BULCehkNUoMDRVw76zhO98 3D/AR4PwGWJ6JOgiyhMwQce5bKYz7/9QXRhq8+KUyz5iiMUWR3Lq2GDDQeeNtyexJyNf +WdAQMWwXHfiQmSihwlJtNCrMo9eW4GkLkrIjxN5qLzR8Fkw3ij8yqLsXvq8wJUxttez 9aUSUfes5CQsLGNaHEVsjTxt+uiMnJvAvFT9sxI4zTQIST1iNVkavMgIAUrYnj1GUyRJ gR3A== X-Gm-Message-State: AOAM533jDmF4iXvPJEMIKHpTp/bTGJQn5eqLOAdrDEmyN16GGWCXRzEG 5+r0NOyqFYUBr0g0iK3AnhEX5g== X-Received: by 2002:a1c:a903:: with SMTP id s3mr648689wme.171.1630679561543; Fri, 03 Sep 2021 07:32:41 -0700 (PDT) Received: from localhost.localdomain (19.11.114.78.rev.sfr.net. [78.114.11.19]) by smtp.gmail.com with ESMTPSA id z2sm4314843wma.45.2021.09.03.07.32.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 07:32:41 -0700 (PDT) From: Jean-Philippe Brucker To: eric.auger@redhat.com Subject: [PATCH v2 5/8] hw/arm/virt: Reject instantiation of multiple IOMMUs Date: Fri, 3 Sep 2021 16:32:06 +0200 Message-Id: <20210903143208.2434284-6-jean-philippe@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210903143208.2434284-1-jean-philippe@linaro.org> References: <20210903143208.2434284-1-jean-philippe@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=jean-philippe@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 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, RCVD_IN_SORBS_WEB=1.5, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, ehabkost@redhat.com, mst@redhat.com, richard.henderson@linaro.org, qemu-devel@nongnu.org, shannon.zhaosl@gmail.com, Jean-Philippe Brucker , qemu-arm@nongnu.org, pbonzini@redhat.com, imammedo@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. Signed-off-by: Jean-Philippe Brucker --- hw/arm/virt.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.33.0 Reviewed-by: Eric Auger diff --git a/hw/arm/virt.c b/hw/arm/virt.c index b4598d3fe6..5ca225291f 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2475,6 +2475,11 @@ static void virt_machine_device_plug_cb(HotplugHandler *hotplug_dev, if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) { PCIDevice *pdev = PCI_DEVICE(dev); + if (vms->iommu != VIRT_IOMMU_NONE) { + error_setg(errp, "virt machine does not support multiple IOMMUs"); + return; + } + vms->iommu = VIRT_IOMMU_VIRTIO; vms->virtio_iommu_bdf = pci_get_bdf(pdev); create_virtio_iommu_dt_bindings(vms); From patchwork Fri Sep 3 14:32:07 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: 506535 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp1059632jai; Fri, 3 Sep 2021 07:40:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwG/y6yG+XEvvCAWyje5uM+keUMwns1wJdL/Yjs1MzVtDMAMvQb2dY6Tybk0DPs6Lmkc5G5 X-Received: by 2002:a67:cd91:: with SMTP id r17mr3187281vsl.20.1630680031898; Fri, 03 Sep 2021 07:40:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630680031; cv=none; d=google.com; s=arc-20160816; b=YN3DgcArZaLpEM9/VgzYTJLU2tU7WKAjoKHszLHp3WMK17sJaOIT2NpPJvveYxM30g l8TgjvmQwp6P25/ugD0ySC4nWYA62QO+i2LVCt6ys8/cGiEvmuaC6Dfr4krFFPk2aKcy 1PpR6A6cmh1LAkSOy4teafA7xiTcLgNbcup4EGa0bQdMvAHcQAuKWAqNHdzPQ0tDkHFE UpOEFgmKVGKGDG348wg8fekADyoXBajRQxNAtjQ970CLZTL5G9/S0+loF/hcgAxwzore wfjnOADE1VfTvwKeROEfmqgxq9yLsBVlu3OtVGDGU+6gi1siCWoDTwI4MEwNvPUD+VyD 3vzw== 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=ML4iX6CFCZNHlVUqfCS6XVSF7GyOD2bEAeWn+nVwWZ4=; b=wYb8NfsRd4BOcqraA6+dY3dDy1fKqJ/XJk5kQJ4TjEf+sdM5K4AWiDzcWsB4Yx+YMm 6F1I7NfhaRg1tPCiPdrxSH8hVEcnxOJvg3yDer2GuWtwc9iy5hO7WC1swkJpPVMXrQCp fuAFnFYiBrSYEtsgzcPDp0ZJ5/0Bfb+Vw/xT2T9n0/5RL0zWdflmqtFO4u9sT9d9Px3m 8W0/CyZgDVj6cPaZzWeD8vKw7otqeRaNXH2+MxTjF9nu0aT698IqNbHaPli8loixnIMJ g6BikhtwyXbRgXE0gLwryvgcwcZ25Ux1QrBey2O7AgQelUvr4FSl/QcVJbrKY78kI+Dy iLHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Jp3N57nQ; 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 s27si2753965vsa.279.2021.09.03.07.40.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Sep 2021 07:40: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=Jp3N57nQ; 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]:45238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMAMp-0001Pz-B2 for patch@linaro.org; Fri, 03 Sep 2021 10:40:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36898) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMAFJ-0004MI-MY for qemu-devel@nongnu.org; Fri, 03 Sep 2021 10:32:47 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:45579) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mMAFI-0005gp-2b for qemu-devel@nongnu.org; Fri, 03 Sep 2021 10:32:45 -0400 Received: by mail-wr1-x435.google.com with SMTP id n5so8500801wro.12 for ; Fri, 03 Sep 2021 07:32:43 -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=ML4iX6CFCZNHlVUqfCS6XVSF7GyOD2bEAeWn+nVwWZ4=; b=Jp3N57nQeWK9FnE2qNloGy3jMZaRiAsKcWsu94VHm7GdypSuZhachsocQkSmJiKnH8 jvHEE7iCIQQK5/SK6HSl8Fc5gSvSbOwnAHuAhJtFicQc4y2UNwrEaxpee0WDB4IudajO HE++DjngBdOfnjNQPP5ge2lTPef8MsK8UZYDIHghybqH9to5/Y1qptHua9pyVcJ96iyG jWU1ADgEZsuSsXs26YmHC47dMDpYkxbqLEbNdamxIyied9me3JNoES+FlavI6BnxTBeN Lc7i4K7u7opnKTBFrSkc+c5/jKgPW9Kw9Wfdyj1QOE1wmnMi8a8+aU2FJRoKi+NQpulE Gelw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ML4iX6CFCZNHlVUqfCS6XVSF7GyOD2bEAeWn+nVwWZ4=; b=MbWasJcdhckntRJElr3lnUK3ZpDaOXR08vlJRzQ2h5uyJzf1nRMURb4AvH3e6hpAFc eZKqdjxhNjP+cQBvR/42Uyvv40ZY6Pba2PCjkzHBIpB6/+wETpxAUryi1Onpemc/RaCs T5N3wV0cwV3rNMsWkL/X+6N6RLvVMlamDIC9LMkC/wvlDD5vYjz9t8Etp6Q8nk+J1sYU wI8O2gp5pCdKlcOslRm0urQAK0KBNHsdsKWRcqmriN100gNVGZaxn7YE37DnUMugg52d WDHoSiBsrN8e+8OEWT7+VhOZgODLhW+S1Jrk4MRL5+ZxlLlGYtcEdOp9IZvA25cymTf2 vwZw== X-Gm-Message-State: AOAM530sgwcbu5TYqtJCTd8nA9mjwrYCbxn+hseSg/Kb9eZJF3IhvRpc I69iYOr1qL+hzio6ZQCO+bSTtA== X-Received: by 2002:adf:b781:: with SMTP id s1mr4533749wre.165.1630679562704; Fri, 03 Sep 2021 07:32:42 -0700 (PDT) Received: from localhost.localdomain (19.11.114.78.rev.sfr.net. [78.114.11.19]) by smtp.gmail.com with ESMTPSA id z2sm4314843wma.45.2021.09.03.07.32.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 07:32:42 -0700 (PDT) From: Jean-Philippe Brucker To: eric.auger@redhat.com Subject: [PATCH v2 6/8] pc: Add VIOT table for virtio-iommu Date: Fri, 3 Sep 2021 16:32:07 +0200 Message-Id: <20210903143208.2434284-7-jean-philippe@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210903143208.2434284-1-jean-philippe@linaro.org> References: <20210903143208.2434284-1-jean-philippe@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=jean-philippe@linaro.org; helo=mail-wr1-x435.google.com X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SORBS_WEB=1.5, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, ehabkost@redhat.com, mst@redhat.com, richard.henderson@linaro.org, qemu-devel@nongnu.org, shannon.zhaosl@gmail.com, Jean-Philippe Brucker , qemu-arm@nongnu.org, pbonzini@redhat.com, imammedo@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The ACPI Virtual I/O Translation table (VIOT) describes the relation between a virtio-iommu and the endpoints it manages. When a virtio-iommu device is instantiated, add a VIOT table. Signed-off-by: Jean-Philippe Brucker --- hw/i386/Kconfig | 1 + include/hw/i386/pc.h | 2 ++ hw/i386/acpi-build.c | 5 +++++ hw/i386/pc.c | 7 +++++++ 4 files changed, 15 insertions(+) -- 2.33.0 diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig index ddedcef0b2..13db05d557 100644 --- a/hw/i386/Kconfig +++ b/hw/i386/Kconfig @@ -54,6 +54,7 @@ config PC_ACPI select ACPI_X86 select ACPI_CPU_HOTPLUG select ACPI_MEMORY_HOTPLUG + select ACPI_VIOT select SMBUS_EEPROM select PFLASH_CFI01 depends on ACPI_SMBUS diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 88dffe7517..979b8d0b7c 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -45,6 +45,8 @@ typedef struct PCMachineState { bool pit_enabled; bool hpet_enabled; bool default_bus_bypass_iommu; + bool virtio_iommu; + uint16_t virtio_iommu_bdf; uint64_t max_fw_size; /* NUMA information: */ diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index a33ac8b91e..078b7f5c6f 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -71,6 +71,7 @@ #include "hw/acpi/ipmi.h" #include "hw/acpi/hmat.h" +#include "hw/acpi/viot.h" /* These are used to size the ACPI tables for -M pc-i440fx-1.7 and * -M pc-i440fx-2.0. Even if the actual amount of AML generated grows @@ -2559,6 +2560,10 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine) build_dmar_q35(tables_blob, tables->linker, x86ms->oem_id, x86ms->oem_table_id); } + } else if (pcms->virtio_iommu) { + acpi_add_table(table_offsets, tables_blob); + build_viot(tables_blob, tables->linker, pcms->virtio_iommu_bdf, + x86ms->oem_id, x86ms->oem_table_id); } if (machine->nvdimms_state->is_enabled) { nvdimm_build_acpi(table_offsets, tables_blob, tables->linker, diff --git a/hw/i386/pc.c b/hw/i386/pc.c index c2b9d62a35..694fc9ce07 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -84,6 +84,7 @@ #include "hw/i386/intel_iommu.h" #include "hw/net/ne2000-isa.h" #include "standard-headers/asm-x86/bootparam.h" +#include "hw/virtio/virtio-iommu.h" #include "hw/virtio/virtio-pmem-pci.h" #include "hw/virtio/virtio-mem-pci.h" #include "hw/mem/memory-device.h" @@ -1388,6 +1389,12 @@ static void pc_machine_device_plug_cb(HotplugHandler *hotplug_dev, } else if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_PMEM_PCI) || object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_MEM_PCI)) { pc_virtio_md_pci_plug(hotplug_dev, dev, errp); + } else if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) { + PCMachineState *pcms = PC_MACHINE(hotplug_dev); + PCIDevice *pdev = PCI_DEVICE(dev); + + pcms->virtio_iommu = true; + pcms->virtio_iommu_bdf = pci_get_bdf(pdev); } } From patchwork Fri Sep 3 14:32:08 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: 506533 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp1056185jai; Fri, 3 Sep 2021 07:36:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIt5Mdda+i0/fnkJFTokTRB0JhmeN9pQ5hc2G4xlylkXMjAJuvGrjTlNQZpG0LJAdUpFDP X-Received: by 2002:a5d:4ac2:: with SMTP id y2mr4601087wrs.296.1630679817874; Fri, 03 Sep 2021 07:36:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630679817; cv=none; d=google.com; s=arc-20160816; b=o8vhcCKL+5IHOtPAMDCwXH32CLkGDWeHkjyft8ndsklAlNZX0OD/GodjsK1llC+Zty qUrT3TbP9F1GzNP7Co6GJ0a9KWA1iKJx13mi5CDj6B7PNSkQoo3kux4jWUy7gOC1o31e m2x+jpVLGoicS+71zajdlcPPtWd1UTFTjmcKWeGl00fcsNn2UlXxUl99Z13f2o9qGZUI yIev8+EG0617T0Gls2Uf9Jvv5XQnH64EorkxzHSy0Y2rmBHGGSbYy42D4A53lAhgXEyW K9jhyogVNIlg8aZJC5uSU1OnsXA9wWQfRZDT1FuNfblhzPk59Od/2jwzw9kTwx00t7KN P2tw== 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=94WuptPyOzTpjzAbl+X3deh0A1E8Zn+KEwD/QXX5ut0=; b=CZDlkzQhIzx3RbihqNgTKpc1Fgdu5u7i7aq29RA6Nror8s+SNIJcHqMKxV3rdhQfq0 JATq36L16S+vWBjnAqn3+Bx4+iNcF7MDCGBsn70QRSP8rgP0xa2qDNWEF8ooY3VuoIks MrWYe8kcmrOqj5/XIgozurWM656+jrSXFZ6sqdtQIpM2tMZ/VWOME5L4xkqLA2YkvS8d NY+7AvFqEexRnreGTLG6PAmfOR6jdeq2KvoGiJ3ryPWG8ksFjvwIl06lyuwrncMcpF2f GmUs56z8OcqWLkwVvivek47inMXiFs6tgiQdnRWzqEQ/xAEcSFtnSnzTkaAxhvL043+I I/rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=SVHqGfUk; 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 r203si273775wma.35.2021.09.03.07.36.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Sep 2021 07:36:57 -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=SVHqGfUk; 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]:35882 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMAJM-0003ST-QI for patch@linaro.org; Fri, 03 Sep 2021 10:36:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36930) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMAFL-0004NL-KW for qemu-devel@nongnu.org; Fri, 03 Sep 2021 10:32:51 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:46732) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mMAFJ-0005ib-8M for qemu-devel@nongnu.org; Fri, 03 Sep 2021 10:32:46 -0400 Received: by mail-wr1-x431.google.com with SMTP id x6so8497293wrv.13 for ; Fri, 03 Sep 2021 07:32:44 -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=94WuptPyOzTpjzAbl+X3deh0A1E8Zn+KEwD/QXX5ut0=; b=SVHqGfUk5gdz5MMZMSjEadUWc884a4J/GEq9zsK0zpWsom3HsrJcgE1mtZU8a99TKY k635YlVzRYlFA0f46bZuTcNzZ3wGa5P6qEsjMB6oezyfqGiMa2y8y+A4OZ6aNymWzf1O XbFluwslPdUziTWubYgNfqk3t4m6svcylF8FXMKjlM4I4TAkuNRaKbEvQlprsZm6hyQR iyiGXguOXYiGbV188r6hdxh8sTI+1dVvnX4XfQk2onGoTlr7dWkjQeyOT+iIWGl3gOoJ J1ZgqQm0yB4lA0PyWwiZUPBtehORaU3FKxzpj0Jbswm3CsD/UjTZ+AGvqayCfgKiX4UA sryw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=94WuptPyOzTpjzAbl+X3deh0A1E8Zn+KEwD/QXX5ut0=; b=clOLq1r2paoj0YeRatO8CZYanRuxJ6szro+ekRs+r27LwYWohtgkd+lYKLk5WQGbM3 pyruy3DUuFkbE1b9rm3npiMrCGYQgyJIgxDgT3VW5n5Ff9loIwLZ5pIXX1Ywp22holws 8odfEX6xZHWrYFe185JHIgMt2Iu3Nx3GbKJfWDcTGWGMVvgJ1Idkpg6YbRfgqVAEZqrg PICthSaQKe+iOZFtA+mSLdAsF1Wu9Bk/i7gjdO9vOuDey/gmMjALRGVChp/eAWrsUz/t HAqAGZuIAJjfoVYc6J/Ule+ez6JpWEKnrnBD6eL1iUQoLPs7xyhr5JdUbwY92uHY43Re T7RQ== X-Gm-Message-State: AOAM531FEoXMAUuDGbDeXuy7mqkPgiMcmvPs2wx58EcLRjmYBwv92ZFa SN+7ejChbhXhHgsNiJtkW0vrpA== X-Received: by 2002:a05:6000:188d:: with SMTP id a13mr4553910wri.99.1630679563819; Fri, 03 Sep 2021 07:32:43 -0700 (PDT) Received: from localhost.localdomain (19.11.114.78.rev.sfr.net. [78.114.11.19]) by smtp.gmail.com with ESMTPSA id z2sm4314843wma.45.2021.09.03.07.32.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 07:32:43 -0700 (PDT) From: Jean-Philippe Brucker To: eric.auger@redhat.com Subject: [PATCH v2 7/8] pc: Allow instantiating a virtio-iommu device Date: Fri, 3 Sep 2021 16:32:08 +0200 Message-Id: <20210903143208.2434284-8-jean-philippe@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210903143208.2434284-1-jean-philippe@linaro.org> References: <20210903143208.2434284-1-jean-philippe@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=jean-philippe@linaro.org; helo=mail-wr1-x431.google.com X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 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, RCVD_IN_SORBS_WEB=1.5, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, ehabkost@redhat.com, mst@redhat.com, richard.henderson@linaro.org, qemu-devel@nongnu.org, shannon.zhaosl@gmail.com, Jean-Philippe Brucker , qemu-arm@nongnu.org, pbonzini@redhat.com, imammedo@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Eric Auger Add a hotplug handler for virtio-iommu on x86 and set the necessary reserved region property. On x86, the [0xfee00000, 0xfeefffff] DMA region is reserved for MSIs. DMA transactions to this range either trigger IRQ remapping in the IOMMU or bypasses IOMMU translation. Although virtio-iommu does not support IRQ remapping it must be informed of the reserved region so that it can forward DMA transactions targeting this region. Signed-off-by: Eric Auger Signed-off-by: Jean-Philippe Brucker --- hw/i386/pc.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) -- 2.33.0 diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 694fc9ce07..c1e1cffe16 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -797,6 +797,11 @@ void pc_machine_done(Notifier *notifier, void *data) "irqchip support."); exit(EXIT_FAILURE); } + + if (pcms->virtio_iommu && x86_iommu_get_default()) { + error_report("QEMU does not support multiple vIOMMUs for x86 yet."); + exit(EXIT_FAILURE); + } } void pc_guest_info_init(PCMachineState *pcms) @@ -1376,6 +1381,14 @@ static void pc_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev, } else if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_PMEM_PCI) || object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_MEM_PCI)) { pc_virtio_md_pci_pre_plug(hotplug_dev, dev, errp); + } else if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) { + /* Declare the reserved MSI region */ + char *resv_prop_str = g_strdup_printf("0xfee00000:0xfeefffff:%d", + VIRTIO_IOMMU_RESV_MEM_T_MSI); + + qdev_prop_set_uint32(dev, "len-reserved-regions", 1); + qdev_prop_set_string(dev, "reserved-regions[0]", resv_prop_str); + g_free(resv_prop_str); } } @@ -1393,6 +1406,11 @@ static void pc_machine_device_plug_cb(HotplugHandler *hotplug_dev, PCMachineState *pcms = PC_MACHINE(hotplug_dev); PCIDevice *pdev = PCI_DEVICE(dev); + if (pcms->virtio_iommu) { + error_setg(errp, + "QEMU does not support multiple vIOMMUs for x86 yet."); + return; + } pcms->virtio_iommu = true; pcms->virtio_iommu_bdf = pci_get_bdf(pdev); } @@ -1436,7 +1454,8 @@ static HotplugHandler *pc_get_hotplug_handler(MachineState *machine, if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM) || object_dynamic_cast(OBJECT(dev), TYPE_CPU) || object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_PMEM_PCI) || - object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_MEM_PCI)) { + object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_MEM_PCI) || + object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) { return HOTPLUG_HANDLER(machine); } From patchwork Fri Sep 3 14:32:09 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: 506536 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp1060726jai; Fri, 3 Sep 2021 07:41:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpPMtw7OkOcWKbBrjenLo6Afui1mZHGAalmQV4QlLAkuQKLHsgmZr5D7n13YMZCFGSFwXS X-Received: by 2002:a67:a24f:: with SMTP id t15mr2984465vsh.25.1630680112457; Fri, 03 Sep 2021 07:41:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630680112; cv=none; d=google.com; s=arc-20160816; b=evsZNgeY6Bk9cHW04zBJdGKcADLL5fucs6hCGAtNa6OsbIpfnrwiO9wiLzyT2MMg4z 0aYy7phzpX1USdJBS0JRIFxW041MZ0znuDBnrk8NvwaHnDYaRnwxyLGHExGZ1/gjEE3S uMWfs87mUK5WhaDFnubm6yNqX9WKR6bTOLWWHkGEqmFvurK6I5gI1G1v0vCq+rHSJOC0 IA95nrda4BurBTJa2g9MgHYw2qEbHAEb5djRQo5HiVh0urq3dO2bwu+IXexzUYmswzef t5Z+EUnprfe6N/SIeWNCpAk8Y0R2sNufq2h5wnqHOMBc4EaGXGE4Tnu6+rc+eu59Zqti lbYw== 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=fY5SdPSeZ+nzP/hRNCu8jlFl6ZP6Y10Sub0ilphjxgs=; b=WBHUwWsTGtgMBcnQMHDxq6CjqP1/M5OU1xJALYa1+gmm4cPYF8wzXYusWiv2mfvJr8 kVJgh5r8171FcmHHe8HKa8jWNBvUXtAD0E7LpwH33+TopRP05o3u/HJ9xhGTy83rH7IL uX+qyVlf35Eg9Yg8WLImlz94rVvainv4j7XLCczZ1pFKc681pXwhYSe/S3c2/YRgJO2F 1iuWAZm0HPBITcb2n1S40LMIKptt6qmduqEsTBteHK2bdq/9YFBncCJcPOGETdh/9lmc KZ8n9gBqnslZ2grvmiarkTtt2AX+0OLQANR4p+vevMk/d2REenhMumGDzmUNGZjGzkmd OlIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=eyDOK78g; 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 l1si2382941vsj.297.2021.09.03.07.41.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Sep 2021 07:41:52 -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=eyDOK78g; 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]:47330 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMAO7-0002vC-Sz for patch@linaro.org; Fri, 03 Sep 2021 10:41:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36952) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMAFM-0004Os-Sp for qemu-devel@nongnu.org; Fri, 03 Sep 2021 10:32:52 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:52076) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mMAFL-0005j6-CK for qemu-devel@nongnu.org; Fri, 03 Sep 2021 10:32:48 -0400 Received: by mail-wm1-x329.google.com with SMTP id u15so3652842wmj.1 for ; Fri, 03 Sep 2021 07:32:45 -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=fY5SdPSeZ+nzP/hRNCu8jlFl6ZP6Y10Sub0ilphjxgs=; b=eyDOK78gtwil10Bk1rn1CGTdZwVLTfjjB4us3m1an2HQcZW/OeAEWM6Tm34Z0RwpIf Dl6PuHM1qpKQWDL5Q8BHHqd7XQzUw/3Kx6OtjhOJ8fAFOwh7VUg1FbUxB43B1Tnnk0vi IeSqP2KN6553JREKkD0w8BSVPNqZUZr6smTmUOoQqCAaBHP2uhScV0w3c4caiAnkhFwG iKXYSA2V/v2NivcxJBbmpR9eCct2AxelZt88ShgTdtewrwadFCSSBuqlmBZdohI9ci0s eWt++nbdfexM6y3miHsqdp+6wpF08PSYfaO1sR5bVnAfG53xg5rSmDFhgpoyi/OspbMi UY0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fY5SdPSeZ+nzP/hRNCu8jlFl6ZP6Y10Sub0ilphjxgs=; b=Uawb6V4nnPwSCxmrCA/13Tk7q34UxfkvoaOzQaNXVXXxHCgAOeSR7nw3dx78F6U8ZD hQ6Vo2TYIFb+aOa4M18W5UfOFnp99OQpRx5fuePBKuxDzzb0gxqDB+VjOfhkD5T/j3IO Xg3K/DBjUkVDTeip+HWn2PI8wKFbmyFFY01a04LkCd9+++daYy4Cvwc+pkhDmL/Jm/GX 5Tmw47XX5r+bvICJ4u7FzvV+epU96P4yQOK7dkxltVSxfg5MJNDQBmtTOuj/RrqkoU+7 sqpeR8AkDb4+D5FkgGlxaKtSp5GgkzoxvDak23A19hoFrKEJd+8Mzorxt8F97FhqtJLh 7drw== X-Gm-Message-State: AOAM530RRKjWlDMr1O35eT7Q9VsrIMbS05fmmKpNy+jVWLeIbhyoxAOY ji89nsXDShDn/aiFtdsabD6l2w== X-Received: by 2002:a1c:3b8a:: with SMTP id i132mr682400wma.145.1630679564993; Fri, 03 Sep 2021 07:32:44 -0700 (PDT) Received: from localhost.localdomain (19.11.114.78.rev.sfr.net. [78.114.11.19]) by smtp.gmail.com with ESMTPSA id z2sm4314843wma.45.2021.09.03.07.32.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 07:32:44 -0700 (PDT) From: Jean-Philippe Brucker To: eric.auger@redhat.com Subject: [PATCH v2 8/8] docs: Add '-device virtio-iommu' entry Date: Fri, 3 Sep 2021 16:32:09 +0200 Message-Id: <20210903143208.2434284-9-jean-philippe@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210903143208.2434284-1-jean-philippe@linaro.org> References: <20210903143208.2434284-1-jean-philippe@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=jean-philippe@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SORBS_WEB=1.5, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, ehabkost@redhat.com, mst@redhat.com, richard.henderson@linaro.org, qemu-devel@nongnu.org, shannon.zhaosl@gmail.com, Jean-Philippe Brucker , qemu-arm@nongnu.org, pbonzini@redhat.com, imammedo@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Document the virtio-iommu device for qemu-system-x86_64. In particular note the lack of interrupt remapping, which may be an important limitation on x86. Suggested-by: Eric Auger Signed-off-by: Jean-Philippe Brucker --- qemu-options.hx | 3 +++ 1 file changed, 3 insertions(+) -- 2.33.0 diff --git a/qemu-options.hx b/qemu-options.hx index 83aa59a920..9a1906a748 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -976,6 +976,9 @@ SRST Please also refer to the wiki page for general scenarios of VT-d emulation in QEMU: https://wiki.qemu.org/Features/VT-d. +``-device virtio-iommu`` + Enable a paravirtual IOMMU, that manages DMA isolation and remapping + for all PCI devices, but does not support interrupt remapping. ERST DEF("name", HAS_ARG, QEMU_OPTION_name,