From patchwork Thu Jun 6 09:01:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 10978855 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B2BE392A for ; Thu, 6 Jun 2019 09:03:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A3FFA286FF for ; Thu, 6 Jun 2019 09:03:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A264628826; Thu, 6 Jun 2019 09:03:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 08E7228841 for ; Thu, 6 Jun 2019 09:03:39 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hYoHh-0006TY-Qt; Thu, 06 Jun 2019 09:02:09 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hYoHg-0006TK-Tk for xen-devel@lists.xenproject.org; Thu, 06 Jun 2019 09:02:08 +0000 X-Inumbo-ID: c2dc9e85-8839-11e9-8980-bc764e045a96 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id c2dc9e85-8839-11e9-8980-bc764e045a96; Thu, 06 Jun 2019 09:02:07 +0000 (UTC) Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=roger.pau@citrix.com; spf=SoftFail smtp.mailfrom=roger.pau@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of roger.pau@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible Received-SPF: SoftFail (esa3.hc3370-68.iphmx.com: domain of roger.pau@citrix.com is inclined to not designate 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 include:spf.citrix.com include:spf2.citrix.com include:ironport.citrix.com exists:%{i}._spf.mta.salesforce.com ~all" Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: i1v8eSehGkrdR1LhDVRTpoRdeEkESBEJZ4B9ppKZog+uJp1pU/RB4Pgwb9P2HMKmN7TJDlLBYu yfER/as53qq01kqalJLDpoVkfBt4S8Nm1Uir9SOPGUIl7oLZGXJbZ1PlXxxL76yk3kkr86/2Wv BKGfYpm6pytHXLVv1rgIXmlkcLC1cl/2Blfe6ki0Q1BQPkntPMcDeqzxb8UIHiN7yJ+R8xJPo4 Jyeqj12NFuvny0HwZkIfQOizMZE/bX55gqL/bxZ+b+KmysULSKz+gXrFGc2haqhfgBputUfwGN k3A= X-SBRS: -0.9 X-MesageID: 1392581 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.63,558,1557201600"; d="scan'208";a="1392581" From: Roger Pau Monne To: Date: Thu, 6 Jun 2019 11:01:35 +0200 Message-ID: <20190606090146.77381-2-roger.pau@citrix.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20190606090146.77381-1-roger.pau@citrix.com> References: <20190606090146.77381-1-roger.pau@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 01/12] pci: introduce a devfn field to pci_sbdf_t X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich , Roger Pau Monne Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP This is equivalent to the current extfunc field in term of contents. Switch the two current users of extfunc to use devfn instead for correctness. No functional change. Requested-by: Jan Beulich Signed-off-by: Roger Pau Monné --- Cc: Andrew Cooper Cc: George Dunlap Cc: Ian Jackson Cc: Jan Beulich Cc: Julien Grall Cc: Konrad Rzeszutek Wilk Cc: Stefano Stabellini Cc: Tim Deegan Cc: Wei Liu --- Changes since v1: - New in this version. --- NB: Paul suggested to name the function field fn instead of func, so that it would match the naming of the devfn field. Sadly the func field cannot be aliased to another field using a union because it's a bit field, so the only option is to rename func to fn. I don't have a strong opinion, but if there's consensus it should be done after this patch IMO and not later in the series, as more occurrences of sbdf.func will appear. --- xen/drivers/vpci/vpci.c | 4 ++-- xen/include/xen/pci.h | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c index 82607bdb9a..4f1f95ab69 100644 --- a/xen/drivers/vpci/vpci.c +++ b/xen/drivers/vpci/vpci.c @@ -327,7 +327,7 @@ uint32_t vpci_read(pci_sbdf_t sbdf, unsigned int reg, unsigned int size) } /* Find the PCI dev matching the address. */ - pdev = pci_get_pdev_by_domain(d, sbdf.seg, sbdf.bus, sbdf.extfunc); + pdev = pci_get_pdev_by_domain(d, sbdf.seg, sbdf.bus, sbdf.devfn); if ( !pdev ) return vpci_read_hw(sbdf, reg, size); @@ -432,7 +432,7 @@ void vpci_write(pci_sbdf_t sbdf, unsigned int reg, unsigned int size, * Find the PCI dev matching the address. * Passthrough everything that's not trapped. */ - pdev = pci_get_pdev_by_domain(d, sbdf.seg, sbdf.bus, sbdf.extfunc); + pdev = pci_get_pdev_by_domain(d, sbdf.seg, sbdf.bus, sbdf.devfn); if ( !pdev ) { vpci_write_hw(sbdf, reg, size, data); diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h index 8b21e8dc84..ec98274675 100644 --- a/xen/include/xen/pci.h +++ b/xen/include/xen/pci.h @@ -49,7 +49,10 @@ typedef union { uint8_t func : 3, dev : 5; }; - uint8_t extfunc; + union { + uint8_t extfunc, + devfn; + }; }; uint8_t bus; };