From patchwork Tue Jun 13 10:32:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Babchuk X-Patchwork-Id: 13278340 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 1EC8EC88CB9 for ; Tue, 13 Jun 2023 10:33:16 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.548003.855756 (Exim 4.92) (envelope-from ) id 1q91KS-00033l-Cw; Tue, 13 Jun 2023 10:32:48 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 548003.855756; Tue, 13 Jun 2023 10:32:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1q91KS-00033Z-8M; Tue, 13 Jun 2023 10:32:48 +0000 Received: by outflank-mailman (input) for mailman id 548003; Tue, 13 Jun 2023 10:32:47 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1q91KQ-0001im-VQ for xen-devel@lists.xenproject.org; Tue, 13 Jun 2023 10:32:46 +0000 Received: from mx0b-0039f301.pphosted.com (mx0b-0039f301.pphosted.com [148.163.137.242]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id a28aba95-09d5-11ee-b232-6b7b168915f2; Tue, 13 Jun 2023 12:32:46 +0200 (CEST) Received: from pps.filterd (m0174683.ppops.net [127.0.0.1]) by mx0b-0039f301.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 35DAO5KX019280; Tue, 13 Jun 2023 10:32:33 GMT Received: from eur05-am6-obe.outbound.protection.outlook.com (mail-am6eur05lp2106.outbound.protection.outlook.com [104.47.18.106]) by mx0b-0039f301.pphosted.com (PPS) with ESMTPS id 3r5yahmgn9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Jun 2023 10:32:32 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com (2603:10a6:803:31::18) by DU0PR03MB9706.eurprd03.prod.outlook.com (2603:10a6:10:44e::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Tue, 13 Jun 2023 10:32:27 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::6fa2:d7b8:9bd4:1a51]) by VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::6fa2:d7b8:9bd4:1a51%5]) with mapi id 15.20.6455.045; Tue, 13 Jun 2023 10:32:26 +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: a28aba95-09d5-11ee-b232-6b7b168915f2 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HFo7Sa8zm/Ht66kAc4Xn6T+u7b5NHw8DTsD5ymKb6G+HVLVtu4JExg5+KdMKUBf7D2ljXxXhgGCKFizly18kJhngo6BaDC1uap98ChsL+qxiRWC3eb2jivFSm8mIt2YWQYnTK+VVcJC5x+ADUyceHjInyP575OFpZvfgwIpzedtwT7G8KNqc5kxkAXnCph+dw1//fxF4dNKfeqCc5uBl+DcC7pe7323385bJOmTXoqcX0bQOFAN8oCG+umRm61IHrJdMf9K7Bib99gt3QQ9i6nuYo82M/AjCMlgnA2bQ7Hl/lxyhpiIcjSWV6HIKIegku4Mrpo9M9ha6YkQRh8QTVw== 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=WiG9vC34t2GxGzLSOhrsfH8tHrKU/OCY0N5867nXnSg=; b=HCCBdJhKYOJqyFbwX2RWIh7o0fpA71UDiPRzRsn1glyyB7SDXdrAcSRh+JEJncUxqbaYj5B1kZyV8i+3DPUwmIEjbKG32JryYYVzswoPQcKrtaVBI1Xv2pl9G2Rt8xF6LXxRo3CtbYK/zeSFLxQw5auuXrqKioRhifRUs9jdiYYKMmNH4dx6KDj/m9TUl0oFzYTkVI6ctjNN34GLbkBLZi6JVLciWG5SvY30l2gBheu4sjFD3dgRAmjFQdDC0IJDrK/WkQNwBil0u+jakkEgvYXM5OOM21+w6R2QAFCD0MtOGePNWsc2iGy8tLZ1INkojGyuXuvJ8s499xSvcY7SxA== 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=WiG9vC34t2GxGzLSOhrsfH8tHrKU/OCY0N5867nXnSg=; b=IFd1PlgBsoXmoEV42RPSiAU1y4yNxUqezFPT38eOtvKvBciQMPCsHdixAFiPrfwhkV0f3gQ+RAyiqAw6UTIPEgicLcUEq0sr7B8UBE9BVMjz6AjhZgM6hZMMLENrfeOcAvC1/bRf7whbI1JqfZO6Y03beWnkn1lxHxhVvICH0IDM2Qrz39zXFqKGgwUMPEY2ozbVy36QnZ0WvpCjQlNiBgL+81TDi+98aoc/HjLgL890O8i9D97ytoxkX4xX/hJWsUPFhHpHZZiDyyHPlTEiIaBxXZITrRofD77D5XRbbbnmFWtDQIdh7wkh2UAWoJ+QYDe423OtJjBT+DTV6jlPxA== From: Volodymyr Babchuk To: "xen-devel@lists.xenproject.org" CC: Volodymyr Babchuk , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu , George Dunlap , Julien Grall , Stefano Stabellini , Paul Durrant , Bertrand Marquis , Volodymyr Babchuk Subject: [PATCH v7 00/12] PCI devices passthrough on Arm, part 3 Thread-Topic: [PATCH v7 00/12] PCI devices passthrough on Arm, part 3 Thread-Index: AQHZneJYJeyWMREaaUSf/027X0QuCg== Date: Tue, 13 Jun 2023 10:32:26 +0000 Message-ID: <20230613103159.524763-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.40.1 x-ms-publictraffictype: Email x-ms-traffictypediagnostic: VI1PR03MB3710:EE_|DU0PR03MB9706:EE_ x-ms-office365-filtering-correlation-id: e2bbb522-f54b-4288-4094-08db6bf97b88 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: UCm3OR2Xghn68zR6JAyIMurkunurXr/HhEbm1vydwtTur3pISlrvTKhw8PaxGt0ao1Dm8LVnpYx9Vg488AyBHhkB5pitDbjjIwBlrTWbdYbD7WLZVKUa26r4vXRg3z8EaPscB3CVB+5E2wOc0GY8fdBCa4dyVbJGANUw1lLkEaIkbuf9AUrgjD2C2XXBsGw9nH1R21sfuCKBK+T1Z8SONKtavoqT87VB6MvPtCpmszBI8wULy7LdpVeK/j+4ZMP5KHKZEeIbtCCQhjJ0ZzpHATdhA727ICXDrzsnFDA+rbUQoX3eI4ipKi4VkY05CiuXFPMR3/WEXNb6GYuYKqt4SeJJeTjqtPbba0RXJcnhM09PFMYpuM79UXc4n3CGE/BxsvxoxSuRCmRvznd9F4LBVVu8T1QzCgXPIpE+/e1yDWQ7PYnqf+REbxaW4r9dH8mmPwXAyge4fKECMs6O2k5fqpGcHTWJMvcYYpkSFbighrRYPjpeFNa9R0jxUmn26EMVYte+oT+lCMZP+QuOckeuSbTUEzG6b0JZsrtXlxMxj9HK/HMMSZJQiE3qUfYpDotqYSbqJWoMo5AvBj/E6jvE3ITjImtOPdt+lrqfbxx3d/U= 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:(13230028)(4636009)(39860400002)(396003)(376002)(136003)(346002)(366004)(451199021)(966005)(91956017)(64756008)(76116006)(66556008)(66446008)(7416002)(4326008)(6916009)(66476007)(71200400001)(5660300002)(66946007)(41300700001)(8936002)(8676002)(316002)(36756003)(54906003)(83380400001)(478600001)(2906002)(6486002)(38100700002)(186003)(6506007)(107886003)(26005)(1076003)(6512007)(86362001)(55236004)(38070700005)(2616005)(122000001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?wNN4KIyj+qr4wGPAVrjm4tGW3usq?= =?utf-8?q?6v003682i5sYCE9ntyqmohNQw4Ukn4cBx83imyfkuahz1btH56pn6Sn9AKfsvCHqC?= =?utf-8?q?4MpWyjiI0H6G6FYqe4ycDaMO4+L3j5sbhI0lA2t++F1iG44FXxbZC+BLEsWGCXxeX?= =?utf-8?q?U7KkoDqmFkysoYshLTsutQrw7Cu/EA6Cs1QZ2P1UhdizL3gHtZLROQuBN/geF0EAh?= =?utf-8?q?KbcANproyOGZa7l1Lpl3INl5J6WmMRvPHNkKDpP4F4KbyMHUoB8j3fuxwL/b2LEwL?= =?utf-8?q?6FpBtFpaOGJK9q9poiEdxsVhDN1C/rPMxF4t3dt+VPVpQLJeXMFCZM6CqjfLFZDc0?= =?utf-8?q?YKMcp3rGFI4XL/mC27NBeVXOBo8nslQgAdCu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DQEov0jKgj1P6R8n8UK/JZ0?= =?utf-8?q?H387DOb6BC0SdXlo9ZhMpXbnjetVb7pzZxpKfKrrFosQETP71RPO+IQDei0pRCUyd?= =?utf-8?q?G/v04l6Wt5He9HAWj+JAr15W99WlNXehMKFJCQYKCluWw2RDBDcljLLxm/rG8COPZ?= =?utf-8?q?pewxHsyNbAVcAjbYeBJHnvDBDVSJs1Nd+sQehUtgF/yNn30II/iUQZixiGn4l8S35?= =?utf-8?q?E6eMEHvKf4lxwL8ZkK3PJaNBZlGnd1F0Zdb+8DQCBa+sY16viKMsxvyWzGF2FecGD?= =?utf-8?q?Z9dIFBKqZxHtWi2YJZctUcDNwTTkGRQXFg=3D=3D?= Content-ID: <352CE6813D1022428BF74FB99F62787A@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: e2bbb522-f54b-4288-4094-08db6bf97b88 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Jun 2023 10:32:26.6053 (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: kdKUP8QF4/tIpd9eTehmtiaDQxyF1lAV4a3NU9ZTAn1O9thwZTfSFmyDunJZzqa2FknzC62TWHvhBXLhxEq92/ooy7gOyFMkWUBZCrj6Giw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR03MB9706 X-Proofpoint-GUID: aW2oc2PcnjmaewcXi_7-q95ic-WGLpzn X-Proofpoint-ORIG-GUID: aW2oc2PcnjmaewcXi_7-q95ic-WGLpzn X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-13_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 suspectscore=0 mlxlogscore=673 spamscore=0 malwarescore=0 clxscore=1011 lowpriorityscore=0 bulkscore=0 priorityscore=1501 phishscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306130093 Hello, This is another another version of vPCI rework (previous one can be found at [1]). The biggest change is how vPCI locking is done. This series uses per-domain vPCI rwlock. Note that this series does not include my work on reference counting for PCI devices because this counting does not resolve isses we are having for vPCI. While it is (maybe) nice to have PCI refcounting, it does not moves us towards PCI on ARM. [1] https://lore.kernel.org/all/20220204063459.680961-1-andr2000@gmail.com/ Oleksandr Andrushchenko (12): vpci: introduce per-domain 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 xen/arch/arm/vpci.c | 31 ++- xen/arch/x86/hvm/vmsi.c | 7 + xen/common/domain.c | 3 + xen/common/rangeset.c | 5 +- xen/drivers/Kconfig | 4 + xen/drivers/passthrough/pci.c | 16 ++ xen/drivers/vpci/header.c | 485 ++++++++++++++++++++++++++++------ xen/drivers/vpci/msi.c | 29 +- xen/drivers/vpci/msix.c | 55 +++- xen/drivers/vpci/vpci.c | 257 ++++++++++++++++-- xen/include/xen/pci.h | 1 + xen/include/xen/rangeset.h | 5 +- xen/include/xen/sched.h | 11 + xen/include/xen/vpci.h | 47 +++- 14 files changed, 826 insertions(+), 130 deletions(-)