[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 2/3] xen/arm: make has_vpci depend on CONFIG_HAS_VPCI
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
- Date: Tue, 18 Jul 2023 13:01:31 -0400
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none
- 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=L0eI4QJl/zvOMtlN85TFWCqI/abwRV2x4VOpktU11ok=; b=X5KsU5KztdA5jU3tDKyT04c14CM0IryRHI5MFZ/TXmvUDnjmwqZRsBavNmFx2MI1raaijPGs6tpK83QSUYZxvRYLJnV1n730sDFEFUR7QYZw9LGtEZjk+8reklEHtld0IgJ/GwUwbExtsIcLrdpsYUfP3KzaKLJIew3b1ZCf208NphjlgHpN40TkZHGx92cTwoE4tCH8LTHcBXwsgqE/XcP3dhk2p4jf2UFW3oEZ/RUpiZE32mmzhz9h2K/JP7Da2N3nXad8RQk9Wb9y7Dz1Ifw/MGn9ALFNukJqJB0uIr7LuwktjNYFwO3tQpBfztwJ1YwzeEQuJQfsULfiRLQQew==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hLVFWd/WtqJegE9UEM3hEflCqFGbuGrZyfV7BsmhOsdGTl6ZPegwRj02H64wdl1UrrWuZRAPYaU8+rCpbO9baKnOARGx94/L9xg5x5AGOlxTJfpqPoOFQUKa4BuM94DFZnqY3YW0mdA5ZQgYCxTi+EeU4Y0NZfxueHQUdKfCR2HONSmSDaiU44mBLvaSYXZnTbmZTf5sGYDAPdV3MsZbzF8h6POZDTzEuR7123CxwD63/LHsI1m08JMSuZ6Hd7LTImYo2faicHJuqWLJlexIkH7+Vr2KferPaKtIpmBymzO/jdwnYzPrKqaMB+bpaaPbONkB88xVlrSaqozjEmLUMQ==
- Cc: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>, "Stefano Stabellini" <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, "Bertrand Marquis" <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>, Artem Mygaiev <artem_mygaiev@xxxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Tue, 18 Jul 2023 17:02:01 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 7/7/23 02:59, Jan Beulich wrote:
> On 07.07.2023 03:47, Stewart Hildebrand wrote:
>> --- a/xen/arch/arm/include/asm/domain.h
>> +++ b/xen/arch/arm/include/asm/domain.h
>> @@ -298,8 +298,7 @@ static inline void arch_vcpu_block(struct vcpu *v) {}
>>
>> #define arch_vm_assist_valid_mask(d) (1UL <<
>> VMASST_TYPE_runstate_update_flag)
>>
>> -/* vPCI is not available on Arm */
>> -#define has_vpci(d) ({ (void)(d); false; })
>> +#define has_vpci(d) ({ IS_ENABLED(CONFIG_HAS_VPCI) &&
>> is_hardware_domain(d); })
>
> While likely not much of a problem here, I think we should strive to
> write macros such that their arguments are evaluated exactly once in
> all cases (for side effects to occur exactly once). When that's not
> easily possible, so be it, but here it doesn't look problematic to
> swap both sides of the &&.
Thanks for pointing this out. Hmm... I'm considering turning it into a static
inline function. This would also satisfy MISRA C:2012 Dir 4.9: "A function
should be used in preference to a function-like macro where they are
interchangeable" [1].
[1]
https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/D_04_09.c
|