From patchwork Mon Jul 31 13:31:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13334642 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 74C80C001DE for ; Mon, 31 Jul 2023 13:31:49 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.573052.897357 (Exim 4.92) (envelope-from ) id 1qQSzl-0007bv-E3; Mon, 31 Jul 2023 13:31:33 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 573052.897357; Mon, 31 Jul 2023 13:31:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qQSzl-0007bo-Az; Mon, 31 Jul 2023 13:31:33 +0000 Received: by outflank-mailman (input) for mailman id 573052; Mon, 31 Jul 2023 13:31:32 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qQSzk-0007bi-5Z for xen-devel@lists.xenproject.org; Mon, 31 Jul 2023 13:31:32 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on20613.outbound.protection.outlook.com [2a01:111:f400:7e1b::613]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 8e8756d5-2fa6-11ee-8613-37d641c3527e; Mon, 31 Jul 2023 15:31:30 +0200 (CEST) Received: from DU2PR04MB8790.eurprd04.prod.outlook.com (2603:10a6:10:2e1::23) by AS4PR04MB9411.eurprd04.prod.outlook.com (2603:10a6:20b:4ea::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.43; Mon, 31 Jul 2023 13:31:27 +0000 Received: from DU2PR04MB8790.eurprd04.prod.outlook.com ([fe80::e5cf:5743:ab60:b14e]) by DU2PR04MB8790.eurprd04.prod.outlook.com ([fe80::e5cf:5743:ab60:b14e%5]) with mapi id 15.20.6631.026; Mon, 31 Jul 2023 13:31:27 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 8e8756d5-2fa6-11ee-8613-37d641c3527e ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DlKISsqCRkQKaKteTv1iFa120j0W1FH7XsHA2zMQGU7udPUeDkfFvutmi9TCQj0e6pTcZd09jEYPVgEu0jxgN9XFcx2iNeRqL/FvpNQ6/r861sraw6L4XC9H493ij3GOWlrZDZkUfhHPwODLsytDmORN7VxS2gwFULRXcHwLojUFg8bSpXJh5Y7Z93xWeIqtXp502zx69mFUGa8b2n5gWAgmZqq/buMBIwh43qiciPq/D7GKvM88zoBcRly6QTGni2gcZHK96CIU/fvJboGy7EMSwPlEgRUrWwygnaqF3YT9Q38GCRAXztSfjEFSDtE0KDx1fb1uUTPhT1922pQiDg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8u6Ro9TH7gEX09Hl6hvYAKoJ1p86WOM8kiqVVm11DA4=; b=l2tZu7xfavIVHAbxnJUWSWwbnCnrd30KKfOIx4MwCLBiBmpBYePZYeoVblNEGlywVjgc6naZriZTxp8u/5GeTTY+a2WRX4Gm+gcMfy8vhuzkWcLcM1+dIZxW/KmrSTfq0rXRpWpwLuFmiZfMjLtwcbNJGBpz6TBs3RVB04CoJknXHpq5xNqmHEWc2lahSKtPKDZiHXRIQ/0NSQIElcDzHcheyztWWPeX76TMFX/THvcQuBXq7Vt/7BG+dFcLjFlvNvXw1rO7ZiI6RjpL8zm+3gZ9E2rsJSSeZV+x5JdZ6k9ZyL2kPHk4F40n18rzJe8mSNC80qI2meJued8GX+zKYA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8u6Ro9TH7gEX09Hl6hvYAKoJ1p86WOM8kiqVVm11DA4=; b=Ghy78BknTA2npD8vj7Go7+HCzo6dfb8ZmH5Flq8h7KW4wK4H+4j47T81jZ5k+LGyOJt+Rt+WyLBLtkz7ilwAXCVCLJL35cyq+OPTclJ7U0CiNuMpyWnQHw8rFOAVb7+ZWwF/IuycVQUS/IxLWJUd2nErf5pylf1XvjsPatv5qOSVHgAWFCkUJrSL4G+/xEtRMeFzHWcxIzNzV+eb/adioVkcZCJI8eQC2Xu4rNy77o/88MHA4zngtfjfP95VYHdmfwLgoyY3xsjOJgwuMfvmUg7zWGVlKVJ9oM6F7iogHyM3O4pUNNdMH0xjRP0w3g/e/DL2lHQ6NC+WbpJEACHzbQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Message-ID: Date: Mon, 31 Jul 2023 15:31:26 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.13.1 Content-Language: en-US To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Nicola Vetrini From: Jan Beulich Subject: [PATCH] x86/HVM: tidy _hvm_load_entry() for style X-ClientProxiedBy: FR3P281CA0128.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:94::10) To DU2PR04MB8790.eurprd04.prod.outlook.com (2603:10a6:10:2e1::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8790:EE_|AS4PR04MB9411:EE_ X-MS-Office365-Filtering-Correlation-Id: 1b44274f-c63e-473c-499d-08db91ca713b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sVWOjyNUtOqfNVZBXPIgTFmXpCfchYFn0KjcS++DbVniD1HEavfS3akBRcfeBNSVyRf2UfZhXhyJrTBDJY01wJMDfoMHVVIdGmgX1uzKc39PdvxkfvvQCpRV296/DLnZ0SVPqo5dl4O/2T0/VqI4rki1t6UzS9WFU1Wb1Gxn4Svm8iYrquHHXOCBTmjL2PkDndLjrdL1k6+Va7r+Gj9P11P9H/oAEYmA1GhaB+QwIZgZidqj0mR6Kg2n0qhQtaKi7a5e64cdNPxJWVOYIhLOagUHo5WSDuNYNTlRXUp95fuzCBgs0Xckm1seC1H5/8FewBe+dtbIhVrKJH+pMBzGJlBMTH0EuCpcNjI6yc140xNo/sc3TMvrq0kBEyfB4gsHYg0ojvwqG1t9DRy4pI/nfOELt+G+pXikCNQ/xkewlZkbnyXwKkxpF+B3tsBU+vrBhpYsi4hp4So/w5AxbLWST6cMIA/a7lDC4hYxZfCdz8cxO0Vr1F2lNvz7sGiAKi06bmB1pSqqBM/CgFAofXmTdxhGFg+qc20g6q0YANlISX4+5h4z55XfuqVzru8IMYFx3REIQOf3hO1nS58PmVp+WGbPP8nA0LGcz6JmvhG5n7C2NEW9UzDNbh+a6OEXhqqk8izQwZdQ7ZRc7QcIe8lu5w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8790.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(39860400002)(136003)(366004)(376002)(396003)(346002)(451199021)(6512007)(6486002)(36756003)(2616005)(26005)(6506007)(186003)(66946007)(66556008)(41300700001)(54906003)(31696002)(86362001)(66476007)(316002)(4326008)(5660300002)(6916009)(8676002)(8936002)(31686004)(38100700002)(2906002)(478600001)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?K2cfwfOAlO/QrW03PLX/Zfb7pqoX?= =?utf-8?q?QKoBZN6vJwK6589lsmDqc01jT/Dy7kXp7IFMbRMFVUfZOB6zzu9443mNUPq1O32Pb?= =?utf-8?q?ZOxYcR1KceResfxnlVGtkOA2mIKZOagFTCsB1/lybGYOyeYudQ2/it/t7u/3EUbfN?= =?utf-8?q?f3zPAuKY8KZGNgmw6ugi3tFKz0oPqSTY95m91cmbla+MKLQ++K0NeU6bYP+ANjAAT?= =?utf-8?q?xvARvj2ou7+2IPJGxvqEhMEHM/DCD03axwOxTiW6vpEiQ245KYCv6XJEQHsmEBQWg?= =?utf-8?q?XZs714d0btRGhmJ2mpB2xtU9jbd1jRARTP2WmkKAOcQcGhrC3x4WhNYFu/3SakxJ9?= =?utf-8?q?fGiV6HRrHktGkdQrHLI65kjnZk6xreyWybvgitZ1olxgqRBEKe5xRBZpr38sVbOEb?= =?utf-8?q?JuFd/lLnrIs0VDSncZnZcKb7WLxxoGuwzOTpBT3wRufogv09XleMs2Ly6Xcg7pOSV?= =?utf-8?q?kNY4LcIv4+qIPAInsmZRoBJPp1yUpjjiipsMg2zFZt2WnTiDAkDXWHuFmmoAmIrdW?= =?utf-8?q?FpKGqQHpRBWDFAoStphJ5+HC3+ajTVY/Espu9t1ZzikJIn+DFn5DiIMh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P?= =?utf-8?q?PhBDmxh206LOEHkStfT4xvyqlL4RNq+xZG+pqz8axJo6+kF5C+Q1DG8Vkj7ZSSbqw?= =?utf-8?q?PCFJaWWZVNn9?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1b44274f-c63e-473c-499d-08db91ca713b X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8790.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2023 13:31:27.3372 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: oPlbzqF61y/CAkEzTsWzZR8IEaDevcuaiN6LVQIA0JaI7hGnb/coRWA0pq58hk2UcvH2oblk5h/mOOU+Yq3c7w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9411 The primary goal is to eliminate the Misra-non-compliance of "desc" shadowing at least the local variable in hvm_load(). Suffix both local variables with underscores, while also - dropping leading underscores from parameter names (applying this also to the two wrapper macros), - correcting indentation, - correcting brace placement, - dropping unnecessary parentheses around parameter uses when those are passed on as plain arguments. No functional change intended. Signed-off-by: Jan Beulich Reviewed-by: Stefano Stabellini --- a/xen/arch/x86/include/asm/hvm/save.h +++ b/xen/arch/x86/include/asm/hvm/save.h @@ -47,30 +47,32 @@ void _hvm_read_entry(struct hvm_domain_c * Unmarshalling: check, then copy. Evaluates to zero on success. This load * function requires the save entry to be the same size as the dest structure. */ -#define _hvm_load_entry(_x, _h, _dst, _strict) ({ \ - int r; \ - struct hvm_save_descriptor *desc \ - = (struct hvm_save_descriptor *)&(_h)->data[(_h)->cur]; \ - if ( (r = _hvm_check_entry((_h), HVM_SAVE_CODE(_x), \ - HVM_SAVE_LENGTH(_x), (_strict))) == 0 ) \ +#define _hvm_load_entry(x, h, dst, strict) ({ \ + int r_; \ + struct hvm_save_descriptor *desc_ \ + = (struct hvm_save_descriptor *)&(h)->data[(h)->cur]; \ + if ( (r_ = _hvm_check_entry(h, HVM_SAVE_CODE(x), \ + HVM_SAVE_LENGTH(x), strict)) == 0 ) \ { \ - _hvm_read_entry((_h), (_dst), HVM_SAVE_LENGTH(_x)); \ - if ( HVM_SAVE_HAS_COMPAT(_x) && \ - desc->length != HVM_SAVE_LENGTH(_x) ) \ - r = HVM_SAVE_FIX_COMPAT(_x, (_dst), desc->length); \ + _hvm_read_entry(h, dst, HVM_SAVE_LENGTH(x)); \ + if ( HVM_SAVE_HAS_COMPAT(x) && \ + desc_->length != HVM_SAVE_LENGTH(x) ) \ + r_ = HVM_SAVE_FIX_COMPAT(x, dst, desc_->length); \ } \ - else if (HVM_SAVE_HAS_COMPAT(_x) \ - && (r = _hvm_check_entry((_h), HVM_SAVE_CODE(_x), \ - HVM_SAVE_LENGTH_COMPAT(_x), (_strict))) == 0 ) { \ - _hvm_read_entry((_h), (_dst), HVM_SAVE_LENGTH_COMPAT(_x)); \ - r = HVM_SAVE_FIX_COMPAT(_x, (_dst), desc->length); \ + else if (HVM_SAVE_HAS_COMPAT(x) \ + && (r_ = _hvm_check_entry(h, HVM_SAVE_CODE(x), \ + HVM_SAVE_LENGTH_COMPAT(x), \ + strict)) == 0 ) \ + { \ + _hvm_read_entry(h, dst, HVM_SAVE_LENGTH_COMPAT(x)); \ + r_ = HVM_SAVE_FIX_COMPAT(x, dst, desc_->length); \ } \ - r; }) + r_; }) -#define hvm_load_entry(_x, _h, _dst) \ - _hvm_load_entry(_x, _h, _dst, 1) -#define hvm_load_entry_zeroextend(_x, _h, _dst) \ - _hvm_load_entry(_x, _h, _dst, 0) +#define hvm_load_entry(x, h, dst) \ + _hvm_load_entry(x, h, dst, true) +#define hvm_load_entry_zeroextend(x, h, dst) \ + _hvm_load_entry(x, h, dst, false) /* Unmarshalling: what is the instance ID of the next entry? */ static inline unsigned int hvm_load_instance(const struct hvm_domain_context *h)