From nobody Sun May 5 03:13:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oracle.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529429985863547.7008998164841; Tue, 19 Jun 2018 10:39:45 -0700 (PDT) Received: from localhost ([::1]:44101 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVKbZ-00005r-7C for importer@patchew.org; Tue, 19 Jun 2018 13:39:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55453) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVJYw-0004NA-2L for qemu-devel@nongnu.org; Tue, 19 Jun 2018 12:33:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVJYr-0002WZ-5s for qemu-devel@nongnu.org; Tue, 19 Jun 2018 12:32:58 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:40262) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fVJYq-0002V7-U3 for qemu-devel@nongnu.org; Tue, 19 Jun 2018 12:32:53 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w5JGTH5l037326; Tue, 19 Jun 2018 16:32:51 GMT Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2jmu6xrxnm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Jun 2018 16:32:51 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w5JGWouY019809 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Jun 2018 16:32:50 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w5JGWnd6011482; Tue, 19 Jun 2018 16:32:49 GMT Received: from localhost.localdomain (/10.159.242.141) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 19 Jun 2018 09:32:49 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=HbvTfZA7anu8+VdsXzTl/GpfQOo++KIboOUh2squQCo=; b=Mg0pLF+Yj03ComaYUDZnZ3HQ0rmEuUcYxfYtQhMwJ+iNNofUO4KTbVqKFgMkmz5wcnTY lS8VH05xSE/m1OzILtbjjy3HcK9KF6C7CkZUkvSzxp6Y6hDYJxyuvU6eZ+YGSNmev991 Ks7n6H5qi71RA7/asr5JDyEUGNcJuKLoRL1dNQK3s4RahiEk/C7iPhGLZ7s61YYY8ZwW qYQLwQMAizHWllr5543DWOehstn4mn36aoom4vowH2gfj1Ewi/H4PiQ5EIDX+zAgNhzW 3OOthOCLeWWn2Pch6z7+Mrtt4P5W117CB/owC66p38nY5KKHCVbVMzm1bIiGwx/ShF8Y Fg== From: Venu Busireddy To: venu.busireddy@oracle.com, "Michael S . Tsirkin" , Marcel Apfelbaum Date: Tue, 19 Jun 2018 11:32:25 -0500 Message-Id: <20180619163228.13790-2-venu.busireddy@oracle.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180619163228.13790-1-venu.busireddy@oracle.com> References: <20180619163228.13790-1-venu.busireddy@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8929 signatures=668702 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806190182 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 156.151.31.85 X-Mailman-Approved-At: Tue, 19 Jun 2018 13:31:57 -0400 Subject: [Qemu-devel] [PATCH 1/3] Add a true or false option to the DEFINE_PROP_UUID macro. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: virtio-dev@lists.oasis-open.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It may not always be desirable to have a random UUID stuffed into the '_field' member. Add a new option '_default' to the macro, that will allow the caller to specify if a random UUID needs be generated or not. Also modified the instance where this macro is used. Signed-off-by: Venu Busireddy --- hw/acpi/vmgenid.c | 2 +- include/hw/qdev-properties.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/acpi/vmgenid.c b/hw/acpi/vmgenid.c index d78b579a20..6d53757ee5 100644 --- a/hw/acpi/vmgenid.c +++ b/hw/acpi/vmgenid.c @@ -215,7 +215,7 @@ static void vmgenid_realize(DeviceState *dev, Error **e= rrp) } =20 static Property vmgenid_device_properties[] =3D { - DEFINE_PROP_UUID(VMGENID_GUID, VmGenIdState, guid), + DEFINE_PROP_UUID(VMGENID_GUID, VmGenIdState, guid, true), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 4f60cc88f3..7d39a4bdcd 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -218,12 +218,12 @@ extern const PropertyInfo qdev_prop_off_auto_pcibar; DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_off_auto_pcibar, \ OffAutoPCIBAR) =20 -#define DEFINE_PROP_UUID(_name, _state, _field) { \ +#define DEFINE_PROP_UUID(_name, _state, _field, _default) { \ .name =3D (_name), \ .info =3D &qdev_prop_uuid, \ .offset =3D offsetof(_state, _field) \ + type_check(QemuUUID, typeof_field(_state, _field)), \ - .set_default =3D true, \ + .set_default =3D _default, \ } =20 #define DEFINE_PROP_END_OF_LIST() \ From nobody Sun May 5 03:13:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oracle.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529429661002301.48883316946694; Tue, 19 Jun 2018 10:34:21 -0700 (PDT) Received: from localhost ([::1]:44058 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVKWJ-0004uh-Qf for importer@patchew.org; Tue, 19 Jun 2018 13:34:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55645) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVJZD-0004Xf-2X for qemu-devel@nongnu.org; Tue, 19 Jun 2018 12:33:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVJZ8-0002lg-51 for qemu-devel@nongnu.org; Tue, 19 Jun 2018 12:33:15 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:41566) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fVJZ7-0002kl-Sw for qemu-devel@nongnu.org; Tue, 19 Jun 2018 12:33:10 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w5JGT4e6015409; Tue, 19 Jun 2018 16:33:08 GMT Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2jmt01h1v0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Jun 2018 16:33:08 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w5JGX7bK000763 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Jun 2018 16:33:07 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w5JGX7mB011598; Tue, 19 Jun 2018 16:33:07 GMT Received: from localhost.localdomain (/10.159.242.141) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 19 Jun 2018 09:33:07 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=uuyYpnTzEd8cgP7+4gJazis1YaczLuMQyk8tpdNB5NU=; b=QTvNatVMqrczDBC4zBwIJvu3hHLzJZ9LP6mxnQTpkbME1Fq6SprzX05sN/wLutUwOqV5 05D1QtRDGmJj0edObvjubJGgMa8sPFxBwHYEmVBt5frN6HEH3ymBIKT6zktDJtE5sm1F i+c8IpJ/qQZt0tDUdjcfc+f2IekrEeG185pkRQN7SbfSDoADQZCdpCAO7nRpdldDg+Bv BHt3+5scIY90rurrCa0TJ7z/ke+UhE9JOPuGooiSw5pk7hQsTDMmWGlmswr436LySDVp F/w6CeFI7kKZlVXx93VhjYJQRie2vB+o6abrSm7iVBDXhVtOQ0ybgCdsZp+LT8xwmZaB nw== From: Venu Busireddy To: venu.busireddy@oracle.com, "Michael S . Tsirkin" , Marcel Apfelbaum Date: Tue, 19 Jun 2018 11:32:28 -0500 Message-Id: <20180619163228.13790-5-venu.busireddy@oracle.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180619163228.13790-1-venu.busireddy@oracle.com> References: <20180619163228.13790-1-venu.busireddy@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8929 signatures=668702 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806190182 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 156.151.31.86 X-Mailman-Approved-At: Tue, 19 Jun 2018 13:31:57 -0400 Subject: [Qemu-devel] [PATCH virtio 1/1] Add "Group Identifier" support to virtio PCI capabilities. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: virtio-dev@lists.oasis-open.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add VIRTIO_PCI_CAP_GROUP_ID_CFG (Group Identifier) capability to the virtio PCI capabilities to allow for the grouping of devices. Signed-off-by: Venu Busireddy --- content.tex | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/content.tex b/content.tex index 7a92cb1..7ea6267 100644 --- a/content.tex +++ b/content.tex @@ -599,6 +599,8 @@ The fields are interpreted as follows: #define VIRTIO_PCI_CAP_DEVICE_CFG 4 /* PCI configuration access */ #define VIRTIO_PCI_CAP_PCI_CFG 5 +/* Group Identifier */ +#define VIRTIO_PCI_CAP_GROUP_ID_CFG 6 \end{lstlisting} =20 Any other value is reserved for future use. @@ -997,6 +999,47 @@ address \field{cap.length} bytes within a BAR range specified by some other Virtio Structure PCI Capability of type other than \field{VIRTIO_PCI_CAP_PCI_CFG}. =20 +\subsubsection{Group Identifier capability}\label{sec:Virtio Transport Opt= ions / Virtio Over PCI Bus / PCI Device Layout / Group Identifier capabilit= y} + +The VIRTIO_PCI_CAP_GROUP_ID_CFG capability provides means for grouping dev= ices together. + +The capability is immediately followed by an identifier of arbitrary size = as below: + +\begin{lstlisting} +struct virtio_pci_group_id_cap { + struct virtio_pci_cap cap; + u8 group_id[]; /* Group Identifier */ +}; +\end{lstlisting} + +The fields \field{cap.bar}, \field{cap.length}, \field{cap.offset} +and \field{group_id} are read-only for the driver. + +The specification does not impose any restrictions on the size or +structure of group_id[]. Vendors are free to declare this array as +large as needed, as long as the combined size of all capabilities can +be accommodated within the PCI configuration space. + +If there is enough room in the PCI configuration space to accommodate +the group identifier, the fields \field{cap.bar}, \field{cap.offset} +and \field{cap.length} should be set to 0. + +If there isn't enough room, some or all of the group identifier can be +presented in the BAR region, in which case the fields \field{cap.bar}, +\field{cap.offset} and \field{cap.length} should be set appropriately. + +In either case, the field \field{cap.cap_len} indicates the length of +the group identifier information present in the configuration space +itself. + +\devicenormative{\paragraph}{Group Identifier capability}{Virtio Transport= Options / Virtio Over PCI Bus / PCI Device Layout / Group Identifier capab= ility} + +The device MAY present the VIRTIO_PCI_CAP_GROUP_ID_CFG capability. + +\drivernormative{\paragraph}{Group Identifier capability}{Virtio Transport= Options / Virtio Over PCI Bus / PCI Device Layout / Group Identifier capab= ility} + +The driver MUST NOT write to group_id[] area or the BAR region. + \subsubsection{Legacy Interfaces: A Note on PCI Device Layout}\label{sec:V= irtio Transport Options / Virtio Over PCI Bus / PCI Device Layout / Legacy = Interfaces: A Note on PCI Device Layout} =20 Transitional devices MUST present part of configuration From nobody Sun May 5 03:13:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oracle.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529429731874332.5312733694017; Tue, 19 Jun 2018 10:35:31 -0700 (PDT) Received: from localhost ([::1]:44082 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVKXT-0006HQ-7J for importer@patchew.org; Tue, 19 Jun 2018 13:35:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55500) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVJZ0-0004PH-Ri for qemu-devel@nongnu.org; Tue, 19 Jun 2018 12:33:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVJYv-0002as-Sw for qemu-devel@nongnu.org; Tue, 19 Jun 2018 12:33:02 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:40316) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fVJYv-0002a6-KV for qemu-devel@nongnu.org; Tue, 19 Jun 2018 12:32:57 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w5JGTB8M037041; Tue, 19 Jun 2018 16:32:56 GMT Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2jmu6xrxny-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Jun 2018 16:32:56 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w5JGWtDi032431 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Jun 2018 16:32:55 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w5JGWt0r009707; Tue, 19 Jun 2018 16:32:55 GMT Received: from localhost.localdomain (/10.159.242.141) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 19 Jun 2018 09:32:55 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=p9NWqwa894h5Yhvs15TwY+hZ487sQdcrv9kTRlBKk10=; b=j5dg+7/DqagiM6Dv+AorNy3bJJ/4fPU4JLL9mGdKoD5Y2orrUoDcVACU7eHTm9K0QMvy 4+PmJ5XCwmK4iWnbPl3KYfIaWOuqmV9opxfXyQD06iHUmJ3EHX/2BafWtqunBhHNup+l m6od40jmGs2E85+mpH8lVcyNI7GtcMlBtohf/uT5hIMwfiJRVgE9a9W8hm6LqoGusq5P n4auOnF9rBYO0dpBJ5YpFn3c9z151chsJoHzGV+/jr43P0xMPrGhjx1qvyw7nKUucF5V OMhW0sSx6/Z7ngb8rdoGKzdN4QZfHcRJjrdj/rAFYeKeykJbyP3ONrGbFf/uxyxLaKP4 Lg== From: Venu Busireddy To: venu.busireddy@oracle.com, "Michael S . Tsirkin" , Marcel Apfelbaum Date: Tue, 19 Jun 2018 11:32:26 -0500 Message-Id: <20180619163228.13790-3-venu.busireddy@oracle.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180619163228.13790-1-venu.busireddy@oracle.com> References: <20180619163228.13790-1-venu.busireddy@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8929 signatures=668702 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806190182 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 156.151.31.85 X-Mailman-Approved-At: Tue, 19 Jun 2018 13:31:57 -0400 Subject: [Qemu-devel] [PATCH 2/3] Add "Group Identifier" support to PCIe bridges. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: virtio-dev@lists.oasis-open.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add a "Vendor-Specific" capability to the PCIe bridge, to contain the "Group Identifier" (UUID) that will be used to pair a virtio device with the passthrough device attached to that bridge. This capability is added to the bridge iff the "uuid" option is specified for the bridge device, via the qemu command line. Also, the bridge's Device ID is changed to PCI_VENDOR_ID_REDHAT, and Vendor ID is changed to PCI_DEVICE_ID_REDHAT_PCIE_BRIDGE (from the default values), when the "uuid" option is present. Signed-off-by: Venu Busireddy --- hw/pci-bridge/ioh3420.c | 2 ++ hw/pci-bridge/pcie_root_port.c | 7 +++++++ hw/pci/pci_bridge.c | 32 ++++++++++++++++++++++++++++++++ include/hw/pci/pci.h | 2 ++ include/hw/pci/pcie.h | 1 + include/hw/pci/pcie_port.h | 1 + 6 files changed, 45 insertions(+) diff --git a/hw/pci-bridge/ioh3420.c b/hw/pci-bridge/ioh3420.c index a451d74ee6..b6b9ebc726 100644 --- a/hw/pci-bridge/ioh3420.c +++ b/hw/pci-bridge/ioh3420.c @@ -35,6 +35,7 @@ #define IOH_EP_MSI_SUPPORTED_FLAGS PCI_MSI_FLAGS_MASKBIT #define IOH_EP_MSI_NR_VECTOR 2 #define IOH_EP_EXP_OFFSET 0x90 +#define IOH_EP_VENDOR_OFFSET 0xCC #define IOH_EP_AER_OFFSET 0x100 =20 /* @@ -111,6 +112,7 @@ static void ioh3420_class_init(ObjectClass *klass, void= *data) rpc->exp_offset =3D IOH_EP_EXP_OFFSET; rpc->aer_offset =3D IOH_EP_AER_OFFSET; rpc->ssvid_offset =3D IOH_EP_SSVID_OFFSET; + rpc->vendor_offset =3D IOH_EP_VENDOR_OFFSET; rpc->ssid =3D IOH_EP_SSVID_SSID; } =20 diff --git a/hw/pci-bridge/pcie_root_port.c b/hw/pci-bridge/pcie_root_port.c index 45f9e8cd4a..ba470c7fda 100644 --- a/hw/pci-bridge/pcie_root_port.c +++ b/hw/pci-bridge/pcie_root_port.c @@ -71,6 +71,12 @@ static void rp_realize(PCIDevice *d, Error **errp) goto err_bridge; } =20 + rc =3D pci_bridge_vendor_init(d, rpc->vendor_offset, errp); + if (rc < 0) { + error_append_hint(errp, "Can't init group ID, error %d\n", rc); + goto err_bridge; + } + if (rpc->interrupts_init) { rc =3D rpc->interrupts_init(d, errp); if (rc < 0) { @@ -137,6 +143,7 @@ static void rp_exit(PCIDevice *d) static Property rp_props[] =3D { DEFINE_PROP_BIT(COMPAT_PROP_PCP, PCIDevice, cap_present, QEMU_PCIE_SLTCAP_PCP_BITNR, true), + DEFINE_PROP_UUID(COMPAT_PROP_UUID, PCIDevice, uuid, false), DEFINE_PROP_END_OF_LIST() }; =20 diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c index 40a39f57cb..c63bc439f7 100644 --- a/hw/pci/pci_bridge.c +++ b/hw/pci/pci_bridge.c @@ -34,12 +34,17 @@ #include "hw/pci/pci_bus.h" #include "qemu/range.h" #include "qapi/error.h" +#include "qemu/uuid.h" =20 /* PCI bridge subsystem vendor ID helper functions */ #define PCI_SSVID_SIZEOF 8 #define PCI_SSVID_SVID 4 #define PCI_SSVID_SSID 6 =20 +#define PCI_VENDOR_SIZEOF 20 +#define PCI_VENDOR_CAP_LEN_OFFSET 2 +#define PCI_VENDOR_GROUP_ID_OFFSET 4 + int pci_bridge_ssvid_init(PCIDevice *dev, uint8_t offset, uint16_t svid, uint16_t ssid, Error **errp) @@ -57,6 +62,33 @@ int pci_bridge_ssvid_init(PCIDevice *dev, uint8_t offset, return pos; } =20 +int pci_bridge_vendor_init(PCIDevice *d, uint8_t offset, Error **errp) +{ + int pos; + PCIDeviceClass *dc =3D PCI_DEVICE_GET_CLASS(d); + + if (qemu_uuid_is_null(&d->uuid)) { + return 0; + } + + pos =3D pci_add_capability(d, PCI_CAP_ID_VNDR, offset, PCI_VENDOR_SIZE= OF, + errp); + if (pos < 0) { + return pos; + } + + dc->vendor_id =3D PCI_VENDOR_ID_REDHAT; + dc->device_id =3D PCI_DEVICE_ID_REDHAT_PCIE_BRIDGE; + pci_set_word(d->config + PCI_VENDOR_ID, PCI_VENDOR_ID_REDHAT); + pci_set_word(d->config + PCI_DEVICE_ID, PCI_DEVICE_ID_REDHAT_PCIE_BRID= GE); + + pci_set_word(d->config + pos + PCI_VENDOR_CAP_LEN_OFFSET, + PCI_VENDOR_SIZEOF); + memcpy(d->config + offset + PCI_VENDOR_GROUP_ID_OFFSET, &d->uuid, + sizeof(QemuUUID)); + return pos; +} + /* Accessor function to get parent bridge device from pci bus. */ PCIDevice *pci_bridge_get_device(PCIBus *bus) { diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 990d6fcbde..ee234c5a6f 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -4,6 +4,7 @@ #include "hw/qdev.h" #include "exec/memory.h" #include "sysemu/dma.h" +#include "qemu/uuid.h" =20 /* PCI includes legacy ISA access. */ #include "hw/isa/isa.h" @@ -343,6 +344,7 @@ struct PCIDevice { bool has_rom; MemoryRegion rom; uint32_t rom_bar; + QemuUUID uuid; =20 /* INTx routing notifier */ PCIINTxRoutingNotifier intx_routing_notifier; diff --git a/include/hw/pci/pcie.h b/include/hw/pci/pcie.h index b71e369703..b4189d0ce3 100644 --- a/include/hw/pci/pcie.h +++ b/include/hw/pci/pcie.h @@ -82,6 +82,7 @@ struct PCIExpressDevice { }; =20 #define COMPAT_PROP_PCP "power_controller_present" +#define COMPAT_PROP_UUID "uuid" =20 /* PCI express capability helper functions */ int pcie_cap_init(PCIDevice *dev, uint8_t offset, uint8_t type, diff --git a/include/hw/pci/pcie_port.h b/include/hw/pci/pcie_port.h index 0736014bfd..40db6dbbe7 100644 --- a/include/hw/pci/pcie_port.h +++ b/include/hw/pci/pcie_port.h @@ -74,6 +74,7 @@ typedef struct PCIERootPortClass { int exp_offset; int aer_offset; int ssvid_offset; + int vendor_offset; int ssid; } PCIERootPortClass; =20 From nobody Sun May 5 03:13:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oracle.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529429816569222.97864319335213; Tue, 19 Jun 2018 10:36:56 -0700 (PDT) Received: from localhost ([::1]:44091 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVKYm-00074K-N7 for importer@patchew.org; Tue, 19 Jun 2018 13:36:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55586) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVJZ7-0004Um-QO for qemu-devel@nongnu.org; Tue, 19 Jun 2018 12:33:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVJZ2-0002gr-Tj for qemu-devel@nongnu.org; Tue, 19 Jun 2018 12:33:09 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:41514) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fVJZ2-0002gH-JT for qemu-devel@nongnu.org; Tue, 19 Jun 2018 12:33:04 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w5JGT4ud015414; Tue, 19 Jun 2018 16:33:02 GMT Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2jmt01h1ug-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Jun 2018 16:33:02 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w5JGX1n9028036 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Jun 2018 16:33:01 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w5JGX1Rs013110; Tue, 19 Jun 2018 16:33:01 GMT Received: from localhost.localdomain (/10.159.242.141) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 19 Jun 2018 09:33:00 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=ofQYAVL8BoDib3C14vEyzjng1qP6CeUfIFOS6WRP23o=; b=Ue+kyn7eDw3jhiM1O7DLkVGeI0/CVgX/5hPSGMwa28/MVe5LFgbNaftMLDrNCP0AOhYw sfC4mpp9ZLDGFfKryeX9cWfRYxlZKlk90SwsAEAVM4cFGbcL6WCN8LWJ7T8cnVloArDC 7yyn9DSq9dLCenxpgBfTHMb8kMRzEDhfil+6wFfmgxFun+j8i9+Lir82ZEXuihQsZUz+ BpPhMycTUYu0mNCyEGbh7UntFFNPLYnYB2w3LtWUPPVR1DxevVaKs9rUtvfq1f9WC3bB t8Y+k0eAZt3Pc8ojpjHlmFHIYgHs+uYPFShkmzdVaKNolAeIh1xpFdI9dh1biYNRBEKH jw== From: Venu Busireddy To: venu.busireddy@oracle.com, "Michael S . Tsirkin" , Marcel Apfelbaum Date: Tue, 19 Jun 2018 11:32:27 -0500 Message-Id: <20180619163228.13790-4-venu.busireddy@oracle.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180619163228.13790-1-venu.busireddy@oracle.com> References: <20180619163228.13790-1-venu.busireddy@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8929 signatures=668702 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806190182 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 156.151.31.86 X-Mailman-Approved-At: Tue, 19 Jun 2018 13:31:57 -0400 Subject: [Qemu-devel] [PATCH 3/3] Add "Group Identifier" support to virtio devices. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: virtio-dev@lists.oasis-open.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Use the virtio PCI capability "VIRTIO_PCI_CAP_GROUP_ID_CFG" to store the "Group Identifier" (UUID) specified via the command line option "uuid" for the virtio device. The capability will be present in the virtio device's configuration space iff the "uuid" option is specified. Group Identifier is used to pair a virtio device with a passthrough device. Signed-off-by: Venu Busireddy --- hw/virtio/virtio-pci.c | 15 +++++++++++++++ hw/virtio/virtio-pci.h | 3 ++- include/standard-headers/linux/virtio_pci.h | 8 ++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 3a01fe90f0..9c2ef16773 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -36,6 +36,7 @@ #include "qemu/range.h" #include "hw/virtio/virtio-bus.h" #include "qapi/visitor.h" +#include "qemu/uuid.h" =20 #define VIRTIO_PCI_REGION_SIZE(dev) VIRTIO_PCI_CONFIG_OFF(msix_present= (dev)) =20 @@ -1638,6 +1639,10 @@ static void virtio_pci_device_plugged(DeviceState *d= , Error **errp) .cap.cap_len =3D sizeof cfg, .cap.cfg_type =3D VIRTIO_PCI_CAP_PCI_CFG, }; + struct virtio_pci_group_id_cap group =3D { + .cap.cap_len =3D sizeof group, + .cap.cfg_type =3D VIRTIO_PCI_CAP_GROUP_ID_CFG, + }; struct virtio_pci_notify_cap notify_pio =3D { .cap.cap_len =3D sizeof notify, .notify_off_multiplier =3D cpu_to_le32(0x0), @@ -1647,6 +1652,11 @@ static void virtio_pci_device_plugged(DeviceState *d= , Error **errp) =20 virtio_pci_modern_regions_init(proxy); =20 + if (!qemu_uuid_is_null(&proxy->pci_dev.uuid)) { + memcpy(group.group_id, &proxy->pci_dev.uuid, sizeof(QemuUUID)); + virtio_pci_modern_mem_region_map(proxy, &proxy->group, &group.= cap); + } + virtio_pci_modern_mem_region_map(proxy, &proxy->common, &cap); virtio_pci_modern_mem_region_map(proxy, &proxy->isr, &cap); virtio_pci_modern_mem_region_map(proxy, &proxy->device, &cap); @@ -1763,6 +1773,10 @@ static void virtio_pci_realize(PCIDevice *pci_dev, E= rror **errp) proxy->device.size =3D 0x1000; proxy->device.type =3D VIRTIO_PCI_CAP_DEVICE_CFG; =20 + proxy->group.offset =3D 0; + proxy->group.size =3D 0; + proxy->group.type =3D VIRTIO_PCI_CAP_GROUP_ID_CFG; + proxy->notify.offset =3D 0x3000; proxy->notify.size =3D virtio_pci_queue_mem_mult(proxy) * VIRTIO_QUEUE= _MAX; proxy->notify.type =3D VIRTIO_PCI_CAP_NOTIFY_CFG; @@ -1898,6 +1912,7 @@ static Property virtio_pci_properties[] =3D { VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT, true), DEFINE_PROP_BIT("x-pcie-pm-init", VirtIOPCIProxy, flags, VIRTIO_PCI_FLAG_INIT_PM_BIT, true), + DEFINE_PROP_UUID("uuid", PCIDevice, uuid, false), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index 813082b0d7..e4592e90bf 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -164,10 +164,11 @@ struct VirtIOPCIProxy { VirtIOPCIRegion common; VirtIOPCIRegion isr; VirtIOPCIRegion device; + VirtIOPCIRegion group; VirtIOPCIRegion notify; VirtIOPCIRegion notify_pio; }; - VirtIOPCIRegion regs[5]; + VirtIOPCIRegion regs[6]; }; MemoryRegion modern_bar; MemoryRegion io_bar; diff --git a/include/standard-headers/linux/virtio_pci.h b/include/standard= -headers/linux/virtio_pci.h index 9262acd130..e5b6c6f3a6 100644 --- a/include/standard-headers/linux/virtio_pci.h +++ b/include/standard-headers/linux/virtio_pci.h @@ -113,6 +113,8 @@ #define VIRTIO_PCI_CAP_DEVICE_CFG 4 /* PCI configuration access */ #define VIRTIO_PCI_CAP_PCI_CFG 5 +/* Group Identifier */ +#define VIRTIO_PCI_CAP_GROUP_ID_CFG 6 =20 /* This is the PCI capability header: */ struct virtio_pci_cap { @@ -163,6 +165,12 @@ struct virtio_pci_cfg_cap { uint8_t pci_cfg_data[4]; /* Data for BAR access. */ }; =20 +/* Fields in VIRTIO_PCI_CAP_GROUP_ID_CFG: */ +struct virtio_pci_group_id_cap { + struct virtio_pci_cap cap; + uint8_t group_id[16]; +}; + /* Macro versions of offsets for the Old Timers! */ #define VIRTIO_PCI_CAP_VNDR 0 #define VIRTIO_PCI_CAP_NEXT 1