From nobody Mon Feb 9 10:54:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=1607001900; cv=none; d=zohomail.com; s=zohoarc; b=YLQB4IpS09p5GuK4XdxdAagOcFwwkMy36iuDXLrnkbknO232mZZTbGjMvs/yF3oAMnQRwW/uETHsakuga+aK0uxh1k6lXh0IrWgJkEf/I2VIpNCWzIrEDH+ndVcIqU+E2fvNxvqNs8wrgmWkOvkqmPPGQnx7xRCeZDmN+F8Piu8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607001900; 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=mwUYW1H+JzV3/GtHWdM4HHeVaxmgzWJndCsLs+sl1Ng=; b=W1pYzTJ4vMO42fi/aBqbuNMI48wbZcwqB+JAotWvaT8nAs3adnE1kGgezqu9VTx1HwwvxJVH4X668rAB2ATwHVpa1sqms7u4t3pvCw5dT2dOOojC1ugASx/wE/Nz//V2t4zSOSboThxQ/lgDWsaStD2kuU0CrIfM7bgMFP1G32c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 1607001900901542.169016651118; Thu, 3 Dec 2020 05:25:00 -0800 (PST) Received: from localhost ([::1]:56944 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kkoDV-0004sG-PM for importer@patchew.org; Thu, 03 Dec 2020 08:00:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46204) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kko6K-0004NH-Um for qemu-devel@nongnu.org; Thu, 03 Dec 2020 07:52:48 -0500 Received: from mail-lf1-x142.google.com ([2a00:1450:4864:20::142]:46686) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kko6J-0008L1-9g for qemu-devel@nongnu.org; Thu, 03 Dec 2020 07:52:48 -0500 Received: by mail-lf1-x142.google.com with SMTP id t6so2506090lfl.13 for ; Thu, 03 Dec 2020 04:52:46 -0800 (PST) Received: from navi.cosmonova.net.ua ([95.67.24.131]) by smtp.gmail.com with ESMTPSA id b17sm499891lfc.93.2020.12.03.04.52.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2020 04:52:45 -0800 (PST) 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=mwUYW1H+JzV3/GtHWdM4HHeVaxmgzWJndCsLs+sl1Ng=; b=BgtQsK8CYLko5vgcOxproEXQ+73QQbr4gxZ080r7M9VDB9OnsVvv/yMggb00l9xIJh zNtThGLLBVrnx/1zg6n/xQoB5vuWRyY/L1SpPs/mr3lBuTqimQkVdE+1GQNJJE3c7MvU 4pOY96mx1gfX/XMnhBRGAKpQbGfB7t6PD1jP9DOsJqgmaYSsqN0UpClaj2AC7VBIEQ/G mdfiEbU+Qf5C731hM05I4xJdZBRtQPNfk4X8oXvY86cFPFWNTtbAyPJWg8cxgdKIQOYJ egr/q/FFnOyjKGOAKRFfJbh+XsmNaAjfV7hc0kBoNC0qH2RXjImLTWTc7zx83sJL9IrN tT+A== 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=mwUYW1H+JzV3/GtHWdM4HHeVaxmgzWJndCsLs+sl1Ng=; b=Ac6v0ZCCwISN9RWuiAQJn468bPcaIPChgKd54xEZeED2FtVgWLX6FUSg74dS/QcGQf ELJcJvaSDtE/C03iceK+BUwtb2yESmw9Nzooy7fsdHk0WhmFEAit8ySemNlG2hENFP2F OsrjdijcNi4LDqWQXIbyIOAh7ZgvGz8BnCuS0t+bj8fggP+lCTNZ8Tw0g715XJEtIi5D oeXCxp3lAEMgT+c1PEFnYOysy77JFZjSl9LdF3nVV2YsKC5HGDd1NWwtEcDIzJ4EVOkN kMd3TOFa9ljhC7LzRmwHM0kKEBGNdASoslnZ9kKCcR8rUfBH6Lx3DL/xzLNrzlbwnDmn tDPA== X-Gm-Message-State: AOAM533+FGdpZfwhzBiLSJOF4eFRUjEj0q9ecd9SRWSQRxsHvT72Dlr4 nWaf4A/VRx/MTinzeNnjV3BwUg== X-Google-Smtp-Source: ABdhPJyN5qjL2Ch9BCOndJjC6c1/mY97x20lmlcEG6wsT8I74Ek4oUXSdyd+jvXvJIWLoyJD26UxVQ== X-Received: by 2002:a19:404a:: with SMTP id n71mr1248846lfa.493.1606999965731; Thu, 03 Dec 2020 04:52:45 -0800 (PST) From: Andrew Melnychenko To: mst@redhat.com Subject: [PATCH v4 1/2] hw/virtio-pci Added counter for pcie capabilities offsets. Date: Thu, 3 Dec 2020 15:25:16 +0200 Message-Id: <20201203132517.220811-2-andrew@daynix.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201203132517.220811-1-andrew@daynix.com> References: <20201203132517.220811-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::142; envelope-from=andrew@daynix.com; helo=mail-lf1-x142.google.com 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: intel-wired-lan@lists.osuosl.org, qemu-devel@nongnu.org, alexander.duyck@gmail.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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 36524a5728..ceaa233129 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1798,6 +1798,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); @@ -1833,7 +1834,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.29.2 From nobody Mon Feb 9 10:54:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=1607002011; cv=none; d=zohomail.com; s=zohoarc; b=N5A1vR5hwa+rn3voD27/p0QoNxWlZp2Qb25T+lpdTZ7C+QHiV4nE1vPlAgsn6OY29wnAWek3xjlJnjt6o4z0UAnwQplT9hiWaxrlJE20vKCjGk0FSu5hTPERWB6we5frhGkTzcgY1k+V+Jd7nTIGlXjL610sPJUACDYyyez3C3E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607002011; 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=FTIXK8Mp2m2AMw0jbqYrjv2kNQYnyeKPV4gyIZ7wxG8=; b=c7mbyTQ6CUfMFZDmxe9jE4BWYK2vUK3DMEZmmL5dV5aYgKEAZPhNf2QB1kioSniSszH0bsnvTfZm1UGS8L1d9vgfxcS+3rZxY+dBHTs2HWluP0e6vGDLDiBqpjl4+4NghX6MQYK3vBCvLclbpG5R5zBMgzhxFbhUkOs2Mh6pFSM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 1607002011306348.47835163995273; Thu, 3 Dec 2020 05:26:51 -0800 (PST) Received: from localhost ([::1]:44058 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kkoKn-0003EL-4f for importer@patchew.org; Thu, 03 Dec 2020 08:07:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46222) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kko6Q-0004RY-EE for qemu-devel@nongnu.org; Thu, 03 Dec 2020 07:52:54 -0500 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]:41081) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kko6K-0008LB-Ki for qemu-devel@nongnu.org; Thu, 03 Dec 2020 07:52:54 -0500 Received: by mail-lj1-x22e.google.com with SMTP id y7so2377417lji.8 for ; Thu, 03 Dec 2020 04:52:48 -0800 (PST) Received: from navi.cosmonova.net.ua ([95.67.24.131]) by smtp.gmail.com with ESMTPSA id b17sm499891lfc.93.2020.12.03.04.52.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2020 04:52:46 -0800 (PST) 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=FTIXK8Mp2m2AMw0jbqYrjv2kNQYnyeKPV4gyIZ7wxG8=; b=DHHGScHIEY4eeaYDHRrLaWRaPURzlxOs2Qt3/jxPJ6VJwmbNEg4BXXU0QyM8CcTqwy UJpv+4nSRYB/3838yNsBmM2+Smw4c3iQZt7wGNgkcNPDaYAFZV/QMSnmofrgQ1EEw4lK /oIPm5GSc0qAFxjydCMzZvqHvEsVtuQZquP5V2+LmxlzBdYDBhUi+3d4lom6WhWA0sjZ 0e0PBg+VjD97axM4lFdWdvX7qhzzGleU30J0k+KElA8cnB/3QwMORc8WmaTFSK8JQe2p jTxrUzTW+HVKKXLl3ALxZUizt+0HUEsGG50JX09tipY40Djp0necYZfByW3MT7kCfv1B SXPg== 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=FTIXK8Mp2m2AMw0jbqYrjv2kNQYnyeKPV4gyIZ7wxG8=; b=QTvd5uRgPWbPLTrG7SpzMCyJMCe6LGIfdQgh15hFOlJz2kYcdWCA+tZR2R2NMh5Hkr GvwDMSz8/Rnu+BTSAyjdZtiISKEco6mff/9R77xF2Nhp0BJYp0+I8sCp+rhzpiKKeUcj CYQGXO0skkWwdycAHCYvgzOikOALEgPUW3NxYiKTAxyT9FloougPcjnmoaRDQ6bNjn77 48ZZgDy+uK8Ij9FyYbMxJdUCHVwPWF+sqtDwJq6BkcZ+//vdvmZVWCkUQIO05E8tngOG i0G6qMt8FdcvdY4CD+GnhDBcV3Qvm0NQqBXiyIk2Qu5uqYKhPaEPTKqOkN5kzcJTefoK Cl9w== X-Gm-Message-State: AOAM531T5HvbI85Ec4pMBRziU+Se2Os7f1EWkunbkwar6qVcEiNIu+WD Bv38huzfFzllCDwWuEjTdEhsIQUwIir4hg== X-Google-Smtp-Source: ABdhPJxn1bvdWXhv3IKmZGiLEM1k3xmR58U7g0UqRt9c+jaSnwAF76IK04kNNB5wYuoxCuQzagpPEA== X-Received: by 2002:a05:651c:1033:: with SMTP id w19mr1201668ljm.55.1606999966900; Thu, 03 Dec 2020 04:52:46 -0800 (PST) From: Andrew Melnychenko To: mst@redhat.com Subject: [PATCH v4 2/2] hw/virtio-pci Added AER capability. Date: Thu, 3 Dec 2020 15:25:17 +0200 Message-Id: <20201203132517.220811-3-andrew@daynix.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201203132517.220811-1-andrew@daynix.com> References: <20201203132517.220811-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::22e; envelope-from=andrew@daynix.com; helo=mail-lj1-x22e.google.com 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: intel-wired-lan@lists.osuosl.org, qemu-devel@nongnu.org, alexander.duyck@gmail.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Andrew Added AER capability for virtio-pci devices. Also added property for devices, by default AER is disabled. 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 ceaa233129..f863f69ede 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1817,6 +1817,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); @@ -1858,7 +1864,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) @@ -1911,6 +1925,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 06e2af12de..d7d5d403a9 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -41,6 +41,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. */ @@ -80,6 +81,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.29.2