From patchwork Tue Aug 29 23:19:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Babchuk X-Patchwork-Id: 13369803 Return-Path: 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 B0B4CC6FA8F for ; Tue, 29 Aug 2023 23:20:32 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.592524.925377 (Exim 4.92) (envelope-from ) id 1qb80L-0002Tf-81; Tue, 29 Aug 2023 23:20:13 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 592524.925377; Tue, 29 Aug 2023 23:20:13 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qb80K-0002Qy-MT; Tue, 29 Aug 2023 23:20:12 +0000 Received: by outflank-mailman (input) for mailman id 592524; Tue, 29 Aug 2023 23:20:10 +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 1qb80H-0006kQ-OW for xen-devel@lists.xenproject.org; Tue, 29 Aug 2023 23:20:09 +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 975d823e-46c2-11ee-9b0d-b553b5be7939; Wed, 30 Aug 2023 01:20:07 +0200 (CEST) Received: from pps.filterd (m0174682.ppops.net [127.0.0.1]) by mx0b-0039f301.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37TFMk9g021983; Tue, 29 Aug 2023 23:19:49 GMT Received: from eur05-db8-obe.outbound.protection.outlook.com (mail-db8eur05lp2108.outbound.protection.outlook.com [104.47.17.108]) by mx0b-0039f301.pphosted.com (PPS) with ESMTPS id 3ssdvpbm4f-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 29 Aug 2023 23:19:48 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com (2603:10a6:803:31::18) by AM7PR03MB6371.eurprd03.prod.outlook.com (2603:10a6:20b:1b8::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.35; Tue, 29 Aug 2023 23:19:42 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::9d42:8444:f00d:7895]) by VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::9d42:8444:f00d:7895%4]) with mapi id 15.20.6699.034; Tue, 29 Aug 2023 23:19:42 +0000 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: 975d823e-46c2-11ee-9b0d-b553b5be7939 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nwRFIKQxV/4EBeCnkN+k9tbYlODgl03wOQ507M0uDlnZN9MLrGeTRSY3JYW5n/SXOKSUuwpEZ2IiNO5430mJc6YyAVYiQVm+/RjC0CzNDRlKBG+oy1G8MQRB7JNSKboCpF6RXKaQhX+pMVRcTn0TIabLtXxD0w2KvoF1VicF75z5BWry3QQKRiNuiJJeBHJXh/Zf4NNRYzShPnr573zK3kLgQ73tggDQFH5gZLbt7dLre26zZ8nBw/Na3uxb4+gM2D+zLBvu1a94Au54eAeoocW6YkRwSa7roNwDfUa6ePzNYui/jmsPBYG/HxJ8Biiqm+Bx+bEOl1wszmgOlC3isw== 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=uPcQXPgI5mctGtrdP3jDDvVvUOnHDqkbfoeVa86vr+I=; b=Kl2MIyHpnRqJOu65xDcql0WPcuKvh/OQw4uB72qc6Nj64CKoZ/0wkrVessRuWh3RyCR1m6VivtrmdRKQVreWMcciySZ+BLgbMl+BxLm9ef+nGD/U8Sg5C1pljkvPNJnSa9ZFF2ghwYqXLw80BBXsFMFsn7FC1CSV69XkYNkDN0MuO3M+qnAUm+XT/XaXjKZGg7SHm4JXHa1fvA5xlB632+8Ty64kilXjp5umCZj5dMirLXH4KBR+J1LUEmNsNonwIaMo99jdajo9NWJIBjxHaVUoFmaN6cpUlitvmF6KRabtHw0x2oqni6qDzuuIbHIVBQupcAFC3D4llMLE74Bgkw== 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=uPcQXPgI5mctGtrdP3jDDvVvUOnHDqkbfoeVa86vr+I=; b=YtcZoPlHKsWxfhEJMtyFFDd50kYPOE9XF2bOA7C/rW1DjBfkEETYGytJ/5JxkJiAGg1xoZbxsgGbgnNWinlZbbYCqIW8PzJnmQ7ji07otWABLsDUIg3+Lcz81C2ygtMIKnTdHhPBTf27dGBTb0p1f8OOIqwToSrpa9sXtgw3SYIx3YWbl5AtL1TsJyBYowWJw5iDKsoSXfNUFBWZQ/p1nEJM/8QanoBWunjY+1N0Cs6N4n0OWsmce1qTOeyCWSZNzfHDXurT1HyONl56z86OQWgQPU+VILym4pFuIiXRxcvwozwlr1hcPYhlx7kL+no/vy/TkfgblOrVrp1yO1qvfw== From: Volodymyr Babchuk To: "xen-devel@lists.xenproject.org" CC: Stewart Hildebrand , Volodymyr Babchuk , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu , Paul Durrant , =?utf-8?q?Roger_Pau_Monn?= =?utf-8?q?=C3=A9?= , Kevin Tian , Jun Nakajima , Bertrand Marquis , Volodymyr Babchuk Subject: [PATCH v9 00/16] PCI devices passthrough on Arm, part 3 Thread-Topic: [PATCH v9 00/16] PCI devices passthrough on Arm, part 3 Thread-Index: AQHZ2s9JMemQqeQYOU6/+Cr/izf61Q== Date: Tue, 29 Aug 2023 23:19:41 +0000 Message-ID: <20230829231912.4091958-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.41.0 x-ms-publictraffictype: Email x-ms-traffictypediagnostic: VI1PR03MB3710:EE_|AM7PR03MB6371:EE_ x-ms-office365-filtering-correlation-id: 86d1d6bb-27f4-4868-2a72-08dba8e66c4c 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: nCRgzZiwwd18zcYwdD1WeobdHNrvNNjqZUlUO0K00SpLCdIlGciifnzvWKlk0SPdSlQFkZQhaylD1sXNJrbYCh6PqOFIzHlKyhj+q4uRMFLAhpu+7mE9RA9zH1r73FDtkngJpxA5kG8VZ8aU8gE5IVGWibym0L1hqvnKjS/WRPq7YpgfNF62JfD7cL6H0a9P5UU8l7ty01pKj0u4ngCN14jAVeqv5wP7BVVcLeW4ZsfrLzSxUua+PJsJ2NClJt4+GOCwMgvidoFkbMJYRilhrsohTC0sdRYj2womLh8RG7A66uNGP7pWvv55r/AF5Hd9gaqQyJ/TrEkjoPFTdN28a+ARiymMtYT0W22negE9tA55kE7sX/EgJim/56oDDJnuwhaAb6+SF0fZgtOj1sV6MCj8U5+FJoej2ifUrplNaYUCu2ODcu1WqNKX/Wiuk9rdnjo/YS13susXa+zd+yB86mSLdzIN7xGSEOQ/KFVq6cPyWpD+u9xsSz2rhmtsaXpoGLfMdMIXba0FxmZCCCVnxh2ScySNOvtMAsdCpSOAqYdBRPOsnZxdz6THBR9K6x0B195Tb1qlJxeiOeStMWPqht0GkVR8uen1GwwtagEuuJuDA2ri4P0OpsY6OsP8tj9d 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)(346002)(39860400002)(376002)(396003)(136003)(366004)(451199024)(1800799009)(186009)(71200400001)(6512007)(6506007)(6486002)(478600001)(55236004)(76116006)(1076003)(2616005)(107886003)(26005)(2906002)(6916009)(64756008)(7416002)(66446008)(54906003)(316002)(5660300002)(66476007)(66556008)(91956017)(66946007)(41300700001)(83380400001)(8936002)(4326008)(8676002)(36756003)(38070700005)(38100700002)(86362001)(122000001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?DUZ46Zmi6ZEdB0V7KLB5n4KKwoDR?= =?utf-8?q?XkZ1cht0Gbc/kfkezFnC/WbYZsWkKWM3jHDyLyqOpLLgtqTTbChnCzNZbP+4vfg3r?= =?utf-8?q?0FkQ7GasIZOk76kaYIq0NoTG/0afxOx2sCRDDMspaer9kaGsP3Ww90m1yVyPgR0xe?= =?utf-8?q?jZR37m26xHPu1XtpcCIOM/33f67X75KA6olLTRDDjwRbA9J96X7ml3mcIj8zlBoFk?= =?utf-8?q?4Ccpy9xrnEo89FNJu3T7vXuOjlb8zN57TrbqqqTL0nuabtp5cEYQm00s8mvnciDoj?= =?utf-8?q?2NYbHOhJ356T7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rvUWPid7a7c+1IEcNgFvE2lg3+x8cq4gYLCL?= =?utf-8?q?1yhFuIgGufBjdjBsowNqgRJzqRwYGtMcbXafRMd6TYURvroqoHXnAdYNi5or87Dnt?= =?utf-8?q?Y/OS305LwHczIp+Y9sx+tdUQtwwWtU+eMBv7nbPv0RXRaO1ppPICe+3Vhr6IzKhuT?= =?utf-8?q?kB+9DmqFYLJ0hKkVqBKAl9ZDRJxiLecA2WsnlPPD2icdO3HmLJPnR4KIdCpOjbNE4?= =?utf-8?q?fe90xKYuk6TAGofjq2JJN2QpU6f7BduWiT57HnYQCXQabV7+gyG422Aipo2rU9+JF?= =?utf-8?q?fJye7Ym0PnbuYpc/HmgyuaZT1sMD42SltsxKIPFsEyMwNXh7ke66MAF2pMo6HxV59?= =?utf-8?q?MxY7vZuM+T0D2downVm8jPqs8MFRooKFaw=3D=3D?= Content-ID: <902A2B3C8CD1274E9B14BE68D5851568@eurprd03.prod.outlook.com> 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: 86d1d6bb-27f4-4868-2a72-08dba8e66c4c X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Aug 2023 23:19:41.5885 (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: fCxFSzy6qpGwpHZbYt5L588kVZ+15oWUc9UAs58UM1Xr1TqSVJnT88ETHOLK2keoLIJAtwQou4OzB7hHn7674fzI0Naee/jc7e9sRlGT/d8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR03MB6371 X-Proofpoint-ORIG-GUID: l7S2BoXKZoQ1lr1tKx84gsci3KbLh4-Y X-Proofpoint-GUID: l7S2BoXKZoQ1lr1tKx84gsci3KbLh4-Y X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-29_16,2023-08-29_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 bulkscore=0 mlxscore=0 adultscore=0 priorityscore=1501 impostorscore=0 lowpriorityscore=0 phishscore=0 spamscore=0 suspectscore=0 mlxlogscore=793 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2308290202 Hello all, This is next version of vPCI rework. Aim of this series is to prepare ground for introducing PCI support on ARM platform. This vesion includes addressed commentes from a previous one. Also it introduces a couple patches from Stewart. This patches are related to vPCI use on ARM. Patch "vpci/header: rework exit path in init_bars" was factored-out from "vpci/header: handle p2m range sets per BAR". Changes from previous versions are described in each separate patch. Oleksandr Andrushchenko (12): vpci: use per-domain PCI lock to protect vpci structure vpci: restrict unhandled read/write operations for guests vpci: add hooks for PCI device assign/de-assign vpci/header: implement guest BAR register handlers rangeset: add RANGESETF_no_print flag vpci/header: handle p2m range sets per BAR vpci/header: program p2m with guest BAR view vpci/header: emulate PCI_COMMAND register for guests vpci/header: reset the command register when adding devices vpci: add initial support for virtual PCI bus topology xen/arm: translate virtual PCI bus topology for guests xen/arm: account IO handlers for emulated PCI MSI-X Stewart Hildebrand (2): xen/arm: vpci: check guest range xen/arm: vpci: permit access to guest vpci space Volodymyr Babchuk (2): pci: introduce per-domain PCI rwlock vpci/header: rework exit path in init_bars xen/arch/arm/vpci.c | 71 ++- xen/arch/x86/hvm/vmsi.c | 24 +- xen/arch/x86/hvm/vmx/vmx.c | 2 - xen/arch/x86/irq.c | 15 +- xen/arch/x86/msi.c | 8 +- xen/common/domain.c | 5 +- xen/common/rangeset.c | 5 +- xen/drivers/Kconfig | 4 + xen/drivers/passthrough/amd/pci_amd_iommu.c | 9 +- xen/drivers/passthrough/pci.c | 103 +++- xen/drivers/passthrough/vtd/iommu.c | 9 +- xen/drivers/vpci/header.c | 497 ++++++++++++++++---- xen/drivers/vpci/msi.c | 32 +- xen/drivers/vpci/msix.c | 56 ++- xen/drivers/vpci/vpci.c | 158 ++++++- xen/include/xen/rangeset.h | 5 +- xen/include/xen/sched.h | 9 + xen/include/xen/vpci.h | 39 +- 18 files changed, 868 insertions(+), 183 deletions(-)