From patchwork Fri Sep 27 16:32: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: 13814456 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 57F95CDD1CD for ; Fri, 27 Sep 2024 16:33:42 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.806400.1217758 (Exim 4.92) (envelope-from ) id 1suDtx-0001iY-6U; Fri, 27 Sep 2024 16:33:05 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 806400.1217758; Fri, 27 Sep 2024 16:33: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 1suDtx-0001fe-0V; Fri, 27 Sep 2024 16:33:05 +0000 Received: by outflank-mailman (input) for mailman id 806400; Fri, 27 Sep 2024 16:33:03 +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 1suDtv-0001aC-I3 for xen-devel@lists.xenproject.org; Fri, 27 Sep 2024 16:33:03 +0000 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [2a00:1450:4864:20::62a]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 296d5a43-7cee-11ef-99a2-01e77a169b0f; Fri, 27 Sep 2024 18:33:01 +0200 (CEST) Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-a8d4979b843so312315066b.3 for ; Fri, 27 Sep 2024 09:33:01 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a93c27c59bdsm150607166b.50.2024.09.27.09.32.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Sep 2024 09:32: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: 296d5a43-7cee-11ef-99a2-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727454780; x=1728059580; 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=nzAWnVE+25sXlcSpnmj7o00ZWNIuoO0eLwRBHFjtKEM=; b=QnYd+stomPUKtX4Rf8vxJnK50Dq+QUmseS2wmqorcn5s38TW9hpD7uSkRb0Fe2vIaB Qy+GXc4/ZotxCCJ6b6AUw49b5P/0ro1kzCqT6ZL6uNjB01Yij23KARhMZLJBZsZePV5X w8jhhw3QSv707Jaa4ojgvLe1CqNx1+q+WwyJL6mwyTmtF0ooFggijkP1DbnMwlmTYXG0 zzfGVMhY90P+UG/KBjC9SIn+gYc9v7uASLCYyhEZ8FVkA7pz+I7GMXcNHfMtH/4A2cUM WfazGfZqLFPpQ216eFGYL3Vt9Gsgh9AlxS6W75ArkS30ir1/LCgHtPR9nnbe+34QRQ+H HBaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727454780; x=1728059580; 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=nzAWnVE+25sXlcSpnmj7o00ZWNIuoO0eLwRBHFjtKEM=; b=MBzCA3sqIhrq7TsgdLNBuFZnUC/3u9HyTw6s34Ap56Jp/kBlYDiFSD4NU2PDq77L7Z +we3qTSZkUdEJkyNqq81sVzTagiwG/S8sGbOdHRTVUtE4gyroMULk44qzkG+Gdp7UefL nY+dzXrU0pw+CuUPH0Kg9VsjueG8j27yU2VC5X+3bZCc0dURTBGZQHBs0DFNerHAlJXO l7jExAjOhUnMdVjNdG0+iM32rki1wpnVp6qotpyNWRfKE1fetbVwVaT5VkNAHucLi8vG XtPaaRzZ1wdmFpM9mzMmpaN1qt9IUc/2Og5B8/jzL6ODM1KeGe5e4FUaXjEkhrpNDwg5 J9Nw== X-Gm-Message-State: AOJu0YwJHzmufFvefzWn5Gqh5G0kl6lzZQxzW/Nfdt6jupjCSfawN9XJ qNLGteant8j23Ex4Afgi0KoRCOtWFt1WqdZIuOrq6Hry+4YPvKMeY+bW4Q== X-Google-Smtp-Source: AGHT+IFXHO9VrrpRGbMSzTVKjhVmVf7mxR5JFaneIy5RuHsDNT47WjtuZ0HG/ZLAxrbjeAkA057dAw== X-Received: by 2002:a17:907:743:b0:a8d:42c3:5f68 with SMTP id a640c23a62f3a-a93c492189fmr270848366b.23.1727454779991; Fri, 27 Sep 2024 09:32:59 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Shawn Anastasio , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Subject: [PATCH v5 1/6] xen: introduce DECL_SECTION_WITH_LADDR Date: Fri, 27 Sep 2024 18:32:51 +0200 Message-ID: X-Mailer: git-send-email 2.46.1 In-Reply-To: References: MIME-Version: 1.0 Introduce DECL_SECTION_WITH_LADDR in order to signal whether DECL_SECTION() should specify a load address or not. Update {ppc,x86}/xen.lds.S to use DECL_SECTION_WITH_LADDR. Signed-off-by: Oleksii Kurochko Acked-by: Jan Beulich --- Changes in V5: - s/SIMPLE_DECL_SECTION/DECL_SECTION_WITH_LADDR. - add space between # and define in x86/xen.lds.S. - use DECL_SECTION_WITH_LADDR in ppc/xen.lds.S. - update the commit message. - add Acked-by: Jan Beulich . --- Changes in V4: - new patch --- xen/arch/ppc/xen.lds.S | 2 ++ xen/arch/x86/xen.lds.S | 6 ++++-- xen/include/xen/xen.lds.h | 6 ++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/xen/arch/ppc/xen.lds.S b/xen/arch/ppc/xen.lds.S index 0c4b94814b..30b4a6ced8 100644 --- a/xen/arch/ppc/xen.lds.S +++ b/xen/arch/ppc/xen.lds.S @@ -1,4 +1,6 @@ #include + +#define DECL_SECTION_WITH_LADDR #include OUTPUT_ARCH(powerpc:common64) diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index b60d2f0d82..7d2aa2d801 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -3,6 +3,10 @@ #include #include + +#ifndef EFI +# define DECL_SECTION_WITH_LADDR +#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..c6178bdc42 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. */ +#ifdef DECL_SECTION_WITH_LADDR + /* * 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 /* !DECL_SECTION_WITH_LADDR */ +#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 Fri Sep 27 16:32: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: 13814454 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 241FFCDD1CD for ; Fri, 27 Sep 2024 16:33:27 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.806399.1217753 (Exim 4.92) (envelope-from ) id 1suDtw-0001dt-Vx; Fri, 27 Sep 2024 16:33:04 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 806399.1217753; Fri, 27 Sep 2024 16:33: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 1suDtw-0001dD-QL; Fri, 27 Sep 2024 16:33:04 +0000 Received: by outflank-mailman (input) for mailman id 806399; Fri, 27 Sep 2024 16:33: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 1suDtv-0001aD-0E for xen-devel@lists.xenproject.org; Fri, 27 Sep 2024 16:33:03 +0000 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [2a00:1450:4864:20::636]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 29c15f0c-7cee-11ef-a0ba-8be0dac302b0; Fri, 27 Sep 2024 18:33:02 +0200 (CEST) Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-a93c1cc74fdso225209966b.3 for ; Fri, 27 Sep 2024 09:33:02 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a93c27c59bdsm150607166b.50.2024.09.27.09.33.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Sep 2024 09:33: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: 29c15f0c-7cee-11ef-a0ba-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727454781; x=1728059581; 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=KJV5oRBJlzZEz9ymtqRaazaj6DoXUhgQRXq9CVcX0tA=; b=j0oHFMrVhqpylfxNXpunPqu9ghT3Shl+AKkoVbTtOMZFh0HrdJ33XwYXEYEfhW/6Yw Mqm6zUD7O3RVjRm27aMRbS83X16TPp5e5Gw70CtOCcMSuQRgXHWktsi2KHzuKr5wewRt 1bIRFzcaUnMwxtuythq1jCJMfTm9FYlfzyo/3Qe2mChsBOBHUscQUNhFXOolZrpzFath Sw87xCC61Or/3/wWw9CHWuulvEL4gTQluJigWdwO6cqSZWV5Gx7aFMEJYdHlViW/jm/W HMzuHYZX89J/hIQQS16WOtS+fsY8mmHRggNNuiB1+aSNN2f3YEcNWJ1HsMicJdxymyRB xqAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727454781; x=1728059581; 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=KJV5oRBJlzZEz9ymtqRaazaj6DoXUhgQRXq9CVcX0tA=; b=PLF2RzYGZZUaZzGEFgHqfUuRQfyXm/FPHVXtVzrF3G547orR43Fqmh7ZpsfpN0CPOW auLEZeHifncQee8SxB49/py2f4VZrlXo43I/5yrCPWsGfEI2s/npeT6yaNIgy3XBSU14 mu5bFLD5PFeUkfkaz/9Gnjxik1/02J2AydQ9a1c+L7Y0AcTsxov92/ZWhpYDKzLvGHRy 9N9/AATeTthdlFvmURGD50QtZZJVyTD8wpqqtitC0PZt4RqBhnbOBsfVMWFrz6/+FxBM KyYaz6nsdMPKJsvHdIU046YSmyIVfOGdBJTTuPO3mti360drSGloUF7WMSsKom5yftow 7eeA== X-Gm-Message-State: AOJu0YwyT6eYnmJ9P9Tdo1EHzNWDJ1SrNx1IDhvvuVEELE8LTyPalTiZ VphnYBUj/X+CfTdazBUcKkhwwwe6V1yPLisoMQ93uiAfwzex3GcXozm6Cw== X-Google-Smtp-Source: AGHT+IHhHgFHvcCnMJwrZrnSea7HPNePoioW1KsPsVXPYD0jV0RZzy1+SVCUfIAFJo92YTJUt2eivQ== X-Received: by 2002:a17:907:6ea1:b0:a86:7b71:7b77 with SMTP id a640c23a62f3a-a93c4a69aabmr335450766b.44.1727454780814; Fri, 27 Sep 2024 09:33:00 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini Subject: [PATCH v5 2/6] xen: define ACPI and DT device info sections macros Date: Fri, 27 Sep 2024 18:32:52 +0200 Message-ID: <05ce8fea5c16ad603ca0fea60730ff10abcf2d02.1727452451.git.oleksii.kurochko@gmail.com> 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 V5: - drop macros parameter for ACPI_DEV_INFO and DT_DEV_INFO. - add 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 c6178bdc42..16a9b1ba03 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 \ + . = ALIGN(POINTER_ALIGN); \ + DECL_SECTION(.adev.info) { \ + _asdevice = .; \ + *(.adev.info) \ + _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 \ + . = ALIGN(POINTER_ALIGN); \ + DECL_SECTION(.dev.info) { \ + _sdevice = .; \ + *(.dev.info) \ + _edevice = .; \ + } :text + #ifdef CONFIG_HYPFS #define HYPFS_PARAM \ . = ALIGN(POINTER_ALIGN); \ From patchwork Fri Sep 27 16:32: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: 13814452 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 25587CDD1CD for ; Fri, 27 Sep 2024 16:33:23 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.806401.1217762 (Exim 4.92) (envelope-from ) id 1suDtx-0001nw-DN; Fri, 27 Sep 2024 16:33:05 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 806401.1217762; Fri, 27 Sep 2024 16:33: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 1suDtx-0001mA-8s; Fri, 27 Sep 2024 16:33:05 +0000 Received: by outflank-mailman (input) for mailman id 806401; Fri, 27 Sep 2024 16:33: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 1suDtv-0001aD-Lc for xen-devel@lists.xenproject.org; Fri, 27 Sep 2024 16:33:03 +0000 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [2a00:1450:4864:20::12e]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 2a68a096-7cee-11ef-a0ba-8be0dac302b0; Fri, 27 Sep 2024 18:33:02 +0200 (CEST) Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-535dc4ec181so2536512e87.3 for ; Fri, 27 Sep 2024 09:33:02 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a93c27c59bdsm150607166b.50.2024.09.27.09.33.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Sep 2024 09:33: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: 2a68a096-7cee-11ef-a0ba-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727454782; x=1728059582; 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=2hWXwXM8AkGaqnosUqSbi4XBp7s8/BolzMP+Ya0W380=; b=bWj5os0jLK3d+qzy8n9ltuylN7xTLMfNwtq9KY9XnoZCZFMFPs99cs8fs+zOY00ZH6 DTFtd4/Z7SzATaAMLbOBqC/P+SK1cBG5SI9MQa2tsvPXXWtnFqoa7bQc//Sbq9aurDMr ykM83sXjo7ntgi8rVpOfUxPGpbIQLWUfLjrrBt9s7jZMHA5WiKvbhDA+JOfVfVhPbbdE DosgbxBElrIHZfcp/mPTU9bum4FNIBOS53SU5wbbabUyCJZ6gwR9PjfI4DGa4OwEzROJ O7Zt8EcObMHgTsp/TKE2YgkCh9MnOjOdMHIsqLmH6REDnyCKSk4236Va99j+bQjV00x7 oPhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727454782; x=1728059582; 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=2hWXwXM8AkGaqnosUqSbi4XBp7s8/BolzMP+Ya0W380=; b=MALOyph+XB7ngZiMNPTeX7GvIwJA5BnXAoL2+TzGMYK3nD+OH4BDO1+wJFqayxqyIu FJLLYBBPklSwallZ4tILIWs48w1VKB3qnshIwtXMf8EB4ZW+RGWEDK41s9JrcfkPZngU 9uofnHAQIot7fv7ez1tVzdZHINV+Zg0oFsy0FDnGTSwVjqU47b7gu45iAK2jXbSh9A1a FocvffbKiu0VArsR7Tv6vaQ7m8GesW6cVH4VJnEUmAa9FJeQuhjZ7BBK/i6PsbGNSEGQ XTLxEHZrkfmzDl7zVZQDC4wRvwOV0AapH2sRuHkqHpp3KTkRV0z/CX0TgXU9JfoiPCzF mJWQ== X-Gm-Message-State: AOJu0Yxwa0yw/qdrQSXw58gcfB2NUEOtis1KEMUZjJCltp4tJUJbV016 3BfnvFJlVMGCiz9ZNnYRBdsLqV6vjqFxwNv2M3pBpUUsLJD1BurRPDSKXg== X-Google-Smtp-Source: AGHT+IHqba2x/LuPYwAWEbDp/3SXBVV9I5Du1sSufcMPMgmKIuxrZOE6HlF1REbdv7tHGF1hnycwfA== X-Received: by 2002:a05:6512:4023:b0:52f:413:7e8c with SMTP id 2adb3069b0e04-5389fc3c5e7mr2318449e87.14.1727454781854; Fri, 27 Sep 2024 09:33: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 Subject: [PATCH v5 3/6] xen/arm: use {DT,ACPI}_DEV_INFO for device info sections Date: Fri, 27 Sep 2024 18:32:53 +0200 Message-ID: <025fa86a8dcc7430c072743b54489f913aa990b0.1727452451.git.oleksii.kurochko@gmail.com> 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. Change alignment of DT_DEV_INFO and ACPI_DEV_INFO sections from 8 to POINTER_ALIGN as struct acpi_device_desc and struct device_desc don't have any uint64_t's so it is safe to do that. Signed-off-by: Oleksii Kurochko Reviewed-by: Michal Orzel --- Changes in V5: - add Reviewed-by: Michal Orzel . - update the commit message ( add information about s/8/POINTER_ALIGN/ for Arm ). - use newly refactored ACPI_DEV_INFO and DT_DEV_INFO ( drop macros argument ) --- 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 | 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 0987052f1a..5b9abc9a2d 100644 --- a/xen/arch/arm/xen.lds.S +++ b/xen/arch/arm/xen.lds.S @@ -124,20 +124,10 @@ SECTIONS _eplatform = .; } :text - . = ALIGN(8); - .dev.info : { - _sdevice = .; - *(.dev.info) - _edevice = .; - } :text + DT_DEV_INFO #ifdef CONFIG_ACPI - . = ALIGN(8); - .adev.info : { - _asdevice = .; - *(.adev.info) - _aedevice = .; - } :text + ACPI_DEV_INFO #endif . = ALIGN(8); From patchwork Fri Sep 27 16:32: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: 13814453 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 5F052CDD1CE for ; Fri, 27 Sep 2024 16:33:25 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.806402.1217786 (Exim 4.92) (envelope-from ) id 1suDty-0002Ql-NI; Fri, 27 Sep 2024 16:33:06 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 806402.1217786; Fri, 27 Sep 2024 16:33:06 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1suDty-0002PZ-Iw; Fri, 27 Sep 2024 16:33:06 +0000 Received: by outflank-mailman (input) for mailman id 806402; Fri, 27 Sep 2024 16:33:05 +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 1suDtx-0001aC-Jl for xen-devel@lists.xenproject.org; Fri, 27 Sep 2024 16:33:05 +0000 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [2a00:1450:4864:20::629]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 2b205ecf-7cee-11ef-99a2-01e77a169b0f; Fri, 27 Sep 2024 18:33:04 +0200 (CEST) Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-a8a897bd4f1so314425866b.3 for ; Fri, 27 Sep 2024 09:33:04 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a93c27c59bdsm150607166b.50.2024.09.27.09.33.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Sep 2024 09:33:02 -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: 2b205ecf-7cee-11ef-99a2-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727454783; x=1728059583; 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=leAxxJzl+409UfrEd5qPVybrX2oZQDzIq1f2vuG+PV8=; b=JjBtGapZoeZ3wCYhIN+19UEhytAvEaN0nBt40rtkiZZ8rVC2PJhbGGcWp3jzPnoAhp scpBJgaAwpTYgSRL3xDkz7ftIexw7SVH/YBKmc7L2wIz1zs4hN3VBcexs6cm+vO5jZx+ WijeK1Vf3U66t4KcMaDfS3JSG7aaa+ml43Ysj9F0DCqSnh8E11QVR+tjNnIn6sMnPfXP AAwtWRa0kyihGHg5tkGMQp/2lmS4w8fm971IYWB9f7wmgxUGgu8DeQ6u0vSYjDKx4s2C Lc0A/oZ3yibhLq945392f7pnYF0mSzI30PRmZ+dHwaEhxenMOUvrepH2nXzryxO9FPvs lfOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727454783; x=1728059583; 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=leAxxJzl+409UfrEd5qPVybrX2oZQDzIq1f2vuG+PV8=; b=C+JGpIUpGdXNfNffr+8lxMynqKm5IJ6QJu+kSt8BFiplAR/+Enyq7tHwB1Caj1QoNn vvFjkybhoh3vaDhu/5Un24l5awdhHk6rizfJjNwoas7L0T6a5G9RWP7iu5OTVag8FAPQ xlgrYUAP8yX2SU0nZedJkZsTXO4RWJDXGrvrpg0gprh+b5kdxfiENB9CdUhXTdVM0Btg o3PwLwmt9/ZY/ppkBLp9Cpka8cQj37LO6dxyCkhuQoRxhzAi8LL7o0z1y0t34vHAGKMs Ik01vJ9woCwBcwyhfKjALkh4J3rmskyzV/vH+xxdQqoQdILYe0rmXpcaBzwXzmDbOr0L GXvA== X-Gm-Message-State: AOJu0YxYiCiM1zQxhw5jNy5OgQoz0zTP1YWK1+XT7my7JjGHbbX0YSX5 BIC2dMoyw3prx/+je9AVfQWZRivQ9xUEf3PmBi+9v3zVhygsdMJrz2sYsQ== X-Google-Smtp-Source: AGHT+IG3CIopgO+5VFJyIZI70q+ryIQxhz3RGf6b5mdoV8H8FuYr8cYwn/WrPxwqE/VlWI+JSsXy+w== X-Received: by 2002:a17:907:e91:b0:a7d:c148:ec85 with SMTP id a640c23a62f3a-a93c4aa6b89mr366505766b.62.1727454782941; Fri, 27 Sep 2024 09:33:02 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Shawn Anastasio Subject: [PATCH v5 4/6] xen/ppc: add section for device information in linker script Date: Fri, 27 Sep 2024 18:32:54 +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 V5: - use newly refactored DT_DEV_INFO ( drop macros argument ) --- 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 30b4a6ced8..3f2a7676ec 100644 --- a/xen/arch/ppc/xen.lds.S +++ b/xen/arch/ppc/xen.lds.S @@ -96,6 +96,8 @@ SECTIONS CONSTRUCTORS } :text + DT_DEV_INFO /* Devicetree based device info */ + . = ALIGN(PAGE_SIZE); /* Init code and data */ __init_begin = .; DECL_SECTION(.init.text) { From patchwork Fri Sep 27 16:32: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: 13814455 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 1D271CDD1CD for ; Fri, 27 Sep 2024 16:33:38 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.806403.1217797 (Exim 4.92) (envelope-from ) id 1suDu0-0002mu-6M; Fri, 27 Sep 2024 16:33:08 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 806403.1217797; Fri, 27 Sep 2024 16:33:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1suDu0-0002m4-25; Fri, 27 Sep 2024 16:33:08 +0000 Received: by outflank-mailman (input) for mailman id 806403; Fri, 27 Sep 2024 16:33:06 +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 1suDty-0001aC-LT for xen-devel@lists.xenproject.org; Fri, 27 Sep 2024 16:33:06 +0000 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [2a00:1450:4864:20::12b]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 2bc6e334-7cee-11ef-99a2-01e77a169b0f; Fri, 27 Sep 2024 18:33:05 +0200 (CEST) Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-535dc4ec181so2536557e87.3 for ; Fri, 27 Sep 2024 09:33:05 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a93c27c59bdsm150607166b.50.2024.09.27.09.33.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Sep 2024 09:33:03 -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: 2bc6e334-7cee-11ef-99a2-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727454784; x=1728059584; 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=+08psIfLJrfr1+9TR9z6IB/oh0Wn/fJVKMeRSZDPsdY=; b=KkcqOpxXrCT0z629iwsso8R0aeLu+wpXVlvWiDvOFqvNECMfmY70pfJSsCELA2oDYj 9tscUJ9N/bOmWE9UoO724gviMNAeOgVPRPtMTpJBqYSfZLxldDUu7ZAWkXz3FqAfx0bv ucnwlcJBH0YKwfd7DumIlZ4AGkTFtxUcho+P2Y1J3y1MopIdA/MH4X6LVjLE5S/BqXyQ nqeGb4hDmwlSz54JO2lvDiqPYAvt42tRGSqoS2hYPgWY/0UyA0MsYtWoFZtPEMSottcD DzLcOjpCBgXgdDTpP8r4N/7kZ13pqIvJ++/25GKFx98GGiAWVFVNLVHk0iTS8HfZMhG1 fC0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727454784; x=1728059584; 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=+08psIfLJrfr1+9TR9z6IB/oh0Wn/fJVKMeRSZDPsdY=; b=HC5qcnMgqj0uEtJdFQ5cXuw34Sr/vz6EkXfAiLuEKKKP5WNgi4c8yPg2cjK0crxXc8 cdYRBf8QeV+e7PjIbx+2Oe7GBSZXnpZ3Cs28gNdBW7n1a46KI9pR3SJ9B3YV5l4OB/50 sESccvn4A7wLqyStrTUuZdhrJyqOQfJ1UboFqzZ59UWvynFRmlefvs6Rw5/SoUhTxycV csKvkqZJ+yPiaRoMfnBDwvUJYSVWkgrgG4y0qsJHPIAwve0qclpK2iVee6q4Nrm4biH4 56VqjD6c5d9sJrQHufIa2EDGNv9JRDGU++LSMT+C45blEk7JzGT6H3WgniRBwy3amPBf 514w== X-Gm-Message-State: AOJu0Yzrr59uwi5c44V6myJwaekQ70rezcYluIFfdf/d5Ae4yCP8pgWC GXZYzwtIhgdSUCUMtULuk3PFvqN74Fcc1T+C6I3IFAQbuzs9hzoW5zKukw== X-Google-Smtp-Source: AGHT+IHag+2Yt+XhEsKsDG5krM5YYD9hVHam1+A0d0Lwbgcf/8x3dibUe6S+Y4EfAdjJCrw7cJCC0w== X-Received: by 2002:a05:6512:68f:b0:536:53c2:817f with SMTP id 2adb3069b0e04-5389fc4d18cmr2780979e87.36.1727454784158; Fri, 27 Sep 2024 09:33:04 -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 v5 5/6] xen/riscv: add section for device information in linker script Date: Fri, 27 Sep 2024 18:32:55 +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 V5: - add Acked-by: Jan Beulich - use newly refactored DT_DEV_INFO ( drop macros argument ) --- Changes in V4: - use newly refactored DT_DEV_INFO --- Changes in V3: - use refactored DT_DEV_INFO macros. --- xen/arch/riscv/xen.lds.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/arch/riscv/xen.lds.S b/xen/arch/riscv/xen.lds.S index 871b47a235..75fcf367e4 100644 --- a/xen/arch/riscv/xen.lds.S +++ b/xen/arch/riscv/xen.lds.S @@ -91,6 +91,8 @@ SECTIONS CONSTRUCTORS } :text + DT_DEV_INFO /* Devicetree based device info */ + . = ALIGN(PAGE_SIZE); /* Init code and data */ __init_begin = .; .init.text : { From patchwork Fri Sep 27 16:32:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13814457 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 2627ECDD1CD for ; Fri, 27 Sep 2024 16:33:47 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.806404.1217803 (Exim 4.92) (envelope-from ) id 1suDu0-0002rT-Ml; Fri, 27 Sep 2024 16:33:08 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 806404.1217803; Fri, 27 Sep 2024 16:33:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1suDu0-0002r0-F1; Fri, 27 Sep 2024 16:33:08 +0000 Received: by outflank-mailman (input) for mailman id 806404; Fri, 27 Sep 2024 16:33:07 +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 1suDty-0001aD-Sj for xen-devel@lists.xenproject.org; Fri, 27 Sep 2024 16:33:06 +0000 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [2a00:1450:4864:20::636]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 2c7a61e0-7cee-11ef-a0ba-8be0dac302b0; Fri, 27 Sep 2024 18:33:06 +0200 (CEST) Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-a7a843bef98so298159966b.2 for ; Fri, 27 Sep 2024 09:33:06 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a93c27c59bdsm150607166b.50.2024.09.27.09.33.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Sep 2024 09:33:04 -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: 2c7a61e0-7cee-11ef-a0ba-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727454785; x=1728059585; 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=X2QQxBgwKAcM3DvdSfBvFC6LEQQkOxf8BpaLss5/lZ0=; b=OqWarkFzh4CZwJgBwFWdVS4nkhK6bx1FFo84r31r3ybcZd+AlL4k+I9Fvtz7vFcok2 XzgGnBS86qVMy8QzWzH4AD/XYRLGtUMes/lvvnAMY9AYIpJ7MTXYvXzTAMNI4ebBj3Ao Rl4vkLmcVAFM9C5k80eAlF24VD6465tKUbo7zt1Hijq/eZiBXqSpSiPUFXXPbUuWEoD+ 4cIT9RZsz7xlo3nNp+rDJAmWAsFjrIiotjYHAZNTCtJKwkqt2hXFZqVo/PgeDzDeNZe6 6WmiXpAU++PcLmm/vwFD3dBdMdVKhEBGjO/yTvviT3hCgshy2GFbv3cZJbJ9XYiYhogc DBAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727454785; x=1728059585; 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=X2QQxBgwKAcM3DvdSfBvFC6LEQQkOxf8BpaLss5/lZ0=; b=HJpb8+29cDvQdruKEXltgcUmcfqvezdWY9VXgIt9hmFsoLO4xKZeTFRGZaa98WnVMM ViOfeiFz2PL5ZkupcHYYS6bc/0IntKF3CcmSbjw7Z9ONAjmoayDGl5sTY/MlNrIEjfK+ eiRdcGIXXUyuhAH4s1LG8NYoNEbJYbc3M7qt0SgICY6ZfQ4gw4wPQ2qN4cg02jafy2oh tJO+ybYsCb7JqVBUv4O6Brw5wabxPq6ozoaUl34l9acDN/y6x2VM0PCHRklxbxdQj2Oc q3idd4ooQYDHiqm8F4hGX47yEEDTxkMlYAkn1My2Ur8YtCSjDzBm1QmG+i5EoZF8NfpY 2wwA== X-Gm-Message-State: AOJu0YyUmOtMxOpgyWs8DZ1oq5kOCPyT2hy1EXtjCO4xL9+G87CjFNqD I6bZodjdTnbALsdsTJAEQuB4Adc1sNNIfVjX+5GNbIdaV7WcMS7sEMJBmw== X-Google-Smtp-Source: AGHT+IEcVT/jngnSHyPkDtg8R5eE+hbo8sqfo4/S4LE98s0mmpdW92PjjiuxdKOm6xNT+SofvdZnVw== X-Received: by 2002:a17:907:7f28:b0:a8a:835f:4cb9 with SMTP id a640c23a62f3a-a93c4a69b3bmr393643966b.46.1727454785287; Fri, 27 Sep 2024 09:33:05 -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 v5 6/6] xen/common: move device initialization code to common code Date: Fri, 27 Sep 2024 18:32:56 +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 V5: - 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