From nobody Fri Nov 22 19:21:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1715965669; cv=pass; d=zohomail.com; s=zohoarc; b=N8zALZDrtMRKnABGrAEk6tM7jMkv8380NdsDLtE0a6ugPmIvRJFjU5FOgYVbSdzs8tU7U19rjliaxr3Sc/uTQxKPyPTPYXeQgnSISyWt/cHJGdUrYLJ8XFFQjWUpmAp2XXkdZVsAa+jcbGPI+gPK3dxmovTX1x7IMX4BO20YsQs= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715965669; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=wg1lIYFsxCkrbMSdoPQQCZQ7ozFKfKSY7zA6PHJCXCc=; b=HZl4XC2Rg48aKA3Elnxem6d6KeIBHGBhWPVaUPWAwPguDdyQ+c0z2WIw+fWaurUfuUwLTTg1d8JPIHyD+zGHOWotjVDcaX1jvXywz/izKeZXCa/S6aX0AE2ORwLI+ASqamsa9nzoAUEcXYU7ZCilWIN5E4TjhmpmjGnoEXAu2eM= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1715965669055970.8079311459659; Fri, 17 May 2024 10:07:49 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.724367.1129632 (Exim 4.92) (envelope-from ) id 1s813P-0007rn-I0; Fri, 17 May 2024 17:07:35 +0000 Received: by outflank-mailman (output) from mailman id 724367.1129632; Fri, 17 May 2024 17:07:35 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s813P-0007rg-F6; Fri, 17 May 2024 17:07:35 +0000 Received: by outflank-mailman (input) for mailman id 724367; Fri, 17 May 2024 17:07:34 +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 1s813O-0006C6-Ag for xen-devel@lists.xenproject.org; Fri, 17 May 2024 17:07:34 +0000 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on20600.outbound.protection.outlook.com [2a01:111:f403:200a::600]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id f2977c4c-146f-11ef-b4bb-af5377834399; Fri, 17 May 2024 19:07:32 +0200 (CEST) Received: from CH0PR04CA0018.namprd04.prod.outlook.com (2603:10b6:610:76::23) by BL1PR12MB5921.namprd12.prod.outlook.com (2603:10b6:208:398::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.30; Fri, 17 May 2024 17:07:26 +0000 Received: from CH2PEPF0000009C.namprd02.prod.outlook.com (2603:10b6:610:76:cafe::19) by CH0PR04CA0018.outlook.office365.com (2603:10b6:610:76::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.31 via Frontend Transport; Fri, 17 May 2024 17:07:26 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by CH2PEPF0000009C.mail.protection.outlook.com (10.167.244.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7587.21 via Frontend Transport; Fri, 17 May 2024 17:07:25 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 17 May 2024 12:07:25 -0500 Received: from ubuntu.mshome.net (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Fri, 17 May 2024 12:07:19 -0500 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: f2977c4c-146f-11ef-b4bb-af5377834399 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mu3r6ORU84PuX3HDQ7SwzWqlPti1SO9+IBG+NK7Lc6MXrIJH47Owd+6a7a9HtlhdifYm3RMsdUZV3CTt5NGAjjZghczZKzhg5bb5+E8LN1N1iaejzmsq7QPe8pFuFS7D0a//EFswBJ0N1cCndia4KN8n3rpr81N7dUkEugc4+Gg3519U3XvgxzkQkBz6SEtRlkppjhaIL08Y+6qiHsPg4NMtGyH7wQP+IDc9q44XT+SSH4sMuZ7xqK7FKE3ryLe9tXofjLQxI36skZ/70cqhciT7+BF68W6jMegb6ay6RqKCE3nMXIEzdS6RY1Nsf9hHha13I3iMBBU5ohIBsMrN9Q== 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=wg1lIYFsxCkrbMSdoPQQCZQ7ozFKfKSY7zA6PHJCXCc=; b=c2QhoeBJ6EdKJXNGkRQGfCTo0BnA+L575RBbWFhAzsr2GuKMbAdQue7Noy5D/+AlH/HjDpr0Bh9bfGv6rIwU5WKcRNgmguTiZqKsnx+aZnArpYRycko5ZrFlc4/Lh5Gcv8RsxEmA/sJwz5C5DQVn8AoUwAbPu6lwt8/BE9sVYYhbYJzp5nXVv0Du0E3aolO7k7pqhJE6RBmIzoNdgFB05Roun1NW29M7R2XHuNfsbcDUAVc8lUqCEUktZs990uOWnuSMmC3Zsf0KASMnXbB4pMnepb5xO6yweIoWxdW7kdn7jPiio6Yvm7+q5Hg4109UxMrPC9Wkda+C0pePnVhx3A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wg1lIYFsxCkrbMSdoPQQCZQ7ozFKfKSY7zA6PHJCXCc=; b=DNQ3978As1te2Q0tl4Hxt8zwQoa3PtLIAPQJE6z9JczMc0Zvm8MH0gAJ8H3OXYgPCEdAmNSGx5t0N1qwtgqXAxAeMvH/dPiVbxN/jXiebG+OAyt9Yv/dKbeN7ZLJt38ZK+Xud550jbx8qLLHBhJOwHmTRTwgP98uBREp+Lv7vC0= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C From: Stewart Hildebrand To: CC: Oleksandr Andrushchenko , "Stewart Hildebrand" , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , "Volodymyr Babchuk" , Julien Grall , Volodymyr Babchuk Subject: [PATCH v15 5/5] xen/arm: account IO handlers for emulated PCI MSI-X Date: Fri, 17 May 2024 13:06:15 -0400 Message-ID: <20240517170619.45088-6-stewart.hildebrand@amd.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240517170619.45088-1-stewart.hildebrand@amd.com> References: <20240517170619.45088-1-stewart.hildebrand@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: None (SATLEXMB03.amd.com: stewart.hildebrand@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PEPF0000009C:EE_|BL1PR12MB5921:EE_ X-MS-Office365-Filtering-Correlation-Id: b40d0cd0-3024-40b6-df5d-08dc7693d386 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|36860700004|82310400017|1800799015|376005; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Y3kuB04l1s5iff60H3ERnvdonr9dL1NtYAX1rH6weVScjRX+6rAUKlRg08Su?= =?us-ascii?Q?S+rBsVd1QigYKbhZ3DfXGO+59RNofwDwFPlPAkhEXpHhppXigKRDAGy0H1kW?= =?us-ascii?Q?dnjDwzMHcRr+qVqUWAQ5B0/lINZFxPsr0BkMr+vgAyyunsDiA8pXYk0MSOZ2?= =?us-ascii?Q?vi29aZbcjYj3G1bZ30GTlcfKZlamiRwutiIpWcMEBKF/ltmjJ2Wa5Sw8JE+l?= =?us-ascii?Q?8GRkyj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X8yF0?= =?us-ascii?Q?eDkI7RGP6/HGTGqPmpQwNT3whh8Tp794uwsITNR5iQe79iOyeYz7lcexGqcF?= =?us-ascii?Q?thNhfeRK5t8zSHk0eMZ/XmHyCCy3TFxvKYL5Vrd1gVTgHzxbeHdBoN8qJywa?= =?us-ascii?Q?weQChhoynw6cKdWaxBnv1YQBDL3BdUur9tHiPFlpBHQHl5VjSbHCz00y9WG8?= =?us-ascii?Q?jUBOSKVoCrpZG3qAvxAjtSwJwrLX3AOVozzQuGc/IHXrbdgKC1vjScBD8KQJ?= =?us-ascii?Q?c9HMfQXBIWEDPK9qkwKaVmEQudi2?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(36860700004)(82310400017)(1800799015)(376005);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2024 17:07:25.8838 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b40d0cd0-3024-40b6-df5d-08dc7693d386 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CH2PEPF0000009C.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5921 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1715965671081100001 Content-Type: text/plain; charset="utf-8" From: Oleksandr Andrushchenko At the moment, we always allocate an extra 16 slots for IO handlers (see MAX_IO_HANDLER). So while adding IO trap handlers for the emulated MSI-X registers we need to explicitly tell that we have additional IO handlers, so those are accounted. Signed-off-by: Oleksandr Andrushchenko Acked-by: Julien Grall Signed-off-by: Volodymyr Babchuk Signed-off-by: Stewart Hildebrand --- This depends on a constant defined in ("vpci: add initial support for virtual PCI bus topology"), so cannot be committed without the dependency. Since v5: - optimize with IS_ENABLED(CONFIG_HAS_PCI_MSI) since VPCI_MAX_VIRT_DEV is defined unconditionally New in v5 --- xen/arch/arm/vpci.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/vpci.c b/xen/arch/arm/vpci.c index 516933bebfb3..4779bbfa9be3 100644 --- a/xen/arch/arm/vpci.c +++ b/xen/arch/arm/vpci.c @@ -132,6 +132,8 @@ static int vpci_get_num_handlers_cb(struct domain *d, =20 unsigned int domain_vpci_get_num_mmio_handlers(struct domain *d) { + unsigned int count; + if ( !has_vpci(d) ) return 0; =20 @@ -152,7 +154,17 @@ unsigned int domain_vpci_get_num_mmio_handlers(struct = domain *d) * For guests each host bridge requires one region to cover the * configuration space. At the moment, we only expose a single host br= idge. */ - return 1; + count =3D 1; + + /* + * There's a single MSI-X MMIO handler that deals with both PBA + * and MSI-X tables per each PCI device being passed through. + * Maximum number of emulated virtual devices is VPCI_MAX_VIRT_DEV. + */ + if ( IS_ENABLED(CONFIG_HAS_PCI_MSI) ) + count +=3D VPCI_MAX_VIRT_DEV; + + return count; } =20 /* --=20 2.45.1