From patchwork Thu Sep 26 16:54:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13813528 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 E6EFECDE024 for ; Thu, 26 Sep 2024 16:54:58 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.805751.1216949 (Exim 4.92) (envelope-from ) id 1strlB-0001W5-Pr; Thu, 26 Sep 2024 16:54:33 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 805751.1216949; Thu, 26 Sep 2024 16:54: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 1strlB-0001Vm-My; Thu, 26 Sep 2024 16:54:33 +0000 Received: by outflank-mailman (input) for mailman id 805751; Thu, 26 Sep 2024 16:54:32 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1strlA-0001SU-Hb for xen-devel@lists.xenproject.org; Thu, 26 Sep 2024 16:54:32 +0000 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [2a00:1450:4864:20::62f]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 001742f4-7c28-11ef-a0ba-8be0dac302b0; Thu, 26 Sep 2024 18:54:31 +0200 (CEST) Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a8d6ac24a3bso231486066b.1 for ; Thu, 26 Sep 2024 09:54:31 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a93c2979e00sm16981566b.158.2024.09.26.09.54.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2024 09:54:29 -0700 (PDT) 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: 001742f4-7c28-11ef-a0ba-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727369671; x=1727974471; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tyQZLVu1mMzTaGyKX8oda+NFy3jMOBImmEzHcbevgZ0=; b=PB8EpGCXAXXY7Yv7vp9W75XsX0eSCfdE5A8/mRX9zh628uc6bDJRV7ATEEUu3uKmIn 3CP0UeojdDB20q1BoOkaYJ+nTSvug43Efcvc6w981oaAjsCjVFCreES2oZCSsC6K17og l7VkC3uNDxIQdkr/uFf3sHwjNSp/zAzOYBzfvKoavuPUEkN8fjSi521fhwD8YGAbmxnG OWiybuYZIfYHRJBjxbshMaCdJudGgSRi+sO42sFNZ6VghQwyluZ9egyti6j2dcd37nCI YxHAv3uewwApSyUpB7lYKVCO8OkhZO6GqzEfSsaRZKjsEmP3buzKgyXQrVEvOOBzLwZT 8SUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727369671; x=1727974471; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tyQZLVu1mMzTaGyKX8oda+NFy3jMOBImmEzHcbevgZ0=; b=U0KEtVneaTLxtoKHhjfTmrqaI0EqRji9kUpWIX0hSmfSPvvIIjZKiP3I1Ct2OWWX44 YsSphUr9LhzuUSCfzDlUwqM7f11GIpS7BrysqUPx3VmeiNZUqU1a7Vbtcwy5WxRqkK2o a9gqeO8Wdn9+wdmJjuT1GjK+gXSLbIEtG5a3/HOB0Bnptg1J2BWQS/kVL/cifKadGjtl E4snBZDvePKEODZdSzz7RJ2FKOZtUZ+1F5w9uE5ipl3FRZxOqyp/Xpn9Hve8d6+rFZNf GTrNrlwYeTxwSgiGN6zdpfUHS/zsLTxfChNdrvre9z5wcn3ek4oyFV5TGFwpiWOa9m+G aT6Q== X-Gm-Message-State: AOJu0Yxd9LqxJAItrNw4nV66bH16HyEAtFF1YYKBlEIczuWXibLDChEs nKOCNtDDIaYpMRLXzJqBDvBqsB+FJFoU+ZkeED+K7/rvUsUjXtheuH/bTg== X-Google-Smtp-Source: AGHT+IGO7LzsF8sL7T87A5FWyFu7zhWF2lc2XGmHrBVsJ9IfeJqByhupnamafALDKTWao2T7nT6fTg== X-Received: by 2002:a17:906:4fd2:b0:a7a:afe8:1013 with SMTP id a640c23a62f3a-a93c3094cbbmr61577066b.1.1727369670418; Thu, 26 Sep 2024 09:54:30 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Julien Grall , Stefano Stabellini Subject: [PATCH v4 1/6] xen: introduce SIMPLE_DECL_SECTION Date: Thu, 26 Sep 2024 18:54:20 +0200 Message-ID: <413dfb16280c3ec541df8775d31902a4b12a64fe.1727365854.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.46.1 In-Reply-To: References: MIME-Version: 1.0 Introduce SIMPLE_DECL_SECTION to cover the case when an architecture wants to declare a section without specifying of load address for the section. Update x86/xen.lds.S to use SIMPLE_DECL_SECTION. Signed-off-by: Oleksii Kurochko Acked-by: Jan Beulich --- Changes in V4: - new patch --- xen/arch/x86/xen.lds.S | 6 ++++-- xen/include/xen/xen.lds.h | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index b60d2f0d82..9275a566e1 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -3,6 +3,10 @@ #include #include + +#ifdef EFI +#define SIMPLE_DECL_SECTION +#endif #include #include #undef ENTRY @@ -12,9 +16,7 @@ #define FORMAT "pei-x86-64" #undef __XEN_VIRT_START -#undef DECL_SECTION #define __XEN_VIRT_START __image_base__ -#define DECL_SECTION(x) x : ENTRY(efi_start) diff --git a/xen/include/xen/xen.lds.h b/xen/include/xen/xen.lds.h index 24b8900ffe..8135732756 100644 --- a/xen/include/xen/xen.lds.h +++ b/xen/include/xen/xen.lds.h @@ -5,6 +5,8 @@ * Common macros to be used in architecture specific linker scripts. */ +#ifndef SIMPLE_DECL_SECTION + /* * Declare a section whose load address is based at PA 0 rather than * Xen's virtual base address. @@ -15,6 +17,10 @@ # define DECL_SECTION(x) x : AT(ADDR(x) - __XEN_VIRT_START) #endif +#else /* SIMPLE_DECL_SECTION */ +#define DECL_SECTION(x) x : +#endif + /* * To avoid any confusion, please note that the EFI macro does not correspond * to EFI support and is used when linking a native EFI (i.e. PE/COFF) binary, From patchwork Thu Sep 26 16:54:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13813526 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 DF763CDE024 for ; Thu, 26 Sep 2024 16:54:54 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.805752.1216959 (Exim 4.92) (envelope-from ) id 1strlC-0001iR-AH; Thu, 26 Sep 2024 16:54:34 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 805752.1216959; Thu, 26 Sep 2024 16:54:34 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1strlC-0001iF-5e; Thu, 26 Sep 2024 16:54:34 +0000 Received: by outflank-mailman (input) for mailman id 805752; Thu, 26 Sep 2024 16:54:33 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1strlB-0001SU-6H for xen-devel@lists.xenproject.org; Thu, 26 Sep 2024 16:54:33 +0000 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [2a00:1450:4864:20::632]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 0072edca-7c28-11ef-a0ba-8be0dac302b0; Thu, 26 Sep 2024 18:54:32 +0200 (CEST) Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-a93c1cc74fdso38881966b.3 for ; Thu, 26 Sep 2024 09:54:32 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a93c2979e00sm16981566b.158.2024.09.26.09.54.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2024 09:54:30 -0700 (PDT) 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: 0072edca-7c28-11ef-a0ba-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727369671; x=1727974471; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/Me01IlmWn5ZXb/VKWHt5wAOgVcX8vvbwAiPhcFzwz0=; b=TsEpjwmIy/fiRv+OxB8HeW8p79G75MGcaw7mtYn024YB9wCyqncHMQ3w2jGx+K0WRr 96XAj5HbvsXqza6NCqmNk/89w6vsnL9CkxsFvSz6qB6Mac28+PUbhaTf/noi8xxvSUN+ zfNMiThN67jBNBekZhvfsnEamSqLfCw87zoh8L//X3IE/fs9zqnYVJbxO/tpjy8K+dU9 4tMiN4xfC4TRbN3r53IKA1TXpzdeB02ciyoJVqAvSj92xeKJ3nn0s4L3Dbv6vaz0lbRF jkfa9HcS7KsvI+t8SANopO/CFfWyRBhDnkW0z3NPESmIuLZJniWPkNHoG6s9r/4ZdPA/ +v8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727369671; x=1727974471; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/Me01IlmWn5ZXb/VKWHt5wAOgVcX8vvbwAiPhcFzwz0=; b=WZi/k4s2X0UzMaD+h//rHeLvIT2KpGnFzYHz8pvmgK9QRHFWdNjgU8ywO6EoBFSjt7 4i/FLMMBAO6+kZfTb5MtijkHLyDZX9AbC1PNN9kZUM1yGKitpfHIRUlCDXw6yManPaeu YcqTlULz+6TwuxInoT3WcxF1XLdl6eN1WSkPMUc8NncJLfRD2yM1u2/kLW0Dq13Iz8Fo M+A+wEFmH8R/JOGuVYuEYIokQsqIDmaO0mvAg9ZjhD5dXsSjYZS7qwHjIN0dA5UtpicK UoEC8Zer2b9IopepLB3/lKKDHCenNO9NX6oaSm3c20mpljrirtvACTo0ixaWGJqF5Kk8 IQbQ== X-Gm-Message-State: AOJu0YwTn1IuSSvi8VGq/zL5X+805JrWXYf0vIJRV2SgzeAYbPQA0LzY 7on5aYZ7aXNvd/VbsJQ/CnZRXdBDc9WM0oeIGw2LvUYgUnJMiNvook+xlQ== X-Google-Smtp-Source: AGHT+IENxhW8Z6GwOSQEBYUaU5Ssy8Dm29D6OtuPMVh8LwjaxL6cuq1Jq2ETxT/5xAHcm5tHy+QvDA== X-Received: by 2002:a17:907:60cc:b0:a86:7a84:abb7 with SMTP id a640c23a62f3a-a93c4915538mr16959066b.20.1727369671152; Thu, 26 Sep 2024 09:54:31 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini Subject: [PATCH v4 2/6] xen: define ACPI and DT device info sections macros Date: Thu, 26 Sep 2024 18:54:21 +0200 Message-ID: X-Mailer: git-send-email 2.46.1 In-Reply-To: References: MIME-Version: 1.0 Introduce macros to define device information sections based on the configuration of ACPI or device tree support. These sections are required for common code of device initialization and getting an information about a device. These macros are expected to be used across different architectures (Arm, PPC, RISC-V), so they are moved to the common xen/xen.lds.h, based on their original definition in Arm. Signed-off-by: Oleksii Kurochko Acked-by: Jan Beulich --- Changes in V4: - rename ADEV_INFO to ACPI_DEV_INFO. - refactor ADEV_INFO and DT_DEV_INFO: add alignment and DECL_SECTION. --- Changes in V3: - drop SEC* at the end of ACPI AND DT device info section mancros. - refactor ADEV_INFO and DT_DEV_INFO macros. --- xen/include/xen/xen.lds.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/xen/include/xen/xen.lds.h b/xen/include/xen/xen.lds.h index 8135732756..cec86d0781 100644 --- a/xen/include/xen/xen.lds.h +++ b/xen/include/xen/xen.lds.h @@ -120,6 +120,14 @@ /* List of constructs other than *_SECTIONS in alphabetical order. */ +#define ACPI_DEV_INFO(secname) \ + . = ALIGN(POINTER_ALIGN); \ + DECL_SECTION(secname) { \ + _asdevice = .; \ + *(secname) \ + _aedevice = .; \ + } :text + #define BUGFRAMES \ __start_bug_frames_0 = .; \ *(.bug_frames.0) \ @@ -137,6 +145,14 @@ *(.bug_frames.3) \ __stop_bug_frames_3 = .; +#define DT_DEV_INFO(secname) \ + . = ALIGN(POINTER_ALIGN); \ + DECL_SECTION(secname) { \ + _sdevice = .; \ + *(secname) \ + _edevice = .; \ + } :text + #ifdef CONFIG_HYPFS #define HYPFS_PARAM \ . = ALIGN(POINTER_ALIGN); \ From patchwork Thu Sep 26 16:54:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13813530 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 877D9CDE027 for ; Thu, 26 Sep 2024 16:54:59 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.805754.1216980 (Exim 4.92) (envelope-from ) id 1strlD-0002DC-R5; Thu, 26 Sep 2024 16:54:35 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 805754.1216980; Thu, 26 Sep 2024 16:54:35 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1strlD-0002Cj-Kl; Thu, 26 Sep 2024 16:54:35 +0000 Received: by outflank-mailman (input) for mailman id 805754; Thu, 26 Sep 2024 16:54:34 +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 1strlC-0001ST-RG for xen-devel@lists.xenproject.org; Thu, 26 Sep 2024 16:54:34 +0000 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [2a00:1450:4864:20::134]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 012ea90a-7c28-11ef-99a2-01e77a169b0f; Thu, 26 Sep 2024 18:54:33 +0200 (CEST) Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-5365aa568ceso1492701e87.0 for ; Thu, 26 Sep 2024 09:54:33 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a93c2979e00sm16981566b.158.2024.09.26.09.54.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2024 09:54:31 -0700 (PDT) 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: 012ea90a-7c28-11ef-99a2-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727369672; x=1727974472; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JQIIQr4UWTptg8Aejtk0NghHPcRH7JuS3+zpBsqfsg8=; b=eCkky41bTqXf5MEQzg89wdxfmXePTFu7VXNHdA6Ml0vlBFh3fDoK0pdqSdG9DJxM8t 5pzozVqNzxoVhV7a2Zj/Wo1KTPhYanm4Ix+4vJqAmrAfaF9K4mgn8Ymj4z4w09U8pxjq XMu6RKl7vwX5V/bScybRH8YuwAAT/dtWik0Pf3maQTFhQrsaAdaFg+b4uhsghVE6xeVX AqKThGXJ8B71C4hnKVXpQi5LusUefKPZ2BBnvQun1vImG2a+yA7Q6EjKdtKCIhI+t61X vDIbKtZkXWnZYajknOpetr02gepnKuYLZkAcBABPPliTY0fXl1GfjVNnAA2W7WamabUg WQog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727369672; x=1727974472; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JQIIQr4UWTptg8Aejtk0NghHPcRH7JuS3+zpBsqfsg8=; b=WK6XjAyK5TwnUiJ/wsZihS/sp/Skf5oronQFffM7SGy4UU1yzkG63BvL+LxgCHMGMX 5aY0eNoG0yvSkSNDfsrqcCFd8KDipCeBwknNMYsw6K4GY1sbeSVeNHMRWyxr3SLKiSHi t5/nS0IH/WGFyRxpk5U3vAAL5E/hGw32uWZ2ZYK6PxBXq+C39O5j9xtDnAn9JA/s+uXd xcodyITbdQ1ANjLlEon75ydUnHB9CJE+ltRGd1HfsBfdyPI1K7UWHwIzQ4EiGN5X0XY/ Lm1pxDuSm+CclRVJNjrOvUk5zvNXrkjyOS/fvbvPVC3LEXU6W2kDqlqRcoWbrIuyqGl2 6BxA== X-Gm-Message-State: AOJu0YykzxCjczZdteG7TGGjz8gqoBg39QSmVw2GMu8Kd0PLHdHBpITG qmabTuJlIPyND9UtoKvjCNIIEaCy+62j8k/5mGQuDHaAuHuJjA+9mAWQPw== X-Google-Smtp-Source: AGHT+IFbuc19mZ6WQ7B3+O6sfjgA9vkYIGDrEAgw1pzkytyRcgldlpExwOPYD6WPVeHFo4Ln1Dauxg== X-Received: by 2002:a05:6512:114c:b0:52e:fa5f:b6a7 with SMTP id 2adb3069b0e04-5389fc3bd7cmr240506e87.13.1727369672200; Thu, 26 Sep 2024 09:54:32 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk Subject: [PATCH v4 3/6] xen/arm: use {DT,ACPI}_DEV_INFO for device info sections Date: Thu, 26 Sep 2024 18:54:22 +0200 Message-ID: X-Mailer: git-send-email 2.46.1 In-Reply-To: References: MIME-Version: 1.0 Refactor arm/xen.lds.S by replacing the inline definitions for device info sections with the newly introduced {DT,ACPI}_DEV_INFO macros from xen/xen.lds.h. Signed-off-by: Oleksii Kurochko Reviewed-by: Michal Orzel --- Changes in V4: - use newly refactored ACPI_DEV_INFO and DT_DEV_INFO --- Changes in V3: - use refactored ADEV_INFO and DT_DEV_INFO macros. --- xen/arch/arm/xen.lds.S | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S index 0987052f1a..3b7b677197 100644 --- a/xen/arch/arm/xen.lds.S +++ b/xen/arch/arm/xen.lds.S @@ -4,6 +4,8 @@ #include #include + +#define SIMPLE_DECL_SECTION #include #include #undef ENTRY @@ -124,20 +126,10 @@ SECTIONS _eplatform = .; } :text - . = ALIGN(8); - .dev.info : { - _sdevice = .; - *(.dev.info) - _edevice = .; - } :text + DT_DEV_INFO(.dev.info) #ifdef CONFIG_ACPI - . = ALIGN(8); - .adev.info : { - _asdevice = .; - *(.adev.info) - _aedevice = .; - } :text + ACPI_DEV_INFO(adev.info) #endif . = ALIGN(8); From patchwork Thu Sep 26 16:54:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13813531 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 A8F94CDE026 for ; Thu, 26 Sep 2024 16:54:59 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.805753.1216973 (Exim 4.92) (envelope-from ) id 1strlD-00029m-FO; Thu, 26 Sep 2024 16:54:35 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 805753.1216973; Thu, 26 Sep 2024 16:54:35 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1strlD-00029f-Cw; Thu, 26 Sep 2024 16:54:35 +0000 Received: by outflank-mailman (input) for mailman id 805753; Thu, 26 Sep 2024 16:54:34 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1strlC-0001SU-8l for xen-devel@lists.xenproject.org; Thu, 26 Sep 2024 16:54:34 +0000 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [2a00:1450:4864:20::62a]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 0177dac0-7c28-11ef-a0ba-8be0dac302b0; Thu, 26 Sep 2024 18:54:33 +0200 (CEST) Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-a8d56155f51so144818666b.2 for ; Thu, 26 Sep 2024 09:54:33 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a93c2979e00sm16981566b.158.2024.09.26.09.54.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2024 09:54:32 -0700 (PDT) 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: 0177dac0-7c28-11ef-a0ba-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727369673; x=1727974473; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/8YXz3xJwYM5w/OK9x2qBPOxlg0qWTOKPTFvzRr9UJQ=; b=c3U7QNUYwulNiwGULAsdw62j+14V2Kk7H1VOQmmT/qefxVfykQzFysm+l+QQGO2Vak OHkD/UrvnxTJ5PYU8mmzOph2YTw2b3EBehhaX1vDyMJ807+Wrl1ER1GAN8RuyXzukyGX MSPSf0jlZu/zF+bA5JzNXB65mOwoNkc5TNasBQ9H12ITXq3uWfVikM7oNfpZ0lL2kCTW QQ23L1xjqpIB4Vu6IakeOQeE0B/uRWcSGhupxYpXLGzaWWGBzRPFMFOliMNNcfYPzT2a oXAJrrp/iU+crY3/CEovw8WFWM3DWu30xnLaQ9ejNrujxmRRGiWtMWfnyZBYN5JRaJR3 8A0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727369673; x=1727974473; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/8YXz3xJwYM5w/OK9x2qBPOxlg0qWTOKPTFvzRr9UJQ=; b=TtSYbOpATz9FYBnEyFpoMOtzqVwQkRnz47nSxdKGvgcDG8RMdy3cURaP9xyQHdP0T7 nGcYs2WzG7KLLmHrcRTuRiIL4ITCN4dYR38IwJtIC3D1VD3SkO3kgViPSqk2/u9Wq6cE 6uLE8ajurjChkyZgGMqQyj/tAly6URJuLo/n7LgQT8ec3M2Jpd9uwylCyGgGexFB0OeZ kopy3ddYUuDJj7fn6Bqp9XM1x5fZQZQNnQDka/XsqWUL+m9GPc+K1CsJa5kVW4iv/pzF w+cQJquMbGgImLMJ9nbekdnlVZXjIrbZKnojkifUnWK/IOq706qnzrIK9SbM5DXUOfw8 LZkQ== X-Gm-Message-State: AOJu0YxECusFIXcrdKkJoM399bOGwPDx+Dw6x9rSjgL5UPOLRoVimtZa CQBXaJtiRhXWSsmZ63J2LsOSH8OytIJ8MATS/sRNNRFlokf6RZOY4uHBnA== X-Google-Smtp-Source: AGHT+IG71GkEna8nM0+z+CEjm6upP/tl2YVZJMZaqlC6YXrPp3VrSAb4t7N9sXbJcbYv1Npz0OEzHA== X-Received: by 2002:a17:906:7946:b0:a8a:7897:c043 with SMTP id a640c23a62f3a-a93c4ae12c7mr11871366b.43.1727369672851; Thu, 26 Sep 2024 09:54:32 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Shawn Anastasio Subject: [PATCH v4 4/6] xen/ppc: add section for device information in linker script Date: Thu, 26 Sep 2024 18:54:23 +0200 Message-ID: X-Mailer: git-send-email 2.46.1 In-Reply-To: References: MIME-Version: 1.0 Introduce a new `.dev.info` section in the PPC linker script to handle device-specific information. This section is required by common code (common/device.c: device_init(), device_get_class() ). This section is aligned to `POINTER_ALIGN`, with `_sdevice` and `_edevice` marking the start and end of the section, respectively. Signed-off-by: Oleksii Kurochko Acked-by: Shawn Anastasio --- Changes in V4: - use newly refactored DT_DEV_INFO --- Changes in V3: - use refactored DT_DEV_INFO macros. - Add Acked-by: Shawn Anastasio --- xen/arch/ppc/xen.lds.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/arch/ppc/xen.lds.S b/xen/arch/ppc/xen.lds.S index 0c4b94814b..9222213484 100644 --- a/xen/arch/ppc/xen.lds.S +++ b/xen/arch/ppc/xen.lds.S @@ -94,6 +94,8 @@ SECTIONS CONSTRUCTORS } :text + DT_DEV_INFO(.dev.info) /* Devicetree based device info */ + . = ALIGN(PAGE_SIZE); /* Init code and data */ __init_begin = .; DECL_SECTION(.init.text) { From patchwork Thu Sep 26 16:54:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13813533 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 B15E6CDE024 for ; Thu, 26 Sep 2024 16:55:02 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.805755.1216994 (Exim 4.92) (envelope-from ) id 1strlG-0002gP-2r; Thu, 26 Sep 2024 16:54:38 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 805755.1216994; Thu, 26 Sep 2024 16:54:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1strlF-0002gD-Vx; Thu, 26 Sep 2024 16:54:37 +0000 Received: by outflank-mailman (input) for mailman id 805755; Thu, 26 Sep 2024 16:54:36 +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 1strlE-0001ST-Kl for xen-devel@lists.xenproject.org; Thu, 26 Sep 2024 16:54:36 +0000 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [2a00:1450:4864:20::333]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 02304502-7c28-11ef-99a2-01e77a169b0f; Thu, 26 Sep 2024 18:54:35 +0200 (CEST) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-42cb57f8b41so15192465e9.0 for ; Thu, 26 Sep 2024 09:54:35 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a93c2979e00sm16981566b.158.2024.09.26.09.54.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2024 09:54:33 -0700 (PDT) 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: 02304502-7c28-11ef-99a2-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727369674; x=1727974474; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QOoo4EKtPRFIE8HIHhg2CdM3Nn/tt0xPaUiavjCjh5s=; b=Fa6S8BXqSUyfiY/XCI3gZQQwnRCEgOkRyBT+CEVlSn56AaTORXehfje1pi7Z9gpKFp hEZjYJighwPeSGakXPZWq08J4AFU/V7VUMe04Oab8qEvABzEEe4mmdJMeT1qTMiZcKA9 SAnksmFetKQIPvRwDACG8lC7rl5NyA5PjONeYuHvohPvGd2WjPMEF+5DP9sHBCvaCM8+ b04DrfOPZmoLJAqp+c1+fX1YcCZoJnVDK582MS9E8Bn9fa4EEPhbX02zOjACJrtWtAS3 qf2yK7DS7CFCVqi7btN4QFR8tuNjcUOExAWcGjtYNB8hv+Uv1sZIf3TnM0/rLzV6m8aV xh2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727369674; x=1727974474; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QOoo4EKtPRFIE8HIHhg2CdM3Nn/tt0xPaUiavjCjh5s=; b=v7T8snq12OMlnnQwyQ07GgfS1EHBM2rWaPImH3mnHzS+s/G4X2l2h/IPaKG+bWcWP9 jENvrorIOXp9NUXpAGMz4mFsraewt8PfrFshZbcn7rw6WMsgDFI2s01GVeAw8EGk46ao W5NN2Ep5O9CLDaNANP2Jm/va0vcI8COpmrFAq+gOHqe0ZqOpbNrLf0tTgBgGDsSrLMkW njmXhlyF3qmgrwPNKsxWMickLwDlQhDFmqAt+uqtgJguJaj/FYXCkagNUDpXs673k3yZ hTNL26dWTkeBIVqm/PAoP/99IsJlsXUniGsHBWQVKmQwypVfgYpqMPks1yBp8gvb4jCI GcvA== X-Gm-Message-State: AOJu0Yz0vgcMdOp0FM41Mr22/NEDSUn0e5JQgKPZNXvRtBv1+AyAngGe eFDy0HECE5ATG3RIHUL5r7XGIrRQYo7cgJfZOOUp9xU7Si6vfRGGw3/Psw== X-Google-Smtp-Source: AGHT+IHVFydoImr+LV17up08n5HYKJ9djPYqPRg6EgwtOFy6HXWX75X6Go6ebuOZdOGAUlNLyf7/Vw== X-Received: by 2002:a05:6000:b8b:b0:374:c658:706e with SMTP id ffacd0b85a97d-37cd5b04975mr165768f8f.39.1727369673981; Thu, 26 Sep 2024 09:54:33 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Alistair Francis , Bob Eshleman , Connor Davis , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini Subject: [PATCH v4 5/6] xen/riscv: add section for device information in linker script Date: Thu, 26 Sep 2024 18:54:24 +0200 Message-ID: X-Mailer: git-send-email 2.46.1 In-Reply-To: References: MIME-Version: 1.0 Introduce a new `.dev.info` section in the RISC-V linker script to handle device-specific information. This section is required by common code (common/device.c: device_init(), device_get_class() ). This section is aligned to `POINTER_ALIGN`, with `_sdevice` and `_edevice` marking the start and end of the section, respectively. Signed-off-by: Oleksii Kurochko Acked-by: Jan Beulich --- Changes in V4: - use newly refactored DT_DEV_INFO --- Changes in V3: - use refactored DT_DEV_INFO macros. --- xen/arch/riscv/xen.lds.S | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xen/arch/riscv/xen.lds.S b/xen/arch/riscv/xen.lds.S index 871b47a235..c1400e0613 100644 --- a/xen/arch/riscv/xen.lds.S +++ b/xen/arch/riscv/xen.lds.S @@ -1,4 +1,6 @@ #include + +#define SIMPLE_DECL_SECTION #include OUTPUT_ARCH(riscv) @@ -91,6 +93,8 @@ SECTIONS CONSTRUCTORS } :text + DT_DEV_INFO(.dev.info) /* Devicetree based device info */ + . = ALIGN(PAGE_SIZE); /* Init code and data */ __init_begin = .; .init.text : { From patchwork Thu Sep 26 16:54:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13813527 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 47523CDE025 for ; Thu, 26 Sep 2024 16:54:55 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.805756.1217001 (Exim 4.92) (envelope-from ) id 1strlG-0002kW-Hc; Thu, 26 Sep 2024 16:54:38 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 805756.1217001; Thu, 26 Sep 2024 16:54:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1strlG-0002ji-9p; Thu, 26 Sep 2024 16:54:38 +0000 Received: by outflank-mailman (input) for mailman id 805756; Thu, 26 Sep 2024 16:54:37 +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 1strlF-0001ST-RJ for xen-devel@lists.xenproject.org; Thu, 26 Sep 2024 16:54:37 +0000 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [2a00:1450:4864:20::635]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 02d6b89c-7c28-11ef-99a2-01e77a169b0f; Thu, 26 Sep 2024 18:54:36 +0200 (CEST) Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-a8a7cdfdd80so157895166b.0 for ; Thu, 26 Sep 2024 09:54:36 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a93c2979e00sm16981566b.158.2024.09.26.09.54.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2024 09:54:34 -0700 (PDT) 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: 02d6b89c-7c28-11ef-99a2-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727369675; x=1727974475; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Gg6k+CK/Tj9ZK3VXKpaB9MObc8AdN5CBF1fDnVMAt5E=; b=EmPxeBXxFFYCQtgjJjNzNHG1mNsffOJGA9UPTAgxFIrGGtux/6yQ6Fie8WsElsk8yN NEU1rVheYrnlrdBjj3aBAZIbXsQrSadZ/fx1SMrN86hv4wf1F3ACF2A5zWykm1icUd1Q 9AqWjV+/836a+OxXCYBE2DNLNsFxjcEdvm+2ebCbbQEMRNitb6y3UTsunNHwVbLdxhes kFgQsuyHZqGVaSmpbfvp+Ea+OHqsq4imeAJ+QpQ/NFFRJD9aEjX+C+0M+Mz8GE7HdMOu YBbQ4jjZ4dshxDnvO52oYy1G8NefSfCGcyk/83bR5d+UOvJTWLjqYF4xxrydXyX4ffJw 4e+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727369675; x=1727974475; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Gg6k+CK/Tj9ZK3VXKpaB9MObc8AdN5CBF1fDnVMAt5E=; b=JTAFHqB4Cqon4/WR+SQrY+fEBSP5BnByCxJThGaIguzhH51XCaNkW6mBx7okiiJqdW KLhQETiMTnqYs8aZ3dCByCqBtCGaLXjj5nJvrMMfYTXIgHdWTBuSEyP82gX5GESii2HD lvdVEVS9xJsWFHbWcUGLsTmqf+Y1qOIuWWLR7K841YDcCVgKNZCJ6WQRxS0u/WTn45Mu RgfJtX2D5nZwQB/LH0oNM2/NXx53W7aZZSvh7VbN0cLxh22bU/M155HP7JADhn7V2kue 9dotkx6+X70v8KGaWwSRTiQlfTZCtTHqxhuAVrZqydqlRO1uvJPv56Q0oVHnTHlLFZIV IDiQ== X-Gm-Message-State: AOJu0YxnyJq3M8q7Kn08yCArrcwzzrMvNWbvY7yTwuxKZu3riSiOCjNI dLjqgIA6njjnFrUaA/jF7GZTTEIRztC7frJxTQwp2IItC9cfrXuehaIrOQ== X-Google-Smtp-Source: AGHT+IHKESgS4TqIm1v+f2kHFyIrUJmECr9U8XK/Heg84H5Dtk0cX1S2luBxYtWe4+iimPY3aTafDw== X-Received: by 2002:a17:906:794f:b0:a80:f840:9004 with SMTP id a640c23a62f3a-a93c48eea6emr16958866b.12.1727369675068; Thu, 26 Sep 2024 09:54:35 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Andrew Cooper , Jan Beulich Subject: [PATCH v4 6/6] xen/common: move device initialization code to common code Date: Thu, 26 Sep 2024 18:54:25 +0200 Message-ID: X-Mailer: git-send-email 2.46.1 In-Reply-To: References: MIME-Version: 1.0 Remove the device initialization code from `xen/arch/arm/device.c` and move it to the common code to avoid duplication and make it accessible for both ARM and other architectures. device_get_class(), device_init(), _sdevice[] and _edevice[] are wrapped by "#ifdef CONFIG_HAS_DEVICE_TREE" for the case if an arch doesn't support device tree. Remove unnecessary inclusions of and from `xen/arch/arm/device.c` as no code in the file relies on these headers. Fix the inclusion order by moving after headers to resolve a compilation error: ./include/public/xen.h:968:35: error: unknown type name 'uint64_t' 968 | __DEFINE_XEN_GUEST_HANDLE(uint64, uint64_t); | ^~~~~~~~ ./include/public/arch-arm.h:191:21: note: in definition of macro '___DEFINE_XEN_GUEST_HANDLE' 191 | typedef union { type *p; uint64_aligned_t q; } \ | ^~~~ ./include/public/xen.h:968:1: note: in expansion of macro '__DEFINE_XEN_GUEST_HANDLE' 968 | __DEFINE_XEN_GUEST_HANDLE(uint64, uint64_t); because includes , which in turn includes "xen.h", which requires to be processed correctly. Additionally, add to `device.c` as functions from this header are used within the file. Signed-off-by: Oleksii Kurochko Reviewed-by: Jan Beulich Reviewed-by: Michal Orzel --- Changes in V4: - add Reviewed-by: Jan Beulich --- Changes in V3: - drop DEVICE_INIT config. - update the commit message. --- xen/arch/arm/device.c | 71 ++----------------------------------- xen/common/Makefile | 2 ++ xen/common/device.c | 82 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 69 deletions(-) create mode 100644 xen/common/device.c diff --git a/xen/arch/arm/device.c b/xen/arch/arm/device.c index 3e02cff008..5610cddcba 100644 --- a/xen/arch/arm/device.c +++ b/xen/arch/arm/device.c @@ -8,79 +8,12 @@ * Copyright (C) 2013 Linaro Limited. */ -#include -#include +#include #include -#include #include #include -extern const struct device_desc _sdevice[], _edevice[]; - -#ifdef CONFIG_ACPI -extern const struct acpi_device_desc _asdevice[], _aedevice[]; -#endif - -int __init device_init(struct dt_device_node *dev, enum device_class class, - const void *data) -{ - const struct device_desc *desc; - - ASSERT(dev != NULL); - - if ( !dt_device_is_available(dev) || dt_device_for_passthrough(dev) ) - return -ENODEV; - - for ( desc = _sdevice; desc != _edevice; desc++ ) - { - if ( desc->class != class ) - continue; - - if ( dt_match_node(desc->dt_match, dev) ) - { - ASSERT(desc->init != NULL); - - return desc->init(dev, data); - } - - } - - return -EBADF; -} - -#ifdef CONFIG_ACPI -int __init acpi_device_init(enum device_class class, const void *data, int class_type) -{ - const struct acpi_device_desc *desc; - - for ( desc = _asdevice; desc != _aedevice; desc++ ) - { - if ( ( desc->class != class ) || ( desc->class_type != class_type ) ) - continue; - - ASSERT(desc->init != NULL); - - return desc->init(data); - } - - return -EBADF; -} -#endif - -enum device_class device_get_class(const struct dt_device_node *dev) -{ - const struct device_desc *desc; - - ASSERT(dev != NULL); - - for ( desc = _sdevice; desc != _edevice; desc++ ) - { - if ( dt_match_node(desc->dt_match, dev) ) - return desc->class; - } - - return DEVICE_UNKNOWN; -} +#include int map_irq_to_domain(struct domain *d, unsigned int irq, bool need_mapping, const char *devname) diff --git a/xen/common/Makefile b/xen/common/Makefile index fc52e0857d..9d962069f7 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -6,6 +6,8 @@ obj-$(CONFIG_HYPFS_CONFIG) += config_data.o obj-$(CONFIG_CORE_PARKING) += core_parking.o obj-y += cpu.o obj-$(CONFIG_DEBUG_TRACE) += debugtrace.o +obj-$(CONFIG_HAS_DEVICE_TREE) += device.o +obj-$(filter-out $(CONFIG_X86),$(CONFIG_ACPI)) += device.o obj-$(CONFIG_HAS_DEVICE_TREE) += device-tree/ obj-$(CONFIG_IOREQ_SERVER) += dm.o obj-y += domain.o diff --git a/xen/common/device.c b/xen/common/device.c new file mode 100644 index 0000000000..33e0d58f2f --- /dev/null +++ b/xen/common/device.c @@ -0,0 +1,82 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Based on the code from: + * xen/arch/arm/device.c + */ + +#include +#include +#include +#include + +#include + +#ifdef CONFIG_HAS_DEVICE_TREE + +extern const struct device_desc _sdevice[], _edevice[]; + +int __init device_init(struct dt_device_node *dev, enum device_class class, + const void *data) +{ + const struct device_desc *desc; + + ASSERT(dev != NULL); + + if ( !dt_device_is_available(dev) || dt_device_for_passthrough(dev) ) + return -ENODEV; + + for ( desc = _sdevice; desc != _edevice; desc++ ) + { + if ( desc->class != class ) + continue; + + if ( dt_match_node(desc->dt_match, dev) ) + { + ASSERT(desc->init != NULL); + + return desc->init(dev, data); + } + } + + return -EBADF; +} + +enum device_class device_get_class(const struct dt_device_node *dev) +{ + const struct device_desc *desc; + + ASSERT(dev != NULL); + + for ( desc = _sdevice; desc != _edevice; desc++ ) + { + if ( dt_match_node(desc->dt_match, dev) ) + return desc->class; + } + + return DEVICE_UNKNOWN; +} + +#endif + +#ifdef CONFIG_ACPI + +extern const struct acpi_device_desc _asdevice[], _aedevice[]; + +int __init acpi_device_init(enum device_class class, const void *data, int class_type) +{ + const struct acpi_device_desc *desc; + + for ( desc = _asdevice; desc != _aedevice; desc++ ) + { + if ( ( desc->class != class ) || ( desc->class_type != class_type ) ) + continue; + + ASSERT(desc->init != NULL); + + return desc->init(data); + } + + return -EBADF; +} + +#endif