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

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


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Tue, 23 Aug 2022 13:34:36 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org 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=armh.onmicrosoft.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=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=eFBZ0IOw7pMG0BEjKGmnUJc4rmcRLVDNQdlp8n1L2jE=; b=NwBe7F1+x/3DgcdXInT2yDgusZf8/lkZWqmfw0nVdciVPn+NR5gpHw5eiXY5C/ApltN+df7TcgWdizIMbao6h6kJgqnxSVWeWGNij4esUIQEofoEn8ZIkoguDwl5hcHQlGk+ZTPgUshay/hBzk2qar8bCCpw3Um45/uuw6jaWW+5tQltPJ44cum5nF2W6uPmKyQHjqKFfbFis8cteo26knBovykBfYqPGombZ+Tc5Pd8zbmDMpsRI5kkjY7kT2LmhaN/kTjJfJ5iAMUMEbZTl8+LF5Tve66UVZ8IDM4py+WS5NY1ymW/6UnQiukMHS92XjxHLRqS6xPPWKLp4LZExQ==
  • 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=eFBZ0IOw7pMG0BEjKGmnUJc4rmcRLVDNQdlp8n1L2jE=; b=loVghY10X9jadkSL3Jmva4I17czCowqMrrUOcOc1qoPL6F9lN3licnRzyFA5HpxuK4WvsOOT8v5Byp5m59yHQpG+v4mkUGhUZOFEc1KeDesONAGOp3CodlBfkxiVFXcn72dqzfrregnAWo4p9z9nSvOakplmOAl2VORUARcU7ro2GsLDL0ZaTU1RcwZ0yIYR4aw94IaWRunLNh905xuwenw4hnFOYDvHg2lXXF99SAhV3jwoZEfGkjWSLVPbrcd2cc+Te4e4K/Q7xEwRzMFshtgZ/6VeAUM0t+8gzvqf80Oy8MYzWM3D6ft2O6R/+ZJxoiWCob+wcO/UXr229j6Myg==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=VhpuraMqSqYngy8aXLgezYUbr8FTHgSWkTQotfJKCnVXegkme78CPDUi1HdJgonikDr3tXVt1qeofJRjQKCsY7p9WfwLU39IU9wWNMCU2V2R8XBMX+0RNGoDxWmSfX/79FTrK1tlBq1yFXzgrzC7Ec8kpA7sKDsPFSwrz58bPy+imFoYArqGEJc1chA4DVtV1f8IY1Izjq8uChqCxdMhK00Nj6Iqb7FqoyiuX2WI6eX2ga/tuD2D4CzqKSYPlWzb+c/FKNAXUWWMQZ7U8xzYg0D6kAWpk63YPSAFWZ0TPjT9GosUP7gpfvmcBwx7RLObkBkUu3RHS4TWJPOTSdB/lw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YSkDCpxWV34C+1OqDMqANtvRQVuaki35YGJ1AXoptILUzKuqm15mUOY6J7ASWhGeJtX41d/baokoEZx9VauDM7IKIDz7hY0p4ZpMGgMYC899xp0hpw32WOvKs6IxpWcYzrMGHc1P6JcagYR+b7/z37xCvp7ek/sOHyQOJcbPHjzT+K/YoAHPV4R2mZ5BDPTBlXuDAZZ/r6Q3ugTv9sKbmfWetjkyTmb0/Oup2Z0UjM8bfT9a1s0NYfChlBJV2S9P8RRCpABN37gJPpnbOIsbBCah/ARnL8C10a+csq6AwRByzMLmeF8hsniMI2+jnba63tM/r7e3un6bCxQJKz1Gaw==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.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 13:34:58 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHYttqU3r7Sk/IKHkKroerrTRS8F628a1KAgAARJAA=
  • Thread-topic: [RFC PATCH] libacpi: Fix cross building x86 on arm

Hi Jan,

> 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. There is not such an issue on arm.

The tool needs at least:
HVM_MAX_VCPUS
XEN_ACPI_CPU_MAP
XEN_ACPI_CPU_MAP_LEN
XEN_ACPI_GPE0_CPUHP_BIT

Which are defined in arch-x86/xen.h and hvm_info_table.h.

I am not quite sure how to get those without the current include

> 
>> diff --git a/xen/include/public/arch-x86/xen.h 
>> b/xen/include/public/arch-x86/xen.h
>> index 58a1e87ee971..ea33a56eb6a0 100644
>> --- a/xen/include/public/arch-x86/xen.h
>> +++ b/xen/include/public/arch-x86/xen.h
>> @@ -24,6 +24,7 @@
>>  * Copyright (c) 2004-2006, K A Fraser
>>  */
>> 
>> +/* TODO: when cross building, this will include the wrong arch header */
>> #include "../xen.h"
> 
> I'm firmly against adding such a comment in a public header, the more
> that it's misleading: Cross-building of Xen, for example, works quite
> fine. The issue is limited to HOSTCC != CC (or yet more precisely the
> target architecture of each), afaict.

Point was the todo was more to show where the issue is coming from.
I am really ok to remove this.

Cheers
Bertrand

> 
> Jan




 


Rackspace

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