From nobody Sun Feb 8 06:05:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=ixsystems.com ARC-Seal: i=1; a=rsa-sha256; t=1582526852; cv=none; d=zohomail.com; s=zohoarc; b=VSmYkqlcLxB8bTpvDqi5+jQnImRsMS8RwWBgS7e0roRfOnJL0pV9UkYOpWdcBD6BfAO3//4nHrw7i2wzv9DdVGwD0humGYxzSiAQraLbuVtXO7scAvarwubVs5x863SIGGxZeIC0QbuoGyXyZ3KPASZcbxbCpmVYHvomGboxLDc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582526852; h=Content-Type: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=IlZJmqHWvBLRotVXu8AmFOdiaTRsrrJeq3sqvimYm4s=; b=njdjyGt/25lwtTDdHMQZ/kqF9n/YsHXzOKfTEPLqawbHiGvcrFDlXxdNv8JvGdvykHM7NJUJ9b7rp3O+0SSbg9cIK3KQA5AT9ZkBRdiCGosNZ+c82wy53obKLAadoqTAAHJP3bvFJCkFtdpGGadpbV2Gx86UsRmInP+bfgwqsvU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1582526852533790.2665156342617; Sun, 23 Feb 2020 22:47:32 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-212-2LXywDIjOYS4Tdb54aHnTw-1; Mon, 24 Feb 2020 01:47:29 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5B1D010CE788; Mon, 24 Feb 2020 06:47:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3192C5C10D; Mon, 24 Feb 2020 06:47:22 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D926118089D8; Mon, 24 Feb 2020 06:47:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01O6kghR025589 for ; Mon, 24 Feb 2020 01:46:42 -0500 Received: by smtp.corp.redhat.com (Postfix) id E4E422028CD2; Mon, 24 Feb 2020 06:46:41 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DF7972026D68 for ; Mon, 24 Feb 2020 06:46:41 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C35C2185A78E for ; Mon, 24 Feb 2020 06:46:41 +0000 (UTC) Received: from mail-yb1-f170.google.com (mail-yb1-f170.google.com [209.85.219.170]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-463-9B7k7sLGP4GmBI9JbLTdIQ-1; Mon, 24 Feb 2020 01:46:39 -0500 Received: by mail-yb1-f170.google.com with SMTP id n131so4158660ybg.13 for ; Sun, 23 Feb 2020 22:46:39 -0800 (PST) Received: from xeon-freebsd.freqlabs.com. (69-228-200-148.lightspeed.knvltn.sbcglobal.net. [69.228.200.148]) by smtp.gmail.com with ESMTPSA id j184sm4821447ywa.39.2020.02.23.22.46.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Feb 2020 22:46:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582526851; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=IlZJmqHWvBLRotVXu8AmFOdiaTRsrrJeq3sqvimYm4s=; b=BpFZxzmwEEwiETXCjb2nOCKlXtCBMLCcW8OT6cAqhXVP1znmwomMV0gP2PYv1L0AXaDtQk TVXU2fBMLE6BXBFrMWEwjnvVrGvs+L0zIm/HU+u0zA0garOjI7roQJswRfKHTAfew7sBKf cVjLnLM7qFpzLvfyHGyeYdww7/js8sU= X-MC-Unique: 2LXywDIjOYS4Tdb54aHnTw-1 X-MC-Unique: 9B7k7sLGP4GmBI9JbLTdIQ-1 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=WXdMUZEE4F8VjPUbwE7iSWjwBrJMAHwANrzcAhSYbz4=; b=TalQrcnWHh6KuV8xgK6cuWhbvZKCiOBPnzJ/McSXoiTizNuXi+iHanUZzaMOcBzo88 q+aKmgdVjf9GRoQclPUuy+WpD7ZTbsUxvtVnJtZrzpnScnr7YYBveuuWhF+8vzoPZv9U XDnmqXqxjnuDvZGJwjnDOYxOb1pYRp7hmfqancHaALfT0+SPgsSmZoqEv1CYbmfTlL2Y YEF5eJFHYNfpg6JuZd44KxiAfCKNb72UdTtXw9IO6Uy2uZyAC3cwmGk4OPvS7etLt7N6 laVHVUWjTmHYiY82lIqxUpWoh6K/tOoRjN1UneCi8NdOgdV5J82Q0CzaUl0k2WGAzBZt niHQ== X-Gm-Message-State: APjAAAWsIWt5xjaVYzSGJKkTVa2vEEsVmLhGTolRpdhOZzYiT66o8laA DFyE8lrI59eNeRo1LMgYs6WTUgE2CmKQAUMALPBrOJut9vtNupceJScsc3Q7im+4CjNES9gp54I 5Lwtc7GkC7RcCLx6kmWRq6sBfIjBKG+NMYo4muKhgDLVPho6VXgHuwrFamDtOFdC2/cc= X-Google-Smtp-Source: APXvYqwWg+O2G/+TJfxyq2gwk4ZsiQnvuikKAmneFtDqogl5lFzsJLkSdYmiZyjxNahXu+Tk3OkrFw== X-Received: by 2002:a5b:d09:: with SMTP id y9mr20807057ybp.188.1582526798776; Sun, 23 Feb 2020 22:46:38 -0800 (PST) From: Ryan Moeller X-Google-Original-From: Ryan Moeller To: libvir-list@redhat.com Subject: [PATCH v1 12/12] Allow PCI functions up to 255 for PCI ARI Date: Mon, 24 Feb 2020 01:46:24 -0500 Message-Id: <20200224064624.66649-13-ryan@iXsystems.com> In-Reply-To: <20200224064624.66649-1-ryan@iXsystems.com> References: <20200224064624.66649-1-ryan@iXsystems.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 01O6kghR025589 X-loop: libvir-list@redhat.com Cc: Ryan Moeller X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" PCI Alternative Routing-ID Interpretation (ARI) capable devices use an implied Device Number of 0 and repurpose those bits to allow for 256 Function Numbers instead of 8. An example of such a device is the Chelsio T580-LP-CR, which uses the additional function numbers to provide Virtual Function (VF) features. Below is an excerpt from the `pciconf -lvc` output for this device when a few VFs are configured: ppt7@pci0:5:0:21: class=3D0x020000 card=3D0x00001425 chip=3D0x5810142= 5 rev=3D0x00 hdr=3D0x00 vendor =3D 'Chelsio Communications Inc' device =3D 'T580-LP-CR Unified Wire Ethernet Controller [VF]' class =3D network subclass =3D ethernet cap 10[70] =3D PCI-Express 2 endpoint max data 256(2048) FLR NS link x0(x8) speed 0.0(8.0) ASPM disabled(L0s/L1) cap 11[b0] =3D MSI-X supports 8 messages Table in map 0x20[0x0], PBA in map 0x20[0x8000] cap 05[50] =3D MSI supports 32 messages, 64 bit, vector masks ecap 0001[100] =3D AER 2 0 fatal 0 non-fatal 0 corrected ecap 000e[140] =3D ARI 1 ecap 0017[150] =3D TPH Requester 1 Of note: the Bus/Device/Function 5/0/21 and the ARI ecap. Attempting to pass this through to a VM as a PCI device produces a validation error due to the function number being out of range. To enable use of devices that use ARI, relax the schema and validity check for PCI addresses to permit function numbers up to 255. Update a few tests to give coverage. Ref: https://pcisig.com/sites/default/files/specification_documents/ECN-alt= -rid-interpretation-070604.pdf Signed-off-by: Ryan Moeller --- docs/schemas/basictypes.rng | 10 +--------- src/util/virpci.c | 4 ++-- tests/bhyveargv2xmldata/bhyveargv2xml-passthru.args | 2 +- tests/bhyveargv2xmldata/bhyveargv2xml-passthru.xml | 2 +- tests/bhyvexml2argvdata/bhyvexml2argv-passthru.args | 2 +- tests/bhyvexml2argvdata/bhyvexml2argv-passthru.xml | 2 +- tests/bhyvexml2xmloutdata/bhyvexml2xmlout-passthru.xml | 2 +- tests/qemuxml2argvdata/pci-function-invalid.xml | 2 +- 8 files changed, 9 insertions(+), 17 deletions(-) diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng index 81465273c8..03ce3f3be3 100644 --- a/docs/schemas/basictypes.rng +++ b/docs/schemas/basictypes.rng @@ -341,15 +341,7 @@ - - - (0x)?[0-7] - - - 0 - 7 - - + =20 diff --git a/src/util/virpci.c b/src/util/virpci.c index 0b1222373e..d60cf5eff7 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -1302,11 +1302,11 @@ virPCIDeviceAddressIsValid(virPCIDeviceAddressPtr a= ddr, addr->slot); return false; } - if (addr->function > 7) { + if (addr->function > 255) { if (report) virReportError(VIR_ERR_XML_ERROR, _("Invalid PCI address function=3D0x%x, " - "must be <=3D 7"), + "must be <=3D 255"), addr->function); return false; } diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-passthru.args b/tests/bh= yveargv2xmldata/bhyveargv2xml-passthru.args index 697bafd642..726dade59e 100644 --- a/tests/bhyveargv2xmldata/bhyveargv2xml-passthru.args +++ b/tests/bhyveargv2xmldata/bhyveargv2xml-passthru.args @@ -5,4 +5,4 @@ -P \ -S \ -s 0:0,hostbridge \ --s 0:1:0,passthru,5/0/7 bhyve +-s 0:1:0,passthru,5/0/9 bhyve diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-passthru.xml b/tests/bhy= veargv2xmldata/bhyveargv2xml-passthru.xml index af99279448..a8d7a574af 100644 --- a/tests/bhyveargv2xmldata/bhyveargv2xml-passthru.xml +++ b/tests/bhyveargv2xmldata/bhyveargv2xml-passthru.xml @@ -18,7 +18,7 @@ -
+
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-passthru.args b/tests/bh= yvexml2argvdata/bhyvexml2argv-passthru.args index c268da957c..afa99344af 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-passthru.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-passthru.args @@ -7,5 +7,5 @@ -P \ -s 0:0,hostbridge \ -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI_CODE-devel.fd \ --s 0:3:0,passthru,5/0/7 \ +-s 0:3:0,passthru,5/0/9 \ -s 1,lpc bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-passthru.xml b/tests/bhy= vexml2argvdata/bhyvexml2argv-passthru.xml index ba0744f35d..e8b3a4064f 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-passthru.xml +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-passthru.xml @@ -14,7 +14,7 @@ -
+
diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-passthru.xml b/tests= /bhyvexml2xmloutdata/bhyvexml2xmlout-passthru.xml index 0313fa0dfa..7f96831df9 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-passthru.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-passthru.xml @@ -21,7 +21,7 @@ -
+
diff --git a/tests/qemuxml2argvdata/pci-function-invalid.xml b/tests/qemuxm= l2argvdata/pci-function-invalid.xml index 5642809ec0..eced7b3fa6 100644 --- a/tests/qemuxml2argvdata/pci-function-invalid.xml +++ b/tests/qemuxml2argvdata/pci-function-invalid.xml @@ -26,7 +26,7 @@ -
+
--=20 2.24.1