From nobody Sun Nov 24 11:38:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1722944501; cv=none; d=zohomail.com; s=zohoarc; b=FL+SAukMPsdI2k7ffuZRNLrZtQTr/A6CiX2oHGWo/aHbS7E10CEFcaVv5xVO45dYg9gpel9YeAXwVLxi41CJHlVxZMKgXMAoFphcD7y/KeglbOdhAYI7FRaExnoW/3Ebvc8CCfQQbeKK7UWdkU+6O3RVXMMOgN8Oghbto5g82ew= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722944501; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=vG5ncRvairjCkr+MpN3fScaqyU5Vca5xbMf9rFGyo/E=; b=EU1J8HM4jkbB8J7K+kDniFtLEKC0jrmfTXB1bo5xvy9chRm+rmaTuS0kSY8FqR2u7pru8LPwxjQs1aBIVC73pj3y0COkfwSJBdS9Y1bJra8QTu9N7x0foWNSUccAhEcGR2v/hvVBBjDosgs+qRjmddaqS9VIYcR17Qsd5ZEkelc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 17229445018871010.0055047125533; Tue, 6 Aug 2024 04:41:41 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.772827.1183274 (Exim 4.92) (envelope-from ) id 1sbIZB-0006hx-2H; Tue, 06 Aug 2024 11:41:25 +0000 Received: by outflank-mailman (output) from mailman id 772827.1183274; Tue, 06 Aug 2024 11:41:25 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sbIZA-0006hq-Vh; Tue, 06 Aug 2024 11:41:24 +0000 Received: by outflank-mailman (input) for mailman id 772827; Tue, 06 Aug 2024 11:41:23 +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 1sbIZ9-0006hC-2X for xen-devel@lists.xenproject.org; Tue, 06 Aug 2024 11:41:23 +0000 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [2a00:1450:4864:20::131]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id cc647c82-53e8-11ef-8776-851b0ebba9a2; Tue, 06 Aug 2024 13:41:19 +0200 (CEST) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-52fcc56c882so3887358e87.0 for ; Tue, 06 Aug 2024 04:41:19 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-530bba07891sm1466093e87.22.2024.08.06.04.41.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Aug 2024 04:41:18 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: cc647c82-53e8-11ef-8776-851b0ebba9a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722944479; x=1723549279; 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=vG5ncRvairjCkr+MpN3fScaqyU5Vca5xbMf9rFGyo/E=; b=RDaCIuR6YgiHcFVzLhqf1M/lsvRnPRT7GRD0wurekTkZaGFnRkII+7/+ELHJXREBkk dTtriFXRFpbVqobsR400oc5KF6Zjg6e+gKazgzmUyOyZHunxZ1d4vWr0N/IxnL1VP99p y84Hq3fqVtoUJgjYGKIu0uhtBGvPaWevjTyXxXr0E8oU+2G7Zd/a+885uf0bp7mNPpvQ K8qU/lqTJhbsVv1KrOWuBIa4Bf0ekrfqB5n2/Ako376nu4AvU6l2Nj0PnqGDjInEjpwi KZBxdxG/8+tJDnCedzhMYlWfltvmuGfzCHbLsx1sfsTamhx3h8QF5LlDektkkNW/4iEl bdoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722944479; x=1723549279; 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=vG5ncRvairjCkr+MpN3fScaqyU5Vca5xbMf9rFGyo/E=; b=Jy5JeWR1GjkYsLhNPuYqaTlzzRkY6CuVvTXVqekFc3/xi/hNPGLWNadGBJVRRniX2H K9P8DfjBJTU+WSxLYLHuSEZhsddj/nIyRJtHPtE1Pp27ndZDemccTIKCXEW5z+ZH7zV7 EtddAy2iXZt3d+ewjOD0SExX/YoOAK3qd+9vl+v0LqoCmx1NitKw4hlTBNQcjYLKyug+ qFV7fPBC8GKh+ShWTZzBB5ATwirk2QYCX3HSlenVcWTA4TACzNdkxNP/5f0nTM2aUz49 dBaif1jCgDV4i3nOm9VBgmrZNPGzE5wQwi4ZxnD4BdLYOghphtwaErUS1QIMTEMvsSzB Ym/A== X-Gm-Message-State: AOJu0YwYL4S4rdh8fn3iOqolPG+3+NARqTljPvt8hSP37Srj4tYgOzJg hLiDBKZQV0TZE5jkAgv1R/ac9oVFxlRw6nIQhvFYc1Vx8VZZc5WukfJ44g== X-Google-Smtp-Source: AGHT+IEB7EuJa6UojpkoU5DZ+m4t37Ub0hQd0f/BxUhDU5i8Bgfw7ccYoRWRlEQLyx8Sa1w6/Vhx0w== X-Received: by 2002:a05:6512:3b06:b0:52c:ad70:6feb with SMTP id 2adb3069b0e04-530bb2e8691mr4009661e87.20.1722944478939; Tue, 06 Aug 2024 04:41:18 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Shawn Anastasio , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Oleksii Kurochko , Julien Grall Subject: [PATCH v2 2/2] xen/common: Move Arm's bootfdt.c to common Date: Tue, 6 Aug 2024 13:41:14 +0200 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1722944503825116600 Content-Type: text/plain; charset="utf-8" From: Shawn Anastasio Move Arm's bootfdt.c to xen/common so that it can be used by other device tree architectures like PPC and RISCV. Remove stubs for process_shm_node() and early_print_info_shmem() from $xen/arch/arm/include/asm/static-shmem.h. These stubs are removed to avoid introducing them for architectures that do not support CONFIG_STATIC_SHM. The process_shm_node() stub is now implemented in common code to maintain the current behavior of early_scan_code() on ARM. The early_print_info_shmem() stub is only used in early_print_info(), so it's now guarded with #ifdef CONFIG_STATIC_SHM ... #endif. Suggested-by: Julien Grall Signed-off-by: Shawn Anastasio Signed-off-by: Oleksii Kurochko Acked-by: Julien Grall --- Changes in V9: - add Acked-by: Julien Grall --- Changes in V8: - Fix the change log for this patch ( accidentally the change log of the p= revious patch was copied to this ). - Drop the stub of process_shm_node() and early_print_info_shmem() in xen/arch/arm/include/asm/static-shmem.h as it is moved to common code to= not re-introduce the same stub for each architecture which doesn't support CONFIG_STATIC_SHM now. - Drop Acked-by: Julien Grall as after the Ack additional= changes were done so an additional review is needed. --- Changes in V7: - Nothing changed. Only rebase. --- Changes in V6: - update the version of the patch to v6. --- Changes in v5: - After rebase the Shawn's patch v4 on top of current staging the following was done: - add guard #ifdef CONFIG_STATIC_SHM around inclusion of in common/device-tree/bootfdt.c. - add stub for process_shm_node() in case CONFIG_STATIC_SHM isn't enable= d. - add guard around #ifdef CONFIG_STATIC_SHM aroud early_print_info_shmem= () in early_print_info(). --- Changes in v4: - move function prototypes to patch 2's xen/include/bootfdt.h - clean up #includes --- xen/arch/arm/Makefile | 1 - xen/arch/arm/include/asm/setup.h | 13 ---------- xen/arch/arm/include/asm/static-shmem.h | 9 ------- xen/common/device-tree/Makefile | 1 + .../arm =3D> common/device-tree}/bootfdt.c | 24 +++++++++++++++---- xen/include/xen/bootfdt.h | 14 +++++++++++ 6 files changed, 34 insertions(+), 28 deletions(-) rename xen/{arch/arm =3D> common/device-tree}/bootfdt.c (98%) diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 45dc29ea53..da9c979dc4 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -10,7 +10,6 @@ obj-$(CONFIG_TEE) +=3D tee/ obj-$(CONFIG_HAS_VPCI) +=3D vpci.o =20 obj-$(CONFIG_HAS_ALTERNATIVE) +=3D alternative.o -obj-y +=3D bootfdt.init.o obj-y +=3D cpuerrata.o obj-y +=3D cpufeature.o obj-y +=3D decode.o diff --git a/xen/arch/arm/include/asm/setup.h b/xen/arch/arm/include/asm/se= tup.h index 1748be29e5..64c227d171 100644 --- a/xen/arch/arm/include/asm/setup.h +++ b/xen/arch/arm/include/asm/setup.h @@ -41,19 +41,6 @@ void fw_unreserved_regions(paddr_t s, paddr_t e, void (*cb)(paddr_t ps, paddr_t pe), unsigned int first); =20 -bool check_reserved_regions_overlap(paddr_t region_start, paddr_t region_s= ize); - -struct bootmodule *add_boot_module(bootmodule_kind kind, - paddr_t start, paddr_t size, bool domU); -struct bootmodule *boot_module_find_by_kind(bootmodule_kind kind); -struct bootmodule * boot_module_find_by_addr_and_kind(bootmodule_kind kind, - paddr_t start= ); -void add_boot_cmdline(const char *name, const char *cmdline, - bootmodule_kind kind, paddr_t start, bool domU); -struct bootcmdline *boot_cmdline_find_by_kind(bootmodule_kind kind); -struct bootcmdline * boot_cmdline_find_by_name(const char *name); -const char *boot_module_kind_as_string(bootmodule_kind kind); - void init_pdx(void); void setup_mm(void); =20 diff --git a/xen/arch/arm/include/asm/static-shmem.h b/xen/arch/arm/include= /asm/static-shmem.h index 806ee41cfc..fd0867c4f2 100644 --- a/xen/arch/arm/include/asm/static-shmem.h +++ b/xen/arch/arm/include/asm/static-shmem.h @@ -80,15 +80,6 @@ static inline int process_shm_chosen(struct domain *d, return 0; } =20 -static inline int process_shm_node(const void *fdt, int node, - uint32_t address_cells, uint32_t size_c= ells) -{ - printk("CONFIG_STATIC_SHM must be enabled for parsing static shared me= mory nodes\n"); - return -EINVAL; -} - -static inline void early_print_info_shmem(void) {}; - static inline void init_sharedmem_pages(void) {}; =20 static inline int remove_shm_from_rangeset(const struct kernel_info *kinfo, diff --git a/xen/common/device-tree/Makefile b/xen/common/device-tree/Makef= ile index f813f7555f..990abd571a 100644 --- a/xen/common/device-tree/Makefile +++ b/xen/common/device-tree/Makefile @@ -1,2 +1,3 @@ +obj-y +=3D bootfdt.init.o obj-y +=3D bootinfo.init.o obj-y +=3D device-tree.o diff --git a/xen/arch/arm/bootfdt.c b/xen/common/device-tree/bootfdt.c similarity index 98% rename from xen/arch/arm/bootfdt.c rename to xen/common/device-tree/bootfdt.c index 6e060111d9..f7998979c1 100644 --- a/xen/arch/arm/bootfdt.c +++ b/xen/common/device-tree/bootfdt.c @@ -4,18 +4,20 @@ * * Copyright (C) 2012-2014 Citrix Systems, Inc. */ -#include -#include -#include -#include -#include + +#include #include +#include +#include +#include #include #include #include #include #include +#ifdef CONFIG_STATIC_SHM #include +#endif =20 static void __init __maybe_unused build_assertions(void) { @@ -436,6 +438,16 @@ static int __init process_domain_node(const void *fdt,= int node, MEMBANK_STATIC_DOMAIN); } =20 +#ifndef CONFIG_STATIC_SHM +static inline int process_shm_node(const void *fdt, int node, + uint32_t address_cells, uint32_t size_c= ells) +{ + printk("CONFIG_STATIC_SHM must be enabled for parsing static shared" + " memory nodes\n"); + return -EINVAL; +} +#endif + static int __init early_scan_node(const void *fdt, int node, const char *name, int depth, u32 address_cells, u32 size_cells, @@ -495,7 +507,9 @@ static void __init early_print_info(void) mem_resv->bank[i].start, mem_resv->bank[i].start + mem_resv->bank[i].size - 1); } +#ifdef CONFIG_STATIC_SHM early_print_info_shmem(); +#endif printk("\n"); for ( i =3D 0 ; i < cmds->nr_mods; i++ ) printk("CMDLINE[%"PRIpaddr"]:%s %s\n", cmds->cmdline[i].start, diff --git a/xen/include/xen/bootfdt.h b/xen/include/xen/bootfdt.h index c39428d5f5..16fa05f38f 100644 --- a/xen/include/xen/bootfdt.h +++ b/xen/include/xen/bootfdt.h @@ -157,6 +157,20 @@ struct bootinfo { =20 extern struct bootinfo bootinfo; =20 +bool check_reserved_regions_overlap(paddr_t region_start, + paddr_t region_size); + +struct bootmodule *add_boot_module(bootmodule_kind kind, + paddr_t start, paddr_t size, bool domU); +struct bootmodule *boot_module_find_by_kind(bootmodule_kind kind); +struct bootmodule * boot_module_find_by_addr_and_kind(bootmodule_kind kind, + paddr_t start= ); +void add_boot_cmdline(const char *name, const char *cmdline, + bootmodule_kind kind, paddr_t start, bool domU); +struct bootcmdline *boot_cmdline_find_by_kind(bootmodule_kind kind); +struct bootcmdline * boot_cmdline_find_by_name(const char *name); +const char *boot_module_kind_as_string(bootmodule_kind kind); + void populate_boot_allocator(void); =20 size_t boot_fdt_info(const void *fdt, paddr_t paddr); --=20 2.45.2