Message ID | 20231202012556.2012281-5-volodymyr_babchuk@epam.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <xen-devel-bounces@lists.xenproject.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AAE6BC10DC1 for <xen-devel@archiver.kernel.org>; Sat, 2 Dec 2023 01:27:34 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.645829.1008237 (Exim 4.92) (envelope-from <xen-devel-bounces@lists.xenproject.org>) id 1r9Emt-0002Ay-Ts; Sat, 02 Dec 2023 01:27:19 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 645829.1008237; Sat, 02 Dec 2023 01:27:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from <xen-devel-bounces@lists.xenproject.org>) id 1r9Emt-0002Ao-Qk; Sat, 02 Dec 2023 01:27:19 +0000 Received: by outflank-mailman (input) for mailman id 645829; Sat, 02 Dec 2023 01:27:18 +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 <SRS0=jVJG=HN=epam.com=prvs=6700ee1bd8=volodymyr_babchuk@srs-se1.protection.inumbo.net>) id 1r9Ems-000271-Gj for xen-devel@lists.xenproject.org; Sat, 02 Dec 2023 01:27:18 +0000 Received: from mx0b-0039f301.pphosted.com (mx0b-0039f301.pphosted.com [148.163.137.242]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id eb9763e6-90b1-11ee-9b0f-b553b5be7939; Sat, 02 Dec 2023 02:27:14 +0100 (CET) Received: from pps.filterd (m0174680.ppops.net [127.0.0.1]) by mx0b-0039f301.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3B20exWY004068; Sat, 2 Dec 2023 01:27:12 GMT Received: from eur02-vi1-obe.outbound.protection.outlook.com (mail-vi1eur02lp2040.outbound.protection.outlook.com [104.47.11.40]) by mx0b-0039f301.pphosted.com (PPS) with ESMTPS id 3uqt8mg1hm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 02 Dec 2023 01:27:11 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com (2603:10a6:803:31::18) by DU0PR03MB8599.eurprd03.prod.outlook.com (2603:10a6:10:3e6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.27; Sat, 2 Dec 2023 01:27:06 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::8e03:368:1fd7:1822]) by VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::8e03:368:1fd7:1822%6]) with mapi id 15.20.7046.027; Sat, 2 Dec 2023 01:27:06 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion <xen-devel.lists.xenproject.org> List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-devel>, <mailto:xen-devel-request@lists.xenproject.org?subject=unsubscribe> List-Post: <mailto:xen-devel@lists.xenproject.org> List-Help: <mailto:xen-devel-request@lists.xenproject.org?subject=help> List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xenproject.org?subject=subscribe> Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" <xen-devel-bounces@lists.xenproject.org> X-Inumbo-ID: eb9763e6-90b1-11ee-9b0f-b553b5be7939 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PVV67vpxBffXxsYMlmmK8gJaR/DMybyhELr2tdhCVNw3hW0O0kXW68wkcapv0Ncfg0Rj2E+9jNidiIgfx/0+aq8YqreY6rzRqvnNJArH2F72q+JFkiIJtR0Cw2Axg+aKGfBnVyrqgcCjYKaxcDwRqXDM6xjvS6HSePLHDa/h8Ui8GTbHCAevSCNPEi5q8aCiHryReFM7aqoZz+KVOYu2uKuNgPNpipnGcM3N18ogPxlhmLcI5xRL2IgucwL69jiSCXJ9Hbc2OuQzbRIKGJJrpQnIZ4oiHvQA8G/wss7fwVZlkojgxq1gRr4ikGlfbB12PwyxwzyzGSYzWA/4RclyEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kEcu45xdaIpfXtUGO2Sqnh0DJtv9WM0RX9NJ+e+vxXs=; b=nZej2pAQdMYTWnY1bn+qOynGXYYu4KqAS7k8GvFFypdaOPzH4Velgtkd/8pJJWu54w6uNuKCNQW2oFDoq7eE70Pre4H/LDLqidGJlArMXSWGteW7ekg5V8oKyynKAY32MC3PJHZ/42jBX5frh4ueqqfzX1sg5lqsPJJEk+pbq+QfzUHmpZjhXhhP1DScs1qywzi3rELpHnB22J4SUzN1gmmQuX7fbogVDmY1criJ48Uma/9kt2EW0lpiOUXJtK5vTsxtnpnKtFaa6eY7gYAwQtD8q7uQJzp+L3mVu00Nxdi9um1k1oAnZyCh+EyjuHsrfUqppmCbA7dZyQ0BBgyShw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=epam.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kEcu45xdaIpfXtUGO2Sqnh0DJtv9WM0RX9NJ+e+vxXs=; b=UODhRrK7CCn3wvuVnh6kgfZTEVVI8/4u9ribXWt9c4560GyJmKMnCiOElfC6dIr5tX2dxPKguL0AUNCS8bIG1wSiCPGCy5ho3fH8cWKqYZ2kBsonSTookbLLydbPbjJes62k+gU0gkCV/BWO/L+IIsqpmr8S406g/BuQyeebsJWmJfOZHOodPVKA4QzIsESuvQMR3Qgn/ewq+p4V3yvE0kCQmoXQRYYNgNbtX8aUNZbPxXVPrUIqBTR8zMo9Xtgf7Al2CjIFs2OeK+5BPc63DLeGXYFja/w4NE2PHLBfqyoOaoQcK9Qi1zspqVTbGFwXHO5VCjHyAP5aB/i4ey0Hyg== From: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com> To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org> CC: Stewart Hildebrand <stewart.hildebrand@amd.com>, Oleksandr Andrushchenko <Oleksandr_Andrushchenko@epam.com>, =?utf-8?q?Roger?= =?utf-8?q?_Pau_Monn=C3=A9?= <roger.pau@citrix.com>, Volodymyr Babchuk <Volodymyr_Babchuk@epam.com> Subject: [PATCH v11 04/17] vpci: restrict unhandled read/write operations for guests Thread-Topic: [PATCH v11 04/17] vpci: restrict unhandled read/write operations for guests Thread-Index: AQHaJL6nE24AjhfTmkCFnkV7ezIkjw== Date: Sat, 2 Dec 2023 01:27:03 +0000 Message-ID: <20231202012556.2012281-5-volodymyr_babchuk@epam.com> References: <20231202012556.2012281-1-volodymyr_babchuk@epam.com> In-Reply-To: <20231202012556.2012281-1-volodymyr_babchuk@epam.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.42.0 x-ms-publictraffictype: Email x-ms-traffictypediagnostic: VI1PR03MB3710:EE_|DU0PR03MB8599:EE_ x-ms-office365-filtering-correlation-id: 80ec34e3-a240-4e66-ebcc-08dbf2d5cbae x-ld-processed: b41b72d0-4e9f-4c26-8a69-f949f367c91d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 2N/TNAahW4L73JX+HAXfzCTMdpr1gcTQhVzVOy+PLMysr87Ho5bS1WZ4sUwqYLwqkDxkmPOMTS3fcS0R14AZzEcxqvjUYOhi2bFuhggx9DmsICGIvRWWxBbwwKbDTjcf9iQ4B7XhZ0M30Z4zXR8Wf1ebgKClp+wK0p7vbk2uPYwg8L2C6Yy/KW+TXmBJgYBGhh4KPeSBzBNk8NFFYOcEH8Kr6xAxI6/RAMmEK1pMZ66FJxk2gNua8zVitz9Wf8nSunb8v/KqJ21bdi/Ltqw4y2/GzCur5r9DaJaWi5E6U7bJ5bpeWYtB6Yl6znjPnFcwFITSzMyK+XFwdwRiyYoSHyATLd6zlURGOVosnHsoceeuP90duHQGCUgxlX7oBIDzpFYHdOdPM4ngYQJn+ZHfte42dGSAggDfsZjyIWLLzjiLb0L1gDVfdZa78JxExxJG0TLvRLkyVykANsm2FTo33gHhzqKYNQdPGrCtQ+H6PIfe7ie2PFVdphjy7GZgDXPNRZ46crvdZ4HDfb1Y1I1cW1rRRurHCADnGLPSWTlh5SRRdvEFijVFExeDxtA5eY9xovoMgQtwoN+1tOnQJWU9r0QIKfz0dD7Sl0Ov8LNQdudLcfnyIVJaEngpChDl80K0 x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB3710.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(396003)(39860400002)(346002)(376002)(366004)(230922051799003)(186009)(64100799003)(451199024)(1800799012)(5660300002)(86362001)(4326008)(8676002)(8936002)(2906002)(38070700009)(41300700001)(36756003)(2616005)(107886003)(1076003)(6512007)(6506007)(55236004)(83380400001)(6486002)(478600001)(26005)(71200400001)(6666004)(38100700002)(122000001)(316002)(91956017)(54906003)(64756008)(66446008)(6916009)(66476007)(66556008)(76116006)(66946007);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?t8ekKUdTnBnid36GLRx9ifLuEgkK?= =?utf-8?q?4uzUNCZSIfWgPK+reqtq2Grm1FuPgbF6jXEewoFiA45Ut/dvqX7PtK9iSG4cTXdnP?= =?utf-8?q?t4LyBOzZm5n4mSfKpd6VGjGaZQJTucNAlDl5iFebfNBDmVPjU5wRziu8J2rtW2uhG?= =?utf-8?q?53DgcukeWv2IzGkSrT8Hcd998i2orC2x+p7zpjBYam5wVsaVJl86XoeeYVrpodOz2?= =?utf-8?q?i3eE+0tA+16wAEwgJiBjS93RpuLZsEXtyk23AXPipNjfbts75n2/bx3vdhiLE/RSv?= =?utf-8?q?UBptkqhD8ffAEBnf+u8Fzjeq/qigkkvI09wlHm4i9slLu87MrWGBXgIt0T2vOFV2y?= =?utf-8?q?jTIT/jlS4RpMs1bjs/S1qlPJQiW0aTNEb564NA4feSWHnUonBzyI5QODX3tn8p3Gw?= =?utf-8?q?cRI5HhjMsvzeSZwmJnOh79iJpVu1qhyNxf467JLqgZDMj1T0KfriuM2knDrietESf?= =?utf-8?q?OsX9K6f+GzP1molhwOjM7Wul5pYStI1r8iRPQpzM2Nd7O7BLAOMw+wQ0RD4yBZxyC?= =?utf-8?q?bi/u4AqruIQUzyMNIsMzvyiM4AwVCIx5zV1bynKLBVmvgZBKxkW+DOj8Iq3/lr8xd?= =?utf-8?q?9+RTh4+vMnmINgrfHI/06eC/jL1dkidsfIyLfaUxG/ty1Vh/yVWRCYaWcP0wUDy5b?= =?utf-8?q?WbBddA3fwFpbzaL72MehwNnt34dtDc+muTUp58EZ6XNMc7AeJubdRxquUFNQ1JnJn?= =?utf-8?q?FEESBcqTwSO7BrsQtQ9QDC6CGkdfduG5uP2o6nL+EblTmBVAVUDquLunrypMlIUwj?= =?utf-8?q?Z+10sgYIv9nbls6sp4PeaTwES0L5u7PvGhJ/0sSEzPiIi3pgGRvxOUnsz8KgTL6WZ?= =?utf-8?q?UuDnPeAvi/j+D2a0iKyUsgf4NJW1odHSM6aG3h/AHwEjWp/qYWwxkWJ+v6bN71kOU?= =?utf-8?q?jG+U3mVUi5CwGZTdpfXEvLxQW2QVrGIMS3k9YtqD8tMbl0xjPGgmeYjxzfhRgSde1?= =?utf-8?q?+P3Ug7873f/Koc3KzU1THCZjd7c7PR37PWedTI6xxaFdbm2QAA4K/ewI/HRi90oZ9?= =?utf-8?q?pXJP2ibb3Y+qKkQDv9VjEQ2U19aCZLFTseTnQSZL4lSgsYR86JRmx3H3U7tE+8vxn?= =?utf-8?q?jUpy4Sho+J9012wW1V9/zhDYyCDIjHwqapHd3dce/toBe9w5TiCJ3P2T4DExelSui?= =?utf-8?q?80I7vahyVXZtDiMPQOEbWUt54dBXq2mSuHxeu0zOEBLvWA4PXzhdoAHoJaU/1g7Jv?= =?utf-8?q?sq39pCwZzc3kyHQX2x6B4p32kh0HXSyNP7aqchIjCEQjznt2NIroV/KxW9y0ci5Kc?= =?utf-8?q?uyeI3u42q17QCmn/sSjxGroPnrJlUCg0HxHH4V/X7QTpc4sV+YZoPkyBIcrjfto5N?= =?utf-8?q?VxvPYVz66b/hfLC4T5oofKn3/npC/prF19Q0xIQIwQ2909OcVeoPDFn7EMC2vX0aD?= =?utf-8?q?F3oeRiRw/4LpyE4+p2H+z/3NFntLhoKYypprOCnHrHDUQlCjKfZrOZ+Inugk7g7P3?= =?utf-8?q?LCYI50MtC1mvTDfh9+zfhOvcb1R2/PVYHWX+zgI3VPu69zxFIjvH2NRO8b4sUTriX?= =?utf-8?q?ReEZu1iO6YwkU83RBCBdAfgyWGw2Ao+oNA=3D=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <0602D929B1A7F342A0843CA4FA2B004F@eurprd03.prod.outlook.com> Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB3710.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 80ec34e3-a240-4e66-ebcc-08dbf2d5cbae X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2023 01:27:03.5224 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b41b72d0-4e9f-4c26-8a69-f949f367c91d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Vww/+lC8a1TlEoTF72cbIYT1y9XqExC3c/h9NufnURYzjLVp4D0kOePyFjXMc7b/acBK5+/+ZoZZxjDz98W2Iw1n78y13+M4VRaQAkS1guU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR03MB8599 X-Proofpoint-ORIG-GUID: NWLUW9YaROk7wzB6Wg9Jh9JOx0Yo-LuI X-Proofpoint-GUID: NWLUW9YaROk7wzB6Wg9Jh9JOx0Yo-LuI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-01_24,2023-11-30_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 phishscore=0 suspectscore=0 impostorscore=0 mlxscore=0 adultscore=0 malwarescore=0 lowpriorityscore=0 mlxlogscore=999 clxscore=1015 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2312020008 |
Series |
PCI devices passthrough on Arm, part 3
|
expand
|
diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c index 0b694beadf..4fec4b26d9 100644 --- a/xen/drivers/vpci/vpci.c +++ b/xen/drivers/vpci/vpci.c @@ -233,6 +233,10 @@ static uint32_t vpci_read_hw(pci_sbdf_t sbdf, unsigned int reg, { uint32_t data; + /* Guest domains are not allowed to read real hardware. */ + if ( !is_hardware_domain(current->domain) ) + return ~(uint32_t)0; + switch ( size ) { case 4: @@ -276,6 +280,10 @@ static uint32_t vpci_read_hw(pci_sbdf_t sbdf, unsigned int reg, static void vpci_write_hw(pci_sbdf_t sbdf, unsigned int reg, unsigned int size, uint32_t data) { + /* Guest domains are not allowed to write real hardware. */ + if ( !is_hardware_domain(current->domain) ) + return; + switch ( size ) { case 4: