From nobody Mon Feb 9 12:08:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1567527349; cv=none; d=zoho.com; s=zohoarc; b=gT6V4exLvCGUY8/QP5zW+XGFIZG3L5WoiEWfksKRXcuY6nOaqMt/wnIpZuR4RSs6x5gKY4aGGzcq3V0BE5P/j/o8Bg6wUsm6mALJHGPJjR66x6fcsz/9tzgTz8Y5v7+CH6I42orkZvddnpgNGOBU3HD9qslzLInAjdR0UL1x6bE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567527349; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=49ayXnL8CbWi0IjnAGuyDz8MRu6frf3kYnK2mWbpAYA=; b=lEWGwxRf1mlSrPE90ryYrDE7xUXaj+vDsgEwZRc1jU59lAdiPrgpbsWdWdSxz8GpqJVuB6RvlsUX7Xgia/M0o7SAzYauDYf8vWnJ2wVkzc5VxcQheNxouXhaNstDFdSZKSbxraPHqasbShlM09kdUOQU9K9CnFV1ti+mn/gxHLg= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 156752734952142.58924295848885; Tue, 3 Sep 2019 09:15:49 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i5BS8-0001rO-LO; Tue, 03 Sep 2019 16:14:44 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i5BS7-0001rH-Tj for xen-devel@lists.xenproject.org; Tue, 03 Sep 2019 16:14:43 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id f00e0e6a-ce65-11e9-b299-bc764e2007e4; Tue, 03 Sep 2019 16:14:43 +0000 (UTC) X-Inumbo-ID: f00e0e6a-ce65-11e9-b299-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1567527283; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YS8KlF9FkGms/zL4mp6PZyXe0FqkybE8K+gxPiQIHFc=; b=Hny8PXAiMau7j2aZ7KQ35R2dB7OePy7OEaynMU9LYUFBM4s2QEt8Xt8m vGiGV8E2XvbJHbTGx8HgGUuVo8v6Dk+UTAs86w1DhR68kJsUhMf/sriUT SC9OsomMpp4l1kUjfsDzuZMdD3OOZyJEx4RHImyGHt0F3SYoZ0MQfMko7 M=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=roger.pau@citrix.com; spf=Pass smtp.mailfrom=roger.pau@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.hc3370-68.iphmx.com: domain of roger.pau@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa4.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 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: ZUc2B59rq7c5UPaD1jyYG+gW313oRZd88vPEYL7vNs8SqziiUxFRkgL5iXBOXDYONeaXt5fOjU DqqZOQ/Pgjz9ChSO2Qb81cusP9yTW03+5g6lqbb9Kyd9oTKiJd7DvfO93+wWPORRQ7GPNVqFDV wo82s7D71nOmYmZBHudtCSGHhKpqgDN5WkQALIa6sc2tORMju5DpiGPMeIM3DWpAxaOvLh2Rpd HZ+va6IfidzBdKG8RCEloJ9YVfjccXSHxSObJd9gY690YmsPfiSqd3ymZ3VcHEaCkIisODZpVH zbs= X-SBRS: 2.7 X-MesageID: 5339034 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,463,1559534400"; d="scan'208";a="5339034" From: Roger Pau Monne To: Date: Tue, 3 Sep 2019 18:14:19 +0200 Message-ID: <20190903161428.7159-3-roger.pau@citrix.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190903161428.7159-1-roger.pau@citrix.com> References: <20190903161428.7159-1-roger.pau@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 02/11] ioreq: terminate cf8 handling at hypervisor level 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: Andrew Cooper , Paul Durrant , Wei Liu , Jan Beulich , Roger Pau Monne Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Do not forward accesses to cf8 to external emulators, decoding of PCI accesses is handled by Xen, and emulators can request handling of config space accesses of devices using the provided ioreq interface. Fully terminate cf8 accesses at the hypervisor level, by improving the existing hvm_access_cf8 helper to also handle register reads, and always return X86EMUL_OKAY in order to terminate the emulation. Also return an error to ioreq servers attempting to map PCI IO ports (0xcf8-cfc), as those are handled by Xen. Note that without this change in the absence of some external emulator that catches accesses to cf8 read requests to the register would misbehave, as the ioreq internal handler did not handle those. Signed-off-by: Roger Pau Monn=C3=A9 --- Changes since v1: - New in this version. --- xen/arch/x86/hvm/ioreq.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c index 692b710b02..69652e1080 100644 --- a/xen/arch/x86/hvm/ioreq.c +++ b/xen/arch/x86/hvm/ioreq.c @@ -1015,6 +1015,12 @@ int hvm_map_io_range_to_ioreq_server(struct domain *= d, ioservid_t id, switch ( type ) { case XEN_DMOP_IO_RANGE_PORT: + rc =3D -EINVAL; + /* PCI config space accesses are handled internally. */ + if ( start <=3D 0xcf8 + 8 && 0xcf8 <=3D end ) + goto out; + else + /* fallthrough. */ case XEN_DMOP_IO_RANGE_MEMORY: case XEN_DMOP_IO_RANGE_PCI: r =3D s->range[type]; @@ -1518,11 +1524,15 @@ static int hvm_access_cf8( { struct domain *d =3D current->domain; =20 - if ( dir =3D=3D IOREQ_WRITE && bytes =3D=3D 4 ) + if ( bytes !=3D 4 ) + return X86EMUL_OKAY; + + if ( dir =3D=3D IOREQ_WRITE ) d->arch.hvm.pci_cf8 =3D *val; + else + *val =3D d->arch.hvm.pci_cf8; =20 - /* We always need to fall through to the catch all emulator */ - return X86EMUL_UNHANDLEABLE; + return X86EMUL_OKAY; } =20 void hvm_ioreq_init(struct domain *d) --=20 2.22.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel