From nobody Sat Feb 7 18:21:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass header.i=teddy.astie@vates.tech; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=vates.tech ARC-Seal: i=1; a=rsa-sha256; t=1767804919; cv=none; d=zohomail.com; s=zohoarc; b=FK+5RJFhqO+AIEkAXOdAfeFsCwOo0/5b1QQXMCdvjsmoFEIl5ikDfL10HJr6zOsxDDUr+8kNCDfX6KlP7grc5hzVbUrs8t+qtqOdrh7Tte3+AD80kVpj9P8kmsWwbUs/VRvw5UvOsr3jDG+/MJz19kScqceksUOY5c2lG6lTHUM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767804919; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=dvpM8KfreT681wQu18BQ2I0ULSna7H2R9oVtTe2ENm4=; b=aR6T1ef4Ooclcx6VSiSzRRrpUMYgQbU4gSmCN8YAwQIO0XEwiOm2nEzF6xxMC0PJX65qDQZSHAv/SmMXsPwxfI5YGwrDa4H2caWMSJ4jk087X3wJi2tCw4+KM/Nl/hDpU/aoYlbOAMq7Ip4sjqX3KeRsI5GQPxHfS77P/ai2hiI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=teddy.astie@vates.tech; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 17678049198121001.6574772914544; Wed, 7 Jan 2026 08:55:19 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1197013.1514699 (Exim 4.92) (envelope-from ) id 1vdWoI-0008WN-DO; Wed, 07 Jan 2026 16:55:02 +0000 Received: by outflank-mailman (output) from mailman id 1197013.1514699; Wed, 07 Jan 2026 16:55:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vdWoI-0008V9-6P; Wed, 07 Jan 2026 16:55:02 +0000 Received: by outflank-mailman (input) for mailman id 1197013; Wed, 07 Jan 2026 16:55:00 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vdWoG-0008Pf-JV for xen-devel@lists.xenproject.org; Wed, 07 Jan 2026 16:55:00 +0000 Received: from mail132-4.atl131.mandrillapp.com (mail132-4.atl131.mandrillapp.com [198.2.132.4]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 98f6e935-ebe9-11f0-9ccf-f158ae23cfc8; Wed, 07 Jan 2026 17:54:58 +0100 (CET) Received: from pmta09.mandrill.prod.atl01.rsglab.com (localhost [127.0.0.1]) by mail132-4.atl131.mandrillapp.com (Mailchimp) with ESMTP id 4dmZ001jfGzlfh3m for ; Wed, 7 Jan 2026 16:54:56 +0000 (GMT) Received: from [37.26.189.201] by mandrillapp.com id 69d9506fa8e44d5ea0d5c68a30f8e736; Wed, 07 Jan 2026 16:54:56 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 98f6e935-ebe9-11f0-9ccf-f158ae23cfc8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com; s=mte1; t=1767804896; x=1768074896; bh=dvpM8KfreT681wQu18BQ2I0ULSna7H2R9oVtTe2ENm4=; h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID: Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date: Subject:From; b=e8EAewOz0fErJtY7w8S95VOq2xku94JGgLX3q5ZZ2OWilXm7DlrI/nnIQR79W8+go CTeM76XNZGxI9XM3JgKgB90wgwiufLKHcMEKV5nIX95XAu3YxS6SScaVzasFAGgwHp Kz38CC3Q+5xNeIZDkpJN9Zc78EYS1wCTj64YnhjF5IkwUCG4wWo3WQ4TVMH9ecihTd 0BMZy7SmIZxnEQnGFzw1cpU1H6Cr6aVFkTQOisA2nQmScDu68HTTG0kLHQJrzIPDR3 Cch3U6idTIzDIr9lbLlcLJF+LVdUZ7bUjW6fq7K041q4mbAPuPllejyi3R0qfXjjfp 20pvYpyuexZ8Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1; t=1767804896; x=1768065396; i=teddy.astie@vates.tech; bh=dvpM8KfreT681wQu18BQ2I0ULSna7H2R9oVtTe2ENm4=; h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID: Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date: Subject:From; b=qpqNwKDxqFkws5MglGsiYHva3+IMoi9VsGzWj2g2czJ2lLaSNfIlQeoId7KXKQniA U2ooEGKbCzsKkQlROcmwfvEuwrUKMrhfyDuHT7xBqWJCKPvZEbZ8HltJ69JbVRdeXF C8WGqltiCZLr/bwCZLzVfWkx82n3TXJDW72P5+GX/R78yrypqM4p+ldh3NwpbRbZAp R+CIna8O08CL9i9Tu5X37QUjpUxvTyV0Yr7Gj+w2EWJn0JVlRIL3XmugdVA3cGWZL/ Xx/JkyGcMiGy3zzdq15N1hQ1fxdEjipZi1R6BnZseJJ7C2cR0Q+cefI1LptcCTjmcs SRpJstzfncccg== From: "Teddy Astie" Subject: =?utf-8?Q?[PATCH=20v1=201/2]=20x86/pci:=20Improve=20pci=5Fmmcfg=5F{read,write}=20error=20handling?= X-Mailer: git-send-email 2.52.0 X-Bm-Disclaimer: Yes X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2 X-Bm-Transport-Timestamp: 1767804895192 To: xen-devel@lists.xenproject.org Cc: "Teddy Astie" , "Jan Beulich" , "Andrew Cooper" , "=?utf-8?Q?Roger=20Pau=20Monn=C3=A9?=" Message-Id: <1042a6163ae71527987a853e3c746c8a6633c0ee.1767804090.git.teddy.astie@vates.tech> In-Reply-To: References: X-Native-Encoded: 1 X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.69d9506fa8e44d5ea0d5c68a30f8e736?= X-Mandrill-User: md_30504962 Feedback-ID: 30504962:30504962.20260107:md Date: Wed, 07 Jan 2026 16:54:56 +0000 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @mandrillapp.com) (identity teddy.astie@vates.tech) X-ZM-MESSAGEID: 1767804921303158500 Content-Type: text/plain; charset="utf-8" Return -ENODEV in case no mmcfg information is available instead of -EINVAL, that is also returned when the parameters are incorrect. It helps us distinguish between incorrect usage and no MMCFG support. Signed-off-by: Teddy Astie --- xen/arch/x86/x86_64/mmconfig_64.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/x86_64/mmconfig_64.c b/xen/arch/x86/x86_64/mmconf= ig_64.c index ffdc62700d..1a2803d2a3 100644 --- a/xen/arch/x86/x86_64/mmconfig_64.c +++ b/xen/arch/x86/x86_64/mmconfig_64.c @@ -60,15 +60,15 @@ int pci_mmcfg_read(unsigned int seg, unsigned int bus, { char __iomem *addr; =20 + *value =3D -1; + /* Why do we have this when nobody checks it. How about a BUG()!? -AK = */ - if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) { -err: *value =3D -1; + if ( unlikely((bus > 255) || (devfn > 255) || (reg > 4095)) ) return -EINVAL; - } =20 addr =3D pci_dev_base(seg, bus, devfn); if (!addr) - goto err; + return -ENODEV; =20 switch (len) { case 1: @@ -96,7 +96,7 @@ int pci_mmcfg_write(unsigned int seg, unsigned int bus, =20 addr =3D pci_dev_base(seg, bus, devfn); if (!addr) - return -EINVAL; + return -ENODEV; =20 switch (len) { case 1: --=20 2.52.0 -- Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech From nobody Sat Feb 7 18:21:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass header.i=teddy.astie@vates.tech; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=vates.tech ARC-Seal: i=1; a=rsa-sha256; t=1767804929; cv=none; d=zohomail.com; s=zohoarc; b=TaoYIDtfZs8cpDwZLbGq37jnxYFaGS31EEenYUhAOgM8Ky0iaCA4paeOceUzpOvgJajXpmwPOpauArMjOyPBzP7c+0ibb4pzeIYWJj6W5KJf4t4p7Pzfs33pLsJMVVNux6nsMRfHbtiPA5wnyf9g4STidup1l9U6BNkDPg3ai7A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767804929; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=GaUw0s07s4BUFWE/xvZWFDAom+ukE1VoOC1T4wtN5q8=; b=eNpQr8Gk3yoQ+WFacsMH4hWSEfC/PSCA4C9USGTU9anJQa1D1x2y0O6t4DbHXNbiJn6ljJ8DvHJotFDjidTh0yQctVEvySybG6RZsk7N4F3LKSc9ZhLpEifTtNNPQF7Q51oP+34StONzChBe/teaLVcOUHXWoOZOEi+P2k65bc4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=teddy.astie@vates.tech; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1767804929023815.4579781812292; Wed, 7 Jan 2026 08:55:29 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1197012.1514693 (Exim 4.92) (envelope-from ) id 1vdWoI-0008Sx-5G; Wed, 07 Jan 2026 16:55:02 +0000 Received: by outflank-mailman (output) from mailman id 1197012.1514693; Wed, 07 Jan 2026 16:55:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vdWoH-0008Rm-Vc; Wed, 07 Jan 2026 16:55:01 +0000 Received: by outflank-mailman (input) for mailman id 1197012; Wed, 07 Jan 2026 16:55:00 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vdWoG-0008Pk-HC for xen-devel@lists.xenproject.org; Wed, 07 Jan 2026 16:55:00 +0000 Received: from mail132-4.atl131.mandrillapp.com (mail132-4.atl131.mandrillapp.com [198.2.132.4]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 98f3754a-ebe9-11f0-b15e-2bf370ae4941; Wed, 07 Jan 2026 17:54:58 +0100 (CET) Received: from pmta09.mandrill.prod.atl01.rsglab.com (localhost [127.0.0.1]) by mail132-4.atl131.mandrillapp.com (Mailchimp) with ESMTP id 4dmZ003Z0yzlfk13 for ; Wed, 7 Jan 2026 16:54:56 +0000 (GMT) Received: from [37.26.189.201] by mandrillapp.com id 4b6fc8b114c14eb3aa834fc567d9a59e; Wed, 07 Jan 2026 16:54:56 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 98f3754a-ebe9-11f0-b15e-2bf370ae4941 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com; s=mte1; t=1767804896; x=1768074896; bh=GaUw0s07s4BUFWE/xvZWFDAom+ukE1VoOC1T4wtN5q8=; h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID: Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date: Subject:From; b=x+Xb3K69hbuQW7YnvMdLTJNYJm8fF3sm6H2MO+ZVZqSrh7jRl2Qgj/N+Dv5BVqs5s DkXmgmPtdlHYUUTlBwfMP1zTKgpUxc4v6ZohghNyq6EaRH+poyTVd7mEYFAYWhCtmu hCi+IUHWfDXYy3MNlt5cfc8ZeyLGT7EqdoGz+7pY3BdBz8gdqKiA1RNdkb9QJir9k8 bLl/Ao2gzRH9busfvwBuL2P3+b6h+LaJK/u/BetvXEtxAsx2I7tCFNxqx7b67ugZYD uT+9o4EnmKEeDc9bfV55ZKG9CR5YLrP1bMwvXVprsamsP8V4ZT2zeVIYFeENnIa5X9 k/gDTBZKn6R/Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1; t=1767804896; x=1768065396; i=teddy.astie@vates.tech; bh=GaUw0s07s4BUFWE/xvZWFDAom+ukE1VoOC1T4wtN5q8=; h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID: Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date: Subject:From; b=NNKwyWi7me6a3GkyHeVCJi3aYdOuyppU1hG6cOKVVMrWHcslWdbovjGZXG8JF4oeF f38FI34C+copDbvmpMuxWz5gkbb4/0Z05mNt3GKLL41LY2NgbYWvapGvRxrmAXHbB1 IFIWzFfcaSUV8DrHfR0ZS2WDp30bsPBVFIxte4nUTXjMLU6d2hg96bEOktbgqfHcZB NorohMrlq/rh3g4CdKmR05/9YTBYA43G8NA+sDfk1LvG0yiCBo3q9eCrS3JUPkebs7 kgSuCDQ+97XG5mdZHKVeL/yBqfaYibEf5liczsZYZtSkwuFP5pDrKOwTyLr6z8QM58 7vq28euP6L7Aw== From: "Teddy Astie" Subject: =?utf-8?Q?[PATCH=20v1=202/2]=20x86/pci:=20Prefer=20using=20mmcfg=20for=20accessing=20configuration=20space?= X-Mailer: git-send-email 2.52.0 X-Bm-Disclaimer: Yes X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2 X-Bm-Transport-Timestamp: 1767804895542 To: xen-devel@lists.xenproject.org Cc: "Teddy Astie" , "Jan Beulich" , "Andrew Cooper" , "=?utf-8?Q?Roger=20Pau=20Monn=C3=A9?=" Message-Id: <27c85c2cded576b3d5253c6e182e24341201c3ea.1767804090.git.teddy.astie@vates.tech> In-Reply-To: References: X-Native-Encoded: 1 X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.4b6fc8b114c14eb3aa834fc567d9a59e?= X-Mandrill-User: md_30504962 Feedback-ID: 30504962:30504962.20260107:md Date: Wed, 07 Jan 2026 16:54:56 +0000 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity teddy.astie@vates.tech) (identity @mandrillapp.com) X-ZM-MESSAGEID: 1767804931200158500 Content-Type: text/plain; charset="utf-8" Current logic prefer using CFC/CF8 and fallbacks on mmcfg when accessing >255 registers or a non-zero segment. Change the logic to always rely on mmcfg unless it is not available to avoid locking on pci_config_lock if possible. Signed-off-by: Teddy Astie --- Are there x86 platforms where MMCFG is the only way to access PCI configura= tion space ? xen/arch/x86/x86_64/pci.c | 52 +++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/xen/arch/x86/x86_64/pci.c b/xen/arch/x86/x86_64/pci.c index 8d33429103..3b3df8014d 100644 --- a/xen/arch/x86/x86_64/pci.c +++ b/xen/arch/x86/x86_64/pci.c @@ -14,62 +14,56 @@ uint8_t pci_conf_read8(pci_sbdf_t sbdf, unsigned int reg) { uint32_t value; + int ret =3D pci_mmcfg_read(sbdf.seg, sbdf.bus, sbdf.devfn, reg, 1, &va= lue); =20 - if ( sbdf.seg || reg > 255 ) - { - pci_mmcfg_read(sbdf.seg, sbdf.bus, sbdf.devfn, reg, 1, &value); - return value; - } + if ( unlikely(ret =3D=3D -ENODEV) && !sbdf.seg && reg <=3D 255 ) + return pci_conf_read(PCI_CONF_ADDRESS(sbdf, reg), reg & 3, 1); =20 - return pci_conf_read(PCI_CONF_ADDRESS(sbdf, reg), reg & 3, 1); + return value; } =20 uint16_t pci_conf_read16(pci_sbdf_t sbdf, unsigned int reg) { - if ( sbdf.seg || reg > 255 ) - { - uint32_t value; + uint32_t value; + int ret =3D pci_mmcfg_read(sbdf.seg, sbdf.bus, sbdf.devfn, reg, 2, &va= lue); =20 - pci_mmcfg_read(sbdf.seg, sbdf.bus, sbdf.devfn, reg, 2, &value); - return value; - } + if ( unlikely(ret =3D=3D -ENODEV) && !sbdf.seg && reg <=3D 255 ) + return pci_conf_read(PCI_CONF_ADDRESS(sbdf, reg), reg & 2, 2); =20 - return pci_conf_read(PCI_CONF_ADDRESS(sbdf, reg), reg & 2, 2); + return value; } =20 uint32_t pci_conf_read32(pci_sbdf_t sbdf, unsigned int reg) { - if ( sbdf.seg || reg > 255 ) - { - uint32_t value; + uint32_t value; + int ret =3D pci_mmcfg_read(sbdf.seg, sbdf.bus, sbdf.devfn, reg, 4, &va= lue); =20 - pci_mmcfg_read(sbdf.seg, sbdf.bus, sbdf.devfn, reg, 4, &value); - return value; - } + if ( unlikely(ret =3D=3D -ENODEV) && !sbdf.seg && reg <=3D 255 ) + return pci_conf_read(PCI_CONF_ADDRESS(sbdf, reg), 0, 4); =20 - return pci_conf_read(PCI_CONF_ADDRESS(sbdf, reg), 0, 4); + return value; } =20 void pci_conf_write8(pci_sbdf_t sbdf, unsigned int reg, uint8_t data) { - if ( sbdf.seg || reg > 255 ) - pci_mmcfg_write(sbdf.seg, sbdf.bus, sbdf.devfn, reg, 1, data); - else + int ret =3D pci_mmcfg_write(sbdf.seg, sbdf.bus, sbdf.devfn, reg, 1, da= ta); + + if ( unlikely(ret =3D=3D -ENODEV) && !sbdf.seg && reg <=3D 255 ) pci_conf_write(PCI_CONF_ADDRESS(sbdf, reg), reg & 3, 1, data); } =20 void pci_conf_write16(pci_sbdf_t sbdf, unsigned int reg, uint16_t data) { - if ( sbdf.seg || reg > 255 ) - pci_mmcfg_write(sbdf.seg, sbdf.bus, sbdf.devfn, reg, 2, data); - else + int ret =3D pci_mmcfg_write(sbdf.seg, sbdf.bus, sbdf.devfn, reg, 2, da= ta); + + if ( unlikely(ret =3D=3D -ENODEV) && !sbdf.seg && reg <=3D 255 ) pci_conf_write(PCI_CONF_ADDRESS(sbdf, reg), reg & 2, 2, data); } =20 void pci_conf_write32(pci_sbdf_t sbdf, unsigned int reg, uint32_t data) { - if ( sbdf.seg || reg > 255 ) - pci_mmcfg_write(sbdf.seg, sbdf.bus, sbdf.devfn, reg, 4, data); - else + int ret =3D pci_mmcfg_write(sbdf.seg, sbdf.bus, sbdf.devfn, reg, 4, da= ta); + + if ( unlikely(ret =3D=3D -ENODEV) && !sbdf.seg && reg <=3D 255 ) pci_conf_write(PCI_CONF_ADDRESS(sbdf, reg), 0, 4, data); } --=20 2.52.0 -- Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech