All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shawn Anastasio <sanastasio@raptorengineering.com>
To: xen-devel@lists.xenproject.org
Cc: Timothy Pearson <tpearson@raptorengineering.com>,
	Jan Beulich <jbeulich@suse.com>,
	Shawn Anastasio <sanastasio@raptorengineering.com>
Subject: [PATCH v2 2/7] xen/asm-generic: Introduce generic setup.h
Date: Thu, 14 Dec 2023 20:43:57 -0600	[thread overview]
Message-ID: <1e4f48d753871bf61de3af97a3009e069d25d01e.1702607884.git.sanastasio@raptorengineering.com> (raw)
In-Reply-To: <cover.1702607884.git.sanastasio@raptorengineering.com>

Introduce setup.h to asm-generic based off of ARM's to define all
stubs necessary to compile bootfdt.c

Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com>
---
 xen/arch/ppc/include/asm/Makefile |   1 +
 xen/arch/ppc/include/asm/setup.h  |   6 --
 xen/include/asm-generic/setup.h   | 148 ++++++++++++++++++++++++++++++
 3 files changed, 149 insertions(+), 6 deletions(-)
 delete mode 100644 xen/arch/ppc/include/asm/setup.h
 create mode 100644 xen/include/asm-generic/setup.h

diff --git a/xen/arch/ppc/include/asm/Makefile b/xen/arch/ppc/include/asm/Makefile
index a711cfa856..7167661f86 100644
--- a/xen/arch/ppc/include/asm/Makefile
+++ b/xen/arch/ppc/include/asm/Makefile
@@ -6,5 +6,6 @@ generic-y += iocap.h
 generic-y += paging.h
 generic-y += percpu.h
 generic-y += random.h
+generic-y += setup.h
 generic-y += static-shmem.h
 generic-y += vm_event.h
diff --git a/xen/arch/ppc/include/asm/setup.h b/xen/arch/ppc/include/asm/setup.h
deleted file mode 100644
index e4f64879b6..0000000000
--- a/xen/arch/ppc/include/asm/setup.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef __ASM_PPC_SETUP_H__
-#define __ASM_PPC_SETUP_H__
-
-#define max_init_domid (0)
-
-#endif /* __ASM_PPC_SETUP_H__ */
diff --git a/xen/include/asm-generic/setup.h b/xen/include/asm-generic/setup.h
new file mode 100644
index 0000000000..0262ad49f9
--- /dev/null
+++ b/xen/include/asm-generic/setup.h
@@ -0,0 +1,148 @@
+#ifndef __ASM_GENERIC_SETUP_H__
+#define __ASM_GENERIC_SETUP_H__
+
+#define max_init_domid (0)
+
+#include <xen/bug.h>
+
+#include <public/version.h>
+#include <asm/p2m.h>
+#include <xen/device_tree.h>
+
+#define MIN_FDT_ALIGN 8
+#define MAX_FDT_SIZE SZ_2M
+
+#define NR_MEM_BANKS 256
+
+#define MAX_MODULES 32 /* Current maximum useful modules */
+
+typedef enum {
+    BOOTMOD_XEN,
+    BOOTMOD_FDT,
+    BOOTMOD_KERNEL,
+    BOOTMOD_RAMDISK,
+    BOOTMOD_XSM,
+    BOOTMOD_GUEST_DTB,
+    BOOTMOD_UNKNOWN
+}  bootmodule_kind;
+
+enum membank_type {
+    /*
+     * The MEMBANK_DEFAULT type refers to either reserved memory for the
+     * device/firmware (when the bank is in 'reserved_mem') or any RAM (when
+     * the bank is in 'mem').
+     */
+    MEMBANK_DEFAULT,
+    /*
+     * The MEMBANK_STATIC_DOMAIN type is used to indicate whether the memory
+     * bank is bound to a static Xen domain. It is only valid when the bank
+     * is in reserved_mem.
+     */
+    MEMBANK_STATIC_DOMAIN,
+    /*
+     * The MEMBANK_STATIC_HEAP type is used to indicate whether the memory
+     * bank is reserved as static heap. It is only valid when the bank is
+     * in reserved_mem.
+     */
+    MEMBANK_STATIC_HEAP,
+};
+
+/* Indicates the maximum number of characters(\0 included) for shm_id */
+#define MAX_SHM_ID_LENGTH 16
+
+struct membank {
+    paddr_t start;
+    paddr_t size;
+    enum membank_type type;
+};
+
+struct meminfo {
+    unsigned int nr_banks;
+    struct membank bank[NR_MEM_BANKS];
+};
+
+/*
+ * The domU flag is set for kernels and ramdisks of "xen,domain" nodes.
+ * The purpose of the domU flag is to avoid getting confused in
+ * kernel_probe, where we try to guess which is the dom0 kernel and
+ * initrd to be compatible with all versions of the multiboot spec.
+ */
+#define BOOTMOD_MAX_CMDLINE 1024
+struct bootmodule {
+    bootmodule_kind kind;
+    bool domU;
+    paddr_t start;
+    paddr_t size;
+};
+
+/* DT_MAX_NAME is the node name max length according the DT spec */
+#define DT_MAX_NAME 41
+struct bootcmdline {
+    bootmodule_kind kind;
+    bool domU;
+    paddr_t start;
+    char dt_name[DT_MAX_NAME];
+    char cmdline[BOOTMOD_MAX_CMDLINE];
+};
+
+struct bootmodules {
+    int nr_mods;
+    struct bootmodule module[MAX_MODULES];
+};
+
+struct bootcmdlines {
+    unsigned int nr_mods;
+    struct bootcmdline cmdline[MAX_MODULES];
+};
+
+struct bootinfo {
+    struct meminfo mem;
+    struct meminfo reserved_mem;
+    struct bootmodules modules;
+    struct bootcmdlines cmdlines;
+    bool static_heap;
+};
+
+extern struct bootinfo bootinfo;
+
+/*
+ * setup.c
+ */
+
+static inline bool check_reserved_regions_overlap(paddr_t region_start,
+                                                  paddr_t region_size)
+{
+    /* Not implemented on GENERIC */
+    BUG();
+}
+
+static inline struct bootmodule *add_boot_module(bootmodule_kind kind,
+                                                 paddr_t start, paddr_t size,
+                                                 bool domU)
+{
+    /* Not implemented on GENERIC */
+    BUG();
+}
+
+static inline void add_boot_cmdline(const char *name, const char *cmdline,
+                                    bootmodule_kind kind, paddr_t start,
+                                    bool domU)
+{
+    /* Not implemented on GENERIC */
+    BUG();
+}
+
+static inline const char *boot_module_kind_as_string(bootmodule_kind kind)
+{
+    /* Not implemented on GENERIC */
+    BUG();
+}
+
+static inline struct bootcmdline *boot_cmdline_find_by_kind(
+    bootmodule_kind kind)
+{
+    /* Not implemented on GENERIC */
+    BUG();
+}
+
+#endif /* __ASM_GENERIC_SETUP_H__ */
-- 
2.30.2



  parent reply	other threads:[~2023-12-15  2:52 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-15  2:43 [PATCH v2 0/7] Early Boot Allocation on Power Shawn Anastasio
2023-12-15  2:43 ` [PATCH v2 1/7] xen/asm-generic: Introduce generic static-shmem.h Shawn Anastasio
2023-12-19 17:07   ` Jan Beulich
2023-12-15  2:43 ` Shawn Anastasio [this message]
2023-12-20  7:23   ` [PATCH v2 2/7] xen/asm-generic: Introduce generic setup.h Jan Beulich
2023-12-20 11:09   ` Jan Beulich
2023-12-20 18:51     ` Shawn Anastasio
2023-12-15  2:43 ` [PATCH v2 3/7] xen/common: Move Arm's bootfdt to common Shawn Anastasio
2023-12-19 17:03   ` Jan Beulich
2023-12-19 18:29     ` Julien Grall
2023-12-20  8:09       ` Jan Beulich
2023-12-20 20:58         ` Shawn Anastasio
2023-12-20 22:08           ` Julien Grall
2023-12-20 22:10             ` Timothy Pearson
2023-12-21  7:11             ` Jan Beulich
2023-12-20 13:53   ` Julien Grall
2023-12-15  2:43 ` [PATCH v2 4/7] xen/device-tree: Fix bootfdt.c to tolerate 0 reserved regions Shawn Anastasio
2024-01-09 18:14   ` Julien Grall
2024-01-10  8:15     ` Michal Orzel
2024-01-11 22:56     ` Shawn Anastasio
2023-12-15  2:44 ` [PATCH v2 5/7] xen/ppc: Enable bootfdt and boot allocator Shawn Anastasio
2023-12-20 11:44   ` Jan Beulich
2023-12-20 13:23   ` Julien Grall
2023-12-20 16:07     ` Julien Grall
2023-12-20 13:49   ` Julien Grall
2024-01-18  1:36     ` Shawn Anastasio
2024-01-18  9:21       ` Julien Grall
2023-12-15  2:44 ` [PATCH v2 6/7] xen/ppc: mm-radix: Replace debug printing code with printk Shawn Anastasio
2023-12-20 11:48   ` Jan Beulich
2024-01-18  1:37     ` Shawn Anastasio
2023-12-15  2:44 ` [PATCH v2 7/7] xen/ppc: mm-radix: Allocate Partition and Process Tables at runtime Shawn Anastasio
2023-12-21  7:06   ` Jan Beulich
2024-03-14 18:29     ` Shawn Anastasio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1e4f48d753871bf61de3af97a3009e069d25d01e.1702607884.git.sanastasio@raptorengineering.com \
    --to=sanastasio@raptorengineering.com \
    --cc=jbeulich@suse.com \
    --cc=tpearson@raptorengineering.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.