Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2312812rdb; Mon, 20 Nov 2023 07:47:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IGL9aZP9KA58/Jgt5RlNlgkVNczLtuc70y25Jk4rQgz7tpazxJgPxu43+QnqmlKjMBlaK1U X-Received: by 2002:a05:6a00:3a09:b0:6cb:a1a7:ebcb with SMTP id fj9-20020a056a003a0900b006cba1a7ebcbmr3747839pfb.24.1700495265841; Mon, 20 Nov 2023 07:47:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700495265; cv=none; d=google.com; s=arc-20160816; b=E7tARLa1s8Q/pT3xIXVETSd7ul0E20fZ8BgwHO8KfWVtAgIWcJqV+797JxfpB0nx5V 6gdJQBBg/9A6mf4QXMlJRtk1ilqlAP3cukI094kM3EtWPD4qcMGvsolfPTEvTvwqUEHv Tdf51ckeosjaPrPGuiS6Ex0slh4Ph92mEVhMSkTvVZoIWykkMgxct8jQxsFZU2m3LfHA l0H0kcP5pBw8nLCTVvMR9vsV7bUbG2VYmp+AAjb1P8AF21LGMRDZv22EmDawy5lO9Xxx gWPLoTL3JzpRvPYBLs4J+mGYpa8bZ/gCqhHSwOQoldIXGUeX2hBl+aPLFYSvvAI5IEu8 Nk5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=wcnyVPOabYyE6w9o3sSEwSC6XYhUxqQOBh2vXqhNzWM=; fh=Ai/H0Taf18K8WaEtKg097cAMRqNstzMX8Hz+1ItJ2kU=; b=rYkdOYhuI9H3EgxPvk+ybUcSRTmzt1TGx/uJmdBCgiE/h2/6+SQQqXV3q5jldeW0gT LbfGa5MPQ8DwP1VedWc/Q2rW94LJSRV1qidXjRUDrYdUl4eY+2hnvD2p85TcADBkE9yY 2iWttVS3CUk/N/ujVP747HL/FDI11EU7zSxi9iNEvk5Qij2EBIe27M2XlDsjKDpw7h7/ OGjsDOMIz4Irp7c7XSr95G5s9m8lJV+/tKs9DHK0Q0mIo3F70K4Jp+923rvID9LywiIr OmtMN6SAPj/KKfZQ4EvPPQSwtYoG8j5itZa9EwmA1Sk+knCvrwpR8UTXOrRhZbsFl301 s9ww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id y9-20020a634b09000000b00565e509dc75si7975310pga.359.2023.11.20.07.47.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 07:47:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 3590480407D3; Mon, 20 Nov 2023 07:47:12 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234076AbjKTPrE convert rfc822-to-8bit (ORCPT + 99 others); Mon, 20 Nov 2023 10:47:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233672AbjKTPrC (ORCPT ); Mon, 20 Nov 2023 10:47:02 -0500 Received: from mail-oo1-f49.google.com (mail-oo1-f49.google.com [209.85.161.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E139610E; Mon, 20 Nov 2023 07:46:58 -0800 (PST) Received: by mail-oo1-f49.google.com with SMTP id 006d021491bc7-58a106dd421so165476eaf.0; Mon, 20 Nov 2023 07:46:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700495218; x=1701100018; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TjSE7oP7NG2cczV9fpstRxmalzuxbmeoxKfXPkfwwRE=; b=OO67O2u0QRy5L986+KQCK8sHljYDSrLHkxaYLPlHgUcDHhudtMxqC6ZDx84TIURC1x C9X1C/f3H2qE9iJVWfCl+46JTRlQxwar24iofwC0XdGStOxXJIEPSlkZYb0C5Ifeo/1G iJ4bvfXfZrMGVyhonACl7dGgGW8Qe/lcvj/tYH0jy+f0S7CHHT/k0j5XlDekvlNAI/ob 12PO4DJYd+sAYT3LmJseFgcSAsQHrSBpsVjyA8Q1ERvt8Hu4/8Vtb9NrLXBclcWC9O+6 G8tnuhh0pS3GRQRMhVHH9cFlpb05RLM4zl8sLOsWdotBQu3xzmSnj/YYCaoRtvKD/XWM 0zrg== X-Gm-Message-State: AOJu0YxwlEhdwrcrPQaAeX2tpVOUAIKNEOivxIlY9fORosRqYAuejhTa GbDgNUHicLNO7ndqeBvJly7grhvMmiaROfBKEvU= X-Received: by 2002:a4a:e783:0:b0:589:daaf:44a1 with SMTP id x3-20020a4ae783000000b00589daaf44a1mr7217546oov.0.1700495218082; Mon, 20 Nov 2023 07:46:58 -0800 (PST) MIME-Version: 1.0 References: <20231114-arm-build-bug-v1-1-458745fe32a4@linaro.org> In-Reply-To: From: "Rafael J. Wysocki" Date: Mon, 20 Nov 2023 16:46:46 +0100 Message-ID: Subject: Re: [PATCH] ACPI: acenv: Permit compilation from within the kernel To: Sam Edwards , Dave Jiang Cc: Linus Walleij , "Rafael J. Wysocki" , Len Brown , Robert Moore , Jonathan Cameron , Dan Williams , Hanjun Guo , Arnd Bergmann , "Rafael J. Wysocki" , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 20 Nov 2023 07:47:12 -0800 (PST) On Tue, Nov 14, 2023 at 7:09 PM Sam Edwards wrote: > > On 11/13/23 16:08, Linus Walleij wrote: > > After commit a103f46633fd the kernel stopped compiling for > > several ARM32 platforms that I am building with a bare metal > > compiler. Bare metal compilers (arm-none-eabi-) don't > > define __linux__. > > Hi Linus, > > I saw the same baremetal-compiler error here on the ARM64 side of the > fence, and narrowed the problem to the same commit as you. > > > > > This is because the header is now > > in the include path for : > > More generally, I think it's because of this addition to linux/acpi.h: > +#include > > linux/acpi.h is supposed to ensure _LINUX is defined (if it isn't > already done by a non-baremetal compiler) before we start pulling in > ACPICA includes, so that ACPICA knows the platform. But because > fw_table.h contains: > #include > #include > > ...the circular include does nothing (linux/acpi.h's include guard stops > the include before _LINUX is defined) and we end up pulling in > acpi/acpi.h before we're ready. Yes, that's the problem AFAICS. Dave? What about moving the fw_table.h include in linux/acpi.h below the mutex.h one, along with the EXPORT_SYMBOL_ACPI_LIB-related definitions? BTW, I'm not really sure why fw_table.h needs to include both linux/acpi.h and acpi/acpi.h, because it should get the latter through the former anyway. > > > > CC arch/arm/kernel/irq.o > > CC kernel/sysctl.o > > CC crypto/api.o > > In file included from ../include/acpi/acpi.h:22, > > from ../include/linux/fw_table.h:29, > > from ../include/linux/acpi.h:18, > > from ../include/linux/irqchip.h:14, > > from ../arch/arm/kernel/irq.c:25: > > ../include/acpi/platform/acenv.h:218:2: error: #error Unknown target environment > > 218 | #error Unknown target environment > > | ^~~~~ > > > > One solution to make compilation with a bare metal compiler > > work again is to say the file is used with Linux from within > > the kernel if __KERNEL__ is defined so I did that. > > I am not an ACPI subsystem maintainer, but my understanding is that the > files in include/acpi/ are copied verbatim from ACPICA, so any change to > those files will have to be sent to the ACPICA project and wouldn't be > accepted here. There are exceptions, but generally you are right. > More likely, we'd want to do something about the circular-include > situation between linux/fw_table.h<->linux/acpi.h. That may have further > consequences down the road than just our problem here. Perhaps just > dropping both #includes from fw_table.h, and lowering the fw_table.h > include from within linux/acpi.h to be below , is the way > to go? Something like that.