From nobody Mon May 6 18:14:31 2024 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=1567438338; cv=none; d=zoho.com; s=zohoarc; b=Ja6fZY36MH7yVeQspS72AW+A6hky+Tc1F2yXiU4CNa/vFAPJVZ45822gi2cRYquPb2Wllkigz+ab9Nt4MldGt3Zzg4USqqfR7cv9blI0raTkDAwJAoNbq0sduDjDl4Fe3kG0x7VHKaEvQjsU8j8tFFHcU0jwlxOaesUpZvGrOsg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567438338; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=VhO7HRa/PVYvWrG8avR22ILw8ceZkLWqTqXsBo/cdnw=; b=WDb8akWD5MYW7fyMDA8niOTVZm9b9DwcUXYwjjo8H9SoGlFjiZJ11F3+6mNx9wxMAIF0mJogM/XsKyNDM5w+KKDcPHTomuCBUiWzTpjx3At15VT4TwUexpOm4PnnHm9Wa/U0SryCcr3eGgOA6sOLg+ckO7l6EP2RVPnYR0DAJzU= 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 1567438338652761.0049816918159; Mon, 2 Sep 2019 08:32:18 -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 1i4oIK-0002b6-HZ; Mon, 02 Sep 2019 15:31:04 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i4oIJ-0002b1-IQ for xen-devel@lists.xenproject.org; Mon, 02 Sep 2019 15:31:03 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id ab8a3694-cd96-11e9-aea3-12813bfff9fa; Mon, 02 Sep 2019 15:31:02 +0000 (UTC) X-Inumbo-ID: ab8a3694-cd96-11e9-aea3-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1567438262; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=PIpK+PFRgFlf4LlYd50OocyzLyQ4HFVKaPgE7ebnk1s=; b=KKInRl2oXS/F6zHiIyfz7xUs6IDblBMjD0x/OcHp8og0UK8uYnCZ64fA UM07tGT003h5IqF1Np/KMlP54H8DSqM5EfkpD1QX3c4yKgpG2Z3OZZK5N MSskuenXmKmznKeqkhaGJ4HhB/tTUT79Y1d9RO02q+3UyFtw/jET503Rc U=; Authentication-Results: esa1.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 (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.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=esa1.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 (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 0lORir4D55fgaD907aAHDpsfTc4re7p41Y6u4SYSRKoeYDfVQQf6xyI1vsB3E1uej7sRP8LzHH Vqaz5nkz4d9RU6Yrz1TbEf/6geTzXHvRcvdl0O0KhCn7PRwwqtOiRwGfKLTs7naf+KecfK3bhv Mk1s4UID0vzclwwvOYBqq8NPYxuxtNOVdVvQqzNyIlp2rTAR1ziChbSRdV953YaCYZPXPetyE3 5aIpwfoFM60YEUFpcmqrdQRBRdxfPyV5RLOlbgo8AMjphOjvf+ZnHDyFgONUuxsSPteqOUHLW7 /zI= X-SBRS: 2.7 X-MesageID: 5070876 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,459,1559534400"; d="scan'208";a="5070876" From: Roger Pau Monne To: Date: Mon, 2 Sep 2019 17:30:37 +0200 Message-ID: <20190902153037.99845-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2] vpci: honor read-only devices 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 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) Don't allow the hardware domain write access the PCI config space of devices marked as read-only. Signed-off-by: Roger Pau Monn=C3=A9 --- Changes since v1: - Change the approach and allow full read access, while limiting write access to devices marked RO. --- xen/drivers/vpci/vpci.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c index 758d9420e7..fc5feeb627 100644 --- a/xen/drivers/vpci/vpci.c +++ b/xen/drivers/vpci/vpci.c @@ -418,13 +418,21 @@ void vpci_write(pci_sbdf_t sbdf, unsigned int reg, un= signed int size, return; } =20 - /* - * Find the PCI dev matching the address. - * Passthrough everything that's not trapped. - */ + /* Find the PCI dev matching the address. */ pdev =3D pci_get_pdev_by_domain(d, sbdf.seg, sbdf.bus, sbdf.devfn); if ( !pdev ) { + const unsigned long *ro_map =3D pci_get_ro_map(sbdf.seg); + + if ( ro_map && test_bit(sbdf.bdf, ro_map) ) + /* Ignore writes to read-only devices. */ + return; + + /* + * Let the hardware domain access config space regions for non-exi= stent + * devices. + * TODO: revisit for domU support. + */ vpci_write_hw(sbdf, reg, size, data); return; } --=20 2.22.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel