From minios-devel-bounces@lists.xenproject.org Sat Jun 18 10:48:28 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sat, 18 Jun 2022 10:48:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.351761.578490 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2W09-00049h-HC; Sat, 18 Jun 2022 10:48:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 351761.578490; Sat, 18 Jun 2022 10:48:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2W09-00049a-Dh; Sat, 18 Jun 2022 10:48:25 +0000
Received: by outflank-mailman (input) for mailman id 351761;
 Sat, 18 Jun 2022 10:48:24 +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 <SRS0=c8TN=WZ=suse.com=jgross@srs-se1.protection.inumbo.net>)
 id 1o2W08-000499-4Z
 for minios-devel@lists.xenproject.org; Sat, 18 Jun 2022 10:48:24 +0000
Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 2a7d2a1e-eef4-11ec-bd2d-47488cf2e6aa;
 Sat, 18 Jun 2022 12:48:22 +0200 (CEST)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out2.suse.de (Postfix) with ESMTPS id 54F1D1FA6F;
 Sat, 18 Jun 2022 10:48:19 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 265B31348B;
 Sat, 18 Jun 2022 10:48:19 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id wDcACHOtrWIXKAAAMHmgww
 (envelope-from <jgross@suse.com>); Sat, 18 Jun 2022 10:48:19 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 2a7d2a1e-eef4-11ec-bd2d-47488cf2e6aa
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1655549299; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=yDDn1mSreaoh9MuJXeryyxgSIBKCF/BQ2diMJ00W4gc=;
	b=tot9UHjcC4L9sx2f56CUcELlvv/IVHFDTxeDcPAnz4Bj/i4fNtv5pPSqKmR/gLKf/HsxTo
	SYkKOWctuqnHNaPikTwIrJkl6w0g4R2sX5N9s2flNReoYoXm8Eab6uozGYNJtw/tBzQ0cq
	ydmFxdoJ7s1l6u7wTb2MAYCS9Ft63oY=
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH 2/3] mini-os: prefer memory map via start_info for PVH
Date: Sat, 18 Jun 2022 12:48:15 +0200
Message-Id: <20220618104816.11527-3-jgross@suse.com>
X-Mailer: git-send-email 2.35.3
In-Reply-To: <20220618104816.11527-1-jgross@suse.com>
References: <20220618104816.11527-1-jgross@suse.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Since some time now a guest started in PVH mode will get the memory
map from Xen via the start_info structure.

Modify the PVH initialization to prefer this memory map over the one
obtained via hypercall, as this will allow to add information to the
memory map for a new kernel when supporting kexec.

In case the start_info structure doesn't contain memory map information
fall back to the hypercall.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/mm.c  |  6 ++++++
 e820.c         | 25 +++++++++++++++++++++++++
 include/e820.h |  4 ++++
 3 files changed, 35 insertions(+)

diff --git a/arch/x86/mm.c b/arch/x86/mm.c
index 220c0b4d..41fcee67 100644
--- a/arch/x86/mm.c
+++ b/arch/x86/mm.c
@@ -45,6 +45,7 @@
 #include <mini-os/xmalloc.h>
 #include <mini-os/e820.h>
 #include <xen/memory.h>
+#include <xen/arch-x86/hvm/start_info.h>
 
 #ifdef MM_DEBUG
 #define DEBUG(_f, _a...) \
@@ -108,6 +109,11 @@ void arch_mm_preinit(void *p)
 {
     long ret;
     domid_t domid = DOMID_SELF;
+    struct hvm_start_info *hsi = p;
+
+    if ( hsi->version >= 1 && hsi->memmap_entries > 0 )
+        e820_init_memmap((struct hvm_memmap_table_entry *)(unsigned long)
+                         hsi->memmap_paddr, hsi->memmap_entries);
 
     pt_base = page_table_base;
     first_free_pfn = PFN_UP(to_phys(&_end));
diff --git a/e820.c b/e820.c
index 991ed382..ad91e00b 100644
--- a/e820.c
+++ b/e820.c
@@ -54,6 +54,7 @@ static char *e820_types[E820_TYPES] = {
     [E820_ACPI]     = "ACPI",
     [E820_NVS]      = "NVS",
     [E820_UNUSABLE] = "Unusable",
+    [E820_DISABLED] = "Disabled",
     [E820_PMEM]     = "PMEM"
 };
 
@@ -259,6 +260,30 @@ static void e820_get_memmap(void)
     e820_sanitize();
 }
 
+void e820_init_memmap(struct hvm_memmap_table_entry *entry, unsigned int num)
+{
+    unsigned int i;
+
+    BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_RAM != E820_RAM);
+    BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_RESERVED != E820_RESERVED);
+    BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_ACPI != E820_ACPI);
+    BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_NVS != E820_NVS);
+    BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_UNUSABLE != E820_UNUSABLE);
+    BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_DISABLED != E820_DISABLED);
+    BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_PMEM != E820_PMEM);
+
+    for ( i = 0; i < num; i++ )
+    {
+        e820_map[i].addr = entry[i].addr;
+        e820_map[i].size = entry[i].size;
+        e820_map[i].type = entry[i].type;
+    }
+
+    e820_entries = num;
+
+    e820_sanitize();
+}
+
 void arch_print_memmap(void)
 {
     int i;
diff --git a/include/e820.h b/include/e820.h
index aaf2f2ca..5438a7c8 100644
--- a/include/e820.h
+++ b/include/e820.h
@@ -26,6 +26,8 @@
 
 #if defined(__arm__) || defined(__aarch64__) || defined(CONFIG_PARAVIRT)
 #define CONFIG_E820_TRIVIAL
+#else
+#include <xen/arch-x86/hvm/start_info.h>
 #endif
 
 /* PC BIOS standard E820 types and structure. */
@@ -34,6 +36,7 @@
 #define E820_ACPI         3
 #define E820_NVS          4
 #define E820_UNUSABLE     5
+#define E820_DISABLED     6
 #define E820_PMEM         7
 #define E820_TYPES        8
 
@@ -54,6 +57,7 @@ unsigned long e820_get_max_contig_pages(unsigned long pfn, unsigned long pages);
 #ifndef CONFIG_E820_TRIVIAL
 unsigned long e820_get_reserved_pfns(int pages);
 void e820_put_reserved_pfns(unsigned long start_pfn, int pages);
+void e820_init_memmap(struct hvm_memmap_table_entry *entry, unsigned int num);
 #endif
 
 #endif /*__E820_HEADER*/
-- 
2.35.3



From minios-devel-bounces@lists.xenproject.org Sat Jun 18 10:48:28 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sat, 18 Jun 2022 10:48:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.351767.578528 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2W0C-0004kR-0z; Sat, 18 Jun 2022 10:48:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 351767.578528; Sat, 18 Jun 2022 10:48:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2W0B-0004it-O7; Sat, 18 Jun 2022 10:48:27 +0000
Received: by outflank-mailman (input) for mailman id 351767;
 Sat, 18 Jun 2022 10:48:26 +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 <SRS0=c8TN=WZ=suse.com=jgross@srs-se1.protection.inumbo.net>)
 id 1o2W09-000499-Vf
 for minios-devel@lists.xenproject.org; Sat, 18 Jun 2022 10:48:26 +0000
Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 2aa1b67a-eef4-11ec-bd2d-47488cf2e6aa;
 Sat, 18 Jun 2022 12:48:22 +0200 (CEST)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out2.suse.de (Postfix) with ESMTPS id 887A61FA72;
 Sat, 18 Jun 2022 10:48:19 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5AB461348B;
 Sat, 18 Jun 2022 10:48:19 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id iJjUFHOtrWIXKAAAMHmgww
 (envelope-from <jgross@suse.com>); Sat, 18 Jun 2022 10:48:19 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 2aa1b67a-eef4-11ec-bd2d-47488cf2e6aa
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1655549299; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=O7Ezlwl1sJwrsR+Lshf/i9Q310DW+uMi1RBHydn95TE=;
	b=ppXAcJl8tx1RGIqamUFhG9gpMhtvj6ECxnAMPfg+AW78PChXgHICCgKWoVNCW1yULseeny
	9tT2dAtdH600cuoxTX+s/pFLeEyO2F9xHSedyG/cwkOxkRB16oCMtk/+naorezL3W5cNuY
	tslEcxEQOHT7jMTS20aYMqiY04HM2A0=
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH 3/3] mini-os: fix number of pages for PVH
Date: Sat, 18 Jun 2022 12:48:16 +0200
Message-Id: <20220618104816.11527-4-jgross@suse.com>
X-Mailer: git-send-email 2.35.3
In-Reply-To: <20220618104816.11527-1-jgross@suse.com>
References: <20220618104816.11527-1-jgross@suse.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

When getting the current allocation from Xen, this value includes the
pages allocated in the MMIO area. Fix the highest available RAM page
by subtracting the size of that area.

This requires to read the E820 map before needing this value.

At the same time add the LAPIC page to the memory map in order to
avoid reusing that PFN for internal purposes.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/mm.c         |  4 +++-
 balloon.c             |  2 +-
 e820.c                | 28 +++++++++++++++++++++-------
 include/e820.h        |  1 +
 include/x86/arch_mm.h |  2 ++
 5 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/arch/x86/mm.c b/arch/x86/mm.c
index 41fcee67..37089978 100644
--- a/arch/x86/mm.c
+++ b/arch/x86/mm.c
@@ -114,6 +114,8 @@ void arch_mm_preinit(void *p)
     if ( hsi->version >= 1 && hsi->memmap_entries > 0 )
         e820_init_memmap((struct hvm_memmap_table_entry *)(unsigned long)
                          hsi->memmap_paddr, hsi->memmap_entries);
+    else
+        e820_init_memmap(NULL, 0);
 
     pt_base = page_table_base;
     first_free_pfn = PFN_UP(to_phys(&_end));
@@ -124,7 +126,7 @@ void arch_mm_preinit(void *p)
         do_exit();
     }
 
-    last_free_pfn = e820_get_maxpfn(ret);
+    last_free_pfn = e820_get_maxpfn(ret - e820_initial_reserved_pfns);
     balloon_set_nr_pages(ret, last_free_pfn);
 }
 #endif
diff --git a/balloon.c b/balloon.c
index 9dc77c54..779223de 100644
--- a/balloon.c
+++ b/balloon.c
@@ -54,7 +54,7 @@ void get_max_pages(void)
         return;
     }
 
-    nr_max_pages = ret;
+    nr_max_pages = ret - e820_initial_reserved_pfns;
     printk("Maximum memory size: %ld pages\n", nr_max_pages);
 
     nr_max_pfn = e820_get_maxpfn(nr_max_pages);
diff --git a/e820.c b/e820.c
index ad91e00b..c3047336 100644
--- a/e820.c
+++ b/e820.c
@@ -29,6 +29,8 @@
 #include <mini-os/e820.h>
 #include <xen/memory.h>
 
+unsigned int e820_initial_reserved_pfns;
+
 #ifdef CONFIG_E820_TRIVIAL
 struct e820entry e820_map[1] = {
     {
@@ -40,10 +42,6 @@ struct e820entry e820_map[1] = {
 
 unsigned e820_entries = 1;
 
-static void e820_get_memmap(void)
-{
-}
-
 #else
 struct e820entry e820_map[E820_MAX];
 unsigned e820_entries;
@@ -199,6 +197,7 @@ static void e820_sanitize(void)
 {
     int i;
     unsigned long end, start;
+    bool found_lapic = false;
 
     /* Sanitize memory map in current form. */
     e820_process_entries();
@@ -238,8 +237,20 @@ static void e820_sanitize(void)
 
     /* Make remaining temporarily reserved entries permanently reserved. */
     for ( i = 0; i < e820_entries; i++ )
+    {
         if ( e820_map[i].type == E820_TMP_RESERVED )
             e820_map[i].type = E820_RESERVED;
+        if ( e820_map[i].type == E820_RESERVED )
+        {
+            e820_initial_reserved_pfns += e820_map[i].size / PAGE_SIZE;
+            if ( e820_map[i].addr <= LAPIC_ADDRESS &&
+                 e820_map[i].addr + e820_map[i].size > LAPIC_ADDRESS )
+                found_lapic = true;
+        }
+    }
+
+    if ( !found_lapic )
+        e820_insert_entry(LAPIC_ADDRESS, PAGE_SIZE, E820_RESERVED);
 }
 
 static void e820_get_memmap(void)
@@ -264,6 +275,12 @@ void e820_init_memmap(struct hvm_memmap_table_entry *entry, unsigned int num)
 {
     unsigned int i;
 
+    if ( !entry )
+    {
+        e820_get_memmap();
+        return;
+    }
+
     BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_RAM != E820_RAM);
     BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_RESERVED != E820_RESERVED);
     BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_ACPI != E820_ACPI);
@@ -365,9 +382,6 @@ unsigned long e820_get_maxpfn(unsigned long pages)
     int i;
     unsigned long pfns = 0, start = 0;
 
-    if ( !e820_entries )
-        e820_get_memmap();
-
     for ( i = 0; i < e820_entries; i++ )
     {
         if ( e820_map[i].type != E820_RAM )
diff --git a/include/e820.h b/include/e820.h
index 5438a7c8..5533894e 100644
--- a/include/e820.h
+++ b/include/e820.h
@@ -51,6 +51,7 @@ struct __packed e820entry {
 
 extern struct e820entry e820_map[];
 extern unsigned e820_entries;
+extern unsigned int e820_initial_reserved_pfns;
 
 unsigned long e820_get_maxpfn(unsigned long pages);
 unsigned long e820_get_max_contig_pages(unsigned long pfn, unsigned long pages);
diff --git a/include/x86/arch_mm.h b/include/x86/arch_mm.h
index ffbec5a8..a1b975dc 100644
--- a/include/x86/arch_mm.h
+++ b/include/x86/arch_mm.h
@@ -207,6 +207,8 @@ typedef unsigned long pgentry_t;
 /* to align the pointer to the (next) page boundary */
 #define PAGE_ALIGN(addr)        (((addr)+PAGE_SIZE-1)&PAGE_MASK)
 
+#define LAPIC_ADDRESS	CONST(0xfee00000)
+
 #ifndef __ASSEMBLY__
 /* Definitions for machine and pseudophysical addresses. */
 #ifdef __i386__
-- 
2.35.3



From minios-devel-bounces@lists.xenproject.org Sat Jun 18 10:48:28 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sat, 18 Jun 2022 10:48:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.351766.578518 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2W0B-0004be-IP; Sat, 18 Jun 2022 10:48:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 351766.578518; Sat, 18 Jun 2022 10:48:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2W0B-0004aS-EP; Sat, 18 Jun 2022 10:48:27 +0000
Received: by outflank-mailman (input) for mailman id 351766;
 Sat, 18 Jun 2022 10:48:25 +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 <SRS0=c8TN=WZ=suse.com=jgross@srs-se1.protection.inumbo.net>)
 id 1o2W09-00049A-HS
 for minios-devel@lists.xenproject.org; Sat, 18 Jun 2022 10:48:25 +0000
Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 2a73de85-eef4-11ec-b725-ed86ccbb4733;
 Sat, 18 Jun 2022 12:48:22 +0200 (CEST)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out2.suse.de (Postfix) with ESMTPS id 1F9611F9BA;
 Sat, 18 Jun 2022 10:48:19 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E6E9C13776;
 Sat, 18 Jun 2022 10:48:18 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id MFkIN3KtrWIXKAAAMHmgww
 (envelope-from <jgross@suse.com>); Sat, 18 Jun 2022 10:48:18 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 2a73de85-eef4-11ec-b725-ed86ccbb4733
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1655549299; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=4sY7iEL9wOcvVypFP7Ls5tXz2Bjjv1VYhMj7YTitExc=;
	b=LiwkP9HIcZgOFPLalVxPbDczT1dYWrL9X0XquPtotLqX6wU67ClBSjGPx5sI5rJcNPCGtb
	RaydcL+h4bom+/IG5nROCYbmK+8qvvsQucjspqDH80fdEeRTr4KPaACkNzmXIFiXNskCAh
	YhgsLfEgTcAhyzKACWblSKA34KlLA6k=
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH 1/3] mini-os: take newest version of arch-x86/hvm/start_info.h
Date: Sat, 18 Jun 2022 12:48:14 +0200
Message-Id: <20220618104816.11527-2-jgross@suse.com>
X-Mailer: git-send-email 2.35.3
In-Reply-To: <20220618104816.11527-1-jgross@suse.com>
References: <20220618104816.11527-1-jgross@suse.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Update include/xen/arch-x86/hvm/start_info.h to the newest version
from the Xen tree.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 include/xen/arch-x86/hvm/start_info.h | 63 ++++++++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/include/xen/arch-x86/hvm/start_info.h b/include/xen/arch-x86/hvm/start_info.h
index 64841597..50af9ea2 100644
--- a/include/xen/arch-x86/hvm/start_info.h
+++ b/include/xen/arch-x86/hvm/start_info.h
@@ -33,7 +33,7 @@
  *    | magic          | Contains the magic value XEN_HVM_START_MAGIC_VALUE
  *    |                | ("xEn3" with the 0x80 bit of the "E" set).
  *  4 +----------------+
- *    | version        | Version of this structure. Current version is 0. New
+ *    | version        | Version of this structure. Current version is 1. New
  *    |                | versions are guaranteed to be backwards-compatible.
  *  8 +----------------+
  *    | flags          | SIF_xxx flags.
@@ -48,6 +48,15 @@
  * 32 +----------------+
  *    | rsdp_paddr     | Physical address of the RSDP ACPI data structure.
  * 40 +----------------+
+ *    | memmap_paddr   | Physical address of the (optional) memory map. Only
+ *    |                | present in version 1 and newer of the structure.
+ * 48 +----------------+
+ *    | memmap_entries | Number of entries in the memory map table. Zero
+ *    |                | if there is no memory map being provided. Only
+ *    |                | present in version 1 and newer of the structure.
+ * 52 +----------------+
+ *    | reserved       | Version 1 and newer only.
+ * 56 +----------------+
  *
  * The layout of each entry in the module structure is the following:
  *
@@ -62,13 +71,51 @@
  *    | reserved       |
  * 32 +----------------+
  *
+ * The layout of each entry in the memory map table is as follows:
+ *
+ *  0 +----------------+
+ *    | addr           | Base address
+ *  8 +----------------+
+ *    | size           | Size of mapping in bytes
+ * 16 +----------------+
+ *    | type           | Type of mapping as defined between the hypervisor
+ *    |                | and guest. See XEN_HVM_MEMMAP_TYPE_* values below.
+ * 20 +----------------|
+ *    | reserved       |
+ * 24 +----------------+
+ *
  * The address and sizes are always a 64bit little endian unsigned integer.
  *
  * NB: Xen on x86 will always try to place all the data below the 4GiB
  * boundary.
+ *
+ * Version numbers of the hvm_start_info structure have evolved like this:
+ *
+ * Version 0:  Initial implementation.
+ *
+ * Version 1:  Added the memmap_paddr/memmap_entries fields (plus 4 bytes of
+ *             padding) to the end of the hvm_start_info struct. These new
+ *             fields can be used to pass a memory map to the guest. The
+ *             memory map is optional and so guests that understand version 1
+ *             of the structure must check that memmap_entries is non-zero
+ *             before trying to read the memory map.
  */
 #define XEN_HVM_START_MAGIC_VALUE 0x336ec578
 
+/*
+ * The values used in the type field of the memory map table entries are
+ * defined below and match the Address Range Types as defined in the "System
+ * Address Map Interfaces" section of the ACPI Specification. Please refer to
+ * section 15 in version 6.2 of the ACPI spec: http://uefi.org/specifications
+ */
+#define XEN_HVM_MEMMAP_TYPE_RAM       1
+#define XEN_HVM_MEMMAP_TYPE_RESERVED  2
+#define XEN_HVM_MEMMAP_TYPE_ACPI      3
+#define XEN_HVM_MEMMAP_TYPE_NVS       4
+#define XEN_HVM_MEMMAP_TYPE_UNUSABLE  5
+#define XEN_HVM_MEMMAP_TYPE_DISABLED  6
+#define XEN_HVM_MEMMAP_TYPE_PMEM      7
+
 /*
  * C representation of the x86/HVM start info layout.
  *
@@ -86,6 +133,13 @@ struct hvm_start_info {
     uint64_t cmdline_paddr;     /* Physical address of the command line.     */
     uint64_t rsdp_paddr;        /* Physical address of the RSDP ACPI data    */
                                 /* structure.                                */
+    /* All following fields only present in version 1 and newer */
+    uint64_t memmap_paddr;      /* Physical address of an array of           */
+                                /* hvm_memmap_table_entry.                   */
+    uint32_t memmap_entries;    /* Number of entries in the memmap table.    */
+                                /* Value will be zero if there is no memory  */
+                                /* map being provided.                       */
+    uint32_t reserved;          /* Must be zero.                             */
 };
 
 struct hvm_modlist_entry {
@@ -95,4 +149,11 @@ struct hvm_modlist_entry {
     uint64_t reserved;
 };
 
+struct hvm_memmap_table_entry {
+    uint64_t addr;              /* Base address of the memory region         */
+    uint64_t size;              /* Size of the memory region in bytes        */
+    uint32_t type;              /* Mapping type                              */
+    uint32_t reserved;          /* Must be zero for Version 1.               */
+};
+
 #endif /* __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__ */
-- 
2.35.3



From minios-devel-bounces@lists.xenproject.org Sat Jun 18 10:48:28 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sat, 18 Jun 2022 10:48:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.351762.578496 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2W09-0004A2-OM; Sat, 18 Jun 2022 10:48:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 351762.578496; Sat, 18 Jun 2022 10:48:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2W09-00049l-FC; Sat, 18 Jun 2022 10:48:25 +0000
Received: by outflank-mailman (input) for mailman id 351762;
 Sat, 18 Jun 2022 10:48:24 +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 <SRS0=c8TN=WZ=suse.com=jgross@srs-se1.protection.inumbo.net>)
 id 1o2W08-00049A-J2
 for minios-devel@lists.xenproject.org; Sat, 18 Jun 2022 10:48:24 +0000
Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 2a73de96-eef4-11ec-b725-ed86ccbb4733;
 Sat, 18 Jun 2022 12:48:22 +0200 (CEST)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out2.suse.de (Postfix) with ESMTPS id EA8D81F99B;
 Sat, 18 Jun 2022 10:48:18 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B00241348B;
 Sat, 18 Jun 2022 10:48:18 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id 4ZpmKXKtrWIXKAAAMHmgww
 (envelope-from <jgross@suse.com>); Sat, 18 Jun 2022 10:48:18 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 2a73de96-eef4-11ec-b725-ed86ccbb4733
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1655549298; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:  content-transfer-encoding:content-transfer-encoding;
	bh=RInIqIonFLW15r0nOyuZItE2ii5IHR7IInXm5oJr6O0=;
	b=nBEPrLOR64DhcXkRffIHR5xzxr3hXwZdB7FIRtYxv+0g2L7x92RESUSUMG1QwoFxZ3WXbm
	xClM03iUTwX439VTp/VyJfEg0mxw46341i7CkZZFnlRPGHXdPoNfGqa7TJYDWsLMti7L09
	TrOyd0he9ZBFY1LP+s3gIxzcfpriY+s=
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH 0/3] mini-os: some memory map updates for PVH
Date: Sat, 18 Jun 2022 12:48:13 +0200
Message-Id: <20220618104816.11527-1-jgross@suse.com>
X-Mailer: git-send-email 2.35.3
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Do some memory map related changes/fixes for PVH mode:

- Prefer the memory map delivered via start-info over the one obtained
  from the hypervisor. This is a prerequisite for Xenstore-stubdom
  live-update with rising the memory limit.

- Fix a bug related to ballooning in PVH mode: PVH Xenstore-stubdom
  can't read its target memory size from Xenstore, as this introduces
  a chicken-and-egg problem. The memory size read from the hypervisor
  OTOH includes additional "special" pages marked as reserved in the
  memory map. Those pages need to be subtracted from the read size.

Juergen Gross (3):
  mini-os: take newest version of arch-x86/hvm/start_info.h
  mini-os: prefer memory map via start_info for PVH
  mini-os: fix number of pages for PVH

 arch/x86/mm.c                         | 10 ++++-
 balloon.c                             |  2 +-
 e820.c                                | 53 +++++++++++++++++++---
 include/e820.h                        |  5 +++
 include/x86/arch_mm.h                 |  2 +
 include/xen/arch-x86/hvm/start_info.h | 63 ++++++++++++++++++++++++++-
 6 files changed, 125 insertions(+), 10 deletions(-)

-- 
2.35.3



From minios-devel-bounces@lists.xenproject.org Sat Jun 18 12:13:36 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sat, 18 Jun 2022 12:13:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.351813.578550 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2XKW-0006zK-OR; Sat, 18 Jun 2022 12:13:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 351813.578550; Sat, 18 Jun 2022 12:13:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2XKW-0006zD-LT; Sat, 18 Jun 2022 12:13:32 +0000
Received: by outflank-mailman (input) for mailman id 351813;
 Sat, 18 Jun 2022 12:13:31 +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
 <SRS0=qCNw=WZ=ens-lyon.org=samuel.thibault@bounce.ens-lyon.org>)
 id 1o2XKV-0006z2-9v
 for minios-devel@lists.xenproject.org; Sat, 18 Jun 2022 12:13:31 +0000
Received: from sonata.ens-lyon.org (sonata.ens-lyon.org [140.77.166.138])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 1063b743-ef00-11ec-bd2d-47488cf2e6aa;
 Sat, 18 Jun 2022 14:13:30 +0200 (CEST)
Received: from localhost (localhost [127.0.0.1])
 by sonata.ens-lyon.org (Postfix) with ESMTP id A697D20157;
 Sat, 18 Jun 2022 14:13:28 +0200 (CEST)
Received: from sonata.ens-lyon.org ([127.0.0.1])
 by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id pdh_QtE20XQS; Sat, 18 Jun 2022 14:13:28 +0200 (CEST)
Received: from begin (cerbere11.aquilenet.fr [185.233.102.190])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest
 SHA256) (No client certificate requested)
 by sonata.ens-lyon.org (Postfix) with ESMTPSA id 7D6FB20154;
 Sat, 18 Jun 2022 14:13:28 +0200 (CEST)
Received: from samy by begin with local (Exim 4.95)
 (envelope-from <samuel.thibault@ens-lyon.org>) id 1o2XKS-00BaWL-DO;
 Sat, 18 Jun 2022 14:13:28 +0200
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 1063b743-ef00-11ec-bd2d-47488cf2e6aa
Date: Sat, 18 Jun 2022 14:13:28 +0200
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Juergen Gross <jgross@suse.com>
Cc: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org,
	wl@xen.org
Subject: Re: [PATCH 3/3] mini-os: fix number of pages for PVH
Message-ID: <20220618121328.54byw5ggucap6x5j@begin>
Mail-Followup-To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
	Juergen Gross <jgross@suse.com>, minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org, wl@xen.org
References: <20220618104816.11527-1-jgross@suse.com>
 <20220618104816.11527-4-jgross@suse.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20220618104816.11527-4-jgross@suse.com>
Organization: I am not organized
User-Agent: NeoMutt/20170609 (1.8.3)

Hello,

Juergen Gross, le sam. 18 juin 2022 12:48:16 +0200, a ecrit:
> @@ -124,7 +126,7 @@ void arch_mm_preinit(void *p)
>          do_exit();
>      }
>  
> -    last_free_pfn = e820_get_maxpfn(ret);
> +    last_free_pfn = e820_get_maxpfn(ret - e820_initial_reserved_pfns);

Mmm, but the reserved pfn could be in the middle of the e820 address
space.

Samuel


From minios-devel-bounces@lists.xenproject.org Sat Jun 18 12:13:49 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sat, 18 Jun 2022 12:13:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.351816.578576 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2XKn-0007c9-Bs; Sat, 18 Jun 2022 12:13:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 351816.578576; Sat, 18 Jun 2022 12:13:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2XKn-0007c0-8F; Sat, 18 Jun 2022 12:13:49 +0000
Received: by outflank-mailman (input) for mailman id 351816;
 Sat, 18 Jun 2022 12:13:47 +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
 <SRS0=qCNw=WZ=ens-lyon.org=samuel.thibault@bounce.ens-lyon.org>)
 id 1o2XKl-0006z2-EO
 for minios-devel@lists.xenproject.org; Sat, 18 Jun 2022 12:13:47 +0000
Received: from sonata.ens-lyon.org (sonata.ens-lyon.org [140.77.166.138])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 19b8cc89-ef00-11ec-bd2d-47488cf2e6aa;
 Sat, 18 Jun 2022 14:13:45 +0200 (CEST)
Received: from localhost (localhost [127.0.0.1])
 by sonata.ens-lyon.org (Postfix) with ESMTP id 1FE0D20157;
 Sat, 18 Jun 2022 14:13:45 +0200 (CEST)
Received: from sonata.ens-lyon.org ([127.0.0.1])
 by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id yy_byW0nzfZw; Sat, 18 Jun 2022 14:13:45 +0200 (CEST)
Received: from begin (cerbere11.aquilenet.fr [185.233.102.190])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest
 SHA256) (No client certificate requested)
 by sonata.ens-lyon.org (Postfix) with ESMTPSA id 039CC20154;
 Sat, 18 Jun 2022 14:13:45 +0200 (CEST)
Received: from samy by begin with local (Exim 4.95)
 (envelope-from <samuel.thibault@ens-lyon.org>) id 1o2XKi-00BaWW-97;
 Sat, 18 Jun 2022 14:13:44 +0200
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 19b8cc89-ef00-11ec-bd2d-47488cf2e6aa
Date: Sat, 18 Jun 2022 14:13:44 +0200
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Juergen Gross <jgross@suse.com>
Cc: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org,
	wl@xen.org
Subject: Re: [PATCH 1/3] mini-os: take newest version of
 arch-x86/hvm/start_info.h
Message-ID: <20220618121344.3nsrtgwvmdhnfvlq@begin>
Mail-Followup-To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
	Juergen Gross <jgross@suse.com>, minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org, wl@xen.org
References: <20220618104816.11527-1-jgross@suse.com>
 <20220618104816.11527-2-jgross@suse.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20220618104816.11527-2-jgross@suse.com>
Organization: I am not organized
User-Agent: NeoMutt/20170609 (1.8.3)

Juergen Gross, le sam. 18 juin 2022 12:48:14 +0200, a ecrit:
> Update include/xen/arch-x86/hvm/start_info.h to the newest version
> from the Xen tree.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

> ---
>  include/xen/arch-x86/hvm/start_info.h | 63 ++++++++++++++++++++++++++-
>  1 file changed, 62 insertions(+), 1 deletion(-)
> 
> diff --git a/include/xen/arch-x86/hvm/start_info.h b/include/xen/arch-x86/hvm/start_info.h
> index 64841597..50af9ea2 100644
> --- a/include/xen/arch-x86/hvm/start_info.h
> +++ b/include/xen/arch-x86/hvm/start_info.h
> @@ -33,7 +33,7 @@
>   *    | magic          | Contains the magic value XEN_HVM_START_MAGIC_VALUE
>   *    |                | ("xEn3" with the 0x80 bit of the "E" set).
>   *  4 +----------------+
> - *    | version        | Version of this structure. Current version is 0. New
> + *    | version        | Version of this structure. Current version is 1. New
>   *    |                | versions are guaranteed to be backwards-compatible.
>   *  8 +----------------+
>   *    | flags          | SIF_xxx flags.
> @@ -48,6 +48,15 @@
>   * 32 +----------------+
>   *    | rsdp_paddr     | Physical address of the RSDP ACPI data structure.
>   * 40 +----------------+
> + *    | memmap_paddr   | Physical address of the (optional) memory map. Only
> + *    |                | present in version 1 and newer of the structure.
> + * 48 +----------------+
> + *    | memmap_entries | Number of entries in the memory map table. Zero
> + *    |                | if there is no memory map being provided. Only
> + *    |                | present in version 1 and newer of the structure.
> + * 52 +----------------+
> + *    | reserved       | Version 1 and newer only.
> + * 56 +----------------+
>   *
>   * The layout of each entry in the module structure is the following:
>   *
> @@ -62,13 +71,51 @@
>   *    | reserved       |
>   * 32 +----------------+
>   *
> + * The layout of each entry in the memory map table is as follows:
> + *
> + *  0 +----------------+
> + *    | addr           | Base address
> + *  8 +----------------+
> + *    | size           | Size of mapping in bytes
> + * 16 +----------------+
> + *    | type           | Type of mapping as defined between the hypervisor
> + *    |                | and guest. See XEN_HVM_MEMMAP_TYPE_* values below.
> + * 20 +----------------|
> + *    | reserved       |
> + * 24 +----------------+
> + *
>   * The address and sizes are always a 64bit little endian unsigned integer.
>   *
>   * NB: Xen on x86 will always try to place all the data below the 4GiB
>   * boundary.
> + *
> + * Version numbers of the hvm_start_info structure have evolved like this:
> + *
> + * Version 0:  Initial implementation.
> + *
> + * Version 1:  Added the memmap_paddr/memmap_entries fields (plus 4 bytes of
> + *             padding) to the end of the hvm_start_info struct. These new
> + *             fields can be used to pass a memory map to the guest. The
> + *             memory map is optional and so guests that understand version 1
> + *             of the structure must check that memmap_entries is non-zero
> + *             before trying to read the memory map.
>   */
>  #define XEN_HVM_START_MAGIC_VALUE 0x336ec578
>  
> +/*
> + * The values used in the type field of the memory map table entries are
> + * defined below and match the Address Range Types as defined in the "System
> + * Address Map Interfaces" section of the ACPI Specification. Please refer to
> + * section 15 in version 6.2 of the ACPI spec: http://uefi.org/specifications
> + */
> +#define XEN_HVM_MEMMAP_TYPE_RAM       1
> +#define XEN_HVM_MEMMAP_TYPE_RESERVED  2
> +#define XEN_HVM_MEMMAP_TYPE_ACPI      3
> +#define XEN_HVM_MEMMAP_TYPE_NVS       4
> +#define XEN_HVM_MEMMAP_TYPE_UNUSABLE  5
> +#define XEN_HVM_MEMMAP_TYPE_DISABLED  6
> +#define XEN_HVM_MEMMAP_TYPE_PMEM      7
> +
>  /*
>   * C representation of the x86/HVM start info layout.
>   *
> @@ -86,6 +133,13 @@ struct hvm_start_info {
>      uint64_t cmdline_paddr;     /* Physical address of the command line.     */
>      uint64_t rsdp_paddr;        /* Physical address of the RSDP ACPI data    */
>                                  /* structure.                                */
> +    /* All following fields only present in version 1 and newer */
> +    uint64_t memmap_paddr;      /* Physical address of an array of           */
> +                                /* hvm_memmap_table_entry.                   */
> +    uint32_t memmap_entries;    /* Number of entries in the memmap table.    */
> +                                /* Value will be zero if there is no memory  */
> +                                /* map being provided.                       */
> +    uint32_t reserved;          /* Must be zero.                             */
>  };
>  
>  struct hvm_modlist_entry {
> @@ -95,4 +149,11 @@ struct hvm_modlist_entry {
>      uint64_t reserved;
>  };
>  
> +struct hvm_memmap_table_entry {
> +    uint64_t addr;              /* Base address of the memory region         */
> +    uint64_t size;              /* Size of the memory region in bytes        */
> +    uint32_t type;              /* Mapping type                              */
> +    uint32_t reserved;          /* Must be zero for Version 1.               */
> +};
> +
>  #endif /* __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__ */
> -- 
> 2.35.3
> 

-- 
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.


From minios-devel-bounces@lists.xenproject.org Sat Jun 18 12:14:14 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sat, 18 Jun 2022 12:14:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.351828.578579 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2XLC-00082u-DX; Sat, 18 Jun 2022 12:14:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 351828.578579; Sat, 18 Jun 2022 12:14:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2XLC-00082n-Ae; Sat, 18 Jun 2022 12:14:14 +0000
Received: by outflank-mailman (input) for mailman id 351828;
 Sat, 18 Jun 2022 12:14:12 +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
 <SRS0=qCNw=WZ=ens-lyon.org=samuel.thibault@bounce.ens-lyon.org>)
 id 1o2XLA-0007p5-54
 for minios-devel@lists.xenproject.org; Sat, 18 Jun 2022 12:14:12 +0000
Received: from sonata.ens-lyon.org (domu-toccata.ens-lyon.fr [140.77.166.138])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 28f3e525-ef00-11ec-b725-ed86ccbb4733;
 Sat, 18 Jun 2022 14:14:11 +0200 (CEST)
Received: from localhost (localhost [127.0.0.1])
 by sonata.ens-lyon.org (Postfix) with ESMTP id F36A220157;
 Sat, 18 Jun 2022 14:14:09 +0200 (CEST)
Received: from sonata.ens-lyon.org ([127.0.0.1])
 by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id YauqhsVtHHYl; Sat, 18 Jun 2022 14:14:09 +0200 (CEST)
Received: from begin (cerbere11.aquilenet.fr [185.233.102.190])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest
 SHA256) (No client certificate requested)
 by sonata.ens-lyon.org (Postfix) with ESMTPSA id DE9D220154;
 Sat, 18 Jun 2022 14:14:09 +0200 (CEST)
Received: from samy by begin with local (Exim 4.95)
 (envelope-from <samuel.thibault@ens-lyon.org>) id 1o2XL7-00BaWi-S0;
 Sat, 18 Jun 2022 14:14:09 +0200
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 28f3e525-ef00-11ec-b725-ed86ccbb4733
Date: Sat, 18 Jun 2022 14:14:09 +0200
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Juergen Gross <jgross@suse.com>
Cc: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org,
	wl@xen.org
Subject: Re: [PATCH 2/3] mini-os: prefer memory map via start_info for PVH
Message-ID: <20220618121409.mopy5vqf3z7gpjed@begin>
Mail-Followup-To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
	Juergen Gross <jgross@suse.com>, minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org, wl@xen.org
References: <20220618104816.11527-1-jgross@suse.com>
 <20220618104816.11527-3-jgross@suse.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20220618104816.11527-3-jgross@suse.com>
Organization: I am not organized
User-Agent: NeoMutt/20170609 (1.8.3)

Juergen Gross, le sam. 18 juin 2022 12:48:15 +0200, a ecrit:
> Since some time now a guest started in PVH mode will get the memory
> map from Xen via the start_info structure.
> 
> Modify the PVH initialization to prefer this memory map over the one
> obtained via hypercall, as this will allow to add information to the
> memory map for a new kernel when supporting kexec.
> 
> In case the start_info structure doesn't contain memory map information
> fall back to the hypercall.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

> ---
>  arch/x86/mm.c  |  6 ++++++
>  e820.c         | 25 +++++++++++++++++++++++++
>  include/e820.h |  4 ++++
>  3 files changed, 35 insertions(+)
> 
> diff --git a/arch/x86/mm.c b/arch/x86/mm.c
> index 220c0b4d..41fcee67 100644
> --- a/arch/x86/mm.c
> +++ b/arch/x86/mm.c
> @@ -45,6 +45,7 @@
>  #include <mini-os/xmalloc.h>
>  #include <mini-os/e820.h>
>  #include <xen/memory.h>
> +#include <xen/arch-x86/hvm/start_info.h>
>  
>  #ifdef MM_DEBUG
>  #define DEBUG(_f, _a...) \
> @@ -108,6 +109,11 @@ void arch_mm_preinit(void *p)
>  {
>      long ret;
>      domid_t domid = DOMID_SELF;
> +    struct hvm_start_info *hsi = p;
> +
> +    if ( hsi->version >= 1 && hsi->memmap_entries > 0 )
> +        e820_init_memmap((struct hvm_memmap_table_entry *)(unsigned long)
> +                         hsi->memmap_paddr, hsi->memmap_entries);
>  
>      pt_base = page_table_base;
>      first_free_pfn = PFN_UP(to_phys(&_end));
> diff --git a/e820.c b/e820.c
> index 991ed382..ad91e00b 100644
> --- a/e820.c
> +++ b/e820.c
> @@ -54,6 +54,7 @@ static char *e820_types[E820_TYPES] = {
>      [E820_ACPI]     = "ACPI",
>      [E820_NVS]      = "NVS",
>      [E820_UNUSABLE] = "Unusable",
> +    [E820_DISABLED] = "Disabled",
>      [E820_PMEM]     = "PMEM"
>  };
>  
> @@ -259,6 +260,30 @@ static void e820_get_memmap(void)
>      e820_sanitize();
>  }
>  
> +void e820_init_memmap(struct hvm_memmap_table_entry *entry, unsigned int num)
> +{
> +    unsigned int i;
> +
> +    BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_RAM != E820_RAM);
> +    BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_RESERVED != E820_RESERVED);
> +    BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_ACPI != E820_ACPI);
> +    BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_NVS != E820_NVS);
> +    BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_UNUSABLE != E820_UNUSABLE);
> +    BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_DISABLED != E820_DISABLED);
> +    BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_PMEM != E820_PMEM);
> +
> +    for ( i = 0; i < num; i++ )
> +    {
> +        e820_map[i].addr = entry[i].addr;
> +        e820_map[i].size = entry[i].size;
> +        e820_map[i].type = entry[i].type;
> +    }
> +
> +    e820_entries = num;
> +
> +    e820_sanitize();
> +}
> +
>  void arch_print_memmap(void)
>  {
>      int i;
> diff --git a/include/e820.h b/include/e820.h
> index aaf2f2ca..5438a7c8 100644
> --- a/include/e820.h
> +++ b/include/e820.h
> @@ -26,6 +26,8 @@
>  
>  #if defined(__arm__) || defined(__aarch64__) || defined(CONFIG_PARAVIRT)
>  #define CONFIG_E820_TRIVIAL
> +#else
> +#include <xen/arch-x86/hvm/start_info.h>
>  #endif
>  
>  /* PC BIOS standard E820 types and structure. */
> @@ -34,6 +36,7 @@
>  #define E820_ACPI         3
>  #define E820_NVS          4
>  #define E820_UNUSABLE     5
> +#define E820_DISABLED     6
>  #define E820_PMEM         7
>  #define E820_TYPES        8
>  
> @@ -54,6 +57,7 @@ unsigned long e820_get_max_contig_pages(unsigned long pfn, unsigned long pages);
>  #ifndef CONFIG_E820_TRIVIAL
>  unsigned long e820_get_reserved_pfns(int pages);
>  void e820_put_reserved_pfns(unsigned long start_pfn, int pages);
> +void e820_init_memmap(struct hvm_memmap_table_entry *entry, unsigned int num);
>  #endif
>  
>  #endif /*__E820_HEADER*/
> -- 
> 2.35.3
> 

-- 
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.


From minios-devel-bounces@lists.xenproject.org Sat Jun 18 14:07:14 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sat, 18 Jun 2022 14:07:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.351875.578625 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2Z6V-0003qO-R7; Sat, 18 Jun 2022 14:07:11 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 351875.578625; Sat, 18 Jun 2022 14:07:11 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2Z6V-0003pK-MZ; Sat, 18 Jun 2022 14:07:11 +0000
Received: by outflank-mailman (input) for mailman id 351875;
 Sat, 18 Jun 2022 14:07:10 +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 <SRS0=c8TN=WZ=suse.com=jgross@srs-se1.protection.inumbo.net>)
 id 1o2Z6U-0003mr-QX
 for minios-devel@lists.xenproject.org; Sat, 18 Jun 2022 14:07:10 +0000
Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id f0ea9b44-ef0f-11ec-b725-ed86ccbb4733;
 Sat, 18 Jun 2022 16:07:09 +0200 (CEST)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out2.suse.de (Postfix) with ESMTPS id 6AB331F74A;
 Sat, 18 Jun 2022 14:07:08 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3BABE1342C;
 Sat, 18 Jun 2022 14:07:08 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id hdGqDAzcrWJsYwAAMHmgww
 (envelope-from <jgross@suse.com>); Sat, 18 Jun 2022 14:07:08 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: f0ea9b44-ef0f-11ec-b725-ed86ccbb4733
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1655561228; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:
	 mime-version:mime-version:content-type:content-type:
	 in-reply-to:in-reply-to:references:references;
	bh=iJ5dO8R/0jN47PrOOM8KMUMIFakJdFFnhXMc95nQrRY=;
	b=WqxxO9gExdamolPAt72JjvvZZjNQOVhU0xeF+4sq5FaXmr71Ju76gYSuRGPq97OPIpj+Sz
	0htcfWGdjqRq76GczJSisAw0ZMobLn7cWdAlTtLfEE3qYpbXTLPTx0PKN71MAaxz0sn3mM
	6tPAD4c6MGbskTWkdxSQjl1VdM6ikpw=
Message-ID: <8815b69d-f687-3b0f-1b9c-6bd273cd3404@suse.com>
Date: Sat, 18 Jun 2022 16:07:07 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
 Thunderbird/91.9.0
Subject: Re: [PATCH 3/3] mini-os: fix number of pages for PVH
Content-Language: en-US
To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
 minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org, wl@xen.org
References: <20220618104816.11527-1-jgross@suse.com>
 <20220618104816.11527-4-jgross@suse.com>
 <20220618121328.54byw5ggucap6x5j@begin>
From: Juergen Gross <jgross@suse.com>
In-Reply-To: <20220618121328.54byw5ggucap6x5j@begin>
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="------------p9xLAeNx0XdfvcYeMBn0FF8F"

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--------------p9xLAeNx0XdfvcYeMBn0FF8F
Content-Type: multipart/mixed; boundary="------------E4wgi72Bwn6iiqNLXv2KDhkQ";
 protected-headers="v1"
From: Juergen Gross <jgross@suse.com>
To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
 minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org, wl@xen.org
Message-ID: <8815b69d-f687-3b0f-1b9c-6bd273cd3404@suse.com>
Subject: Re: [PATCH 3/3] mini-os: fix number of pages for PVH
References: <20220618104816.11527-1-jgross@suse.com>
 <20220618104816.11527-4-jgross@suse.com>
 <20220618121328.54byw5ggucap6x5j@begin>
In-Reply-To: <20220618121328.54byw5ggucap6x5j@begin>

--------------E4wgi72Bwn6iiqNLXv2KDhkQ
Content-Type: multipart/mixed; boundary="------------KvEEbbqzaVpnHYxCeQAofYnQ"

--------------KvEEbbqzaVpnHYxCeQAofYnQ
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: base64

T24gMTguMDYuMjIgMTQ6MTMsIFNhbXVlbCBUaGliYXVsdCB3cm90ZToNCj4gSGVsbG8sDQo+
IA0KPiBKdWVyZ2VuIEdyb3NzLCBsZSBzYW0uIDE4IGp1aW4gMjAyMiAxMjo0ODoxNiArMDIw
MCwgYSBlY3JpdDoNCj4+IEBAIC0xMjQsNyArMTI2LDcgQEAgdm9pZCBhcmNoX21tX3ByZWlu
aXQodm9pZCAqcCkNCj4+ICAgICAgICAgICBkb19leGl0KCk7DQo+PiAgICAgICB9DQo+PiAg
IA0KPj4gLSAgICBsYXN0X2ZyZWVfcGZuID0gZTgyMF9nZXRfbWF4cGZuKHJldCk7DQo+PiAr
ICAgIGxhc3RfZnJlZV9wZm4gPSBlODIwX2dldF9tYXhwZm4ocmV0IC0gZTgyMF9pbml0aWFs
X3Jlc2VydmVkX3BmbnMpOw0KPiANCj4gTW1tLCBidXQgdGhlIHJlc2VydmVkIHBmbiBjb3Vs
ZCBiZSBpbiB0aGUgbWlkZGxlIG9mIHRoZSBlODIwIGFkZHJlc3MNCj4gc3BhY2UuDQoNClRo
YXQgZG9lc24ndCBtYXR0ZXIuDQoNCmU4MjBfZ2V0X21heHBmbihuKSB3aWxsIGp1c3QgcmV0
dXJuIHRoZSBwZm4gb2YgdGhlIG4tdGggUkFNIHBmbiBpdCBpcw0KZmluZGluZyBpbiB0aGUg
RTgyMCBtYXAuIFRoaXMgc2hvdWxkIGJlIHRoZSBsYXN0IHBmbiB3aXRoIGFsbG9jYXRlZA0K
bWVtb3J5LiBXaXRob3V0IHN1YnRyYWN0aW5nIHRoZSBudW1iZXIgb2YgcmVzZXJ2ZWQgcGZu
cyAod2hpY2ggY29udGFpbg0Kbm9ybWFsbHkgbWVtb3J5IHdoaWNoIGlzIGFsbG9jYXRlZCBm
b3IgdGhlIGd1ZXN0LCBidXQgbm90IHVzYWJsZSBhcw0KUkFNKSwgTWluaS1PUyB0cmllcyB0
byB1c2UgUkFNIGJleW9uZCBpdHMgYWxsb2NhdGlvbiwgd2hpY2ggZmFpbHMuDQoNCg0KSnVl
cmdlbg0K
--------------KvEEbbqzaVpnHYxCeQAofYnQ
Content-Type: application/pgp-keys; name="OpenPGP_0xB0DE9DD628BF132F.asc"
Content-Disposition: attachment; filename="OpenPGP_0xB0DE9DD628BF132F.asc"
Content-Description: OpenPGP public key
Content-Transfer-Encoding: quoted-printable

-----BEGIN PGP PUBLIC KEY BLOCK-----

xsBNBFOMcBYBCACgGjqjoGvbEouQZw/ToiBg9W98AlM2QHV+iNHsEs7kxWhKMjri
oyspZKOBycWxw3ie3j9uvg9EOB3aN4xiTv4qbnGiTr3oJhkB1gsb6ToJQZ8uxGq2
kaV2KL9650I1SJvedYm8Of8Zd621lSmoKOwlNClALZNew72NjJLEzTalU1OdT7/i
1TXkH09XSSI8mEQ/ouNcMvIJNwQpd369y9bfIhWUiVXEK7MlRgUG6MvIj6Y3Am/B
BLUVbDa4+gmzDC9ezlZkTZG2t14zWPvxXP3FAp2pkW0xqG7/377qptDmrk42GlSK
N4z76ELnLxussxc7I2hx18NUcbP8+uty4bMxABEBAAHNHEp1ZXJnZW4gR3Jvc3Mg
PGpnQHBmdXBmLm5ldD7CwHkEEwECACMFAlOMcBYCGwMHCwkIBwMCAQYVCAIJCgsE
FgIDAQIeAQIXgAAKCRCw3p3WKL8TL0KdB/93FcIZ3GCNwFU0u3EjNbNjmXBKDY4F
UGNQH2lvWAUy+dnyThpwdtF/jQ6j9RwE8VP0+NXcYpGJDWlNb9/JmYqLiX2Q3Tye
vpB0CA3dbBQp0OW0fgCetToGIQrg0MbD1C/sEOv8Mr4NAfbauXjZlvTj30H2jO0u
+6WGM6nHwbh2l5O8ZiHkH32iaSTfN7Eu5RnNVUJbvoPHZ8SlM4KWm8rG+lIkGurq
qu5gu8q8ZMKdsdGC4bBxdQKDKHEFExLJK/nRPFmAuGlId1E3fe10v5QL+qHI3EIP
tyfE7i9Hz6rVwi7lWKgh7pe0ZvatAudZ+JNIlBKptb64FaiIOAWDCx1SzR9KdWVy
Z2VuIEdyb3NzIDxqZ3Jvc3NAc3VzZS5jb20+wsB5BBMBAgAjBQJTjHCvAhsDBwsJ
CAcDAgEGFQgCCQoLBBYCAwECHgECF4AACgkQsN6d1ii/Ey/HmQf/RtI7kv5A2PS4
RF7HoZhPVPogNVbC4YA6lW7DrWf0teC0RR3MzXfy6pJ+7KLgkqMlrAbN/8Dvjoz7
8X+5vhH/rDLa9BuZQlhFmvcGtCF8eR0T1v0nC/nuAFVGy+67q2DH8As3KPu0344T
BDpAvr2uYM4tSqxK4DURx5INz4ZZ0WNFHcqsfvlGJALDeE0LhITTd9jLzdDad1pQ
SToCnLl6SBJZjDOX9QQcyUigZFtCXFst4dlsvddrxyqT1f17+2cFSdu7+ynLmXBK
7abQ3rwJY8SbRO2iRulogc5vr/RLMMlscDAiDkaFQWLoqHHOdfO9rURssHNN8WkM
nQfvUewRz80hSnVlcmdlbiBHcm9zcyA8amdyb3NzQG5vdmVsbC5jb20+wsB5BBMB
AgAjBQJTjHDXAhsDBwsJCAcDAgEGFQgCCQoLBBYCAwECHgECF4AACgkQsN6d1ii/
Ey8PUQf/ehmgCI9jB9hlgexLvgOtf7PJnFOXgMLdBQgBlVPO3/D9R8LtF9DBAFPN
hlrsfIG/SqICoRCqUcJ96Pn3P7UUinFG/I0ECGF4EvTE1jnDkfJZr6jrbjgyoZHi
w/4BNwSTL9rWASyLgqlA8u1mf+c2yUwcGhgkRAd1gOwungxcwzwqgljf0N51N5Jf
VRHRtyfwq/ge+YEkDGcTU6Y0sPOuj4Dyfm8fJzdfHNQsWq3PnczLVELStJNdapwP
OoE+lotufe3AM2vAEYJ9rTz3Cki4JFUsgLkHFqGZarrPGi1eyQcXeluldO3m91NK
/1xMI3/+8jbO0tsn1tqSEUGIJi7ox80eSnVlcmdlbiBHcm9zcyA8amdyb3NzQHN1
c2UuZGU+wsB5BBMBAgAjBQJTjHDrAhsDBwsJCAcDAgEGFQgCCQoLBBYCAwECHgEC
F4AACgkQsN6d1ii/Ey+LhQf9GL45eU5vOowA2u5N3g3OZUEBmDHVVbqMtzwlmNC4
k9Kx39r5s2vcFl4tXqW7g9/ViXYuiDXb0RfUpZiIUW89siKrkzmQ5dM7wRqzgJpJ
wK8Bn2MIxAKArekWpiCKvBOB/Cc+3EXE78XdlxLyOi/NrmSGRIov0karw2RzMNOu
5D+jLRZQd1Sv27AR+IP3I8U4aqnhLpwhK7MEy9oCILlgZ1QZe49kpcumcZKORmzB
TNh30FVKK1EvmV2xAKDoaEOgQB4iFQLhJCdP1I5aSgM5IVFdn7v5YgEYuJYx37Io
N1EblHI//x/e2AaIHpzK5h88NEawQsaNRpNSrcfbFmAg987ATQRTjHAWAQgAyzH6
AOODMBjgfWE9VeCgsrwH3exNAU32gLq2xvjpWnHIs98ndPUDpnoxWQugJ6MpMncr
0xSwFmHEgnSEjK/PAjppgmyc57BwKII3sV4on+gDVFJR6Y8ZRwgnBC5mVM6JjQ5x
Dk8WRXljExRfUX9pNhdE5eBOZJrDRoLUmmjDtKzWaDhIg/+1Hzz93X4fCQkNVbVF
LELU9bMaLPBG/x5q4iYZ2k2ex6d47YE1ZFdMm6YBYMOljGkZKwYde5ldM9mo45mm
we0icXKLkpEdIXKTZeKDO+Hdv1aqFuAcccTg9RXDQjmwhC3yEmrmcfl0+rPghO0I
v3OOImwTEe4co3c1mwARAQABwsBfBBgBAgAJBQJTjHAWAhsMAAoJELDendYovxMv
Q/gH/1ha96vm4P/L+bQpJwrZ/dneZcmEwTbe8YFsw2V/Buv6Z4Mysln3nQK5ZadD
534CF7TDVft7fC4tU4PONxF5D+/tvgkPfDAfF77zy2AH1vJzQ1fOU8lYFpZXTXIH
b+559UqvIB8AdgR3SAJGHHt4RKA0F7f5ipYBBrC6cyXJyyoprT10EMvU8VGiwXvT
yJz3fjoYsdFzpWPlJEBRMedCot60g5dmbdrZ5DWClAr0yau47zpWj3enf1tLWaqc
suylWsviuGjKGw7KHQd3bxALOknAp4dN3QwBYCKuZ7AddY9yjynVaD5X7nF9nO5B
jR/i1DG86lem3iBDXzXsZDn8R38=3D
=3D2wuH
-----END PGP PUBLIC KEY BLOCK-----

--------------KvEEbbqzaVpnHYxCeQAofYnQ--

--------------E4wgi72Bwn6iiqNLXv2KDhkQ--

--------------p9xLAeNx0XdfvcYeMBn0FF8F
Content-Type: application/pgp-signature; name="OpenPGP_signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="OpenPGP_signature"

-----BEGIN PGP SIGNATURE-----

wsB5BAABCAAjFiEEhRJncuj2BJSl0Jf3sN6d1ii/Ey8FAmKt3AsFAwAAAAAACgkQsN6d1ii/Ey/Z
iwf/YdA1009qcPXsrTxCmMp/3SAyk1katT1ziIVATeduWpDSAKo5f29uSzZ2PZG+LYHh5M/AaM8n
9qTZ5wGiEdCANYMG6cbHkSE6f0b2/1oEJ3dqPrruA6FLcZgy93cpJrR+DETLG/Cadtq3+21lTwfJ
y9JtLftI1ycNzyd08NmZ5Z5E0wZoBSjE6R26iODOJtQICXtYPB9IT4XiwXGJZCe2bYZGCdBopcdr
ejSw3I6+yE3+X2dwZKPep2JHD7GuzEE+cveUf6dSo71F4ZbuEM6IVnWJWDDOnEBjxz7viLLtWtMs
nZjWRHnsjRsDion1jSUCkHYWTdaAbuWJQJYTAoX71A==
=aw8p
-----END PGP SIGNATURE-----

--------------p9xLAeNx0XdfvcYeMBn0FF8F--


From minios-devel-bounces@lists.xenproject.org Sat Jun 18 15:57:05 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sat, 18 Jun 2022 15:57:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.351935.578668 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2aon-00086V-MH; Sat, 18 Jun 2022 15:57:01 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 351935.578668; Sat, 18 Jun 2022 15:57:01 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2aon-00086D-HG; Sat, 18 Jun 2022 15:57:01 +0000
Received: by outflank-mailman (input) for mailman id 351935;
 Sat, 18 Jun 2022 15:57:00 +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
 <SRS0=qCNw=WZ=ens-lyon.org=samuel.thibault@bounce.ens-lyon.org>)
 id 1o2aom-00084J-My
 for minios-devel@lists.xenproject.org; Sat, 18 Jun 2022 15:57:00 +0000
Received: from sonata.ens-lyon.org (domu-toccata.ens-lyon.fr [140.77.166.138])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 4700c7ea-ef1f-11ec-bd2d-47488cf2e6aa;
 Sat, 18 Jun 2022 17:56:58 +0200 (CEST)
Received: from localhost (localhost [127.0.0.1])
 by sonata.ens-lyon.org (Postfix) with ESMTP id 986BC2015C;
 Sat, 18 Jun 2022 17:56:55 +0200 (CEST)
Received: from sonata.ens-lyon.org ([127.0.0.1])
 by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id KfNSFwHv7YZv; Sat, 18 Jun 2022 17:56:55 +0200 (CEST)
Received: from begin (201.52.205.77.rev.sfr.net [77.205.52.201])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest
 SHA256) (No client certificate requested)
 by sonata.ens-lyon.org (Postfix) with ESMTPSA id 5385A20003;
 Sat, 18 Jun 2022 17:56:55 +0200 (CEST)
Received: from samy by begin with local (Exim 4.95)
 (envelope-from <samuel.thibault@ens-lyon.org>) id 1o2aog-00Bc2C-Cm;
 Sat, 18 Jun 2022 17:56:54 +0200
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 4700c7ea-ef1f-11ec-bd2d-47488cf2e6aa
Date: Sat, 18 Jun 2022 17:56:54 +0200
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Juergen Gross <jgross@suse.com>
Cc: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org,
	wl@xen.org
Subject: Re: [PATCH 3/3] mini-os: fix number of pages for PVH
Message-ID: <20220618155654.kcvodnjcd7khwspl@begin>
Mail-Followup-To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
	Juergen Gross <jgross@suse.com>, minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org, wl@xen.org
References: <20220618104816.11527-1-jgross@suse.com>
 <20220618104816.11527-4-jgross@suse.com>
 <20220618121328.54byw5ggucap6x5j@begin>
 <8815b69d-f687-3b0f-1b9c-6bd273cd3404@suse.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <8815b69d-f687-3b0f-1b9c-6bd273cd3404@suse.com>
Organization: I am not organized
User-Agent: NeoMutt/20170609 (1.8.3)

Juergen Gross, le sam. 18 juin 2022 16:07:07 +0200, a ecrit:
> On 18.06.22 14:13, Samuel Thibault wrote:
> > Hello,
> > 
> > Juergen Gross, le sam. 18 juin 2022 12:48:16 +0200, a ecrit:
> > > @@ -124,7 +126,7 @@ void arch_mm_preinit(void *p)
> > >           do_exit();
> > >       }
> > > -    last_free_pfn = e820_get_maxpfn(ret);
> > > +    last_free_pfn = e820_get_maxpfn(ret - e820_initial_reserved_pfns);
> > 
> > Mmm, but the reserved pfn could be in the middle of the e820 address
> > space.
> 
> That doesn't matter.
> 
> e820_get_maxpfn(n) will just return the pfn of the n-th RAM pfn it is
> finding in the E820 map.

Yes, but subtracting at this point looks a bit hacky to me.

It seems to me that it'd be better to make e820_get_maxpfn count by
itself the reserved pages (but never return its pfn of course), rather
than having to make e820_sanitize look at the reserved pages, store
it somewhere, and hope that other code will remember to subtract that
before calling e820_get_maxpfn.

I mean something like:

unsigned long e820_get_maxpfn(unsigned long pages)
{
    int i;
    unsigned long pfns = 0, start = 0;

    if ( !e820_entries )
        e820_get_memmap();

    for ( i = 0; i < e820_entries; i++ )
    {
        pfns = e820_map[i].size >> PAGE_SHIFT;

	if ( e820_map[i].type == E820_RESERVED )
	{
	    /* This counts in the memory reservation, but is not usable */
            pages -= pfns;
	    continue;
	}
        if ( e820_map[i].type != E820_RAM )
            continue;

        start = e820_map[i].addr >> PAGE_SHIFT;
        if ( pages <= pfns )
            return start + pages;
        pages -= pfns;
    }

    return start + pfns;
}

Samuel


From minios-devel-bounces@lists.xenproject.org Sun Jun 19 05:52:02 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sun, 19 Jun 2022 05:52:02 +0000
Received: from list by lists.xenproject.org with outflank-mailman.352029.578738 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2nqo-0006Lu-7b; Sun, 19 Jun 2022 05:51:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 352029.578738; Sun, 19 Jun 2022 05:51:58 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2nqo-0006L1-3C; Sun, 19 Jun 2022 05:51:58 +0000
Received: by outflank-mailman (input) for mailman id 352029;
 Sun, 19 Jun 2022 05:51:57 +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 <SRS0=Ii8P=W2=suse.com=jgross@srs-se1.protection.inumbo.net>)
 id 1o2nqn-0006Ip-DD
 for minios-devel@lists.xenproject.org; Sun, 19 Jun 2022 05:51:57 +0000
Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id ec2cf6f0-ef93-11ec-b725-ed86ccbb4733;
 Sun, 19 Jun 2022 07:51:54 +0200 (CEST)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out1.suse.de (Postfix) with ESMTPS id 0E5A021DFC;
 Sun, 19 Jun 2022 05:51:54 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D3DD113458;
 Sun, 19 Jun 2022 05:51:53 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id XW4pMXm5rmILUAAAMHmgww
 (envelope-from <jgross@suse.com>); Sun, 19 Jun 2022 05:51:53 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: ec2cf6f0-ef93-11ec-b725-ed86ccbb4733
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1655617914; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:
	 mime-version:mime-version:content-type:content-type:
	 in-reply-to:in-reply-to:references:references;
	bh=L/RykbmL5s0TZXBBWPLquIWnkE/8q9vQJ3Ra5JnTDjg=;
	b=R8WLOD5Mn4bPjpJfsD1YbN0Bc44LOmMB0SI1FWSQhUzq6GQYtUpziDemDuaokPt8PqqhCW
	vZJbA6lahumenjpw5aJ1acSlYQqxg9e3IzOPUAlIOQYe/qN5nNyr/j8CjU2i0Sin06NcwC
	e4KvnZ72RS+VOB1WdjAQno6oEZ5B2lg=
Message-ID: <09d88287-a957-b89a-939a-7d39282e7d94@suse.com>
Date: Sun, 19 Jun 2022 07:51:53 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
 Thunderbird/91.9.0
Subject: Re: [PATCH 3/3] mini-os: fix number of pages for PVH
Content-Language: en-US
To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
 minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org, wl@xen.org
References: <20220618104816.11527-1-jgross@suse.com>
 <20220618104816.11527-4-jgross@suse.com>
 <20220618121328.54byw5ggucap6x5j@begin>
 <8815b69d-f687-3b0f-1b9c-6bd273cd3404@suse.com>
 <20220618155654.kcvodnjcd7khwspl@begin>
From: Juergen Gross <jgross@suse.com>
In-Reply-To: <20220618155654.kcvodnjcd7khwspl@begin>
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="------------5CgqcIrOffQ7QwdM0BKvXb4p"

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--------------5CgqcIrOffQ7QwdM0BKvXb4p
Content-Type: multipart/mixed; boundary="------------s0gT5wMZ48gjfVaL77yMyCbE";
 protected-headers="v1"
From: Juergen Gross <jgross@suse.com>
To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
 minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org, wl@xen.org
Message-ID: <09d88287-a957-b89a-939a-7d39282e7d94@suse.com>
Subject: Re: [PATCH 3/3] mini-os: fix number of pages for PVH
References: <20220618104816.11527-1-jgross@suse.com>
 <20220618104816.11527-4-jgross@suse.com>
 <20220618121328.54byw5ggucap6x5j@begin>
 <8815b69d-f687-3b0f-1b9c-6bd273cd3404@suse.com>
 <20220618155654.kcvodnjcd7khwspl@begin>
In-Reply-To: <20220618155654.kcvodnjcd7khwspl@begin>

--------------s0gT5wMZ48gjfVaL77yMyCbE
Content-Type: multipart/mixed; boundary="------------2GZMiMbs0NqV6DqwP8JmwmsF"

--------------2GZMiMbs0NqV6DqwP8JmwmsF
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: base64

T24gMTguMDYuMjIgMTc6NTYsIFNhbXVlbCBUaGliYXVsdCB3cm90ZToNCj4gSnVlcmdlbiBH
cm9zcywgbGUgc2FtLiAxOCBqdWluIDIwMjIgMTY6MDc6MDcgKzAyMDAsIGEgZWNyaXQ6DQo+
PiBPbiAxOC4wNi4yMiAxNDoxMywgU2FtdWVsIFRoaWJhdWx0IHdyb3RlOg0KPj4+IEhlbGxv
LA0KPj4+DQo+Pj4gSnVlcmdlbiBHcm9zcywgbGUgc2FtLiAxOCBqdWluIDIwMjIgMTI6NDg6
MTYgKzAyMDAsIGEgZWNyaXQ6DQo+Pj4+IEBAIC0xMjQsNyArMTI2LDcgQEAgdm9pZCBhcmNo
X21tX3ByZWluaXQodm9pZCAqcCkNCj4+Pj4gICAgICAgICAgICBkb19leGl0KCk7DQo+Pj4+
ICAgICAgICB9DQo+Pj4+IC0gICAgbGFzdF9mcmVlX3BmbiA9IGU4MjBfZ2V0X21heHBmbihy
ZXQpOw0KPj4+PiArICAgIGxhc3RfZnJlZV9wZm4gPSBlODIwX2dldF9tYXhwZm4ocmV0IC0g
ZTgyMF9pbml0aWFsX3Jlc2VydmVkX3BmbnMpOw0KPj4+DQo+Pj4gTW1tLCBidXQgdGhlIHJl
c2VydmVkIHBmbiBjb3VsZCBiZSBpbiB0aGUgbWlkZGxlIG9mIHRoZSBlODIwIGFkZHJlc3MN
Cj4+PiBzcGFjZS4NCj4+DQo+PiBUaGF0IGRvZXNuJ3QgbWF0dGVyLg0KPj4NCj4+IGU4MjBf
Z2V0X21heHBmbihuKSB3aWxsIGp1c3QgcmV0dXJuIHRoZSBwZm4gb2YgdGhlIG4tdGggUkFN
IHBmbiBpdCBpcw0KPj4gZmluZGluZyBpbiB0aGUgRTgyMCBtYXAuDQo+IA0KPiBZZXMsIGJ1
dCBzdWJ0cmFjdGluZyBhdCB0aGlzIHBvaW50IGxvb2tzIGEgYml0IGhhY2t5IHRvIG1lLg0K
PiANCj4gSXQgc2VlbXMgdG8gbWUgdGhhdCBpdCdkIGJlIGJldHRlciB0byBtYWtlIGU4MjBf
Z2V0X21heHBmbiBjb3VudCBieQ0KPiBpdHNlbGYgdGhlIHJlc2VydmVkIHBhZ2VzIChidXQg
bmV2ZXIgcmV0dXJuIGl0cyBwZm4gb2YgY291cnNlKSwgcmF0aGVyDQo+IHRoYW4gaGF2aW5n
IHRvIG1ha2UgZTgyMF9zYW5pdGl6ZSBsb29rIGF0IHRoZSByZXNlcnZlZCBwYWdlcywgc3Rv
cmUNCj4gaXQgc29tZXdoZXJlLCBhbmQgaG9wZSB0aGF0IG90aGVyIGNvZGUgd2lsbCByZW1l
bWJlciB0byBzdWJ0cmFjdCB0aGF0DQo+IGJlZm9yZSBjYWxsaW5nIGU4MjBfZ2V0X21heHBm
bi4NCj4gDQo+IEkgbWVhbiBzb21ldGhpbmcgbGlrZToNCj4gDQo+IHVuc2lnbmVkIGxvbmcg
ZTgyMF9nZXRfbWF4cGZuKHVuc2lnbmVkIGxvbmcgcGFnZXMpDQo+IHsNCj4gICAgICBpbnQg
aTsNCj4gICAgICB1bnNpZ25lZCBsb25nIHBmbnMgPSAwLCBzdGFydCA9IDA7DQo+IA0KPiAg
ICAgIGlmICggIWU4MjBfZW50cmllcyApDQo+ICAgICAgICAgIGU4MjBfZ2V0X21lbW1hcCgp
Ow0KPiANCj4gICAgICBmb3IgKCBpID0gMDsgaSA8IGU4MjBfZW50cmllczsgaSsrICkNCj4g
ICAgICB7DQo+ICAgICAgICAgIHBmbnMgPSBlODIwX21hcFtpXS5zaXplID4+IFBBR0VfU0hJ
RlQ7DQo+IA0KPiAJaWYgKCBlODIwX21hcFtpXS50eXBlID09IEU4MjBfUkVTRVJWRUQgKQ0K
PiAJew0KPiAJICAgIC8qIFRoaXMgY291bnRzIGluIHRoZSBtZW1vcnkgcmVzZXJ2YXRpb24s
IGJ1dCBpcyBub3QgdXNhYmxlICovDQo+ICAgICAgICAgICAgICBwYWdlcyAtPSBwZm5zOw0K
PiAJICAgIGNvbnRpbnVlOw0KPiAJfQ0KPiAgICAgICAgICBpZiAoIGU4MjBfbWFwW2ldLnR5
cGUgIT0gRTgyMF9SQU0gKQ0KPiAgICAgICAgICAgICAgY29udGludWU7DQo+IA0KPiAgICAg
ICAgICBzdGFydCA9IGU4MjBfbWFwW2ldLmFkZHIgPj4gUEFHRV9TSElGVDsNCj4gICAgICAg
ICAgaWYgKCBwYWdlcyA8PSBwZm5zICkNCj4gICAgICAgICAgICAgIHJldHVybiBzdGFydCAr
IHBhZ2VzOw0KPiAgICAgICAgICBwYWdlcyAtPSBwZm5zOw0KPiAgICAgIH0NCj4gDQo+ICAg
ICAgcmV0dXJuIHN0YXJ0ICsgcGZuczsNCj4gfQ0KDQpUaGlzIHdvdWxkIGxlYWQgdG8gd3Jv
bmcgdmFsdWVzIG9mIG5yX21lbV9wYWdlcy4gSSB0aGluayB0aGUgYmVzdCBzb2x1dGlvbg0K
d291bGQgYmUgdG8gaGF2ZSBmdW5jdGlvbnMgcmV0dXJuaW5nIHRoZSBudW1iZXIgb2YgYXZh
aWxhYmxlIGFuZCBtYXggUkFNDQpwYWdlcyB0byBlODIwLmMuIFRoaXMgd291bGQgYWRkcmVz
cyB5b3VyIHZhbGlkIGNvbmNlcm4sIHdoaWxlIG5vdCBsZWFkaW5nDQp0byB3cm9uZyB2YWx1
ZXMgYXQgdGhlIGNhbGxlcnMgc2lkZS4NCg0KDQpKdWVyZ2VuDQo=
--------------2GZMiMbs0NqV6DqwP8JmwmsF
Content-Type: application/pgp-keys; name="OpenPGP_0xB0DE9DD628BF132F.asc"
Content-Disposition: attachment; filename="OpenPGP_0xB0DE9DD628BF132F.asc"
Content-Description: OpenPGP public key
Content-Transfer-Encoding: quoted-printable

-----BEGIN PGP PUBLIC KEY BLOCK-----

xsBNBFOMcBYBCACgGjqjoGvbEouQZw/ToiBg9W98AlM2QHV+iNHsEs7kxWhKMjri
oyspZKOBycWxw3ie3j9uvg9EOB3aN4xiTv4qbnGiTr3oJhkB1gsb6ToJQZ8uxGq2
kaV2KL9650I1SJvedYm8Of8Zd621lSmoKOwlNClALZNew72NjJLEzTalU1OdT7/i
1TXkH09XSSI8mEQ/ouNcMvIJNwQpd369y9bfIhWUiVXEK7MlRgUG6MvIj6Y3Am/B
BLUVbDa4+gmzDC9ezlZkTZG2t14zWPvxXP3FAp2pkW0xqG7/377qptDmrk42GlSK
N4z76ELnLxussxc7I2hx18NUcbP8+uty4bMxABEBAAHNHEp1ZXJnZW4gR3Jvc3Mg
PGpnQHBmdXBmLm5ldD7CwHkEEwECACMFAlOMcBYCGwMHCwkIBwMCAQYVCAIJCgsE
FgIDAQIeAQIXgAAKCRCw3p3WKL8TL0KdB/93FcIZ3GCNwFU0u3EjNbNjmXBKDY4F
UGNQH2lvWAUy+dnyThpwdtF/jQ6j9RwE8VP0+NXcYpGJDWlNb9/JmYqLiX2Q3Tye
vpB0CA3dbBQp0OW0fgCetToGIQrg0MbD1C/sEOv8Mr4NAfbauXjZlvTj30H2jO0u
+6WGM6nHwbh2l5O8ZiHkH32iaSTfN7Eu5RnNVUJbvoPHZ8SlM4KWm8rG+lIkGurq
qu5gu8q8ZMKdsdGC4bBxdQKDKHEFExLJK/nRPFmAuGlId1E3fe10v5QL+qHI3EIP
tyfE7i9Hz6rVwi7lWKgh7pe0ZvatAudZ+JNIlBKptb64FaiIOAWDCx1SzR9KdWVy
Z2VuIEdyb3NzIDxqZ3Jvc3NAc3VzZS5jb20+wsB5BBMBAgAjBQJTjHCvAhsDBwsJ
CAcDAgEGFQgCCQoLBBYCAwECHgECF4AACgkQsN6d1ii/Ey/HmQf/RtI7kv5A2PS4
RF7HoZhPVPogNVbC4YA6lW7DrWf0teC0RR3MzXfy6pJ+7KLgkqMlrAbN/8Dvjoz7
8X+5vhH/rDLa9BuZQlhFmvcGtCF8eR0T1v0nC/nuAFVGy+67q2DH8As3KPu0344T
BDpAvr2uYM4tSqxK4DURx5INz4ZZ0WNFHcqsfvlGJALDeE0LhITTd9jLzdDad1pQ
SToCnLl6SBJZjDOX9QQcyUigZFtCXFst4dlsvddrxyqT1f17+2cFSdu7+ynLmXBK
7abQ3rwJY8SbRO2iRulogc5vr/RLMMlscDAiDkaFQWLoqHHOdfO9rURssHNN8WkM
nQfvUewRz80hSnVlcmdlbiBHcm9zcyA8amdyb3NzQG5vdmVsbC5jb20+wsB5BBMB
AgAjBQJTjHDXAhsDBwsJCAcDAgEGFQgCCQoLBBYCAwECHgECF4AACgkQsN6d1ii/
Ey8PUQf/ehmgCI9jB9hlgexLvgOtf7PJnFOXgMLdBQgBlVPO3/D9R8LtF9DBAFPN
hlrsfIG/SqICoRCqUcJ96Pn3P7UUinFG/I0ECGF4EvTE1jnDkfJZr6jrbjgyoZHi
w/4BNwSTL9rWASyLgqlA8u1mf+c2yUwcGhgkRAd1gOwungxcwzwqgljf0N51N5Jf
VRHRtyfwq/ge+YEkDGcTU6Y0sPOuj4Dyfm8fJzdfHNQsWq3PnczLVELStJNdapwP
OoE+lotufe3AM2vAEYJ9rTz3Cki4JFUsgLkHFqGZarrPGi1eyQcXeluldO3m91NK
/1xMI3/+8jbO0tsn1tqSEUGIJi7ox80eSnVlcmdlbiBHcm9zcyA8amdyb3NzQHN1
c2UuZGU+wsB5BBMBAgAjBQJTjHDrAhsDBwsJCAcDAgEGFQgCCQoLBBYCAwECHgEC
F4AACgkQsN6d1ii/Ey+LhQf9GL45eU5vOowA2u5N3g3OZUEBmDHVVbqMtzwlmNC4
k9Kx39r5s2vcFl4tXqW7g9/ViXYuiDXb0RfUpZiIUW89siKrkzmQ5dM7wRqzgJpJ
wK8Bn2MIxAKArekWpiCKvBOB/Cc+3EXE78XdlxLyOi/NrmSGRIov0karw2RzMNOu
5D+jLRZQd1Sv27AR+IP3I8U4aqnhLpwhK7MEy9oCILlgZ1QZe49kpcumcZKORmzB
TNh30FVKK1EvmV2xAKDoaEOgQB4iFQLhJCdP1I5aSgM5IVFdn7v5YgEYuJYx37Io
N1EblHI//x/e2AaIHpzK5h88NEawQsaNRpNSrcfbFmAg987ATQRTjHAWAQgAyzH6
AOODMBjgfWE9VeCgsrwH3exNAU32gLq2xvjpWnHIs98ndPUDpnoxWQugJ6MpMncr
0xSwFmHEgnSEjK/PAjppgmyc57BwKII3sV4on+gDVFJR6Y8ZRwgnBC5mVM6JjQ5x
Dk8WRXljExRfUX9pNhdE5eBOZJrDRoLUmmjDtKzWaDhIg/+1Hzz93X4fCQkNVbVF
LELU9bMaLPBG/x5q4iYZ2k2ex6d47YE1ZFdMm6YBYMOljGkZKwYde5ldM9mo45mm
we0icXKLkpEdIXKTZeKDO+Hdv1aqFuAcccTg9RXDQjmwhC3yEmrmcfl0+rPghO0I
v3OOImwTEe4co3c1mwARAQABwsBfBBgBAgAJBQJTjHAWAhsMAAoJELDendYovxMv
Q/gH/1ha96vm4P/L+bQpJwrZ/dneZcmEwTbe8YFsw2V/Buv6Z4Mysln3nQK5ZadD
534CF7TDVft7fC4tU4PONxF5D+/tvgkPfDAfF77zy2AH1vJzQ1fOU8lYFpZXTXIH
b+559UqvIB8AdgR3SAJGHHt4RKA0F7f5ipYBBrC6cyXJyyoprT10EMvU8VGiwXvT
yJz3fjoYsdFzpWPlJEBRMedCot60g5dmbdrZ5DWClAr0yau47zpWj3enf1tLWaqc
suylWsviuGjKGw7KHQd3bxALOknAp4dN3QwBYCKuZ7AddY9yjynVaD5X7nF9nO5B
jR/i1DG86lem3iBDXzXsZDn8R38=3D
=3D2wuH
-----END PGP PUBLIC KEY BLOCK-----

--------------2GZMiMbs0NqV6DqwP8JmwmsF--

--------------s0gT5wMZ48gjfVaL77yMyCbE--

--------------5CgqcIrOffQ7QwdM0BKvXb4p
Content-Type: application/pgp-signature; name="OpenPGP_signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="OpenPGP_signature"

-----BEGIN PGP SIGNATURE-----

wsB5BAABCAAjFiEEhRJncuj2BJSl0Jf3sN6d1ii/Ey8FAmKuuXkFAwAAAAAACgkQsN6d1ii/Ey+J
QAgAn3f11VEGbKSa2SRSCF/1x2iiXgwNnUvcFA1z7a1JG6vCKdmWNoHGgHyORIsEpNsiruAsViRw
W/jLjS7+u3oC5pe/VsF8E4S19+OgGFjztzwaB6TgDp+hDyMv7VGrr05phmL3TI8Pt/xWXdQQIEWI
QEbbOnHWr0IAplWPxBJvTFmxUU9ww3N674k0vFxgtaPg+41ZDSrCfUZ9UM6CeNYRyD903JsM0tMw
LM5I5jNc49v+w5ZsBgecMb9SbqUxa46pqs17CGaMRuEiAWkPN6ZggBJgxZ7vQ2RPUvG6rC0bouxi
RjPAEc0l+sGi6eREfJaZBVA3Dn7kRBkMlrqrKuABeQ==
=7Qeu
-----END PGP SIGNATURE-----

--------------5CgqcIrOffQ7QwdM0BKvXb4p--


From minios-devel-bounces@lists.xenproject.org Sun Jun 19 06:53:02 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sun, 19 Jun 2022 06:53:02 +0000
Received: from list by lists.xenproject.org with outflank-mailman.352041.578760 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2onr-0004V1-S0; Sun, 19 Jun 2022 06:52:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 352041.578760; Sun, 19 Jun 2022 06:52:59 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2onr-0004Uu-Op; Sun, 19 Jun 2022 06:52:59 +0000
Received: by outflank-mailman (input) for mailman id 352041;
 Sun, 19 Jun 2022 06:52:58 +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 <SRS0=Ii8P=W2=suse.com=jgross@srs-se1.protection.inumbo.net>)
 id 1o2onp-0004F7-WC
 for minios-devel@lists.xenproject.org; Sun, 19 Jun 2022 06:52:58 +0000
Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 728ce77f-ef9c-11ec-bd2d-47488cf2e6aa;
 Sun, 19 Jun 2022 08:52:56 +0200 (CEST)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out2.suse.de (Postfix) with ESMTPS id 811D61F97A;
 Sun, 19 Jun 2022 06:52:55 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5661213A5D;
 Sun, 19 Jun 2022 06:52:55 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id 0LDUE8fHrmJzXgAAMHmgww
 (envelope-from <jgross@suse.com>); Sun, 19 Jun 2022 06:52:55 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 728ce77f-ef9c-11ec-bd2d-47488cf2e6aa
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1655621575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=sqQB2mee0jCv15NOcWCx6SVOgjnvvSzpgTYbgdXHN/4=;
	b=ie4i4WPFQ6OSeuhCBDRpD7dx5s2n3JIx76lUv+g0jwcY8mwvKpG8rLUm6Am95jytnv96e8
	6Uo4Sv8YMiI0TMsao5RTw7M+vEU7XdeD8fvmcpWra+lOqBUVZOoL2fpFbZfvR4PJVaPnqD
	ZCeZyyxWvVnQ6hGd1aMgySeYJDkhe70=
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH v2 2/4] mini-os: prefer memory map via start_info for PVH
Date: Sun, 19 Jun 2022 08:52:51 +0200
Message-Id: <20220619065253.19503-3-jgross@suse.com>
X-Mailer: git-send-email 2.35.3
In-Reply-To: <20220619065253.19503-1-jgross@suse.com>
References: <20220619065253.19503-1-jgross@suse.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Since some time now a guest started in PVH mode will get the memory
map from Xen via the start_info structure.

Modify the PVH initialization to prefer this memory map over the one
obtained via hypercall, as this will allow to add information to the
memory map for a new kernel when supporting kexec.

In case the start_info structure doesn't contain memory map information
fall back to the hypercall.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 arch/x86/mm.c  |  6 ++++++
 e820.c         | 25 +++++++++++++++++++++++++
 include/e820.h |  4 ++++
 3 files changed, 35 insertions(+)

diff --git a/arch/x86/mm.c b/arch/x86/mm.c
index 220c0b4d..41fcee67 100644
--- a/arch/x86/mm.c
+++ b/arch/x86/mm.c
@@ -45,6 +45,7 @@
 #include <mini-os/xmalloc.h>
 #include <mini-os/e820.h>
 #include <xen/memory.h>
+#include <xen/arch-x86/hvm/start_info.h>
 
 #ifdef MM_DEBUG
 #define DEBUG(_f, _a...) \
@@ -108,6 +109,11 @@ void arch_mm_preinit(void *p)
 {
     long ret;
     domid_t domid = DOMID_SELF;
+    struct hvm_start_info *hsi = p;
+
+    if ( hsi->version >= 1 && hsi->memmap_entries > 0 )
+        e820_init_memmap((struct hvm_memmap_table_entry *)(unsigned long)
+                         hsi->memmap_paddr, hsi->memmap_entries);
 
     pt_base = page_table_base;
     first_free_pfn = PFN_UP(to_phys(&_end));
diff --git a/e820.c b/e820.c
index 991ed382..ad91e00b 100644
--- a/e820.c
+++ b/e820.c
@@ -54,6 +54,7 @@ static char *e820_types[E820_TYPES] = {
     [E820_ACPI]     = "ACPI",
     [E820_NVS]      = "NVS",
     [E820_UNUSABLE] = "Unusable",
+    [E820_DISABLED] = "Disabled",
     [E820_PMEM]     = "PMEM"
 };
 
@@ -259,6 +260,30 @@ static void e820_get_memmap(void)
     e820_sanitize();
 }
 
+void e820_init_memmap(struct hvm_memmap_table_entry *entry, unsigned int num)
+{
+    unsigned int i;
+
+    BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_RAM != E820_RAM);
+    BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_RESERVED != E820_RESERVED);
+    BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_ACPI != E820_ACPI);
+    BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_NVS != E820_NVS);
+    BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_UNUSABLE != E820_UNUSABLE);
+    BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_DISABLED != E820_DISABLED);
+    BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_PMEM != E820_PMEM);
+
+    for ( i = 0; i < num; i++ )
+    {
+        e820_map[i].addr = entry[i].addr;
+        e820_map[i].size = entry[i].size;
+        e820_map[i].type = entry[i].type;
+    }
+
+    e820_entries = num;
+
+    e820_sanitize();
+}
+
 void arch_print_memmap(void)
 {
     int i;
diff --git a/include/e820.h b/include/e820.h
index aaf2f2ca..5438a7c8 100644
--- a/include/e820.h
+++ b/include/e820.h
@@ -26,6 +26,8 @@
 
 #if defined(__arm__) || defined(__aarch64__) || defined(CONFIG_PARAVIRT)
 #define CONFIG_E820_TRIVIAL
+#else
+#include <xen/arch-x86/hvm/start_info.h>
 #endif
 
 /* PC BIOS standard E820 types and structure. */
@@ -34,6 +36,7 @@
 #define E820_ACPI         3
 #define E820_NVS          4
 #define E820_UNUSABLE     5
+#define E820_DISABLED     6
 #define E820_PMEM         7
 #define E820_TYPES        8
 
@@ -54,6 +57,7 @@ unsigned long e820_get_max_contig_pages(unsigned long pfn, unsigned long pages);
 #ifndef CONFIG_E820_TRIVIAL
 unsigned long e820_get_reserved_pfns(int pages);
 void e820_put_reserved_pfns(unsigned long start_pfn, int pages);
+void e820_init_memmap(struct hvm_memmap_table_entry *entry, unsigned int num);
 #endif
 
 #endif /*__E820_HEADER*/
-- 
2.35.3



From minios-devel-bounces@lists.xenproject.org Sun Jun 19 06:53:02 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sun, 19 Jun 2022 06:53:02 +0000
Received: from list by lists.xenproject.org with outflank-mailman.352043.578774 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2ont-0004mO-5Q; Sun, 19 Jun 2022 06:53:01 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 352043.578774; Sun, 19 Jun 2022 06:53:01 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2ont-0004mH-2Y; Sun, 19 Jun 2022 06:53:01 +0000
Received: by outflank-mailman (input) for mailman id 352043;
 Sun, 19 Jun 2022 06:52:59 +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 <SRS0=Ii8P=W2=suse.com=jgross@srs-se1.protection.inumbo.net>)
 id 1o2onr-0004F8-9v
 for minios-devel@lists.xenproject.org; Sun, 19 Jun 2022 06:52:59 +0000
Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 729e91ac-ef9c-11ec-b725-ed86ccbb4733;
 Sun, 19 Jun 2022 08:52:56 +0200 (CEST)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out2.suse.de (Postfix) with ESMTPS id B4EF71FD3C;
 Sun, 19 Jun 2022 06:52:55 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 890F613427;
 Sun, 19 Jun 2022 06:52:55 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id 0N8WIMfHrmJzXgAAMHmgww
 (envelope-from <jgross@suse.com>); Sun, 19 Jun 2022 06:52:55 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 729e91ac-ef9c-11ec-b725-ed86ccbb4733
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1655621575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=AOnLOnXpUKuT3ZPKKnEQ4FE2kaPgsf79zVn7fKehw7c=;
	b=knRVAWHAzL0m/Y+Fs5C2n5U+iUHX+9kgJTQhx1NO+HLVnYAh5AoF3wi2Il6tQn7iQWz9ue
	XKQBW76Ryf05GP6VcIeY/BuwscFh6ue/NXJRKpapM9IiZsuNsiLwpuBMPhgp3sjE5moSLa
	3/5eq5KaAtkRC5X4LLBuYaSPL8ok3VA=
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH v2 3/4] mini-os: fix number of pages for PVH
Date: Sun, 19 Jun 2022 08:52:52 +0200
Message-Id: <20220619065253.19503-4-jgross@suse.com>
X-Mailer: git-send-email 2.35.3
In-Reply-To: <20220619065253.19503-1-jgross@suse.com>
References: <20220619065253.19503-1-jgross@suse.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

When getting the current allocation from Xen, this value includes the
pages allocated in the MMIO area. Fix the highest available RAM page
by subtracting the size of that area.

This requires to read the E820 map before needing this value. Add two
functions returning the current and the maximum number of RAM pages
taking this correction into account.

At the same time add the LAPIC page to the memory map in order to
avoid reusing that PFN for internal purposes.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
V2:
- make e820_initial_reserved_pfns static (Samuel Thibault)
- add e820_get_current_pages() and e820_get_max_pages()
---
 arch/x86/mm.c         | 17 +++++--------
 balloon.c             | 16 +++---------
 e820.c                | 58 +++++++++++++++++++++++++++++++++++++------
 include/e820.h        |  2 ++
 include/x86/arch_mm.h |  2 ++
 5 files changed, 65 insertions(+), 30 deletions(-)

diff --git a/arch/x86/mm.c b/arch/x86/mm.c
index 41fcee67..cfc978f6 100644
--- a/arch/x86/mm.c
+++ b/arch/x86/mm.c
@@ -107,25 +107,20 @@ desc_ptr idt_ptr =
 
 void arch_mm_preinit(void *p)
 {
-    long ret;
-    domid_t domid = DOMID_SELF;
+    unsigned int pages;
     struct hvm_start_info *hsi = p;
 
     if ( hsi->version >= 1 && hsi->memmap_entries > 0 )
         e820_init_memmap((struct hvm_memmap_table_entry *)(unsigned long)
                          hsi->memmap_paddr, hsi->memmap_entries);
+    else
+        e820_init_memmap(NULL, 0);
 
     pt_base = page_table_base;
     first_free_pfn = PFN_UP(to_phys(&_end));
-    ret = HYPERVISOR_memory_op(XENMEM_current_reservation, &domid);
-    if ( ret < 0 )
-    {
-        xprintk("could not get memory size\n");
-        do_exit();
-    }
-
-    last_free_pfn = e820_get_maxpfn(ret);
-    balloon_set_nr_pages(ret, last_free_pfn);
+    pages = e820_get_current_pages();
+    last_free_pfn = e820_get_maxpfn(pages);
+    balloon_set_nr_pages(pages, last_free_pfn);
 }
 #endif
 
diff --git a/balloon.c b/balloon.c
index 9dc77c54..6ad07644 100644
--- a/balloon.c
+++ b/balloon.c
@@ -44,20 +44,12 @@ void balloon_set_nr_pages(unsigned long pages, unsigned long pfn)
 
 void get_max_pages(void)
 {
-    long ret;
-    domid_t domid = DOMID_SELF;
-
-    ret = HYPERVISOR_memory_op(XENMEM_maximum_reservation, &domid);
-    if ( ret < 0 )
+    nr_max_pages = e820_get_max_pages();
+    if ( nr_max_pages )
     {
-        printk("Could not get maximum pfn\n");
-        return;
+        printk("Maximum memory size: %ld pages\n", nr_max_pages);
+        nr_max_pfn = e820_get_maxpfn(nr_max_pages);
     }
-
-    nr_max_pages = ret;
-    printk("Maximum memory size: %ld pages\n", nr_max_pages);
-
-    nr_max_pfn = e820_get_maxpfn(nr_max_pages);
 }
 
 void mm_alloc_bitmap_remap(void)
diff --git a/e820.c b/e820.c
index ad91e00b..48c9eadc 100644
--- a/e820.c
+++ b/e820.c
@@ -29,6 +29,38 @@
 #include <mini-os/e820.h>
 #include <xen/memory.h>
 
+static unsigned int e820_initial_reserved_pfns;
+
+unsigned int e820_get_current_pages(void)
+{
+    domid_t domid = DOMID_SELF;
+    long ret;
+
+    ret = HYPERVISOR_memory_op(XENMEM_current_reservation, &domid);
+    if ( ret < 0 )
+    {
+        xprintk("could not get memory size\n");
+        do_exit();
+    }
+
+    return ret - e820_initial_reserved_pfns;
+}
+
+unsigned int e820_get_max_pages(void)
+{
+    domid_t domid = DOMID_SELF;
+    long ret;
+
+    ret = HYPERVISOR_memory_op(XENMEM_maximum_reservation, &domid);
+    if ( ret < 0 )
+    {
+        printk("Could not get maximum pfn\n");
+        return 0;
+    }
+
+    return ret - e820_initial_reserved_pfns;
+}
+
 #ifdef CONFIG_E820_TRIVIAL
 struct e820entry e820_map[1] = {
     {
@@ -40,10 +72,6 @@ struct e820entry e820_map[1] = {
 
 unsigned e820_entries = 1;
 
-static void e820_get_memmap(void)
-{
-}
-
 #else
 struct e820entry e820_map[E820_MAX];
 unsigned e820_entries;
@@ -199,6 +227,7 @@ static void e820_sanitize(void)
 {
     int i;
     unsigned long end, start;
+    bool found_lapic = false;
 
     /* Sanitize memory map in current form. */
     e820_process_entries();
@@ -238,8 +267,20 @@ static void e820_sanitize(void)
 
     /* Make remaining temporarily reserved entries permanently reserved. */
     for ( i = 0; i < e820_entries; i++ )
+    {
         if ( e820_map[i].type == E820_TMP_RESERVED )
             e820_map[i].type = E820_RESERVED;
+        if ( e820_map[i].type == E820_RESERVED )
+        {
+            e820_initial_reserved_pfns += e820_map[i].size / PAGE_SIZE;
+            if ( e820_map[i].addr <= LAPIC_ADDRESS &&
+                 e820_map[i].addr + e820_map[i].size > LAPIC_ADDRESS )
+                found_lapic = true;
+        }
+    }
+
+    if ( !found_lapic )
+        e820_insert_entry(LAPIC_ADDRESS, PAGE_SIZE, E820_RESERVED);
 }
 
 static void e820_get_memmap(void)
@@ -264,6 +305,12 @@ void e820_init_memmap(struct hvm_memmap_table_entry *entry, unsigned int num)
 {
     unsigned int i;
 
+    if ( !entry )
+    {
+        e820_get_memmap();
+        return;
+    }
+
     BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_RAM != E820_RAM);
     BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_RESERVED != E820_RESERVED);
     BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_ACPI != E820_ACPI);
@@ -365,9 +412,6 @@ unsigned long e820_get_maxpfn(unsigned long pages)
     int i;
     unsigned long pfns = 0, start = 0;
 
-    if ( !e820_entries )
-        e820_get_memmap();
-
     for ( i = 0; i < e820_entries; i++ )
     {
         if ( e820_map[i].type != E820_RAM )
diff --git a/include/e820.h b/include/e820.h
index 5438a7c8..6f15fcd2 100644
--- a/include/e820.h
+++ b/include/e820.h
@@ -52,6 +52,8 @@ struct __packed e820entry {
 extern struct e820entry e820_map[];
 extern unsigned e820_entries;
 
+unsigned int e820_get_current_pages(void);
+unsigned int e820_get_max_pages(void);
 unsigned long e820_get_maxpfn(unsigned long pages);
 unsigned long e820_get_max_contig_pages(unsigned long pfn, unsigned long pages);
 #ifndef CONFIG_E820_TRIVIAL
diff --git a/include/x86/arch_mm.h b/include/x86/arch_mm.h
index ffbec5a8..a1b975dc 100644
--- a/include/x86/arch_mm.h
+++ b/include/x86/arch_mm.h
@@ -207,6 +207,8 @@ typedef unsigned long pgentry_t;
 /* to align the pointer to the (next) page boundary */
 #define PAGE_ALIGN(addr)        (((addr)+PAGE_SIZE-1)&PAGE_MASK)
 
+#define LAPIC_ADDRESS	CONST(0xfee00000)
+
 #ifndef __ASSEMBLY__
 /* Definitions for machine and pseudophysical addresses. */
 #ifdef __i386__
-- 
2.35.3



From minios-devel-bounces@lists.xenproject.org Sun Jun 19 06:53:02 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sun, 19 Jun 2022 06:53:02 +0000
Received: from list by lists.xenproject.org with outflank-mailman.352045.578782 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2ont-0004qi-L2; Sun, 19 Jun 2022 06:53:01 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 352045.578782; Sun, 19 Jun 2022 06:53:01 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2ont-0004qS-Fr; Sun, 19 Jun 2022 06:53:01 +0000
Received: by outflank-mailman (input) for mailman id 352045;
 Sun, 19 Jun 2022 06:53:00 +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 <SRS0=Ii8P=W2=suse.com=jgross@srs-se1.protection.inumbo.net>)
 id 1o2ons-0004F8-AL
 for minios-devel@lists.xenproject.org; Sun, 19 Jun 2022 06:53:00 +0000
Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 72c3744e-ef9c-11ec-b725-ed86ccbb4733;
 Sun, 19 Jun 2022 08:52:56 +0200 (CEST)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out2.suse.de (Postfix) with ESMTPS id 089FE1FD96;
 Sun, 19 Jun 2022 06:52:56 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id BBB2F13427;
 Sun, 19 Jun 2022 06:52:55 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id UCh0LMfHrmJzXgAAMHmgww
 (envelope-from <jgross@suse.com>); Sun, 19 Jun 2022 06:52:55 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 72c3744e-ef9c-11ec-b725-ed86ccbb4733
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1655621576; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=xmLVZAezCgzTgOsivEiAdLkZ5h3o4dxtcy7J5SE1ulo=;
	b=Nki0XgCrhrAtcSGlsxAi7Igkh5HutNGZ1se7+Qjw1BBYbqM1ZY0J1CSIw1nMGG1OpYVOiY
	+m6BU7OVZtvEUC25lBZiXcEUIOPKtCqF4yYh9bgSp+xdmgOgyw9/zMQeHmMmN65rC/rJj9
	FhKCY+x9DOhzuOKuHa//gpUF4UEX9Mw=
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH v2 4/4] mini-os: fix bug in ballooning on PVH
Date: Sun, 19 Jun 2022 08:52:53 +0200
Message-Id: <20220619065253.19503-5-jgross@suse.com>
X-Mailer: git-send-email 2.35.3
In-Reply-To: <20220619065253.19503-1-jgross@suse.com>
References: <20220619065253.19503-1-jgross@suse.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

There is a subtle bug in ballooning code for PVH: in case ballooning
extends above a non-RAM area of the memory map, wrong pages will be
used.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
V2:
- new patch
---
 balloon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/balloon.c b/balloon.c
index 6ad07644..55be8141 100644
--- a/balloon.c
+++ b/balloon.c
@@ -124,7 +124,7 @@ int balloon_up(unsigned long n_pages)
     for ( pfn = 0; pfn < rc; pfn++ )
     {
         arch_pfn_add(start_pfn + pfn, balloon_frames[pfn]);
-        free_page(pfn_to_virt(nr_mem_pages + pfn));
+        free_page(pfn_to_virt(start_pfn + pfn));
     }
 
     nr_mem_pages += rc;
-- 
2.35.3



From minios-devel-bounces@lists.xenproject.org Sun Jun 19 06:53:05 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sun, 19 Jun 2022 06:53:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.352048.578811 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2onx-0005Ry-5s; Sun, 19 Jun 2022 06:53:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 352048.578811; Sun, 19 Jun 2022 06:53:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2onw-0005QU-Nt; Sun, 19 Jun 2022 06:53:04 +0000
Received: by outflank-mailman (input) for mailman id 352048;
 Sun, 19 Jun 2022 06:53: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 <SRS0=Ii8P=W2=suse.com=jgross@srs-se1.protection.inumbo.net>)
 id 1o2onv-0004F8-Ag
 for minios-devel@lists.xenproject.org; Sun, 19 Jun 2022 06:53:03 +0000
Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 728438db-ef9c-11ec-b725-ed86ccbb4733;
 Sun, 19 Jun 2022 08:52:55 +0200 (CEST)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out1.suse.de (Postfix) with ESMTPS id 51F3621D96;
 Sun, 19 Jun 2022 06:52:55 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 245AA13427;
 Sun, 19 Jun 2022 06:52:55 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id GLKIB8fHrmJzXgAAMHmgww
 (envelope-from <jgross@suse.com>); Sun, 19 Jun 2022 06:52:55 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 728438db-ef9c-11ec-b725-ed86ccbb4733
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1655621575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=5vH2NqyFMDYKMsu2Ud2YN8B9pnuLSEdOQPWCQhYC+kA=;
	b=KuNxw/BnF+1yrTWlTm/CJW/I2L7NggaMX43YRO9yxn+bE9DI3/aTgHbVFNVPn8cD/3/LaY
	/w5shJpfcvotjxt3MHfnzrvvBSDNZR76G0uDVhkbksl/UWERUhtVUKDE6/uZV4RgOtngJ0
	5xWBPFo81TjFbKK0WVjGhDBrRAujYgM=
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH v2 1/4] mini-os: take newest version of arch-x86/hvm/start_info.h
Date: Sun, 19 Jun 2022 08:52:50 +0200
Message-Id: <20220619065253.19503-2-jgross@suse.com>
X-Mailer: git-send-email 2.35.3
In-Reply-To: <20220619065253.19503-1-jgross@suse.com>
References: <20220619065253.19503-1-jgross@suse.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Update include/xen/arch-x86/hvm/start_info.h to the newest version
from the Xen tree.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 include/xen/arch-x86/hvm/start_info.h | 63 ++++++++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/include/xen/arch-x86/hvm/start_info.h b/include/xen/arch-x86/hvm/start_info.h
index 64841597..50af9ea2 100644
--- a/include/xen/arch-x86/hvm/start_info.h
+++ b/include/xen/arch-x86/hvm/start_info.h
@@ -33,7 +33,7 @@
  *    | magic          | Contains the magic value XEN_HVM_START_MAGIC_VALUE
  *    |                | ("xEn3" with the 0x80 bit of the "E" set).
  *  4 +----------------+
- *    | version        | Version of this structure. Current version is 0. New
+ *    | version        | Version of this structure. Current version is 1. New
  *    |                | versions are guaranteed to be backwards-compatible.
  *  8 +----------------+
  *    | flags          | SIF_xxx flags.
@@ -48,6 +48,15 @@
  * 32 +----------------+
  *    | rsdp_paddr     | Physical address of the RSDP ACPI data structure.
  * 40 +----------------+
+ *    | memmap_paddr   | Physical address of the (optional) memory map. Only
+ *    |                | present in version 1 and newer of the structure.
+ * 48 +----------------+
+ *    | memmap_entries | Number of entries in the memory map table. Zero
+ *    |                | if there is no memory map being provided. Only
+ *    |                | present in version 1 and newer of the structure.
+ * 52 +----------------+
+ *    | reserved       | Version 1 and newer only.
+ * 56 +----------------+
  *
  * The layout of each entry in the module structure is the following:
  *
@@ -62,13 +71,51 @@
  *    | reserved       |
  * 32 +----------------+
  *
+ * The layout of each entry in the memory map table is as follows:
+ *
+ *  0 +----------------+
+ *    | addr           | Base address
+ *  8 +----------------+
+ *    | size           | Size of mapping in bytes
+ * 16 +----------------+
+ *    | type           | Type of mapping as defined between the hypervisor
+ *    |                | and guest. See XEN_HVM_MEMMAP_TYPE_* values below.
+ * 20 +----------------|
+ *    | reserved       |
+ * 24 +----------------+
+ *
  * The address and sizes are always a 64bit little endian unsigned integer.
  *
  * NB: Xen on x86 will always try to place all the data below the 4GiB
  * boundary.
+ *
+ * Version numbers of the hvm_start_info structure have evolved like this:
+ *
+ * Version 0:  Initial implementation.
+ *
+ * Version 1:  Added the memmap_paddr/memmap_entries fields (plus 4 bytes of
+ *             padding) to the end of the hvm_start_info struct. These new
+ *             fields can be used to pass a memory map to the guest. The
+ *             memory map is optional and so guests that understand version 1
+ *             of the structure must check that memmap_entries is non-zero
+ *             before trying to read the memory map.
  */
 #define XEN_HVM_START_MAGIC_VALUE 0x336ec578
 
+/*
+ * The values used in the type field of the memory map table entries are
+ * defined below and match the Address Range Types as defined in the "System
+ * Address Map Interfaces" section of the ACPI Specification. Please refer to
+ * section 15 in version 6.2 of the ACPI spec: http://uefi.org/specifications
+ */
+#define XEN_HVM_MEMMAP_TYPE_RAM       1
+#define XEN_HVM_MEMMAP_TYPE_RESERVED  2
+#define XEN_HVM_MEMMAP_TYPE_ACPI      3
+#define XEN_HVM_MEMMAP_TYPE_NVS       4
+#define XEN_HVM_MEMMAP_TYPE_UNUSABLE  5
+#define XEN_HVM_MEMMAP_TYPE_DISABLED  6
+#define XEN_HVM_MEMMAP_TYPE_PMEM      7
+
 /*
  * C representation of the x86/HVM start info layout.
  *
@@ -86,6 +133,13 @@ struct hvm_start_info {
     uint64_t cmdline_paddr;     /* Physical address of the command line.     */
     uint64_t rsdp_paddr;        /* Physical address of the RSDP ACPI data    */
                                 /* structure.                                */
+    /* All following fields only present in version 1 and newer */
+    uint64_t memmap_paddr;      /* Physical address of an array of           */
+                                /* hvm_memmap_table_entry.                   */
+    uint32_t memmap_entries;    /* Number of entries in the memmap table.    */
+                                /* Value will be zero if there is no memory  */
+                                /* map being provided.                       */
+    uint32_t reserved;          /* Must be zero.                             */
 };
 
 struct hvm_modlist_entry {
@@ -95,4 +149,11 @@ struct hvm_modlist_entry {
     uint64_t reserved;
 };
 
+struct hvm_memmap_table_entry {
+    uint64_t addr;              /* Base address of the memory region         */
+    uint64_t size;              /* Size of the memory region in bytes        */
+    uint32_t type;              /* Mapping type                              */
+    uint32_t reserved;          /* Must be zero for Version 1.               */
+};
+
 #endif /* __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__ */
-- 
2.35.3



From minios-devel-bounces@lists.xenproject.org Sun Jun 19 06:53:06 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sun, 19 Jun 2022 06:53:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.352049.578818 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2ony-0005gC-13; Sun, 19 Jun 2022 06:53:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 352049.578818; Sun, 19 Jun 2022 06:53:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o2onx-0005f2-Rk; Sun, 19 Jun 2022 06:53:05 +0000
Received: by outflank-mailman (input) for mailman id 352049;
 Sun, 19 Jun 2022 06:53: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 <SRS0=Ii8P=W2=suse.com=jgross@srs-se1.protection.inumbo.net>)
 id 1o2onw-0004F8-AX
 for minios-devel@lists.xenproject.org; Sun, 19 Jun 2022 06:53:04 +0000
Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 72844e11-ef9c-11ec-b725-ed86ccbb4733;
 Sun, 19 Jun 2022 08:52:56 +0200 (CEST)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out2.suse.de (Postfix) with ESMTPS id 1E2FD1F8F9;
 Sun, 19 Jun 2022 06:52:55 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E378913427;
 Sun, 19 Jun 2022 06:52:54 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id 1echNsbHrmJzXgAAMHmgww
 (envelope-from <jgross@suse.com>); Sun, 19 Jun 2022 06:52:54 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 72844e11-ef9c-11ec-b725-ed86ccbb4733
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1655621575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:  content-transfer-encoding:content-transfer-encoding;
	bh=4/VBdIlOf0fGkH80DrK+kifFIKli7auGQ8C3iCy/sOs=;
	b=c8BMbjPEFETnXHanJPJbi3acpIGjTIKia2MlnxWPPyqgCIc0Fdz8nER8mBrCn4cTemVsZv
	jAb7Lw1Wbug31VxVKq0ubuPyt3OE63p+MWqYDMklWNBabkKo0Ia+RMRA+h+ufGaHT07nEq
	J+fDDoXHsdbVnROv5wp6tsTyQKQOxkg=
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH v2 0/4] mini-os: some memory map updates for PVH
Date: Sun, 19 Jun 2022 08:52:49 +0200
Message-Id: <20220619065253.19503-1-jgross@suse.com>
X-Mailer: git-send-email 2.35.3
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Do some memory map related changes/fixes for PVH mode:

- Prefer the memory map delivered via start-info over the one obtained
  from the hypervisor. This is a prerequisite for Xenstore-stubdom
  live-update with rising the memory limit.

- Fix a bug related to ballooning in PVH mode: PVH Xenstore-stubdom
  can't read its target memory size from Xenstore, as this introduces
  a chicken-and-egg problem. The memory size read from the hypervisor
  OTOH includes additional "special" pages marked as reserved in the
  memory map. Those pages need to be subtracted from the read size.

- Fix a bug in ballooning code in PVH mode when using memory beyond
  a RAM hole in the memory map

Changes in V2:
- added patch 4
- addressed comment regarding patch 3

Juergen Gross (4):
  mini-os: take newest version of arch-x86/hvm/start_info.h
  mini-os: prefer memory map via start_info for PVH
  mini-os: fix number of pages for PVH
  mini-os: fix bug in ballooning on PVH

 arch/x86/mm.c                         | 23 ++++----
 balloon.c                             | 18 ++----
 e820.c                                | 83 ++++++++++++++++++++++++---
 include/e820.h                        |  6 ++
 include/x86/arch_mm.h                 |  2 +
 include/xen/arch-x86/hvm/start_info.h | 63 +++++++++++++++++++-
 6 files changed, 163 insertions(+), 32 deletions(-)

-- 
2.35.3



From minios-devel-bounces@lists.xenproject.org Mon Jun 20 07:38:39 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 20 Jun 2022 07:38:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.352523.579300 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3BzZ-0002Zg-7J; Mon, 20 Jun 2022 07:38:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 352523.579300; Mon, 20 Jun 2022 07:38:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3BzZ-0002ZZ-46; Mon, 20 Jun 2022 07:38:37 +0000
Received: by outflank-mailman (input) for mailman id 352523;
 Mon, 20 Jun 2022 07:38:35 +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 <SRS0=Hycu=W3=suse.com=jgross@srs-se1.protection.inumbo.net>)
 id 1o3BzX-0002ZD-IG
 for minios-devel@lists.xenproject.org; Mon, 20 Jun 2022 07:38:35 +0000
Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id fc0d334d-f06b-11ec-b725-ed86ccbb4733;
 Mon, 20 Jun 2022 09:38:33 +0200 (CEST)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out1.suse.de (Postfix) with ESMTPS id BF3C521B85;
 Mon, 20 Jun 2022 07:38:32 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 91AD1134CA;
 Mon, 20 Jun 2022 07:38:32 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id nOwwIvgjsGI3DAAAMHmgww
 (envelope-from <jgross@suse.com>); Mon, 20 Jun 2022 07:38:32 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: fc0d334d-f06b-11ec-b725-ed86ccbb4733
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1655710712; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:  content-transfer-encoding:content-transfer-encoding;
	bh=Nw3aoVhr/WUv7SQwVbjYwYfUJ9Uxj7BJzlvpNqO58Ls=;
	b=R/2lQtS318TyDax/XDzFR0kI36a8m2rfgLF2Lrv4sspyhoEJbmSJe9DwzIy5LJQBRwGpAl
	34tJOPRYQ4mTPmerBXT2tBf/53Vea0FLctnSh8xhYpifZqgY359Q3JB9qvYx97bkaEJMTj
	b8X6CBfwMZPBlDKGvJ3TrvdGAAqIuWo=
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH 0/8] mini-os: some cleanup patches
Date: Mon, 20 Jun 2022 09:38:12 +0200
Message-Id: <20220620073820.9336-1-jgross@suse.com>
X-Mailer: git-send-email 2.35.3
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Do some cleanups.

No functional change intended, apart from whitespace changes only
minor modifications making code easier to read.

Juergen Gross (8):
  mini-os: drop xenbus directory
  mini-os: apply coding style to xenbus.c
  mini-os: eliminate console/console.h
  mini-os: rename console/xenbus.c to consfront.c
  mini-os: apply coding style to consfront.c
  mini-os: eliminate console directory
  mini-os: apply coding style to console.c
  mini-os: add mini-os-debug[.gz] to .gitignore

 .gitignore                      |   2 +
 Makefile                        |   9 +-
 console/xenbus.c => consfront.c |  99 ++++---
 console.c                       | 415 ++++++++++++++++++++++++++
 console/console.c               | 177 -----------
 console/console.h               |   2 -
 console/xencons_ring.c          | 238 ---------------
 include/console.h               |   1 +
 xenbus/xenbus.c => xenbus.c     | 510 +++++++++++++++++++-------------
 9 files changed, 778 insertions(+), 675 deletions(-)
 rename console/xenbus.c => consfront.c (78%)
 create mode 100644 console.c
 delete mode 100644 console/console.c
 delete mode 100644 console/console.h
 delete mode 100644 console/xencons_ring.c
 rename xenbus/xenbus.c => xenbus.c (71%)

-- 
2.35.3



From minios-devel-bounces@lists.xenproject.org Mon Jun 20 07:38:39 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 20 Jun 2022 07:38:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.352527.579323 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3Bzb-0002vt-1b; Mon, 20 Jun 2022 07:38:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 352527.579323; Mon, 20 Jun 2022 07:38:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3Bza-0002vF-Qx; Mon, 20 Jun 2022 07:38:38 +0000
Received: by outflank-mailman (input) for mailman id 352527;
 Mon, 20 Jun 2022 07:38:37 +0000
Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50]
 helo=se1-gles-flk1.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <SRS0=Hycu=W3=suse.com=jgross@srs-se1.protection.inumbo.net>)
 id 1o3BzZ-0002ZD-BT
 for minios-devel@lists.xenproject.org; Mon, 20 Jun 2022 07:38:37 +0000
Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id fc6d24bb-f06b-11ec-b725-ed86ccbb4733;
 Mon, 20 Jun 2022 09:38:33 +0200 (CEST)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out2.suse.de (Postfix) with ESMTPS id A9F1A1F383;
 Mon, 20 Jun 2022 07:38:33 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7BC73134CA;
 Mon, 20 Jun 2022 07:38:33 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id aAbZHPkjsGI3DAAAMHmgww
 (envelope-from <jgross@suse.com>); Mon, 20 Jun 2022 07:38:33 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: fc6d24bb-f06b-11ec-b725-ed86ccbb4733
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1655710713; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=hnPzvgMWe8RIRQajkOAJiVhJlYFwWqqQzJSgyQ7guJk=;
	b=CzZNsrKQQhGFss+TpjyunC4m5576B69vSH9hfI+3uRjliaCOAI0gFyhtNBlW0XHgOzp7uT
	9pRjAc041oQJ5rsL3/RqoCmPvC6Yk3vYPH9beMMJHA6MFgwPxlTxqexwQv/xK6KM67Sf1N
	IiAm934tudtI2+QIdwABW85FwF0cA6Q=
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH 4/8] mini-os: rename console/xenbus.c to consfront.c
Date: Mon, 20 Jun 2022 09:38:16 +0200
Message-Id: <20220620073820.9336-5-jgross@suse.com>
X-Mailer: git-send-email 2.35.3
In-Reply-To: <20220620073820.9336-1-jgross@suse.com>
References: <20220620073820.9336-1-jgross@suse.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Move console/xenbus.c into the main directory and rename it to
consfront.c.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 Makefile                        | 2 +-
 console/xenbus.c => consfront.c | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename console/xenbus.c => consfront.c (100%)

diff --git a/Makefile b/Makefile
index 16d1f5d6..509d927b 100644
--- a/Makefile
+++ b/Makefile
@@ -37,6 +37,7 @@ TARGET := mini-os
 SUBDIRS := lib xenbus console
 
 src-$(CONFIG_BLKFRONT) += blkfront.c
+src-$(CONFIG_CONSFRONT) += consfront.c
 src-$(CONFIG_TPMFRONT) += tpmfront.c
 src-$(CONFIG_TPM_TIS) += tpm_tis.c
 src-$(CONFIG_TPMBACK) += tpmback.c
@@ -70,7 +71,6 @@ src-$(CONFIG_LIBXS) += lib/xs.c
 
 src-y += console/console.c
 src-y += console/xencons_ring.c
-src-$(CONFIG_CONSFRONT) += console/xenbus.c
 
 # The common mini-os objects to build.
 APP_OBJS :=
diff --git a/console/xenbus.c b/consfront.c
similarity index 100%
rename from console/xenbus.c
rename to consfront.c
-- 
2.35.3



From minios-devel-bounces@lists.xenproject.org Mon Jun 20 07:38:39 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 20 Jun 2022 07:38:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.352524.579304 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3BzZ-0002Zv-Cz; Mon, 20 Jun 2022 07:38:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 352524.579304; Mon, 20 Jun 2022 07:38:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3BzZ-0002Zl-5i; Mon, 20 Jun 2022 07:38:37 +0000
Received: by outflank-mailman (input) for mailman id 352524;
 Mon, 20 Jun 2022 07:38:35 +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 <SRS0=Hycu=W3=suse.com=jgross@srs-se1.protection.inumbo.net>)
 id 1o3BzX-0002ZE-RT
 for minios-devel@lists.xenproject.org; Mon, 20 Jun 2022 07:38:35 +0000
Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id fca02103-f06b-11ec-bd2d-47488cf2e6aa;
 Mon, 20 Jun 2022 09:38:34 +0200 (CEST)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out1.suse.de (Postfix) with ESMTPS id 758BA21BCC;
 Mon, 20 Jun 2022 07:38:33 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 48E2F13A79;
 Mon, 20 Jun 2022 07:38:33 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id 0H4eEPkjsGI3DAAAMHmgww
 (envelope-from <jgross@suse.com>); Mon, 20 Jun 2022 07:38:33 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: fca02103-f06b-11ec-bd2d-47488cf2e6aa
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1655710713; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=mXoU4RmuES8ycHpl3QBq4ZigOK3MOzKFqQcwP9Rcli4=;
	b=QqRprFy/46avRj+XmmN+NOAl8ov8kRK941KMadJFb9N5OhcdNsIwPfT4lZRBj4mv8wOeXD
	yCLGF+ZwcfA6RIcs0RScMTmzzllsCd+ZkJ+rRr87E7/U9RpLu8RoEiB1Oyko0lWwoF9YfL
	0U88RrGFfrwgRAeaagcxsn8Uvuy4QGk=
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH 3/8] mini-os: eliminate console/console.h
Date: Mon, 20 Jun 2022 09:38:15 +0200
Message-Id: <20220620073820.9336-4-jgross@suse.com>
X-Mailer: git-send-email 2.35.3
In-Reply-To: <20220620073820.9336-1-jgross@suse.com>
References: <20220620073820.9336-1-jgross@suse.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

console/console.h contains only a single prototype. Move that to
include/console.h and remove console/console.h.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 console/console.h      | 2 --
 console/xenbus.c       | 2 +-
 console/xencons_ring.c | 2 +-
 include/console.h      | 1 +
 4 files changed, 3 insertions(+), 4 deletions(-)
 delete mode 100644 console/console.h

diff --git a/console/console.h b/console/console.h
deleted file mode 100644
index e85147a4..00000000
--- a/console/console.h
+++ /dev/null
@@ -1,2 +0,0 @@
-
-void console_handle_input(evtchn_port_t port, struct pt_regs *regs, void *data);
diff --git a/console/xenbus.c b/console/xenbus.c
index d8950454..73659656 100644
--- a/console/xenbus.c
+++ b/console/xenbus.c
@@ -5,13 +5,13 @@
 #include <mini-os/events.h>
 #include <mini-os/os.h>
 #include <mini-os/lib.h>
+#include <mini-os/console.h>
 #include <mini-os/xenbus.h>
 #include <xen/io/console.h>
 #include <xen/io/protocols.h>
 #include <xen/io/ring.h>
 #include <mini-os/xmalloc.h>
 #include <mini-os/gnttab.h>
-#include "console.h"
 
 void free_consfront(struct consfront_dev *dev)
 {
diff --git a/console/xencons_ring.c b/console/xencons_ring.c
index efedf46b..495f0a19 100644
--- a/console/xencons_ring.c
+++ b/console/xencons_ring.c
@@ -5,6 +5,7 @@
 #include <mini-os/events.h>
 #include <mini-os/os.h>
 #include <mini-os/lib.h>
+#include <mini-os/console.h>
 #include <mini-os/xenbus.h>
 #include <xen/io/console.h>
 #include <xen/io/protocols.h>
@@ -12,7 +13,6 @@
 #include <xen/hvm/params.h>
 #include <mini-os/xmalloc.h>
 #include <mini-os/gnttab.h>
-#include "console.h"
 
 DECLARE_WAIT_QUEUE_HEAD(console_queue);
 
diff --git a/include/console.h b/include/console.h
index e76e4234..d216d247 100644
--- a/include/console.h
+++ b/include/console.h
@@ -98,5 +98,6 @@ void free_consfront(struct consfront_dev *dev);
 extern const struct file_ops console_ops;
 int open_consfront(char *nodename);
 #endif
+void console_handle_input(evtchn_port_t port, struct pt_regs *regs, void *data);
 
 #endif /* _LIB_CONSOLE_H_ */
-- 
2.35.3



From minios-devel-bounces@lists.xenproject.org Mon Jun 20 07:38:39 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 20 Jun 2022 07:38:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.352528.579330 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3Bzb-0002wS-97; Mon, 20 Jun 2022 07:38:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 352528.579330; Mon, 20 Jun 2022 07:38:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3Bza-0002w4-T8; Mon, 20 Jun 2022 07:38:38 +0000
Received: by outflank-mailman (input) for mailman id 352528;
 Mon, 20 Jun 2022 07:38:37 +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 <SRS0=Hycu=W3=suse.com=jgross@srs-se1.protection.inumbo.net>)
 id 1o3BzZ-0002ZE-Jv
 for minios-devel@lists.xenproject.org; Mon, 20 Jun 2022 07:38:37 +0000
Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id fd8397c4-f06b-11ec-bd2d-47488cf2e6aa;
 Mon, 20 Jun 2022 09:38:34 +0200 (CEST)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out1.suse.de (Postfix) with ESMTPS id 985DB21BD0;
 Mon, 20 Jun 2022 07:38:34 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6206E13A79;
 Mon, 20 Jun 2022 07:38:34 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id EFuXFvojsGI3DAAAMHmgww
 (envelope-from <jgross@suse.com>); Mon, 20 Jun 2022 07:38:34 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: fd8397c4-f06b-11ec-bd2d-47488cf2e6aa
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1655710714; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=g253R54BCUXErJG0A5bqZZ4ZPguYj/1UWM+5iFTL2Q4=;
	b=NGnw937lMT/LOym5c4FxAJvsiKqbPHFdtXnXWnw+KPZQ2CZdE9erEzVRNC9go0JBFdw03p
	8vE7N10ooM3hfysMkQhuqM6HfgEQpdZa1qMynsfHUvdUYEFL6tdgtW5f0TIK0r9ltl89H3
	Bz9JR4qLhGl9SYSPaB8KTneMQ/jTnSI=
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH 8/8] mini-os: add mini-os-debug[.gz] to .gitignore
Date: Mon, 20 Jun 2022 09:38:20 +0200
Message-Id: <20220620073820.9336-9-jgross@suse.com>
X-Mailer: git-send-email 2.35.3
In-Reply-To: <20220620073820.9336-1-jgross@suse.com>
References: <20220620073820.9336-1-jgross@suse.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

mini-os-debug and mini-os-debug.gz are created when building Mini-OS,
add them to .gitignore.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 .gitignore | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.gitignore b/.gitignore
index d57c2bdd..abef46b2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,3 +14,5 @@ include/list.h
 mini-os
 mini-os.gz
 minios-config.mk
+mini-os-debug
+mini-os-debug.gz
-- 
2.35.3



From minios-devel-bounces@lists.xenproject.org Mon Jun 20 07:38:41 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 20 Jun 2022 07:38:41 +0000
Received: from list by lists.xenproject.org with outflank-mailman.352531.579356 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3Bzd-0003ab-7H; Mon, 20 Jun 2022 07:38:41 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 352531.579356; Mon, 20 Jun 2022 07:38:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3Bzd-0003a1-03; Mon, 20 Jun 2022 07:38:41 +0000
Received: by outflank-mailman (input) for mailman id 352531;
 Mon, 20 Jun 2022 07:38:39 +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 <SRS0=Hycu=W3=suse.com=jgross@srs-se1.protection.inumbo.net>)
 id 1o3Bzb-0002ZD-BY
 for minios-devel@lists.xenproject.org; Mon, 20 Jun 2022 07:38:39 +0000
Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id fc0b9888-f06b-11ec-b725-ed86ccbb4733;
 Mon, 20 Jun 2022 09:38:33 +0200 (CEST)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out1.suse.de (Postfix) with ESMTPS id 0014521BB8;
 Mon, 20 Jun 2022 07:38:32 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id C6946134CA;
 Mon, 20 Jun 2022 07:38:32 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id IP0rL/gjsGI3DAAAMHmgww
 (envelope-from <jgross@suse.com>); Mon, 20 Jun 2022 07:38:32 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: fc0b9888-f06b-11ec-b725-ed86ccbb4733
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1655710713; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=qUmUwfIlKzy4uayyFfnh4ZN+f1gTP+njO8tkwccWoP4=;
	b=MAKOBlsmDx/DpF2gfo0e6hjRB0chjmo+Fm8UcxMU7vC87txTwbnVPqFXpXstAKKwvpkldD
	b7IAcsjIzqCzfR/z9CJrG7kITaSInvFuo0tp/1bP4wfm7sTOMFAM1FSIEC0317AAUMLMSe
	+TO+qjXbqxbzUXKCrklkUqixCFUPueo=
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH 1/8] mini-os: drop xenbus directory
Date: Mon, 20 Jun 2022 09:38:13 +0200
Message-Id: <20220620073820.9336-2-jgross@suse.com>
X-Mailer: git-send-email 2.35.3
In-Reply-To: <20220620073820.9336-1-jgross@suse.com>
References: <20220620073820.9336-1-jgross@suse.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

The xenbus directory contains only a single source. Move this source
up and remove the xenbus directory.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 Makefile                    | 3 +--
 xenbus/xenbus.c => xenbus.c | 0
 2 files changed, 1 insertion(+), 2 deletions(-)
 rename xenbus/xenbus.c => xenbus.c (100%)

diff --git a/Makefile b/Makefile
index 9f95d197..16d1f5d6 100644
--- a/Makefile
+++ b/Makefile
@@ -57,6 +57,7 @@ src-y += sched.c
 src-y += shutdown.c
 src-$(CONFIG_TEST) += test.c
 src-$(CONFIG_BALLOON) += balloon.c
+src-$(CONFIG_XENBUS) += xenbus.c
 
 src-y += lib/ctype.c
 src-y += lib/math.c
@@ -67,8 +68,6 @@ src-y += lib/sys.c
 src-y += lib/xmalloc.c
 src-$(CONFIG_LIBXS) += lib/xs.c
 
-src-$(CONFIG_XENBUS) += xenbus/xenbus.c
-
 src-y += console/console.c
 src-y += console/xencons_ring.c
 src-$(CONFIG_CONSFRONT) += console/xenbus.c
diff --git a/xenbus/xenbus.c b/xenbus.c
similarity index 100%
rename from xenbus/xenbus.c
rename to xenbus.c
-- 
2.35.3



From minios-devel-bounces@lists.xenproject.org Mon Jun 20 07:38:42 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 20 Jun 2022 07:38:42 +0000
Received: from list by lists.xenproject.org with outflank-mailman.352532.579363 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3Bze-0003nw-7p; Mon, 20 Jun 2022 07:38:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 352532.579363; Mon, 20 Jun 2022 07:38:42 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3Bze-0003nk-36; Mon, 20 Jun 2022 07:38:42 +0000
Received: by outflank-mailman (input) for mailman id 352532;
 Mon, 20 Jun 2022 07:38:39 +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 <SRS0=Hycu=W3=suse.com=jgross@srs-se1.protection.inumbo.net>)
 id 1o3Bzb-0002ZE-KE
 for minios-devel@lists.xenproject.org; Mon, 20 Jun 2022 07:38:39 +0000
Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id fd465502-f06b-11ec-bd2d-47488cf2e6aa;
 Mon, 20 Jun 2022 09:38:34 +0200 (CEST)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out2.suse.de (Postfix) with ESMTPS id 5B6ED1F972;
 Mon, 20 Jun 2022 07:38:34 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 292A1134CA;
 Mon, 20 Jun 2022 07:38:34 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id AKiuCPojsGI3DAAAMHmgww
 (envelope-from <jgross@suse.com>); Mon, 20 Jun 2022 07:38:34 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: fd465502-f06b-11ec-bd2d-47488cf2e6aa
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1655710714; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=Ij/l8vGwMUP3sj1l6oCVo+3lGirXIhChnHnYSjdN7M4=;
	b=iF7oXWL274QxV6P/YGQuE7yJf2FZ0UXUVsAp/+MPXoFykVPZWfIApaoD94IxzdB9eHBASW
	njBlkkiQQWfD4VEiQqxiOKMA4qCWqPyyhvost8/ERAPHX38leEth0ndXibttvUX81T0hpY
	deQXWgsSL9uNG4oH4OkMlGZriS7IVLY=
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH 7/8] mini-os: apply coding style to console.c
Date: Mon, 20 Jun 2022 09:38:19 +0200
Message-Id: <20220620073820.9336-8-jgross@suse.com>
X-Mailer: git-send-email 2.35.3
In-Reply-To: <20220620073820.9336-1-jgross@suse.com>
References: <20220620073820.9336-1-jgross@suse.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Make console.c coding style compliant.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 console.c | 280 ++++++++++++++++++++++++++++--------------------------
 1 file changed, 145 insertions(+), 135 deletions(-)

diff --git a/console.c b/console.c
index 29277eac..5d205c7d 100644
--- a/console.c
+++ b/console.c
@@ -1,14 +1,14 @@
-/* 
+/*
  ****************************************************************************
  * (C) 2006 - Grzegorz Milos - Cambridge University
  ****************************************************************************
  *
  *        File: console.c
  *      Author: Grzegorz Milos
- *     Changes: 
- *              
+ *     Changes:
+ *
  *        Date: Mar 2006
- * 
+ *
  * Environment: Xen Minimal OS
  * Description: Console interface.
  *
@@ -21,19 +21,19 @@
  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  * sell copies of the Software, and to permit persons to whom the Software is
  * furnished to do so, subject to the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  */
- 
+
 #include <mini-os/types.h>
 #include <mini-os/wait.h>
 #include <mini-os/mm.h>
@@ -50,26 +50,24 @@
 #include <xen/io/ring.h>
 #include <xen/hvm/params.h>
 
-/* If console not initialised the printk will be sent to xen serial line 
-   NOTE: you need to enable verbose in xen/Rules.mk for it to work. */
 static struct consfront_dev* xen_console = NULL;
 static int console_initialised = 0;
 
-__attribute__((weak)) void console_input(char * buf, unsigned len)
+__attribute__((weak)) void console_input(char *buf, unsigned int len)
 {
-    if(len > 0)
+    if ( len > 0 )
     {
         /* Just repeat what's written */
         buf[len] = '\0';
         printk("%s", buf);
-        
-        if(buf[len-1] == '\r')
+
+        if ( buf[len - 1] == '\r' )
             printk("\nNo console input handler.\n");
     }
 }
 
 #ifndef HAVE_LIBC
-void xencons_rx(char *buf, unsigned len, struct pt_regs *regs)
+void xencons_rx(char *buf, unsigned int len, struct pt_regs *regs)
 {
     console_input(buf, len);
 }
@@ -80,88 +78,94 @@ void xencons_tx(void)
 }
 #endif
 
-
 void console_print(struct consfront_dev *dev, const char *data, int length)
 {
     char *curr_char, saved_char;
     char copied_str[length+1];
     char *copied_ptr;
     int part_len;
-    int (*ring_send_fn)(struct consfront_dev *dev, const char *data, unsigned length);
+    int (*ring_send_fn)(struct consfront_dev *dev, const char *data,
+                        unsigned int length);
 
-    if(!console_initialised)
+    if ( !console_initialised )
         ring_send_fn = xencons_ring_send_no_notify;
     else
         ring_send_fn = xencons_ring_send;
 
-    if (dev && dev->is_raw) {
+    if ( dev && dev->is_raw )
+    {
         ring_send_fn(dev, data, length);
         return;
     }
 
     copied_ptr = copied_str;
     memcpy(copied_ptr, data, length);
-    for(curr_char = copied_ptr; curr_char < copied_ptr+length-1; curr_char++)
+    for ( curr_char = copied_ptr; curr_char < copied_ptr + length - 1;
+          curr_char++ )
     {
-        if(*curr_char == '\n')
+        if ( *curr_char == '\n' )
         {
             *curr_char = '\r';
-            saved_char = *(curr_char+1);
-            *(curr_char+1) = '\n';
+            saved_char = *(curr_char + 1);
+            *(curr_char + 1) = '\n';
             part_len = curr_char - copied_ptr + 2;
             ring_send_fn(dev, copied_ptr, part_len);
-            *(curr_char+1) = saved_char;
-            copied_ptr = curr_char+1;
+            *(curr_char + 1) = saved_char;
+            copied_ptr = curr_char + 1;
             length -= part_len - 1;
         }
     }
 
-    if (copied_ptr[length-1] == '\n') {
-        copied_ptr[length-1] = '\r';
+    if ( copied_ptr[length - 1] == '\n')
+    {
+        copied_ptr[length - 1] = '\r';
         copied_ptr[length] = '\n';
         length++;
     }
-    
+
     ring_send_fn(dev, copied_ptr, length);
 }
 
 void print(int direct, const char *fmt, va_list args)
 {
     static char __print_buf[1024];
-    
+
     (void)vsnprintf(__print_buf, sizeof(__print_buf), fmt, args);
 
-    if(direct)
+    if ( direct )
     {
-        (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(__print_buf), __print_buf);
+        (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(__print_buf),
+                                    __print_buf);
         return;
-    } else {
-#ifndef CONFIG_USE_XEN_CONSOLE
-    if(!console_initialised)
-#endif    
-            (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(__print_buf), __print_buf);
-        
-        console_print(NULL, __print_buf, strlen(__print_buf));
     }
+#ifndef CONFIG_USE_XEN_CONSOLE
+    if ( !console_initialised )
+#endif
+        (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(__print_buf),
+                                    __print_buf);
+
+    console_print(NULL, __print_buf, strlen(__print_buf));
 }
 
 void printk(const char *fmt, ...)
 {
-    va_list       args;
+    va_list args;
+
     va_start(args, fmt);
     print(0, fmt, args);
-    va_end(args);        
+    va_end(args);
 }
 
 void xprintk(const char *fmt, ...)
 {
-    va_list       args;
+    va_list args;
+
     va_start(args, fmt);
     print(1, fmt, args);
-    va_end(args);        
+    va_end(args);
 }
 void init_console(void)
-{   
+{
     printk("Initialising console ... ");
     xen_console = xencons_ring_init();
     console_initialised = 1;
@@ -186,7 +190,7 @@ DECLARE_WAIT_QUEUE_HEAD(console_queue);
 static struct xencons_interface *console_ring;
 uint32_t console_evtchn;
 
-static struct consfront_dev* resume_xen_console(struct consfront_dev* dev);
+static struct consfront_dev* resume_xen_console(struct consfront_dev *dev);
 
 #ifdef CONFIG_PARAVIRT
 void get_console(void *p)
@@ -201,11 +205,11 @@ void get_console(void *p)
 {
     uint64_t v = -1;
 
-    if (hvm_get_parameter(HVM_PARAM_CONSOLE_EVTCHN, &v))
+    if ( hvm_get_parameter(HVM_PARAM_CONSOLE_EVTCHN, &v) )
         BUG();
     console_evtchn = v;
 
-    if (hvm_get_parameter(HVM_PARAM_CONSOLE_PFN, &v))
+    if ( hvm_get_parameter(HVM_PARAM_CONSOLE_PFN, &v) )
         BUG();
     console_ring = (struct xencons_interface *)map_frame_virt(v);
 }
@@ -214,7 +218,7 @@ void get_console(void *p)
 static inline void notify_daemon(struct consfront_dev *dev)
 {
     /* Use evtchn: this is called early, before irq is set up. */
-    if (!dev)
+    if ( !dev )
         notify_remote_via_evtchn(console_evtchn);
     else
         notify_remote_via_evtchn(dev->evtchn);
@@ -223,36 +227,38 @@ static inline void notify_daemon(struct consfront_dev *dev)
 static inline struct xencons_interface *xencons_interface(void)
 {
     return console_evtchn ? console_ring : NULL;
-} 
- 
-int xencons_ring_send_no_notify(struct consfront_dev *dev, const char *data, unsigned len)
-{	
+}
+
+int xencons_ring_send_no_notify(struct consfront_dev *dev, const char *data,
+                                unsigned int len)
+{
     int sent = 0;
-	struct xencons_interface *intf;
-	XENCONS_RING_IDX cons, prod;
-
-	if (!dev)
-            intf = xencons_interface();
-        else
-            intf = dev->ring;
-        if (!intf)
-            return sent;
-
-	cons = intf->out_cons;
-	prod = intf->out_prod;
-	mb();
-	BUG_ON((prod - cons) > sizeof(intf->out));
-
-	while ((sent < len) && ((prod - cons) < sizeof(intf->out)))
-		intf->out[MASK_XENCONS_IDX(prod++, intf->out)] = data[sent++];
-
-	wmb();
-	intf->out_prod = prod;
-    
+    struct xencons_interface *intf;
+    XENCONS_RING_IDX cons, prod;
+
+    if ( !dev )
+        intf = xencons_interface();
+    else
+        intf = dev->ring;
+    if ( !intf )
+        return sent;
+
+    cons = intf->out_cons;
+    prod = intf->out_prod;
+    mb();
+    BUG_ON((prod - cons) > sizeof(intf->out));
+
+    while ( (sent < len) && ((prod - cons) < sizeof(intf->out)) )
+        intf->out[MASK_XENCONS_IDX(prod++, intf->out)] = data[sent++];
+
+    wmb();
+    intf->out_prod = prod;
+
     return sent;
 }
 
-int xencons_ring_send(struct consfront_dev *dev, const char *data, unsigned len)
+int xencons_ring_send(struct consfront_dev *dev, const char *data,
+                      unsigned int len)
 {
     int sent;
 
@@ -264,83 +270,85 @@ int xencons_ring_send(struct consfront_dev *dev, const char *data, unsigned len)
 
 void console_handle_input(evtchn_port_t port, struct pt_regs *regs, void *data)
 {
-	struct consfront_dev *dev = (struct consfront_dev *) data;
+    struct consfront_dev *dev = (struct consfront_dev *) data;
 #ifdef HAVE_LIBC
-        struct file *file = dev ? get_file_from_fd(dev->fd) : NULL;
+    struct file *file = dev ? get_file_from_fd(dev->fd) : NULL;
 
-        if ( file )
-            file->read = true;
+    if ( file )
+        file->read = true;
 
-        wake_up(&console_queue);
+    wake_up(&console_queue);
 #else
-	struct xencons_interface *intf = xencons_interface();
-	XENCONS_RING_IDX cons, prod;
+    struct xencons_interface *intf = xencons_interface();
+    XENCONS_RING_IDX cons, prod;
 
-	cons = intf->in_cons;
-	prod = intf->in_prod;
-	mb();
-	BUG_ON((prod - cons) > sizeof(intf->in));
+    cons = intf->in_cons;
+    prod = intf->in_prod;
+    mb();
+    BUG_ON((prod - cons) > sizeof(intf->in));
 
-	while (cons != prod) {
-		xencons_rx(intf->in+MASK_XENCONS_IDX(cons,intf->in), 1, regs);
-		cons++;
-	}
+    while ( cons != prod )
+    {
+        xencons_rx(intf->in + MASK_XENCONS_IDX(cons, intf->in), 1, regs);
+        cons++;
+    }
 
-	mb();
-	intf->in_cons = cons;
+    mb();
+    intf->in_cons = cons;
 
-	notify_daemon(dev);
+    notify_daemon(dev);
 
-	xencons_tx();
+    xencons_tx();
 #endif
 }
 
 #ifdef HAVE_LIBC
 int xencons_ring_avail(struct consfront_dev *dev)
 {
-	struct xencons_interface *intf;
-	XENCONS_RING_IDX cons, prod;
+    struct xencons_interface *intf;
+    XENCONS_RING_IDX cons, prod;
 
-        if (!dev)
-            intf = xencons_interface();
-        else
-            intf = dev->ring;
+    if ( !dev )
+        intf = xencons_interface();
+    else
+        intf = dev->ring;
 
-	cons = intf->in_cons;
-	prod = intf->in_prod;
-	mb();
-	BUG_ON((prod - cons) > sizeof(intf->in));
+    cons = intf->in_cons;
+    prod = intf->in_prod;
+    mb();
+    BUG_ON((prod - cons) > sizeof(intf->in));
 
-        return prod - cons;
+    return prod - cons;
 }
 
-int xencons_ring_recv(struct consfront_dev *dev, char *data, unsigned len)
+int xencons_ring_recv(struct consfront_dev *dev, char *data, unsigned int len)
 {
-	struct xencons_interface *intf;
-	XENCONS_RING_IDX cons, prod;
-        unsigned filled = 0;
+    struct xencons_interface *intf;
+    XENCONS_RING_IDX cons, prod;
+    unsigned int filled = 0;
 
-        if (!dev)
-            intf = xencons_interface();
-        else
-            intf = dev->ring;
+    if ( !dev )
+        intf = xencons_interface();
+    else
+        intf = dev->ring;
 
-	cons = intf->in_cons;
-	prod = intf->in_prod;
-	mb();
-	BUG_ON((prod - cons) > sizeof(intf->in));
+    cons = intf->in_cons;
+    prod = intf->in_prod;
+    mb();
+    BUG_ON((prod - cons) > sizeof(intf->in));
 
-        while (filled < len && cons + filled != prod) {
-                data[filled] = *(intf->in + MASK_XENCONS_IDX(cons + filled, intf->in));
-                filled++;
-	}
+    while ( filled < len && cons + filled != prod )
+    {
+        data[filled] = *(intf->in + MASK_XENCONS_IDX(cons + filled, intf->in));
+        filled++;
+    }
 
-	mb();
-        intf->in_cons = cons + filled;
+    mb();
+    intf->in_cons = cons + filled;
 
-	notify_daemon(dev);
+    notify_daemon(dev);
 
-        return filled;
+    return filled;
 }
 #endif
 
@@ -348,7 +356,7 @@ struct consfront_dev *xencons_ring_init(void)
 {
     struct consfront_dev *dev;
 
-    if (!console_evtchn)
+    if ( !console_evtchn )
         return 0;
 
     dev = malloc(sizeof(struct consfront_dev));
@@ -365,7 +373,7 @@ struct consfront_dev *xencons_ring_init(void)
     return resume_xen_console(dev);
 }
 
-static struct consfront_dev* resume_xen_console(struct consfront_dev* dev)
+static struct consfront_dev *resume_xen_console(struct consfront_dev *dev)
 {
     int err;
 
@@ -373,7 +381,8 @@ static struct consfront_dev* resume_xen_console(struct consfront_dev* dev)
     dev->ring = xencons_interface();
 
     err = bind_evtchn(dev->evtchn, console_handle_input, dev);
-    if (err <= 0) {
+    if ( err <= 0 )
+    {
         printk("XEN console request chn bind failed %i\n", err);
         free(dev);
         return NULL;
@@ -386,15 +395,16 @@ static struct consfront_dev* resume_xen_console(struct consfront_dev* dev)
     return dev;
 }
 
-void xencons_ring_fini(struct consfront_dev* dev)
+void xencons_ring_fini(struct consfront_dev *dev)
 {
-    if (dev)
+    if ( dev )
         mask_evtchn(dev->evtchn);
 }
 
-void xencons_ring_resume(struct consfront_dev* dev)
+void xencons_ring_resume(struct consfront_dev *dev)
 {
-    if (dev) {
+    if ( dev )
+    {
 #if CONFIG_PARAVIRT
         get_console(&start_info);
 #else
-- 
2.35.3



From minios-devel-bounces@lists.xenproject.org Mon Jun 20 07:38:44 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 20 Jun 2022 07:38:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.352535.579382 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3Bzg-000487-Di; Mon, 20 Jun 2022 07:38:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 352535.579382; Mon, 20 Jun 2022 07:38:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3Bzf-00046V-Jh; Mon, 20 Jun 2022 07:38:43 +0000
Received: by outflank-mailman (input) for mailman id 352535;
 Mon, 20 Jun 2022 07:38:41 +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 <SRS0=Hycu=W3=suse.com=jgross@srs-se1.protection.inumbo.net>)
 id 1o3Bzd-0002ZD-C4
 for minios-devel@lists.xenproject.org; Mon, 20 Jun 2022 07:38:41 +0000
Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id fc8da548-f06b-11ec-b725-ed86ccbb4733;
 Mon, 20 Jun 2022 09:38:33 +0200 (CEST)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out2.suse.de (Postfix) with ESMTPS id DD1BF1F965;
 Mon, 20 Jun 2022 07:38:33 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B0F56134CA;
 Mon, 20 Jun 2022 07:38:33 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id 6IjTKfkjsGI3DAAAMHmgww
 (envelope-from <jgross@suse.com>); Mon, 20 Jun 2022 07:38:33 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: fc8da548-f06b-11ec-b725-ed86ccbb4733
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1655710713; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=f6bMt+f3pFpdaJuWe2kNv32ADnt11PKGb5MGFZlNFfI=;
	b=VNs992xF2rRY/4TMpQS+AdsE1pIJcmbTPoytwq4AOuNVmc26FTTOceKPDsUytjkrUUe5or
	xJCnyoidGJMJbREy2Sg6fuYDJKx2nYd5nER40PXa1lL3dItCmAAGwF60c79bNec8yLZAoD
	k0aoUd+Uj+aBwVu0esc/XZxdkxlsQiA=
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH 5/8] mini-os: apply coding style to consfront.c
Date: Mon, 20 Jun 2022 09:38:17 +0200
Message-Id: <20220620073820.9336-6-jgross@suse.com>
X-Mailer: git-send-email 2.35.3
In-Reply-To: <20220620073820.9336-1-jgross@suse.com>
References: <20220620073820.9336-1-jgross@suse.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Make consfront.c coding style compliant.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 consfront.c | 97 +++++++++++++++++++++++++++++------------------------
 1 file changed, 53 insertions(+), 44 deletions(-)

diff --git a/consfront.c b/consfront.c
index 73659656..dfe6a3f0 100644
--- a/consfront.c
+++ b/consfront.c
@@ -15,26 +15,30 @@
 
 void free_consfront(struct consfront_dev *dev)
 {
-    char* err = NULL;
+    char *err = NULL;
     XenbusState state;
-
     char path[strlen(dev->backend) + strlen("/state") + 1];
     char nodename[strlen(dev->nodename) + strlen("/state") + 1];
 
     snprintf(path, sizeof(path), "%s/state", dev->backend);
     snprintf(nodename, sizeof(nodename), "%s/state", dev->nodename);
 
-    if ((err = xenbus_switch_state(XBT_NIL, nodename, XenbusStateClosing)) != NULL) {
+    if ( (err = xenbus_switch_state(XBT_NIL, nodename, XenbusStateClosing)) !=
+         NULL )
+    {
         printk("free_consfront: error changing state to %d: %s\n",
                 XenbusStateClosing, err);
         goto close;
     }
+
     state = xenbus_read_integer(path);
-    while (err == NULL && state < XenbusStateClosing)
+    while ( err == NULL && state < XenbusStateClosing )
         err = xenbus_wait_for_state_change(path, &state, &dev->events);
     free(err);
 
-    if ((err = xenbus_switch_state(XBT_NIL, nodename, XenbusStateClosed)) != NULL) {
+    if ( (err = xenbus_switch_state(XBT_NIL, nodename, XenbusStateClosed)) !=
+         NULL)
+    {
         printk("free_consfront: error changing state to %d: %s\n",
                 XenbusStateClosed, err);
         goto close;
@@ -59,19 +63,22 @@ close:
 struct consfront_dev *init_consfront(char *_nodename)
 {
     xenbus_transaction_t xbt;
-    char* err = NULL;
-    char* message=NULL;
-    int retry=0;
-    char* msg = NULL;
+    char *err = NULL;
+    char *message = NULL;
+    int retry = 0;
+    char *msg = NULL;
     char nodename[256];
     char path[256];
+    XenbusState state;
     static int consfrontends = 3;
     struct consfront_dev *dev;
     int res;
 
-    if (!_nodename)
-        snprintf(nodename, sizeof(nodename), "device/console/%d", consfrontends);
-    else {
+    if ( !_nodename )
+        snprintf(nodename, sizeof(nodename), "device/console/%d",
+                 consfrontends);
+    else
+    {
         strncpy(nodename, _nodename, sizeof(nodename) - 1);
         nodename[sizeof(nodename) - 1] = 0;
     }
@@ -87,13 +94,13 @@ struct consfront_dev *init_consfront(char *_nodename)
 #endif
 
     snprintf(path, sizeof(path), "%s/backend-id", nodename);
-    if ((res = xenbus_read_integer(path)) < 0) 
+    if ( (res = xenbus_read_integer(path)) < 0 )
         goto error;
     else
         dev->dom = res;
     evtchn_alloc_unbound(dev->dom, console_handle_input, dev, &dev->evtchn);
 
-    dev->ring = (struct xencons_interface *) alloc_page();
+    dev->ring = (struct xencons_interface *)alloc_page();
     memset(dev->ring, 0, PAGE_SIZE);
     dev->ring_ref = gnttab_grant_access(dev->dom, virt_to_mfn(dev->ring), 0);
 
@@ -101,33 +108,36 @@ struct consfront_dev *init_consfront(char *_nodename)
 
 again:
     err = xenbus_transaction_start(&xbt);
-    if (err) {
+    if ( err )
+    {
         printk("starting transaction\n");
         free(err);
     }
 
-    err = xenbus_printf(xbt, nodename, "ring-ref","%u",
-                dev->ring_ref);
-    if (err) {
+    err = xenbus_printf(xbt, nodename, "ring-ref","%u", dev->ring_ref);
+    if ( err )
+    {
         message = "writing ring-ref";
         goto abort_transaction;
     }
-    err = xenbus_printf(xbt, nodename,
-                "port", "%u", dev->evtchn);
-    if (err) {
+    err = xenbus_printf(xbt, nodename, "port", "%u", dev->evtchn);
+    if ( err )
+    {
         message = "writing event-channel";
         goto abort_transaction;
     }
-    err = xenbus_printf(xbt, nodename,
-                "protocol", "%s", XEN_IO_PROTO_ABI_NATIVE);
-    if (err) {
+    err = xenbus_printf(xbt, nodename, "protocol", "%s",
+                        XEN_IO_PROTO_ABI_NATIVE);
+    if ( err )
+    {
         message = "writing protocol";
         goto abort_transaction;
     }
 
     snprintf(path, sizeof(path), "%s/state", nodename);
     err = xenbus_switch_state(xbt, path, XenbusStateConnected);
-    if (err) {
+    if ( err )
+    {
         message = "switching state";
         goto abort_transaction;
     }
@@ -135,8 +145,9 @@ again:
 
     err = xenbus_transaction_end(xbt, 0, &retry);
     free(err);
-    if (retry) {
-            goto again;
+    if ( retry )
+    {
+        goto again;
         printk("completing transaction\n");
     }
 
@@ -149,31 +160,28 @@ abort_transaction:
     goto error;
 
 done:
-
     snprintf(path, sizeof(path), "%s/backend", nodename);
     msg = xenbus_read(XBT_NIL, path, &dev->backend);
-    if (msg) {
+    if ( msg )
+    {
         printk("Error %s when reading the backend path %s\n", msg, path);
         goto error;
     }
 
     printk("backend at %s\n", dev->backend);
+    snprintf(path, sizeof(path), "%s/state", dev->backend);
+
+    free(xenbus_watch_path_token(XBT_NIL, path, path, &dev->events));
+    msg = NULL;
+    state = xenbus_read_integer(path);
+    while ( msg == NULL && state < XenbusStateConnected )
+        msg = xenbus_wait_for_state_change(path, &state, &dev->events);
 
+    if ( msg != NULL || state != XenbusStateConnected )
     {
-        XenbusState state;
-        char path[strlen(dev->backend) + strlen("/state") + 1];
-        snprintf(path, sizeof(path), "%s/state", dev->backend);
-        
-	free(xenbus_watch_path_token(XBT_NIL, path, path, &dev->events));
-        msg = NULL;
-        state = xenbus_read_integer(path);
-        while (msg == NULL && state < XenbusStateConnected)
-            msg = xenbus_wait_for_state_change(path, &state, &dev->events);
-        if (msg != NULL || state != XenbusStateConnected) {
-            printk("backend not available, state=%d\n", state);
-            err = xenbus_unwatch_path_token(XBT_NIL, path, path);
-            goto error;
-        }
+        printk("backend not available, state=%d\n", state);
+        err = xenbus_unwatch_path_token(XBT_NIL, path, path);
+        goto error;
     }
     unmask_evtchn(dev->evtchn);
 
@@ -190,7 +198,8 @@ error:
 
 void fini_consfront(struct consfront_dev *dev)
 {
-    if (dev) free_consfront(dev);
+    if ( dev )
+        free_consfront(dev);
 }
 
 #ifdef HAVE_LIBC
-- 
2.35.3



From minios-devel-bounces@lists.xenproject.org Mon Jun 20 07:38:44 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 20 Jun 2022 07:38:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.352536.579388 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3Bzg-000498-Ms; Mon, 20 Jun 2022 07:38:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 352536.579388; Mon, 20 Jun 2022 07:38:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3Bzf-000480-NJ; Mon, 20 Jun 2022 07:38:43 +0000
Received: by outflank-mailman (input) for mailman id 352536;
 Mon, 20 Jun 2022 07:38:42 +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 <SRS0=Hycu=W3=suse.com=jgross@srs-se1.protection.inumbo.net>)
 id 1o3Bzd-0002ZE-KN
 for minios-devel@lists.xenproject.org; Mon, 20 Jun 2022 07:38:41 +0000
Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id fc822beb-f06b-11ec-bd2d-47488cf2e6aa;
 Mon, 20 Jun 2022 09:38:34 +0200 (CEST)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out1.suse.de (Postfix) with ESMTPS id 4217C21BC8;
 Mon, 20 Jun 2022 07:38:33 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 09A63134CA;
 Mon, 20 Jun 2022 07:38:33 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id mPnvAPkjsGI3DAAAMHmgww
 (envelope-from <jgross@suse.com>); Mon, 20 Jun 2022 07:38:33 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: fc822beb-f06b-11ec-bd2d-47488cf2e6aa
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1655710713; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=vgB6fTgQL43gcxc48HlbOD3FwW8e0Wc8cOsNTfGA2fM=;
	b=pFYN5R+LFVNfPmEVSqYvHvqQvriSnnGqsviLHmWLZN+qbOrSZmjz5jINkVb2suyJKZcFXs
	T5H17S/1T20lJ1HvSBtEMJLpaUw9kQpJ+694TjSPAMvGxs7+QMLRr6wWvX9FRJTLfon+eD
	i/XDrNOXTMWFH7sHC3hsj4X3ZoJ3p2o=
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH 2/8] mini-os: apply coding style to xenbus.c
Date: Mon, 20 Jun 2022 09:38:14 +0200
Message-Id: <20220620073820.9336-3-jgross@suse.com>
X-Mailer: git-send-email 2.35.3
In-Reply-To: <20220620073820.9336-1-jgross@suse.com>
References: <20220620073820.9336-1-jgross@suse.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Make xenbus.c coding style compliant.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 xenbus.c | 510 +++++++++++++++++++++++++++++++++----------------------
 1 file changed, 303 insertions(+), 207 deletions(-)

diff --git a/xenbus.c b/xenbus.c
index b687678f..aa1fe7bf 100644
--- a/xenbus.c
+++ b/xenbus.c
@@ -1,15 +1,15 @@
-/* 
+/*
  ****************************************************************************
  * (C) 2006 - Cambridge University
  ****************************************************************************
  *
  *        File: xenbus.c
- *      Author: Steven Smith (sos22@cam.ac.uk) 
+ *      Author: Steven Smith (sos22@cam.ac.uk)
  *     Changes: Grzegorz Milos (gm281@cam.ac.uk)
  *     Changes: John D. Ramsdell
- *              
+ *
  *        Date: Jun 2006, chages Aug 2005
- * 
+ *
  * Environment: Xen Minimal OS
  * Description: Minimal implementation of xenbus
  *
@@ -32,10 +32,10 @@
 #include <mini-os/semaphore.h>
 
 #define min(x,y) ({                       \
-        typeof(x) tmpx = (x);                 \
-        typeof(y) tmpy = (y);                 \
-        tmpx < tmpy ? tmpx : tmpy;            \
-        })
+    typeof(x) tmpx = (x);                 \
+    typeof(y) tmpy = (y);                 \
+    tmpx < tmpy ? tmpx : tmpy;            \
+    })
 
 #ifdef XENBUS_DEBUG
 #define DEBUG(_f, _a...) \
@@ -56,7 +56,8 @@ static struct watch {
     xenbus_event_queue *events;
     struct watch *next;
 } *watches;
-struct xenbus_req_info 
+
+struct xenbus_req_info
 {
     int in_use:1;
     struct wait_queue_head waitq;
@@ -93,14 +94,12 @@ void get_xenbus(void *p)
 }
 #endif
 
-static void memcpy_from_ring(const void *Ring,
-        void *Dest,
-        int off,
-        int len)
+static void memcpy_from_ring(const void *Ring, void *Dest, int off, int len)
 {
     int c1, c2;
     const char *ring = Ring;
     char *dest = Dest;
+
     c1 = min(len, XENSTORE_RING_SIZE - off);
     c2 = len - c1;
     memcpy(dest, ring + off, c1);
@@ -111,24 +110,28 @@ char **xenbus_wait_for_watch_return(xenbus_event_queue *queue)
 {
     struct xenbus_event *event;
     DEFINE_WAIT(w);
-    if (!queue)
+
+    if ( !queue )
         queue = &xenbus_events;
-    while (!(event = *queue)) {
+    while ( !(event = *queue) )
+    {
         add_waiter(w, xenbus_watch_queue);
         schedule();
     }
     remove_waiter(w, xenbus_watch_queue);
     *queue = event->next;
+
     return &event->path;
 }
 
 void xenbus_wait_for_watch(xenbus_event_queue *queue)
 {
     char **ret;
-    if (!queue)
+
+    if ( !queue )
         queue = &xenbus_events;
     ret = xenbus_wait_for_watch_return(queue);
-    if (ret)
+    if ( ret )
         free(ret);
     else
         printk("unexpected path returned by watch\n");
@@ -137,33 +140,39 @@ void xenbus_wait_for_watch(xenbus_event_queue *queue)
 void xenbus_release_wait_for_watch(xenbus_event_queue *queue)
 {
     struct xenbus_event *event = malloc(sizeof(*event));
+
     event->next = *queue;
     *queue = event;
     wake_up(&xenbus_watch_queue);
 }
 
-char* xenbus_wait_for_value(const char* path, const char* value, xenbus_event_queue *queue)
+char *xenbus_wait_for_value(const char *path, const char *value,
+                            xenbus_event_queue *queue)
 {
-    if (!queue)
+    if ( !queue )
         queue = &xenbus_events;
-    for(;;)
+
+    for( ;; )
     {
         char *res, *msg;
         int r;
 
         msg = xenbus_read(XBT_NIL, path, &res);
-        if(msg) return msg;
+        if ( msg )
+            return msg;
 
         r = strcmp(value,res);
         free(res);
 
-        if(r==0) break;
-        else xenbus_wait_for_watch(queue);
+        if ( r==0 )
+            return NULL;
+
+        xenbus_wait_for_watch(queue);
     }
-    return NULL;
 }
 
-char *xenbus_switch_state(xenbus_transaction_t xbt, const char* path, XenbusState state)
+char *xenbus_switch_state(xenbus_transaction_t xbt, const char *path,
+                          XenbusState state)
 {
     char *current_state;
     char *msg = NULL;
@@ -174,18 +183,22 @@ char *xenbus_switch_state(xenbus_transaction_t xbt, const char* path, XenbusStat
     int retry = 0;
 
     do {
-        if (xbt == XBT_NIL) {
+        if ( xbt == XBT_NIL )
+        {
             msg = xenbus_transaction_start(&xbt);
-            if (msg) goto exit;
+            if ( msg )
+                goto exit;
             xbt_flag = 1;
         }
 
         msg = xenbus_read(xbt, path, &current_state);
-        if (msg) goto exit;
+        if ( msg )
+            goto exit;
 
         rs = (XenbusState) (current_state[0] - '0');
         free(current_state);
-        if (rs == state) {
+        if ( rs == state )
+        {
             msg = NULL;
             goto exit;
         }
@@ -194,37 +207,42 @@ char *xenbus_switch_state(xenbus_transaction_t xbt, const char* path, XenbusStat
         msg = xenbus_write(xbt, path, value);
 
 exit:
-        if (xbt_flag) {
+        if ( xbt_flag )
+        {
             msg2 = xenbus_transaction_end(xbt, 0, &retry);
             xbt = XBT_NIL;
         }
-        if (msg == NULL && msg2 != NULL)
+        if ( msg == NULL && msg2 != NULL )
             msg = msg2;
         else
             free(msg2);
-    } while (retry);
+    } while ( retry );
 
     return msg;
 }
 
-char *xenbus_wait_for_state_change(const char* path, XenbusState *state, xenbus_event_queue *queue)
+char *xenbus_wait_for_state_change(const char *path, XenbusState *state,
+                                   xenbus_event_queue *queue)
 {
-    if (!queue)
+    if ( !queue )
         queue = &xenbus_events;
-    for(;;)
+
+    for( ;; )
     {
         char *res, *msg;
         XenbusState rs;
 
         msg = xenbus_read(XBT_NIL, path, &res);
-        if(msg) return msg;
+        if ( msg )
+            return msg;
 
-        rs = (XenbusState) (res[0] - 48);
+        rs = (XenbusState)(res[0] - 48);
         free(res);
 
-        if (rs == *state)
+        if ( rs == *state )
             xenbus_wait_for_watch(queue);
-        else {
+        else
+        {
             *state = rs;
             break;
         }
@@ -232,14 +250,13 @@ char *xenbus_wait_for_state_change(const char* path, XenbusState *state, xenbus_
     return NULL;
 }
 
-
 static void xenbus_read_data(char *buf, unsigned int len)
 {
     unsigned int off = 0;
     unsigned int prod, cons;
     unsigned int size;
 
-    while (off != len)
+    while ( off != len )
     {
         wait_event(xb_waitq, xenstore_buf->rsp_prod != xenstore_buf->rsp_cons);
 
@@ -255,7 +272,7 @@ static void xenbus_read_data(char *buf, unsigned int len)
         mb();    /* memcpy() and rsp_cons update must not be reordered. */
         xenstore_buf->rsp_cons += size;
         mb();    /* rsp_cons must be visible before we look at rsp_prod. */
-        if (xenstore_buf->rsp_prod - cons >= XENSTORE_RING_SIZE)
+        if ( xenstore_buf->rsp_prod - cons >= XENSTORE_RING_SIZE )
             notify_remote_via_evtchn(xenbus_evtchn);
     }
 }
@@ -265,30 +282,35 @@ static void xenbus_thread_func(void *ign)
     struct xsd_sockmsg msg;
     char *data;
 
-    for (;;) {
+    for ( ;; )
+    {
         xenbus_read_data((char *)&msg, sizeof(msg));
         DEBUG("Msg len %d, %d avail, id %d.\n", msg.len + sizeof(msg),
               xenstore_buf->rsp_prod - xenstore_buf->rsp_cons, msg.req_id);
 
-        if (msg.len > XENSTORE_PAYLOAD_MAX) {
+        if ( msg.len > XENSTORE_PAYLOAD_MAX )
+        {
             printk("Xenstore violates protocol, message longer than allowed.\n");
             return;
         }
 
-        if (msg.type == XS_WATCH_EVENT) {
+        if ( msg.type == XS_WATCH_EVENT )
+        {
             struct xenbus_event *event = malloc(sizeof(*event) + msg.len);
             xenbus_event_queue *events = NULL;
             struct watch *watch;
             char *c;
             int zeroes = 0;
 
-            data = (char*)event + sizeof(*event);
+            data = (char *)event + sizeof(*event);
             xenbus_read_data(data, msg.len);
 
-            for (c = data; c < data + msg.len; c++)
-                if (!*c)
+            for ( c = data; c < data + msg.len; c++ )
+                if ( !*c )
                     zeroes++;
-            if (zeroes != 2) {
+
+            if ( zeroes != 2 )
+            {
                 printk("Xenstore: illegal watch event data\n");
                 free(event);
                 continue;
@@ -297,17 +319,21 @@ static void xenbus_thread_func(void *ign)
             event->path = data;
             event->token = event->path + strlen(event->path) + 1;
 
-            for (watch = watches; watch; watch = watch->next)
-                if (!strcmp(watch->token, event->token)) {
+            for ( watch = watches; watch; watch = watch->next )
+                if ( !strcmp(watch->token, event->token) )
+                {
                     events = watch->events;
                     break;
                 }
 
-            if (events) {
+            if ( events )
+            {
                 event->next = *events;
                 *events = event;
                 wake_up(&xenbus_watch_queue);
-            } else {
+            }
+            else
+            {
                 printk("Xenstore: unexpected watch token %s\n", event->token);
                 free(event);
             }
@@ -319,7 +345,8 @@ static void xenbus_thread_func(void *ign)
         memcpy(data, &msg, sizeof(msg));
         xenbus_read_data(data + sizeof(msg), msg.len);
 
-        if (msg.req_id >= NR_REQS || !req_info[msg.req_id].in_use) {
+        if ( msg.req_id >= NR_REQS || !req_info[msg.req_id].in_use )
+        {
             printk("Xenstore: illegal request id %d\n", msg.req_id);
             free(data);
             continue;
@@ -334,7 +361,7 @@ static void xenbus_thread_func(void *ign)
 }
 
 static void xenbus_evtchn_handler(evtchn_port_t port, struct pt_regs *regs,
-				  void *ign)
+                                  void *ign)
 {
     wake_up(&xb_waitq);
 }
@@ -347,12 +374,15 @@ static DECLARE_WAIT_QUEUE_HEAD(req_wq);
 static void release_xenbus_id(int id)
 {
     BUG_ON(!req_info[id].in_use);
+
     spin_lock(&req_lock);
+
     req_info[id].in_use = 0;
     nr_live_reqs--;
     req_info[id].in_use = 0;
-    if (nr_live_reqs == 0 || nr_live_reqs == NR_REQS - 1)
+    if ( nr_live_reqs == 0 || nr_live_reqs == NR_REQS - 1 )
         wake_up(&req_wq);
+
     spin_unlock(&req_lock);
 }
 
@@ -363,27 +393,27 @@ static int allocate_xenbus_id(void)
     static int probe;
     int o_probe;
 
-    while (1) 
+    while ( 1 )
     {
         spin_lock(&req_lock);
-        if (nr_live_reqs < NR_REQS)
+        if ( nr_live_reqs < NR_REQS )
             break;
         spin_unlock(&req_lock);
-        wait_event(req_wq, (nr_live_reqs < NR_REQS));
+        wait_event(req_wq, nr_live_reqs < NR_REQS);
     }
 
     o_probe = probe;
-    for (;;) 
+    while ( req_info[o_probe].in_use )
     {
-        if (!req_info[o_probe].in_use)
-            break;
         o_probe = (o_probe + 1) % NR_REQS;
         BUG_ON(o_probe == probe);
     }
     nr_live_reqs++;
     req_info[o_probe].in_use = 1;
     probe = (o_probe + 1) % NR_REQS;
+
     spin_unlock(&req_lock);
+
     init_waitqueue_head(&req_info[o_probe].waitq);
 
     return o_probe;
@@ -393,6 +423,7 @@ static int allocate_xenbus_id(void)
 void init_xenbus(void)
 {
     int err;
+
     DEBUG("init_xenbus called.\n");
     create_thread("xenstore", xenbus_thread_func, NULL);
     DEBUG("buf at %p.\n", xenstore_buf);
@@ -408,13 +439,13 @@ void fini_xenbus(void)
 void suspend_xenbus(void)
 {
     /* Check for live requests and wait until they finish */
-    while (1)
+    while ( 1 )
     {
         spin_lock(&req_lock);
-        if (nr_live_reqs == 0)
+        if ( nr_live_reqs == 0 )
             break;
         spin_unlock(&req_lock);
-        wait_event(req_wq, (nr_live_reqs == 0));
+        wait_event(req_wq, nr_live_reqs == 0);
     }
 
     mask_evtchn(xenbus_evtchn);
@@ -436,8 +467,10 @@ void resume_xenbus(int canceled)
 #endif
     unmask_evtchn(xenbus_evtchn);
 
-    if (!canceled) {
-        for (watch = watches; watch; watch = watch->next) {
+    if ( !canceled )
+    {
+        for ( watch = watches; watch; watch = watch->next )
+        {
             req[0].data = watch->path;
             req[0].len = strlen(watch->path) + 1;
             req[1].data = watch->token;
@@ -445,10 +478,12 @@ void resume_xenbus(int canceled)
 
             rep = xenbus_msg_reply(XS_WATCH, XBT_NIL, req, ARRAY_SIZE(req));
             msg = errmsg(rep);
-            if (msg) {
+            if ( msg )
+            {
                 xprintk("error on XS_WATCH: %s\n", msg);
                 free(msg);
-            } else
+            }
+            else
                 free(rep);
         }
     }
@@ -456,12 +491,14 @@ void resume_xenbus(int canceled)
     notify_remote_via_evtchn(xenbus_evtchn);
 }
 
-/* Send data to xenbus.  This can block.  All of the requests are seen
-   by xenbus as if sent atomically.  The header is added
-   automatically, using type %type, req_id %req_id, and trans_id
-   %trans_id. */
+/*
+ * Send data to xenbus.  This can block.  All of the requests are seen
+ * by xenbus as if sent atomically.  The header is added
+ * automatically, using type %type, req_id %req_id, and trans_id
+ * %trans_id.
+ */
 static void xb_write(int type, int req_id, xenbus_transaction_t trans_id,
-		     const struct write_req *req, int nr_reqs)
+                     const struct write_req *req, int nr_reqs)
 {
     XENSTORE_RING_IDX prod;
     int r;
@@ -470,12 +507,12 @@ static void xb_write(int type, int req_id, xenbus_transaction_t trans_id,
     int req_off;
     int total_off;
     int this_chunk;
-    struct xsd_sockmsg m = {.type = type, .req_id = req_id,
-        .tx_id = trans_id };
+    struct xsd_sockmsg m = {.type = type, .req_id = req_id, .tx_id = trans_id };
     struct write_req header_req = { &m, sizeof(m) };
 
-    for (r = 0; r < nr_reqs; r++)
+    for ( r = 0; r < nr_reqs; r++ )
         len += req[r].len;
+
     m.len = len;
     len += sizeof(m);
 
@@ -489,10 +526,10 @@ static void xb_write(int type, int req_id, xenbus_transaction_t trans_id,
     /* Send the message in chunks using free ring space when available. */
     total_off = 0;
     req_off = 0;
-    while (total_off < len)
+    while ( total_off < len )
     {
         prod = xenstore_buf->req_prod;
-        if (prod - xenstore_buf->req_cons >= XENSTORE_RING_SIZE)
+        if ( prod - xenstore_buf->req_cons >= XENSTORE_RING_SIZE )
         {
             /* Send evtchn to notify remote */
             notify_remote_via_evtchn(xenbus_evtchn);
@@ -514,10 +551,10 @@ static void xb_write(int type, int req_id, xenbus_transaction_t trans_id,
         prod += this_chunk;
         req_off += this_chunk;
         total_off += this_chunk;
-        if (req_off == cur_req->len)
+        if ( req_off == cur_req->len )
         {
             req_off = 0;
-            if (cur_req == &header_req)
+            if ( cur_req == &header_req )
                 cur_req = req;
             else
                 cur_req++;
@@ -538,14 +575,13 @@ static void xb_write(int type, int req_id, xenbus_transaction_t trans_id,
     up(&xb_write_sem);
 }
 
-/* Send a mesasge to xenbus, in the same fashion as xb_write, and
-   block waiting for a reply.  The reply is malloced and should be
-   freed by the caller. */
-struct xsd_sockmsg *
-xenbus_msg_reply(int type,
-		 xenbus_transaction_t trans,
-		 struct write_req *io,
-		 int nr_reqs)
+/*
+ * Send a mesasge to xenbus, in the same fashion as xb_write, and
+ * block waiting for a reply.  The reply is malloced and should be
+ * freed by the caller.
+ */
+struct xsd_sockmsg *xenbus_msg_reply(int type, xenbus_transaction_t trans,
+                                     struct write_req *io, int nr_reqs)
 {
     int id;
     DEFINE_WAIT(w);
@@ -563,29 +599,36 @@ xenbus_msg_reply(int type,
     rep = req_info[id].reply;
     BUG_ON(rep->req_id != id);
     release_xenbus_id(id);
+
     return rep;
 }
 
 static char *errmsg(struct xsd_sockmsg *rep)
 {
     char *res;
-    if (!rep) {
-	char msg[] = "No reply";
-	size_t len = strlen(msg) + 1;
-	return memcpy(malloc(len), msg, len);
+
+    if ( !rep )
+    {
+        char msg[] = "No reply";
+        size_t len = strlen(msg) + 1;
+        return memcpy(malloc(len), msg, len);
     }
-    if (rep->type != XS_ERROR)
-	return NULL;
+    if ( rep->type != XS_ERROR )
+        return NULL;
+
     res = malloc(rep->len + 1);
     memcpy(res, rep + 1, rep->len);
     res[rep->len] = 0;
     free(rep);
+
     return res;
 }
 
-/* List the contents of a directory.  Returns a malloc()ed array of
-   pointers to malloc()ed strings.  The array is NULL terminated.  May
-   block. */
+/*
+ * List the contents of a directory.  Returns a malloc()ed array of
+ * pointers to malloc()ed strings.  The array is NULL terminated.  May
+ * block.
+ */
 char *xenbus_ls(xenbus_transaction_t xbt, const char *pre, char ***contents)
 {
     struct xsd_sockmsg *reply, *repmsg;
@@ -595,23 +638,30 @@ char *xenbus_ls(xenbus_transaction_t xbt, const char *pre, char ***contents)
 
     repmsg = xenbus_msg_reply(XS_DIRECTORY, xbt, req, ARRAY_SIZE(req));
     msg = errmsg(repmsg);
-    if (msg) {
-	*contents = NULL;
-	return msg;
+    if ( msg )
+    {
+        *contents = NULL;
+        return msg;
     }
+
     reply = repmsg + 1;
-    for (x = nr_elems = 0; x < repmsg->len; x++)
+    for ( x = nr_elems = 0; x < repmsg->len; x++ )
         nr_elems += (((char *)reply)[x] == 0);
+
     res = malloc(sizeof(res[0]) * (nr_elems + 1));
-    for (x = i = 0; i < nr_elems; i++) {
+    for ( x = i = 0; i < nr_elems; i++ )
+    {
         int l = strlen((char *)reply + x);
+
         res[i] = malloc(l + 1);
         memcpy(res[i], (char *)reply + x, l + 1);
         x += l + 1;
     }
+
     res[i] = NULL;
     free(repmsg);
     *contents = res;
+
     return NULL;
 }
 
@@ -620,49 +670,56 @@ char *xenbus_read(xenbus_transaction_t xbt, const char *path, char **value)
     struct write_req req[] = { {path, strlen(path) + 1} };
     struct xsd_sockmsg *rep;
     char *res, *msg;
+
     rep = xenbus_msg_reply(XS_READ, xbt, req, ARRAY_SIZE(req));
     msg = errmsg(rep);
-    if (msg) {
-	*value = NULL;
-	return msg;
+    if ( msg )
+    {
+        *value = NULL;
+        return msg;
     }
+
     res = malloc(rep->len + 1);
     memcpy(res, rep + 1, rep->len);
     res[rep->len] = 0;
     free(rep);
     *value = res;
+
     return NULL;
 }
 
-char *xenbus_write(xenbus_transaction_t xbt, const char *path, const char *value)
+char *xenbus_write(xenbus_transaction_t xbt, const char *path,
+                   const char *value)
 {
-    struct write_req req[] = { 
-	{path, strlen(path) + 1},
-	{value, strlen(value)},
+    struct write_req req[] = {
+        {path, strlen(path) + 1},
+        {value, strlen(value)},
     };
     struct xsd_sockmsg *rep;
     char *msg;
+
     rep = xenbus_msg_reply(XS_WRITE, xbt, req, ARRAY_SIZE(req));
     msg = errmsg(rep);
-    if (msg) return msg;
+    if ( msg )
+        return msg;
+
     free(rep);
+
     return NULL;
 }
 
-char* xenbus_watch_path_token( xenbus_transaction_t xbt, const char *path, const char *token, xenbus_event_queue *events)
+char* xenbus_watch_path_token(xenbus_transaction_t xbt, const char *path,
+                              const char *token, xenbus_event_queue *events)
 {
     struct xsd_sockmsg *rep;
-
-    struct write_req req[] = { 
+    struct write_req req[] = {
         {path, strlen(path) + 1},
-	{token, strlen(token) + 1},
+        {token, strlen(token) + 1},
     };
-
     struct watch *watch = malloc(sizeof(*watch));
-
     char *msg;
 
-    if (!events)
+    if ( !events )
         events = &xenbus_events;
 
     watch->token = strdup(token);
@@ -674,33 +731,37 @@ char* xenbus_watch_path_token( xenbus_transaction_t xbt, const char *path, const
     rep = xenbus_msg_reply(XS_WATCH, xbt, req, ARRAY_SIZE(req));
 
     msg = errmsg(rep);
-    if (msg) return msg;
+    if ( msg )
+        return msg;
+
     free(rep);
 
     return NULL;
 }
 
-char* xenbus_unwatch_path_token( xenbus_transaction_t xbt, const char *path, const char *token)
+char* xenbus_unwatch_path_token(xenbus_transaction_t xbt, const char *path,
+                                const char *token)
 {
     struct xsd_sockmsg *rep;
-
-    struct write_req req[] = { 
+    struct write_req req[] = {
         {path, strlen(path) + 1},
-	{token, strlen(token) + 1},
+        {token, strlen(token) + 1},
     };
-
     struct watch *watch, **prev;
-
     char *msg;
 
     rep = xenbus_msg_reply(XS_UNWATCH, xbt, req, ARRAY_SIZE(req));
 
     msg = errmsg(rep);
-    if (msg) return msg;
+    if ( msg )
+        return msg;
+
     free(rep);
 
-    for (prev = &watches, watch = *prev; watch; prev = &watch->next, watch = *prev)
-        if (!strcmp(watch->token, token)) {
+    for ( prev = &watches, watch = *prev; watch;
+          prev = &watch->next, watch = *prev)
+        if ( !strcmp(watch->token, token) )
+        {
             free(watch->token);
             free(watch->path);
             *prev = watch->next;
@@ -716,11 +777,14 @@ char *xenbus_rm(xenbus_transaction_t xbt, const char *path)
     struct write_req req[] = { {path, strlen(path) + 1} };
     struct xsd_sockmsg *rep;
     char *msg;
+
     rep = xenbus_msg_reply(XS_RM, xbt, req, ARRAY_SIZE(req));
     msg = errmsg(rep);
-    if (msg)
-	return msg;
+    if ( msg )
+        return msg;
+
     free(rep);
+
     return NULL;
 }
 
@@ -729,59 +793,70 @@ char *xenbus_get_perms(xenbus_transaction_t xbt, const char *path, char **value)
     struct write_req req[] = { {path, strlen(path) + 1} };
     struct xsd_sockmsg *rep;
     char *res, *msg;
+
     rep = xenbus_msg_reply(XS_GET_PERMS, xbt, req, ARRAY_SIZE(req));
     msg = errmsg(rep);
-    if (msg) {
-	*value = NULL;
-	return msg;
+    if ( msg )
+    {
+        *value = NULL;
+        return msg;
     }
+
     res = malloc(rep->len + 1);
     memcpy(res, rep + 1, rep->len);
     res[rep->len] = 0;
     free(rep);
     *value = res;
+
     return NULL;
 }
 
 #define PERM_MAX_SIZE 32
-char *xenbus_set_perms(xenbus_transaction_t xbt, const char *path, domid_t dom, char perm)
+char *xenbus_set_perms(xenbus_transaction_t xbt, const char *path, domid_t dom,
+                       char perm)
 {
     char value[PERM_MAX_SIZE];
-    struct write_req req[] = { 
-	{path, strlen(path) + 1},
-	{value, 0},
+    struct write_req req[] = {
+        {path, strlen(path) + 1},
+        {value, 0},
     };
     struct xsd_sockmsg *rep;
     char *msg;
+
     snprintf(value, PERM_MAX_SIZE, "%c%hu", perm, dom);
     req[1].len = strlen(value) + 1;
     rep = xenbus_msg_reply(XS_SET_PERMS, xbt, req, ARRAY_SIZE(req));
     msg = errmsg(rep);
-    if (msg)
-	return msg;
+    if ( msg )
+        return msg;
+
     free(rep);
+
     return NULL;
 }
 
 char *xenbus_transaction_start(xenbus_transaction_t *xbt)
 {
-    /* xenstored becomes angry if you send a length 0 message, so just
-       shove a nul terminator on the end */
+    /*
+     * xenstored becomes angry if you send a length 0 message, so just
+     * shove a nul terminator on the end
+     */
     struct write_req req = { "", 1};
     struct xsd_sockmsg *rep;
     char *err;
 
     rep = xenbus_msg_reply(XS_TRANSACTION_START, 0, &req, 1);
     err = errmsg(rep);
-    if (err)
-	return err;
+    if ( err )
+        return err;
+
     sscanf((char *)(rep + 1), "%lu", xbt);
     free(rep);
+
     return NULL;
 }
 
-char *
-xenbus_transaction_end(xenbus_transaction_t t, int abort, int *retry)
+char *xenbus_transaction_end(xenbus_transaction_t t, int abort, int *retry)
 {
     struct xsd_sockmsg *rep;
     struct write_req req;
@@ -793,16 +868,19 @@ xenbus_transaction_end(xenbus_transaction_t t, int abort, int *retry)
     req.len = 2;
     rep = xenbus_msg_reply(XS_TRANSACTION_END, t, &req, 1);
     err = errmsg(rep);
-    if (err) {
-	if (!strcmp(err, "EAGAIN")) {
-	    *retry = 1;
-	    free(err);
-	    return NULL;
-	} else {
-	    return err;
-	}
+    if ( err )
+    {
+        if ( !strcmp(err, "EAGAIN") )
+        {
+            *retry = 1;
+            free(err);
+            return NULL;
+        }
+        else
+            return err;
     }
     free(rep);
+
     return NULL;
 }
 
@@ -812,46 +890,54 @@ int xenbus_read_integer(const char *path)
     int t;
 
     res = xenbus_read(XBT_NIL, path, &buf);
-    if (res) {
-	printk("Failed to read %s.\n", path);
-	free(res);
-	return -1;
+    if ( res )
+    {
+        printk("Failed to read %s.\n", path);
+        free(res);
+        return -1;
     }
+
     sscanf(buf, "%d", &t);
     free(buf);
+
     return t;
 }
 
-int xenbus_read_uuid(const char* path, unsigned char uuid[16]) {
-   char * res, *buf;
-   res = xenbus_read(XBT_NIL, path, &buf);
-   if(res) {
-      printk("Failed to read %s.\n", path);
-      free(res);
-      return 0;
-   }
-   if(strlen(buf) != ((2*16)+4) /* 16 hex bytes and 4 hyphens */
-         || sscanf(buf,
-            "%2hhx%2hhx%2hhx%2hhx-"
-            "%2hhx%2hhx-"
-            "%2hhx%2hhx-"
-            "%2hhx%2hhx-"
-            "%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx",
-            uuid, uuid + 1, uuid + 2, uuid + 3,
-            uuid + 4, uuid + 5, uuid + 6, uuid + 7,
-            uuid + 8, uuid + 9, uuid + 10, uuid + 11,
-            uuid + 12, uuid + 13, uuid + 14, uuid + 15) != 16) {
-      printk("Xenbus path %s value %s is not a uuid!\n", path, buf);
-      free(buf);
-      return 0;
-   }
-   free(buf);
-   return 1;
-}
-
-char* xenbus_printf(xenbus_transaction_t xbt,
-                                  const char* node, const char* path,
-                                  const char* fmt, ...)
+int xenbus_read_uuid(const char *path, unsigned char uuid[16])
+{
+    char *res, *buf;
+
+    res = xenbus_read(XBT_NIL, path, &buf);
+    if ( res )
+    {
+       printk("Failed to read %s.\n", path);
+       free(res);
+       return 0;
+    }
+
+    if ( strlen(buf) != ((2 * 16) + 4) /* 16 hex bytes and 4 hyphens */ ||
+         sscanf(buf, "%2hhx%2hhx%2hhx%2hhx-"
+                     "%2hhx%2hhx-"
+                     "%2hhx%2hhx-"
+                     "%2hhx%2hhx-"
+                     "%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx",
+                uuid, uuid + 1, uuid + 2, uuid + 3,
+                uuid + 4, uuid + 5, uuid + 6, uuid + 7,
+                uuid + 8, uuid + 9, uuid + 10, uuid + 11,
+                uuid + 12, uuid + 13, uuid + 14, uuid + 15) != 16)
+    {
+        printk("Xenbus path %s value %s is not a uuid!\n", path, buf);
+        free(buf);
+        return 0;
+    }
+
+    free(buf);
+
+    return 1;
+}
+
+char *xenbus_printf(xenbus_transaction_t xbt, const char* node,
+                    const char* path, const char* fmt, ...)
 {
 #define BUFFER_SIZE 256
     char fullpath[BUFFER_SIZE];
@@ -863,6 +949,7 @@ char* xenbus_printf(xenbus_transaction_t xbt,
     va_start(args, fmt);
     vsprintf(val, fmt, args);
     va_end(args);
+
     return xenbus_write(xbt,fullpath,val);
 }
 
@@ -890,7 +977,7 @@ static void xenbus_debug_msg(const char *msg)
 
     reply = xenbus_msg_reply(XS_DEBUG, 0, req, ARRAY_SIZE(req));
     printk("Got a reply, type %d, id %d, len %d.\n",
-            reply->type, reply->req_id, reply->len);
+           reply->type, reply->req_id, reply->len);
 }
 
 static void do_ls_test(const char *pre)
@@ -900,28 +987,33 @@ static void do_ls_test(const char *pre)
 
     printk("ls %s...\n", pre);
     msg = xenbus_ls(XBT_NIL, pre, &dirs);
-    if (msg) {
-	printk("Error in xenbus ls: %s\n", msg);
-	free(msg);
-	return;
+    if ( msg )
+    {
+        printk("Error in xenbus ls: %s\n", msg);
+        free(msg);
+        return;
     }
-    for (x = 0; dirs[x]; x++) 
+
+    for ( x = 0; dirs[x]; x++ )
     {
         printk("ls %s[%d] -> %s\n", pre, x, dirs[x]);
         free(dirs[x]);
     }
+
     free(dirs);
 }
 
 static void do_read_test(const char *path)
 {
     char *res, *msg;
+
     printk("Read %s...\n", path);
     msg = xenbus_read(XBT_NIL, path, &res);
-    if (msg) {
-	printk("Error in xenbus read: %s\n", msg);
-	free(msg);
-	return;
+    if ( msg )
+    {
+        printk("Error in xenbus read: %s\n", msg);
+        free(msg);
+        return;
     }
     printk("Read %s -> %s.\n", path, res);
     free(res);
@@ -930,27 +1022,31 @@ static void do_read_test(const char *path)
 static void do_write_test(const char *path, const char *val)
 {
     char *msg;
+
     printk("Write %s to %s...\n", val, path);
     msg = xenbus_write(XBT_NIL, path, val);
-    if (msg) {
-	printk("Result %s\n", msg);
-	free(msg);
-    } else {
-	printk("Success.\n");
+    if ( msg )
+    {
+        printk("Result %s\n", msg);
+        free(msg);
     }
+    else
+        printk("Success.\n");
 }
 
 static void do_rm_test(const char *path)
 {
     char *msg;
+
     printk("rm %s...\n", path);
     msg = xenbus_rm(XBT_NIL, path);
-    if (msg) {
-	printk("Result %s\n", msg);
-	free(msg);
-    } else {
-	printk("Success.\n");
+    if ( msg )
+    {
+        printk("Result %s\n", msg);
+        free(msg);
     }
+    else
+        printk("Success.\n");
 }
 
 /* Simple testing thing */
-- 
2.35.3



From minios-devel-bounces@lists.xenproject.org Mon Jun 20 07:38:47 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 20 Jun 2022 07:38:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.352539.579403 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3Bzi-0004c0-Uv; Mon, 20 Jun 2022 07:38:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 352539.579403; Mon, 20 Jun 2022 07:38:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3Bzi-0004Yf-Ci; Mon, 20 Jun 2022 07:38:46 +0000
Received: by outflank-mailman (input) for mailman id 352539;
 Mon, 20 Jun 2022 07:38:44 +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 <SRS0=Hycu=W3=suse.com=jgross@srs-se1.protection.inumbo.net>)
 id 1o3Bzf-0002ZD-CG
 for minios-devel@lists.xenproject.org; Mon, 20 Jun 2022 07:38:43 +0000
Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id fcb15982-f06b-11ec-b725-ed86ccbb4733;
 Mon, 20 Jun 2022 09:38:33 +0200 (CEST)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out1.suse.de (Postfix) with ESMTPS id 2193721BCE;
 Mon, 20 Jun 2022 07:38:34 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E52F6134CA;
 Mon, 20 Jun 2022 07:38:33 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id OEubNvkjsGI3DAAAMHmgww
 (envelope-from <jgross@suse.com>); Mon, 20 Jun 2022 07:38:33 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: fcb15982-f06b-11ec-b725-ed86ccbb4733
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1655710714; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=F2usykdrZz/ETCDtrSzcODBAgM6yVFNOOYprC5PICS8=;
	b=sSC6tQ1TwuIm9F1IbZobt/BlZYlWRWpysSxHKvHzavFfCHHIa5nFk1ZdZElY8a3WwNwMRA
	y9ZrzB/r5gPVTVtZ8kKydPNmy8Ic/jBpOArgr7WXEI28MTsM1sqy5oup9ByadnXzGCtIh0
	ynmiF7xExpf2uig1Lusce6y7AOxIUqA=
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH 6/8] mini-os: eliminate console directory
Date: Mon, 20 Jun 2022 09:38:18 +0200
Message-Id: <20220620073820.9336-7-jgross@suse.com>
X-Mailer: git-send-email 2.35.3
In-Reply-To: <20220620073820.9336-1-jgross@suse.com>
References: <20220620073820.9336-1-jgross@suse.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Merge the two remaining source files in the console directory into
a single one and move it to the main directory.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 Makefile                            |   4 +-
 console/xencons_ring.c => console.c | 171 ++++++++++++++++++++++++++-
 console/console.c                   | 177 ----------------------------
 3 files changed, 170 insertions(+), 182 deletions(-)
 rename console/xencons_ring.c => console.c (51%)
 delete mode 100644 console/console.c

diff --git a/Makefile b/Makefile
index 509d927b..f3acdd2f 100644
--- a/Makefile
+++ b/Makefile
@@ -41,6 +41,7 @@ src-$(CONFIG_CONSFRONT) += consfront.c
 src-$(CONFIG_TPMFRONT) += tpmfront.c
 src-$(CONFIG_TPM_TIS) += tpm_tis.c
 src-$(CONFIG_TPMBACK) += tpmback.c
+src-y += console.c
 src-y += daytime.c
 src-y += e820.c
 src-y += events.c
@@ -69,9 +70,6 @@ src-y += lib/sys.c
 src-y += lib/xmalloc.c
 src-$(CONFIG_LIBXS) += lib/xs.c
 
-src-y += console/console.c
-src-y += console/xencons_ring.c
-
 # The common mini-os objects to build.
 APP_OBJS :=
 OBJS := $(patsubst %.c,$(OBJ_DIR)/%.o,$(src-y))
diff --git a/console/xencons_ring.c b/console.c
similarity index 51%
rename from console/xencons_ring.c
rename to console.c
index 495f0a19..29277eac 100644
--- a/console/xencons_ring.c
+++ b/console.c
@@ -1,3 +1,39 @@
+/* 
+ ****************************************************************************
+ * (C) 2006 - Grzegorz Milos - Cambridge University
+ ****************************************************************************
+ *
+ *        File: console.c
+ *      Author: Grzegorz Milos
+ *     Changes: 
+ *              
+ *        Date: Mar 2006
+ * 
+ * Environment: Xen Minimal OS
+ * Description: Console interface.
+ *
+ * Handles console I/O. Defines printk.
+ *
+ ****************************************************************************
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ * DEALINGS IN THE SOFTWARE.
+ */
+ 
 #include <mini-os/types.h>
 #include <mini-os/wait.h>
 #include <mini-os/mm.h>
@@ -7,12 +43,143 @@
 #include <mini-os/lib.h>
 #include <mini-os/console.h>
 #include <mini-os/xenbus.h>
+#include <mini-os/xmalloc.h>
+#include <mini-os/gnttab.h>
 #include <xen/io/console.h>
 #include <xen/io/protocols.h>
 #include <xen/io/ring.h>
 #include <xen/hvm/params.h>
-#include <mini-os/xmalloc.h>
-#include <mini-os/gnttab.h>
+
+/* If console not initialised the printk will be sent to xen serial line 
+   NOTE: you need to enable verbose in xen/Rules.mk for it to work. */
+static struct consfront_dev* xen_console = NULL;
+static int console_initialised = 0;
+
+__attribute__((weak)) void console_input(char * buf, unsigned len)
+{
+    if(len > 0)
+    {
+        /* Just repeat what's written */
+        buf[len] = '\0';
+        printk("%s", buf);
+        
+        if(buf[len-1] == '\r')
+            printk("\nNo console input handler.\n");
+    }
+}
+
+#ifndef HAVE_LIBC
+void xencons_rx(char *buf, unsigned len, struct pt_regs *regs)
+{
+    console_input(buf, len);
+}
+
+void xencons_tx(void)
+{
+    /* Do nothing, handled by _rx */
+}
+#endif
+
+
+void console_print(struct consfront_dev *dev, const char *data, int length)
+{
+    char *curr_char, saved_char;
+    char copied_str[length+1];
+    char *copied_ptr;
+    int part_len;
+    int (*ring_send_fn)(struct consfront_dev *dev, const char *data, unsigned length);
+
+    if(!console_initialised)
+        ring_send_fn = xencons_ring_send_no_notify;
+    else
+        ring_send_fn = xencons_ring_send;
+
+    if (dev && dev->is_raw) {
+        ring_send_fn(dev, data, length);
+        return;
+    }
+
+    copied_ptr = copied_str;
+    memcpy(copied_ptr, data, length);
+    for(curr_char = copied_ptr; curr_char < copied_ptr+length-1; curr_char++)
+    {
+        if(*curr_char == '\n')
+        {
+            *curr_char = '\r';
+            saved_char = *(curr_char+1);
+            *(curr_char+1) = '\n';
+            part_len = curr_char - copied_ptr + 2;
+            ring_send_fn(dev, copied_ptr, part_len);
+            *(curr_char+1) = saved_char;
+            copied_ptr = curr_char+1;
+            length -= part_len - 1;
+        }
+    }
+
+    if (copied_ptr[length-1] == '\n') {
+        copied_ptr[length-1] = '\r';
+        copied_ptr[length] = '\n';
+        length++;
+    }
+    
+    ring_send_fn(dev, copied_ptr, length);
+}
+
+void print(int direct, const char *fmt, va_list args)
+{
+    static char __print_buf[1024];
+    
+    (void)vsnprintf(__print_buf, sizeof(__print_buf), fmt, args);
+
+    if(direct)
+    {
+        (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(__print_buf), __print_buf);
+        return;
+    } else {
+#ifndef CONFIG_USE_XEN_CONSOLE
+    if(!console_initialised)
+#endif    
+            (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(__print_buf), __print_buf);
+        
+        console_print(NULL, __print_buf, strlen(__print_buf));
+    }
+}
+
+void printk(const char *fmt, ...)
+{
+    va_list       args;
+    va_start(args, fmt);
+    print(0, fmt, args);
+    va_end(args);        
+}
+
+void xprintk(const char *fmt, ...)
+{
+    va_list       args;
+    va_start(args, fmt);
+    print(1, fmt, args);
+    va_end(args);        
+}
+void init_console(void)
+{   
+    printk("Initialising console ... ");
+    xen_console = xencons_ring_init();
+    console_initialised = 1;
+    /* This is also required to notify the daemon */
+    printk("done.\n");
+}
+
+void suspend_console(void)
+{
+    console_initialised = 0;
+    xencons_ring_fini(xen_console);
+}
+
+void resume_console(void)
+{
+    xencons_ring_resume(xen_console);
+    console_initialised = 1;
+}
 
 DECLARE_WAIT_QUEUE_HEAD(console_queue);
 
diff --git a/console/console.c b/console/console.c
deleted file mode 100644
index 68c8435e..00000000
--- a/console/console.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/* 
- ****************************************************************************
- * (C) 2006 - Grzegorz Milos - Cambridge University
- ****************************************************************************
- *
- *        File: console.h
- *      Author: Grzegorz Milos
- *     Changes: 
- *              
- *        Date: Mar 2006
- * 
- * Environment: Xen Minimal OS
- * Description: Console interface.
- *
- * Handles console I/O. Defines printk.
- *
- ****************************************************************************
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- * 
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
- * DEALINGS IN THE SOFTWARE.
- */
- 
-#include <mini-os/types.h>
-#include <mini-os/wait.h>
-#include <mini-os/mm.h>
-#include <mini-os/hypervisor.h>
-#include <mini-os/events.h>
-#include <mini-os/os.h>
-#include <mini-os/lib.h>
-#include <mini-os/xenbus.h>
-#include <xen/io/console.h>
-
-
-/* If console not initialised the printk will be sent to xen serial line 
-   NOTE: you need to enable verbose in xen/Rules.mk for it to work. */
-static struct consfront_dev* xen_console = NULL;
-static int console_initialised = 0;
-
-__attribute__((weak)) void console_input(char * buf, unsigned len)
-{
-    if(len > 0)
-    {
-        /* Just repeat what's written */
-        buf[len] = '\0';
-        printk("%s", buf);
-        
-        if(buf[len-1] == '\r')
-            printk("\nNo console input handler.\n");
-    }
-}
-
-#ifndef HAVE_LIBC
-void xencons_rx(char *buf, unsigned len, struct pt_regs *regs)
-{
-    console_input(buf, len);
-}
-
-void xencons_tx(void)
-{
-    /* Do nothing, handled by _rx */
-}
-#endif
-
-
-void console_print(struct consfront_dev *dev, const char *data, int length)
-{
-    char *curr_char, saved_char;
-    char copied_str[length+1];
-    char *copied_ptr;
-    int part_len;
-    int (*ring_send_fn)(struct consfront_dev *dev, const char *data, unsigned length);
-
-    if(!console_initialised)
-        ring_send_fn = xencons_ring_send_no_notify;
-    else
-        ring_send_fn = xencons_ring_send;
-
-    if (dev && dev->is_raw) {
-        ring_send_fn(dev, data, length);
-        return;
-    }
-
-    copied_ptr = copied_str;
-    memcpy(copied_ptr, data, length);
-    for(curr_char = copied_ptr; curr_char < copied_ptr+length-1; curr_char++)
-    {
-        if(*curr_char == '\n')
-        {
-            *curr_char = '\r';
-            saved_char = *(curr_char+1);
-            *(curr_char+1) = '\n';
-            part_len = curr_char - copied_ptr + 2;
-            ring_send_fn(dev, copied_ptr, part_len);
-            *(curr_char+1) = saved_char;
-            copied_ptr = curr_char+1;
-            length -= part_len - 1;
-        }
-    }
-
-    if (copied_ptr[length-1] == '\n') {
-        copied_ptr[length-1] = '\r';
-        copied_ptr[length] = '\n';
-        length++;
-    }
-    
-    ring_send_fn(dev, copied_ptr, length);
-}
-
-void print(int direct, const char *fmt, va_list args)
-{
-    static char __print_buf[1024];
-    
-    (void)vsnprintf(__print_buf, sizeof(__print_buf), fmt, args);
-
-    if(direct)
-    {
-        (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(__print_buf), __print_buf);
-        return;
-    } else {
-#ifndef CONFIG_USE_XEN_CONSOLE
-    if(!console_initialised)
-#endif    
-            (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(__print_buf), __print_buf);
-        
-        console_print(NULL, __print_buf, strlen(__print_buf));
-    }
-}
-
-void printk(const char *fmt, ...)
-{
-    va_list       args;
-    va_start(args, fmt);
-    print(0, fmt, args);
-    va_end(args);        
-}
-
-void xprintk(const char *fmt, ...)
-{
-    va_list       args;
-    va_start(args, fmt);
-    print(1, fmt, args);
-    va_end(args);        
-}
-void init_console(void)
-{   
-    printk("Initialising console ... ");
-    xen_console = xencons_ring_init();
-    console_initialised = 1;
-    /* This is also required to notify the daemon */
-    printk("done.\n");
-}
-
-void suspend_console(void)
-{
-    console_initialised = 0;
-    xencons_ring_fini(xen_console);
-}
-
-void resume_console(void)
-{
-    xencons_ring_resume(xen_console);
-    console_initialised = 1;
-}
-- 
2.35.3



From minios-devel-bounces@lists.xenproject.org Mon Jun 20 22:39:54 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 20 Jun 2022 22:39:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.352902.579767 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3Q3j-0007kL-5m; Mon, 20 Jun 2022 22:39:51 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 352902.579767; Mon, 20 Jun 2022 22:39:51 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3Q3j-0007kE-2k; Mon, 20 Jun 2022 22:39:51 +0000
Received: by outflank-mailman (input) for mailman id 352902;
 Mon, 20 Jun 2022 22:39:49 +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
 <SRS0=B8m2=W3=ens-lyon.org=samuel.thibault@bounce.ens-lyon.org>)
 id 1o3Q3h-0007k3-NU
 for minios-devel@lists.xenproject.org; Mon, 20 Jun 2022 22:39:49 +0000
Received: from sonata.ens-lyon.org (domu-toccata.ens-lyon.fr [140.77.166.138])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id e2f02af7-f0e9-11ec-b725-ed86ccbb4733;
 Tue, 21 Jun 2022 00:39:48 +0200 (CEST)
Received: from localhost (localhost [127.0.0.1])
 by sonata.ens-lyon.org (Postfix) with ESMTP id 5721E2014F;
 Tue, 21 Jun 2022 00:39:46 +0200 (CEST)
Received: from sonata.ens-lyon.org ([127.0.0.1])
 by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id wv5TOJiU0PRU; Tue, 21 Jun 2022 00:39:46 +0200 (CEST)
Received: from begin.home (anantes-655-1-33-15.w83-195.abo.wanadoo.fr
 [83.195.225.15])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest
 SHA256) (No client certificate requested)
 by sonata.ens-lyon.org (Postfix) with ESMTPSA id 1259420137;
 Tue, 21 Jun 2022 00:39:45 +0200 (CEST)
Received: from samy by begin.home with local (Exim 4.95)
 (envelope-from <samuel.thibault@ens-lyon.org>) id 1o3Q3d-00B6Ec-JF;
 Tue, 21 Jun 2022 00:39:45 +0200
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: e2f02af7-f0e9-11ec-b725-ed86ccbb4733
Date: Tue, 21 Jun 2022 00:39:45 +0200
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Juergen Gross <jgross@suse.com>
Cc: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org,
	wl@xen.org
Subject: Re: [PATCH 0/8] mini-os: some cleanup patches
Message-ID: <20220620223945.mjnn3kulnyhi4xfn@begin>
Mail-Followup-To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
	Juergen Gross <jgross@suse.com>, minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org, wl@xen.org
References: <20220620073820.9336-1-jgross@suse.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20220620073820.9336-1-jgross@suse.com>
Organization: I am not organized
User-Agent: NeoMutt/20170609 (1.8.3)

Hello,

Juergen Gross, le lun. 20 juin 2022 09:38:12 +0200, a ecrit:
> Do some cleanups.
> 
> No functional change intended, apart from whitespace changes only
> minor modifications making code easier to read.
> 
> Juergen Gross (8):
>   mini-os: drop xenbus directory
>   mini-os: apply coding style to xenbus.c
>   mini-os: eliminate console/console.h
>   mini-os: rename console/xenbus.c to consfront.c
>   mini-os: apply coding style to consfront.c
>   mini-os: eliminate console directory
>   mini-os: apply coding style to console.c
>   mini-os: add mini-os-debug[.gz] to .gitignore

For the whole series:

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

Thanks!

>  .gitignore                      |   2 +
>  Makefile                        |   9 +-
>  console/xenbus.c => consfront.c |  99 ++++---
>  console.c                       | 415 ++++++++++++++++++++++++++
>  console/console.c               | 177 -----------
>  console/console.h               |   2 -
>  console/xencons_ring.c          | 238 ---------------
>  include/console.h               |   1 +
>  xenbus/xenbus.c => xenbus.c     | 510 +++++++++++++++++++-------------
>  9 files changed, 778 insertions(+), 675 deletions(-)
>  rename console/xenbus.c => consfront.c (78%)
>  create mode 100644 console.c
>  delete mode 100644 console/console.c
>  delete mode 100644 console/console.h
>  delete mode 100644 console/xencons_ring.c
>  rename xenbus/xenbus.c => xenbus.c (71%)
> 
> -- 
> 2.35.3
> 


From minios-devel-bounces@lists.xenproject.org Mon Jun 20 22:44:05 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 20 Jun 2022 22:44:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.352914.579782 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3Q7o-0000pa-UZ; Mon, 20 Jun 2022 22:44:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 352914.579782; Mon, 20 Jun 2022 22:44:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3Q7o-0000pT-RN; Mon, 20 Jun 2022 22:44:04 +0000
Received: by outflank-mailman (input) for mailman id 352914;
 Mon, 20 Jun 2022 22:44: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
 <SRS0=B8m2=W3=ens-lyon.org=samuel.thibault@bounce.ens-lyon.org>)
 id 1o3Q7n-0000pC-58
 for minios-devel@lists.xenproject.org; Mon, 20 Jun 2022 22:44:03 +0000
Received: from sonata.ens-lyon.org (sonata.ens-lyon.org [140.77.166.138])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 79df0d36-f0ea-11ec-bd2d-47488cf2e6aa;
 Tue, 21 Jun 2022 00:44:02 +0200 (CEST)
Received: from localhost (localhost [127.0.0.1])
 by sonata.ens-lyon.org (Postfix) with ESMTP id CED232014F;
 Tue, 21 Jun 2022 00:43:58 +0200 (CEST)
Received: from sonata.ens-lyon.org ([127.0.0.1])
 by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id rWJLcV2fRi5A; Tue, 21 Jun 2022 00:43:58 +0200 (CEST)
Received: from begin.home (anantes-655-1-33-15.w83-195.abo.wanadoo.fr
 [83.195.225.15])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest
 SHA256) (No client certificate requested)
 by sonata.ens-lyon.org (Postfix) with ESMTPSA id B95C720148;
 Tue, 21 Jun 2022 00:43:58 +0200 (CEST)
Received: from samy by begin.home with local (Exim 4.95)
 (envelope-from <samuel.thibault@ens-lyon.org>) id 1o3Q7j-00B6Jd-Bt;
 Tue, 21 Jun 2022 00:43:59 +0200
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 79df0d36-f0ea-11ec-bd2d-47488cf2e6aa
Date: Tue, 21 Jun 2022 00:43:59 +0200
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Juergen Gross <jgross@suse.com>
Cc: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org,
	wl@xen.org
Subject: Re: [PATCH v2 3/4] mini-os: fix number of pages for PVH
Message-ID: <20220620224359.qbpojkdwbxbsfcv3@begin>
Mail-Followup-To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
	Juergen Gross <jgross@suse.com>, minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org, wl@xen.org
References: <20220619065253.19503-1-jgross@suse.com>
 <20220619065253.19503-4-jgross@suse.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20220619065253.19503-4-jgross@suse.com>
Organization: I am not organized
User-Agent: NeoMutt/20170609 (1.8.3)

Juergen Gross, le dim. 19 juin 2022 08:52:52 +0200, a ecrit:
> When getting the current allocation from Xen, this value includes the
> pages allocated in the MMIO area. Fix the highest available RAM page
> by subtracting the size of that area.
> 
> This requires to read the E820 map before needing this value. Add two
> functions returning the current and the maximum number of RAM pages
> taking this correction into account.
> 
> At the same time add the LAPIC page to the memory map in order to
> avoid reusing that PFN for internal purposes.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
> V2:
> - make e820_initial_reserved_pfns static (Samuel Thibault)
> - add e820_get_current_pages() and e820_get_max_pages()
> ---

> diff --git a/include/e820.h b/include/e820.h
> index 5438a7c8..6f15fcd2 100644
> --- a/include/e820.h
> +++ b/include/e820.h
> @@ -52,6 +52,8 @@ struct __packed e820entry {
>  extern struct e820entry e820_map[];
>  extern unsigned e820_entries;
>  
> +unsigned int e820_get_current_pages(void);
> +unsigned int e820_get_max_pages(void);

Why an int rather than a long int? Yes 4TiB memory is large for mini-os,
but better keep numbers of pages a long?

Apart from that,

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

Samuel


From minios-devel-bounces@lists.xenproject.org Mon Jun 20 22:45:22 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 20 Jun 2022 22:45:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.352923.579798 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3Q93-0001TN-En; Mon, 20 Jun 2022 22:45:21 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 352923.579798; Mon, 20 Jun 2022 22:45:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3Q93-0001TG-Bo; Mon, 20 Jun 2022 22:45:21 +0000
Received: by outflank-mailman (input) for mailman id 352923;
 Mon, 20 Jun 2022 22:45:20 +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
 <SRS0=B8m2=W3=ens-lyon.org=samuel.thibault@bounce.ens-lyon.org>)
 id 1o3Q92-0001T5-3k
 for minios-devel@lists.xenproject.org; Mon, 20 Jun 2022 22:45:20 +0000
Received: from sonata.ens-lyon.org (sonata.ens-lyon.org [140.77.166.138])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id a8e4bc60-f0ea-11ec-bd2d-47488cf2e6aa;
 Tue, 21 Jun 2022 00:45:19 +0200 (CEST)
Received: from localhost (localhost [127.0.0.1])
 by sonata.ens-lyon.org (Postfix) with ESMTP id A705C2014F;
 Tue, 21 Jun 2022 00:45:18 +0200 (CEST)
Received: from sonata.ens-lyon.org ([127.0.0.1])
 by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id x8bigerdlSdi; Tue, 21 Jun 2022 00:45:18 +0200 (CEST)
Received: from begin.home (anantes-655-1-33-15.w83-195.abo.wanadoo.fr
 [83.195.225.15])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest
 SHA256) (No client certificate requested)
 by sonata.ens-lyon.org (Postfix) with ESMTPSA id 8E1D820148;
 Tue, 21 Jun 2022 00:45:18 +0200 (CEST)
Received: from samy by begin.home with local (Exim 4.95)
 (envelope-from <samuel.thibault@ens-lyon.org>) id 1o3Q90-00B6Ki-5w;
 Tue, 21 Jun 2022 00:45:18 +0200
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: a8e4bc60-f0ea-11ec-bd2d-47488cf2e6aa
Date: Tue, 21 Jun 2022 00:45:18 +0200
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Juergen Gross <jgross@suse.com>
Cc: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org,
	wl@xen.org
Subject: Re: [PATCH v2 4/4] mini-os: fix bug in ballooning on PVH
Message-ID: <20220620224518.xfm426w5gcu322sh@begin>
Mail-Followup-To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
	Juergen Gross <jgross@suse.com>, minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org, wl@xen.org
References: <20220619065253.19503-1-jgross@suse.com>
 <20220619065253.19503-5-jgross@suse.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20220619065253.19503-5-jgross@suse.com>
Organization: I am not organized
User-Agent: NeoMutt/20170609 (1.8.3)

Juergen Gross, le dim. 19 juin 2022 08:52:53 +0200, a ecrit:
> There is a subtle bug in ballooning code for PVH: in case ballooning
> extends above a non-RAM area of the memory map, wrong pages will be
> used.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

> ---
> V2:
> - new patch
> ---
>  balloon.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/balloon.c b/balloon.c
> index 6ad07644..55be8141 100644
> --- a/balloon.c
> +++ b/balloon.c
> @@ -124,7 +124,7 @@ int balloon_up(unsigned long n_pages)
>      for ( pfn = 0; pfn < rc; pfn++ )
>      {
>          arch_pfn_add(start_pfn + pfn, balloon_frames[pfn]);
> -        free_page(pfn_to_virt(nr_mem_pages + pfn));
> +        free_page(pfn_to_virt(start_pfn + pfn));
>      }
>  
>      nr_mem_pages += rc;
> -- 
> 2.35.3
> 


From minios-devel-bounces@lists.xenproject.org Tue Jun 21 07:18:27 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 21 Jun 2022 07:18:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.352985.579856 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3Y9Y-0008RM-SV; Tue, 21 Jun 2022 07:18:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 352985.579856; Tue, 21 Jun 2022 07:18:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3Y9Y-0008RF-Pa; Tue, 21 Jun 2022 07:18:24 +0000
Received: by outflank-mailman (input) for mailman id 352985;
 Tue, 21 Jun 2022 07:18: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 <SRS0=VA9I=W4=suse.com=jgross@srs-se1.protection.inumbo.net>)
 id 1o3Y9X-0008R4-BV
 for minios-devel@lists.xenproject.org; Tue, 21 Jun 2022 07:18:23 +0000
Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 541bbbc6-f132-11ec-b725-ed86ccbb4733;
 Tue, 21 Jun 2022 09:18:20 +0200 (CEST)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out1.suse.de (Postfix) with ESMTPS id 60DA121EC7;
 Tue, 21 Jun 2022 07:18:20 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3EBBF13638;
 Tue, 21 Jun 2022 07:18:20 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id Min+DbxwsWJ1YQAAMHmgww
 (envelope-from <jgross@suse.com>); Tue, 21 Jun 2022 07:18:20 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 541bbbc6-f132-11ec-b725-ed86ccbb4733
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1655795900; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:
	 mime-version:mime-version:content-type:content-type:
	 in-reply-to:in-reply-to:references:references;
	bh=FYzXzyNLzxsDxkplJxEXVmQtR/+WRwMen2LYGkswUAg=;
	b=UedvPFVXUz6Pwwbt3p91AyHRx91X3F5psqWH2mwSrFcUT50qda33Clpq2B4JDw27mDvuvn
	NkaasDvlrfPN1h/ZM+f05QF36AbWikkTQJ0wJcAcjr7TrSDXxr/ZHrcwQLs9UCe5VkmSmU
	36IY33UU5yvCwPFrh1x6C6iKw0tGTl8=
Message-ID: <d45f10c8-236b-3302-5cc5-9aba6dab2dea@suse.com>
Date: Tue, 21 Jun 2022 09:18:19 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
 Thunderbird/91.9.0
Subject: Re: [PATCH v2 3/4] mini-os: fix number of pages for PVH
Content-Language: en-US
To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
 minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org, wl@xen.org
References: <20220619065253.19503-1-jgross@suse.com>
 <20220619065253.19503-4-jgross@suse.com>
 <20220620224359.qbpojkdwbxbsfcv3@begin>
From: Juergen Gross <jgross@suse.com>
In-Reply-To: <20220620224359.qbpojkdwbxbsfcv3@begin>
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="------------I43HiciVyFPAPnKWa290gyk6"

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--------------I43HiciVyFPAPnKWa290gyk6
Content-Type: multipart/mixed; boundary="------------PzYnehsueDrjJ0UbXmf7UCZQ";
 protected-headers="v1"
From: Juergen Gross <jgross@suse.com>
To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
 minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org, wl@xen.org
Message-ID: <d45f10c8-236b-3302-5cc5-9aba6dab2dea@suse.com>
Subject: Re: [PATCH v2 3/4] mini-os: fix number of pages for PVH
References: <20220619065253.19503-1-jgross@suse.com>
 <20220619065253.19503-4-jgross@suse.com>
 <20220620224359.qbpojkdwbxbsfcv3@begin>
In-Reply-To: <20220620224359.qbpojkdwbxbsfcv3@begin>

--------------PzYnehsueDrjJ0UbXmf7UCZQ
Content-Type: multipart/mixed; boundary="------------b1dMPg1H1UbvgQvcqzHbdAqC"

--------------b1dMPg1H1UbvgQvcqzHbdAqC
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: base64

T24gMjEuMDYuMjIgMDA6NDMsIFNhbXVlbCBUaGliYXVsdCB3cm90ZToNCj4gSnVlcmdlbiBH
cm9zcywgbGUgZGltLiAxOSBqdWluIDIwMjIgMDg6NTI6NTIgKzAyMDAsIGEgZWNyaXQ6DQo+
PiBXaGVuIGdldHRpbmcgdGhlIGN1cnJlbnQgYWxsb2NhdGlvbiBmcm9tIFhlbiwgdGhpcyB2
YWx1ZSBpbmNsdWRlcyB0aGUNCj4+IHBhZ2VzIGFsbG9jYXRlZCBpbiB0aGUgTU1JTyBhcmVh
LiBGaXggdGhlIGhpZ2hlc3QgYXZhaWxhYmxlIFJBTSBwYWdlDQo+PiBieSBzdWJ0cmFjdGlu
ZyB0aGUgc2l6ZSBvZiB0aGF0IGFyZWEuDQo+Pg0KPj4gVGhpcyByZXF1aXJlcyB0byByZWFk
IHRoZSBFODIwIG1hcCBiZWZvcmUgbmVlZGluZyB0aGlzIHZhbHVlLiBBZGQgdHdvDQo+PiBm
dW5jdGlvbnMgcmV0dXJuaW5nIHRoZSBjdXJyZW50IGFuZCB0aGUgbWF4aW11bSBudW1iZXIg
b2YgUkFNIHBhZ2VzDQo+PiB0YWtpbmcgdGhpcyBjb3JyZWN0aW9uIGludG8gYWNjb3VudC4N
Cj4+DQo+PiBBdCB0aGUgc2FtZSB0aW1lIGFkZCB0aGUgTEFQSUMgcGFnZSB0byB0aGUgbWVt
b3J5IG1hcCBpbiBvcmRlciB0bw0KPj4gYXZvaWQgcmV1c2luZyB0aGF0IFBGTiBmb3IgaW50
ZXJuYWwgcHVycG9zZXMuDQo+Pg0KPj4gU2lnbmVkLW9mZi1ieTogSnVlcmdlbiBHcm9zcyA8
amdyb3NzQHN1c2UuY29tPg0KPj4gLS0tDQo+PiBWMjoNCj4+IC0gbWFrZSBlODIwX2luaXRp
YWxfcmVzZXJ2ZWRfcGZucyBzdGF0aWMgKFNhbXVlbCBUaGliYXVsdCkNCj4+IC0gYWRkIGU4
MjBfZ2V0X2N1cnJlbnRfcGFnZXMoKSBhbmQgZTgyMF9nZXRfbWF4X3BhZ2VzKCkNCj4+IC0t
LQ0KPiANCj4+IGRpZmYgLS1naXQgYS9pbmNsdWRlL2U4MjAuaCBiL2luY2x1ZGUvZTgyMC5o
DQo+PiBpbmRleCA1NDM4YTdjOC4uNmYxNWZjZDIgMTAwNjQ0DQo+PiAtLS0gYS9pbmNsdWRl
L2U4MjAuaA0KPj4gKysrIGIvaW5jbHVkZS9lODIwLmgNCj4+IEBAIC01Miw2ICs1Miw4IEBA
IHN0cnVjdCBfX3BhY2tlZCBlODIwZW50cnkgew0KPj4gICBleHRlcm4gc3RydWN0IGU4MjBl
bnRyeSBlODIwX21hcFtdOw0KPj4gICBleHRlcm4gdW5zaWduZWQgZTgyMF9lbnRyaWVzOw0K
Pj4gICANCj4+ICt1bnNpZ25lZCBpbnQgZTgyMF9nZXRfY3VycmVudF9wYWdlcyh2b2lkKTsN
Cj4+ICt1bnNpZ25lZCBpbnQgZTgyMF9nZXRfbWF4X3BhZ2VzKHZvaWQpOw0KPiANCj4gV2h5
IGFuIGludCByYXRoZXIgdGhhbiBhIGxvbmcgaW50PyBZZXMgNFRpQiBtZW1vcnkgaXMgbGFy
Z2UgZm9yIG1pbmktb3MsDQo+IGJ1dCBiZXR0ZXIga2VlcCBudW1iZXJzIG9mIHBhZ2VzIGEg
bG9uZz8NCg0KSSBkb24ndCB0aGluayBpdCBtYXR0ZXJzIHRoYXQgbXVjaCAoY3VycmVudGx5
IE1pbmktT1MgY2FuJ3Qgc3VwcG9ydCBtb3JlDQp0aGFuIDUxMkdpQiBvZiBtZW1vcnkpLCBi
dXQgSSBjYW4gY2hhbmdlIHRoZSBmdW5jdGlvbnMgdG8gdW5zaWduZWQgbG9uZy4NCg0KPiAN
Cj4gQXBhcnQgZnJvbSB0aGF0LA0KPiANCj4gUmV2aWV3ZWQtYnk6IFNhbXVlbCBUaGliYXVs
dCA8c2FtdWVsLnRoaWJhdWx0QGVucy1seW9uLm9yZz4NCg0KVGhhbmtzLA0KDQoNCkp1ZXJn
ZW4NCg==
--------------b1dMPg1H1UbvgQvcqzHbdAqC
Content-Type: application/pgp-keys; name="OpenPGP_0xB0DE9DD628BF132F.asc"
Content-Disposition: attachment; filename="OpenPGP_0xB0DE9DD628BF132F.asc"
Content-Description: OpenPGP public key
Content-Transfer-Encoding: quoted-printable

-----BEGIN PGP PUBLIC KEY BLOCK-----

xsBNBFOMcBYBCACgGjqjoGvbEouQZw/ToiBg9W98AlM2QHV+iNHsEs7kxWhKMjri
oyspZKOBycWxw3ie3j9uvg9EOB3aN4xiTv4qbnGiTr3oJhkB1gsb6ToJQZ8uxGq2
kaV2KL9650I1SJvedYm8Of8Zd621lSmoKOwlNClALZNew72NjJLEzTalU1OdT7/i
1TXkH09XSSI8mEQ/ouNcMvIJNwQpd369y9bfIhWUiVXEK7MlRgUG6MvIj6Y3Am/B
BLUVbDa4+gmzDC9ezlZkTZG2t14zWPvxXP3FAp2pkW0xqG7/377qptDmrk42GlSK
N4z76ELnLxussxc7I2hx18NUcbP8+uty4bMxABEBAAHNHEp1ZXJnZW4gR3Jvc3Mg
PGpnQHBmdXBmLm5ldD7CwHkEEwECACMFAlOMcBYCGwMHCwkIBwMCAQYVCAIJCgsE
FgIDAQIeAQIXgAAKCRCw3p3WKL8TL0KdB/93FcIZ3GCNwFU0u3EjNbNjmXBKDY4F
UGNQH2lvWAUy+dnyThpwdtF/jQ6j9RwE8VP0+NXcYpGJDWlNb9/JmYqLiX2Q3Tye
vpB0CA3dbBQp0OW0fgCetToGIQrg0MbD1C/sEOv8Mr4NAfbauXjZlvTj30H2jO0u
+6WGM6nHwbh2l5O8ZiHkH32iaSTfN7Eu5RnNVUJbvoPHZ8SlM4KWm8rG+lIkGurq
qu5gu8q8ZMKdsdGC4bBxdQKDKHEFExLJK/nRPFmAuGlId1E3fe10v5QL+qHI3EIP
tyfE7i9Hz6rVwi7lWKgh7pe0ZvatAudZ+JNIlBKptb64FaiIOAWDCx1SzR9KdWVy
Z2VuIEdyb3NzIDxqZ3Jvc3NAc3VzZS5jb20+wsB5BBMBAgAjBQJTjHCvAhsDBwsJ
CAcDAgEGFQgCCQoLBBYCAwECHgECF4AACgkQsN6d1ii/Ey/HmQf/RtI7kv5A2PS4
RF7HoZhPVPogNVbC4YA6lW7DrWf0teC0RR3MzXfy6pJ+7KLgkqMlrAbN/8Dvjoz7
8X+5vhH/rDLa9BuZQlhFmvcGtCF8eR0T1v0nC/nuAFVGy+67q2DH8As3KPu0344T
BDpAvr2uYM4tSqxK4DURx5INz4ZZ0WNFHcqsfvlGJALDeE0LhITTd9jLzdDad1pQ
SToCnLl6SBJZjDOX9QQcyUigZFtCXFst4dlsvddrxyqT1f17+2cFSdu7+ynLmXBK
7abQ3rwJY8SbRO2iRulogc5vr/RLMMlscDAiDkaFQWLoqHHOdfO9rURssHNN8WkM
nQfvUewRz80hSnVlcmdlbiBHcm9zcyA8amdyb3NzQG5vdmVsbC5jb20+wsB5BBMB
AgAjBQJTjHDXAhsDBwsJCAcDAgEGFQgCCQoLBBYCAwECHgECF4AACgkQsN6d1ii/
Ey8PUQf/ehmgCI9jB9hlgexLvgOtf7PJnFOXgMLdBQgBlVPO3/D9R8LtF9DBAFPN
hlrsfIG/SqICoRCqUcJ96Pn3P7UUinFG/I0ECGF4EvTE1jnDkfJZr6jrbjgyoZHi
w/4BNwSTL9rWASyLgqlA8u1mf+c2yUwcGhgkRAd1gOwungxcwzwqgljf0N51N5Jf
VRHRtyfwq/ge+YEkDGcTU6Y0sPOuj4Dyfm8fJzdfHNQsWq3PnczLVELStJNdapwP
OoE+lotufe3AM2vAEYJ9rTz3Cki4JFUsgLkHFqGZarrPGi1eyQcXeluldO3m91NK
/1xMI3/+8jbO0tsn1tqSEUGIJi7ox80eSnVlcmdlbiBHcm9zcyA8amdyb3NzQHN1
c2UuZGU+wsB5BBMBAgAjBQJTjHDrAhsDBwsJCAcDAgEGFQgCCQoLBBYCAwECHgEC
F4AACgkQsN6d1ii/Ey+LhQf9GL45eU5vOowA2u5N3g3OZUEBmDHVVbqMtzwlmNC4
k9Kx39r5s2vcFl4tXqW7g9/ViXYuiDXb0RfUpZiIUW89siKrkzmQ5dM7wRqzgJpJ
wK8Bn2MIxAKArekWpiCKvBOB/Cc+3EXE78XdlxLyOi/NrmSGRIov0karw2RzMNOu
5D+jLRZQd1Sv27AR+IP3I8U4aqnhLpwhK7MEy9oCILlgZ1QZe49kpcumcZKORmzB
TNh30FVKK1EvmV2xAKDoaEOgQB4iFQLhJCdP1I5aSgM5IVFdn7v5YgEYuJYx37Io
N1EblHI//x/e2AaIHpzK5h88NEawQsaNRpNSrcfbFmAg987ATQRTjHAWAQgAyzH6
AOODMBjgfWE9VeCgsrwH3exNAU32gLq2xvjpWnHIs98ndPUDpnoxWQugJ6MpMncr
0xSwFmHEgnSEjK/PAjppgmyc57BwKII3sV4on+gDVFJR6Y8ZRwgnBC5mVM6JjQ5x
Dk8WRXljExRfUX9pNhdE5eBOZJrDRoLUmmjDtKzWaDhIg/+1Hzz93X4fCQkNVbVF
LELU9bMaLPBG/x5q4iYZ2k2ex6d47YE1ZFdMm6YBYMOljGkZKwYde5ldM9mo45mm
we0icXKLkpEdIXKTZeKDO+Hdv1aqFuAcccTg9RXDQjmwhC3yEmrmcfl0+rPghO0I
v3OOImwTEe4co3c1mwARAQABwsBfBBgBAgAJBQJTjHAWAhsMAAoJELDendYovxMv
Q/gH/1ha96vm4P/L+bQpJwrZ/dneZcmEwTbe8YFsw2V/Buv6Z4Mysln3nQK5ZadD
534CF7TDVft7fC4tU4PONxF5D+/tvgkPfDAfF77zy2AH1vJzQ1fOU8lYFpZXTXIH
b+559UqvIB8AdgR3SAJGHHt4RKA0F7f5ipYBBrC6cyXJyyoprT10EMvU8VGiwXvT
yJz3fjoYsdFzpWPlJEBRMedCot60g5dmbdrZ5DWClAr0yau47zpWj3enf1tLWaqc
suylWsviuGjKGw7KHQd3bxALOknAp4dN3QwBYCKuZ7AddY9yjynVaD5X7nF9nO5B
jR/i1DG86lem3iBDXzXsZDn8R38=3D
=3D2wuH
-----END PGP PUBLIC KEY BLOCK-----

--------------b1dMPg1H1UbvgQvcqzHbdAqC--

--------------PzYnehsueDrjJ0UbXmf7UCZQ--

--------------I43HiciVyFPAPnKWa290gyk6
Content-Type: application/pgp-signature; name="OpenPGP_signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="OpenPGP_signature"

-----BEGIN PGP SIGNATURE-----

wsB5BAABCAAjFiEEhRJncuj2BJSl0Jf3sN6d1ii/Ey8FAmKxcLsFAwAAAAAACgkQsN6d1ii/Ey8f
VQf/ZilBm1MDU6FR6KXhb73Zic/eJtTqV1m8kZsrdu0NdvPfOZExXl+9cqYG0DzYrXLBcYLtM5Ik
NWSTJMJTzvrGsjwiu6SJRY05jqYmSz1GNWFa5DP3bdbyRt1tQjJxw6XalYh4Kce4VduS2x9hVezH
AI4iP05C2m+9WDxhSJxbn3AQfOgdwkfCnqx5hjXTn/lBSlWqlQdkgYL3qWpL7ZfOQe3Dzfb7pm5z
2qBywR9lJDWIlAOfw0rv1697tuI2Fy4Ebj2p3AowoEH/F8GYbTz6nI0XLXfOlcrRxP3cuuLQPjvv
HLW+Cq3kxJ/XcRGgbPfMig1MNcaNv2HsXUL8tITOuw==
=cLAS
-----END PGP SIGNATURE-----

--------------I43HiciVyFPAPnKWa290gyk6--


From minios-devel-bounces@lists.xenproject.org Tue Jun 21 07:23:20 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 21 Jun 2022 07:23:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.352995.579871 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3YEI-0001UJ-FJ; Tue, 21 Jun 2022 07:23:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 352995.579871; Tue, 21 Jun 2022 07:23:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3YEI-0001UC-Cl; Tue, 21 Jun 2022 07:23:18 +0000
Received: by outflank-mailman (input) for mailman id 352995;
 Tue, 21 Jun 2022 07:23:17 +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 <SRS0=VA9I=W4=suse.com=jgross@srs-se1.protection.inumbo.net>)
 id 1o3YEH-0001Tv-7n
 for minios-devel@lists.xenproject.org; Tue, 21 Jun 2022 07:23:17 +0000
Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 043a01cd-f133-11ec-b725-ed86ccbb4733;
 Tue, 21 Jun 2022 09:23:16 +0200 (CEST)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out2.suse.de (Postfix) with ESMTPS id 0C7F11FDD0;
 Tue, 21 Jun 2022 07:23:16 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D5A5C13638;
 Tue, 21 Jun 2022 07:23:15 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id oPDsMuNxsWLDYwAAMHmgww
 (envelope-from <jgross@suse.com>); Tue, 21 Jun 2022 07:23:15 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 043a01cd-f133-11ec-b725-ed86ccbb4733
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1655796196; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:  content-transfer-encoding:content-transfer-encoding;
	bh=r8IJi4G0dpuEL3/1eath/8IW/jxqJG8WThQocwvM6XY=;
	b=JbgVOS9Dda7Ko5UNhr3J2zWh2GDx6L1G91NAkHiWRYhsp3Nk6arhiDa+7Wve+E5W7n3Xwm
	DymTMv4BPlA24vH+ZdirA/FbVmmqBhKKZYqSor33oTbcrJGJLla5S6XTtQOf3lIQivU+oc
	7a0w2McbX8/6S7fxWk+vaWUNqTwJgw0=
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH v3 0/4] mini-os: some memory map updates for PVH
Date: Tue, 21 Jun 2022 09:23:10 +0200
Message-Id: <20220621072314.16382-1-jgross@suse.com>
X-Mailer: git-send-email 2.35.3
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Do some memory map related changes/fixes for PVH mode:

- Prefer the memory map delivered via start-info over the one obtained
  from the hypervisor. This is a prerequisite for Xenstore-stubdom
  live-update with rising the memory limit.

- Fix a bug related to ballooning in PVH mode: PVH Xenstore-stubdom
  can't read its target memory size from Xenstore, as this introduces
  a chicken-and-egg problem. The memory size read from the hypervisor
  OTOH includes additional "special" pages marked as reserved in the
  memory map. Those pages need to be subtracted from the read size.

- Fix a bug in ballooning code in PVH mode when using memory beyond
  a RAM hole in the memory map

Changes in V3:
- minor comment for patch 3 addressed

Changes in V2:
- added patch 4
- addressed comment regarding patch 3

Juergen Gross (4):
  mini-os: take newest version of arch-x86/hvm/start_info.h
  mini-os: prefer memory map via start_info for PVH
  mini-os: fix number of pages for PVH
  mini-os: fix bug in ballooning on PVH

 arch/x86/mm.c                         | 23 ++++----
 balloon.c                             | 18 ++----
 e820.c                                | 83 ++++++++++++++++++++++++---
 include/e820.h                        |  6 ++
 include/x86/arch_mm.h                 |  2 +
 include/xen/arch-x86/hvm/start_info.h | 63 +++++++++++++++++++-
 6 files changed, 163 insertions(+), 32 deletions(-)

-- 
2.35.3



From minios-devel-bounces@lists.xenproject.org Tue Jun 21 07:23:20 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 21 Jun 2022 07:23:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.352996.579877 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3YEI-0001Uc-LZ; Tue, 21 Jun 2022 07:23:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 352996.579877; Tue, 21 Jun 2022 07:23:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3YEI-0001UQ-EG; Tue, 21 Jun 2022 07:23:18 +0000
Received: by outflank-mailman (input) for mailman id 352996;
 Tue, 21 Jun 2022 07:23:17 +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 <SRS0=VA9I=W4=suse.com=jgross@srs-se1.protection.inumbo.net>)
 id 1o3YEH-0001Tw-Kx
 for minios-devel@lists.xenproject.org; Tue, 21 Jun 2022 07:23:17 +0000
Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 04ad967a-f133-11ec-bd2d-47488cf2e6aa;
 Tue, 21 Jun 2022 09:23:16 +0200 (CEST)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out2.suse.de (Postfix) with ESMTPS id 7FFF61FDE7;
 Tue, 21 Jun 2022 07:23:16 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 467B613AAA;
 Tue, 21 Jun 2022 07:23:16 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id iLsBEORxsWLDYwAAMHmgww
 (envelope-from <jgross@suse.com>); Tue, 21 Jun 2022 07:23:16 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 04ad967a-f133-11ec-bd2d-47488cf2e6aa
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1655796196; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=sqQB2mee0jCv15NOcWCx6SVOgjnvvSzpgTYbgdXHN/4=;
	b=R8+VFBmuL4/bHanaZhB9KH4TxeG5iLgiaOJ8U3o57yzJGOc0as9jZLbVigjvVcC4+0cbgl
	TSTReEqQZCWcw9xQCgLJi4zzqFL/jptDJ/dUnHi5EIwi3EG1czuqVXbSJiPAVbxf5IjkcV
	2EGmoM4jmIVX9egQC/0YUF+hF4SquTk=
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH v3 2/4] mini-os: prefer memory map via start_info for PVH
Date: Tue, 21 Jun 2022 09:23:12 +0200
Message-Id: <20220621072314.16382-3-jgross@suse.com>
X-Mailer: git-send-email 2.35.3
In-Reply-To: <20220621072314.16382-1-jgross@suse.com>
References: <20220621072314.16382-1-jgross@suse.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Since some time now a guest started in PVH mode will get the memory
map from Xen via the start_info structure.

Modify the PVH initialization to prefer this memory map over the one
obtained via hypercall, as this will allow to add information to the
memory map for a new kernel when supporting kexec.

In case the start_info structure doesn't contain memory map information
fall back to the hypercall.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 arch/x86/mm.c  |  6 ++++++
 e820.c         | 25 +++++++++++++++++++++++++
 include/e820.h |  4 ++++
 3 files changed, 35 insertions(+)

diff --git a/arch/x86/mm.c b/arch/x86/mm.c
index 220c0b4d..41fcee67 100644
--- a/arch/x86/mm.c
+++ b/arch/x86/mm.c
@@ -45,6 +45,7 @@
 #include <mini-os/xmalloc.h>
 #include <mini-os/e820.h>
 #include <xen/memory.h>
+#include <xen/arch-x86/hvm/start_info.h>
 
 #ifdef MM_DEBUG
 #define DEBUG(_f, _a...) \
@@ -108,6 +109,11 @@ void arch_mm_preinit(void *p)
 {
     long ret;
     domid_t domid = DOMID_SELF;
+    struct hvm_start_info *hsi = p;
+
+    if ( hsi->version >= 1 && hsi->memmap_entries > 0 )
+        e820_init_memmap((struct hvm_memmap_table_entry *)(unsigned long)
+                         hsi->memmap_paddr, hsi->memmap_entries);
 
     pt_base = page_table_base;
     first_free_pfn = PFN_UP(to_phys(&_end));
diff --git a/e820.c b/e820.c
index 991ed382..ad91e00b 100644
--- a/e820.c
+++ b/e820.c
@@ -54,6 +54,7 @@ static char *e820_types[E820_TYPES] = {
     [E820_ACPI]     = "ACPI",
     [E820_NVS]      = "NVS",
     [E820_UNUSABLE] = "Unusable",
+    [E820_DISABLED] = "Disabled",
     [E820_PMEM]     = "PMEM"
 };
 
@@ -259,6 +260,30 @@ static void e820_get_memmap(void)
     e820_sanitize();
 }
 
+void e820_init_memmap(struct hvm_memmap_table_entry *entry, unsigned int num)
+{
+    unsigned int i;
+
+    BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_RAM != E820_RAM);
+    BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_RESERVED != E820_RESERVED);
+    BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_ACPI != E820_ACPI);
+    BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_NVS != E820_NVS);
+    BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_UNUSABLE != E820_UNUSABLE);
+    BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_DISABLED != E820_DISABLED);
+    BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_PMEM != E820_PMEM);
+
+    for ( i = 0; i < num; i++ )
+    {
+        e820_map[i].addr = entry[i].addr;
+        e820_map[i].size = entry[i].size;
+        e820_map[i].type = entry[i].type;
+    }
+
+    e820_entries = num;
+
+    e820_sanitize();
+}
+
 void arch_print_memmap(void)
 {
     int i;
diff --git a/include/e820.h b/include/e820.h
index aaf2f2ca..5438a7c8 100644
--- a/include/e820.h
+++ b/include/e820.h
@@ -26,6 +26,8 @@
 
 #if defined(__arm__) || defined(__aarch64__) || defined(CONFIG_PARAVIRT)
 #define CONFIG_E820_TRIVIAL
+#else
+#include <xen/arch-x86/hvm/start_info.h>
 #endif
 
 /* PC BIOS standard E820 types and structure. */
@@ -34,6 +36,7 @@
 #define E820_ACPI         3
 #define E820_NVS          4
 #define E820_UNUSABLE     5
+#define E820_DISABLED     6
 #define E820_PMEM         7
 #define E820_TYPES        8
 
@@ -54,6 +57,7 @@ unsigned long e820_get_max_contig_pages(unsigned long pfn, unsigned long pages);
 #ifndef CONFIG_E820_TRIVIAL
 unsigned long e820_get_reserved_pfns(int pages);
 void e820_put_reserved_pfns(unsigned long start_pfn, int pages);
+void e820_init_memmap(struct hvm_memmap_table_entry *entry, unsigned int num);
 #endif
 
 #endif /*__E820_HEADER*/
-- 
2.35.3



From minios-devel-bounces@lists.xenproject.org Tue Jun 21 07:23:20 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 21 Jun 2022 07:23:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.352999.579896 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3YEK-0001qq-Bz; Tue, 21 Jun 2022 07:23:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 352999.579896; Tue, 21 Jun 2022 07:23:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3YEK-0001qB-5U; Tue, 21 Jun 2022 07:23:20 +0000
Received: by outflank-mailman (input) for mailman id 352999;
 Tue, 21 Jun 2022 07:23:19 +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 <SRS0=VA9I=W4=suse.com=jgross@srs-se1.protection.inumbo.net>)
 id 1o3YEJ-0001Tv-0r
 for minios-devel@lists.xenproject.org; Tue, 21 Jun 2022 07:23:19 +0000
Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 045eec7a-f133-11ec-b725-ed86ccbb4733;
 Tue, 21 Jun 2022 09:23:16 +0200 (CEST)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out2.suse.de (Postfix) with ESMTPS id 4CA7B1FA5D;
 Tue, 21 Jun 2022 07:23:16 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 134A113638;
 Tue, 21 Jun 2022 07:23:16 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id 4LFqA+RxsWLDYwAAMHmgww
 (envelope-from <jgross@suse.com>); Tue, 21 Jun 2022 07:23:16 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 045eec7a-f133-11ec-b725-ed86ccbb4733
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1655796196; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=5vH2NqyFMDYKMsu2Ud2YN8B9pnuLSEdOQPWCQhYC+kA=;
	b=Ji4OgDXCs3g7pOm0MGuTzpDGx1npbuTC62kRMt6Gxvr7skYlXuuXUJh/Cm1qLDKrwktTHq
	01x+eS3hEqQc0AymmVZ96+E6bH8EPmy65pIK/8s9A347lkN4ri9T+Lk34VllN6b4xoDtHF
	xOeISvMnLfIO1emAV7Qy7f9FezSFd/s=
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH v3 1/4] mini-os: take newest version of arch-x86/hvm/start_info.h
Date: Tue, 21 Jun 2022 09:23:11 +0200
Message-Id: <20220621072314.16382-2-jgross@suse.com>
X-Mailer: git-send-email 2.35.3
In-Reply-To: <20220621072314.16382-1-jgross@suse.com>
References: <20220621072314.16382-1-jgross@suse.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Update include/xen/arch-x86/hvm/start_info.h to the newest version
from the Xen tree.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 include/xen/arch-x86/hvm/start_info.h | 63 ++++++++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/include/xen/arch-x86/hvm/start_info.h b/include/xen/arch-x86/hvm/start_info.h
index 64841597..50af9ea2 100644
--- a/include/xen/arch-x86/hvm/start_info.h
+++ b/include/xen/arch-x86/hvm/start_info.h
@@ -33,7 +33,7 @@
  *    | magic          | Contains the magic value XEN_HVM_START_MAGIC_VALUE
  *    |                | ("xEn3" with the 0x80 bit of the "E" set).
  *  4 +----------------+
- *    | version        | Version of this structure. Current version is 0. New
+ *    | version        | Version of this structure. Current version is 1. New
  *    |                | versions are guaranteed to be backwards-compatible.
  *  8 +----------------+
  *    | flags          | SIF_xxx flags.
@@ -48,6 +48,15 @@
  * 32 +----------------+
  *    | rsdp_paddr     | Physical address of the RSDP ACPI data structure.
  * 40 +----------------+
+ *    | memmap_paddr   | Physical address of the (optional) memory map. Only
+ *    |                | present in version 1 and newer of the structure.
+ * 48 +----------------+
+ *    | memmap_entries | Number of entries in the memory map table. Zero
+ *    |                | if there is no memory map being provided. Only
+ *    |                | present in version 1 and newer of the structure.
+ * 52 +----------------+
+ *    | reserved       | Version 1 and newer only.
+ * 56 +----------------+
  *
  * The layout of each entry in the module structure is the following:
  *
@@ -62,13 +71,51 @@
  *    | reserved       |
  * 32 +----------------+
  *
+ * The layout of each entry in the memory map table is as follows:
+ *
+ *  0 +----------------+
+ *    | addr           | Base address
+ *  8 +----------------+
+ *    | size           | Size of mapping in bytes
+ * 16 +----------------+
+ *    | type           | Type of mapping as defined between the hypervisor
+ *    |                | and guest. See XEN_HVM_MEMMAP_TYPE_* values below.
+ * 20 +----------------|
+ *    | reserved       |
+ * 24 +----------------+
+ *
  * The address and sizes are always a 64bit little endian unsigned integer.
  *
  * NB: Xen on x86 will always try to place all the data below the 4GiB
  * boundary.
+ *
+ * Version numbers of the hvm_start_info structure have evolved like this:
+ *
+ * Version 0:  Initial implementation.
+ *
+ * Version 1:  Added the memmap_paddr/memmap_entries fields (plus 4 bytes of
+ *             padding) to the end of the hvm_start_info struct. These new
+ *             fields can be used to pass a memory map to the guest. The
+ *             memory map is optional and so guests that understand version 1
+ *             of the structure must check that memmap_entries is non-zero
+ *             before trying to read the memory map.
  */
 #define XEN_HVM_START_MAGIC_VALUE 0x336ec578
 
+/*
+ * The values used in the type field of the memory map table entries are
+ * defined below and match the Address Range Types as defined in the "System
+ * Address Map Interfaces" section of the ACPI Specification. Please refer to
+ * section 15 in version 6.2 of the ACPI spec: http://uefi.org/specifications
+ */
+#define XEN_HVM_MEMMAP_TYPE_RAM       1
+#define XEN_HVM_MEMMAP_TYPE_RESERVED  2
+#define XEN_HVM_MEMMAP_TYPE_ACPI      3
+#define XEN_HVM_MEMMAP_TYPE_NVS       4
+#define XEN_HVM_MEMMAP_TYPE_UNUSABLE  5
+#define XEN_HVM_MEMMAP_TYPE_DISABLED  6
+#define XEN_HVM_MEMMAP_TYPE_PMEM      7
+
 /*
  * C representation of the x86/HVM start info layout.
  *
@@ -86,6 +133,13 @@ struct hvm_start_info {
     uint64_t cmdline_paddr;     /* Physical address of the command line.     */
     uint64_t rsdp_paddr;        /* Physical address of the RSDP ACPI data    */
                                 /* structure.                                */
+    /* All following fields only present in version 1 and newer */
+    uint64_t memmap_paddr;      /* Physical address of an array of           */
+                                /* hvm_memmap_table_entry.                   */
+    uint32_t memmap_entries;    /* Number of entries in the memmap table.    */
+                                /* Value will be zero if there is no memory  */
+                                /* map being provided.                       */
+    uint32_t reserved;          /* Must be zero.                             */
 };
 
 struct hvm_modlist_entry {
@@ -95,4 +149,11 @@ struct hvm_modlist_entry {
     uint64_t reserved;
 };
 
+struct hvm_memmap_table_entry {
+    uint64_t addr;              /* Base address of the memory region         */
+    uint64_t size;              /* Size of the memory region in bytes        */
+    uint32_t type;              /* Mapping type                              */
+    uint32_t reserved;          /* Must be zero for Version 1.               */
+};
+
 #endif /* __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__ */
-- 
2.35.3



From minios-devel-bounces@lists.xenproject.org Tue Jun 21 07:23:22 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 21 Jun 2022 07:23:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.353002.579919 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3YEM-0002Kz-GL; Tue, 21 Jun 2022 07:23:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 353002.579919; Tue, 21 Jun 2022 07:23:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3YEM-0002If-83; Tue, 21 Jun 2022 07:23:22 +0000
Received: by outflank-mailman (input) for mailman id 353002;
 Tue, 21 Jun 2022 07:23:20 +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 <SRS0=VA9I=W4=suse.com=jgross@srs-se1.protection.inumbo.net>)
 id 1o3YEK-0001Tw-EB
 for minios-devel@lists.xenproject.org; Tue, 21 Jun 2022 07:23:20 +0000
Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 04e57763-f133-11ec-bd2d-47488cf2e6aa;
 Tue, 21 Jun 2022 09:23:17 +0200 (CEST)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out2.suse.de (Postfix) with ESMTPS id D95C81FDE8;
 Tue, 21 Jun 2022 07:23:16 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id AD8C613A8F;
 Tue, 21 Jun 2022 07:23:16 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id KJkaKeRxsWLDYwAAMHmgww
 (envelope-from <jgross@suse.com>); Tue, 21 Jun 2022 07:23:16 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 04e57763-f133-11ec-bd2d-47488cf2e6aa
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1655796196; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=iK4xpyO/24q/Du+ofA9DMrmGHYHqE1QdZ+2SGjY3+1E=;
	b=TLm0LLGu8RVX2fv2/nucY1GzNv04PipwpCSX20R8nj8u2d2/GfARxKo3E3i12mBoX3C118
	AJo8fKEsKkVQ/dzJsvG2yVV2e85TyQydpxL8HBcVMQ4Ay2tzCscsIf0usqacKMU8nnkGoz
	/1lCFwCJKeqkZ4qT7cwGYYBMhQVlchE=
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH v3 4/4] mini-os: fix bug in ballooning on PVH
Date: Tue, 21 Jun 2022 09:23:14 +0200
Message-Id: <20220621072314.16382-5-jgross@suse.com>
X-Mailer: git-send-email 2.35.3
In-Reply-To: <20220621072314.16382-1-jgross@suse.com>
References: <20220621072314.16382-1-jgross@suse.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

There is a subtle bug in ballooning code for PVH: in case ballooning
extends above a non-RAM area of the memory map, wrong pages will be
used.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
V2:
- new patch
---
 balloon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/balloon.c b/balloon.c
index 6ad07644..55be8141 100644
--- a/balloon.c
+++ b/balloon.c
@@ -124,7 +124,7 @@ int balloon_up(unsigned long n_pages)
     for ( pfn = 0; pfn < rc; pfn++ )
     {
         arch_pfn_add(start_pfn + pfn, balloon_frames[pfn]);
-        free_page(pfn_to_virt(nr_mem_pages + pfn));
+        free_page(pfn_to_virt(start_pfn + pfn));
     }
 
     nr_mem_pages += rc;
-- 
2.35.3



From minios-devel-bounces@lists.xenproject.org Tue Jun 21 07:23:23 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 21 Jun 2022 07:23:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.353003.579929 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3YEN-0002c8-GB; Tue, 21 Jun 2022 07:23:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 353003.579929; Tue, 21 Jun 2022 07:23:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3YEN-0002bs-As; Tue, 21 Jun 2022 07:23:23 +0000
Received: by outflank-mailman (input) for mailman id 353003;
 Tue, 21 Jun 2022 07:23:21 +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 <SRS0=VA9I=W4=suse.com=jgross@srs-se1.protection.inumbo.net>)
 id 1o3YEL-0001Tw-ER
 for minios-devel@lists.xenproject.org; Tue, 21 Jun 2022 07:23:21 +0000
Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29])
 by se1-gles-sth1.inumbo.com (Halon) with ESMTPS
 id 04c46c7d-f133-11ec-bd2d-47488cf2e6aa;
 Tue, 21 Jun 2022 09:23:16 +0200 (CEST)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out2.suse.de (Postfix) with ESMTPS id A5F851FDEA;
 Tue, 21 Jun 2022 07:23:16 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7AE9E13638;
 Tue, 21 Jun 2022 07:23:16 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id oPOpHORxsWLDYwAAMHmgww
 (envelope-from <jgross@suse.com>); Tue, 21 Jun 2022 07:23:16 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 04c46c7d-f133-11ec-bd2d-47488cf2e6aa
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1655796196; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=CgVNbVQGUCTaIYP+BHs4gAn3b+qv8h822SUhzQAjGoI=;
	b=gKyS74dTKyHkB9YN22Xr6mm5x9q1uigRxKb8vhOFbIlWet23p//Z/HjjJq2HSZvQBVPUL7
	Z/kfIrftMU9eVVZu249TT9mQ8NGohdfgpu/o2bDRNcCUzgkQ/x7CfbdPxz5TYZQgb4bEZA
	off+3BIq4riF5pNLFLzaK8KEPk3RzlU=
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH v3 3/4] mini-os: fix number of pages for PVH
Date: Tue, 21 Jun 2022 09:23:13 +0200
Message-Id: <20220621072314.16382-4-jgross@suse.com>
X-Mailer: git-send-email 2.35.3
In-Reply-To: <20220621072314.16382-1-jgross@suse.com>
References: <20220621072314.16382-1-jgross@suse.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

When getting the current allocation from Xen, this value includes the
pages allocated in the MMIO area. Fix the highest available RAM page
by subtracting the size of that area.

This requires to read the E820 map before needing this value. Add two
functions returning the current and the maximum number of RAM pages
taking this correction into account.

At the same time add the LAPIC page to the memory map in order to
avoid reusing that PFN for internal purposes.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
V2:
- make e820_initial_reserved_pfns static (Samuel Thibault)
- add e820_get_current_pages() and e820_get_max_pages()
V3:
- change return type of e820_get_current_pages() and e820_get_max_pages()
  to unsigned long (Samuel Thibault)
---
 arch/x86/mm.c         | 17 +++++--------
 balloon.c             | 16 +++---------
 e820.c                | 58 +++++++++++++++++++++++++++++++++++++------
 include/e820.h        |  2 ++
 include/x86/arch_mm.h |  2 ++
 5 files changed, 65 insertions(+), 30 deletions(-)

diff --git a/arch/x86/mm.c b/arch/x86/mm.c
index 41fcee67..cfc978f6 100644
--- a/arch/x86/mm.c
+++ b/arch/x86/mm.c
@@ -107,25 +107,20 @@ desc_ptr idt_ptr =
 
 void arch_mm_preinit(void *p)
 {
-    long ret;
-    domid_t domid = DOMID_SELF;
+    unsigned int pages;
     struct hvm_start_info *hsi = p;
 
     if ( hsi->version >= 1 && hsi->memmap_entries > 0 )
         e820_init_memmap((struct hvm_memmap_table_entry *)(unsigned long)
                          hsi->memmap_paddr, hsi->memmap_entries);
+    else
+        e820_init_memmap(NULL, 0);
 
     pt_base = page_table_base;
     first_free_pfn = PFN_UP(to_phys(&_end));
-    ret = HYPERVISOR_memory_op(XENMEM_current_reservation, &domid);
-    if ( ret < 0 )
-    {
-        xprintk("could not get memory size\n");
-        do_exit();
-    }
-
-    last_free_pfn = e820_get_maxpfn(ret);
-    balloon_set_nr_pages(ret, last_free_pfn);
+    pages = e820_get_current_pages();
+    last_free_pfn = e820_get_maxpfn(pages);
+    balloon_set_nr_pages(pages, last_free_pfn);
 }
 #endif
 
diff --git a/balloon.c b/balloon.c
index 9dc77c54..6ad07644 100644
--- a/balloon.c
+++ b/balloon.c
@@ -44,20 +44,12 @@ void balloon_set_nr_pages(unsigned long pages, unsigned long pfn)
 
 void get_max_pages(void)
 {
-    long ret;
-    domid_t domid = DOMID_SELF;
-
-    ret = HYPERVISOR_memory_op(XENMEM_maximum_reservation, &domid);
-    if ( ret < 0 )
+    nr_max_pages = e820_get_max_pages();
+    if ( nr_max_pages )
     {
-        printk("Could not get maximum pfn\n");
-        return;
+        printk("Maximum memory size: %ld pages\n", nr_max_pages);
+        nr_max_pfn = e820_get_maxpfn(nr_max_pages);
     }
-
-    nr_max_pages = ret;
-    printk("Maximum memory size: %ld pages\n", nr_max_pages);
-
-    nr_max_pfn = e820_get_maxpfn(nr_max_pages);
 }
 
 void mm_alloc_bitmap_remap(void)
diff --git a/e820.c b/e820.c
index ad91e00b..49b16878 100644
--- a/e820.c
+++ b/e820.c
@@ -29,6 +29,38 @@
 #include <mini-os/e820.h>
 #include <xen/memory.h>
 
+static unsigned long e820_initial_reserved_pfns;
+
+unsigned long e820_get_current_pages(void)
+{
+    domid_t domid = DOMID_SELF;
+    long ret;
+
+    ret = HYPERVISOR_memory_op(XENMEM_current_reservation, &domid);
+    if ( ret < 0 )
+    {
+        xprintk("could not get memory size\n");
+        do_exit();
+    }
+
+    return ret - e820_initial_reserved_pfns;
+}
+
+unsigned long e820_get_max_pages(void)
+{
+    domid_t domid = DOMID_SELF;
+    long ret;
+
+    ret = HYPERVISOR_memory_op(XENMEM_maximum_reservation, &domid);
+    if ( ret < 0 )
+    {
+        printk("Could not get maximum pfn\n");
+        return 0;
+    }
+
+    return ret - e820_initial_reserved_pfns;
+}
+
 #ifdef CONFIG_E820_TRIVIAL
 struct e820entry e820_map[1] = {
     {
@@ -40,10 +72,6 @@ struct e820entry e820_map[1] = {
 
 unsigned e820_entries = 1;
 
-static void e820_get_memmap(void)
-{
-}
-
 #else
 struct e820entry e820_map[E820_MAX];
 unsigned e820_entries;
@@ -199,6 +227,7 @@ static void e820_sanitize(void)
 {
     int i;
     unsigned long end, start;
+    bool found_lapic = false;
 
     /* Sanitize memory map in current form. */
     e820_process_entries();
@@ -238,8 +267,20 @@ static void e820_sanitize(void)
 
     /* Make remaining temporarily reserved entries permanently reserved. */
     for ( i = 0; i < e820_entries; i++ )
+    {
         if ( e820_map[i].type == E820_TMP_RESERVED )
             e820_map[i].type = E820_RESERVED;
+        if ( e820_map[i].type == E820_RESERVED )
+        {
+            e820_initial_reserved_pfns += e820_map[i].size / PAGE_SIZE;
+            if ( e820_map[i].addr <= LAPIC_ADDRESS &&
+                 e820_map[i].addr + e820_map[i].size > LAPIC_ADDRESS )
+                found_lapic = true;
+        }
+    }
+
+    if ( !found_lapic )
+        e820_insert_entry(LAPIC_ADDRESS, PAGE_SIZE, E820_RESERVED);
 }
 
 static void e820_get_memmap(void)
@@ -264,6 +305,12 @@ void e820_init_memmap(struct hvm_memmap_table_entry *entry, unsigned int num)
 {
     unsigned int i;
 
+    if ( !entry )
+    {
+        e820_get_memmap();
+        return;
+    }
+
     BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_RAM != E820_RAM);
     BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_RESERVED != E820_RESERVED);
     BUILD_BUG_ON(XEN_HVM_MEMMAP_TYPE_ACPI != E820_ACPI);
@@ -365,9 +412,6 @@ unsigned long e820_get_maxpfn(unsigned long pages)
     int i;
     unsigned long pfns = 0, start = 0;
 
-    if ( !e820_entries )
-        e820_get_memmap();
-
     for ( i = 0; i < e820_entries; i++ )
     {
         if ( e820_map[i].type != E820_RAM )
diff --git a/include/e820.h b/include/e820.h
index 5438a7c8..ffa15aa9 100644
--- a/include/e820.h
+++ b/include/e820.h
@@ -52,6 +52,8 @@ struct __packed e820entry {
 extern struct e820entry e820_map[];
 extern unsigned e820_entries;
 
+unsigned long e820_get_current_pages(void);
+unsigned long e820_get_max_pages(void);
 unsigned long e820_get_maxpfn(unsigned long pages);
 unsigned long e820_get_max_contig_pages(unsigned long pfn, unsigned long pages);
 #ifndef CONFIG_E820_TRIVIAL
diff --git a/include/x86/arch_mm.h b/include/x86/arch_mm.h
index ffbec5a8..a1b975dc 100644
--- a/include/x86/arch_mm.h
+++ b/include/x86/arch_mm.h
@@ -207,6 +207,8 @@ typedef unsigned long pgentry_t;
 /* to align the pointer to the (next) page boundary */
 #define PAGE_ALIGN(addr)        (((addr)+PAGE_SIZE-1)&PAGE_MASK)
 
+#define LAPIC_ADDRESS	CONST(0xfee00000)
+
 #ifndef __ASSEMBLY__
 /* Definitions for machine and pseudophysical addresses. */
 #ifdef __i386__
-- 
2.35.3



From minios-devel-bounces@lists.xenproject.org Tue Jun 21 08:43:54 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 21 Jun 2022 08:43:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.353063.579957 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3ZUF-0004l5-4E; Tue, 21 Jun 2022 08:43:51 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 353063.579957; Tue, 21 Jun 2022 08:43:51 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3ZUF-0004ky-1c; Tue, 21 Jun 2022 08:43:51 +0000
Received: by outflank-mailman (input) for mailman id 353063;
 Tue, 21 Jun 2022 08:43:49 +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
 <SRS0=0ORL=W4=citrix.com=prvs=164d1f6c5=Andrew.Cooper3@srs-se1.protection.inumbo.net>)
 id 1o3ZUD-0004kn-LX
 for minios-devel@lists.xenproject.org; Tue, 21 Jun 2022 08:43:49 +0000
Received: from esa1.hc3370-68.iphmx.com (esa1.hc3370-68.iphmx.com
 [216.71.145.142]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 42a138f6-f13e-11ec-b725-ed86ccbb4733;
 Tue, 21 Jun 2022 10:43:47 +0200 (CEST)
Received: from mail-dm6nam10lp2108.outbound.protection.outlook.com (HELO
 NAM10-DM6-obe.outbound.protection.outlook.com) ([104.47.58.108])
 by ob1.hc3370-68.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256;
 21 Jun 2022 04:43:43 -0400
Received: from BYAPR03MB3623.namprd03.prod.outlook.com (2603:10b6:a02:aa::12)
 by PH0PR03MB5671.namprd03.prod.outlook.com (2603:10b6:510:35::22)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Tue, 21 Jun
 2022 08:43:42 +0000
Received: from BYAPR03MB3623.namprd03.prod.outlook.com
 ([fe80::bd46:feab:b3:4a5c]) by BYAPR03MB3623.namprd03.prod.outlook.com
 ([fe80::bd46:feab:b3:4a5c%4]) with mapi id 15.20.5353.022; Tue, 21 Jun 2022
 08:43:41 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 42a138f6-f13e-11ec-b725-ed86ccbb4733
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple;
  d=citrix.com; s=securemail; t=1655801027;
  h=from:to:cc:subject:date:message-id:references:
   in-reply-to:content-id:content-transfer-encoding:
   mime-version;
  bh=FNrCyn8Mx/7tAkgrwEhkXNSohg3BRnwaYcikUPpOo2Q=;
  b=HRAwPfvKYFOh9e3FZjEBRMixfUJVxJIAXNEfa0RSXpMcUltXSEyMmz/b
   3diLSE72RL50J6tlMv13LWBOwcxVZr5YztbzXl1I902yMpZTlnMNnOc1G
   ZrcNyEfNOoXtL6W8OB7OS+7lQJ/jsZn0MgrZEj99uJsphO0sIRpou61YF
   k=;
X-IronPort-RemoteIP: 104.47.58.108
X-IronPort-MID: 74473539
X-IronPort-Reputation: None
X-IronPort-Listener: OutboundMail
X-IronPort-SenderGroup: RELAY_O365
X-IronPort-MailFlowPolicy: $RELAYED
IronPort-Data: A9a23:B215lK8tcKk4BIaEdTTeDrUDsH+TJUtcMsCJ2f8bNWPcYEJGY0x3m
 GRLWTiAP/eLMzfwctonPoqx8BkBuMeGmNM1SVM4/is8E34SpcT7XtnIdU2Y0wF+jyHgoOCLy
 +1EN7Es+ehtFie0Si+Fa+Sn9T8mvU2xbuKU5NTsY0idfic5DnZ74f5fs7Rh2NQw34LgW1rlV
 e7a+KUzBnf0g1aYDUpMg06zgEsHUCPa4W5wUvQWPJinjXeG/5UnJMt3yZKZdhMUdrJ8DO+iL
 9sv+Znilo/vE7XBPfv++lrzWhVirrc/pmFigFIOM0SpqkAqSiDfTs/XnRfTAKtao2zhojx/9
 DlCnaSLVRx4Y5Xno+I2fDB/FwonMYZmwrCSdBBTseTLp6HHW13F5qw2SW0TY8gf8OsxBnxS/
 /sFLjxLdgqEm++93LO8TK9rm9gnK87oeogYvxmMzxmAVapgHc+FHvWMvIcItNszrpkm8fL2T
 swVczdwKj/HZAVCIAw/A5Mihua4wHL4dlW0rXrK+fZouDWInWSd1pCwEofkI9y4WPxrm3i/+
 k3X2nrdU0oVYYn3JT2ttyjEavX0tSH0QoUJD5Wj6+VnxlaUwwQ7DRwQVFyg5PW0lEO6c9ZeM
 FAPvDojq7Ao806mRcW7WAe3yFaUsxhZV9dOHukS7ACW1rGS8wufHnIDTDNKdJohrsBebScj0
 0KEm5X1BT1luaCRVVqQ8KzRqSK1P24SN2BqTTAAZRsI5Z/kuo5bs/7UZtNqEarwgtirHzj1m
 miOtHJn3+VVitMX3aKm+1yBmyirupXCUg8y4EPQQ36h6QR6IoWiYuRE9GTm0BqJF67BJnHpg
 ZTOs5H2ADwmZX1VqBGwfQ==
IronPort-HdrOrdr: A9a23:ed2KnKnGIQZOkInND3rKOuTONqXpDfN1iWdD5ihNYBxZY6Wkfp
 +V8cjzhCWftN9OYhodcIi7SdK9qXO1z+8X3WGIVY3SEDUOy1HYVr2KirGSjAEIeheOu9K1sJ
 0NT0EQMqyWMbEXt6fHCUyDYq4dKbq8ge6VbIXlvhFQpGhRAskOgTuRSDzra3GeLzM2Z6bRYa
 Dsgvav0ADQHEj/AP7aOlA1G8z44/HbnpPvZhALQzQ97hOVsD+u4LnmVzCFwxY3SVp0sPcf2F
 mAtza8yrSosvm9xBOZ/XTU9Y5qlNzozcYGLNCQi/ISNi7nhm+TFcdcsvy5zXIISdOUmRIXee
 r30lAd1gNImjXsl1SO0F7QMs/boW8TAjHZuAelaDDY0LHErXoBerZ8bMRiA1rkAgMbza9BOO
 gg5RPni7NHSRzHhyjz/N7OSlVjkVe1u2MrlaoJg2VYSpZ2Us4YkWUzxjIiLH47JlOy1GnnKp
 gdMOjMoPJNNV+KZXHQuWdihNSqQ3QoBx+DBkwPoNac3TRalG1wixJw/r1Uol4QsJYmD5VU7e
 XNNapl0LlIU88NdKp4QOMMW9G+BGDBSQ/FdGiSPVPkHqcaPG+lke+93JwloOWxPJAYxpo7n5
 rMFFteqG4pYkrrTdaD2ZVamyq9N1lVnQ6dvv22y6IJyoEUHoCbQBFrYGpe4PeIsrEYHtDRXe
 q1NdZfH+LjRFGebLp04w==
X-IronPort-AV: E=Sophos;i="5.92,209,1650945600"; 
   d="scan'208";a="74473539"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=GVlTNc3qWhMJ2+IVzdSGMtm+jRwTiP3Ejc8RvdNu3bChdB32XTsXNdicvQ6fPD4vcdTfMsJbY9VJEvbT2pr+S6zu3uH2TJfSS2OXPfBLXtH+C4cnSR9nwCkyryhDF7e+wzYmKmVTF3J7nyQwnlXR7888btrJO6d7C+cF053KEG2VPbdrOenQ5KnP9wgzOB/3FqQoJnhzHsnyyUremVnBC+6cjpUAkRF+NSRfmZ1AVRJ1NMelhh4IokZeigqrsFPwTHRnGT7ICgQ9abDit9hR4tUPlR8cnn/NuoE5Bvnr01JrkmC61VgkVyf3I5xW3z7v2yO5c9km4xot2UWxYrQzCA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=FNrCyn8Mx/7tAkgrwEhkXNSohg3BRnwaYcikUPpOo2Q=;
 b=kVi+WNOn3gHalNykrmMeiGAKWtM6szLfElAaXQjOCbbjT98C3HdO2uBR1O1p1XA7SEqDjPIyYEcI0dIw3zzG3yFSEclwyK1Je5SuukphOP+FlQvEnEztVc4SiS2CKPCn5VQIg3K0SYDTpdWTruoUhVbwwXSnNe7CDTrr5HgJdE6HF0njrbDnmJfYijb9SDwamJfCtcriLstZvLlccRBc0zU6PYBk9pZRx/4JWEOZezen9dadkIMZRYd5hVStFSIG4/9rzuwq1ljTwHFFU4cb0h4h+bvDN6UXNpZNcEKrIkgjeKoCQRRH9ogUioIsGXlUdbrW3we03mTCiadpe5KPeg==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com;
 dkim=pass header.d=citrix.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=FNrCyn8Mx/7tAkgrwEhkXNSohg3BRnwaYcikUPpOo2Q=;
 b=LzSHFxmDC3Iyrd84ZRufriv4EbYuOF0j4Js5MFpMcl3E0kXQrfKDycgxNDqiYHy0Zpao2oQDw6eHuG/s8yuj3toFiNAyysq5Jt3/Urj8Jsa44eZzDR7aobVc4SD6exYpVyU4Nz2DTExx+LzZfZ4hYPcNM3Fe7K0p3L3VLBrBiNo=
From: Andrew Cooper <Andrew.Cooper3@citrix.com>
To: Juergen Gross <jgross@suse.com>, "minios-devel@lists.xenproject.org"
	<minios-devel@lists.xenproject.org>, "xen-devel@lists.xenproject.org"
	<xen-devel@lists.xenproject.org>
CC: "samuel.thibault@ens-lyon.org" <samuel.thibault@ens-lyon.org>,
	"wl@xen.org" <wl@xen.org>
Subject: Re: [PATCH v3 3/4] mini-os: fix number of pages for PVH
Thread-Topic: [PATCH v3 3/4] mini-os: fix number of pages for PVH
Thread-Index: AQHYhT/O8+kLDI1LXkCy8scmU4sLua1Zi4MA
Date: Tue, 21 Jun 2022 08:43:41 +0000
Message-ID: <ec0d19c7-cc28-3c2a-05a9-0cdecd5b9f56@citrix.com>
References: <20220621072314.16382-1-jgross@suse.com>
 <20220621072314.16382-4-jgross@suse.com>
In-Reply-To: <20220621072314.16382-4-jgross@suse.com>
Accept-Language: en-GB, en-US
Content-Language: en-GB
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
user-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
 Thunderbird/91.10.0
authentication-results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=citrix.com;
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 11355091-74e2-4bc9-083c-08da536224f8
x-ms-traffictypediagnostic: PH0PR03MB5671:EE_
x-microsoft-antispam-prvs:
 <PH0PR03MB5671FA9AB2D6F5406502E857BAB39@PH0PR03MB5671.namprd03.prod.outlook.com>
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info:
 D4KK4Rp1sYNKtF0DTX7TrffGRWnI6a66bigD4AE7SyoviVLpx+SglTph1jNdHUuqbr1QT7NHWXVP1yyV/cM/Frm4qS/2nz65Mze4QBWHuvzZE6Any8G87d/EI+dAET8NDcC2RE6uCn3CrzNQhTPOV+G6hV3ut4g6FFXyratvfuMJzW/0wRBXdw0niqdZj5uwgkN5+av4SYQ5jW341OU+mbrXQlQxa9dj2x8Mxi1uXF2KFh//VjqFpffJnPm/0vit9gU4ByScjCvy6swiZc5IByqI9fV2E7VyMcTMfgtd8Zb1KyAmCIvzQWJl01dYYt4B6IXycVJ9yFQfN9Hd+4i/huDBEvcL5aUmdi2qbQ2qF9wqhSM/RDv73d6cXBlvkU/Wb5ZxlvDOf0j1NTOiyfzEaryNH0we0Ba9iu2fI9R8BxhUgPe41uwBeVz4t+tatpo/tp/38o6D21aTb0d+fgsGY3sjQZk/1QBPX6jlCdbuogNN1Pd2T3aiRFtGdZ+NWqDhuPitdCsZHq6pOs9HL+YO86oVmH6M9H/pUlamsDsbdzp4lHHJ9RFIETZTuzK4y94eciKmURSj+pCswVBugW+h1PgRj9ZBNzc2IZ5QbzTBE6/8lS7eEFwqrAq/hcqGX+EbTM+CcHzgDjcOBMxk9qt+8byXKZsLDI1UCU0ckfVZ4MoX82vB+0909a2NOaFgKjCeqQKNync5dWServ1SC5Kxv1m80kE4m0V4P6Klf9TUUEJ38PrUaSVwtWHIXThJ5s2tP6KvdkHnQVZNvTQBK2od6g==
x-forefront-antispam-report:
 CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR03MB3623.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(376002)(39860400002)(346002)(366004)(396003)(136003)(316002)(4744005)(478600001)(6486002)(2906002)(54906003)(110136005)(4326008)(8936002)(71200400001)(66946007)(5660300002)(86362001)(53546011)(91956017)(26005)(64756008)(31686004)(36756003)(31696002)(2616005)(6512007)(41300700001)(66476007)(66556008)(66446008)(76116006)(8676002)(186003)(38100700002)(38070700005)(82960400001)(6506007)(122000001)(43740500002)(45980500001);DIR:OUT;SFP:1101;
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0:
 =?utf-8?B?L2QvNzN3T0ZsWFZnc2ZTdFBsNVplVEZIS0R6UDE4S3RjbFBDRGlLMWNKcFBX?=
 =?utf-8?B?RXBJdEp0b0V1aXZSZllaKzZRcUFkYjE4VHA5dGp6NWF6RFAwOUdnSytMTG81?=
 =?utf-8?B?UXIydSt5Ujg1N3pVb2MzcmY5aTBQUzlHNkZ6RDBNQWVWakFxaGxtV3VjSFNK?=
 =?utf-8?B?QXA0ZXpYYmkrQmh0d0kydHJySFR4UDJZRU1sNll6bHZ2Ti9CajNXZjB4R1N2?=
 =?utf-8?B?aDBlQ2lQMjhObW4zcDluYkFLWUN5MXNKK0FLdmhqRzVXamVvNTU0YWZnRFpw?=
 =?utf-8?B?VWozdXVvUnhVZ0p4RmxyU1NJTjB6bTgrZUJVWkozNUZ4emJLa3ZCWEpaVDBn?=
 =?utf-8?B?RExoS0JWdHNaNTlpc1crVTdheVVpa25pZnRTeUJzVHlNK05JOG44N05RSUhq?=
 =?utf-8?B?S1haMFBpY3MxOEduZm5LYjJKSGpPOWdkRE0yZmpCSnArWFVXQmNDTEgxVGVK?=
 =?utf-8?B?cWdBVHFCMDAybHF6a00xZDMwL2g5SFNwbzZXcGRneDgzYVZSemZaeGR2ZFZp?=
 =?utf-8?B?RWx2OTA3UkdwRkRhNVhBRnVEN3h4OEdIUDFGd1IzYWliRHdidlVRWW91U3Jh?=
 =?utf-8?B?Z0FjR2RpdU9jOHJGMStzQ1VIQitnRDQ5ZmJQMDR2NlM4YlJxb3R3dU1mNWlO?=
 =?utf-8?B?SFJUdnNIdEJ6V2pKNzlPUnhVV0VuRkoyWVJRNE5JTmhTVE15TFdqY1lpTGRt?=
 =?utf-8?B?WWxsQURSSE9EK1F3UnFZNTVCODFxelJISURrQmtFRjlFQUYxZDFtMmphcEcx?=
 =?utf-8?B?aU1OalJPRlhMeTQ3ckNidGJucEFkM3VrdDZ2NVVYd3JZZWIxeU04QU1ScW1Y?=
 =?utf-8?B?S1VydStXZldDUzVLMzJTUmtyMEk0aHZOVHpvTkZtalYxL25GdzBpMWJCaUNo?=
 =?utf-8?B?NVJLQ3FKeEtDNUxTUThzMVJYaFNNKzVCZ0VCMzlHRk5wL0Z6ODFTZlFoaUhy?=
 =?utf-8?B?eUh0ZVRaSTE2RzlmZHJtMFBrM2FmT1hhSXhIdjRjZEVWSGF1dWtHMkJEeDNq?=
 =?utf-8?B?c1ZoQmRLV2tTZlRXcTc0aDZONnZ0RTBTemZyU0I1TzZweHRJaWlhNitBUDcy?=
 =?utf-8?B?ZnZiZDBtNG1kOWVXTTBoVzJRbHBpczNwak56WTJubnlXV1JjYkZTV1BqT1Q4?=
 =?utf-8?B?SWo0cjVIUnlxNCs0ZkNtRmI2QXY4LzA4ZHBZdXlieXcyaVNvY3lOZXZNdFQ3?=
 =?utf-8?B?RzZrTmZzVUkvUUpzYVFFZ3VGUjg1WjFMTnRiVzBodjVxY01GYXFMK29LaWNq?=
 =?utf-8?B?WVowQlFYWkJVMEJiRnEyVVNFWExHN25GUzhMQ1l4Q0FJd2pVVnQ2RnBvTEJM?=
 =?utf-8?B?dnJZOUxqNkpSbUNManlpVVU4MWZLcmVzM1B2akxPaDR1b3h5aHgzck96dTI0?=
 =?utf-8?B?L2lqQVM0ajArdktMekpBeEZWWnZPMmMrV0kyaHFFd2NENU1ZS0M3dVFNNTY0?=
 =?utf-8?B?VE1KaUt3RzQva0ZacDF5djRmbXhyZE1ieGRGRkxSNlE2Q1Q0UUtqL3lRUE5y?=
 =?utf-8?B?TGhGMHlJUmZzQlZKTkltcDBTMkI2NEdacGJrd2s3Y3dUc1hwQWFZZ0NkTjFB?=
 =?utf-8?B?UUlyZFIzUERoNnJaNGl3ekltd1lSdng2QjNUN2pzTGNtN3lzN2FCTTJGRXlX?=
 =?utf-8?B?NmJxS1YyTktaejNaQ2hRcms5Y1pZZGQ2cVhhdjR5dHJ6N0Fybjl1MnJxSFkz?=
 =?utf-8?B?SGhmYkVkUVpvV3k0NVZYWTRUbVNDOGY0SzNrSm9HUHJIRDNSZmQ2ampDWXVG?=
 =?utf-8?B?V1czUGpjcGVzRUM3bENKcks4SzdRMVViN0tVTk5BVWg5TVBXQmduWFVXdjRh?=
 =?utf-8?B?ejRZZnVpK3p2UVhGcUcxWGpVN3ByaHJJNW1yRWZTa3BYY1BtUDBoYkIyNUZS?=
 =?utf-8?B?R3dTYWw0ZjlCdndMd3RsdG5NQUFQVzBiVURYVDZucTJkbVJ1cW9WYkNJbVNO?=
 =?utf-8?B?aEs1UXZQYk44WElFU0F6dDBDK2NkV2xRQURWdW5LUWdjU3JIdEJsMUo0Q05H?=
 =?utf-8?B?N2ZFenZSUFdrZ0RaN0xCU25GK0hiQzFFZ1VRSTRTVUhrRHJGN0s1b215U1Iy?=
 =?utf-8?B?eDBROUQzb1QyT1NDV2JPSStaQjhLSHU3SEVVSFkwTkxQU0R2RzVTQ0dtZWdD?=
 =?utf-8?B?S2tPbGtSZ2FUSUZQME5qOTErcFFJdFlWL0FpOW9RMVhzZWZHTTFDemhVVGls?=
 =?utf-8?B?UEFzZi9jQk5xS081a0pBbU15dWlwZjY5cHo3ZTVVbFo0ZWVLU3FVaFg1c2ly?=
 =?utf-8?B?UnlhYjRFS1E1NSs2KzFHbnRyOWZCSDJOQUFWQmlMY2NyU0VKYk53SWV3cmdk?=
 =?utf-8?B?SVM5MXRsWEg5Z2RnZ28xYXhqM1V2SkYxQ3YwNVlHUlBvVmNFTll2aExBMzNQ?=
 =?utf-8?Q?mo32VNP5nD7iPbQM=3D?=
Content-Type: text/plain; charset="utf-8"
Content-ID: <EB86FB817E85AA4E84C6D11FA8547F2E@namprd03.prod.outlook.com>
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-OriginatorOrg: citrix.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: BYAPR03MB3623.namprd03.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 11355091-74e2-4bc9-083c-08da536224f8
X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jun 2022 08:43:41.8012
 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 335836de-42ef-43a2-b145-348c2ee9ca5b
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: 8dt0ch4db4iPucSIvA2YiogfpP8YBlVt4v+uCTXsbbnlLSmfSM6+ujIay/ICXUbrG+/7z3Z86WHMVI/HwCZT5Zn9IHUhjRaTVaxsL2J7ozU=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR03MB5671

T24gMjEvMDYvMjAyMiAwODoyMywgSnVlcmdlbiBHcm9zcyB3cm90ZToNCj4gZGlmZiAtLWdpdCBh
L2U4MjAuYyBiL2U4MjAuYw0KPiBpbmRleCBhZDkxZTAwYi4uNDliMTY4NzggMTAwNjQ0DQo+IC0t
LSBhL2U4MjAuYw0KPiArKysgYi9lODIwLmMNCj4gQEAgLTI5LDYgKzI5LDM4IEBADQo+ICAjaW5j
bHVkZSA8bWluaS1vcy9lODIwLmg+DQo+ICAjaW5jbHVkZSA8eGVuL21lbW9yeS5oPg0KPiAgDQo+
ICtzdGF0aWMgdW5zaWduZWQgbG9uZyBlODIwX2luaXRpYWxfcmVzZXJ2ZWRfcGZuczsNCj4gKw0K
PiArdW5zaWduZWQgbG9uZyBlODIwX2dldF9jdXJyZW50X3BhZ2VzKHZvaWQpDQo+ICt7DQo+ICsg
ICAgZG9taWRfdCBkb21pZCA9IERPTUlEX1NFTEY7DQo+ICsgICAgbG9uZyByZXQ7DQo+ICsNCj4g
KyAgICByZXQgPSBIWVBFUlZJU09SX21lbW9yeV9vcChYRU5NRU1fY3VycmVudF9yZXNlcnZhdGlv
biwgJmRvbWlkKTsNCj4gKyAgICBpZiAoIHJldCA8IDAgKQ0KPiArICAgIHsNCj4gKyAgICAgICAg
eHByaW50aygiY291bGQgbm90IGdldCBtZW1vcnkgc2l6ZVxuIik7DQoNCiVsZCByZXQNCg0KQWxz
bywgeHByaW50aygpIHZzIC4uLg0KDQo+ICsgICAgICAgIGRvX2V4aXQoKTsNCj4gKyAgICB9DQo+
ICsNCj4gKyAgICByZXR1cm4gcmV0IC0gZTgyMF9pbml0aWFsX3Jlc2VydmVkX3BmbnM7DQo+ICt9
DQo+ICsNCj4gK3Vuc2lnbmVkIGxvbmcgZTgyMF9nZXRfbWF4X3BhZ2VzKHZvaWQpDQo+ICt7DQo+
ICsgICAgZG9taWRfdCBkb21pZCA9IERPTUlEX1NFTEY7DQo+ICsgICAgbG9uZyByZXQ7DQo+ICsN
Cj4gKyAgICByZXQgPSBIWVBFUlZJU09SX21lbW9yeV9vcChYRU5NRU1fbWF4aW11bV9yZXNlcnZh
dGlvbiwgJmRvbWlkKTsNCj4gKyAgICBpZiAoIHJldCA8IDAgKQ0KPiArICAgIHsNCj4gKyAgICAg
ICAgcHJpbnRrKCJDb3VsZCBub3QgZ2V0IG1heGltdW0gcGZuXG4iKTsNCg0KLi4uIHByaW50aygp
Pw0KDQpTaG91bGRuJ3QgdGhleSBib3RoIGJlIHByaW50aygpP8KgIENhbiBmaXggYm90aCBpc3N1
ZXMgb24gY29tbWl0Lg0KDQp+QW5kcmV3DQo=


From minios-devel-bounces@lists.xenproject.org Tue Jun 21 08:52:28 2022
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 21 Jun 2022 08:52:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.353096.580006 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3ZcZ-0007lx-3B; Tue, 21 Jun 2022 08:52:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 353096.580006; Tue, 21 Jun 2022 08:52:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1o3ZcY-0007lo-Vr; Tue, 21 Jun 2022 08:52:26 +0000
Received: by outflank-mailman (input) for mailman id 353096;
 Tue, 21 Jun 2022 08:52:25 +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 <SRS0=VA9I=W4=suse.com=jgross@srs-se1.protection.inumbo.net>)
 id 1o3ZcX-0007WK-C9
 for minios-devel@lists.xenproject.org; Tue, 21 Jun 2022 08:52:25 +0000
Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28])
 by se1-gles-flk1.inumbo.com (Halon) with ESMTPS
 id 777d0fac-f13f-11ec-b725-ed86ccbb4733;
 Tue, 21 Jun 2022 10:52:23 +0200 (CEST)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out1.suse.de (Postfix) with ESMTPS id C30E221EBA;
 Tue, 21 Jun 2022 08:52:22 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 933F713A88;
 Tue, 21 Jun 2022 08:52:22 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id D4WbIsaGsWLLEwAAMHmgww
 (envelope-from <jgross@suse.com>); Tue, 21 Jun 2022 08:52:22 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 777d0fac-f13f-11ec-b725-ed86ccbb4733
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1655801542; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:content-type:content-type:
	 in-reply-to:in-reply-to:references:references;
	bh=ecQl4gx2pJEVJl/2Ry2eGo14Mgun+bU1T/nT7aFLXns=;
	b=daqkP76PTZG8leaqnMXEZLXJTFWb27KGCY1yVxUpbpUGDYgSfq8lP4jm/ru9m7kVmRkP8I
	VUzfuIEVKxPujRfawkEiS7Yj2de4XS3PgDmAOAAyQ8egkrbbJIH77ODX/YJdITYVLlvcd+
	fK7PaRTV9c29nfBk8HdnJt9flx2ywWM=
Message-ID: <ea7d7837-785a-c543-a0c1-ad471c7e6d1c@suse.com>
Date: Tue, 21 Jun 2022 10:52:22 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
 Thunderbird/91.9.0
Content-Language: en-US
To: Andrew Cooper <Andrew.Cooper3@citrix.com>,
 "minios-devel@lists.xenproject.org" <minios-devel@lists.xenproject.org>,
 "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "samuel.thibault@ens-lyon.org" <samuel.thibault@ens-lyon.org>,
 "wl@xen.org" <wl@xen.org>
References: <20220621072314.16382-1-jgross@suse.com>
 <20220621072314.16382-4-jgross@suse.com>
 <ec0d19c7-cc28-3c2a-05a9-0cdecd5b9f56@citrix.com>
From: Juergen Gross <jgross@suse.com>
Subject: Re: [PATCH v3 3/4] mini-os: fix number of pages for PVH
In-Reply-To: <ec0d19c7-cc28-3c2a-05a9-0cdecd5b9f56@citrix.com>
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="------------4PFqV1eEr0FcLU29tejucyFp"

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--------------4PFqV1eEr0FcLU29tejucyFp
Content-Type: multipart/mixed; boundary="------------EuYWG09dcRRmAm985LvvRqMV";
 protected-headers="v1"
From: Juergen Gross <jgross@suse.com>
To: Andrew Cooper <Andrew.Cooper3@citrix.com>,
 "minios-devel@lists.xenproject.org" <minios-devel@lists.xenproject.org>,
 "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "samuel.thibault@ens-lyon.org" <samuel.thibault@ens-lyon.org>,
 "wl@xen.org" <wl@xen.org>
Message-ID: <ea7d7837-785a-c543-a0c1-ad471c7e6d1c@suse.com>
Subject: Re: [PATCH v3 3/4] mini-os: fix number of pages for PVH
References: <20220621072314.16382-1-jgross@suse.com>
 <20220621072314.16382-4-jgross@suse.com>
 <ec0d19c7-cc28-3c2a-05a9-0cdecd5b9f56@citrix.com>
In-Reply-To: <ec0d19c7-cc28-3c2a-05a9-0cdecd5b9f56@citrix.com>

--------------EuYWG09dcRRmAm985LvvRqMV
Content-Type: multipart/mixed; boundary="------------IVnimBOUk60PHtLClNttlB6l"

--------------IVnimBOUk60PHtLClNttlB6l
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: base64

T24gMjEuMDYuMjIgMTA6NDMsIEFuZHJldyBDb29wZXIgd3JvdGU6DQo+IE9uIDIxLzA2LzIw
MjIgMDg6MjMsIEp1ZXJnZW4gR3Jvc3Mgd3JvdGU6DQo+PiBkaWZmIC0tZ2l0IGEvZTgyMC5j
IGIvZTgyMC5jDQo+PiBpbmRleCBhZDkxZTAwYi4uNDliMTY4NzggMTAwNjQ0DQo+PiAtLS0g
YS9lODIwLmMNCj4+ICsrKyBiL2U4MjAuYw0KPj4gQEAgLTI5LDYgKzI5LDM4IEBADQo+PiAg
ICNpbmNsdWRlIDxtaW5pLW9zL2U4MjAuaD4NCj4+ICAgI2luY2x1ZGUgPHhlbi9tZW1vcnku
aD4NCj4+ICAgDQo+PiArc3RhdGljIHVuc2lnbmVkIGxvbmcgZTgyMF9pbml0aWFsX3Jlc2Vy
dmVkX3BmbnM7DQo+PiArDQo+PiArdW5zaWduZWQgbG9uZyBlODIwX2dldF9jdXJyZW50X3Bh
Z2VzKHZvaWQpDQo+PiArew0KPj4gKyAgICBkb21pZF90IGRvbWlkID0gRE9NSURfU0VMRjsN
Cj4+ICsgICAgbG9uZyByZXQ7DQo+PiArDQo+PiArICAgIHJldCA9IEhZUEVSVklTT1JfbWVt
b3J5X29wKFhFTk1FTV9jdXJyZW50X3Jlc2VydmF0aW9uLCAmZG9taWQpOw0KPj4gKyAgICBp
ZiAoIHJldCA8IDAgKQ0KPj4gKyAgICB7DQo+PiArICAgICAgICB4cHJpbnRrKCJjb3VsZCBu
b3QgZ2V0IG1lbW9yeSBzaXplXG4iKTsNCj4gDQo+ICVsZCByZXQNCj4gDQo+IEFsc28sIHhw
cmludGsoKSB2cyAuLi4NCj4gDQo+PiArICAgICAgICBkb19leGl0KCk7DQo+PiArICAgIH0N
Cj4+ICsNCj4+ICsgICAgcmV0dXJuIHJldCAtIGU4MjBfaW5pdGlhbF9yZXNlcnZlZF9wZm5z
Ow0KPj4gK30NCj4+ICsNCj4+ICt1bnNpZ25lZCBsb25nIGU4MjBfZ2V0X21heF9wYWdlcyh2
b2lkKQ0KPj4gK3sNCj4+ICsgICAgZG9taWRfdCBkb21pZCA9IERPTUlEX1NFTEY7DQo+PiAr
ICAgIGxvbmcgcmV0Ow0KPj4gKw0KPj4gKyAgICByZXQgPSBIWVBFUlZJU09SX21lbW9yeV9v
cChYRU5NRU1fbWF4aW11bV9yZXNlcnZhdGlvbiwgJmRvbWlkKTsNCj4+ICsgICAgaWYgKCBy
ZXQgPCAwICkNCj4+ICsgICAgew0KPj4gKyAgICAgICAgcHJpbnRrKCJDb3VsZCBub3QgZ2V0
IG1heGltdW0gcGZuXG4iKTsNCj4gDQo+IC4uLiBwcmludGsoKT8NCj4gDQo+IFNob3VsZG4n
dCB0aGV5IGJvdGggYmUgcHJpbnRrKCk/wqAgQ2FuIGZpeCBib3RoIGlzc3VlcyBvbiBjb21t
aXQuDQoNCmU4MjBfZ2V0X2N1cnJlbnRfcGFnZXMoKSBpcyBiZWluZyBjYWxsZWQgYmVmb3Jl
IGNvbnNvbGUgaW5pdGlhbGl6YXRpb24sDQpzbyBpdCBzaG91bGQgcmVhbGx5IHVzZSB4cHJp
bnRrKCkuDQoNCkFkZGluZyB0aGUgcmV0dXJuZWQgZXJyb3IgbWlnaHQgYmUgaW50ZXJlc3Rp
bmcsIHRob3VnaCAoZXZlbiBpZiBhbiBlcnJvcg0KaXMgdmVyeSB1bmxpa2VseSkuDQoNCk5v
dGUgdGhhdCB0aGUgZXJyb3IgbWVzc2FnZSBwcmludGluZyBoYXMganVzdCBiZWVuIG1vdmVk
IGZyb20gdGhlIHByZXZpb3VzDQp1c2UgY2FzZSBpbnRvIHRoZSBuZXcgZnVuY3Rpb24uDQoN
Cg0KSnVlcmdlbg0K
--------------IVnimBOUk60PHtLClNttlB6l
Content-Type: application/pgp-keys; name="OpenPGP_0xB0DE9DD628BF132F.asc"
Content-Disposition: attachment; filename="OpenPGP_0xB0DE9DD628BF132F.asc"
Content-Description: OpenPGP public key
Content-Transfer-Encoding: quoted-printable

-----BEGIN PGP PUBLIC KEY BLOCK-----

xsBNBFOMcBYBCACgGjqjoGvbEouQZw/ToiBg9W98AlM2QHV+iNHsEs7kxWhKMjri
oyspZKOBycWxw3ie3j9uvg9EOB3aN4xiTv4qbnGiTr3oJhkB1gsb6ToJQZ8uxGq2
kaV2KL9650I1SJvedYm8Of8Zd621lSmoKOwlNClALZNew72NjJLEzTalU1OdT7/i
1TXkH09XSSI8mEQ/ouNcMvIJNwQpd369y9bfIhWUiVXEK7MlRgUG6MvIj6Y3Am/B
BLUVbDa4+gmzDC9ezlZkTZG2t14zWPvxXP3FAp2pkW0xqG7/377qptDmrk42GlSK
N4z76ELnLxussxc7I2hx18NUcbP8+uty4bMxABEBAAHNHEp1ZXJnZW4gR3Jvc3Mg
PGpnQHBmdXBmLm5ldD7CwHkEEwECACMFAlOMcBYCGwMHCwkIBwMCAQYVCAIJCgsE
FgIDAQIeAQIXgAAKCRCw3p3WKL8TL0KdB/93FcIZ3GCNwFU0u3EjNbNjmXBKDY4F
UGNQH2lvWAUy+dnyThpwdtF/jQ6j9RwE8VP0+NXcYpGJDWlNb9/JmYqLiX2Q3Tye
vpB0CA3dbBQp0OW0fgCetToGIQrg0MbD1C/sEOv8Mr4NAfbauXjZlvTj30H2jO0u
+6WGM6nHwbh2l5O8ZiHkH32iaSTfN7Eu5RnNVUJbvoPHZ8SlM4KWm8rG+lIkGurq
qu5gu8q8ZMKdsdGC4bBxdQKDKHEFExLJK/nRPFmAuGlId1E3fe10v5QL+qHI3EIP
tyfE7i9Hz6rVwi7lWKgh7pe0ZvatAudZ+JNIlBKptb64FaiIOAWDCx1SzR9KdWVy
Z2VuIEdyb3NzIDxqZ3Jvc3NAc3VzZS5jb20+wsB5BBMBAgAjBQJTjHCvAhsDBwsJ
CAcDAgEGFQgCCQoLBBYCAwECHgECF4AACgkQsN6d1ii/Ey/HmQf/RtI7kv5A2PS4
RF7HoZhPVPogNVbC4YA6lW7DrWf0teC0RR3MzXfy6pJ+7KLgkqMlrAbN/8Dvjoz7
8X+5vhH/rDLa9BuZQlhFmvcGtCF8eR0T1v0nC/nuAFVGy+67q2DH8As3KPu0344T
BDpAvr2uYM4tSqxK4DURx5INz4ZZ0WNFHcqsfvlGJALDeE0LhITTd9jLzdDad1pQ
SToCnLl6SBJZjDOX9QQcyUigZFtCXFst4dlsvddrxyqT1f17+2cFSdu7+ynLmXBK
7abQ3rwJY8SbRO2iRulogc5vr/RLMMlscDAiDkaFQWLoqHHOdfO9rURssHNN8WkM
nQfvUewRz80hSnVlcmdlbiBHcm9zcyA8amdyb3NzQG5vdmVsbC5jb20+wsB5BBMB
AgAjBQJTjHDXAhsDBwsJCAcDAgEGFQgCCQoLBBYCAwECHgECF4AACgkQsN6d1ii/
Ey8PUQf/ehmgCI9jB9hlgexLvgOtf7PJnFOXgMLdBQgBlVPO3/D9R8LtF9DBAFPN
hlrsfIG/SqICoRCqUcJ96Pn3P7UUinFG/I0ECGF4EvTE1jnDkfJZr6jrbjgyoZHi
w/4BNwSTL9rWASyLgqlA8u1mf+c2yUwcGhgkRAd1gOwungxcwzwqgljf0N51N5Jf
VRHRtyfwq/ge+YEkDGcTU6Y0sPOuj4Dyfm8fJzdfHNQsWq3PnczLVELStJNdapwP
OoE+lotufe3AM2vAEYJ9rTz3Cki4JFUsgLkHFqGZarrPGi1eyQcXeluldO3m91NK
/1xMI3/+8jbO0tsn1tqSEUGIJi7ox80eSnVlcmdlbiBHcm9zcyA8amdyb3NzQHN1
c2UuZGU+wsB5BBMBAgAjBQJTjHDrAhsDBwsJCAcDAgEGFQgCCQoLBBYCAwECHgEC
F4AACgkQsN6d1ii/Ey+LhQf9GL45eU5vOowA2u5N3g3OZUEBmDHVVbqMtzwlmNC4
k9Kx39r5s2vcFl4tXqW7g9/ViXYuiDXb0RfUpZiIUW89siKrkzmQ5dM7wRqzgJpJ
wK8Bn2MIxAKArekWpiCKvBOB/Cc+3EXE78XdlxLyOi/NrmSGRIov0karw2RzMNOu
5D+jLRZQd1Sv27AR+IP3I8U4aqnhLpwhK7MEy9oCILlgZ1QZe49kpcumcZKORmzB
TNh30FVKK1EvmV2xAKDoaEOgQB4iFQLhJCdP1I5aSgM5IVFdn7v5YgEYuJYx37Io
N1EblHI//x/e2AaIHpzK5h88NEawQsaNRpNSrcfbFmAg987ATQRTjHAWAQgAyzH6
AOODMBjgfWE9VeCgsrwH3exNAU32gLq2xvjpWnHIs98ndPUDpnoxWQugJ6MpMncr
0xSwFmHEgnSEjK/PAjppgmyc57BwKII3sV4on+gDVFJR6Y8ZRwgnBC5mVM6JjQ5x
Dk8WRXljExRfUX9pNhdE5eBOZJrDRoLUmmjDtKzWaDhIg/+1Hzz93X4fCQkNVbVF
LELU9bMaLPBG/x5q4iYZ2k2ex6d47YE1ZFdMm6YBYMOljGkZKwYde5ldM9mo45mm
we0icXKLkpEdIXKTZeKDO+Hdv1aqFuAcccTg9RXDQjmwhC3yEmrmcfl0+rPghO0I
v3OOImwTEe4co3c1mwARAQABwsBfBBgBAgAJBQJTjHAWAhsMAAoJELDendYovxMv
Q/gH/1ha96vm4P/L+bQpJwrZ/dneZcmEwTbe8YFsw2V/Buv6Z4Mysln3nQK5ZadD
534CF7TDVft7fC4tU4PONxF5D+/tvgkPfDAfF77zy2AH1vJzQ1fOU8lYFpZXTXIH
b+559UqvIB8AdgR3SAJGHHt4RKA0F7f5ipYBBrC6cyXJyyoprT10EMvU8VGiwXvT
yJz3fjoYsdFzpWPlJEBRMedCot60g5dmbdrZ5DWClAr0yau47zpWj3enf1tLWaqc
suylWsviuGjKGw7KHQd3bxALOknAp4dN3QwBYCKuZ7AddY9yjynVaD5X7nF9nO5B
jR/i1DG86lem3iBDXzXsZDn8R38=3D
=3D2wuH
-----END PGP PUBLIC KEY BLOCK-----

--------------IVnimBOUk60PHtLClNttlB6l--

--------------EuYWG09dcRRmAm985LvvRqMV--

--------------4PFqV1eEr0FcLU29tejucyFp
Content-Type: application/pgp-signature; name="OpenPGP_signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="OpenPGP_signature"

-----BEGIN PGP SIGNATURE-----

wsB5BAABCAAjFiEEhRJncuj2BJSl0Jf3sN6d1ii/Ey8FAmKxhsYFAwAAAAAACgkQsN6d1ii/Ey9N
0AgAnwy/5BcDtCtdKZvvrx1UN4UAEDqFkal51Fo47pBHjjPs5sRQgx+7eunLWbsKhwWDz1cz7d+9
o5H5/KxQJ8Nja2xovI5Q7v2JZg0oz/1tnJcxVHs42ZitNhv8vyqwTL7SoC0A+h0dhEBieIVq8LXm
1chIEh0OIjPWDWXUInyWcHXTgkHFIh7UCJ6/fOskeDk49/8I5OlBhGVPo5Mto8fdrITpHzAIsaaV
515tnuuPYRbXn0IUQ6DNkYDzaBW27jRNi1trFj9sTeMhSg31eTJ64Y2YxH5W8IJy1vhdgHH9HXzC
brkb2HO8u3xTbmuYX2M8GAClhPG8P6XPwZmn5dY03w==
=KXTE
-----END PGP SIGNATURE-----

--------------4PFqV1eEr0FcLU29tejucyFp--


