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

Re: [PATCH v6 02/15] drivers/smmu-v3: Fix impending MISRA R20.6 violation


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Fri, 18 Apr 2025 06:28:46 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 4.158.2.129) smtp.rcpttodomain=citrix.com smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; 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=68SCY0sBged/spZfHPqBp3vV09Aagu7hHMxl46ryxRQ=; b=oF5zLhOQMc7BF8UA5duAPhtp8xoCJ9/cGbxAM9p2w9+ALsBrQboJ9IUN9AiTzJ0rvDWDmCKYKFhCrbVJCFSABIBixhgb4K0wkzUIXX8JvZpNwITiY08CmD2zvrOGK+mOG+zzHKixeRTIAZOhTYXl2lEN8Rg7sOCneLUye5GjAj1fiOZy/Jbko7kDiIj8wzkE2Swhmnrx12ijhTt+3XmE6M1uenidxTrwDP4jGXnrMN6ALBQ2WdWj70j9V2vb9cErkMiIwz5gGPQBClGxuxEKdlnxkyPUhokYSsX0WuBkpULnRcIw4VcLm6Vw79HHKvZzCMKo2DBHmObGxquNO7H8IA==
  • 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=68SCY0sBged/spZfHPqBp3vV09Aagu7hHMxl46ryxRQ=; b=ZXvV+1/DuPv3BwZF+Ir+JXCQjiRB/8pWWKDG/s3inkBWp7boTJALFvZlgOhzRuOE33+J1I3cqsHvVB4ydWSVEzR0R1LcJ+s1LwjfMznfkhes5c1U1DFyUcfOGft7V9JqXnJ6MXfTIOsCOEUPHGmWmSYsA30LjDF4a1vB5ks8MdNFb+InmII9B0RwpX/qPNOwiiex6kbF2KrbqSbmHcMV8sGkTu5rBNPhflZa47EvngIjTHP+72oTbEMkmRNJsxb7DtPdmpMIcKPyjiuYAPPSm0ddrjl0CeEHpdA7YfdSQrI+qKVzKn5XJhRMg01qcswES89c5kJ3eNOD1kyVNox89w==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=uS36tgwddZ+Gyof3qT58gl4eHEXLB2ABLGsUGo3jqCcGX0hn5epg9CZWUU9/bEtRIvDPAWfhlM+MJABMD//lzQP4URenC4Rp1peKamWRjIAiDos4/8hjADFvHzyO41jCsoTVqUz6+hknjCOJGqoH1YCwCfDWesAIzdpQEipTHU3p/AA35rKjyvknj+4hE4xn7Pis4TXVidvFwPMjVnAyCH4mdYv/+Q2MItyaL3jY+PjwEoyKdd25w9bRIfjlaIvM1/z8pSG6uBSkjyQ82mY9sL1c9wkQAFyr1ugpfSpapbOCMGHZlRx2UL4pJflJJOnqLojGQcnG1WJqJ+7K9S8Kag==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PdRO13vRCkJXMFJNjMg7WX46BQ/PsRuQt5D0lePAftoWCtJN12a9i/HfpR55/NSK+haDvVYK68Bwrg1TxgROQZghOIpxOMaw3aS9Rl8aWPXZesN0iJ9zfEmmkgSQ1FwNzqwafA2Ppo/oMBNldT+so4lis0Vp6XCWjFrtEhhIXHAL2RBT6v1HrmNxyJvQyL/mHjsiuRhV1C9zwXWyxM3/yVZWfP/+rzQAYClkud4XEsqSFog70HIvJF0whinno3hk88H1jgxWuZHud3hoi5k+9oLDphrr18iEYAj/SU260WDx25N2h5jt5GYcrrFs2ltnQFe95oE7UN77VJcEpg1JPg==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, 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>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Shawn Anastasio <sanastasio@xxxxxxxxxxxxxxxxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, "Daniel P . Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, Lin Liu <lin.liu@xxxxxxxxxx>, Rahul Singh <Rahul.Singh@xxxxxxx>
  • Delivery-date: Fri, 18 Apr 2025 06:29:53 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Thread-index: AQHbrsb4h7zxEPTLGky/jys+D4v1IrOo+KwA
  • Thread-topic: [PATCH v6 02/15] drivers/smmu-v3: Fix impending MISRA R20.6 violation

Hi Andrew,

> On 16 Apr 2025, at 13:58, Andrew Cooper <andrew.cooper3@xxxxxxxxxx> wrote:
> 
> cpu_to_le64() is about to become a macro, at which point the #ifdef in the
> middle of it becomes undefined behaviour.
> 
> Use a logcal variable to prepare strtab, where the #ifdef is fine to use.
> 
> No functional change.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>

Cheers
Bertrand

> ---
> CC: Anthony PERARD <anthony.perard@xxxxxxxxxx>
> CC: Michal Orzel <michal.orzel@xxxxxxx>
> CC: Jan Beulich <jbeulich@xxxxxxxx>
> CC: Julien Grall <julien@xxxxxxx>
> CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> CC: Stefano Stabellini <sstabellini@xxxxxxxxxx>
> CC: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
> CC: Bertrand Marquis <bertrand.marquis@xxxxxxx>
> CC: Shawn Anastasio <sanastasio@xxxxxxxxxxxxxxxxxxxxx>
> CC: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
> CC: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
> CC: Lin Liu <lin.liu@xxxxxxxxxx>
> 
> v6:
> * New
> 
> Eclair log from v5:
>  
> https://uk01.z.antigena.com/l/DKXzqbWh6FOSes_N-GS4kVrRo3s8zxL~gIwm28-vykineH901_xtXphlRhHlTYIHWWH6_S74ZTXa~OJ1oe8DWS0WAgpOS1BOFHtxX2jR6U-~VP31JDjZ40itG8x3chZ~PBn931irdHNDnKtxILHxK_FvR7wxF63KdTZtHUaOvCWrtK4k_iVXV9-H9nXfDUd_q1i9d6-qOYpJBZ9NvulXvOWkHp6YDvPqHMLDubcurr3Zr60yQ3vrc8GDgfSEgbkM6Cmz9QmGqEm_qyEqM1N2rys622rmVNet6hPpI-Xm6SJRUeepHpylVuK4flX48Jpf0jOqHz4GaTjouy4nRC017h
>  
> ---
> xen/drivers/passthrough/arm/smmu-v3.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/xen/drivers/passthrough/arm/smmu-v3.c 
> b/xen/drivers/passthrough/arm/smmu-v3.c
> index cee572402203..df162350578c 100644
> --- a/xen/drivers/passthrough/arm/smmu-v3.c
> +++ b/xen/drivers/passthrough/arm/smmu-v3.c
> @@ -722,15 +722,17 @@ static void arm_smmu_write_strtab_ent(struct 
> arm_smmu_master *master, u32 sid,
> }
> 
> if (s2_cfg) {
> - BUG_ON(ste_live);
> - dst[2] = cpu_to_le64(
> + u64 strtab =
> FIELD_PREP(STRTAB_STE_2_S2VMID, s2_cfg->vmid) |
> FIELD_PREP(STRTAB_STE_2_VTCR, s2_cfg->vtcr) |
> #ifdef __BIG_ENDIAN
> STRTAB_STE_2_S2ENDI |
> #endif
> STRTAB_STE_2_S2PTW | STRTAB_STE_2_S2AA64 |
> - STRTAB_STE_2_S2R);
> + STRTAB_STE_2_S2R;
> +
> + BUG_ON(ste_live);
> + dst[2] = cpu_to_le64(strtab);
> 
> dst[3] = cpu_to_le64(s2_cfg->vttbr & STRTAB_STE_3_S2TTB_MASK);
> 
> -- 
> 2.39.5
> 
> 


 


Rackspace

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