From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eu-smtp-delivery-143.mimecast.com (eu-smtp-delivery-143.mimecast.com [207.82.80.143]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6F3051A1E72 for ; Thu, 20 Oct 2016 23:40:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=mg1nNhp464TYFLT+F4uvLXPzJMQci/pmx3O2RP4ahG0=; b=YxYcpoC+VmcEvnq8HNOnqcXujzg5hUckTDJcoTWa9T/s2W0nV20d4NOMRfNt2AjnebSfiKFhv/tsnxEUPEfDdY1mBPkzgGqI6URbvf4JsyyPk0iz8fpC1EXDV1gWAW6ncaOwbUZas1K4gyhLAguSi2NDUXOBf5IRPi2MApV7epc= Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01lp0239.outbound.protection.outlook.com [213.199.154.239]) (Using TLS) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-78-7KKISQcUM5S6qa66JsWAng-1; Fri, 21 Oct 2016 07:40:50 +0100 Received: from AM2PR08CA0008.eurprd08.prod.outlook.com (10.162.32.18) by HE1PR08MB0619.eurprd08.prod.outlook.com (10.163.178.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.659.11; Fri, 21 Oct 2016 06:40:48 +0000 Received: from AM1FFO11FD055.protection.gbl (2a01:111:f400:7e00::168) by AM2PR08CA0008.outlook.office365.com (2a01:111:e400:843e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.16 via Frontend Transport; Fri, 21 Oct 2016 06:40:48 +0000 Received: from nebula.arm.com (217.140.96.140) by AM1FFO11FD055.mail.protection.outlook.com (10.174.65.74) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.669.7 via Frontend Transport; Fri, 21 Oct 2016 06:40:48 +0000 Received: from dennis-ws.asiapac.arm.com (10.1.2.79) by mail.arm.com (10.1.106.66) with Microsoft SMTP Server id 14.3.294.0; Fri, 21 Oct 2016 07:40:45 +0100 From: Dennis Chen To: CC: , Dennis Chen , Ard Biesheuvel , Leif Lindholm Date: Fri, 21 Oct 2016 14:40:35 +0800 Message-ID: <1477032035-27652-1-git-send-email-dennis.chen@arm.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:217.140.96.140; IPV:CAL; SCL:-1; CTRY:GB; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(438002)(199003)(189002)(356003)(626004)(19580405001)(48376002)(33646002)(229853001)(305945005)(5003940100001)(246002)(2906002)(92566002)(26826002)(8936002)(110136003)(19580395003)(6916009)(6666003)(2351001)(8676002)(50466002)(7846002)(5660300001)(50986999)(104016004)(11100500001)(106466001)(77096005)(87936001)(36756003)(50226002)(4326007)(586003)(86362001)(189998001)(47776003)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR08MB0619; H:nebula.arm.com; FPR:; SPF:Pass; PTR:fw-tnat.cambridge.arm.com; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; AM1FFO11FD055; 1:isM3GE6tp/fP3h37U+SBHX0EqmXLBo3hjHXFnwtb+tj9bDzlh+QhAyjMB4FKd6fn+jhZkoU06ackNJM+xCRyIYuQN+2wYJvXwSmXgigg4OsV0DWxkrI6mwzKW+xFEEYFZ35+2WYSO+jzmpsexQtNZqiILbQJlHKqRYx1LR4oEjVJyqXToJTkRQ3bIAbdulCj2Gp5oswLOqPdiNOac1/nfBBoWmbnskBp/43V6HAFvYDSKGhe1FyQlOImlgkpCorZhat4uYzjzu4XsAhHynUbWUAwNgcrHsiu7Pz3TcApPVxYCVBd8nKa8Y1r2FHiXf7m9U/5p3kZaUHdD4d3Cy43AMqptQ+8rZSoJoByi88DMmNGG9DqNiuzcqm0DwDD3A2aCUVBgR1FQn/kVYFjyq5RmqubrCZ9BHVIz0YNW464DTo1ZlYymItNLLsJeeEbjuQAx12FYxr7iR8EbH8iI1dDDjk+of05i0ZnksSJ7JAHCT0p8IL4Szq2wLmhL/e53/VIlaBWQz91Yw2c4XM6wBxul8nEoUgAXcUZqv4C+sIoR3iLBb1Mm28XadaKSX5CVhzqPZmEi7xA6u+4jDrHYDk82mYrjtGeH1wsfmBYkKWSwg0= X-MS-Office365-Filtering-Correlation-Id: 52e57ba6-d540-45c5-2804-08d3f97d31a2 X-Microsoft-Exchange-Diagnostics: 1; HE1PR08MB0619; 2:YDuzxhyjjkCNSrHMWG8Ju3pgw2+MyWAFshXXDKypwVxhKm4aqYqdWxmZVcfYl7DUk2wXBnx8Q7mY1rfS5dbK3ckcqg2rZCjdgrfzZf+EDz8DM4J0Q89MEpffyQC+59S1cozi4j/b7P7fYIo0ZcChmXJD5ENmJXYlVHopF06wD9CGnY7tybzuweDbKcSj67JMFCVdtjNzaPdTT4Y2iRizLQ==; 3:XHh0kzVJK25ozKfDlB63OOYpi/JhTSFQxPK6FErRUP+CvH/KHoOHLVDs5rOqHb8pp9eGrOkPjm8ti5Cz3c8qv3dj7ST//MOhDUh6+S52PwWVcosj9pvzBInRaZyfUVnprqKQmwm1q7qse3hBAvQyMTy2+J4sIZN+84AGZqfk9EJoCA1Tc9slCjowsbhhBY3TGy3Ri65abxJGabOGn6RPMIi7yshRFDKNAUHCOe4GMD+R/2jfdxYXJlY4hzfWRUXrN0wm3N0X+J77C5gxyVg7zkk4T3aWxLFm5Pq7isKUXdQ= X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:HE1PR08MB0619; X-Microsoft-Exchange-Diagnostics: 1; HE1PR08MB0619; 25:OljNE+6Iei8lDLHhGhGfapMADh2gDKxsTLodEeHFfrVXuPtzyOfMCydE6BJL4OdijETRwOeuFPyPnUOJAEsIpUEy5mxwXgXghKl/MW11WRTYBnXgIZKTrhwQJCJ5fJIyje1q1Ir8uDQgYGZfP3iqR6hqS0W5MXrko9pe+xW7kT1ALSvqR5OWpaU090o7xNnckXfMJKcC2KklRAlk3lo2eJsCxcsSAy91ybmfiEHt3zqJzOw4zbjo0gMJAZOcOZT9/wH0DTa75rxNdV8xVY6aBiaSmT441kjMGuqkTIaYEccuJSzpZ/YvmbiNik2OYS4m/k9/cLWgJKQFE5BwEZWLontfflgaANcIdSaaktUDogFmjCDep+DvzIsRzJAmRmLK+LeWy4Hgc5nhLoIkeS4t9JNWSwcbrljp+IIzYqViFjnEjvJdVlHNEIDASA7/lfoqhGq051qpdXjGWhydK9QoFRW2AQ6RJDWn60K4S6zBdLL/G5p7W8xIrCmboz2KcvhtcHB5RhSuAOHH2w5X8N5+Qd3S7E6oFAuKZBDP2PbjBk9k4m1o3EUaWHz4tEhKU5gvlkigeKkA5q25JiNaoob34yETK/l3Fzp4E593+WOZe20ShhwdN8E475m4xNjU85aApvnOO5jLlRC2NBATqwFdDVY0OkmC3ajCUIHDo4GeUI91ZPG5p6fCBnlLdquVRMg3ld9C9if3ZT7A6698xZrQdf4GQFZu4SbnbL1SvWUQCG0cFyTR8jYOa2DW400kTlP7dM8bLagff0Z0+omWtG8+Yg== X-LD-Processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; HE1PR08MB0619; 31:RM6r5p0xqR4Vb2fwizZjr2fnFDmG6nga3GGZx5cOPWo+19hWi2kwvrqNknCUaJbDJU9lbdSppXuIP1tLYLVDh1HzSpU/M8XDfleV+BbkkFwYBcc55kHcAS3omZw36Sd+F4FIvj0zaat4QagySq1wfL2+Xo/VwVbrcIkrdOErvQiWCccPUa3C2+vOscu6QH5KtEYvnhYzUrNmHvadCsuPO1OCbEtOuDPJsv9sZ/iJg0Zk4zwpO42Ib/lq0GDlTMm0; 20:7Mzi4jtiRPUBzPu9NhIh+nIm2W4QiXdsO9R+vQxi1lDTroixuDY5wQGt1zUaBAyR5YxP1f+tWw1U5ohLsxAye9pDFTp6uJXCTmbv4zXEWRc0U/D6dINce2DWAj6kbMlES0A2c2jbYxS3tWtArjjn5E4NCbcQJop7YJkakB777+BKYvRt1Bs3tCLfVuY8cisjP1pRL9tsdNuco/8kSgMDjJHsCLpSzIKiIR83EHRx8NhmZkqfbb7Nn4s9UzLlP/sQ NoDisclaimer: True X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(13024025)(5005006)(8121501046)(13023025)(13020025)(13013025)(10201501046)(3002001)(6055026); SRVR:HE1PR08MB0619; BCL:0; PCL:0; RULEID:; SRVR:HE1PR08MB0619; X-Microsoft-Exchange-Diagnostics: 1; HE1PR08MB0619; 4:xE3DOXjh4BDn8t6hSBQ2k9jsSk7ClxRQhN0nNu1RGj+bF+3oaz0O9aW9lZmGLx8ZNG5qE4laFJ5VftaU2uh3p7mBHoYJlJtYVP9UEnbjEdaONbsUfjcODo8oq8J8aWMtd8joAB2po6psS6J8LKgIJ+LwNtRTmC0saXwhszAvKoTZmkEZ7lfN5zYRUAS8hYtGoe6QG8IiD9Un57l03oPQ4MsdGzKOax/oQsJ1j/YO7mjJR6GNNW2MumXSKkYVdN62/jmGqEM8WFOdVFWw+vXV2lqFlX0ybCsJewSjjNVfoOcS9hN3iF2ygFaxjgIMCY1Q3As8HkjFf1JgijM8C5tzokGkW5hk62LZmLCsVzxWVgVdqNVpxPjuQydeQaNYVZXtEZ1KRI/TcpRY9zVGlgHsl5HsZI58RSRYvE/FO1RDHtuyjTO3s8QlC1zoq8/TU1ToOvfr/4pgANy+UbWQZoCZWtrIvCs4rkP2xet5wHCKzrlsAQ55doRDUMugm6toBfT9E8r2BPpXNxGv7b5t5IlIZCe8aNhciop1+xdyrx/sRfk= X-Forefront-PRVS: 01026E1310 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR08MB0619; 23:gNrM8fwzpiKmIGa0R5J8l7FjvHgo3WqSXDWXXpADA?= =?us-ascii?Q?+Fv6qqIryG8BIsCVHDvA3M0H3s2yTLwerQTn0lqSC0bFSvg5RYUK3cFzOa17?= =?us-ascii?Q?wySrVyG8T0+xoTLYYDe6oUlNiukiKhPOtan71UZI/0vyauHInbJeaWJrrmU4?= =?us-ascii?Q?AGDyjSJvwI0o6YZeBRtmq/wtFcD3M9te7Jz1QhmIO8JJy4JECNTHkwMNcUkO?= =?us-ascii?Q?s1FmhrupRNkE1/KYyiwX4dkImut/ypU1hQm0Ci3J5PBCq7VXxkPsV75HGfGK?= =?us-ascii?Q?uhmHgTHjDPzK8/3ggYeYzfvIAVYWEkSZrWbHIo8t307DpzZiMyFue00mkOzR?= =?us-ascii?Q?UD6ZiHdCVBirID89EUS7kPb5tbWU69in+ekx2kZ+YhG4GEzP17v9RiqjaEyA?= =?us-ascii?Q?RuBHaOPfi+jCOASzcnM3PeQlWbr0ME2vIFSAsh2gRmyk1Zz4CctnpZPmUVs8?= =?us-ascii?Q?VvAdXB1oAbdpTXAnjfetFbkI5xXoct1eGzfzfxQnIOaV90zwm3zFhrNHzH25?= =?us-ascii?Q?L/OCOlPdXJVd2ivKvqhPjb9Y6EsljMoQaxtxhyXanfSb5SRn1jB/82wGGyQN?= =?us-ascii?Q?ObEbmmG7zrAr1yynv5mkOmUd0VxkoTNBZ8VusEn2KhoPM5gMhWlmNPLBJLUH?= =?us-ascii?Q?DX2/SbUVrCKNL1t0f7gE11Vo5kq4AL2Te8F6aVQqm2s5KXFLLYKmCu3liCqK?= =?us-ascii?Q?SBW9YA30Zy1xt0mq9Sn9sNqFEODCImac3Ez46wfdXVmqB5oTtxcLpKltv4T5?= =?us-ascii?Q?1K3nNQQ+n62QcpCNle7rkT9/Yqhyt4UecqBGEh/foNOmyMPdxqBHAK3maGmS?= =?us-ascii?Q?ciI7yUNLzJrCmJDQqnQ5DujgaQ2GxtKCjnjMMYUpUELggn/x8HKFPOGve9qz?= =?us-ascii?Q?HFVeJHi7ti4StmW231GasUNPTMTgUOOKRugCFKftc+2PMAQAelG28PedzyAm?= =?us-ascii?Q?L/hZmStEzoxmJ6KRJ7uxdhXK3T3jAnqklppXIDtXj++LWRfRg1n8mu5k/H0a?= =?us-ascii?Q?uqLoCHIz4P59F27ffM3rijvNKXi55Kdq+SaQ8Ac7BaKp8vuMZF3bK0sKr8yx?= =?us-ascii?Q?izCcLY=3D?= X-Microsoft-Exchange-Diagnostics: 1; HE1PR08MB0619; 6:d0v4dz0VG098EkbPFMeu+oLgJl0FSfKpthqhR60fWqkZxSqlIfE37Atm0j2Z7/q1EoQiJw4AFj0jplWcNaTDs4kORXzaT2kvvW4A+9GGFEd5U3tSPWqkuYRUEa+u8kxzdaYjV8XAxIO+0sDQQ2Kx2LoobU/Vc5MwutYp6PA1BewigTB5BFcUnCiHZBmt9DPeRLSlhVJrfQ5ic+6CSqL3XyQm1Z65VuYs2lOe/B8nKeXnJRMZydxhv6fPGzui0h8IPJ2s8583pRbqOX421IMYM01sncdxl/CKZhjIlMRUvDud5SXDrMd+TyMGRswNqmpBDx2vmfse0MKn67afMolMYKbmiWo9gM2MnsgKfWmFA28=; 5:5+XmiPUGHhUqj3weiMu+0Lali71ZukKnRdnhtIoIr5hX2LvKmowU+Ns2R3htWyWdEMzDs7rQKWz1c3N4820UtXoiiAew7QBLzgebtleFz90DOuVJFMvALuRCjCEDynD4Pf9BVzMzEdvgg6masUF2sA==; 24:OmL+W35WnzYSaO76IwxPBRPgk8/WDlDbr+w7F0syHY43ulR3tQ3eNqm01OXjKxyvQcKtONo8VT/d00wns/d5Zpl2OwcSlHeSJh9YBxIh22g= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR08MB0619; 7:dn4IgYrst8vxtZbEOlEnf4BMfSgVCdIMA1E/+3OWkI59lBMpdMtIxGKQqokrHdTlXTnc/YoW1AeGOHUPRDq54JDNfIUP6o4PnxPyIdSOgOAMoYBm956xVczUi8zgkGn+EzsKPgmS4W87xjulUroFcznX7FUU8SDd3Xipw3wOuEq9diUdTGMpm7cE/gLUPznt+IJ2Dy7LFrglD92ZORkMiXY+oDii5v5EDOtjZuFw6nb1Myq4gQy09QQcQLrzgcge3rb2H/UMpLrIijBKggS7HUwpfKOWJL9v25jvhgGffXfIqYS9Tub2QvB5HBTelNU6o6rlVU7Rpxbafb1s/eIc8ncQvc3/pVrhIV13lrK40k4= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2016 06:40:48.5658 (UTC) X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[217.140.96.140]; Helo=[nebula.arm.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR08MB0619 X-MC-Unique: 7KKISQcUM5S6qa66JsWAng-1 Subject: [PATCH] ArmPkg: Assign the real INTID value for sanity check X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2016 06:40:55 -0000 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Current implementation doesn't assign the INTID value readed from GICC_IAR to the @InterruptId parameter in case of GICv3, thus make the sanity check of the INTID in the caller becomes untrustworthy, this patch is trying to re-assign the @InterruptId to mitigate this issue. Contributed-under: TianoCore Contribution Agreement 1.0 Cc: Ard Biesheuvel Cc: Leif Lindholm Signed-off-by: Dennis Chen --- ArmPkg/Drivers/ArmGic/ArmGicLib.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/ArmPkg/Drivers/ArmGic/ArmGicLib.c b/ArmPkg/Drivers/ArmGic/ArmG= icLib.c index 733488c..6c9ee8b 100644 --- a/ArmPkg/Drivers/ArmGic/ArmGicLib.c +++ b/ArmPkg/Drivers/ArmGic/ArmGicLib.c @@ -135,27 +135,32 @@ ArmGicAcknowledgeInterrupt ( OUT UINTN *InterruptId ) { - UINTN Value; + UINTN Value, IntID; ARM_GIC_ARCH_REVISION Revision; =20 + // InterruptId is required for the caller to know if a valid or spurious + // interrupt has been read + ASSERT (InterruptId !=3D NULL); + Revision =3D ArmGicGetSupportedArchRevision (); if (Revision =3D=3D ARM_GIC_ARCH_REVISION_2) { Value =3D ArmGicV2AcknowledgeInterrupt (GicInterruptInterfaceBase); - // InterruptId is required for the caller to know if a valid or spurio= us - // interrupt has been read - ASSERT (InterruptId !=3D NULL); - if (InterruptId !=3D NULL) { - *InterruptId =3D Value & ARM_GIC_ICCIAR_ACKINTID; - } + IntID =3D Value & ARM_GIC_ICCIAR_ACKINTID; } else if (Revision =3D=3D ARM_GIC_ARCH_REVISION_3) { Value =3D ArmGicV3AcknowledgeInterrupt (); + // For GICv3, the Value readed from GICC_IAR is the final INTID + IntID =3D Value; } else { ASSERT_EFI_ERROR (EFI_UNSUPPORTED); // Report Spurious interrupt which is what the above controllers would // return if no interrupt was available Value =3D 1023; + IntID =3D Value; } =20 + if (InterruptId !=3D NULL) +=09*InterruptId =3D IntID; + return Value; } =20 --=20 2.7.4