From patchwork Tue Sep 17 16:15:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13806311 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 B6ED8CAC592 for ; Tue, 17 Sep 2024 16:16:20 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.800025.1209953 (Exim 4.92) (envelope-from ) id 1sqarz-0001d9-8Z; Tue, 17 Sep 2024 16:16:03 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 800025.1209953; Tue, 17 Sep 2024 16:16:03 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sqarz-0001cd-0R; Tue, 17 Sep 2024 16:16:03 +0000 Received: by outflank-mailman (input) for mailman id 800025; Tue, 17 Sep 2024 16:16:02 +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 1sqary-0001Pu-2c for xen-devel@lists.xenproject.org; Tue, 17 Sep 2024 16:16:02 +0000 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [2a00:1450:4864:20::12c]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 201ab6d0-7510-11ef-99a2-01e77a169b0f; Tue, 17 Sep 2024 18:15:59 +0200 (CEST) Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-5365b71a6bdso5039166e87.2 for ; Tue, 17 Sep 2024 09:15:59 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5368704da27sm1234574e87.83.2024.09.17.09.15.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Sep 2024 09:15:58 -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: 201ab6d0-7510-11ef-99a2-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726589758; x=1727194558; 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=Lm/1+4e3ZJBgxoi/GYAc1NQQlIkPFwoz0AdoMqlIYho=; b=ikTT+2T5TMMcZJ1npP7htDirFoV1JpSsW7EcIGkBtF0Ujr6mvmvPm7/IsQtA2iYN9E t/0kyEVMnuP3vb8FnVQetWihvFTQ+UBcKHlPaalzh6pYqJ0oMS/tnGoynfpd9xPbE+b2 Yiz4jClcGcQynVERWY0hmQ/3qKhIFl3bCG1FTLFcWl6QzaxuccX2UOPU+5ajhav2BmX3 ajDh3AqhqAcqoKlWVIaOfbPGPwuhqRB6Q3LPNB1QHND3npLVVB9GI0USlOJtpsseaKGL W7uuxioVemUK6XGQsEL9PKeDSF8ECTEYx3EXgO9zgcQwk+DA99fupr3Ec0j4ZmU0/nLS 6Fiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726589758; x=1727194558; 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=Lm/1+4e3ZJBgxoi/GYAc1NQQlIkPFwoz0AdoMqlIYho=; b=GEVYiFsUgn/axBeq32W/g0vTevhTjzxaxXPg6IMrZHsnm7CVGOhmTPL5EA7sAHKomr Yfmx9B+DONU7NLiciu6DH1/VutkgSLvjhSLVIRxHKYpmXG2ZpP6vVM3EO010sI/fnM45 KPnjx/4r/5iwCCadDuwPEAAWp0S8lXzLZELkGlXKm1tJRgALLmFb19uvETQRg9ZZWBQJ M9AdD+zJ7EKlmKSurSCE34mk7pLnb+SKVvN7TrBUeeMVz+gymscSd5yVlvrEsZexnTgK 6p9gQUGKnQ3DCGH+kwr7DRtaukv8IPE4z49tVp4+8vKcip2+1dcAQm9fqUTEsWHjacKD GyFg== X-Gm-Message-State: AOJu0YyF+t/bpk5zeL/78lpzUiLjC+w65BHbPubjaSIVyYjWwWQH6p2X DEEFkfVgcFTunKWtOlcoReg+y9Qha7tKgPbDXFnPQub4wxM2JJhUONWx5g== X-Google-Smtp-Source: AGHT+IFMX0RwsEJNJ8FstnMCi8De9M+shLAOZ9A5ig6cERy69nFxUWib7vyBYZ1dEfGwKgsAyGsSig== X-Received: by 2002:a05:6512:2c06:b0:536:88d0:4220 with SMTP id 2adb3069b0e04-53688d04697mr4048387e87.34.1726589758372; Tue, 17 Sep 2024 09:15:58 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini Subject: [PATCH v2 1/5] xen: define ACPI and DT device info sections macros Date: Tue, 17 Sep 2024 18:15:51 +0200 Message-ID: <3049dd691f79c688751abaae63c0ccdc36680fbb.1726579819.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 Introduce conditional 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 --- Changes in v2: - New patch. --- xen/include/xen/xen.lds.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/xen/include/xen/xen.lds.h b/xen/include/xen/xen.lds.h index a17810bb28..aa7301139d 100644 --- a/xen/include/xen/xen.lds.h +++ b/xen/include/xen/xen.lds.h @@ -114,6 +114,21 @@ /* List of constructs other than *_SECTIONS in alphabetical order. */ +#define USE_DECL_SECTION(x) DECL_SECTION(x) + +#define NOUSE_DECL_SECTION(x) x : + +#ifdef CONFIG_ACPI +#define ACPI_DEV_INFO_SEC(secname, DECL_SECTION_MACROS_NAME) \ + DECL_SECTION_MACROS_NAME(secname) { \ + _asdevice = .; \ + *(secname) \ + _aedevice = .; \ + } :text +#else +#define ACPI_DEV_INFO_SEC(secname, DECL_SECTION_MACROS_NAME) +#endif /* CONFIG_ACPI */ + #define BUGFRAMES \ __start_bug_frames_0 = .; \ *(.bug_frames.0) \ @@ -131,6 +146,17 @@ *(.bug_frames.3) \ __stop_bug_frames_3 = .; +#ifdef CONFIG_HAS_DEVICE_TREE +#define DT_DEV_INFO_SEC(secname, DECL_SECTION_MACROS_NAME) \ + DECL_SECTION_MACROS_NAME(secname) { \ + _sdevice = .; \ + *(secname) \ + _edevice = .; \ + } :text +#else +#define DECL_DT_DEV_INFO_SEC(secname, DECL_SECTION_MACROS_NAME) +#endif /* CONFIG_HAS_DEVICE_TREE */ + #ifdef CONFIG_HYPFS #define HYPFS_PARAM \ . = ALIGN(POINTER_ALIGN); \ From patchwork Tue Sep 17 16:15:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13806307 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 4D9C4CAC587 for ; Tue, 17 Sep 2024 16:16:20 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.800026.1209966 (Exim 4.92) (envelope-from ) id 1sqas0-00024V-Cq; Tue, 17 Sep 2024 16:16:04 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 800026.1209966; Tue, 17 Sep 2024 16:16:04 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sqas0-000243-8e; Tue, 17 Sep 2024 16:16:04 +0000 Received: by outflank-mailman (input) for mailman id 800026; Tue, 17 Sep 2024 16:16:02 +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 1sqary-0001Pu-9U for xen-devel@lists.xenproject.org; Tue, 17 Sep 2024 16:16:02 +0000 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [2a00:1450:4864:20::12e]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 20b7a653-7510-11ef-99a2-01e77a169b0f; Tue, 17 Sep 2024 18:16:00 +0200 (CEST) Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-5365d3f9d34so5144265e87.3 for ; Tue, 17 Sep 2024 09:16:00 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5368704da27sm1234574e87.83.2024.09.17.09.15.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Sep 2024 09:15:58 -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: 20b7a653-7510-11ef-99a2-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726589759; x=1727194559; 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=AOR0qHhttHkehBXUQHlKkxROPlwujDM7oNt3V6O5xi0=; b=Q0mnpRLIPkJrBplcjbJM78M6lf1t4mqS3hgeEWDaadqHQupo3fnCY5wx41V37MT+oQ IXvqWvv8rhhUjLswJAnbWfplh7YeL/VXUvyKgpahFl/2/J8FSUTnA4zxu/Tl8X/spgg4 xnOtbbnhKfCKvHFGKXuDhgNb6QrWgNmeNi0FTTHu7LpXWUeAD95UNbG6Esa4pbNV4wjm 3wIo+NTqsgZpMAjyABC8nCV5vAzoGRpdu3pRfWmC0FCvLfzprQnIFWLaNZfj4aBnWZLm XlO7FdWRw78Gnx04HaNoiz2JxuricQQiEKZa7Ld9DqeSh0CNrMBasElYzyeBLHpi83Kp sYIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726589759; x=1727194559; 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=AOR0qHhttHkehBXUQHlKkxROPlwujDM7oNt3V6O5xi0=; b=FGUZnrSg4n2NwZh2+fe/48kiK5T1vffM5JwVxxrzmh7fuDxKVJUjbC3aZmdkz6xpkQ WtSMlet5TqNRL1v4Ujlxnw1bR9A0HE10tClu4bVfvy+1o22dT10il51OHsNJjCG01vZk pNVAbCWuVeFyQr8lqBD2DHi8Us81G3SftC7kz3jBQkDk2VJ/h8KkCFe0jL4bJfU5V7l5 hnvAcw2Jdnvyw1ZUuO6W+Rdgh+1qwgMtmv75x/AdExb70YwBDwpYamjPyodewvYu3GIy ffjYcQ86li6bs5Cc8trqXpEjY8eQGAfQshTx/uWu3cKwG24dC2mUOmzywLaUnSRIWm/j Hn0w== X-Gm-Message-State: AOJu0YwjNuyg1bMCaBsmCmxM/v2gVITjh5hKKG0DCzA4WhOUwmsNLZ8B YdH7C1wuOYud0H8bU2Qia1eRbOp+ABHE7tlwDuJUHTT5+Os50tTlZtt7Dg== X-Google-Smtp-Source: AGHT+IGbAPsJS9DuEOO/ZAh3D5ibK1ZkH80MPxeL6eFSY0yxjPSTWmiIo2sjh1r/TrDG02dzb7azYw== X-Received: by 2002:a05:6512:a90:b0:535:3dae:a14b with SMTP id 2adb3069b0e04-5367feba05emr7972209e87.2.1726589759293; Tue, 17 Sep 2024 09:15:59 -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 v2 2/5] xen/arm: use {DT,ACPI}_DEV_INFO for device info sections Date: Tue, 17 Sep 2024 18:15:52 +0200 Message-ID: <19096a1113dc4c76af7f869f095e4d18b8f58375.1726579819.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.46.0 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 --- Changes in V2: - New patch. --- xen/arch/arm/xen.lds.S | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S index bd884664ad..940ff7819a 100644 --- a/xen/arch/arm/xen.lds.S +++ b/xen/arch/arm/xen.lds.S @@ -125,20 +125,10 @@ SECTIONS } :text . = ALIGN(8); - .dev.info : { - _sdevice = .; - *(.dev.info) - _edevice = .; - } :text + DT_DEV_INFO_SEC(.dev.info, NOUSE_DECL_SECTION) -#ifdef CONFIG_ACPI . = ALIGN(8); - .adev.info : { - _asdevice = .; - *(.adev.info) - _aedevice = .; - } :text -#endif + ACPI_DEV_INFO_SEC(.adev.info, NOUSE_DECL_SECTION) . = ALIGN(8); .teemediator.info : { From patchwork Tue Sep 17 16:15:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13806310 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 A1766CAC58F for ; Tue, 17 Sep 2024 16:16:20 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.800024.1209947 (Exim 4.92) (envelope-from ) id 1sqary-0001b7-TR; Tue, 17 Sep 2024 16:16:02 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 800024.1209947; Tue, 17 Sep 2024 16:16:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sqary-0001b0-Q9; Tue, 17 Sep 2024 16:16:02 +0000 Received: by outflank-mailman (input) for mailman id 800024; Tue, 17 Sep 2024 16:16:01 +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 1sqarx-0001Mb-A5 for xen-devel@lists.xenproject.org; Tue, 17 Sep 2024 16:16:01 +0000 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [2a00:1450:4864:20::12f]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 211b3ce0-7510-11ef-a0b7-8be0dac302b0; Tue, 17 Sep 2024 18:16:00 +0200 (CEST) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-5356bb55224so6514197e87.0 for ; Tue, 17 Sep 2024 09:16:00 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5368704da27sm1234574e87.83.2024.09.17.09.15.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Sep 2024 09:15:59 -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: 211b3ce0-7510-11ef-a0b7-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726589760; x=1727194560; 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=d7JSRENPt1Yj1oaX2UiyUImJhaKNtf+xr2GA2sDhSBM=; b=Ynonf12kYcgZWqAu224JqJXaXuMp8wE9a4YH/hbeyuUllYTFFlpuLzXoAuI72UXOk3 Ak2ngsW6Zd5yw2ZtKXRMrAzq8ceomWoHYmUexDGO37NwGThDndFjf8uR1EupS2ZKy/Tq NKcDcPIvw5Wyf8PNWBBEJ6BQcDvn5YLPji5mcVlG9rEGVMb6GzKk480AAv02z2ZBHM1I cQNJy+fjzYytVOWZv1nja3umIReLweMr6p30dNxzu1SKXjoiFHwSWvcwyBJlaHXB8PST wop6gPzGXandmEDbslvyZZRTgLUna28kL+NoYGrvbeK0DyoRFRjxKzh8NC8D/yiTWN6s iFYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726589760; x=1727194560; 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=d7JSRENPt1Yj1oaX2UiyUImJhaKNtf+xr2GA2sDhSBM=; b=vWfNFeY0+F/SC0fFMwZtAaejcS8cnXDzKXFt9uWQAxhbH3cRfMKn1CEX7hI/4gF9w9 QJ1jW6oaVAF0DhMMfIC3ndKEL8OIQGhX+Ypwp3aIsnwtzzyLjoZi47Uu24FpNC6WSpNb 2iECxFYzlKwfzdMPm6Gf4gCpJO78Ulbjxs+0Zl+glyIXi6GXESIaYv5VbkScmyvqMh0D rOVOCGTO849biPFrrAEwbI79D/xwqlYgkFiIHGNcSSr3vvkv6ZlUDloQyZP5LEbG+3S2 LVhDvFEA+gQWGaLDjvl49ebt1E9gpb+HaZx2vqEVpEdHDDPnFjiRpqNJmP0TBywES/lK bwww== X-Gm-Message-State: AOJu0Ywt/0nPeO8oU0+DzR4oR71m6fPL8VBSjfpBQfId2o4ElR1DeNyX gfezcvw7EG5U848FxgEErpCChvvU/8q43lpW5CcWdFMJNcajPmDQCdy6wQ== X-Google-Smtp-Source: AGHT+IHoZKW8br/L6CyzzRGJkmCXaGEild3CLH7s7OKnJnWMGqHmfA5tkYeHi6G281k5ryBSfXBECg== X-Received: by 2002:a05:6512:a8a:b0:52f:159:2dc5 with SMTP id 2adb3069b0e04-53678fe69a7mr12178688e87.42.1726589759866; Tue, 17 Sep 2024 09:15:59 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Shawn Anastasio Subject: [PATCH v2 3/5] xen/ppc: add section for device information in linker script Date: Tue, 17 Sep 2024 18:15:53 +0200 Message-ID: <05eeb53403017fb40c4debf8a33f70438953d6de.1726579819.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.46.0 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 V2: - reuse DT_DEV_INFO_SEC introduced earlier in this patch series with using of DECL_SECTION. --- xen/arch/ppc/xen.lds.S | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xen/arch/ppc/xen.lds.S b/xen/arch/ppc/xen.lds.S index 38cd857187..6e5582c3e4 100644 --- a/xen/arch/ppc/xen.lds.S +++ b/xen/arch/ppc/xen.lds.S @@ -94,6 +94,9 @@ SECTIONS CONSTRUCTORS } :text + . = ALIGN(POINTER_ALIGN); /* Devicetree based device info */ + DT_DEV_INFO_SEC(.dev.info, USE_DECL_SECTION) + . = ALIGN(PAGE_SIZE); /* Init code and data */ __init_begin = .; DECL_SECTION(.init.text) { From patchwork Tue Sep 17 16:15:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13806309 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 B1B84CAC591 for ; Tue, 17 Sep 2024 16:16:20 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.800028.1209979 (Exim 4.92) (envelope-from ) id 1sqas1-0002FS-7V; Tue, 17 Sep 2024 16:16:05 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 800028.1209979; Tue, 17 Sep 2024 16:16:05 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sqas1-0002EH-1u; Tue, 17 Sep 2024 16:16:05 +0000 Received: by outflank-mailman (input) for mailman id 800028; Tue, 17 Sep 2024 16:16:04 +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 1sqarz-0001Pu-VU for xen-devel@lists.xenproject.org; Tue, 17 Sep 2024 16:16:03 +0000 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [2a00:1450:4864:20::130]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 21dea7bf-7510-11ef-99a2-01e77a169b0f; Tue, 17 Sep 2024 18:16:02 +0200 (CEST) Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-5365b71a6bdso5039220e87.2 for ; Tue, 17 Sep 2024 09:16:02 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5368704da27sm1234574e87.83.2024.09.17.09.16.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Sep 2024 09:16:00 -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: 21dea7bf-7510-11ef-99a2-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726589761; x=1727194561; 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=SQTb+FsyN+TP1FUoLarmMCU9MXHOsu5FDxRh9xEM0sk=; b=fY9tOeb0hLtx82/fHUe3AxsTuZJb6KPoZ1c/UR1bmg6tptYWvQ1zAmsz4HKS9lnkR8 1p7fBaXMoBgcdIRscS6BLZdOYqbE4Z18mEfqhsfjOQ4jm3ksaw0+ihn10lmUcenpFV5P 9PyrR/iR/YF2P3Z2Cl8n/CJN95f37Cmg9y2yfJpwP6xGoAyLTVhoFeQ0SjmQ7Dg/8gGb xKwKBZqzc1UNjuD+XHIUgIOIwPoeC7IET5/tDbMu8AGuDHXCT/AmJEa0r7c4hT4+kajU WctnLBr9eOlCoIUT93mNLQmhxFrw5Eca9prJjoIb7mU3O8dAyCYwcXP3d3xN7++ynEvA h+5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726589761; x=1727194561; 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=SQTb+FsyN+TP1FUoLarmMCU9MXHOsu5FDxRh9xEM0sk=; b=xP8rdklXAiasDyDEeExldA4KB/ycuQ1W7FmtL4nJZRK7g2UkEjRFdI0PtdLJQKl+Pn EgToptgHS4OYD0sqBGNIiAC8tI2M16YZT9KhIfo+Jlu3ds8CMggeZdS1bEDB7ShHTb5y fo+P89oMb8jDncArJk5ZUm8igdPqyB1xJ73NsXsvOUfu0LuJkxCpXwZSw3JFBgPqf4nX JFRLh//aqtVpcRJdH3YuQ3DqiPj1pDIcCD6fVDpdZb89uJ8/Fq3fmvvo7gSZUoDznzXl NWr3AqwmSUAh1yBj/crR5htFhV40VZ98p+f7S2oPNzJUMdcUhqy4pETak0EALGh987/I lOmA== X-Gm-Message-State: AOJu0YwlulYyr+fJsgvpv88TtCJxqoRE8XecvSy8HBYs7DqGOSpvUz3N kowO1rQ2ZzfmGHCrtPbVVNzDtqgUC5ihSzHHgB4c64y1+gufdLdILWxU/w== X-Google-Smtp-Source: AGHT+IFA5ewUt/bSya28z2iCve4lXFKWItRmKNI5D4i+IvmmHiJ0lsrKJzGtOhO8J6n5vG55AJbeTQ== X-Received: by 2002:a05:6512:2345:b0:52e:9b2f:c313 with SMTP id 2adb3069b0e04-5367fed6fd4mr9152415e87.22.1726589760914; Tue, 17 Sep 2024 09:16:00 -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 v2 4/5] xen/riscv: add section for device information in linker script Date: Tue, 17 Sep 2024 18:15:54 +0200 Message-ID: <5e8bec88e4839fc6fa49b6c46e697553f5ca9145.1726579819.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.46.0 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 --- Changes in V2: - reuse DT_DEV_INFO_SEC introduced earlier in this patch series. --- xen/arch/riscv/xen.lds.S | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xen/arch/riscv/xen.lds.S b/xen/arch/riscv/xen.lds.S index 070b19d915..cdc975a49d 100644 --- a/xen/arch/riscv/xen.lds.S +++ b/xen/arch/riscv/xen.lds.S @@ -91,6 +91,9 @@ SECTIONS CONSTRUCTORS } :text + . = ALIGN(POINTER_ALIGN); /* Devicetree based device info */ + DT_DEV_INFO_SEC(.dev.info, NOUSE_DECL_SECTION) + . = ALIGN(PAGE_SIZE); /* Init code and data */ __init_begin = .; .init.text : { From patchwork Tue Sep 17 16:15:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13806306 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 DB4F9CAC58D for ; Tue, 17 Sep 2024 16:16:19 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.800027.1209972 (Exim 4.92) (envelope-from ) id 1sqas0-0002AL-Ro; Tue, 17 Sep 2024 16:16:04 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 800027.1209972; Tue, 17 Sep 2024 16:16:04 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sqas0-00029M-Mm; Tue, 17 Sep 2024 16:16:04 +0000 Received: by outflank-mailman (input) for mailman id 800027; Tue, 17 Sep 2024 16:16:03 +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 1sqarz-0001Mb-4C for xen-devel@lists.xenproject.org; Tue, 17 Sep 2024 16:16:03 +0000 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [2a00:1450:4864:20::130]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 2223370e-7510-11ef-a0b7-8be0dac302b0; Tue, 17 Sep 2024 18:16:02 +0200 (CEST) Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-52f01b8738dso4061621e87.1 for ; Tue, 17 Sep 2024 09:16:02 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5368704da27sm1234574e87.83.2024.09.17.09.16.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Sep 2024 09:16:01 -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: 2223370e-7510-11ef-a0b7-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726589762; x=1727194562; 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=ZV/z++s6J65vsQnlFGFo5cA2p/9dImYXd2ub5JW3o9k=; b=XqdliA17rLpwamkjKqwp/JRbCz2BtgMXawMU2BULC3pKn7PbkGQ5gKMcX+VoIdGixr zNAjDI5EIt7og+FUQMWDProVeHX2bjgfL2ACTB//BeBj3y7ZqRoeWOv6njDOCVV8QdCA WgQAmxtdWatxntYxlkDgdbsXtNX59RZQLhsa7XZgHlRVfDXsezj0JQ8p57+pfRKruFiy Gzjvk+sRrJfzrAy4SwA/lIsk1s90uzrQvBM3QI+Zs9K66U7mbLoA9VIrNHLaYLf6fBZj OLxxTS+VGYak12ZpF2z4dg2PC6oq0sMartTGkG1VO6xv955JDDCZFJ3kKhjdipqaJP0q arMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726589762; x=1727194562; 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=ZV/z++s6J65vsQnlFGFo5cA2p/9dImYXd2ub5JW3o9k=; b=EwNb7dw+Wp16BaVwUYQl6X/VAABgd4RLrC05h8KBg/7IR30WvL9APlmzB7HA3VFIxS TCwyglG+UlT+s4SLkNrw5NozrYJkh0clnJQb+UD2BCmon9SanXqC3hATWE+sD1ifv8zd qvtuLcxdP5YH9tpfX64MTCdW+sqCCRjtms25NxKKMKp5qEI1pEl1OicFI9VQ8c3GrWU4 YF9NPDqOjJh8VdYGFDwRG8DoUrz+R20zLDMT9RusQeKKUy/wXzPCgKkG2keExxTcKN9l wsFyr4Qejo7x3kJ9n9Z7IegANaITQ6uqeMHdrd1aByNrDkloj/4e7qEZf2IHjfN2o6st uCSg== X-Gm-Message-State: AOJu0YwCm55hThL+I1Fj3qnYz73J+gwBSgq0hCwLT80ZEnctlxVmOrIl PMRhsYEwssW5ZqxltLpPsXEXojNs20/qIpe/2WdRlu1DdWj8pTDfF9emDQ== X-Google-Smtp-Source: AGHT+IGWVi29ZiUxnxGSyX4/sW8gW6/cNzd8sB6+hmt9dqALFma3EAYWbSlfljUTW8UySNLFVXTYsQ== X-Received: by 2002:a05:6512:39ce:b0:536:5530:af46 with SMTP id 2adb3069b0e04-53678ff3226mr10453617e87.52.1726589761721; Tue, 17 Sep 2024 09:16:01 -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 v2 5/5] xen/common: move device initialization code to common code Date: Tue, 17 Sep 2024 18:15:55 +0200 Message-ID: <0b4d49742f58549ec644944ce1e02c98d7551845.1726579819.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.46.0 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. Introduce new CONFIG_DEVICE_INIT to compile `device.o` conditionally, ensuring the correct device initialization code is included as needed. Signed-off-by: Oleksii Kurochko --- Changes in v2: - Introduce CONFIG_DEVICE_INIT to make common/device.o compilable only for Arm, PPC and RIS-V. - Move declaration of acpi_device_desc _asdevice[], _aedevice[] inside #ifdef CONFIG_ACPI ... #endif. - Include instead of as will be included anyway. --- xen/arch/arm/device.c | 71 ++----------------------------------- xen/common/Kconfig | 8 +++++ xen/common/Makefile | 1 + xen/common/device.c | 82 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 93 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/Kconfig b/xen/common/Kconfig index 90268d9249..6c6ad30d99 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -12,6 +12,14 @@ config CORE_PARKING bool depends on NR_CPUS > 1 +config DEVICE_INIT + bool + default !X86 + depends on !X86 && (ACPI || HAS_DEVICE_TREE) + help + Enable support for device initialization using device tree or ACPI. + It is not available for X86 systems. + config GRANT_TABLE bool "Grant table support" if EXPERT default y diff --git a/xen/common/Makefile b/xen/common/Makefile index fc52e0857d..1d5a4bb18d 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -6,6 +6,7 @@ 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_DEVICE_INIT) += 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