From nobody Mon Feb 9 16:53:55 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1601887956; cv=none; d=zohomail.com; s=zohoarc; b=No/YPhe5mEPK5sv0Vn9wgUffK3WrmKgvAFDjHk1nh4cf7wjJV9zAL87fqwFfaEluWIAJx/m6OduNbO+x7S0OP5IxJR0YKEJG8wOuSANQEMQD1PcmeTWk5NO8Shj5iZRzTrkLxeIO6FzUHwdLZlArAVuNAAg06rOKEIrM5IfEhwA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601887956; h=Content-Transfer-Encoding:Cc: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=081ribZzsJC9K8QhvxDETxbGA4OIAPk4ZwZgtVwhNbg=; b=QJ5KABU3dRbb/pKFBEkCTPG1cB9famf34RPyAQAfZOe0MMGwmz4/OwC3obrb01VoNwZfOnBWb+ncPhUCEoXlVCPmM7zEdcnUkyRMMcKibmgbUNzTgrWW3Nus5MaOUseJirkUBxo7A7nShPmBFimcNBTWvfrwPAmHUYxvOOdWq/4= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601887956504260.4019030304594; Mon, 5 Oct 2020 01:52:36 -0700 (PDT) Received: from localhost ([::1]:40146 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPMEV-0004vM-91 for importer@patchew.org; Mon, 05 Oct 2020 04:52:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38540) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPLtS-0007qN-7B for qemu-devel@nongnu.org; Mon, 05 Oct 2020 04:30:50 -0400 Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]:38876) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kPLtO-0008OY-HJ for qemu-devel@nongnu.org; Mon, 05 Oct 2020 04:30:49 -0400 Received: by mail-lj1-x243.google.com with SMTP id w3so6596101ljo.5 for ; Mon, 05 Oct 2020 01:30:42 -0700 (PDT) Received: from navi.cosmonova.net.ua ([95.67.24.131]) by smtp.gmail.com with ESMTPSA id o27sm2585693lfb.306.2020.10.05.01.30.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Oct 2020 01:30:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=081ribZzsJC9K8QhvxDETxbGA4OIAPk4ZwZgtVwhNbg=; b=pYY6Gdj3b5gAdovqxO0KbcqY0TH1ukTcODULAQe3WsZKMrEDrcSp0ihR7RLFm0eDqQ A+sm+KwkXz6Vw568Cany4F4+zmlWqazWitxVTa2fzGgkOBlf5HSFP8eyLWISVXX7xGrS mg8mc/b4/Zl0KX27BJJ7Zdxl1cwHjskJiQgNdyahU+/Erm8On8ZE2AmqWxmgduOioPde pPEu+XVvsXiBUAGU/+KYj2zbEx4KjCg/dbEsXKUxzp65azxiRGHawJGHkKcrgH94+7C1 lEaFfj/4AKmX5KhfIBAnsNY0O/StH9HJWz+xy0ZiXtk/pTN//xRLChpDRkGeSy1gsmpx CPlg== 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=081ribZzsJC9K8QhvxDETxbGA4OIAPk4ZwZgtVwhNbg=; b=KBX1jMnrHTcPVhTg8KiaEAJqj0KNvswwlHy+G0aCUxxbq3Byi75eLQq+UDWsg3dsqX 8QGlqRtAM7nwQmfkfFrepne+ozrIVvXu7cM7SiIdkD7eYvybnFljQLVuTAgKSEYu4zdo tzSw3DjAWkpHt4tfBBGz9mIOZQVOpSzIH2Uz20tPYjph+TMtGteW6sIjfmKyjTxw4Jbv LFFNtEDdSWr2zGeAo9NfL2FiMQbIqkw/HnovEqEV6kEvjlDUXAXlM9sOZhyAr5pvFgsl udwq0bILzJq4Gmb4vuOCD5I/ZVPXGGT5M1ALOCEC829EZNv3401LxQuF4tjQ6DUglRu5 hOGg== X-Gm-Message-State: AOAM530Si2B8TEbUDwy7JpwF4gXpPMWZfQAke/TZyfeOXokYKrWWBH4S s4p2dS0ipwpjQYsJNNoEnd+Q37UMfIB46w== X-Google-Smtp-Source: ABdhPJwlP+Z8jpXwJ086Q1FlcMc4k5oKs9+so3chfSKP1ENj4X38ptIUOV0q6UUO+edtjqQhYhyB0w== X-Received: by 2002:a2e:9ad4:: with SMTP id p20mr4049747ljj.456.1601886641211; Mon, 05 Oct 2020 01:30:41 -0700 (PDT) From: andrew@daynix.com To: qemu-devel@nongnu.org Subject: [PATCH v2 1/2] hw/virtio-pci Added counter for pcie capabilities offsets. Date: Mon, 5 Oct 2020 12:01:39 +0300 Message-Id: <20201005090140.90461-2-andrew@daynix.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201005090140.90461-1-andrew@daynix.com> References: <20201005090140.90461-1-andrew@daynix.com> 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: none client-ip=2a00:1450:4864:20::243; envelope-from=andrew@daynix.com; helo=mail-lj1-x243.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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @daynix-com.20150623.gappssmtp.com) Content-Type: text/plain; charset="utf-8" From: Andrew Removed hardcoded offset for ats. Added cap offset counter for future capabilities like AER. Signed-off-by: Andrew Melnychenko --- hw/virtio/virtio-pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 5bc769f685..ae60c1e249 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1788,6 +1788,7 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Er= ror **errp) =20 if (pcie_port && pci_is_express(pci_dev)) { int pos; + uint16_t last_pcie_cap_offset =3D PCI_CONFIG_SPACE_SIZE; =20 pos =3D pcie_endpoint_cap_init(pci_dev, 0); assert(pos > 0); @@ -1823,7 +1824,8 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Er= ror **errp) } =20 if (proxy->flags & VIRTIO_PCI_FLAG_ATS) { - pcie_ats_init(pci_dev, 256); + pcie_ats_init(pci_dev, last_pcie_cap_offset); + last_pcie_cap_offset +=3D PCI_EXT_CAP_ATS_SIZEOF; } =20 if (proxy->flags & VIRTIO_PCI_FLAG_INIT_FLR) { --=20 2.28.0 From nobody Mon Feb 9 16:53:55 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1601888054; cv=none; d=zohomail.com; s=zohoarc; b=XAXWsjDUBy713q5p5hKpJ5DhcWcF6fhMRLcPjdxg9xEh5VWIh00ZPxxmJtUOFYrJ8Z4mwfRlejYvhZKu/lM0oYKmUydCwo10O3q4GojEj6ZrwrITF6+KGtWyH5tOqBRc1HCgnvVDnXdAKNmNgGMFXlj+aDBEcWQsilqPAnPdEew= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601888054; h=Content-Transfer-Encoding:Cc: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=bGpHgmFALb5nN7cwzPzCKDIbrvSvN3WF59KON2eM8BU=; b=iOJxfTJKDxMdBFjzYW/byExFZEdKsYz38W9U5OXMwJUi5wPdcXKWBla481oAb/YULow+GTcXiIrjeSGApmxNc+qSm+wwmkzSWUETKFT2O9PDHR4uXza/3iQpdEmGeKcVHwO9OskaTHGpw9qtsyhSuUO3OBTQxCWCW+1rX9FPmvI= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601888054315477.6196398717083; Mon, 5 Oct 2020 01:54:14 -0700 (PDT) Received: from localhost ([::1]:44254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPMG4-0006bn-Tg for importer@patchew.org; Mon, 05 Oct 2020 04:54:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38544) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPLtS-0007r6-HH for qemu-devel@nongnu.org; Mon, 05 Oct 2020 04:30:50 -0400 Received: from mail-lf1-x141.google.com ([2a00:1450:4864:20::141]:33292) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kPLtO-0008Of-IQ for qemu-devel@nongnu.org; Mon, 05 Oct 2020 04:30:50 -0400 Received: by mail-lf1-x141.google.com with SMTP id 77so9844990lfj.0 for ; Mon, 05 Oct 2020 01:30:44 -0700 (PDT) Received: from navi.cosmonova.net.ua ([95.67.24.131]) by smtp.gmail.com with ESMTPSA id o27sm2585693lfb.306.2020.10.05.01.30.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Oct 2020 01:30:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bGpHgmFALb5nN7cwzPzCKDIbrvSvN3WF59KON2eM8BU=; b=m5ZapRUEGC9lr9pL6OTuH1DAZnc9qZSrcixSiDUAEMBFA2zcriFUbBfUAMbe7l3oQZ HQGT20le7AwB/8MCFM0+qbLbCETBkiH0DVR2DRPgE5U/aYZvn1C06AU735tnFYjaSR3U WQNagGxdFX7GUoUjROaIW6uZPQdnYqplHwT+bhjS4eG26qN/OKTHl+06jOrAppFs9KuQ CMlAtBBB2ZKptJxxqvELcMJohmvOhVgomcA4JPWnkA0CKlucJKJI75mtzAZTOcI5W+xW re7jY9jJ3sS8/TE5rhtiq3uJyi9jQhPfJm0zZcOOOG00DIBqxNVDDEjpduAJPYFYwy5I vdsA== 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=bGpHgmFALb5nN7cwzPzCKDIbrvSvN3WF59KON2eM8BU=; b=j+GhMI9awVGLx914Hca2tnSbhtOXrXfDIWM/H8WLCBkRtm2PTCwD0UXGP6waX7vY3n K4nbagd8ZoJx+C8pynRTFi8CMmu+lVyOqM7u/YRbeqhUuoJcggfm67oFemlBf1RdksMX Dbm+5FylidY8I83pdYs0C3gL5R0o3BYXJEo32XrhmrhaAKU3NZty8zoX0pOeHUkPUKSd WuzOzPp5vOJhqXnw5/GE6kjMOizVIeb7Fydpvqn97al3zqNAFwxNy85wXdjHaYlD0BT3 0SbQfuRqOWN0b/Bj6H3KAJupRbPr8ki21s5kprOQBzCDdzjY0wgki7mlR1XokrntCpTw rTfg== X-Gm-Message-State: AOAM530enEmUb9qzoX0sI4dV8er468PLteOLU1Am+BchYC7mGnl1bznc kWO9lYzUixX1y+FzqbRFLQeyMzv3+uNLDg== X-Google-Smtp-Source: ABdhPJy4TerNR8Brc/L67h4p37/AM1OerC0p9GwGISmphizgcdhnpqPUVVlALA2g1tryD2K6hvgHoA== X-Received: by 2002:ac2:4c19:: with SMTP id t25mr4928931lfq.375.1601886642423; Mon, 05 Oct 2020 01:30:42 -0700 (PDT) From: andrew@daynix.com To: qemu-devel@nongnu.org Subject: [PATCH v2 2/2] hw/virtio-pci Added AER capability. Date: Mon, 5 Oct 2020 12:01:40 +0300 Message-Id: <20201005090140.90461-3-andrew@daynix.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201005090140.90461-1-andrew@daynix.com> References: <20201005090140.90461-1-andrew@daynix.com> 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: none client-ip=2a00:1450:4864:20::141; envelope-from=andrew@daynix.com; helo=mail-lf1-x141.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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @daynix-com.20150623.gappssmtp.com) Content-Type: text/plain; charset="utf-8" From: Andrew Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=3D1857668 Added AER capability for virtio-pci devices. Also added property for devices, by default AER is enabled. Signed-off-by: Andrew Melnychenko --- hw/virtio/virtio-pci.c | 16 ++++++++++++++++ hw/virtio/virtio-pci.h | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index ae60c1e249..e0a7936f9c 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1807,6 +1807,12 @@ static void virtio_pci_realize(PCIDevice *pci_dev, E= rror **errp) */ pci_set_word(pci_dev->config + pos + PCI_PM_PMC, 0x3); =20 + if (proxy->flags & VIRTIO_PCI_FLAG_AER) { + pcie_aer_init(pci_dev, PCI_ERR_VER, last_pcie_cap_offset, + PCI_ERR_SIZEOF, NULL); + last_pcie_cap_offset +=3D PCI_ERR_SIZEOF; + } + if (proxy->flags & VIRTIO_PCI_FLAG_INIT_DEVERR) { /* Init error enabling flags */ pcie_cap_deverr_init(pci_dev); @@ -1848,7 +1854,15 @@ static void virtio_pci_realize(PCIDevice *pci_dev, E= rror **errp) =20 static void virtio_pci_exit(PCIDevice *pci_dev) { + VirtIOPCIProxy *proxy =3D VIRTIO_PCI(pci_dev); + bool pcie_port =3D pci_bus_is_express(pci_get_bus(pci_dev)) && + !pci_bus_is_root(pci_get_bus(pci_dev)); + msix_uninit_exclusive_bar(pci_dev); + if (proxy->flags & VIRTIO_PCI_FLAG_AER && pcie_port && + pci_is_express(pci_dev)) { + pcie_aer_exit(pci_dev); + } } =20 static void virtio_pci_reset(DeviceState *qdev) @@ -1901,6 +1915,8 @@ static Property virtio_pci_properties[] =3D { VIRTIO_PCI_FLAG_INIT_PM_BIT, true), DEFINE_PROP_BIT("x-pcie-flr-init", VirtIOPCIProxy, flags, VIRTIO_PCI_FLAG_INIT_FLR_BIT, true), + DEFINE_PROP_BIT("aer", VirtIOPCIProxy, flags, + VIRTIO_PCI_FLAG_AER_BIT, false), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index 91096f0291..3986b4f0e3 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -45,6 +45,7 @@ enum { VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT, VIRTIO_PCI_FLAG_INIT_PM_BIT, VIRTIO_PCI_FLAG_INIT_FLR_BIT, + VIRTIO_PCI_FLAG_AER_BIT, }; =20 /* Need to activate work-arounds for buggy guests at vmstate load. */ @@ -84,6 +85,9 @@ enum { /* Init Function Level Reset capability */ #define VIRTIO_PCI_FLAG_INIT_FLR (1 << VIRTIO_PCI_FLAG_INIT_FLR_BIT) =20 +/* Advanced Error Reporting capability */ +#define VIRTIO_PCI_FLAG_AER (1 << VIRTIO_PCI_FLAG_AER_BIT) + typedef struct { MSIMessage msg; int virq; --=20 2.28.0