From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (EUR02-HE1-obe.outbound.protection.outlook.com [40.107.1.45]) by mx.groups.io with SMTP id smtpd.web08.11846.1615308329467582345 for ; Tue, 09 Mar 2021 08:45:30 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=3M9ZJlzp; spf=pass (domain: arm.com, ip: 40.107.1.45, mailfrom: joey.gouly@arm.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LGY2Yha2xlWKijaXPCP83s6OS35xvlLtI4JocZMSiHU=; b=3M9ZJlzpYJxvYfZoJQQk/ZsNzjtZnYr8VQa1dpu2IQj170WCZHbXM2Lvm1GckfeIxOSQa6uB3pQfmoskVZFRxXtJTfwkDv0UxvP0cc7lyGuz3zvj3YhRUar54vWX7eo6YlfQWzcXBsez7Z66NrdP63m0uaK/CuCFDq0goAfTqsk= Received: from MRXP264CA0031.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:14::19) by PR3PR08MB5643.eurprd08.prod.outlook.com (2603:10a6:102:84::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17; Tue, 9 Mar 2021 16:45:26 +0000 Received: from VE1EUR03FT048.eop-EUR03.prod.protection.outlook.com (2603:10a6:500:14:cafe::7) by MRXP264CA0031.outlook.office365.com (2603:10a6:500:14::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.26 via Frontend Transport; Tue, 9 Mar 2021 16:45:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT048.mail.protection.outlook.com (10.152.19.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Tue, 9 Mar 2021 16:45:25 +0000 Received: ("Tessian outbound e7a0046930fb:v71"); Tue, 09 Mar 2021 16:45:25 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 941cd3fdb4616a6c X-CR-MTA-TID: 64aa7808 Received: from 9f786fc79eba.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id B19897D7-95B0-4D50-8F27-7E35BAA6B781.1; Tue, 09 Mar 2021 16:45:19 +0000 Received: from EUR02-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9f786fc79eba.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 09 Mar 2021 16:45:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mw3QDFWpl3Yjp5eF7FTU0R0+g9vmCb3cgxXzV7kb8j/lgA+b5kaaS6fNjXc259CLN9vKbHQuHNAwy8BP9PdJjXXB70kfMp7qeTvtiIp2SUzniRSMJj6I0jKeK5H+AwnNWfROnXTCHmxH+4yCifkbgZ4PWaO0zTwJWoXiQexswSRmsI7LQx27xbEZAYvlC5UHJXnzZatVcPFHaBTeFC94AMkQAd4A9TYRkBtAOn5GgNvNkeasSJF3ZddkcWri23ZTEjDPuZF0yo5NKQwC0r5ofX1obn9ruNFZNfrlPFM2gjSy2KTWVmmt4OpFMy+hpLsQfqec8P4Mp04AlqXLFwszOw== 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-SenderADCheck; bh=LGY2Yha2xlWKijaXPCP83s6OS35xvlLtI4JocZMSiHU=; b=A1h4X1PL4rUzBqpEVWpAeo/jEF1y8PhX8HvEVS69QfXnuYBpYIK4kMNEdyAqhqx7gYGAmYIIB5YtHlBYcZPJx6cV05oZtKRA7qHXuHlDx0dZZwuD8mpC43EcaTviEjWLiHcDp6iZSpzxAJUroNA9oP77uGS26XwHeBoqzT5KffMYQyWz/LCDCLscDarwowVtOSSNjR6jfpX5bD0KyJ34f/vV207EaqkHDouZWKp1D10Uj3lXc/AzCyym7scQgJNu53BHg4m5fyY5+qwCLZVb1QWhFl3gvGYgKzsTyHhAoEsdSWDwIPUrk1fDsHD3nNki4gImyZS/JRLlvxZIjedmIw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LGY2Yha2xlWKijaXPCP83s6OS35xvlLtI4JocZMSiHU=; b=3M9ZJlzpYJxvYfZoJQQk/ZsNzjtZnYr8VQa1dpu2IQj170WCZHbXM2Lvm1GckfeIxOSQa6uB3pQfmoskVZFRxXtJTfwkDv0UxvP0cc7lyGuz3zvj3YhRUar54vWX7eo6YlfQWzcXBsez7Z66NrdP63m0uaK/CuCFDq0goAfTqsk= Received: from AM5PR0101CA0030.eurprd01.prod.exchangelabs.com (2603:10a6:206:16::43) by AM0PR08MB4275.eurprd08.prod.outlook.com (2603:10a6:208:140::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17; Tue, 9 Mar 2021 16:45:17 +0000 Received: from AM5EUR03FT031.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:16:cafe::d6) by AM5PR0101CA0030.outlook.office365.com (2603:10a6:206:16::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Tue, 9 Mar 2021 16:45:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT031.mail.protection.outlook.com (10.152.16.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3912.17 via Frontend Transport; Tue, 9 Mar 2021 16:45:16 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 9 Mar 2021 16:45:10 +0000 Received: from e124191.cambridge.arm.com (10.11.7.12) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Tue, 9 Mar 2021 16:45:09 +0000 From: "Joey Gouly" To: CC: , , , , , Subject: [PATCH] ArmPkg/ArmGic: Fix maximum number of interrupts in GICv3 Date: Tue, 9 Mar 2021 16:45:10 +0000 Message-ID: <20210309164510.19272-1-joey.gouly@arm.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 022805de-8a5c-4911-17b9-08d8e31abd83 X-MS-TrafficTypeDiagnostic: AM0PR08MB4275:|PR3PR08MB5643: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8273;OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 8B81ajA/vUaZPJK/15XQyoE8pDjGKNWR1k3CEexCrUxvh3f1SmEPyVDC04cAfzzPTSZo9Don+sJD7U3y4RnQLXsUBrvA2ATmc2z+eIyOaB7j7VlxfDd4XVxnZatuabLnF/ZAx1mDKEQdf1Fgd3vQ7/Pyd0G6syQCAAZ3CDMRywmBcvpvaGuq0XOds0lBR2DkwB/bZAzzDLp/bD/E235XGOxqn+lIJCELWNtNqHXU/kI1pMHZCc1xK7H3zygdfIg6fjwbb2C/Kwhl4sgFYBkiomeyjieeM7eNEjIEeRbNQtMwVKWLrzYnh/K/NvWdbhfYFng3zLlS9MHM28GyP5ooMTvVGx9W0JFXX8bOqhqZNZ45PKmlspGbgIkr9kV/xBDyMyzAj4ODAgsqbdn5JQN1qJ6k1nqqBfnxS7yU2xRI5cxM8+sixUkWp39y2Ih4qWAv3OobbEky4iToo6gruzamervf55Dp5SwSKyz+m0s9OnvOgVpq/QDvvoWnlgL1cSvj2KdYOtyy1xxdUKmVnagMn0fMgOYqs9s3BX4VxfWjpB1n4lwZSqU3/RRj/SyuYXnODDH5THjYiQs9H2d4gVqpPKd64bU1KjT8n4wLwJdmdaVN0CV884Xfz8m9ltMHwXiYf/8yl+SWm40iZLOxHG0/8CP/fYQRUptNclTkNB+CRIhTDKRhojcsmDCAYGknbDPT1/4g6rcV5CoCH4t1TPM6eb5Nr5prxxwgl0/Z6fA4XAsk8d8u2J65eS8MS+KSpYBBLF2hZrd1aHW5pTLyw4tzJA== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(136003)(376002)(396003)(39860400002)(346002)(36840700001)(46966006)(478600001)(4326008)(82740400003)(86362001)(5660300002)(36860700001)(316002)(44832011)(8936002)(186003)(26005)(356005)(336012)(6916009)(70206006)(6666004)(36756003)(83380400001)(966005)(82310400003)(54906003)(2616005)(2906002)(70586007)(81166007)(7696005)(47076005)(426003)(8676002)(1076003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4275 Return-Path: Joey.Gouly@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT048.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 2177e170-fb0f-4d43-cfce-08d8e31ab803 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Y5b1L73y7xHbjL7zTsbybgoN4yDxlnXpZcaMDvmUEZHKmMrmG13GMRjrwiEHV9MUnv6p37u09V3Dtg+Ofo3iKnSkhhNWnGgSrRjWLEFhlwpuQ69Ll+U/ae4OVlX6gzXNiUPgv2wS0GLxZrdcZLtd76xO7nRtpYOf0vvZ5WSL98eISmvowKxo+7o4TVYYFAP2rV+1oVmqL5J/REy5AC7fsp6XNkpiGD+ZZ5jYzvUpOgf+5CaLoYsUwbeqA9uLgEAsfn+gV+KGz8zAhDqh8CqGw3bB/WgAwCDd8t1ehLIcpk5vRDmkSSrWvEwKz4VfPDxt7fqocUpg92QDvEeg0UAJglH+FrNhBDM6rZLd1eyik0vD/BP+tCFKS97Mm1+5mUf7sWxCSshKTou4ppDMl7mdtSo+thNhcQxDXfYZYMyFS52RtgatySjfPwx2CWC2rvCSt+hHJ5PHfGCUE+KApWqqmnkkEPZDGMxKwDCpUwQ7HPKB42TmcGzKMxfhfPJgmczQcbX5mJHSMS55FuGT0IDyJy4fEBhYoEF8OcKrSui3MKUxEXMdqh2+4nvjVBkvPwxyH/yEMjh3bfJ2h47ZWJavuQqoop1Eqjxw5fSy4ZT2WuMKs6E6BXDAgq/PbHr/qTlNDO4DYFk1PKyujY3hMeP26/DK62S6ZjetLsuxkfg3j5cHdMiQsz1RsWbfTsZwajOjjYLleHaSw8psPVZz/TWrMUNlmdSVzHK7PoOxZqGJmsM= X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(4636009)(346002)(136003)(376002)(39860400002)(396003)(36840700001)(46966006)(81166007)(6916009)(6666004)(966005)(1076003)(26005)(36756003)(4326008)(316002)(5660300002)(478600001)(47076005)(36860700001)(82740400003)(54906003)(44832011)(426003)(70206006)(2616005)(82310400003)(70586007)(336012)(2906002)(8936002)(86362001)(186003)(8676002)(7696005)(83380400001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2021 16:45:25.9745 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 022805de-8a5c-4911-17b9-08d8e31abd83 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT048.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5643 Content-Type: text/plain From: Andreas Sandberg The GICv3 architecture supports up to 1020 ordinary interrupt lines. The actual number of interrupts supported is described by the ITLinesNumber field in the GICD_TYPER register. The total number of implemented registers is normally calculated as 32*(ITLinesNumber+1). However, maximum value (0x1f) is a special case since that would indicate that 1024 interrupts are implemented. Add handling for this special case in ArmGicGetMaxNumInterrupts. Signed-off-by: Andreas Sandberg Signed-off-by: Joey Gouly --- The changes can be seen at https://github.com/jgouly/edk2/tree/1396_gic_max_num_intr_v1 ArmPkg/Drivers/ArmGic/ArmGicLib.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ArmPkg/Drivers/ArmGic/ArmGicLib.c b/ArmPkg/Drivers/ArmGic/ArmGicLib.c index 6b01c88206ad8adef3100dd44c0d57660db77783..c4996970eb299776552fe7b54f34fd5a68afff29 100644 --- a/ArmPkg/Drivers/ArmGic/ArmGicLib.c +++ b/ArmPkg/Drivers/ArmGic/ArmGicLib.c @@ -1,6 +1,6 @@ /** @file * -* Copyright (c) 2011-2018, ARM Limited. All rights reserved. +* Copyright (c) 2011-2021, ARM Limited. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause-Patent * @@ -120,7 +120,12 @@ ArmGicGetMaxNumInterrupts ( IN INTN GicDistributorBase ) { - return 32 * ((MmioRead32 (GicDistributorBase + ARM_GIC_ICDICTR) & 0x1F) + 1); + UINTN ItLines; + + ItLines = MmioRead32 (GicDistributorBase + ARM_GIC_ICDICTR) & 0x1F; + + // Interrupt ID 1020-1023 are reserved; + return (ItLines == 0x1f) ? 1020 : 32 * (ItLines + 1); } VOID -- Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")