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

Re: [RFC PATCH] libacpi: Fix cross building x86 on arm


  • To: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 23 Aug 2022 18:15:36 +0200
  • 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
  • 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=xE+8Zf3Ld4qAW7RUD6s/LnYiLlHMrnTAEmP9qpLRDSE=; b=h/8XUs9BK6+RiR/EObF5AW0Swknzv4LBJNGH1duaZa6GUtWZA6KRIqPRwofHDlC0PxAFwjZIe31g8jIL2BnVfysFmr0Ti3b5rZJY1tvJQZkP/r2niUMMdcklVicpw69UBNSPI8IR7YZl9OYDL6abrDi1MIOjb11TO3PJnjurc340LWuB4ZxQg41fZYuaSN2bwbTDdWCDazRvL8scvFCD89Kk3sjLLQiPvqh5HMJ6e0qRwYcjy/VnVJUNBwK1zE2GN4eR6vAtOPCzBfBFAWiU0X7XPq9AUUzjsnu8YbUgiAdLyF/mDN5GUWqzBPO5UlR4OpVh32z17q6UXJJ7NMnxdw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cqp2Ks3I636Hgv+zj4cfxI66w6qFqaZ5cqD8dSx1mbNbnMJXmzoTe7g1D9Lu2rZIqoL7pY5FjK/Sh9UJ7w5W7SCFmTeg/GtFBR9eCP71UyW8uozauW5xL1vmnqtNWRSVwqTa1yJvnzQAhCveKr7AJJsq6Zm8xMZLNjYPhweEhelPSuloxrNA4FnUEhLTN2vFvjekGtjfubsGwV+2Ockxrs795H3lh+Fvgj5eoO+gvOGJT8x+O1OW4q5rWHDD12RtShiPw3MWCwqXoJ99pFxOEIA/QgupfqUM1c1RNG/t7pBVdMbfYujefWTb+d7Ht+dkM4PfcDoW1B7+7oFKD+jURQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 23 Aug 2022 16:15:59 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 23.08.2022 16:41, Bertrand Marquis wrote:
> 
> 
>> On 23 Aug 2022, at 15:31, Jan Beulich <jbeulich@xxxxxxxx> wrote:
>>
>> On 23.08.2022 15:34, Bertrand Marquis wrote:
>>>> On 23 Aug 2022, at 13:33, Jan Beulich <jbeulich@xxxxxxxx> wrote:
>>>> On 23.08.2022 12:24, Bertrand Marquis wrote:
>>>>> --- a/tools/libacpi/mk_dsdt.c
>>>>> +++ b/tools/libacpi/mk_dsdt.c
>>>>> @@ -18,6 +18,16 @@
>>>>> #include <stdlib.h>
>>>>> #include <stdbool.h>
>>>>> #if defined(CONFIG_X86)
>>>>> +/*
>>>>> + * When building on non x86 host, arch-x86/xen.h will include xen.h 
>>>>> which will
>>>>> + * try to include the arch xen.h (for example if built on arm, x86/xen.h 
>>>>> will
>>>>> + * include xen.h which will include arch-arm.h).
>>>>> + * To prevent this effect, define x86 to have the proper sub arch 
>>>>> included when
>>>>> + * the compiler does not define it.
>>>>> + */
>>>>> +#if !(defined(__i386__) || defined(__x86_64__))
>>>>> +#define __x86_64__
>>>>> +#endif
>>>>
>>>> Besides being confusing this depends on the order of checks in xen.h.
>>>>
>>>>> #include <xen/arch-x86/xen.h>
>>>>> #include <xen/hvm/hvm_info_table.h>
>>>>> #elif defined(CONFIG_ARM_64)
>>>>
>>>> At the very least you will want to #undef the auxiliary define as soon
>>>> as practically possible.
>>>
>>> Ack
>>>
>>>>
>>>> But I think a different solution will want finding. Did you check what
>>>> the #include is needed for, really? I've glanced through the file
>>>> without being able to spot anything ... After all this is a build tool,
>>>> which generally can't correctly use many of the things declared in the
>>>> header.
>>>
>>> As stated in the comment after the commit message, this is not a good
>>> solution but an hack.
>>>
>>> Now I do not completely agree here, the tool is not really the problem
>>> but the headers are.
>>
>> Well - the issue is the tool depending on these headers.
> 
> Yes but the tool itself cannot solve the issue, we need to have the values
> in properly accessible headers.
> 
>>
>>> There is not such an issue on arm.
>>
>> Then why does the tool include xen/arch-arm.h for Arm64?
> 
> Because this header defines the values required and as no such thing as 
> include xen.h.
> The point is on arm, the arch-arm.h header does not depend on per cpu defines.

At first I was surprised you get away there without including xen.h -
this may change at any time, as soon as you grow a dependency.

But then the inclusion by arch-x86/xen.h looks suspicious, since xen.h
itself includes arch-x86/xen.h (first thing), so unless I'm missing
something arch-x86/xen.h can't really have a dependency on xen.h. So
maybe in the short term you could get away with removing that include
as a "fix"?

Jan



 


Rackspace

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