[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] arm/gic_v3: fix MISRA C R2.1 violations in gicv3_do_LPI()
- To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>
- Date: Mon, 29 Sep 2025 19:55:46 +0000
- Accept-language: en-US, uk-UA, ru-RU
- 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
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=PDNpMY8JYLJcz1TcoJVtdxvjvaqDkSl07G6GkIo5MQ8=; b=g0bh9CsHyA34mL4Z2y6rTsquDzwzaFE8WL/mvoYywcho+ql9WmvfJOrAZgvrpqN1qj38coO9swpyhxtl2qFq/UGXG9nU+s5fgeDxxAZoyIqZSDlSjKty2sF3kOy9KKOSab7vJBW8q3zC4aM81sad+/zRAZz+eEy1sPSP3P36oBJhpC7eTkyPsUgfXm68iw1qbBxajDd+xQn6ceLcNPtxZpzSPPhXTFf4k2Ru5sAIgjMWD0XOtkQ9WhpKv/koAdTNmgv0xY3alsBB/YCijvfDUHJHwGC2dVqcMJg9sm7K3BBIwMAcBv2qIYt4DQEGd6NDT+HlEQPRzWDlr1SJ6EGtEA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=S9+maWaf1WGlCYm/Q08OV0rxcQQFJ7zH3qPIDd3zQaycN1AY587r7pJEw0c1yPEKE2R/Qm9ddb1ae3rLhxbxdq/ojBMQvvylqDR54/LSrdCtRLBnT0k223eXs1h7Lxv9U/JxvBjROxW7uMm+1EpphRTIqQ6OmTlMmLMwgZTCojidZ3apZ72iA/+YIuEbzTzQlQF4/40MwSUDfqmS9sE62FDTHGYhKs77oqCFWLezW/9MdMhP08mybGLdhZwp5FBgKogBcBHDv+HL3/EAc/NFPQbV+PazZbb90iy4B+raMkr6VJVhz3+ZlOUD7UBxuwOSbYBPqCJ/y/HQkzQf/RZcNg==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
- Cc: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
- Delivery-date: Mon, 29 Sep 2025 19:55:55 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHcMXsLUvRxhyKkhUuhWVAohL+E7Q==
- Thread-topic: [PATCH] arm/gic_v3: fix MISRA C R2.1 violations in gicv3_do_LPI()
The function 'gicv3_do_LPI()' violates MISRA C 2012 Rule 2.1, which states:
"A project shall not contain unreachable code." This is due to the use of
the 'BUG()' macro, which causes the function to never return.
This behavior is intentional and safe within the specific build configuration
defined by 'CONFIG_HAS_ITS'. The 'BUG()' macro handles irrecoverable error
conditions where LPIs must not occur without an ITS enabled.
A SAF comment has been added to document the justification for this violation,
stating that it is safe within the context of the Xen project.
Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
---
Test CI pipeline:
https://gitlab.com/xen-project/people/dimaprkp4k/xen/-/pipelines/2070455717
---
docs/misra/safe.json | 8 ++++++++
xen/arch/arm/include/asm/gic_v3_its.h | 1 +
2 files changed, 9 insertions(+)
diff --git a/docs/misra/safe.json b/docs/misra/safe.json
index 3584cb90c6..4c227c1e8b 100644
--- a/docs/misra/safe.json
+++ b/docs/misra/safe.json
@@ -124,6 +124,14 @@
},
{
"id": "SAF-15-safe",
+ "analyser": {
+ "eclair": "MC3A2.R2.1"
+ },
+ "name": "Rule 2.1: Unreachable code",
+ "text": "It is safe because the BUG() macro is intentionally used
to terminate execution when LPIs are enabled without an ITS."
+ },
+ {
+ "id": "SAF-16-safe",
"analyser": {},
"name": "Sentinel",
"text": "Next ID to be used"
diff --git a/xen/arch/arm/include/asm/gic_v3_its.h
b/xen/arch/arm/include/asm/gic_v3_its.h
index fc5a84892c..672dae7ac3 100644
--- a/xen/arch/arm/include/asm/gic_v3_its.h
+++ b/xen/arch/arm/include/asm/gic_v3_its.h
@@ -229,6 +229,7 @@ static inline unsigned int vgic_v3_its_count(const struct
domain *d)
return 0;
}
+/* SAF-15-safe */
static inline void gicv3_do_LPI(unsigned int lpi)
{
/* We don't enable LPIs without an ITS. */
--
2.43.0
|