[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Resend: [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: Tue, 14 Oct 2025 16:36:18 +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=IBRkNPWSgPH8vclCOAb0N0pom0K0OPZ5N9LX1LDkHd8=; b=Wza2bpzZbz+3YZzAcpTvTOBOt13KY4rZXKzn/pxRrS9MtthD4ObxK8XecUKXCymge7CVVUM2R9W2gWmk9dVI+ZfyY4Ra2VlVzAhw+4rTH9mVO3ngjRul55m7vHJa2qBnULgZDl+Fxv6P+J/lHExXoyvGGXuVnMcxwZPEEGANb+5VOxuBXtN2Kg100jyFWjMKy3pA78RcAAKWGxw2o0gn+msZ2I2xnTvPhd3njhsiED73cW0pc+1D7L+WFQq+8RsmbUM+oDgqhAUC569f9bEi+Om8rOH1tQwLXjJKzEPp0N4m4WD6zd0qxbAi1ZNJf8TIY+ZymsBjxTSfF1HjERIfig==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=whAcFV/80+1LYnOSOLdBIz6Wobrj4s8YASw5KwB9uDmQuC9Cm71tvjh6z6HGt9r9rzHyyDWDMhErn/TaGuTdtwexpuNAFi3ttemr7lJXVlEeb55r4+FiZNNJbqjm4uuGnED7g9fE7wrJBTYakz71pJpLyAk+K8vVm5FXyEi3MM2XErRxaPmFcMejvgt5eOpfjdx5fFjpHhYhoIHuBKxy+7/WGa4uy3OFbr8YWMmcRlkez4IE0/wQ6VEls6Rxut5YLEbjqbpiHMv/NuBzRwn4DTUJTgu9Q+7mBfglbM4OF4aOU983gsHQ3rvEi0Zqs+uF68eEWKp6Bgpb63NvY6E5FA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: 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: Tue, 14 Oct 2025 16:36:32 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHcMXsLUvRxhyKkhUuhWVAohL+E7bTB7l2A
  • Thread-topic: Resend: [PATCH] arm/gic_v3: fix MISRA C R2.1 violations in gicv3_do_LPI()

Hello,
looking forward to feedback, suggestions, or any required
changes to get this patch accepted.

BR, Dmytro.

On 9/29/25 22:55, Dmytro Prokopchuk1 wrote:
> 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. */

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.