From xen-changelog-bounces@lists.xenproject.org Mon Sep 02 10:11:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Sep 2024 10:11:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.787745.1197207 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sl41Z-0002sm-76; Mon, 02 Sep 2024 10:11:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 787745.1197207; Mon, 02 Sep 2024 10:11:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sl41Z-0002se-42; Mon, 02 Sep 2024 10:11:05 +0000
Received: by outflank-mailman (input) for mailman id 787745;
 Mon, 02 Sep 2024 10:11:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sl41Y-0002sY-Az
 for xen-changelog@lists.xenproject.org; Mon, 02 Sep 2024 10:11:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sl41Y-0007yP-4q
 for xen-changelog@lists.xenproject.org; Mon, 02 Sep 2024 10:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sl41Y-0005hW-3G
 for xen-changelog@lists.xenproject.org; Mon, 02 Sep 2024 10:11:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=E8A8mIzUwslDxfKJDUPWDaV6IhJeYRsO+gNX485dZe4=; b=ZOpbxsyy1K/qiWBxXS+c/FO2mA
	XUsOUrY9EcQ6YeYWjVT8xVTmndn6BSg0sfZvFM2VEkQpArXceHtlNZCwhx6zmBOQqdNE82Fyne7cY
	OqT0Cne02IxRxaQEtR60FzXsWDAgdBJW/gAycWt+T2PG+jcRJJFRGCdPUQlAkekHl5GM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/mm: add defensive return
Message-Id: <E1sl41Y-0005hW-3G@xenbits.xenproject.org>
Date: Mon, 02 Sep 2024 10:11:04 +0000

commit a8a74261681b5010a6f29e18b30739528c8f310c
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Mon Sep 2 11:55:16 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 2 11:55:16 2024 +0200

    x86/mm: add defensive return
    
    Add defensive return statement at the end of an unreachable
    default case. Other than improve safety, this meets the requirements
    to deviate a violation of MISRA C Rule 16.3: "An unconditional `break'
    statement shall terminate every switch-clause".
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index e9c86208b0..4148c65657 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -918,6 +918,7 @@ get_page_from_l1e(
                 return 0;
             default:
                 ASSERT_UNREACHABLE();
+                return -EILSEQ;
             }
         }
         else if ( l1f & _PAGE_RW )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 02 10:11:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Sep 2024 10:11:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.787746.1197211 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sl41j-0002ub-8W; Mon, 02 Sep 2024 10:11:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 787746.1197211; Mon, 02 Sep 2024 10:11:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sl41j-0002uS-5Q; Mon, 02 Sep 2024 10:11:15 +0000
Received: by outflank-mailman (input) for mailman id 787746;
 Mon, 02 Sep 2024 10:11:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sl41i-0002uL-9l
 for xen-changelog@lists.xenproject.org; Mon, 02 Sep 2024 10:11:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sl41i-0007yT-8v
 for xen-changelog@lists.xenproject.org; Mon, 02 Sep 2024 10:11:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sl41i-0005iH-71
 for xen-changelog@lists.xenproject.org; Mon, 02 Sep 2024 10:11:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=h9Q6EV8yoDeREVo/pdO16oSNzGRiQi+EdQenFmtaR8g=; b=CZvssLyxWY2/6FyeiQz2l99iTN
	B8eLGbD0uursoUW1wOYWWZvVKTeV5bPs3Yk8FLDPNi5XOjVyv6t5W3YTd2k9oI3ZLCongmmC4V6X+
	nK4Cq86QMli1dOOPhbmvPs7ayXHlkieF0RL6MZd+QU2lQEDwke1GQCbO9T74Dent+bHc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: drop s<N>/u<N> overrides from mkelf32
Message-Id: <E1sl41i-0005iH-71@xenbits.xenproject.org>
Date: Mon, 02 Sep 2024 10:11:14 +0000

commit 913952cca4e34a5f01228e3ab9f44d326662170b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Sep 2 11:56:24 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 2 11:56:24 2024 +0200

    x86: drop s<N>/u<N> overrides from mkelf32
    
    Use uint<N>_t instead (s<N> were unused altogether). While adjusting
    swap<N>() drop excessive casts and rename the arguments to avoid leading
    underscores.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/boot/mkelf32.c | 30 +++++++++++-------------------
 1 file changed, 11 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/boot/mkelf32.c b/xen/arch/x86/boot/mkelf32.c
index 3d639c2e08..5f9e7e440e 100644
--- a/xen/arch/x86/boot/mkelf32.c
+++ b/xen/arch/x86/boot/mkelf32.c
@@ -17,14 +17,6 @@
 #include <unistd.h>
 #include <inttypes.h>
 
-#define u8  uint8_t
-#define u16 uint16_t
-#define u32 uint32_t
-#define u64 uint64_t
-#define s8  int8_t
-#define s16 int16_t
-#define s32 int32_t
-#define s64 int64_t
 #include "../../../include/xen/elfstructs.h"
 
 #define DYNAMICALLY_FILLED   0
@@ -72,9 +64,9 @@ static Elf32_Phdr note_phdr = {
     4                                        /* p_align */
 };
 
-static u8 out_shstrtab[] = "\0.text\0.shstrtab";
+static uint8_t out_shstrtab[] = "\0.text\0.shstrtab";
 /* If num_phdrs >= 2, we need to tack the .note. */
-static u8 out_shstrtab_extra[] = ".note\0";
+static uint8_t out_shstrtab_extra[] = ".note\0";
 
 static Elf32_Shdr out_shdr[] = {
     { 0 },
@@ -124,9 +116,9 @@ static Elf32_Shdr out_shdr_note = {
 #undef swap32
 #undef swap64
 
-#define swap16(_v) ((((u16)(_v)>>8)&0xff)|(((u16)(_v)&0xff)<<8))
-#define swap32(_v) (((u32)swap16((u16)(_v))<<16)|(u32)swap16((u32)((_v)>>16)))
-#define swap64(_v) (((u64)swap32((u32)(_v))<<32)|(u64)swap32((u32)((_v)>>32)))
+#define swap16(v) (( (uint8_t)(v)       <<  8) | (uint8_t)((v) >>  8))
+#define swap32(v) (((uint32_t)swap16(v) << 16) |    swap16((v) >> 16))
+#define swap64(v) (((uint64_t)swap32(v) << 32) |    swap32((v) >> 32))
 
 static int big_endian;
 
@@ -256,8 +248,8 @@ static void do_read(int fd, void *data, int len)
 
 int main(int argc, char **argv)
 {
-    u64        final_exec_addr;
-    u32        loadbase, dat_siz, mem_siz, note_base, note_sz, offset;
+    uint64_t   final_exec_addr;
+    uint32_t   loadbase, dat_siz, mem_siz, note_base, note_sz, offset;
     char      *inimage, *outimage;
     int        infd, outfd;
     char       buffer[1024] = {};
@@ -302,7 +294,7 @@ int main(int argc, char **argv)
         return 1;
     }
 
-    big_endian = (*(u16 *)in32_ehdr.e_ident == ((ELFMAG0 << 8) | ELFMAG1));
+    big_endian = (*(uint16_t *)in32_ehdr.e_ident == ((ELFMAG0 << 8) | ELFMAG1));
 
     endianadjust_ehdr32(&in32_ehdr);
     if ( in32_ehdr.e_ident[EI_CLASS] != ELFCLASS64 )
@@ -345,11 +337,11 @@ int main(int argc, char **argv)
     endianadjust_phdr64(&in64_phdr);
 
     (void)lseek(infd, in64_phdr.p_offset, SEEK_SET);
-    dat_siz = (u32)in64_phdr.p_filesz;
+    dat_siz = (uint32_t)in64_phdr.p_filesz;
 
     /* Do not use p_memsz: it does not include BSS alignment padding. */
-    /*mem_siz = (u32)in64_phdr.p_memsz;*/
-    mem_siz = (u32)(final_exec_addr - in64_phdr.p_vaddr);
+    /*mem_siz = (uint32_t)in64_phdr.p_memsz;*/
+    mem_siz = (uint32_t)(final_exec_addr - in64_phdr.p_vaddr);
 
     note_sz = note_base = offset = 0;
     if ( num_phdrs > 1 )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 02 10:11:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Sep 2024 10:11:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.787750.1197215 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sl41t-0002xg-9h; Mon, 02 Sep 2024 10:11:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 787750.1197215; Mon, 02 Sep 2024 10:11:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sl41t-0002xZ-6n; Mon, 02 Sep 2024 10:11:25 +0000
Received: by outflank-mailman (input) for mailman id 787750;
 Mon, 02 Sep 2024 10:11:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sl41s-0002xH-Ev
 for xen-changelog@lists.xenproject.org; Mon, 02 Sep 2024 10:11:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sl41s-0007ye-E5
 for xen-changelog@lists.xenproject.org; Mon, 02 Sep 2024 10:11:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sl41s-0005je-Bu
 for xen-changelog@lists.xenproject.org; Mon, 02 Sep 2024 10:11:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=J7myUll1+7ZuBiulIubJgan0HfEIQ6khfnwBccB4n4o=; b=Pgr9RpWDMIdX0L5/NwyI/W26qo
	MFVkJGcl22kKkYMj/rKt2+xO/3h8uK2Lleoh4f8mKpIKoCQrZOoNuG5DLk8onfhXD8kLiXQ9Z8jiX
	D0K2gTEEMrMMmjCF9jrmMMpUNbJD0U/ea1umE2Etm5W0bJaZROL/XEer6YUOOpsO9PNQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] types: replace remaining uses of s8
Message-Id: <E1sl41s-0005je-Bu@xenbits.xenproject.org>
Date: Mon, 02 Sep 2024 10:11:24 +0000

commit bfcb0abb191f75775081b74755c71c52ac06f994
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Sep 2 11:57:22 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 2 11:57:22 2024 +0200

    types: replace remaining uses of s8
    
    ... and move the type itself to linux-compat.h.
    
    While doing so,
    - convert __read_mostly to __ro_after_init for respective variables
      having their type changed (for acpi_numa add the attribute anew),
    - in cpuid_hypervisor_leaves() drop a cast altogether,
    - switch an adjacent struct arch_irq_desc field to bool.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/apic.c                     | 2 +-
 xen/arch/x86/cpu/amd.c                  | 2 +-
 xen/arch/x86/e820.c                     | 2 +-
 xen/arch/x86/hvm/quirks.c               | 2 +-
 xen/arch/x86/hvm/vmx/vmcs.c             | 2 +-
 xen/arch/x86/include/asm/acpi.h         | 2 +-
 xen/arch/x86/include/asm/amd.h          | 2 +-
 xen/arch/x86/include/asm/hvm/hvm.h      | 2 +-
 xen/arch/x86/include/asm/irq.h          | 4 ++--
 xen/arch/x86/mm.c                       | 2 +-
 xen/arch/x86/msi.c                      | 2 +-
 xen/arch/x86/numa.c                     | 2 +-
 xen/arch/x86/oprofile/op_model_athlon.c | 2 +-
 xen/arch/x86/setup.c                    | 4 ++--
 xen/arch/x86/traps.c                    | 2 +-
 xen/include/acpi/cpufreq/cpufreq.h      | 2 +-
 xen/include/xen/linux-compat.h          | 2 +-
 xen/include/xen/types.h                 | 1 -
 18 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 7869c30e83..e077bf7edc 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -71,7 +71,7 @@ static struct {
 /*
  * Knob to control our willingness to enable the local APIC.
  */
-static s8 __initdata enable_local_apic; /* -1=force-disable, +1=force-enable */
+static int8_t __initdata enable_local_apic; /* -1=force-disable, +1=force-enable */
 
 /*
  * Debug level
diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index ab92333673..903be14af4 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -46,7 +46,7 @@ static unsigned int __initdata opt_cpuid_mask_thermal_ecx = ~0u;
 integer_param("cpuid_mask_thermal_ecx", opt_cpuid_mask_thermal_ecx);
 
 /* 1 = allow, 0 = don't allow guest creation, -1 = don't allow boot */
-s8 __read_mostly opt_allow_unsafe;
+int8_t __ro_after_init opt_allow_unsafe;
 boolean_param("allow_unsafe", opt_allow_unsafe);
 
 /* Signal whether the ACPI C1E quirk is required. */
diff --git a/xen/arch/x86/e820.c b/xen/arch/x86/e820.c
index 3726823e88..e052e84de7 100644
--- a/xen/arch/x86/e820.c
+++ b/xen/arch/x86/e820.c
@@ -27,7 +27,7 @@ static unsigned long long __initdata opt_availmem;
 size_param("availmem", opt_availmem);
 
 /* opt_nomtrr_check: Don't clip ram to highest cacheable MTRR. */
-static s8 __initdata e820_mtrr_clip = -1;
+static int8_t __initdata e820_mtrr_clip = -1;
 boolean_param("e820-mtrr-clip", e820_mtrr_clip);
 
 /* opt_e820_verbose: Be verbose about clipping, the original e820, &c */
diff --git a/xen/arch/x86/hvm/quirks.c b/xen/arch/x86/hvm/quirks.c
index 09face0c51..9202f5a47f 100644
--- a/xen/arch/x86/hvm/quirks.c
+++ b/xen/arch/x86/hvm/quirks.c
@@ -11,7 +11,7 @@
 #include <xen/param.h>
 #include <asm/hvm/support.h>
 
-s8 __read_mostly hvm_port80_allowed = -1;
+int8_t __ro_after_init hvm_port80_allowed = -1;
 boolean_param("hvm_port80", hvm_port80_allowed);
 
 static int __init cf_check dmi_hvm_deny_port80(const struct dmi_system_id *id)
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 5787110a56..147e998371 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -59,7 +59,7 @@ static unsigned int __ro_after_init vm_notify_window;
 integer_param("vm-notify-window", vm_notify_window);
 
 static bool __read_mostly opt_ept_pml = true;
-static s8 __read_mostly opt_ept_ad = -1;
+static int8_t __ro_after_init opt_ept_ad = -1;
 int8_t __read_mostly opt_ept_exec_sp = -1;
 
 static int __init cf_check parse_ept_param(const char *s)
diff --git a/xen/arch/x86/include/asm/acpi.h b/xen/arch/x86/include/asm/acpi.h
index 48b1d69946..3c47b216d0 100644
--- a/xen/arch/x86/include/asm/acpi.h
+++ b/xen/arch/x86/include/asm/acpi.h
@@ -100,7 +100,7 @@ extern unsigned long acpi_wakeup_address;
 
 #define ARCH_HAS_POWER_INIT	1
 
-extern s8 acpi_numa;
+extern int8_t acpi_numa;
 
 extern struct acpi_sleep_info acpi_sinfo;
 #define acpi_video_flags bootsym(video_flags)
diff --git a/xen/arch/x86/include/asm/amd.h b/xen/arch/x86/include/asm/amd.h
index fa4e0fc766..9c9599a622 100644
--- a/xen/arch/x86/include/asm/amd.h
+++ b/xen/arch/x86/include/asm/amd.h
@@ -160,7 +160,7 @@
 struct cpuinfo_x86;
 int cpu_has_amd_erratum(const struct cpuinfo_x86 *cpu, int osvw_id, ...);
 
-extern s8 opt_allow_unsafe;
+extern int8_t opt_allow_unsafe;
 
 void fam10h_check_enable_mmcfg(void);
 void check_enable_amd_mmconf_dmi(void);
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index d5aaa5b710..dd7d4872b5 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -241,7 +241,7 @@ struct hvm_function_table {
 
 extern struct hvm_function_table hvm_funcs;
 extern bool hvm_enabled;
-extern s8 hvm_port80_allowed;
+extern int8_t hvm_port80_allowed;
 
 extern const struct hvm_function_table *start_svm(void);
 extern const struct hvm_function_table *start_vmx(void);
diff --git a/xen/arch/x86/include/asm/irq.h b/xen/arch/x86/include/asm/irq.h
index 5f445299be..5a8352a21e 100644
--- a/xen/arch/x86/include/asm/irq.h
+++ b/xen/arch/x86/include/asm/irq.h
@@ -80,8 +80,8 @@ struct arch_irq_desc {
         cpumask_var_t pending_mask;
         vmask_t *used_vectors;
         unsigned move_cleanup_count;
-        u8 move_in_progress : 1;
-        s8 used;
+        bool move_in_progress : 1;
+        int8_t used;
         /*
          * Weak reference to domain having permission over this IRQ (which can
          * be different from the domain actually having the IRQ assigned)
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 4148c65657..608583a113 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -170,7 +170,7 @@ static uint32_t __ro_after_init base_disallow_mask;
       is_pv_domain(d)) ?                                        \
      L1_DISALLOW_MASK : (L1_DISALLOW_MASK & ~PAGE_CACHE_ATTRS))
 
-static s8 __read_mostly opt_mmio_relax;
+static int8_t __ro_after_init opt_mmio_relax;
 
 static int __init cf_check parse_mmio_relax(const char *s)
 {
diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index 0c97fbb3fc..ff2e3d8687 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -35,7 +35,7 @@
 #include <xsm/xsm.h>
 #include <xen/vpci.h>
 
-static s8 __read_mostly use_msi = -1;
+static int8_t __ro_after_init use_msi = -1;
 boolean_param("msi", use_msi);
 
 static void __pci_disable_msix(struct msi_desc *entry);
diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c
index 4b0b297c7e..3f2fe54874 100644
--- a/xen/arch/x86/numa.c
+++ b/xen/arch/x86/numa.c
@@ -25,7 +25,7 @@ nodeid_t apicid_to_node[MAX_LOCAL_APIC] = {
     [0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE
 };
 
-s8 acpi_numa = 0;
+int8_t __ro_after_init acpi_numa = 0;
 
 int __init arch_numa_setup(const char *opt)
 {
diff --git a/xen/arch/x86/oprofile/op_model_athlon.c b/xen/arch/x86/oprofile/op_model_athlon.c
index 782fa606ee..bf897a4b63 100644
--- a/xen/arch/x86/oprofile/op_model_athlon.c
+++ b/xen/arch/x86/oprofile/op_model_athlon.c
@@ -157,7 +157,7 @@ static inline u64 op_amd_randomize_ibs_op(u64 val)
          * IbsOpMaxCnt must fit in the range from 0x0081 to
          * 0xff80.
          */
-        val += (s8)(random >> 4);
+        val += (int8_t)(random >> 4);
     else
         val |= (u64)(random & IBS_RANDOM_MASK) << 32;
 
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index c2e0082a30..cd69198326 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -164,7 +164,7 @@ unsigned long __read_mostly mmu_cr4_features = XEN_MINIMAL_CR4;
 
 /* smep: Enable/disable Supervisor Mode Execution Protection */
 #define SMEP_HVM_ONLY (-2)
-static s8 __initdata opt_smep = -1;
+static int8_t __initdata opt_smep = -1;
 
 /*
  * Initial domain place holder. Needs to be global so it can be created in
@@ -201,7 +201,7 @@ custom_param("smep", parse_smep_param);
 
 /* smap: Enable/disable Supervisor Mode Access Prevention */
 #define SMAP_HVM_ONLY (-2)
-static s8 __initdata opt_smap = -1;
+static int8_t __initdata opt_smap = -1;
 
 static int __init cf_check parse_smap_param(const char *s)
 {
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index b796c2f7df..708136f625 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1116,7 +1116,7 @@ void cpuid_hypervisor_leaves(const struct vcpu *v, uint32_t leaf,
             res->a = offset;
             res->b = offset >> 32;
             res->c = d->arch.vtsc_to_ns.mul_frac;
-            res->d = (s8)d->arch.vtsc_to_ns.shift;
+            res->d = d->arch.vtsc_to_ns.shift;
             break;
         }
 
diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/cpufreq.h
index b6cff825ce..3f1b05a02e 100644
--- a/xen/include/acpi/cpufreq/cpufreq.h
+++ b/xen/include/acpi/cpufreq/cpufreq.h
@@ -79,7 +79,7 @@ struct cpufreq_policy {
 
     bool                resume; /* flag for cpufreq 1st run
                                  * S3 wakeup, hotplug cpu, etc */
-    s8                  turbo;  /* tristate flag: 0 for unsupported
+    int8_t              turbo;  /* tristate flag: 0 for unsupported
                                  * -1 for disable, 1 for enabled
                                  * See CPUFREQ_TURBO_* below for defines */
 };
diff --git a/xen/include/xen/linux-compat.h b/xen/include/xen/linux-compat.h
index b289dfd894..1491894feb 100644
--- a/xen/include/xen/linux-compat.h
+++ b/xen/include/xen/linux-compat.h
@@ -11,7 +11,7 @@
 
 #include <xen/types.h>
 
-typedef int8_t  __s8;
+typedef int8_t  s8, __s8;
 typedef uint8_t __u8;
 typedef int16_t __s16;
 typedef int32_t __s32;
diff --git a/xen/include/xen/types.h b/xen/include/xen/types.h
index 449947b353..542dbaf63c 100644
--- a/xen/include/xen/types.h
+++ b/xen/include/xen/types.h
@@ -5,7 +5,6 @@
 #include <xen/stdint.h>
 
 /* Linux inherited types which are being phased out */
-typedef int8_t s8;
 typedef uint8_t u8;
 typedef int16_t s16;
 typedef uint16_t u16, __u16;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 02 10:11:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Sep 2024 10:11:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.787755.1197219 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sl423-00030M-B3; Mon, 02 Sep 2024 10:11:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 787755.1197219; Mon, 02 Sep 2024 10:11:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sl423-00030E-8K; Mon, 02 Sep 2024 10:11:35 +0000
Received: by outflank-mailman (input) for mailman id 787755;
 Mon, 02 Sep 2024 10:11:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sl422-000304-Ib
 for xen-changelog@lists.xenproject.org; Mon, 02 Sep 2024 10:11:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sl422-0007yn-H5
 for xen-changelog@lists.xenproject.org; Mon, 02 Sep 2024 10:11:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sl422-0005kS-G9
 for xen-changelog@lists.xenproject.org; Mon, 02 Sep 2024 10:11:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TusLCPH/zAp3VZuPszbuh9KsIdnryedpX4+QJSYc3yI=; b=yWAlT7vodWTcBgIzjdLELSNasV
	QIyfOb6UPHN0Z0b5gvRSb2dvNSH1wSk2K2EkOmjKSM6VHm/eWL96lblqmNR0tJ4nSWo4aoul/Qu56
	msm4XAIdeaT9GCE9fDIgPctiq9icDHq+JU+0bOIWMtg2s4xfXVD5Gcn6MFC6BnFGzVGw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: drop map-low-16Mb leftovers
Message-Id: <E1sl422-0005kS-G9@xenbits.xenproject.org>
Date: Mon, 02 Sep 2024 10:11:34 +0000

commit 442625ef10fb919b0b55658ecac87cf323fa5af8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Sep 2 11:58:21 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 2 11:58:21 2024 +0200

    x86: drop map-low-16Mb leftovers
    
    Prior work (e.g. cbabbc9f5659 ["x86/boot: Size the boot/directmap
    mappings dynamically"]) has fully eliminated that hardcoded boundary.
    Drop both the linker script assertion (the upper bound is now the stubs
    area) and the artificial extending of xen.efi's image size.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/xen.lds.S | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 9a1dfe1b34..d48de67cfd 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -359,14 +359,6 @@ SECTIONS
 
   DWARF2_DEBUG_SECTIONS
 
-#ifdef EFI
-  /* Trick the linker into setting the image size to no less than 16Mb. */
-  __image_end__ = .;
-  .pad ALIGN(__section_alignment__) : {
-    . = __image_end__ < __image_base__ + MB(16) ? ALIGN(MB(16)) : .;
-  }
-#endif
-
 #ifdef CONFIG_HYPERV_GUEST
   hv_hcall_page = ABSOLUTE(HV_HCALL_PAGE - XEN_VIRT_START + __XEN_VIRT_START);
 #endif
@@ -429,6 +421,3 @@ ASSERT((trampoline_end - trampoline_start) < TRAMPOLINE_SPACE - MBI_SPACE_MIN,
     "not enough room for trampoline and mbi data")
 ASSERT((wakeup_stack - wakeup_stack_start) >= WAKEUP_STACK_MIN,
     "wakeup stack too small")
-
-/* Plenty of boot code assumes that Xen isn't larger than 16M. */
-ASSERT(_end - _start <= MB(16), "Xen too large for early-boot assumptions")
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 02 10:55:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Sep 2024 10:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.787791.1197253 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sl4i9-0004Qr-TI; Mon, 02 Sep 2024 10:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 787791.1197253; Mon, 02 Sep 2024 10:55:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sl4i9-0004Qk-Qa; Mon, 02 Sep 2024 10:55:05 +0000
Received: by outflank-mailman (input) for mailman id 787791;
 Mon, 02 Sep 2024 10:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sl4i8-0004Qe-7u
 for xen-changelog@lists.xenproject.org; Mon, 02 Sep 2024 10:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sl4i7-0000Ft-Ny
 for xen-changelog@lists.xenproject.org; Mon, 02 Sep 2024 10:55:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sl4i7-0001bI-MW
 for xen-changelog@lists.xenproject.org; Mon, 02 Sep 2024 10:55:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nLJaNOd6pM1D/Vor1s+0DBNSML+41PwAHT4tskqIiww=; b=Ix8K8PCaECMt8Ryte0hd8VGlBO
	QSyoPtiHfLljQcDyQ89dzzpFbV7XEhUMrltsCogd7H24blunEBPkEH7BD8WUM8rVjEqXymE7ilFUy
	WR7MmJNPW73opBOaKUWufdoIyQc3aeckQ/Ri++az7G225YR74mXBNF7MFtU+WOW1QKtQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Use C99 types for integers
Message-Id: <E1sl4i7-0001bI-MW@xenbits.xenproject.org>
Date: Mon, 02 Sep 2024 10:55:03 +0000

commit e884903ec56be8b0cc658cc5ba7c1cb70f25208d
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Thu Aug 29 12:52:44 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 2 11:42:32 2024 +0100

    x86/boot: Use C99 types for integers
    
    Just style update, no functional change.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/boot/cmdline.c | 30 +++++++++++++++---------------
 xen/arch/x86/boot/defs.h    |  2 +-
 xen/arch/x86/boot/reloc.c   | 38 +++++++++++++++++++-------------------
 3 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/xen/arch/x86/boot/cmdline.c b/xen/arch/x86/boot/cmdline.c
index f9eee756aa..b8ad7f3a14 100644
--- a/xen/arch/x86/boot/cmdline.c
+++ b/xen/arch/x86/boot/cmdline.c
@@ -36,15 +36,15 @@ asm (
 
 /* Keep in sync with trampoline.S:early_boot_opts label! */
 typedef struct __packed {
-    u8 skip_realmode;
-    u8 opt_edd;
-    u8 opt_edid;
-    u8 padding;
+    uint8_t skip_realmode;
+    uint8_t opt_edd;
+    uint8_t opt_edid;
+    uint8_t padding;
 #ifdef CONFIG_VIDEO
-    u16 boot_vid_mode;
-    u16 vesa_width;
-    u16 vesa_height;
-    u16 vesa_depth;
+    uint16_t boot_vid_mode;
+    uint16_t vesa_width;
+    uint16_t vesa_height;
+    uint16_t vesa_depth;
 #endif
 } early_boot_opts_t;
 
@@ -214,7 +214,7 @@ static bool skip_realmode(const char *cmdline)
     return find_opt(cmdline, "no-real-mode", false) || find_opt(cmdline, "tboot=", true);
 }
 
-static u8 edd_parse(const char *cmdline)
+static uint8_t edd_parse(const char *cmdline)
 {
     const char *c;
 
@@ -229,7 +229,7 @@ static u8 edd_parse(const char *cmdline)
     return !strmaxcmp(c, "skipmbr", delim_chars);
 }
 
-static u8 edid_parse(const char *cmdline)
+static uint8_t edid_parse(const char *cmdline)
 {
     const char *c;
 
@@ -245,7 +245,7 @@ static u8 edid_parse(const char *cmdline)
 }
 
 #ifdef CONFIG_VIDEO
-static u16 rows2vmode(unsigned int rows)
+static uint16_t rows2vmode(unsigned int rows)
 {
     switch ( rows )
     {
@@ -300,7 +300,7 @@ static void vga_parse(const char *cmdline, early_boot_opts_t *ebo)
         {
             vesa_width = strtoui(c + strlen("gfx-"), "x", &c);
 
-            if ( vesa_width > U16_MAX )
+            if ( vesa_width > UINT16_MAX )
                 return;
 
             /*
@@ -311,12 +311,12 @@ static void vga_parse(const char *cmdline, early_boot_opts_t *ebo)
             ++c;
             vesa_height = strtoui(c, "x", &c);
 
-            if ( vesa_height > U16_MAX )
+            if ( vesa_height > UINT16_MAX )
                 return;
 
             vesa_depth = strtoui(++c, delim_chars_comma, NULL);
 
-            if ( vesa_depth > U16_MAX )
+            if ( vesa_depth > UINT16_MAX )
                 return;
 
             ebo->vesa_width = vesa_width;
@@ -328,7 +328,7 @@ static void vga_parse(const char *cmdline, early_boot_opts_t *ebo)
         {
             tmp = strtoui(c + strlen("mode-"), delim_chars_comma, NULL);
 
-            if ( tmp > U16_MAX )
+            if ( tmp > UINT16_MAX )
                 return;
 
             ebo->boot_vid_mode = tmp;
diff --git a/xen/arch/x86/boot/defs.h b/xen/arch/x86/boot/defs.h
index 239b9f8716..ee1a4da6af 100644
--- a/xen/arch/x86/boot/defs.h
+++ b/xen/arch/x86/boot/defs.h
@@ -57,7 +57,7 @@ typedef u16 uint16_t;
 typedef u32 uint32_t;
 typedef u64 uint64_t;
 
-#define U16_MAX		((u16)(~0U))
+#define UINT16_MAX	((uint16_t)(~0U))
 #define UINT_MAX	(~0U)
 
 #endif /* __BOOT_DEFS_H__ */
diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c
index 4033557481..589e026ff9 100644
--- a/xen/arch/x86/boot/reloc.c
+++ b/xen/arch/x86/boot/reloc.c
@@ -68,24 +68,24 @@ struct vesa_mode_info {
 #endif /* CONFIG_VIDEO */
 
 #define get_mb2_data(tag, type, member)   (((const multiboot2_tag_##type##_t *)(tag))->member)
-#define get_mb2_string(tag, type, member) ((u32)get_mb2_data(tag, type, member))
+#define get_mb2_string(tag, type, member) ((uint32_t)get_mb2_data(tag, type, member))
 
-static u32 alloc;
+static uint32_t alloc;
 
-static u32 alloc_mem(u32 bytes)
+static uint32_t alloc_mem(uint32_t bytes)
 {
     return alloc -= ALIGN_UP(bytes, 16);
 }
 
-static void zero_mem(u32 s, u32 bytes)
+static void zero_mem(uint32_t s, uint32_t bytes)
 {
     while ( bytes-- )
         *(char *)s++ = 0;
 }
 
-static u32 copy_mem(u32 src, u32 bytes)
+static uint32_t copy_mem(uint32_t src, uint32_t bytes)
 {
-    u32 dst, dst_ret;
+    uint32_t dst, dst_ret;
 
     dst = alloc_mem(bytes);
     dst_ret = dst;
@@ -96,9 +96,9 @@ static u32 copy_mem(u32 src, u32 bytes)
     return dst_ret;
 }
 
-static u32 copy_string(u32 src)
+static uint32_t copy_string(uint32_t src)
 {
-    u32 p;
+    uint32_t p;
 
     if ( !src )
         return 0;
@@ -109,7 +109,7 @@ static u32 copy_string(u32 src)
     return copy_mem(src, p - src + 1);
 }
 
-static struct hvm_start_info *pvh_info_reloc(u32 in)
+static struct hvm_start_info *pvh_info_reloc(uint32_t in)
 {
     struct hvm_start_info *out;
 
@@ -139,7 +139,7 @@ static struct hvm_start_info *pvh_info_reloc(u32 in)
     return out;
 }
 
-static multiboot_info_t *mbi_reloc(u32 mbi_in)
+static multiboot_info_t *mbi_reloc(uint32_t mbi_in)
 {
     int i;
     multiboot_info_t *mbi_out;
@@ -192,7 +192,7 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
 #ifdef CONFIG_VIDEO
     struct boot_video_info *video = NULL;
 #endif
-    u32 ptr;
+    uint32_t ptr;
     unsigned int i, mod_idx = 0;
 
     ptr = alloc_mem(sizeof(*mbi_out));
@@ -203,8 +203,8 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
     ptr = ALIGN_UP(mbi_in + sizeof(*mbi_fix), MULTIBOOT2_TAG_ALIGN);
 
     /* Get the number of modules. */
-    for ( tag = _p(ptr); (u32)tag - mbi_in < mbi_fix->total_size;
-          tag = _p(ALIGN_UP((u32)tag + tag->size, MULTIBOOT2_TAG_ALIGN)) )
+    for ( tag = _p(ptr); (uint32_t)tag - mbi_in < mbi_fix->total_size;
+          tag = _p(ALIGN_UP((uint32_t)tag + tag->size, MULTIBOOT2_TAG_ALIGN)) )
     {
         if ( tag->type == MULTIBOOT2_TAG_TYPE_MODULE )
             ++mbi_out->mods_count;
@@ -228,8 +228,8 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
     ptr = ALIGN_UP(mbi_in + sizeof(*mbi_fix), MULTIBOOT2_TAG_ALIGN);
 
     /* Put all needed data into mbi_out. */
-    for ( tag = _p(ptr); (u32)tag - mbi_in < mbi_fix->total_size;
-          tag = _p(ALIGN_UP((u32)tag + tag->size, MULTIBOOT2_TAG_ALIGN)) )
+    for ( tag = _p(ptr); (uint32_t)tag - mbi_in < mbi_fix->total_size;
+          tag = _p(ALIGN_UP((uint32_t)tag + tag->size, MULTIBOOT2_TAG_ALIGN)) )
     {
         switch ( tag->type )
         {
@@ -272,10 +272,10 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
                 mmap_dst[i].size = sizeof(*mmap_dst);
                 mmap_dst[i].size -= sizeof(mmap_dst[i].size);
                 /* Now copy a given region data. */
-                mmap_dst[i].base_addr_low = (u32)mmap_src->addr;
-                mmap_dst[i].base_addr_high = (u32)(mmap_src->addr >> 32);
-                mmap_dst[i].length_low = (u32)mmap_src->len;
-                mmap_dst[i].length_high = (u32)(mmap_src->len >> 32);
+                mmap_dst[i].base_addr_low = (uint32_t)mmap_src->addr;
+                mmap_dst[i].base_addr_high = (uint32_t)(mmap_src->addr >> 32);
+                mmap_dst[i].length_low = (uint32_t)mmap_src->len;
+                mmap_dst[i].length_high = (uint32_t)(mmap_src->len >> 32);
                 mmap_dst[i].type = mmap_src->type;
                 mmap_src = _p(mmap_src) + get_mb2_data(tag, mmap, entry_size);
             }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 02 15:44:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Sep 2024 15:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.788189.1197652 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sl9Do-0001RV-HU; Mon, 02 Sep 2024 15:44:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 788189.1197652; Mon, 02 Sep 2024 15: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 <xen-changelog-bounces@lists.xenproject.org>)
	id 1sl9Do-0001RO-Ez; Mon, 02 Sep 2024 15:44:04 +0000
Received: by outflank-mailman (input) for mailman id 788189;
 Mon, 02 Sep 2024 15:44:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sl9Dn-0001RG-ET
 for xen-changelog@lists.xenproject.org; Mon, 02 Sep 2024 15:44:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sl9Dn-0005P3-3p
 for xen-changelog@lists.xenproject.org; Mon, 02 Sep 2024 15:44:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sl9Dn-0003wb-2M
 for xen-changelog@lists.xenproject.org; Mon, 02 Sep 2024 15:44:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CDkaoJCiwGflw09Sr3YsXLF+udOtolhZCkYqAaMa/Uc=; b=b1o0ipOiJLSBJDKwSmKrGxgemL
	Uf25y8kkCCsaZKr+VYLyLM/tyV+5krRm+HeN0jNp31MzFVvHE2nfmeeUiLgYlSzR81BQA+IB0RSrM
	q5Z1bmUt3v9HnDQWflQni0K9kiBnwZU1V8m4BYlTxmhza4p7p9ZayNCK3ZhIWX7DahKc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/cpu: revert opt_allow_unsafe from __ro_after_init to __read_mostly
Message-Id: <E1sl9Dn-0003wb-2M@xenbits.xenproject.org>
Date: Mon, 02 Sep 2024 15:44:03 +0000

commit 1e6bb29b03680a9d0e12f14c4d406a0d67317ea7
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Sep 2 17:34:54 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 2 17:34:54 2024 +0200

    x86/cpu: revert opt_allow_unsafe from __ro_after_init to __read_mostly
    
    Making opt_allow_unsafe read only after init requires changes to the logic in
    init_amd(), otherwise the following #PF happens on CPU hotplug:
    
    ----[ Xen-4.20.0-1-d  x86_64  debug=y  Tainted:     H  ]----
    CPU:    1
    RIP:    e008:[<ffff82d040291081>] arch/x86/cpu/amd.c#init_amd+0x37f/0x993
    [...]
    Xen call trace:
       [<ffff82d040291081>] R arch/x86/cpu/amd.c#init_amd+0x37f/0x993
       [<ffff82d040291fbe>] F identify_cpu+0x2d4/0x4db
       [<ffff82d04032eeaa>] F start_secondary+0x22e/0x3cf
       [<ffff82d040203327>] F __high_start+0x87/0xa0
    
    Pagetable walk from ffff82d0404011ea:
     L4[0x105] = 000000006fc2e063 ffffffffffffffff
     L3[0x141] = 000000006fc2b063 ffffffffffffffff
     L2[0x002] = 000000807c7ca063 ffffffffffffffff
     L1[0x001] = 800000006f801121 ffffffffffffffff
    
    ****************************************
    Panic on CPU 1:
    FATAL PAGE FAULT
    [error_code=0003]
    Faulting linear address: ffff82d0404011ea
    ****************************************
    
    For the time being revert opt_allow_unsafe to be __read_mostly.
    
    Fixes: bfcb0abb191f ('types: replace remaining uses of s8')
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/amd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index 903be14af4..7da0423039 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -46,7 +46,7 @@ static unsigned int __initdata opt_cpuid_mask_thermal_ecx = ~0u;
 integer_param("cpuid_mask_thermal_ecx", opt_cpuid_mask_thermal_ecx);
 
 /* 1 = allow, 0 = don't allow guest creation, -1 = don't allow boot */
-int8_t __ro_after_init opt_allow_unsafe;
+int8_t __read_mostly opt_allow_unsafe;
 boolean_param("allow_unsafe", opt_allow_unsafe);
 
 /* Signal whether the ACPI C1E quirk is required. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 00:00:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 00:00:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.788528.1197942 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slGxm-00008M-Br; Tue, 03 Sep 2024 00:00:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 788528.1197942; Tue, 03 Sep 2024 00:00:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slGxm-00007U-76; Tue, 03 Sep 2024 00:00:02 +0000
Received: by outflank-mailman (input) for mailman id 788528;
 Tue, 03 Sep 2024 00:00:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slGxl-0008Ls-Pj
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 00:00:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slGxl-0006ky-Kz
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 00:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slGxl-0003yU-JN
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 00:00:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=j/hjYNUr6otLtMB+/kpZH9p9hCKUMDHeHr1lI0M+6/A=; b=QWbIyEbPMwxVA57VACm1CAPIMb
	R0OMEfmFKZI94tVbbGqkKtC6jsSFnxNJa7AF0G3RRQjs7gyGFCS2G+B1pZHAMMYM0aNi/0D05mraF
	/8Jq2LGzq9PgVXuFjGTISRzEtXJD4GW1eFlZUJxMXZ6r941pnKxxmhitRrXF0ogeydDg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: fix false success in qemu tests
Message-Id: <E1slGxl-0003yU-JN@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 00:00:01 +0000

commit 740c41ca05a83a2c3629eb2ff323877c37d95c1e
Author:     Victor Lira <victorm.lira@amd.com>
AuthorDate: Thu Aug 29 15:34:22 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Aug 29 17:44:42 2024 -0700

    automation: fix false success in qemu tests
    
    Fix flaw in qemu-*.sh tests that producess a false success. The following
    lines produces success despite the "expect" script producing nonzero exit
    status:
    
        set +e
    ...
        ./automation/scripts/qemu-key.exp | sed 's/\r\+$//'
        (end of file)
    
    The default exit status for a pipeline using "|" operator is that of the
    rightmost command. Fix this by setting the "pipefail" option in the shell,
    and removing "set +e" allowing the expect script to determine the result.
    
    Signed-off-by: Victor Lira <victorm.lira@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/scripts/qemu-alpine-x86_64.sh        | 3 +--
 automation/scripts/qemu-key.exp                 | 2 +-
 automation/scripts/qemu-smoke-dom0-arm32.sh     | 3 +--
 automation/scripts/qemu-smoke-dom0-arm64.sh     | 3 +--
 automation/scripts/qemu-smoke-dom0less-arm32.sh | 3 +--
 automation/scripts/qemu-smoke-dom0less-arm64.sh | 3 +--
 automation/scripts/qemu-smoke-ppc64le.sh        | 3 +--
 automation/scripts/qemu-smoke-riscv64.sh        | 3 +--
 automation/scripts/qemu-smoke-x86-64.sh         | 3 +--
 automation/scripts/qemu-xtf-dom0less-arm64.sh   | 3 +--
 10 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/scripts/qemu-alpine-x86_64.sh
index 42a89e86b0..93914c41bc 100755
--- a/automation/scripts/qemu-alpine-x86_64.sh
+++ b/automation/scripts/qemu-alpine-x86_64.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 # DomU Busybox
 cd binaries
@@ -76,7 +76,6 @@ EOF
 
 # Run the test
 rm -f smoke.serial
-set +e
 export QEMU_CMD="qemu-system-x86_64 \
     -cpu qemu64,+svm \
     -m 2G -smp 2 \
diff --git a/automation/scripts/qemu-key.exp b/automation/scripts/qemu-key.exp
index 787f1f08cb..66c4164831 100755
--- a/automation/scripts/qemu-key.exp
+++ b/automation/scripts/qemu-key.exp
@@ -14,7 +14,7 @@ eval spawn $env(QEMU_CMD)
 
 expect_after {
     -re "(.*)\r" {
-        exp_continue
+        exp_continue -continue_timer
     }
     timeout {send_error "ERROR-Timeout!\n"; exit 1}
     eof {send_error "ERROR-EOF!\n"; exit 1}
diff --git a/automation/scripts/qemu-smoke-dom0-arm32.sh b/automation/scripts/qemu-smoke-dom0-arm32.sh
index fd64b19358..7c282eff3a 100755
--- a/automation/scripts/qemu-smoke-dom0-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm32.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 serial_log="$(pwd)/smoke.serial"
 
@@ -77,7 +77,6 @@ git clone --depth 1 https://gitlab.com/xen-project/imagebuilder.git
 bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
 
 rm -f ${serial_log}
-set +e
 export QEMU_CMD="./qemu-system-arm \
    -machine virt \
    -machine virtualization=true \
diff --git a/automation/scripts/qemu-smoke-dom0-arm64.sh b/automation/scripts/qemu-smoke-dom0-arm64.sh
index e0cea742b0..81f210f7f5 100755
--- a/automation/scripts/qemu-smoke-dom0-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm64.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 # DomU Busybox
 cd binaries
@@ -93,7 +93,6 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 
 # Run the test
 rm -f smoke.serial
-set +e
 export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \
diff --git a/automation/scripts/qemu-smoke-dom0less-arm32.sh b/automation/scripts/qemu-smoke-dom0less-arm32.sh
index e824cb7c2a..38e8a0b0bd 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm32.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 test_variant=$1
 
@@ -130,7 +130,6 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
 
 # Run the test
 rm -f ${serial_log}
-set +e
 export QEMU_CMD="./qemu-system-arm \
     -machine virt \
     -machine virtualization=true \
diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index f42ba5d196..ea67650e17 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 test_variant=$1
 
@@ -204,7 +204,6 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 
 # Run the test
 rm -f smoke.serial
-set +e
 export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt,gic-version=$gic_version \
diff --git a/automation/scripts/qemu-smoke-ppc64le.sh b/automation/scripts/qemu-smoke-ppc64le.sh
index 594f92c19c..49e189c370 100755
--- a/automation/scripts/qemu-smoke-ppc64le.sh
+++ b/automation/scripts/qemu-smoke-ppc64le.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 serial_log="$(pwd)/smoke.serial"
 
@@ -9,7 +9,6 @@ machine=$1
 
 # Run the test
 rm -f ${serial_log}
-set +e
 
 export QEMU_CMD="qemu-system-ppc64 \
     -bios skiboot.lid \
diff --git a/automation/scripts/qemu-smoke-riscv64.sh b/automation/scripts/qemu-smoke-riscv64.sh
index c2595f657f..422ee03e0d 100755
--- a/automation/scripts/qemu-smoke-riscv64.sh
+++ b/automation/scripts/qemu-smoke-riscv64.sh
@@ -1,10 +1,9 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 # Run the test
 rm -f smoke.serial
-set +e
 
 export QEMU_CMD="qemu-system-riscv64 \
     -M virt \
diff --git a/automation/scripts/qemu-smoke-x86-64.sh b/automation/scripts/qemu-smoke-x86-64.sh
index 3440b1761d..7495185d9f 100755
--- a/automation/scripts/qemu-smoke-x86-64.sh
+++ b/automation/scripts/qemu-smoke-x86-64.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 # variant should be either pv or pvh
 variant=$1
@@ -15,7 +15,6 @@ case $variant in
 esac
 
 rm -f smoke.serial
-set +e
 export QEMU_CMD="qemu-system-x86_64 -nographic -kernel binaries/xen \
         -initrd xtf/tests/example/$k \
         -append \"loglvl=all console=com1 noreboot console_timestamps=boot $extra\" \
diff --git a/automation/scripts/qemu-xtf-dom0less-arm64.sh b/automation/scripts/qemu-xtf-dom0less-arm64.sh
index 4042fe5060..acef1637e2 100755
--- a/automation/scripts/qemu-xtf-dom0less-arm64.sh
+++ b/automation/scripts/qemu-xtf-dom0less-arm64.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 # Name of the XTF test
 xtf_test=$1
@@ -50,7 +50,6 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 
 # Run the test
 rm -f smoke.serial
-set +e
 export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 00:00:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 00:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.788529.1197944 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slGxx-00010p-KZ; Tue, 03 Sep 2024 00:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 788529.1197944; Tue, 03 Sep 2024 00:00:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slGxx-00010g-H4; Tue, 03 Sep 2024 00:00:13 +0000
Received: by outflank-mailman (input) for mailman id 788529;
 Tue, 03 Sep 2024 00:00:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slGxv-00010V-Rm
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 00:00:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slGxv-0007HD-QA
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 00:00:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slGxv-000423-Na
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 00:00:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=clyc1GN0JbSFaStePga9IjGjTCzuEdms2SVR4bXPcfM=; b=c1RV9/pe4pm0M7B0PCafVA3TNM
	B+SvxB9PL0XIdrwPJ3tC/hG6EvFtVv8rckVvHe2pxGXX+nqBiQHtEJQPiz+LZ6ZxtPdhR9YS/5PBE
	HXt0gvbGspTFbA0S1GXTOqfR0+oDdFo8UrSPCmPLkE+1impV9rzcBhKTU6KQsRy/sMzY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: use expect utility in xilinx tests
Message-Id: <E1slGxv-000423-Na@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 00:00:11 +0000

commit 5e99a40ea54a6bf0bdc18241992866a642d7782b
Author:     Victor Lira <victorm.lira@amd.com>
AuthorDate: Thu Aug 29 15:34:23 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Aug 29 18:43:47 2024 -0700

    automation: use expect utility in xilinx tests
    
    Fixes: 95764a0817a5 (automation: update xilinx test scripts (tty))
    This patch introduced a CI failure due to a timeout in xilinx-x86_64 test.
    
    Change xilinx-x86_64 and xilinx-arm64 scripts to use "expect" utility
    to determine test result and allow early exit from tests.
    Add "expect" to xilinx container environment (dockerfile).
    Rename references to "QEMU" in "qemu-key.exp" expect script to "TEST" to be
    used by both QEMU and hardware tests.
    
    Signed-off-by: Victor Lira <victorm.lira@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/build/ubuntu/xenial-xilinx.dockerfile  |  1 +
 automation/gitlab-ci/test.yaml                    |  2 +
 automation/scripts/console.exp                    | 49 +++++++++++++++++++++++
 automation/scripts/qemu-alpine-x86_64.sh          |  6 +--
 automation/scripts/qemu-key.exp                   | 49 -----------------------
 automation/scripts/qemu-smoke-dom0-arm32.sh       |  6 +--
 automation/scripts/qemu-smoke-dom0-arm64.sh       |  6 +--
 automation/scripts/qemu-smoke-dom0less-arm32.sh   |  6 +--
 automation/scripts/qemu-smoke-dom0less-arm64.sh   |  6 +--
 automation/scripts/qemu-smoke-ppc64le.sh          |  6 +--
 automation/scripts/qemu-smoke-riscv64.sh          |  6 +--
 automation/scripts/qemu-smoke-x86-64.sh           |  6 +--
 automation/scripts/qemu-xtf-dom0less-arm64.sh     |  6 +--
 automation/scripts/xilinx-smoke-dom0-x86_64.sh    | 22 +++++-----
 automation/scripts/xilinx-smoke-dom0less-arm64.sh | 19 ++++-----
 15 files changed, 99 insertions(+), 97 deletions(-)

diff --git a/automation/build/ubuntu/xenial-xilinx.dockerfile b/automation/build/ubuntu/xenial-xilinx.dockerfile
index f03d62e8bd..6107d8b771 100644
--- a/automation/build/ubuntu/xenial-xilinx.dockerfile
+++ b/automation/build/ubuntu/xenial-xilinx.dockerfile
@@ -20,6 +20,7 @@ RUN apt-get update && \
         git \
         gzip \
         file \
+        expect \
         && \
         apt-get autoremove -y && \
         apt-get clean && \
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 3b339f387f..cecc18a019 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -84,6 +84,7 @@
   variables:
     CONTAINER: ubuntu:xenial-xilinx
     LOGFILE: qemu-smoke-xilinx.log
+    TEST_TIMEOUT: 120
   artifacts:
     paths:
       - smoke.serial
@@ -103,6 +104,7 @@
     LOGFILE: xilinx-smoke-x86_64.log
     XEN_CMD_CONSOLE: "console=com2 com2=115200,8n1,0x2F8,4"
     TEST_BOARD: "crater"
+    TEST_TIMEOUT: 1000
   artifacts:
     paths:
       - smoke.serial
diff --git a/automation/scripts/console.exp b/automation/scripts/console.exp
new file mode 100755
index 0000000000..f538aa6bd0
--- /dev/null
+++ b/automation/scripts/console.exp
@@ -0,0 +1,49 @@
+#!/usr/bin/expect -f
+
+if {[info exists env(TEST_TIMEOUT)]} {
+    set timeout $env(TEST_TIMEOUT)
+} else {
+    set timeout 1500
+}
+
+log_file -a $env(TEST_LOG)
+
+match_max 10000
+
+eval spawn $env(TEST_CMD)
+
+expect_after {
+    -re "(.*)\r" {
+        exp_continue -continue_timer
+    }
+    timeout {send_error "ERROR-Timeout!\n"; exit 1}
+    eof {send_error "ERROR-EOF!\n"; exit 1}
+}
+
+if {[info exists env(UBOOT_CMD)]} {
+    expect "=>"
+
+    send "$env(UBOOT_CMD)\r"
+}
+
+if {[info exists env(LOG_MSG)]} {
+    expect {
+        "$env(PASSED)" {
+            expect "$env(LOG_MSG)"
+            exit 0
+        }
+        "$env(LOG_MSG)" {
+            expect "$env(PASSED)"
+            exit 0
+        }
+    }
+}
+
+expect {
+    "$env(PASSED)" {
+        exit 0
+    }
+}
+
+expect eof
+
diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/scripts/qemu-alpine-x86_64.sh
index 93914c41bc..1ff689b577 100755
--- a/automation/scripts/qemu-alpine-x86_64.sh
+++ b/automation/scripts/qemu-alpine-x86_64.sh
@@ -76,7 +76,7 @@ EOF
 
 # Run the test
 rm -f smoke.serial
-export QEMU_CMD="qemu-system-x86_64 \
+export TEST_CMD="qemu-system-x86_64 \
     -cpu qemu64,+svm \
     -m 2G -smp 2 \
     -monitor none -serial stdio \
@@ -84,8 +84,8 @@ export QEMU_CMD="qemu-system-x86_64 \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0"
 
-export QEMU_LOG="smoke.serial"
+export TEST_LOG="smoke.serial"
 export LOG_MSG="Domain-0"
 export PASSED="BusyBox"
 
-./automation/scripts/qemu-key.exp | sed 's/\r\+$//'
+./automation/scripts/console.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-key.exp b/automation/scripts/qemu-key.exp
deleted file mode 100755
index 66c4164831..0000000000
--- a/automation/scripts/qemu-key.exp
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/expect -f
-
-if {[info exists env(QEMU_TIMEOUT)]} {
-    set timeout $env(QEMU_TIMEOUT)
-} else {
-    set timeout 1500
-}
-
-log_file -a $env(QEMU_LOG)
-
-match_max 10000
-
-eval spawn $env(QEMU_CMD)
-
-expect_after {
-    -re "(.*)\r" {
-        exp_continue -continue_timer
-    }
-    timeout {send_error "ERROR-Timeout!\n"; exit 1}
-    eof {send_error "ERROR-EOF!\n"; exit 1}
-}
-
-if {[info exists env(UBOOT_CMD)]} {
-    expect "=>"
-
-    send "$env(UBOOT_CMD)\r"
-}
-
-if {[info exists env(LOG_MSG)]} {
-    expect {
-        "$env(PASSED)" {
-            expect "$env(LOG_MSG)"
-            exit 0
-        }
-        "$env(LOG_MSG)" {
-            expect "$env(PASSED)"
-            exit 0
-        }
-    }
-}
-
-expect {
-    "$env(PASSED)" {
-        exit 0
-    }
-}
-
-expect eof
-
diff --git a/automation/scripts/qemu-smoke-dom0-arm32.sh b/automation/scripts/qemu-smoke-dom0-arm32.sh
index 7c282eff3a..e1cd838809 100755
--- a/automation/scripts/qemu-smoke-dom0-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm32.sh
@@ -77,7 +77,7 @@ git clone --depth 1 https://gitlab.com/xen-project/imagebuilder.git
 bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
 
 rm -f ${serial_log}
-export QEMU_CMD="./qemu-system-arm \
+export TEST_CMD="./qemu-system-arm \
    -machine virt \
    -machine virtualization=true \
    -smp 4 \
@@ -91,8 +91,8 @@ export QEMU_CMD="./qemu-system-arm \
    -bios /usr/lib/u-boot/qemu_arm/u-boot.bin"
 
 export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
-export QEMU_LOG="${serial_log}"
+export TEST_LOG="${serial_log}"
 export LOG_MSG="Domain-0"
 export PASSED="/ #"
 
-../automation/scripts/qemu-key.exp | sed 's/\r\+$//'
+../automation/scripts/console.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-dom0-arm64.sh b/automation/scripts/qemu-smoke-dom0-arm64.sh
index 81f210f7f5..4d22a124df 100755
--- a/automation/scripts/qemu-smoke-dom0-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm64.sh
@@ -93,7 +93,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 
 # Run the test
 rm -f smoke.serial
-export QEMU_CMD="./binaries/qemu-system-aarch64 \
+export TEST_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \
     -m 2048 -monitor none -serial stdio \
@@ -104,8 +104,8 @@ export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
 
 export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
-export QEMU_LOG="smoke.serial"
+export TEST_LOG="smoke.serial"
 export LOG_MSG="Domain-0"
 export PASSED="BusyBox"
 
-./automation/scripts/qemu-key.exp | sed 's/\r\+$//'
+./automation/scripts/console.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-dom0less-arm32.sh b/automation/scripts/qemu-smoke-dom0less-arm32.sh
index 38e8a0b0bd..41f6e5d8e6 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm32.sh
@@ -130,7 +130,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
 
 # Run the test
 rm -f ${serial_log}
-export QEMU_CMD="./qemu-system-arm \
+export TEST_CMD="./qemu-system-arm \
     -machine virt \
     -machine virtualization=true \
     -smp 4 \
@@ -144,8 +144,8 @@ export QEMU_CMD="./qemu-system-arm \
     -bios /usr/lib/u-boot/qemu_arm/u-boot.bin"
 
 export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
-export QEMU_LOG="${serial_log}"
+export TEST_LOG="${serial_log}"
 export LOG_MSG="${dom0_prompt}"
 export PASSED="${passed}"
 
-../automation/scripts/qemu-key.exp | sed 's/\r\+$//'
+../automation/scripts/console.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index ea67650e17..83e1866ca6 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -204,7 +204,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 
 # Run the test
 rm -f smoke.serial
-export QEMU_CMD="./binaries/qemu-system-aarch64 \
+export TEST_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt,gic-version=$gic_version \
     -m 2048 -monitor none -serial stdio \
@@ -215,8 +215,8 @@ export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
 
 export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
-export QEMU_LOG="smoke.serial"
+export TEST_LOG="smoke.serial"
 export LOG_MSG="Welcome to Alpine Linux"
 export PASSED="${passed}"
 
-./automation/scripts/qemu-key.exp | sed 's/\r\+$//'
+./automation/scripts/console.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-ppc64le.sh b/automation/scripts/qemu-smoke-ppc64le.sh
index 49e189c370..617096ad1f 100755
--- a/automation/scripts/qemu-smoke-ppc64le.sh
+++ b/automation/scripts/qemu-smoke-ppc64le.sh
@@ -10,7 +10,7 @@ machine=$1
 # Run the test
 rm -f ${serial_log}
 
-export QEMU_CMD="qemu-system-ppc64 \
+export TEST_CMD="qemu-system-ppc64 \
     -bios skiboot.lid \
     -M $machine \
     -m 2g \
@@ -21,7 +21,7 @@ export QEMU_CMD="qemu-system-ppc64 \
     -serial stdio \
     -kernel binaries/xen"
 
-export QEMU_LOG="${serial_log}"
+export TEST_LOG="${serial_log}"
 export PASSED="Hello, ppc64le!"
 
-./automation/scripts/qemu-key.exp | sed 's/\r\+$//'
+./automation/scripts/console.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-riscv64.sh b/automation/scripts/qemu-smoke-riscv64.sh
index 422ee03e0d..8f755d0a6a 100755
--- a/automation/scripts/qemu-smoke-riscv64.sh
+++ b/automation/scripts/qemu-smoke-riscv64.sh
@@ -5,14 +5,14 @@ set -ex -o pipefail
 # Run the test
 rm -f smoke.serial
 
-export QEMU_CMD="qemu-system-riscv64 \
+export TEST_CMD="qemu-system-riscv64 \
     -M virt \
     -smp 1 \
     -nographic \
     -m 2g \
     -kernel binaries/xen"
 
-export QEMU_LOG="smoke.serial"
+export TEST_LOG="smoke.serial"
 export PASSED="All set up"
 
-./automation/scripts/qemu-key.exp | sed 's/\r\+$//'
+./automation/scripts/console.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-x86-64.sh b/automation/scripts/qemu-smoke-x86-64.sh
index 7495185d9f..da0c26cc2f 100755
--- a/automation/scripts/qemu-smoke-x86-64.sh
+++ b/automation/scripts/qemu-smoke-x86-64.sh
@@ -15,12 +15,12 @@ case $variant in
 esac
 
 rm -f smoke.serial
-export QEMU_CMD="qemu-system-x86_64 -nographic -kernel binaries/xen \
+export TEST_CMD="qemu-system-x86_64 -nographic -kernel binaries/xen \
         -initrd xtf/tests/example/$k \
         -append \"loglvl=all console=com1 noreboot console_timestamps=boot $extra\" \
         -m 512 -monitor none -serial stdio"
 
-export QEMU_LOG="smoke.serial"
+export TEST_LOG="smoke.serial"
 export PASSED="Test result: SUCCESS"
 
-./automation/scripts/qemu-key.exp | sed 's/\r\+$//'
+./automation/scripts/console.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-xtf-dom0less-arm64.sh b/automation/scripts/qemu-xtf-dom0less-arm64.sh
index acef1637e2..9608de6ec0 100755
--- a/automation/scripts/qemu-xtf-dom0less-arm64.sh
+++ b/automation/scripts/qemu-xtf-dom0less-arm64.sh
@@ -50,7 +50,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 
 # Run the test
 rm -f smoke.serial
-export QEMU_CMD="./binaries/qemu-system-aarch64 \
+export TEST_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \
     -m 2048 -monitor none -serial stdio \
@@ -61,7 +61,7 @@ export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
 
 export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
-export QEMU_LOG="smoke.serial"
+export TEST_LOG="smoke.serial"
 export PASSED="${passed}"
 
-./automation/scripts/qemu-key.exp | sed 's/\r\+$//'
+./automation/scripts/console.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/xilinx-smoke-dom0-x86_64.sh b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
index 4559e2b9ee..ef6e1361a9 100755
--- a/automation/scripts/xilinx-smoke-dom0-x86_64.sh
+++ b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
@@ -1,8 +1,8 @@
-#!/bin/sh
+#!/usr/bin/env bash
 
 # Run x86_64 dom0 tests on hardware.
 
-set -ex
+set -ex -o pipefail
 
 fatal() {
     echo "$(basename "$0") $*" >&2
@@ -27,7 +27,6 @@ memory = 512
 vif = [ "bridge=xenbr0", ]
 disk = [ ]
 '
-TIMEOUT_SECONDS=200
 
 # Select test variant.
 if [ "${TEST}" = "ping" ]; then
@@ -125,20 +124,19 @@ boot
 
 # Power cycle board and collect serial port output.
 SERIAL_DEV="/dev/serial/${TEST_BOARD}"
-SERIAL_CMD="cat ${SERIAL_DEV} | tee smoke.serial | sed 's/\r//'"
 sh /scratch/gitlab-runner/${TEST_BOARD}.sh 2
 sleep 5
 sh /scratch/gitlab-runner/${TEST_BOARD}.sh 1
 sleep 5
 set +e
 stty -F ${SERIAL_DEV} 115200
-timeout -k 1 ${TIMEOUT_SECONDS} nohup sh -c "${SERIAL_CMD}"
-sh /scratch/gitlab-runner/${TEST_BOARD}.sh 2
-
-set -e
 
-if grep -q "${PASS_MSG}" smoke.serial; then
-    exit 0
-fi
+# Capture test result and power off board before exiting.
+export PASSED="${PASS_MSG}"
+export TEST_CMD="cat ${SERIAL_DEV}"
+export TEST_LOG="smoke.serial"
 
-fatal "Test failed"
+./automation/scripts/console.exp | sed 's/\r\+$//'
+TEST_RESULT=$?
+sh "/scratch/gitlab-runner/${TEST_BOARD}.sh" 2
+exit ${TEST_RESULT}
diff --git a/automation/scripts/xilinx-smoke-dom0less-arm64.sh b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
index 18aa07f0a2..b24ad11b8c 100755
--- a/automation/scripts/xilinx-smoke-dom0less-arm64.sh
+++ b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 test_variant=$1
 
@@ -137,13 +137,14 @@ cd $START
 SERIAL_DEV="/dev/serial/zynq"
 set +e
 stty -F ${SERIAL_DEV} 115200
-timeout -k 1 120 nohup sh -c "cat ${SERIAL_DEV} | tee smoke.serial | sed 's/\r//'"
 
-# stop the board
-cd /scratch/gitlab-runner
-bash zcu102.sh 2
-cd $START
+# Capture test result and power off board before exiting.
+export PASSED="${passed}"
+export LOG_MSG="Welcome to Alpine Linux"
+export TEST_CMD="cat ${SERIAL_DEV}"
+export TEST_LOG="smoke.serial"
 
-set -e
-(grep -q "^Welcome to Alpine Linux" smoke.serial && grep -q "${passed}" smoke.serial) || exit 1
-exit 0
+./automation/scripts/console.exp | sed 's/\r\+$//'
+TEST_RESULT=$?
+sh "/scratch/gitlab-runner/zcu102.sh" 2
+exit ${TEST_RESULT}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 00:00:22 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 00:00:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.788530.1197948 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slGy6-0001EY-NV; Tue, 03 Sep 2024 00:00:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 788530.1197948; Tue, 03 Sep 2024 00:00:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slGy6-0001EQ-Kn; Tue, 03 Sep 2024 00:00:22 +0000
Received: by outflank-mailman (input) for mailman id 788530;
 Tue, 03 Sep 2024 00:00:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slGy5-0001EG-UT
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 00:00:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slGy5-0007HO-Th
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 00:00:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slGy5-00043C-SL
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 00:00:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=193zUI36rY3uV2JBGrmEzbth3c3QtZsPHyZ50Lmeas0=; b=LYPDcY1vqx+SGS/TktnC5staF1
	7slqkEWV1aIyDggb3dPrUGEDgyHLqTY2AgLjbENj0Wi2DJStnrqMDIzq93pFrjQLlzV2EiCrteRVE
	ayBzDde5nX1UbPAfebq/oYqvtd0nO1ktZsA7Ut/lK1XxO5v23O21hyybVyf4ODb3vZRE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml: Factor out compatiblity handling
Message-Id: <E1slGy5-00043C-SL@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 00:00:21 +0000

commit 8d336fcb6ea6b486ceccef2e36d003db032131fe
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jan 30 22:14:20 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 30 18:08:48 2024 +0100

    tools/ocaml: Factor out compatiblity handling
    
    ... rather than having each library implement its own subset.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
---
 tools/ocaml/libs/xc/Makefile        |  2 +-
 tools/ocaml/libs/xc/xenctrl_stubs.c | 13 +++----------
 tools/ocaml/libs/xen-caml-compat.h  | 23 +++++++++++++++++++++++
 3 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/tools/ocaml/libs/xc/Makefile b/tools/ocaml/libs/xc/Makefile
index 1d9fecb06e..cdf4d01dac 100644
--- a/tools/ocaml/libs/xc/Makefile
+++ b/tools/ocaml/libs/xc/Makefile
@@ -2,7 +2,7 @@ OCAML_TOPLEVEL=$(CURDIR)/../..
 XEN_ROOT=$(OCAML_TOPLEVEL)/../..
 include $(OCAML_TOPLEVEL)/common.make
 
-CFLAGS += -I../mmap $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest)
+CFLAGS += -I../ -I../mmap $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest)
 CFLAGS += $(APPEND_CFLAGS)
 OCAMLINCLUDE += -I ../mmap -I ../eventchn
 
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index a529080129..c78191f95a 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -25,6 +25,8 @@
 #include <caml/fail.h>
 #include <caml/callback.h>
 
+#include "xen-caml-compat.h"
+
 #include <sys/mman.h>
 #include <stdint.h>
 #include <string.h>
@@ -37,14 +39,6 @@
 
 #include "mmap_stubs.h"
 
-#ifndef Val_none
-#define Val_none (Val_int(0))
-#endif
-
-#ifndef Tag_some
-#define Tag_some 0
-#endif
-
 static inline xc_interface *xch_of_val(value v)
 {
 	xc_interface *xch = *(xc_interface **)Data_custom_val(v);
@@ -744,8 +738,7 @@ CAMLprim value stub_xc_evtchn_status(value xch_val, value domid, value port)
 	Store_field(result_status, 0, Val_int(status.vcpu));
 	Store_field(result_status, 1, stat);
 
-	result = caml_alloc_small(1, Tag_some);
-	Store_field(result, 0, result_status);
+	result = caml_alloc_some(result_status);
 
 	CAMLreturn(result);
 }
diff --git a/tools/ocaml/libs/xen-caml-compat.h b/tools/ocaml/libs/xen-caml-compat.h
new file mode 100644
index 0000000000..14aede2128
--- /dev/null
+++ b/tools/ocaml/libs/xen-caml-compat.h
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: LGPL-2.1-only WITH OCaml-LGPL-linking-exception */
+#ifndef XEN_CAML_COMPAT_H
+#define XEN_CAML_COMPAT_H
+
+#ifndef Val_none /* Option handling.  Compat for Ocaml < 4.12 */
+
+#define Val_none Val_int(0)
+#define Tag_some 0
+#define Some_val(v) Field(v, 0)
+
+static inline value caml_alloc_some(value v)
+{
+    CAMLparam1(v);
+
+    value some = caml_alloc_small(1, Tag_some);
+    Field(some, 0) = v;
+
+    CAMLreturn(some);
+}
+
+#endif /* !Val_none */
+
+#endif /* XEN_CAML_COMPAT_H */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 00:00:32 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 00:00:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.788533.1197952 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slGyG-0001I6-Oq; Tue, 03 Sep 2024 00:00:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 788533.1197952; Tue, 03 Sep 2024 00:00:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slGyG-0001Hy-MH; Tue, 03 Sep 2024 00:00:32 +0000
Received: by outflank-mailman (input) for mailman id 788533;
 Tue, 03 Sep 2024 00:00:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slGyG-0001Hn-3J
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 00:00:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slGyG-0007HV-21
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 00:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slGyF-00044K-W5
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 00:00:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RyA5MikP9vBrZS1zgAuiu0cRnRsKrvG6ltJgoniPsXE=; b=3eekT2Q0tbLXh1NQCei41oseWS
	FEyyfiMXJK7O0Va7XH3ZgVNpM77kHIdF7mflX1mluZ8Pr+LKBCl4pny299SugU5jG8jwydpBl8QHR
	kuQ/R7m5ZcOlsFj3up83Kyl3nVUT00SR/g3DP2bk2ybM66dvms9gyMmTSBoVpYWig2TM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/pv: Make cr4_pv32_mask be PV32-only
Message-Id: <E1slGyF-00044K-W5@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 00:00:31 +0000

commit 7ab0f83e604d44c92daa218423bf7644502fcefe
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Aug 28 20:20:34 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 30 18:08:48 2024 +0100

    x86/pv: Make cr4_pv32_mask be PV32-only
    
    The user of cr4_pv32_mask (the cr4_pv32_restore() function) only exists in a
    CONFIG_PV32 build, but right now the variable is unconditionally set up.
    
    To start with, move the setup into set_in_cr4() and remove it from it's
    somewhat ad-hoc position in __start_xen().  This means the variable will be
    set up in two steps for a CONFIG_PV32=y build, but it's cleaner and more
    robust logic overall.
    
    With that, there's no good reason for the variable to stay in setup.c.  Move
    it to x86/pv/domain.c (beside opt_pv32, for want of any better place to live),
    and move the declaration to beside set_in_cr4() and mmu_cr4_features which is
    a better position than setup.h.
    
    Guard the reference with CONFIG_PV32, and fix up a recent typo in an adjacent
    comment while at it.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/include/asm/processor.h |  4 ++++
 xen/arch/x86/include/asm/setup.h     |  2 --
 xen/arch/x86/pv/dom0_build.c         | 10 +++++++---
 xen/arch/x86/pv/domain.c             |  1 +
 xen/arch/x86/setup.c                 |  4 ----
 5 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/include/asm/processor.h b/xen/arch/x86/include/asm/processor.h
index 66463f6a6d..e71dbb8d3f 100644
--- a/xen/arch/x86/include/asm/processor.h
+++ b/xen/arch/x86/include/asm/processor.h
@@ -312,11 +312,15 @@ static inline void stts(void)
  * after us can get the correct flags.
  */
 extern unsigned long mmu_cr4_features;
+extern unsigned long cr4_pv32_mask;
 
 static always_inline void set_in_cr4 (unsigned long mask)
 {
     mmu_cr4_features |= mask;
     write_cr4(read_cr4() | mask);
+
+    if ( IS_ENABLED(CONFIG_PV32) && (mask & XEN_CR4_PV32_BITS) )
+        cr4_pv32_mask |= (mask & XEN_CR4_PV32_BITS);
 }
 
 static always_inline void __monitor(const void *eax, unsigned long ecx,
diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h
index 8f7dfefb4d..d75589178b 100644
--- a/xen/arch/x86/include/asm/setup.h
+++ b/xen/arch/x86/include/asm/setup.h
@@ -64,8 +64,6 @@ extern bool opt_dom0_verbose;
 extern bool opt_dom0_cpuid_faulting;
 extern bool opt_dom0_msr_relaxed;
 
-extern unsigned long cr4_pv32_mask;
-
 #define max_init_domid (0)
 
 #endif
diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index 57b1834b5e..262edb6bf2 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -1061,12 +1061,14 @@ int __init dom0_construct_pv(struct domain *d,
 
     /*
      * Clear SMAP in CR4 to allow user-accesses in construct_dom0().  This
-     * prevents us needing to write rewrite construct_dom0() in terms of
+     * prevents us needing to write construct_dom0() in terms of
      * copy_{to,from}_user().
      */
     if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
     {
-        cr4_pv32_mask &= ~X86_CR4_SMAP;
+        if ( IS_ENABLED(CONFIG_PV32) )
+            cr4_pv32_mask &= ~X86_CR4_SMAP;
+
         write_cr4(read_cr4() & ~X86_CR4_SMAP);
     }
 
@@ -1075,7 +1077,9 @@ int __init dom0_construct_pv(struct domain *d,
     if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
     {
         write_cr4(read_cr4() | X86_CR4_SMAP);
-        cr4_pv32_mask |= X86_CR4_SMAP;
+
+        if ( IS_ENABLED(CONFIG_PV32) )
+            cr4_pv32_mask |= X86_CR4_SMAP;
     }
 
     return rc;
diff --git a/xen/arch/x86/pv/domain.c b/xen/arch/x86/pv/domain.c
index 86b74fb372..d5a8564c1c 100644
--- a/xen/arch/x86/pv/domain.c
+++ b/xen/arch/x86/pv/domain.c
@@ -19,6 +19,7 @@
 
 #ifdef CONFIG_PV32
 int8_t __read_mostly opt_pv32 = -1;
+unsigned long __ro_after_init cr4_pv32_mask;
 #endif
 
 static int __init cf_check parse_pv(const char *s)
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index f1076c7203..c2e0082a30 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -79,8 +79,6 @@ bool __read_mostly use_invpcid;
 int8_t __initdata opt_probe_port_aliases = -1;
 boolean_param("probe-port-aliases", opt_probe_port_aliases);
 
-unsigned long __ro_after_init cr4_pv32_mask;
-
 /* **** Linux config option: propagated to domain0. */
 /* "acpi=off":    Sisables both ACPI table parsing and interpreter. */
 /* "acpi=force":  Override the disable blacklist.                   */
@@ -1898,8 +1896,6 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
         set_in_cr4(X86_CR4_SMAP);
 
-    cr4_pv32_mask = mmu_cr4_features & XEN_CR4_PV32_BITS;
-
     if ( boot_cpu_has(X86_FEATURE_FSGSBASE) )
         set_in_cr4(X86_CR4_FSGSBASE);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 00:00:42 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 00:00:42 +0000
Received: from list by lists.xenproject.org with outflank-mailman.788535.1197956 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slGyQ-0001Kv-QO; Tue, 03 Sep 2024 00:00:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 788535.1197956; Tue, 03 Sep 2024 00:00:42 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slGyQ-0001Kn-Nk; Tue, 03 Sep 2024 00:00:42 +0000
Received: by outflank-mailman (input) for mailman id 788535;
 Tue, 03 Sep 2024 00:00:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slGyQ-0001Kf-6J
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 00:00:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slGyQ-0007Hg-5a
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 00:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slGyQ-00049E-4a
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 00:00:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=M5rY/pO9ZCBALTUHgcQzNSL/br5Dydk/pGyxC7vr2X0=; b=zE1KdcQo1NfvftZR7DvZJ93JFp
	AyonVjD02wnV2fa+sitSeCUrDLkUsvtjQm3qjWDxM+j5EzwQ6SpNkXAyTCR+WT3IysDa68xuOK3Dk
	hfZDJsURAx02ezAjFsmyDn7249nfZ+rUVWF17dKoIt0UBFbDrpGmsX4oMvDyeKAcyGpI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: Probe QEMU for -run-with chroot=dir and use it
Message-Id: <E1slGyQ-00049E-4a@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 00:00:42 +0000

commit 82335a8cc54c009792d44f0be51213da48303a68
Author:     Anthony PERARD <anthony.perard@vates.tech>
AuthorDate: Fri Aug 30 09:49:40 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 30 18:14:11 2024 +0100

    libxl: Probe QEMU for -run-with chroot=dir and use it
    
    QEMU 9.0 have removed "-chroot" command line option, which have been
    deprecated since QEMU 8.1 in favor of "-run-with chroot=dir".
    
    Look into the result of the QMP command "query-command-line-options"
    to find out if "-run-with chroot=dir" is available. Then use it in
    place of "-chroot".
    
    Resolves: xen-project/xen#187
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 tools/libs/light/libxl_dm.c       | 78 ++++++++++++++++++++++++++++++++-------
 tools/libs/light/libxl_internal.h |  5 +++
 2 files changed, 69 insertions(+), 14 deletions(-)

diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index 46babfed0b..15b157060f 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -1183,11 +1183,12 @@ out:
 }
 
 static int libxl__build_device_model_args_new(libxl__gc *gc,
-                                        const char *dm, int guest_domid,
-                                        const libxl_domain_config *guest_config,
-                                        char ***args, char ***envs,
-                                        const libxl__domain_build_state *state,
-                                        int *dm_state_fd)
+    const char *dm, int guest_domid,
+    const libxl_domain_config *guest_config,
+    char ***args, char ***envs,
+    const libxl__domain_build_state *state,
+    const libxl__qemu_available_opts *qemu_opts,
+    int *dm_state_fd)
 {
     const libxl_domain_create_info *c_info = &guest_config->c_info;
     const libxl_domain_build_info *b_info = &guest_config->b_info;
@@ -1778,8 +1779,13 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
         }
 
         /* Add "-chroot [dir]" to command-line */
-        flexarray_append(dm_args, "-chroot");
-        flexarray_append(dm_args, chroot_dir);
+        if (qemu_opts->have_runwith_chroot) {
+            flexarray_append_pair(dm_args, "-run-with",
+                                  GCSPRINTF("chroot=%s", chroot_dir));
+        } else {
+            flexarray_append(dm_args, "-chroot");
+            flexarray_append(dm_args, chroot_dir);
+        }
     }
 
     if (state->saved_state) {
@@ -2059,11 +2065,12 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
 }
 
 static int libxl__build_device_model_args(libxl__gc *gc,
-                                        const char *dm, int guest_domid,
-                                        const libxl_domain_config *guest_config,
-                                        char ***args, char ***envs,
-                                        const libxl__domain_build_state *state,
-                                        int *dm_state_fd)
+    const char *dm, int guest_domid,
+    const libxl_domain_config *guest_config,
+    char ***args, char ***envs,
+    const libxl__domain_build_state *state,
+    const libxl__qemu_available_opts *qemu_opts,
+    int *dm_state_fd)
 /* dm_state_fd may be NULL iff caller knows we are using stubdom
  * and therefore will be passing a filename rather than a fd. */
 {
@@ -2081,7 +2088,9 @@ static int libxl__build_device_model_args(libxl__gc *gc,
         return libxl__build_device_model_args_new(gc, dm,
                                                   guest_domid, guest_config,
                                                   args, envs,
-                                                  state, dm_state_fd);
+                                                  state,
+                                                  qemu_opts,
+                                                  dm_state_fd);
     default:
         LOGED(ERROR, guest_domid, "unknown device model version %d",
               guest_config->b_info.device_model_version);
@@ -2403,7 +2412,9 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss)
 
     ret = libxl__build_device_model_args(gc, "stubdom-dm", guest_domid,
                                          guest_config, &args, NULL,
-                                         d_state, NULL);
+                                         d_state,
+                                         &sdss->dm.qemu_opts,
+                                         NULL);
     if (ret) {
         ret = ERROR_FAIL;
         goto out;
@@ -3024,6 +3035,7 @@ static void device_model_probe_detached(libxl__egc *egc,
 static void device_model_probe_cmdline(libxl__egc *egc,
     libxl__ev_qmp *qmp, const libxl__json_object *response, int rc)
 {
+    EGC_GC;
     libxl__dm_spawn_state *dmss = CONTAINER_OF(qmp, *dmss, qmp);
 
     if (rc)
@@ -3033,6 +3045,43 @@ static void device_model_probe_cmdline(libxl__egc *egc,
      * query-command-line-options response:
      * [ { 'option': 'str', 'parameters': [{ 'name': 'str', ... }] } ]
      */
+    const libxl__json_object *option;
+    for (int i_option = 0;
+         (option = libxl__json_array_get(response, i_option));
+         i_option++) {
+        const libxl__json_object *o;
+        const char *opt_str;
+
+        o = libxl__json_map_get("option", option, JSON_STRING);
+        if (!o) {
+            rc = ERROR_QEMU_API;
+            goto out;
+        }
+        opt_str = libxl__json_object_get_string(o);
+
+        if (!strcmp("run-with", opt_str)) {
+            const libxl__json_object *params;
+            const libxl__json_object *item;
+
+            params = libxl__json_map_get("parameters", option, JSON_ARRAY);
+            for (int i = 0; (item = libxl__json_array_get(params, i)); i++) {
+                o = libxl__json_map_get("name", item, JSON_STRING);
+                if (!o) {
+                    rc = ERROR_QEMU_API;
+                    goto out;
+                }
+                if (!strcmp("chroot", libxl__json_object_get_string(o))) {
+                    dmss->qemu_opts.have_runwith_chroot = true;
+                }
+            }
+
+            /*
+             * No need to parse more options, we are only interested with
+             * -run-with at the moment.
+             */
+            break;
+        }
+    }
 
     qmp->callback = device_model_probe_quit;
     rc = libxl__ev_qmp_send(egc, qmp, "quit", NULL);
@@ -3113,6 +3162,7 @@ static void device_model_launch(libxl__egc *egc,
 
     rc = libxl__build_device_model_args(gc, dm, domid, guest_config,
                                           &args, &envs, state,
+                                          &dmss->qemu_opts,
                                           &dm_state_fd);
     if (rc)
         goto out;
diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h
index e99adc56cb..0133c57e01 100644
--- a/tools/libs/light/libxl_internal.h
+++ b/tools/libs/light/libxl_internal.h
@@ -4142,6 +4142,10 @@ _hidden void libxl__add_nics(libxl__egc *egc, libxl__ao *ao, uint32_t domid,
 /* First layer; wraps libxl__spawn_spawn. */
 
 typedef struct libxl__dm_spawn_state libxl__dm_spawn_state;
+typedef struct libxl__qemu_available_opts libxl__qemu_available_opts;
+struct libxl__qemu_available_opts {
+    bool have_runwith_chroot;
+};
 
 typedef void libxl__dm_spawn_cb(libxl__egc *egc, libxl__dm_spawn_state*,
                                 int rc /* if !0, error was logged */);
@@ -4154,6 +4158,7 @@ struct libxl__dm_spawn_state {
     libxl__ev_qmp qmp;
     libxl__ev_time timeout;
     libxl__dm_resume_state dmrs;
+    libxl__qemu_available_opts qemu_opts;
     const char *dm;
     /* filled in by user, must remain valid: */
     uint32_t guest_domid; /* domain being served */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 00:00:52 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 00:00:52 +0000
Received: from list by lists.xenproject.org with outflank-mailman.788537.1197960 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slGya-0001Nu-Rt; Tue, 03 Sep 2024 00:00:52 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 788537.1197960; Tue, 03 Sep 2024 00:00:52 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slGya-0001Nm-PE; Tue, 03 Sep 2024 00:00:52 +0000
Received: by outflank-mailman (input) for mailman id 788537;
 Tue, 03 Sep 2024 00:00:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slGya-0001Nb-9p
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 00:00:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slGya-0007Hn-91
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 00:00:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slGya-0004AJ-88
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 00:00:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LqQH+WuPuzgK/Boa+F3kuUFkNEKEwK9Us1XQKoNwbdg=; b=Oc6ouA1zWR7p+itzQx+kKb0Cjh
	S+VmWSfq9nPf5/yycOaTY3zr5t5BdzTLLcoVw2/r63+dxC9BoaiE2tWd5b87Eoea97aFluAeY4ywh
	90kabnoCwyFxbi2puy4YaRIWU0/yiXfpy53KVUASD0zwxus9TmpmOhIcEdIs2wi/UQhE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: Probe QEMU for -run-with user=user and use it
Message-Id: <E1slGya-0004AJ-88@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 00:00:52 +0000

commit 1436593d5f8f7f700478e307d5198535ba69f88d
Author:     Anthony PERARD <anthony.perard@vates.tech>
AuthorDate: Fri Aug 30 09:49:40 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 30 18:14:11 2024 +0100

    libxl: Probe QEMU for -run-with user=user and use it
    
    "-runas" is deprecated since QEMU 9.1 and will be remove in a future
    release.
    
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 tools/libs/light/libxl_dm.c       | 12 ++++++++++--
 tools/libs/light/libxl_internal.h |  1 +
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index 15b157060f..1f2f5bd97a 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -2052,8 +2052,13 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
         }
 
         if (state->dm_runas) {
-            flexarray_append(dm_args, "-runas");
-            flexarray_append(dm_args, state->dm_runas);
+            if (qemu_opts->have_runwith_user) {
+                flexarray_append_pair(dm_args, "-run-with",
+                                      GCSPRINTF("user=%s", state->dm_runas));
+            } else {
+                flexarray_append(dm_args, "-runas");
+                flexarray_append(dm_args, state->dm_runas);
+            }
         }
     }
     flexarray_append(dm_args, NULL);
@@ -3073,6 +3078,9 @@ static void device_model_probe_cmdline(libxl__egc *egc,
                 if (!strcmp("chroot", libxl__json_object_get_string(o))) {
                     dmss->qemu_opts.have_runwith_chroot = true;
                 }
+                else if (!strcmp("user", libxl__json_object_get_string(o))) {
+                    dmss->qemu_opts.have_runwith_user = true;
+                }
             }
 
             /*
diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h
index 0133c57e01..089a2f949c 100644
--- a/tools/libs/light/libxl_internal.h
+++ b/tools/libs/light/libxl_internal.h
@@ -4145,6 +4145,7 @@ typedef struct libxl__dm_spawn_state libxl__dm_spawn_state;
 typedef struct libxl__qemu_available_opts libxl__qemu_available_opts;
 struct libxl__qemu_available_opts {
     bool have_runwith_chroot;
+    bool have_runwith_user;
 };
 
 typedef void libxl__dm_spawn_cb(libxl__egc *egc, libxl__dm_spawn_state*,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 08:00:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 08:00:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.788742.1198215 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slOSJ-0005ha-6e; Tue, 03 Sep 2024 08:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 788742.1198215; Tue, 03 Sep 2024 08:00:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slOSJ-0005gl-1k; Tue, 03 Sep 2024 08:00:03 +0000
Received: by outflank-mailman (input) for mailman id 788742;
 Tue, 03 Sep 2024 08:00:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slOSH-00059c-TH
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 08:00:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slOSH-0007uU-SQ
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 08:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slOSH-0000HG-Qq
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 08:00:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZoFUY99BBozhclAl2lxaBqFBEIX681xXUg4KHfwQpwI=; b=EGK86lse/rR+f1GELcpbHCBoEn
	+dMuO7t24TB57PLGtlpGIV+5HdfUFN+VeNORIDFbMgG+U0QLP4xAXq/Tw/gURhIkiydW6emK/Qnxr
	DO43UGPAjmqgE+QOvNCAmw9q2o4KSTP+CEyLj2+sUr6oZND7gbiy8KIo8hbYYYzAzAUw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mm: add defensive return
Message-Id: <E1slOSH-0000HG-Qq@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 08:00:01 +0000

commit a8a74261681b5010a6f29e18b30739528c8f310c
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Mon Sep 2 11:55:16 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 2 11:55:16 2024 +0200

    x86/mm: add defensive return
    
    Add defensive return statement at the end of an unreachable
    default case. Other than improve safety, this meets the requirements
    to deviate a violation of MISRA C Rule 16.3: "An unconditional `break'
    statement shall terminate every switch-clause".
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index e9c86208b0..4148c65657 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -918,6 +918,7 @@ get_page_from_l1e(
                 return 0;
             default:
                 ASSERT_UNREACHABLE();
+                return -EILSEQ;
             }
         }
         else if ( l1f & _PAGE_RW )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 08:00:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 08:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.788745.1198217 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slOST-0006U2-8s; Tue, 03 Sep 2024 08:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 788745.1198217; Tue, 03 Sep 2024 08:00:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slOST-0006Tv-6B; Tue, 03 Sep 2024 08:00:13 +0000
Received: by outflank-mailman (input) for mailman id 788745;
 Tue, 03 Sep 2024 08:00:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slOSS-0006Os-1j
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 08:00:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slOSS-0008Ey-0A
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 08:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slOSR-0000K4-Ud
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 08:00:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tEdiROfjXbhiga4sq2sMMxcfN1vmTSGAGzKxTrTYNCE=; b=T6onB4/wELPfo/b3FKPCdNu9/E
	lqr4kuM/8MzuW0WBgvXQechrY1hE1vOLvAL10NxtEEhInkDFh05wMr6N9r/NOe9fDybxXKl9oDtsU
	+gSxNH9fe0ztpiROAV6ltH/siE95Ihf1mXP4xo+h1G7aPY/RCSnXyzNv8y7P4LfRm/oQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: drop s<N>/u<N> overrides from mkelf32
Message-Id: <E1slOSR-0000K4-Ud@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 08:00:11 +0000

commit 913952cca4e34a5f01228e3ab9f44d326662170b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Sep 2 11:56:24 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 2 11:56:24 2024 +0200

    x86: drop s<N>/u<N> overrides from mkelf32
    
    Use uint<N>_t instead (s<N> were unused altogether). While adjusting
    swap<N>() drop excessive casts and rename the arguments to avoid leading
    underscores.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/boot/mkelf32.c | 30 +++++++++++-------------------
 1 file changed, 11 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/boot/mkelf32.c b/xen/arch/x86/boot/mkelf32.c
index 3d639c2e08..5f9e7e440e 100644
--- a/xen/arch/x86/boot/mkelf32.c
+++ b/xen/arch/x86/boot/mkelf32.c
@@ -17,14 +17,6 @@
 #include <unistd.h>
 #include <inttypes.h>
 
-#define u8  uint8_t
-#define u16 uint16_t
-#define u32 uint32_t
-#define u64 uint64_t
-#define s8  int8_t
-#define s16 int16_t
-#define s32 int32_t
-#define s64 int64_t
 #include "../../../include/xen/elfstructs.h"
 
 #define DYNAMICALLY_FILLED   0
@@ -72,9 +64,9 @@ static Elf32_Phdr note_phdr = {
     4                                        /* p_align */
 };
 
-static u8 out_shstrtab[] = "\0.text\0.shstrtab";
+static uint8_t out_shstrtab[] = "\0.text\0.shstrtab";
 /* If num_phdrs >= 2, we need to tack the .note. */
-static u8 out_shstrtab_extra[] = ".note\0";
+static uint8_t out_shstrtab_extra[] = ".note\0";
 
 static Elf32_Shdr out_shdr[] = {
     { 0 },
@@ -124,9 +116,9 @@ static Elf32_Shdr out_shdr_note = {
 #undef swap32
 #undef swap64
 
-#define swap16(_v) ((((u16)(_v)>>8)&0xff)|(((u16)(_v)&0xff)<<8))
-#define swap32(_v) (((u32)swap16((u16)(_v))<<16)|(u32)swap16((u32)((_v)>>16)))
-#define swap64(_v) (((u64)swap32((u32)(_v))<<32)|(u64)swap32((u32)((_v)>>32)))
+#define swap16(v) (( (uint8_t)(v)       <<  8) | (uint8_t)((v) >>  8))
+#define swap32(v) (((uint32_t)swap16(v) << 16) |    swap16((v) >> 16))
+#define swap64(v) (((uint64_t)swap32(v) << 32) |    swap32((v) >> 32))
 
 static int big_endian;
 
@@ -256,8 +248,8 @@ static void do_read(int fd, void *data, int len)
 
 int main(int argc, char **argv)
 {
-    u64        final_exec_addr;
-    u32        loadbase, dat_siz, mem_siz, note_base, note_sz, offset;
+    uint64_t   final_exec_addr;
+    uint32_t   loadbase, dat_siz, mem_siz, note_base, note_sz, offset;
     char      *inimage, *outimage;
     int        infd, outfd;
     char       buffer[1024] = {};
@@ -302,7 +294,7 @@ int main(int argc, char **argv)
         return 1;
     }
 
-    big_endian = (*(u16 *)in32_ehdr.e_ident == ((ELFMAG0 << 8) | ELFMAG1));
+    big_endian = (*(uint16_t *)in32_ehdr.e_ident == ((ELFMAG0 << 8) | ELFMAG1));
 
     endianadjust_ehdr32(&in32_ehdr);
     if ( in32_ehdr.e_ident[EI_CLASS] != ELFCLASS64 )
@@ -345,11 +337,11 @@ int main(int argc, char **argv)
     endianadjust_phdr64(&in64_phdr);
 
     (void)lseek(infd, in64_phdr.p_offset, SEEK_SET);
-    dat_siz = (u32)in64_phdr.p_filesz;
+    dat_siz = (uint32_t)in64_phdr.p_filesz;
 
     /* Do not use p_memsz: it does not include BSS alignment padding. */
-    /*mem_siz = (u32)in64_phdr.p_memsz;*/
-    mem_siz = (u32)(final_exec_addr - in64_phdr.p_vaddr);
+    /*mem_siz = (uint32_t)in64_phdr.p_memsz;*/
+    mem_siz = (uint32_t)(final_exec_addr - in64_phdr.p_vaddr);
 
     note_sz = note_base = offset = 0;
     if ( num_phdrs > 1 )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 08:00:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 08:00:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.788746.1198221 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slOSd-0006XI-Bf; Tue, 03 Sep 2024 08:00:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 788746.1198221; Tue, 03 Sep 2024 08:00:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slOSd-0006XA-96; Tue, 03 Sep 2024 08:00:23 +0000
Received: by outflank-mailman (input) for mailman id 788746;
 Tue, 03 Sep 2024 08:00:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slOSc-0006Ws-5m
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 08:00:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slOSc-0008F5-4y
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 08:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slOSc-0000LD-3H
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 08:00:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=og9VNUVbG7v9ZDpI4fUMdPOnd72F/66eZDfd8TsR61s=; b=w2RjpfUL3i2S9iTKuVx5h4EgYg
	WEsMyAmJVo/nM7K91b4Y6mOzpYAYE0rtXkLCg+BSVdpV+fOkEsSuh+QFFRP9i5+kQzRresfqzxYF5
	eba9Bu2awwOhI5f4VCHFe4sXQyDIqvgos32U/g593gplv6rbHrmx/wy0Vd+2TOYVLIFw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] types: replace remaining uses of s8
Message-Id: <E1slOSc-0000LD-3H@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 08:00:22 +0000

commit bfcb0abb191f75775081b74755c71c52ac06f994
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Sep 2 11:57:22 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 2 11:57:22 2024 +0200

    types: replace remaining uses of s8
    
    ... and move the type itself to linux-compat.h.
    
    While doing so,
    - convert __read_mostly to __ro_after_init for respective variables
      having their type changed (for acpi_numa add the attribute anew),
    - in cpuid_hypervisor_leaves() drop a cast altogether,
    - switch an adjacent struct arch_irq_desc field to bool.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/apic.c                     | 2 +-
 xen/arch/x86/cpu/amd.c                  | 2 +-
 xen/arch/x86/e820.c                     | 2 +-
 xen/arch/x86/hvm/quirks.c               | 2 +-
 xen/arch/x86/hvm/vmx/vmcs.c             | 2 +-
 xen/arch/x86/include/asm/acpi.h         | 2 +-
 xen/arch/x86/include/asm/amd.h          | 2 +-
 xen/arch/x86/include/asm/hvm/hvm.h      | 2 +-
 xen/arch/x86/include/asm/irq.h          | 4 ++--
 xen/arch/x86/mm.c                       | 2 +-
 xen/arch/x86/msi.c                      | 2 +-
 xen/arch/x86/numa.c                     | 2 +-
 xen/arch/x86/oprofile/op_model_athlon.c | 2 +-
 xen/arch/x86/setup.c                    | 4 ++--
 xen/arch/x86/traps.c                    | 2 +-
 xen/include/acpi/cpufreq/cpufreq.h      | 2 +-
 xen/include/xen/linux-compat.h          | 2 +-
 xen/include/xen/types.h                 | 1 -
 18 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 7869c30e83..e077bf7edc 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -71,7 +71,7 @@ static struct {
 /*
  * Knob to control our willingness to enable the local APIC.
  */
-static s8 __initdata enable_local_apic; /* -1=force-disable, +1=force-enable */
+static int8_t __initdata enable_local_apic; /* -1=force-disable, +1=force-enable */
 
 /*
  * Debug level
diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index ab92333673..903be14af4 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -46,7 +46,7 @@ static unsigned int __initdata opt_cpuid_mask_thermal_ecx = ~0u;
 integer_param("cpuid_mask_thermal_ecx", opt_cpuid_mask_thermal_ecx);
 
 /* 1 = allow, 0 = don't allow guest creation, -1 = don't allow boot */
-s8 __read_mostly opt_allow_unsafe;
+int8_t __ro_after_init opt_allow_unsafe;
 boolean_param("allow_unsafe", opt_allow_unsafe);
 
 /* Signal whether the ACPI C1E quirk is required. */
diff --git a/xen/arch/x86/e820.c b/xen/arch/x86/e820.c
index 3726823e88..e052e84de7 100644
--- a/xen/arch/x86/e820.c
+++ b/xen/arch/x86/e820.c
@@ -27,7 +27,7 @@ static unsigned long long __initdata opt_availmem;
 size_param("availmem", opt_availmem);
 
 /* opt_nomtrr_check: Don't clip ram to highest cacheable MTRR. */
-static s8 __initdata e820_mtrr_clip = -1;
+static int8_t __initdata e820_mtrr_clip = -1;
 boolean_param("e820-mtrr-clip", e820_mtrr_clip);
 
 /* opt_e820_verbose: Be verbose about clipping, the original e820, &c */
diff --git a/xen/arch/x86/hvm/quirks.c b/xen/arch/x86/hvm/quirks.c
index 09face0c51..9202f5a47f 100644
--- a/xen/arch/x86/hvm/quirks.c
+++ b/xen/arch/x86/hvm/quirks.c
@@ -11,7 +11,7 @@
 #include <xen/param.h>
 #include <asm/hvm/support.h>
 
-s8 __read_mostly hvm_port80_allowed = -1;
+int8_t __ro_after_init hvm_port80_allowed = -1;
 boolean_param("hvm_port80", hvm_port80_allowed);
 
 static int __init cf_check dmi_hvm_deny_port80(const struct dmi_system_id *id)
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 5787110a56..147e998371 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -59,7 +59,7 @@ static unsigned int __ro_after_init vm_notify_window;
 integer_param("vm-notify-window", vm_notify_window);
 
 static bool __read_mostly opt_ept_pml = true;
-static s8 __read_mostly opt_ept_ad = -1;
+static int8_t __ro_after_init opt_ept_ad = -1;
 int8_t __read_mostly opt_ept_exec_sp = -1;
 
 static int __init cf_check parse_ept_param(const char *s)
diff --git a/xen/arch/x86/include/asm/acpi.h b/xen/arch/x86/include/asm/acpi.h
index 48b1d69946..3c47b216d0 100644
--- a/xen/arch/x86/include/asm/acpi.h
+++ b/xen/arch/x86/include/asm/acpi.h
@@ -100,7 +100,7 @@ extern unsigned long acpi_wakeup_address;
 
 #define ARCH_HAS_POWER_INIT	1
 
-extern s8 acpi_numa;
+extern int8_t acpi_numa;
 
 extern struct acpi_sleep_info acpi_sinfo;
 #define acpi_video_flags bootsym(video_flags)
diff --git a/xen/arch/x86/include/asm/amd.h b/xen/arch/x86/include/asm/amd.h
index fa4e0fc766..9c9599a622 100644
--- a/xen/arch/x86/include/asm/amd.h
+++ b/xen/arch/x86/include/asm/amd.h
@@ -160,7 +160,7 @@
 struct cpuinfo_x86;
 int cpu_has_amd_erratum(const struct cpuinfo_x86 *cpu, int osvw_id, ...);
 
-extern s8 opt_allow_unsafe;
+extern int8_t opt_allow_unsafe;
 
 void fam10h_check_enable_mmcfg(void);
 void check_enable_amd_mmconf_dmi(void);
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index d5aaa5b710..dd7d4872b5 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -241,7 +241,7 @@ struct hvm_function_table {
 
 extern struct hvm_function_table hvm_funcs;
 extern bool hvm_enabled;
-extern s8 hvm_port80_allowed;
+extern int8_t hvm_port80_allowed;
 
 extern const struct hvm_function_table *start_svm(void);
 extern const struct hvm_function_table *start_vmx(void);
diff --git a/xen/arch/x86/include/asm/irq.h b/xen/arch/x86/include/asm/irq.h
index 5f445299be..5a8352a21e 100644
--- a/xen/arch/x86/include/asm/irq.h
+++ b/xen/arch/x86/include/asm/irq.h
@@ -80,8 +80,8 @@ struct arch_irq_desc {
         cpumask_var_t pending_mask;
         vmask_t *used_vectors;
         unsigned move_cleanup_count;
-        u8 move_in_progress : 1;
-        s8 used;
+        bool move_in_progress : 1;
+        int8_t used;
         /*
          * Weak reference to domain having permission over this IRQ (which can
          * be different from the domain actually having the IRQ assigned)
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 4148c65657..608583a113 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -170,7 +170,7 @@ static uint32_t __ro_after_init base_disallow_mask;
       is_pv_domain(d)) ?                                        \
      L1_DISALLOW_MASK : (L1_DISALLOW_MASK & ~PAGE_CACHE_ATTRS))
 
-static s8 __read_mostly opt_mmio_relax;
+static int8_t __ro_after_init opt_mmio_relax;
 
 static int __init cf_check parse_mmio_relax(const char *s)
 {
diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index 0c97fbb3fc..ff2e3d8687 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -35,7 +35,7 @@
 #include <xsm/xsm.h>
 #include <xen/vpci.h>
 
-static s8 __read_mostly use_msi = -1;
+static int8_t __ro_after_init use_msi = -1;
 boolean_param("msi", use_msi);
 
 static void __pci_disable_msix(struct msi_desc *entry);
diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c
index 4b0b297c7e..3f2fe54874 100644
--- a/xen/arch/x86/numa.c
+++ b/xen/arch/x86/numa.c
@@ -25,7 +25,7 @@ nodeid_t apicid_to_node[MAX_LOCAL_APIC] = {
     [0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE
 };
 
-s8 acpi_numa = 0;
+int8_t __ro_after_init acpi_numa = 0;
 
 int __init arch_numa_setup(const char *opt)
 {
diff --git a/xen/arch/x86/oprofile/op_model_athlon.c b/xen/arch/x86/oprofile/op_model_athlon.c
index 782fa606ee..bf897a4b63 100644
--- a/xen/arch/x86/oprofile/op_model_athlon.c
+++ b/xen/arch/x86/oprofile/op_model_athlon.c
@@ -157,7 +157,7 @@ static inline u64 op_amd_randomize_ibs_op(u64 val)
          * IbsOpMaxCnt must fit in the range from 0x0081 to
          * 0xff80.
          */
-        val += (s8)(random >> 4);
+        val += (int8_t)(random >> 4);
     else
         val |= (u64)(random & IBS_RANDOM_MASK) << 32;
 
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index c2e0082a30..cd69198326 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -164,7 +164,7 @@ unsigned long __read_mostly mmu_cr4_features = XEN_MINIMAL_CR4;
 
 /* smep: Enable/disable Supervisor Mode Execution Protection */
 #define SMEP_HVM_ONLY (-2)
-static s8 __initdata opt_smep = -1;
+static int8_t __initdata opt_smep = -1;
 
 /*
  * Initial domain place holder. Needs to be global so it can be created in
@@ -201,7 +201,7 @@ custom_param("smep", parse_smep_param);
 
 /* smap: Enable/disable Supervisor Mode Access Prevention */
 #define SMAP_HVM_ONLY (-2)
-static s8 __initdata opt_smap = -1;
+static int8_t __initdata opt_smap = -1;
 
 static int __init cf_check parse_smap_param(const char *s)
 {
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index b796c2f7df..708136f625 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1116,7 +1116,7 @@ void cpuid_hypervisor_leaves(const struct vcpu *v, uint32_t leaf,
             res->a = offset;
             res->b = offset >> 32;
             res->c = d->arch.vtsc_to_ns.mul_frac;
-            res->d = (s8)d->arch.vtsc_to_ns.shift;
+            res->d = d->arch.vtsc_to_ns.shift;
             break;
         }
 
diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/cpufreq.h
index b6cff825ce..3f1b05a02e 100644
--- a/xen/include/acpi/cpufreq/cpufreq.h
+++ b/xen/include/acpi/cpufreq/cpufreq.h
@@ -79,7 +79,7 @@ struct cpufreq_policy {
 
     bool                resume; /* flag for cpufreq 1st run
                                  * S3 wakeup, hotplug cpu, etc */
-    s8                  turbo;  /* tristate flag: 0 for unsupported
+    int8_t              turbo;  /* tristate flag: 0 for unsupported
                                  * -1 for disable, 1 for enabled
                                  * See CPUFREQ_TURBO_* below for defines */
 };
diff --git a/xen/include/xen/linux-compat.h b/xen/include/xen/linux-compat.h
index b289dfd894..1491894feb 100644
--- a/xen/include/xen/linux-compat.h
+++ b/xen/include/xen/linux-compat.h
@@ -11,7 +11,7 @@
 
 #include <xen/types.h>
 
-typedef int8_t  __s8;
+typedef int8_t  s8, __s8;
 typedef uint8_t __u8;
 typedef int16_t __s16;
 typedef int32_t __s32;
diff --git a/xen/include/xen/types.h b/xen/include/xen/types.h
index 449947b353..542dbaf63c 100644
--- a/xen/include/xen/types.h
+++ b/xen/include/xen/types.h
@@ -5,7 +5,6 @@
 #include <xen/stdint.h>
 
 /* Linux inherited types which are being phased out */
-typedef int8_t s8;
 typedef uint8_t u8;
 typedef int16_t s16;
 typedef uint16_t u16, __u16;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 08:00:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 08:00:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.788748.1198224 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slOSn-0006Zy-DG; Tue, 03 Sep 2024 08:00:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 788748.1198224; Tue, 03 Sep 2024 08:00:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slOSn-0006Zq-AZ; Tue, 03 Sep 2024 08:00:33 +0000
Received: by outflank-mailman (input) for mailman id 788748;
 Tue, 03 Sep 2024 08:00:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slOSm-0006Zi-9e
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 08:00:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slOSm-0008FC-8t
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 08:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slOSm-0000MJ-73
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 08:00:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hdRV6LILQdWlZuC7ynk7qe4bqH8QwM4BuRkomXaPiEU=; b=BUZHcO9PtkQGvp6X3+Um+uJTv+
	fEF1ScYaI1vQz/szI+FI3H0K7TmSQDLXasPlPPf0NpQdoCrq5A3fo+kC959d1qqTlv6qkK4zTcOQb
	xX2WzRt4NMKpOS2k2i40i7eZ2XfE3Q0khDpndonb1R267J0sTdYOR+mNfd8vUbnd1Mek=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: drop map-low-16Mb leftovers
Message-Id: <E1slOSm-0000MJ-73@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 08:00:32 +0000

commit 442625ef10fb919b0b55658ecac87cf323fa5af8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Sep 2 11:58:21 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 2 11:58:21 2024 +0200

    x86: drop map-low-16Mb leftovers
    
    Prior work (e.g. cbabbc9f5659 ["x86/boot: Size the boot/directmap
    mappings dynamically"]) has fully eliminated that hardcoded boundary.
    Drop both the linker script assertion (the upper bound is now the stubs
    area) and the artificial extending of xen.efi's image size.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/xen.lds.S | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 9a1dfe1b34..d48de67cfd 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -359,14 +359,6 @@ SECTIONS
 
   DWARF2_DEBUG_SECTIONS
 
-#ifdef EFI
-  /* Trick the linker into setting the image size to no less than 16Mb. */
-  __image_end__ = .;
-  .pad ALIGN(__section_alignment__) : {
-    . = __image_end__ < __image_base__ + MB(16) ? ALIGN(MB(16)) : .;
-  }
-#endif
-
 #ifdef CONFIG_HYPERV_GUEST
   hv_hcall_page = ABSOLUTE(HV_HCALL_PAGE - XEN_VIRT_START + __XEN_VIRT_START);
 #endif
@@ -429,6 +421,3 @@ ASSERT((trampoline_end - trampoline_start) < TRAMPOLINE_SPACE - MBI_SPACE_MIN,
     "not enough room for trampoline and mbi data")
 ASSERT((wakeup_stack - wakeup_stack_start) >= WAKEUP_STACK_MIN,
     "wakeup stack too small")
-
-/* Plenty of boot code assumes that Xen isn't larger than 16M. */
-ASSERT(_end - _start <= MB(16), "Xen too large for early-boot assumptions")
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 08:00:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 08:00:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.788751.1198229 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slOSx-0006d4-El; Tue, 03 Sep 2024 08:00:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 788751.1198229; Tue, 03 Sep 2024 08:00:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slOSx-0006cv-Bz; Tue, 03 Sep 2024 08:00:43 +0000
Received: by outflank-mailman (input) for mailman id 788751;
 Tue, 03 Sep 2024 08:00:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slOSw-0006ce-Ce
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 08:00:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slOSw-0008FM-Bt
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 08:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slOSw-0000Ng-Az
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 08:00:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JtErx/P0VWz/7F+gjVBfBipmQmjP2A+KIi3phMnqMWg=; b=re0gJO0Rh5Ml+uMU731yYgTNS4
	Tvoj7yZvxZGZE7gRN5yPLZSDXt2sr1zogQwtnvtzAnPx5+wUTOak+VZoB2fJeO72tEjqewIr4lBrN
	6guhamiCKCJ+Sc9nDBFi6ANmpYtBZB5BC2QsSGdU8UkJdQM1oeZ8zWcRHFY1dkJ3O3kE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Use C99 types for integers
Message-Id: <E1slOSw-0000Ng-Az@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 08:00:42 +0000

commit e884903ec56be8b0cc658cc5ba7c1cb70f25208d
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Thu Aug 29 12:52:44 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 2 11:42:32 2024 +0100

    x86/boot: Use C99 types for integers
    
    Just style update, no functional change.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/boot/cmdline.c | 30 +++++++++++++++---------------
 xen/arch/x86/boot/defs.h    |  2 +-
 xen/arch/x86/boot/reloc.c   | 38 +++++++++++++++++++-------------------
 3 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/xen/arch/x86/boot/cmdline.c b/xen/arch/x86/boot/cmdline.c
index f9eee756aa..b8ad7f3a14 100644
--- a/xen/arch/x86/boot/cmdline.c
+++ b/xen/arch/x86/boot/cmdline.c
@@ -36,15 +36,15 @@ asm (
 
 /* Keep in sync with trampoline.S:early_boot_opts label! */
 typedef struct __packed {
-    u8 skip_realmode;
-    u8 opt_edd;
-    u8 opt_edid;
-    u8 padding;
+    uint8_t skip_realmode;
+    uint8_t opt_edd;
+    uint8_t opt_edid;
+    uint8_t padding;
 #ifdef CONFIG_VIDEO
-    u16 boot_vid_mode;
-    u16 vesa_width;
-    u16 vesa_height;
-    u16 vesa_depth;
+    uint16_t boot_vid_mode;
+    uint16_t vesa_width;
+    uint16_t vesa_height;
+    uint16_t vesa_depth;
 #endif
 } early_boot_opts_t;
 
@@ -214,7 +214,7 @@ static bool skip_realmode(const char *cmdline)
     return find_opt(cmdline, "no-real-mode", false) || find_opt(cmdline, "tboot=", true);
 }
 
-static u8 edd_parse(const char *cmdline)
+static uint8_t edd_parse(const char *cmdline)
 {
     const char *c;
 
@@ -229,7 +229,7 @@ static u8 edd_parse(const char *cmdline)
     return !strmaxcmp(c, "skipmbr", delim_chars);
 }
 
-static u8 edid_parse(const char *cmdline)
+static uint8_t edid_parse(const char *cmdline)
 {
     const char *c;
 
@@ -245,7 +245,7 @@ static u8 edid_parse(const char *cmdline)
 }
 
 #ifdef CONFIG_VIDEO
-static u16 rows2vmode(unsigned int rows)
+static uint16_t rows2vmode(unsigned int rows)
 {
     switch ( rows )
     {
@@ -300,7 +300,7 @@ static void vga_parse(const char *cmdline, early_boot_opts_t *ebo)
         {
             vesa_width = strtoui(c + strlen("gfx-"), "x", &c);
 
-            if ( vesa_width > U16_MAX )
+            if ( vesa_width > UINT16_MAX )
                 return;
 
             /*
@@ -311,12 +311,12 @@ static void vga_parse(const char *cmdline, early_boot_opts_t *ebo)
             ++c;
             vesa_height = strtoui(c, "x", &c);
 
-            if ( vesa_height > U16_MAX )
+            if ( vesa_height > UINT16_MAX )
                 return;
 
             vesa_depth = strtoui(++c, delim_chars_comma, NULL);
 
-            if ( vesa_depth > U16_MAX )
+            if ( vesa_depth > UINT16_MAX )
                 return;
 
             ebo->vesa_width = vesa_width;
@@ -328,7 +328,7 @@ static void vga_parse(const char *cmdline, early_boot_opts_t *ebo)
         {
             tmp = strtoui(c + strlen("mode-"), delim_chars_comma, NULL);
 
-            if ( tmp > U16_MAX )
+            if ( tmp > UINT16_MAX )
                 return;
 
             ebo->boot_vid_mode = tmp;
diff --git a/xen/arch/x86/boot/defs.h b/xen/arch/x86/boot/defs.h
index 239b9f8716..ee1a4da6af 100644
--- a/xen/arch/x86/boot/defs.h
+++ b/xen/arch/x86/boot/defs.h
@@ -57,7 +57,7 @@ typedef u16 uint16_t;
 typedef u32 uint32_t;
 typedef u64 uint64_t;
 
-#define U16_MAX		((u16)(~0U))
+#define UINT16_MAX	((uint16_t)(~0U))
 #define UINT_MAX	(~0U)
 
 #endif /* __BOOT_DEFS_H__ */
diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c
index 4033557481..589e026ff9 100644
--- a/xen/arch/x86/boot/reloc.c
+++ b/xen/arch/x86/boot/reloc.c
@@ -68,24 +68,24 @@ struct vesa_mode_info {
 #endif /* CONFIG_VIDEO */
 
 #define get_mb2_data(tag, type, member)   (((const multiboot2_tag_##type##_t *)(tag))->member)
-#define get_mb2_string(tag, type, member) ((u32)get_mb2_data(tag, type, member))
+#define get_mb2_string(tag, type, member) ((uint32_t)get_mb2_data(tag, type, member))
 
-static u32 alloc;
+static uint32_t alloc;
 
-static u32 alloc_mem(u32 bytes)
+static uint32_t alloc_mem(uint32_t bytes)
 {
     return alloc -= ALIGN_UP(bytes, 16);
 }
 
-static void zero_mem(u32 s, u32 bytes)
+static void zero_mem(uint32_t s, uint32_t bytes)
 {
     while ( bytes-- )
         *(char *)s++ = 0;
 }
 
-static u32 copy_mem(u32 src, u32 bytes)
+static uint32_t copy_mem(uint32_t src, uint32_t bytes)
 {
-    u32 dst, dst_ret;
+    uint32_t dst, dst_ret;
 
     dst = alloc_mem(bytes);
     dst_ret = dst;
@@ -96,9 +96,9 @@ static u32 copy_mem(u32 src, u32 bytes)
     return dst_ret;
 }
 
-static u32 copy_string(u32 src)
+static uint32_t copy_string(uint32_t src)
 {
-    u32 p;
+    uint32_t p;
 
     if ( !src )
         return 0;
@@ -109,7 +109,7 @@ static u32 copy_string(u32 src)
     return copy_mem(src, p - src + 1);
 }
 
-static struct hvm_start_info *pvh_info_reloc(u32 in)
+static struct hvm_start_info *pvh_info_reloc(uint32_t in)
 {
     struct hvm_start_info *out;
 
@@ -139,7 +139,7 @@ static struct hvm_start_info *pvh_info_reloc(u32 in)
     return out;
 }
 
-static multiboot_info_t *mbi_reloc(u32 mbi_in)
+static multiboot_info_t *mbi_reloc(uint32_t mbi_in)
 {
     int i;
     multiboot_info_t *mbi_out;
@@ -192,7 +192,7 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
 #ifdef CONFIG_VIDEO
     struct boot_video_info *video = NULL;
 #endif
-    u32 ptr;
+    uint32_t ptr;
     unsigned int i, mod_idx = 0;
 
     ptr = alloc_mem(sizeof(*mbi_out));
@@ -203,8 +203,8 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
     ptr = ALIGN_UP(mbi_in + sizeof(*mbi_fix), MULTIBOOT2_TAG_ALIGN);
 
     /* Get the number of modules. */
-    for ( tag = _p(ptr); (u32)tag - mbi_in < mbi_fix->total_size;
-          tag = _p(ALIGN_UP((u32)tag + tag->size, MULTIBOOT2_TAG_ALIGN)) )
+    for ( tag = _p(ptr); (uint32_t)tag - mbi_in < mbi_fix->total_size;
+          tag = _p(ALIGN_UP((uint32_t)tag + tag->size, MULTIBOOT2_TAG_ALIGN)) )
     {
         if ( tag->type == MULTIBOOT2_TAG_TYPE_MODULE )
             ++mbi_out->mods_count;
@@ -228,8 +228,8 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
     ptr = ALIGN_UP(mbi_in + sizeof(*mbi_fix), MULTIBOOT2_TAG_ALIGN);
 
     /* Put all needed data into mbi_out. */
-    for ( tag = _p(ptr); (u32)tag - mbi_in < mbi_fix->total_size;
-          tag = _p(ALIGN_UP((u32)tag + tag->size, MULTIBOOT2_TAG_ALIGN)) )
+    for ( tag = _p(ptr); (uint32_t)tag - mbi_in < mbi_fix->total_size;
+          tag = _p(ALIGN_UP((uint32_t)tag + tag->size, MULTIBOOT2_TAG_ALIGN)) )
     {
         switch ( tag->type )
         {
@@ -272,10 +272,10 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
                 mmap_dst[i].size = sizeof(*mmap_dst);
                 mmap_dst[i].size -= sizeof(mmap_dst[i].size);
                 /* Now copy a given region data. */
-                mmap_dst[i].base_addr_low = (u32)mmap_src->addr;
-                mmap_dst[i].base_addr_high = (u32)(mmap_src->addr >> 32);
-                mmap_dst[i].length_low = (u32)mmap_src->len;
-                mmap_dst[i].length_high = (u32)(mmap_src->len >> 32);
+                mmap_dst[i].base_addr_low = (uint32_t)mmap_src->addr;
+                mmap_dst[i].base_addr_high = (uint32_t)(mmap_src->addr >> 32);
+                mmap_dst[i].length_low = (uint32_t)mmap_src->len;
+                mmap_dst[i].length_high = (uint32_t)(mmap_src->len >> 32);
                 mmap_dst[i].type = mmap_src->type;
                 mmap_src = _p(mmap_src) + get_mb2_data(tag, mmap, entry_size);
             }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 08:00:53 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 08:00:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.788753.1198232 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slOT7-0006gZ-GB; Tue, 03 Sep 2024 08:00:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 788753.1198232; Tue, 03 Sep 2024 08:00:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slOT7-0006gR-Db; Tue, 03 Sep 2024 08:00:53 +0000
Received: by outflank-mailman (input) for mailman id 788753;
 Tue, 03 Sep 2024 08:00:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slOT6-0006gH-GL
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 08:00:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slOT6-0008FT-Fe
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 08:00:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slOT6-0000Or-E0
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 08:00:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mxinxidjPjYoKT7rIBrX4+/27qcD8UqsPD3dfAF0G7k=; b=m88WRl+QQiSj+n3UTUTa4o1kdb
	A+oZEMsInU4hTd7Mnp8fQ7jR8uX6No8sG96dPOQS4R3mjL++Ao5McSEXW4dFvFURKbQgLq1Gcf3a8
	Epr6qaiCJ4pm+ohjdAWV8l0ujdCjO/Va1s5tbC3p324z0IpOohclxcdCaGDD7H/dWacw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/cpu: revert opt_allow_unsafe from __ro_after_init to __read_mostly
Message-Id: <E1slOT6-0000Or-E0@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 08:00:52 +0000

commit 1e6bb29b03680a9d0e12f14c4d406a0d67317ea7
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Sep 2 17:34:54 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 2 17:34:54 2024 +0200

    x86/cpu: revert opt_allow_unsafe from __ro_after_init to __read_mostly
    
    Making opt_allow_unsafe read only after init requires changes to the logic in
    init_amd(), otherwise the following #PF happens on CPU hotplug:
    
    ----[ Xen-4.20.0-1-d  x86_64  debug=y  Tainted:     H  ]----
    CPU:    1
    RIP:    e008:[<ffff82d040291081>] arch/x86/cpu/amd.c#init_amd+0x37f/0x993
    [...]
    Xen call trace:
       [<ffff82d040291081>] R arch/x86/cpu/amd.c#init_amd+0x37f/0x993
       [<ffff82d040291fbe>] F identify_cpu+0x2d4/0x4db
       [<ffff82d04032eeaa>] F start_secondary+0x22e/0x3cf
       [<ffff82d040203327>] F __high_start+0x87/0xa0
    
    Pagetable walk from ffff82d0404011ea:
     L4[0x105] = 000000006fc2e063 ffffffffffffffff
     L3[0x141] = 000000006fc2b063 ffffffffffffffff
     L2[0x002] = 000000807c7ca063 ffffffffffffffff
     L1[0x001] = 800000006f801121 ffffffffffffffff
    
    ****************************************
    Panic on CPU 1:
    FATAL PAGE FAULT
    [error_code=0003]
    Faulting linear address: ffff82d0404011ea
    ****************************************
    
    For the time being revert opt_allow_unsafe to be __read_mostly.
    
    Fixes: bfcb0abb191f ('types: replace remaining uses of s8')
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/amd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index 903be14af4..7da0423039 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -46,7 +46,7 @@ static unsigned int __initdata opt_cpuid_mask_thermal_ecx = ~0u;
 integer_param("cpuid_mask_thermal_ecx", opt_cpuid_mask_thermal_ecx);
 
 /* 1 = allow, 0 = don't allow guest creation, -1 = don't allow boot */
-int8_t __ro_after_init opt_allow_unsafe;
+int8_t __read_mostly opt_allow_unsafe;
 boolean_param("allow_unsafe", opt_allow_unsafe);
 
 /* Signal whether the ACPI C1E quirk is required. */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 10:33:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 10:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.788937.1198443 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slQqP-0007X5-9B; Tue, 03 Sep 2024 10:33:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 788937.1198443; Tue, 03 Sep 2024 10:33:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slQqP-0007Wx-5Y; Tue, 03 Sep 2024 10:33:05 +0000
Received: by outflank-mailman (input) for mailman id 788937;
 Tue, 03 Sep 2024 10:33:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slQqN-0007Wp-TM
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 10:33:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slQqN-0002VC-LZ
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 10:33:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slQqN-0007bv-JD
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 10:33:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6omEMprxIwuLa4h7o8JrkSdRfBkKQXamFONxnISCQ2A=; b=6OFglu2RpC5Bd9P3JryYNJNuwj
	34r611aXvLB3mP5Ep2PwdyCknMXI7vfPhV9RMBgtS8KxJacsS0jln5umLiprFco9DXsGk9FJN2OWs
	kxrpft/qkMiHp1hmFP58mP+huUYgGLy9Fk84Lf0Bgjo5lEX390wlGoT1SBff+t2ca/Fg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libxl: Fix nul-termination of the return value of libxl_xen_console_read_line()
Message-Id: <E1slQqN-0007bv-JD@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 10:33:03 +0000

commit bb03169bcb6ecccf372de1f6b9285cd519a26bb8
Author:     Javi Merino <javi.merino@cloud.com>
AuthorDate: Mon Sep 2 17:38:37 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 10:53:44 2024 +0100

    libxl: Fix nul-termination of the return value of libxl_xen_console_read_line()
    
    When built with ASAN, "xl dmesg" crashes in the "printf("%s", line)"
    call in main_dmesg().  ASAN reports a heap buffer overflow: an
    off-by-one access to cr->buffer.
    
    The readconsole sysctl copies up to count characters into the buffer,
    but it does not add a null character at the end.  Despite the
    documentation of libxl_xen_console_read_line(), line_r is not
    nul-terminated if 16384 characters were copied to the buffer.
    
    Fix this by asking xc_readconsolering() to fill the buffer up to size
    - 1.  As the number of characters in the buffer is only needed in
    libxl_xen_console_read_line(), make it a local variable there instead
    of part of the libxl__xen_console_reader struct.
    
    Fixes: 4024bae739cc ("xl: Add subcommand 'xl dmesg'")
    Reported-by: Edwin Török <edwin.torok@cloud.com>
    Signed-off-by: Javi Merino <javi.merino@cloud.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/libs/light/libxl_console.c  | 19 +++++++++++++++----
 tools/libs/light/libxl_internal.h |  1 -
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/tools/libs/light/libxl_console.c b/tools/libs/light/libxl_console.c
index a563c9d3c7..9f736b8913 100644
--- a/tools/libs/light/libxl_console.c
+++ b/tools/libs/light/libxl_console.c
@@ -774,12 +774,17 @@ libxl_xen_console_reader *
 {
     GC_INIT(ctx);
     libxl_xen_console_reader *cr;
-    unsigned int size = 16384;
+    /*
+     * We want xen to fill the buffer in as few hypercalls as
+     * possible, but xen will not nul-terminate it.  The default size
+     * of Xen's console buffer is 16384.  Leave one byte at the end
+     * for the null character.
+     */
+    unsigned int size = 16384 + 1;
 
     cr = libxl__zalloc(NOGC, sizeof(libxl_xen_console_reader));
     cr->buffer = libxl__zalloc(NOGC, size);
     cr->size = size;
-    cr->count = size;
     cr->clear = clear;
     cr->incremental = 1;
 
@@ -800,10 +805,16 @@ int libxl_xen_console_read_line(libxl_ctx *ctx,
                                 char **line_r)
 {
     int ret;
+    /*
+     * Number of chars to copy into the buffer.  xc_readconsolering()
+     * does not add a null character at the end, so leave a space for
+     * us to add it.
+     */
+    unsigned int nr_chars = cr->size - 1;
     GC_INIT(ctx);
 
     memset(cr->buffer, 0, cr->size);
-    ret = xc_readconsolering(ctx->xch, cr->buffer, &cr->count,
+    ret = xc_readconsolering(ctx->xch, cr->buffer, &nr_chars,
                              cr->clear, cr->incremental, &cr->index);
     if (ret < 0) {
         LOGE(ERROR, "reading console ring buffer");
@@ -811,7 +822,7 @@ int libxl_xen_console_read_line(libxl_ctx *ctx,
         return ERROR_FAIL;
     }
     if (!ret) {
-        if (cr->count) {
+        if (nr_chars) {
             *line_r = cr->buffer;
             ret = 1;
         } else {
diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h
index 089a2f949c..cfac8e18b6 100644
--- a/tools/libs/light/libxl_internal.h
+++ b/tools/libs/light/libxl_internal.h
@@ -2077,7 +2077,6 @@ _hidden char *libxl__uuid2string(libxl__gc *gc, const libxl_uuid uuid);
 struct libxl__xen_console_reader {
     char *buffer;
     unsigned int size;
-    unsigned int count;
     unsigned int clear;
     unsigned int incremental;
     unsigned int index;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 10:33:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 10:33:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.788938.1198447 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slQqZ-0007Z4-AS; Tue, 03 Sep 2024 10:33:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 788938.1198447; Tue, 03 Sep 2024 10:33:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slQqZ-0007Yv-70; Tue, 03 Sep 2024 10:33:15 +0000
Received: by outflank-mailman (input) for mailman id 788938;
 Tue, 03 Sep 2024 10:33:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slQqX-0007Yk-PI
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 10:33:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slQqX-0002VR-OY
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 10:33:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slQqX-0007cV-Nh
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 10:33:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dmAHnFEp5tXhFfAT20rnJxvdixd+L7WCumF8b+ptqzY=; b=XBZ1aQv5T7JqKZ8V4wPFXBH+WU
	NF9a+YJTrvCrxRYrbV5H13gL2+AXFMtkNmQibjx7tEtlb52bRYH2I9ViQ8uGoZD84xEOoSAU/WGSB
	vORcyjh7clCz2bGLEyo7aTipPSeHEznHsT/E2BLY4YRFWktz0FX3Se6ugaLmngEO1wmc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libxl: Remove unnecessary buffer zeroing and zalloc()
Message-Id: <E1slQqX-0007cV-Nh@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 10:33:13 +0000

commit ba5755798e9daf85617876276a3aee5e749d5f2a
Author:     Javi Merino <javi.merino@cloud.com>
AuthorDate: Mon Sep 2 17:38:38 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 10:53:44 2024 +0100

    libxl: Remove unnecessary buffer zeroing and zalloc()
    
    When reading the console, xen overwrites the contents of the buffer,
    so there is no need to zero the buffer before passing it to xen.
    Instead, add a NULL at the end of the buffer.
    
    While we are at it, change the zalloc() of the buffer back to
    malloc() as it was before bdf4131 (libxl: don't leak buf in
    libxl_xen_console_read_start error handling, 2013-12-03).  The comment
    in that commit message says that the intent of the commit was to
    change malloc+memset to zalloc(), but only for the
    libxl_xen_console_reader struct, not for the buffer.
    
    Signed-off-by: Javi Merino <javi.merino@cloud.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/libs/light/libxl_console.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/libs/light/libxl_console.c b/tools/libs/light/libxl_console.c
index 9f736b8913..6c4414fcc1 100644
--- a/tools/libs/light/libxl_console.c
+++ b/tools/libs/light/libxl_console.c
@@ -783,7 +783,7 @@ libxl_xen_console_reader *
     unsigned int size = 16384 + 1;
 
     cr = libxl__zalloc(NOGC, sizeof(libxl_xen_console_reader));
-    cr->buffer = libxl__zalloc(NOGC, size);
+    cr->buffer = libxl__malloc(NOGC, size);
     cr->size = size;
     cr->clear = clear;
     cr->incremental = 1;
@@ -813,7 +813,6 @@ int libxl_xen_console_read_line(libxl_ctx *ctx,
     unsigned int nr_chars = cr->size - 1;
     GC_INIT(ctx);
 
-    memset(cr->buffer, 0, cr->size);
     ret = xc_readconsolering(ctx->xch, cr->buffer, &nr_chars,
                              cr->clear, cr->incremental, &cr->index);
     if (ret < 0) {
@@ -823,6 +822,7 @@ int libxl_xen_console_read_line(libxl_ctx *ctx,
     }
     if (!ret) {
         if (nr_chars) {
+            cr->buffer[nr_chars] = '\0';
             *line_r = cr->buffer;
             ret = 1;
         } else {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 10:33:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 10:33:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.788939.1198450 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slQqj-0007by-Av; Tue, 03 Sep 2024 10:33:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 788939.1198450; Tue, 03 Sep 2024 10:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slQqj-0007bq-8U; Tue, 03 Sep 2024 10:33:25 +0000
Received: by outflank-mailman (input) for mailman id 788939;
 Tue, 03 Sep 2024 10:33:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slQqh-0007bQ-Tx
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 10:33:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slQqh-0002Vf-SW
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 10:33:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slQqh-0007d5-Qj
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 10:33:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=G0N69lAim8sNfF13nVUIQUn1flzVvUG8bwKGoXmD80Y=; b=0ANnHyHX4dxHIhtatXj/Ft94wo
	5FygruqTr0cth+5svAt+bK3FyatiiwutFM1x1M1LB347BxBsQNMOrtiq2ETTqU3bd3aWy7OA5KJ4Y
	8iowFPmfzcCjE7BNq/rbJSnPnDtVqWzjBCmNZ0kHG5hJgtRLcA207avQ8lBgazSFM9mU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libxl: Update the documentation of libxl_xen_console_read_line()
Message-Id: <E1slQqh-0007d5-Qj@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 10:33:23 +0000

commit 87b307ff1de8f5f261eb7c9b94d370fc08e1983e
Author:     Javi Merino <javi.merino@cloud.com>
AuthorDate: Mon Sep 2 17:38:39 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 10:53:44 2024 +0100

    libxl: Update the documentation of libxl_xen_console_read_line()
    
    Despite its name, libxl_xen_console_read_line() does not read a line,
    it fills the buffer with as many characters as fit.  Update the
    documentation to reflect the real behaviour of the function.  Rename
    line_r to avoid confusion since it is a pointer to an array of
    characters.
    
    Signed-off-by: Javi Merino <javi.merino@cloud.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/include/libxl.h            |  2 +-
 tools/libs/light/libxl_console.c | 29 ++++++++++++++++++-----------
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index f5c7167742..8d32428ea9 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -2813,7 +2813,7 @@ libxl_xen_console_reader *
     libxl_xen_console_read_start(libxl_ctx *ctx, int clear);
 int libxl_xen_console_read_line(libxl_ctx *ctx,
                                 libxl_xen_console_reader *cr,
-                                char **line_r);
+                                char **buff);
 void libxl_xen_console_read_finish(libxl_ctx *ctx,
                                    libxl_xen_console_reader *cr);
 
diff --git a/tools/libs/light/libxl_console.c b/tools/libs/light/libxl_console.c
index 6c4414fcc1..044ca64676 100644
--- a/tools/libs/light/libxl_console.c
+++ b/tools/libs/light/libxl_console.c
@@ -792,17 +792,24 @@ libxl_xen_console_reader *
     return cr;
 }
 
-/* return values:                                          *line_r
- *   1          success, whole line obtained from buffer    non-0
- *   0          no more lines available right now           0
- *   negative   error code ERROR_*                          0
- * On success *line_r is updated to point to a nul-terminated
- * string which is valid until the next call on the same console
- * reader.  The libxl caller may overwrite parts of the string
- * if it wishes. */
+/*
+ * Copy part of the console ring into a buffer
+ *
+ * Return values:
+ *   1: Success, *buff points to the string
+ *   0: No more lines available right now
+ *   -ERROR_* on error
+ *
+ * Despite its name, libxl_xen_console_read_line() does not
+ * necessarily read a complete line.  It attempts to fill the buffer
+ * with as many characters as it can accommodate.  The buffer pointed
+ * to by *buff is updated to contain a nul-terminated string.  This
+ * string remains valid until the next call to
+ * libxl_xen_console_read_line() on the same console reader.
+ */
 int libxl_xen_console_read_line(libxl_ctx *ctx,
                                 libxl_xen_console_reader *cr,
-                                char **line_r)
+                                char **buff)
 {
     int ret;
     /*
@@ -823,10 +830,10 @@ int libxl_xen_console_read_line(libxl_ctx *ctx,
     if (!ret) {
         if (nr_chars) {
             cr->buffer[nr_chars] = '\0';
-            *line_r = cr->buffer;
+            *buff = cr->buffer;
             ret = 1;
         } else {
-            *line_r = NULL;
+            *buff = NULL;
             ret = 0;
         }
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 18:55:17 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 18:55:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.789492.1199081 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slYgM-00006L-OT; Tue, 03 Sep 2024 18:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 789492.1199081; Tue, 03 Sep 2024 18:55:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slYgM-00006D-Lg; Tue, 03 Sep 2024 18:55:14 +0000
Received: by outflank-mailman (input) for mailman id 789492;
 Tue, 03 Sep 2024 18:55:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slYgM-000065-54
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 18:55:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slYgM-0003Sj-4F
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 18:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slYgM-0003fK-3D
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 18:55:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FBBuNFUsbkatVsTR3AsuERYgiWt/OhgcrQLN+bRhkBc=; b=D0CXQ/mthdYGOFBEFMm6o8Qaza
	G7P9GfM3KHPM16/QFS25orjInccTzW1oAAV1nLoKMr6E2+2U7uA+koe4UP9QlOTemXEBeOlCuYmNH
	aMS1euz90V71G65kOsZiqK94c/4c5enrI+5Oowns1SfK9F+GOXFU4mZ7mKMdmBYvHc9A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Use <xen/types.h>
Message-Id: <E1slYgM-0003fK-3D@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 18:55:14 +0000

commit 43d4c10dfae19cbdbbcf38e50752b43845638137
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Sep 2 11:54:14 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 15:51:44 2024 +0100

    x86/boot: Use <xen/types.h>
    
    ... rather than opencoding locally.  This also covers NULL and *_MAX.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/boot/cmdline.c |  2 ++
 xen/arch/x86/boot/defs.h    | 17 -----------------
 xen/arch/x86/boot/reloc.c   |  2 ++
 3 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/xen/arch/x86/boot/cmdline.c b/xen/arch/x86/boot/cmdline.c
index b8ad7f3a14..28a47da7ab 100644
--- a/xen/arch/x86/boot/cmdline.c
+++ b/xen/arch/x86/boot/cmdline.c
@@ -31,6 +31,8 @@ asm (
     );
 
 #include <xen/kconfig.h>
+#include <xen/types.h>
+
 #include "defs.h"
 #include "video.h"
 
diff --git a/xen/arch/x86/boot/defs.h b/xen/arch/x86/boot/defs.h
index ee1a4da6af..cf9a80d116 100644
--- a/xen/arch/x86/boot/defs.h
+++ b/xen/arch/x86/boot/defs.h
@@ -20,14 +20,10 @@
 #ifndef __BOOT_DEFS_H__
 #define __BOOT_DEFS_H__
 
-#include <xen/stdbool.h>
-
 #define __maybe_unused	__attribute__((__unused__))
 #define __packed	__attribute__((__packed__))
 #define __stdcall	__attribute__((__stdcall__))
 
-#define NULL		((void *)0)
-
 #define ALIGN_UP(arg, align) \
                 (((arg) + (align) - 1) & ~((typeof(arg))(align) - 1))
 
@@ -47,17 +43,4 @@
 
 #define tolower(c)	((c) | 0x20)
 
-typedef unsigned char u8;
-typedef unsigned short u16;
-typedef unsigned int u32;
-typedef unsigned long long u64;
-typedef unsigned int size_t;
-typedef u8 uint8_t;
-typedef u16 uint16_t;
-typedef u32 uint32_t;
-typedef u64 uint64_t;
-
-#define UINT16_MAX	((uint16_t)(~0U))
-#define UINT_MAX	(~0U)
-
 #endif /* __BOOT_DEFS_H__ */
diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c
index 589e026ff9..ac8b58b695 100644
--- a/xen/arch/x86/boot/reloc.c
+++ b/xen/arch/x86/boot/reloc.c
@@ -26,6 +26,8 @@ asm (
     "    jmp  reloc                    \n"
     );
 
+#include <xen/types.h>
+
 #include "defs.h"
 
 #include <xen/kconfig.h>
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 18:55:17 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 18:55:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.789491.1199076 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slYgD-00004q-Mq; Tue, 03 Sep 2024 18:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 789491.1199076; Tue, 03 Sep 2024 18:55:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slYgD-0008WO-KI; Tue, 03 Sep 2024 18:55:05 +0000
Received: by outflank-mailman (input) for mailman id 789491;
 Tue, 03 Sep 2024 18:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slYgC-0008WI-D6
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 18:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slYgC-0003SM-12
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 18:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slYgB-0003eg-Vs
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 18:55:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=E1kqDlmGBlDyBRKdNlf3jmqMk/+NVQgZVCfr7ppt9E4=; b=JapRPuBPZvcPeIJq5+r84Sia4m
	zZtkhOOsvDnSIDjKHQHDkQCE91HpMbUgLhPxga2tahUsPL4bQo1k4GfVeFSxnXu+WiWg27ukbxM0C
	uEQNc6Hdj/jqHrcF13HPa50MmOM+6Cra63+G0ZTwdOD7/dMIRuAZOrGSYzQH/UVNdKuo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Fix include paths for 32bit objects
Message-Id: <E1slYgB-0003eg-Vs@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 18:55:03 +0000

commit 5f36fab2406299bd2c54074d81fe482af11fb2b9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 3 11:41:56 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 15:51:14 2024 +0100

    x86/boot: Fix include paths for 32bit objects
    
    Most of Xen is build using -nostdinc and a fully specified include path.
    However, the makefile line:
    
      $(head-bin-objs): XEN_CFLAGS := $(CFLAGS_x86_32) -fpic
    
    discards XEN_CFLAGS and replaces them with CFLAGS_x86_32.
    
    Reinstate -nostdinc, and copy the -include and all -I arguments from
    XEN_CFLAGS.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/boot/Makefile | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index 03d8ce3a9e..de47740277 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -14,10 +14,8 @@ $(obj)/head.o: $(head-bin-objs:.o=.bin)
 CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_TREEWIDE_CFLAGS))
 $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
 CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float
-ifneq ($(abs_objtree),$(abs_srctree))
-CFLAGS_x86_32 += -I$(objtree)/include
-endif
-CFLAGS_x86_32 += -I$(srctree)/include
+CFLAGS_x86_32 += -nostdinc -include $(filter %/include/xen/config.h,$(XEN_CFLAGS))
+CFLAGS_x86_32 += $(filter -I%,$(XEN_CFLAGS))
 
 # override for 32bit binaries
 $(head-bin-objs): CFLAGS_stack_boundary :=
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 18:55:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 18:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.789493.1199085 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slYgW-000094-Q8; Tue, 03 Sep 2024 18:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 789493.1199085; Tue, 03 Sep 2024 18:55:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slYgW-00008w-N8; Tue, 03 Sep 2024 18:55:24 +0000
Received: by outflank-mailman (input) for mailman id 789493;
 Tue, 03 Sep 2024 18:55:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slYgW-00008k-8d
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 18:55:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slYgW-0003Su-7s
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 18:55:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slYgW-0003g6-6T
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 18:55:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=czeePxxcQRy6nekO4Jv74SclfUDY3e2TQr6xGre03no=; b=t8nPWuvbE5G0HEaFL+X1sV2VHr
	CqaVl8H2H4wEdgfwYVXS96nbf7R568xqNKBoPQcsm/zYZ2KIOqhH2GU+lJ+eZwZNlpq5kMdQlhRJW
	+l3bB7S6iFM3eQi3CwkVm15oNxF8uZQ6PTFkHZAUzZSd82Oi2y0T6giJv+MOtD4Fu2/w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Use <xen/macros.h>
Message-Id: <E1slYgW-0003g6-6T@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 18:55:24 +0000

commit a268cdc05a1e24e80ed936c94b04785fa64a172a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Sep 2 13:58:09 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 15:51:44 2024 +0100

    x86/boot: Use <xen/macros.h>
    
    ... rather than opencoding locally.
    
    This involve collecting various macros scattered around Xen (min()/max()
    macros from kernel.h, and _p() from lib.h) and moving them into macros.h
    
    In reloc.c, replace ALIGN_UP() with ROUNDUP().
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/boot/cmdline.c |  4 ++++
 xen/arch/x86/boot/defs.h    | 19 -------------------
 xen/arch/x86/boot/reloc.c   | 11 ++++++-----
 xen/include/xen/kernel.h    | 36 +-----------------------------------
 xen/include/xen/lib.h       |  2 --
 xen/include/xen/macros.h    | 44 ++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 55 insertions(+), 61 deletions(-)

diff --git a/xen/arch/x86/boot/cmdline.c b/xen/arch/x86/boot/cmdline.c
index 28a47da7ab..b7375d1066 100644
--- a/xen/arch/x86/boot/cmdline.c
+++ b/xen/arch/x86/boot/cmdline.c
@@ -31,6 +31,7 @@ asm (
     );
 
 #include <xen/kconfig.h>
+#include <xen/macros.h>
 #include <xen/types.h>
 
 #include "defs.h"
@@ -50,6 +51,9 @@ typedef struct __packed {
 #endif
 } early_boot_opts_t;
 
+/* Avoid pulling in all of ctypes.h for this. */
+#define tolower(c)	((c) | 0x20)
+
 /*
  * Space and TAB are obvious delimiters. However, I am
  * adding "\n" and "\r" here too. Just in case when
diff --git a/xen/arch/x86/boot/defs.h b/xen/arch/x86/boot/defs.h
index cf9a80d116..4d519ac4f5 100644
--- a/xen/arch/x86/boot/defs.h
+++ b/xen/arch/x86/boot/defs.h
@@ -24,23 +24,4 @@
 #define __packed	__attribute__((__packed__))
 #define __stdcall	__attribute__((__stdcall__))
 
-#define ALIGN_UP(arg, align) \
-                (((arg) + (align) - 1) & ~((typeof(arg))(align) - 1))
-
-#define min(x,y) ({ \
-        const typeof(x) _x = (x);       \
-        const typeof(y) _y = (y);       \
-        (void) (&_x == &_y);            \
-        _x < _y ? _x : _y; })
-
-#define max(x,y) ({ \
-        const typeof(x) _x = (x);       \
-        const typeof(y) _y = (y);       \
-        (void) (&_x == &_y);            \
-        _x > _y ? _x : _y; })
-
-#define _p(val)		((void *)(unsigned long)(val))
-
-#define tolower(c)	((c) | 0x20)
-
 #endif /* __BOOT_DEFS_H__ */
diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c
index ac8b58b695..eb9902d73f 100644
--- a/xen/arch/x86/boot/reloc.c
+++ b/xen/arch/x86/boot/reloc.c
@@ -26,6 +26,7 @@ asm (
     "    jmp  reloc                    \n"
     );
 
+#include <xen/macros.h>
 #include <xen/types.h>
 
 #include "defs.h"
@@ -76,7 +77,7 @@ static uint32_t alloc;
 
 static uint32_t alloc_mem(uint32_t bytes)
 {
-    return alloc -= ALIGN_UP(bytes, 16);
+    return alloc -= ROUNDUP(bytes, 16);
 }
 
 static void zero_mem(uint32_t s, uint32_t bytes)
@@ -202,11 +203,11 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
     zero_mem(ptr, sizeof(*mbi_out));
 
     /* Skip Multiboot2 information fixed part. */
-    ptr = ALIGN_UP(mbi_in + sizeof(*mbi_fix), MULTIBOOT2_TAG_ALIGN);
+    ptr = ROUNDUP(mbi_in + sizeof(*mbi_fix), MULTIBOOT2_TAG_ALIGN);
 
     /* Get the number of modules. */
     for ( tag = _p(ptr); (uint32_t)tag - mbi_in < mbi_fix->total_size;
-          tag = _p(ALIGN_UP((uint32_t)tag + tag->size, MULTIBOOT2_TAG_ALIGN)) )
+          tag = _p(ROUNDUP((uint32_t)tag + tag->size, MULTIBOOT2_TAG_ALIGN)) )
     {
         if ( tag->type == MULTIBOOT2_TAG_TYPE_MODULE )
             ++mbi_out->mods_count;
@@ -227,11 +228,11 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
     }
 
     /* Skip Multiboot2 information fixed part. */
-    ptr = ALIGN_UP(mbi_in + sizeof(*mbi_fix), MULTIBOOT2_TAG_ALIGN);
+    ptr = ROUNDUP(mbi_in + sizeof(*mbi_fix), MULTIBOOT2_TAG_ALIGN);
 
     /* Put all needed data into mbi_out. */
     for ( tag = _p(ptr); (uint32_t)tag - mbi_in < mbi_fix->total_size;
-          tag = _p(ALIGN_UP((uint32_t)tag + tag->size, MULTIBOOT2_TAG_ALIGN)) )
+          tag = _p(ROUNDUP((uint32_t)tag + tag->size, MULTIBOOT2_TAG_ALIGN)) )
     {
         switch ( tag->type )
         {
diff --git a/xen/include/xen/kernel.h b/xen/include/xen/kernel.h
index bc2440b5f9..c5b6cc9777 100644
--- a/xen/include/xen/kernel.h
+++ b/xen/include/xen/kernel.h
@@ -5,43 +5,9 @@
  * 'kernel.h' contains some often-used function prototypes etc
  */
 
+#include <xen/macros.h>
 #include <xen/types.h>
 
-/*
- * min()/max() macros that also do
- * strict type-checking.. See the
- * "unnecessary" pointer comparison.
- */
-#define min(x,y) ({ \
-        const typeof(x) _x = (x);       \
-        const typeof(y) _y = (y);       \
-        (void) (&_x == &_y);            \
-        _x < _y ? _x : _y; })
-
-#define max(x,y) ({ \
-        const typeof(x) _x = (x);       \
-        const typeof(y) _y = (y);       \
-        (void) (&_x == &_y);            \
-        _x > _y ? _x : _y; })
-
-/*
- * ..and if you can't take the strict
- * types, you can specify one yourself.
- *
- * Or not use min/max at all, of course.
- */
-#define min_t(type,x,y) \
-        ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
-#define max_t(type,x,y) \
-        ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
-
-/*
- * pre-processor, array size, and bit field width suitable variants;
- * please don't use in "normal" expressions.
- */
-#define MIN(x,y) ((x) < (y) ? (x) : (y))
-#define MAX(x,y) ((x) > (y) ? (x) : (y))
-
 /**
  * container_of - cast a member of a structure out to the containing structure
  *
diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
index 394319c818..e884a02ee8 100644
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -57,8 +57,6 @@ static inline void
 debugtrace_printk(const char *fmt, ...) {}
 #endif
 
-/* Allows us to use '%p' as general-purpose machine-word format char. */
-#define _p(_x) ((void *)(unsigned long)(_x))
 extern void printk(const char *fmt, ...)
     __attribute__ ((format (printf, 1, 2), cold));
 
diff --git a/xen/include/xen/macros.h b/xen/include/xen/macros.h
index 44d723fd12..19caaa8026 100644
--- a/xen/include/xen/macros.h
+++ b/xen/include/xen/macros.h
@@ -101,6 +101,50 @@
  */
 #define sizeof_field(type, member) sizeof(((type *)NULL)->member)
 
+/* Cast an arbitrary integer to a pointer. */
+#define _p(x) ((void *)(unsigned long)(x))
+
+/*
+ * min()/max() macros that also do strict type-checking..
+ */
+#define min(x, y)                               \
+    ({                                          \
+        const typeof(x) _x = (x);               \
+        const typeof(y) _y = (y);               \
+        (void)(&_x == &_y); /* typecheck */     \
+        _x < _y ? _x : _y;                      \
+    })
+#define max(x, y)                               \
+    ({                                          \
+        const typeof(x) _x = (x);               \
+        const typeof(y) _y = (y);               \
+        (void)(&_x == &_y); /* typecheck */     \
+        _x > _y ? _x : _y;                      \
+    })
+
+/*
+ * ..and if you can't take the strict types, you can specify one yourself.
+ */
+#define min_t(type, x, y)                       \
+    ({                                          \
+        type __x = (x);                         \
+        type __y = (y);                         \
+        __x < __y ? __x: __y;                   \
+    })
+#define max_t(type, x, y)                       \
+    ({                                          \
+        type __x = (x);                         \
+        type __y = (y);                         \
+        __x > __y ? __x: __y;                   \
+    })
+
+/*
+ * pre-processor, array size, and bit field width suitable variants;
+ * please don't use in "normal" expressions.
+ */
+#define MIN(x, y) ((x) < (y) ? (x) : (y))
+#define MAX(x, y) ((x) > (y) ? (x) : (y))
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __MACROS_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 18:55:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 18:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.789494.1199088 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slYgg-0000D6-R2; Tue, 03 Sep 2024 18:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 789494.1199088; Tue, 03 Sep 2024 18:55:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slYgg-0000Cz-Oa; Tue, 03 Sep 2024 18:55:34 +0000
Received: by outflank-mailman (input) for mailman id 789494;
 Tue, 03 Sep 2024 18:55:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slYgg-0000Cf-CS
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 18:55:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slYgg-0003T1-Bh
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 18:55:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slYgg-0003gY-A1
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 18:55:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UdZJ1AZq7PO7acGEQ6dgDv9hb9OMXTCOcK78mOgDS7w=; b=jMAueXvj/tE0y/8B/eoTck1uTO
	s02N7OLsAisHMO2ZtRoK+tPuTyMFu0DT2EOVeQv4jQKpb9jxkC4HCeeqAp2F2pxqCrJ8ll1FauaKU
	xuT8jpJJUJpyQU5qHyW5aKEN+bnfxRbIqxbMQYeAMPCk6wMwfnyw/43bVW9+6q0qCkxQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Use fastcall for 32bit code
Message-Id: <E1slYgg-0003gY-A1@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 18:55:34 +0000

commit 62da0b364a507d3fe48dcdb7c38592cc1848342f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Sep 2 12:11:51 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 15:51:44 2024 +0100

    x86/boot: Use fastcall for 32bit code
    
    This is marginally more efficient, but is mostly to get rid of the use of
    stdcall in cmdline.c and reloc.c
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/boot/Makefile  |  2 +-
 xen/arch/x86/boot/cmdline.c |  6 +++---
 xen/arch/x86/boot/defs.h    |  1 -
 xen/arch/x86/boot/head.S    | 15 ++++++++-------
 xen/arch/x86/boot/reloc.c   | 12 ++++++------
 5 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index de47740277..8f5bbff0cc 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -13,7 +13,7 @@ $(obj)/head.o: $(head-bin-objs:.o=.bin)
 
 CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_TREEWIDE_CFLAGS))
 $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
-CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float
+CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float -mregparm=3
 CFLAGS_x86_32 += -nostdinc -include $(filter %/include/xen/config.h,$(XEN_CFLAGS))
 CFLAGS_x86_32 += $(filter -I%,$(XEN_CFLAGS))
 
diff --git a/xen/arch/x86/boot/cmdline.c b/xen/arch/x86/boot/cmdline.c
index b7375d1066..c1d21180b6 100644
--- a/xen/arch/x86/boot/cmdline.c
+++ b/xen/arch/x86/boot/cmdline.c
@@ -20,8 +20,8 @@
 
 /*
  * This entry point is entered from xen/arch/x86/boot/head.S with:
- *   - 0x4(%esp) = &cmdline,
- *   - 0x8(%esp) = &early_boot_opts.
+ *   - %eax      = &cmdline,
+ *   - %edx      = &early_boot_opts.
  */
 asm (
     "    .text                         \n"
@@ -347,7 +347,7 @@ static void vga_parse(const char *cmdline, early_boot_opts_t *ebo)
 #endif
 
 /* SAF-1-safe */
-void __stdcall cmdline_parse_early(const char *cmdline, early_boot_opts_t *ebo)
+void cmdline_parse_early(const char *cmdline, early_boot_opts_t *ebo)
 {
     if ( !cmdline )
         return;
diff --git a/xen/arch/x86/boot/defs.h b/xen/arch/x86/boot/defs.h
index 4d519ac4f5..d733ee9b8b 100644
--- a/xen/arch/x86/boot/defs.h
+++ b/xen/arch/x86/boot/defs.h
@@ -22,6 +22,5 @@
 
 #define __maybe_unused	__attribute__((__unused__))
 #define __packed	__attribute__((__packed__))
-#define __stdcall	__attribute__((__stdcall__))
 
 #endif /* __BOOT_DEFS_H__ */
diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index d867b015d9..12bbb97f33 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -613,10 +613,11 @@ trampoline_setup:
 
         /* Save Multiboot / PVH info struct (after relocation) for later use. */
         push    %edx                /* Boot video info to be filled from MB2. */
-        push    %ecx                /* Bottom-most low-memory stack address. */
-        push    %ebx                /* Multiboot / PVH information address. */
-        push    %eax                /* Magic number. */
+        mov     %ebx, %edx          /* Multiboot / PVH information address. */
+        /*      reloc(magic/eax, info/edx, trampoline/ecx, video/stk) using fastcall. */
         call    reloc
+        add     $4, %esp
+
 #ifdef CONFIG_PVH_GUEST
         cmpb    $0, sym_esi(pvh_boot)
         je      1f
@@ -848,9 +849,9 @@ trampoline_setup:
         testl   $MBI_CMDLINE,MB_flags(%ebx)
         jz      1f
 
-        lea     sym_esi(early_boot_opts),%eax
-        push    %eax
-        pushl   MB_cmdline(%ebx)
+        lea     sym_esi(early_boot_opts), %edx
+        mov     MB_cmdline(%ebx), %eax
+        /*      cmdline_parse_early(cmdline/eax, opts/edx) using fastcall. */
         call    cmdline_parse_early
 
 1:
@@ -871,7 +872,7 @@ trampoline_setup:
 
         /*
          * cmdline and reloc are written in C, and linked to be 32bit PIC with
-         * entrypoints at 0 and using the stdcall convention.
+         * entrypoints at 0 and using the fastcall convention.
          */
         ALIGN
 cmdline_parse_early:
diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c
index eb9902d73f..38adca1f36 100644
--- a/xen/arch/x86/boot/reloc.c
+++ b/xen/arch/x86/boot/reloc.c
@@ -14,10 +14,10 @@
 
 /*
  * This entry point is entered from xen/arch/x86/boot/head.S with:
- *   - 0x04(%esp) = MAGIC,
- *   - 0x08(%esp) = INFORMATION_ADDRESS,
- *   - 0x0c(%esp) = TOPMOST_LOW_MEMORY_STACK_ADDRESS.
- *   - 0x10(%esp) = BOOT_VIDEO_INFO_ADDRESS.
+ *   - %eax       = MAGIC,
+ *   - %edx       = INFORMATION_ADDRESS,
+ *   - %ecx       = TOPMOST_LOW_MEMORY_STACK_ADDRESS.
+ *   - 0x04(%esp) = BOOT_VIDEO_INFO_ADDRESS.
  */
 asm (
     "    .text                         \n"
@@ -354,8 +354,8 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
 }
 
 /* SAF-1-safe */
-void *__stdcall reloc(uint32_t magic, uint32_t in, uint32_t trampoline,
-                      uint32_t video_info)
+void *reloc(uint32_t magic, uint32_t in, uint32_t trampoline,
+            uint32_t video_info)
 {
     alloc = trampoline;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 18:55:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 18:55:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.789498.1199093 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slYgr-0000Fk-T3; Tue, 03 Sep 2024 18:55:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 789498.1199093; Tue, 03 Sep 2024 18:55:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slYgr-0000Fc-Q8; Tue, 03 Sep 2024 18:55:45 +0000
Received: by outflank-mailman (input) for mailman id 789498;
 Tue, 03 Sep 2024 18:55:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slYgq-0000FQ-FQ
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 18:55:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slYgq-0003TB-Eg
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 18:55:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slYgq-0003h5-Dm
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 18:55:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cN1a+ZmvyOE9fz4g1UNN7TNzEWHVQFPRut4vXsDEzT0=; b=Zjfw2kTJKtqlpCZTsnoQmfb4gy
	piIoWEuTWV86Y6T7k+e9LJGQfWrbOL75QXa1lnKIgMrX+VKzV3hRhxoGuqSgCwIz3zruAZbMWS0E5
	mk1nt0zcUhuFiABtOsnq32U5xzpu3yCrbE6c5otWMakjdYVhCCsiRKutxt2iHUc53w3Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Use <xen/compiler.h>
Message-Id: <E1slYgq-0003h5-Dm@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 18:55:44 +0000

commit ad783c71f75f4938d00e2c234816e7656d4822a5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Sep 2 13:01:40 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 15:51:44 2024 +0100

    x86/boot: Use <xen/compiler.h>
    
    ... rather than opencoding locally.  With this, defs.h is empty so delete it.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/boot/cmdline.c |  2 +-
 xen/arch/x86/boot/defs.h    | 26 --------------------------
 xen/arch/x86/boot/reloc.c   |  3 +--
 3 files changed, 2 insertions(+), 29 deletions(-)

diff --git a/xen/arch/x86/boot/cmdline.c b/xen/arch/x86/boot/cmdline.c
index c1d21180b6..fc9241ede9 100644
--- a/xen/arch/x86/boot/cmdline.c
+++ b/xen/arch/x86/boot/cmdline.c
@@ -30,11 +30,11 @@ asm (
     "    jmp  cmdline_parse_early      \n"
     );
 
+#include <xen/compiler.h>
 #include <xen/kconfig.h>
 #include <xen/macros.h>
 #include <xen/types.h>
 
-#include "defs.h"
 #include "video.h"
 
 /* Keep in sync with trampoline.S:early_boot_opts label! */
diff --git a/xen/arch/x86/boot/defs.h b/xen/arch/x86/boot/defs.h
deleted file mode 100644
index d733ee9b8b..0000000000
--- a/xen/arch/x86/boot/defs.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * max() was copied from xen/xen/include/xen/kernel.h.
- */
-
-#ifndef __BOOT_DEFS_H__
-#define __BOOT_DEFS_H__
-
-#define __maybe_unused	__attribute__((__unused__))
-#define __packed	__attribute__((__packed__))
-
-#endif /* __BOOT_DEFS_H__ */
diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c
index 38adca1f36..201e38d544 100644
--- a/xen/arch/x86/boot/reloc.c
+++ b/xen/arch/x86/boot/reloc.c
@@ -26,11 +26,10 @@ asm (
     "    jmp  reloc                    \n"
     );
 
+#include <xen/compiler.h>
 #include <xen/macros.h>
 #include <xen/types.h>
 
-#include "defs.h"
-
 #include <xen/kconfig.h>
 #include <xen/multiboot.h>
 #include <xen/multiboot2.h>
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 18:55:56 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 18:55:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.789500.1199097 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slYh1-0000Je-W7; Tue, 03 Sep 2024 18:55:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 789500.1199097; Tue, 03 Sep 2024 18:55:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slYh1-0000JX-TQ; Tue, 03 Sep 2024 18:55:55 +0000
Received: by outflank-mailman (input) for mailman id 789500;
 Tue, 03 Sep 2024 18:55:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slYh0-0000J1-If
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 18:55:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slYh0-0003TK-Ho
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 18:55:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slYh0-0003hW-Gr
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 18:55:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=t25ddU/DmHdN40QSyUo+EUXqos+4xJ63ldWnV1I2usY=; b=HPSFmvLLAJK2C7bRa5Oz1MbREG
	DunoiaoPjQGN1ZaB7aHImKhTP9T9XU2hwKM0q00RFU7pWKJs6hWryEsiSiEDKHIFWAKl7C5bJtfEV
	SA1DmsnWYfwwvlpCmgP4agdPji3ylPeiw8yx1cmu0HIXapMzUl6KQr7yUw15zvAjAtKs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] ARM/div: Drop __div64_fls()
Message-Id: <E1slYh0-0003hW-Gr@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 18:55:54 +0000

commit 2eb32c6c2d3ae25a85409e7388ab01bf3f0487ac
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 23 13:23:00 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 15:51:44 2024 +0100

    ARM/div: Drop __div64_fls()
    
    Following the improvements to Xen's bitops, fls() does constant propagation in
    all cases.  Use it, and drop the local opencoded helper.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/include/asm/div64.h | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/xen/arch/arm/include/asm/div64.h b/xen/arch/arm/include/asm/div64.h
index 0459d5cc01..da1f1fcbd5 100644
--- a/xen/arch/arm/include/asm/div64.h
+++ b/xen/arch/arm/include/asm/div64.h
@@ -102,7 +102,7 @@
 		/* preserve low part of n for reminder computation */	\
 		__r = __n;						\
 		/* determine number of bits to represent __b */		\
-		__p = 1 << __div64_fls(__b);				\
+		__p = 1 << fls(__b);					\
 		/* compute __m = ((__p << 64) + __b - 1) / __b */	\
 		__m = (~0ULL / __b) * __p;				\
 		__m += (((~0ULL % __b + 1) * __p) + __b - 1) / __b;	\
@@ -150,8 +150,8 @@
 				__p /= (__m & -__m);			\
 				__m /= (__m & -__m);			\
 			} else {					\
-				__p >>= __div64_fls(__bits);		\
-				__m >>= __div64_fls(__bits);		\
+				__p >>= fls(__bits);			\
+				__m >>= fls(__bits);			\
 			}						\
 			/* No correction needed. */			\
 			__c = 0;					\
@@ -217,18 +217,6 @@
 	__r;								\
 })
 
-/* our own fls implementation to make sure constant propagation is fine */
-#define __div64_fls(bits)						\
-({									\
-	unsigned int __left = (bits), __nr = 0;				\
-	if (__left & 0xffff0000) __nr += 16, __left >>= 16;		\
-	if (__left & 0x0000ff00) __nr +=  8, __left >>=  8;		\
-	if (__left & 0x000000f0) __nr +=  4, __left >>=  4;		\
-	if (__left & 0x0000000c) __nr +=  2, __left >>=  2;		\
-	if (__left & 0x00000002) __nr +=  1;				\
-	__nr;								\
-})
-
 #endif /* GCC version */
 
 #endif /* BITS_PER_LONG */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 18:56:06 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 18:56:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.789502.1199100 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slYhC-0000Mn-1J; Tue, 03 Sep 2024 18:56:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 789502.1199100; Tue, 03 Sep 2024 18:56:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slYhB-0000Mg-V8; Tue, 03 Sep 2024 18:56:05 +0000
Received: by outflank-mailman (input) for mailman id 789502;
 Tue, 03 Sep 2024 18:56:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slYhA-0000MS-M3
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 18:56:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slYhA-0003Te-LN
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 18:56:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slYhA-0003io-Jt
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 18:56:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5ZVC/e37206fMR08LP990x1reKk0YULsSlfPvRmU0oE=; b=jYZLe5nWHDNuX5v4N4xWwuBhTi
	S01ySfrYSWE6nuffBiVuSochWU06rzQDWBIdwrysnzdEURUUhGucv8IWINedUA4bL+jy5L1trTcvo
	4vFJuzeBs1j9tzUqvFFUUNjFo25QHcMgnzitMSK36S2kEazGnHrR7omt+huyl1FezONA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] ARM/vgic: Correct the expression for lr_all_full()
Message-Id: <E1slYhA-0003io-Jt@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 18:56:04 +0000

commit bad717f845782b4aa9699544428d4d5f3073cd24
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 30 15:20:17 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 15:51:44 2024 +0100

    ARM/vgic: Correct the expression for lr_all_full()
    
    The current expression hits UB with 31 LRs (shifting into the sign bit), and
    malfunctions with 32 LRs (shifting beyond the range of int).  Swapping 1 for
    1ULL fixes some of these, but still malfunctions at 64 LRs which is the
    architectural limit.
    
    Instead, shift -1ULL right in order to create the mask.
    
    Fixes: 596f885a3202 ("xen/arm: set GICH_HCR_UIE if all the LRs are in use")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/gic-vgic.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/gic-vgic.c b/xen/arch/arm/gic-vgic.c
index 9aa245a36d..3f14aab2ef 100644
--- a/xen/arch/arm/gic-vgic.c
+++ b/xen/arch/arm/gic-vgic.c
@@ -16,7 +16,8 @@
 #include <asm/gic.h>
 #include <asm/vgic.h>
 
-#define lr_all_full() (this_cpu(lr_mask) == ((1 << gic_get_nr_lrs()) - 1))
+#define lr_all_full()                                           \
+    (this_cpu(lr_mask) == (-1ULL >> (64 - gic_get_nr_lrs())))
 
 #undef GIC_DEBUG
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 18:56:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 18:56:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.789504.1199105 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slYhM-0000t4-36; Tue, 03 Sep 2024 18:56:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 789504.1199105; Tue, 03 Sep 2024 18:56:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slYhM-0000sw-0L; Tue, 03 Sep 2024 18:56:16 +0000
Received: by outflank-mailman (input) for mailman id 789504;
 Tue, 03 Sep 2024 18:56:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slYhK-0000si-Op
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 18:56:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slYhK-0003U1-O6
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 18:56:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slYhK-0003jH-NR
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 18:56:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BTGmHsROS8UwPi1G0rvz67oqZCq0GvAJ2xInp+gEymc=; b=pws2Es7hIJqvfR78xlrk50/hUr
	8WTwdXI92tC1bZDrEATbL3i49NCUP1rUzGiueJfHK94hAPK4OpxRHVEkZZzkfzrXcSB2fW9VUxLLO
	u+FJQeuIpPhc0OglcSB5yBxRc4kZ3cIaFl1Lkp4v68j5SXzYU2qRiAM0B5NesquQ+pj4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] ARM/vgic: Use for_each_set_bit() in gic_find_unused_lr()
Message-Id: <E1slYhK-0003jH-NR@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 18:56:14 +0000

commit e9c703f85efcb61f67625c39b1e60c62e90d19fd
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 30 16:32:08 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 15:51:44 2024 +0100

    ARM/vgic: Use for_each_set_bit() in gic_find_unused_lr()
    
    There are no bits set in lr_mask beyond nr_lrs, so when substituting
    bitmap_for_each() for for_each_set_bit(), we don't need to worry about the
    upper bound.
    
    However, the type of lr_mask does matter, so switch it to be uint64_t * and
    move unsigned long * override until the find_next_zero_bit() call.
    
    Move lr_val into a narrower scope and drop used_lr as it's declared by
    for_each_set_bit() itself.
    
    Drop the nr_lrs variable and use gic_get_nr_lrs() in the one location its now
    used.  It hides a triple pointer dereference, and while it may not be needed
    in the PRISTINE case, it certainly doesn't need to be live across the rest of
    the function.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/gic-vgic.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/xen/arch/arm/gic-vgic.c b/xen/arch/arm/gic-vgic.c
index 3f14aab2ef..ea48c5375a 100644
--- a/xen/arch/arm/gic-vgic.c
+++ b/xen/arch/arm/gic-vgic.c
@@ -102,25 +102,23 @@ static unsigned int gic_find_unused_lr(struct vcpu *v,
                                        struct pending_irq *p,
                                        unsigned int lr)
 {
-    unsigned int nr_lrs = gic_get_nr_lrs();
-    unsigned long *lr_mask = (unsigned long *) &this_cpu(lr_mask);
-    struct gic_lr lr_val;
+    uint64_t *lr_mask = &this_cpu(lr_mask);
 
     ASSERT(spin_is_locked(&v->arch.vgic.lock));
 
     if ( unlikely(test_bit(GIC_IRQ_GUEST_PRISTINE_LPI, &p->status)) )
     {
-        unsigned int used_lr;
-
-        bitmap_for_each ( used_lr, lr_mask, nr_lrs )
+        for_each_set_bit ( used_lr, *lr_mask )
         {
+            struct gic_lr lr_val;
+
             gic_hw_ops->read_lr(used_lr, &lr_val);
             if ( lr_val.virq == p->irq )
                 return used_lr;
         }
     }
 
-    lr = find_next_zero_bit(lr_mask, nr_lrs, lr);
+    lr = find_next_zero_bit((unsigned long *)lr_mask, gic_get_nr_lrs(), lr);
 
     return lr;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 21:22:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 21:22:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.789566.1199148 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slayS-0002n3-Py; Tue, 03 Sep 2024 21:22:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 789566.1199148; Tue, 03 Sep 2024 21:22:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slayS-0002mv-NL; Tue, 03 Sep 2024 21:22:04 +0000
Received: by outflank-mailman (input) for mailman id 789566;
 Tue, 03 Sep 2024 21:22:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slayR-0002mp-Hd
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 21:22:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slayR-0005ul-C7
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 21:22:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slayR-0004Jh-Ag
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 21:22:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BTK5gsX7S5eQMnrpjKnYP2UzubmSUoPGPrJhq4lvN9A=; b=5DFNRi5O15NX7MmEoA5EfVMo0T
	RbfG6ff4lqagAdj5T4OLUFfszUP5ZntqPFYPXN14JSXmJjXfqeY5cbueRMdTcKssVI/YxC3JJwiXh
	E7UTTdcLWNWeyIYF2Kth1Q9w9yDJh/rAd9OdT+PiWWTqhMmBBdwL9yxhzLv2MCu5OsUk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/compiler: Rename __attribute_const__ to attr_const
Message-Id: <E1slayR-0004Jh-Ag@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 21:22:03 +0000

commit 3cbd5f0c187d4f8bf4db80024302cd240a61364d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Aug 28 20:42:15 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 20:22:18 2024 +0100

    xen/compiler: Rename __attribute_const__ to attr_const
    
    There's no need for the name to be so verbose.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/libs/guest/xg_dom_decompress_unsafe_zstd.c |  2 +-
 xen/arch/arm/include/asm/arm64/cpufeature.h      | 12 ++++++------
 xen/arch/x86/include/asm/byteorder.h             |  4 ++--
 xen/arch/x86/include/asm/endbr.h                 |  4 ++--
 xen/include/xen/byteorder/swab.h                 |  6 +++---
 xen/include/xen/compiler.h                       |  2 +-
 6 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/tools/libs/guest/xg_dom_decompress_unsafe_zstd.c b/tools/libs/guest/xg_dom_decompress_unsafe_zstd.c
index 7cd266444b..ff45732a36 100644
--- a/tools/libs/guest/xg_dom_decompress_unsafe_zstd.c
+++ b/tools/libs/guest/xg_dom_decompress_unsafe_zstd.c
@@ -22,7 +22,7 @@ typedef uint16_t __be16;
 typedef uint32_t __be32;
 typedef uint64_t __be64;
 
-#define __attribute_const__
+#define attr_const
 #define __force
 #define always_inline
 #define noinline
diff --git a/xen/arch/arm/include/asm/arm64/cpufeature.h b/xen/arch/arm/include/asm/arm64/cpufeature.h
index d9b9fa77cb..1bb503e857 100644
--- a/xen/arch/arm/include/asm/arm64/cpufeature.h
+++ b/xen/arch/arm/include/asm/arm64/cpufeature.h
@@ -44,25 +44,25 @@ struct arm64_ftr_bits {
 	s64		safe_val; /* safe value for FTR_EXACT features */
 };
 
-static inline int __attribute_const__
+static inline int attr_const
 cpuid_feature_extract_signed_field_width(u64 features, int field, int width)
 {
 	return (s64)(features << (64 - width - field)) >> (64 - width);
 }
 
-static inline int __attribute_const__
+static inline int attr_const
 cpuid_feature_extract_signed_field(u64 features, int field)
 {
 	return cpuid_feature_extract_signed_field_width(features, field, 4);
 }
 
-static inline unsigned int __attribute_const__
+static inline unsigned int attr_const
 cpuid_feature_extract_unsigned_field_width(u64 features, int field, int width)
 {
 	return (u64)(features << (64 - width - field)) >> (64 - width);
 }
 
-static inline unsigned int __attribute_const__
+static inline unsigned int attr_const
 cpuid_feature_extract_unsigned_field(u64 features, int field)
 {
 	return cpuid_feature_extract_unsigned_field_width(features, field, 4);
@@ -73,7 +73,7 @@ static inline u64 arm64_ftr_mask(const struct arm64_ftr_bits *ftrp)
 	return (u64)GENMASK(ftrp->shift + ftrp->width - 1, ftrp->shift);
 }
 
-static inline int __attribute_const__
+static inline int attr_const
 cpuid_feature_extract_field_width(u64 features, int field, int width, bool sign)
 {
 	return (sign) ?
@@ -81,7 +81,7 @@ cpuid_feature_extract_field_width(u64 features, int field, int width, bool sign)
 		cpuid_feature_extract_unsigned_field_width(features, field, width);
 }
 
-static inline int __attribute_const__
+static inline int attr_const
 cpuid_feature_extract_field(u64 features, int field, bool sign)
 {
 	return cpuid_feature_extract_field_width(features, field, 4, sign);
diff --git a/xen/arch/x86/include/asm/byteorder.h b/xen/arch/x86/include/asm/byteorder.h
index e935f7b2b0..a877c07f67 100644
--- a/xen/arch/x86/include/asm/byteorder.h
+++ b/xen/arch/x86/include/asm/byteorder.h
@@ -4,13 +4,13 @@
 #include <xen/types.h>
 #include <xen/compiler.h>
 
-static inline __attribute_const__ __u32 ___arch__swab32(__u32 x)
+static inline attr_const __u32 ___arch__swab32(__u32 x)
 {
     asm("bswap %0" : "=r" (x) : "0" (x));
     return x;
 }
 
-static inline __attribute_const__ __u64 ___arch__swab64(__u64 val)
+static inline attr_const __u64 ___arch__swab64(__u64 val)
 { 
     union { 
         struct { __u32 a,b; } s;
diff --git a/xen/arch/x86/include/asm/endbr.h b/xen/arch/x86/include/asm/endbr.h
index 3033e40d29..ba3bae7147 100644
--- a/xen/arch/x86/include/asm/endbr.h
+++ b/xen/arch/x86/include/asm/endbr.h
@@ -19,7 +19,7 @@
  * gen_endbr64() is written deliberately to avoid the problematic operand, and
  * marked __const__ as it is safe for the optimiser to hoist/merge/etc.
  */
-static inline uint32_t __attribute_const__ gen_endbr64(void)
+static inline uint32_t attr_const gen_endbr64(void)
 {
     uint32_t res;
 
@@ -45,7 +45,7 @@ static inline void place_endbr64(void *ptr)
  * contain an ENDBR64 instruction.  Use an encoding which isn't the default
  * P6_NOP4.  Specifically, nopw (%rcx)
  */
-static inline uint32_t __attribute_const__ gen_endbr64_poison(void)
+static inline uint32_t attr_const gen_endbr64_poison(void)
 {
     uint32_t res;
 
diff --git a/xen/include/xen/byteorder/swab.h b/xen/include/xen/byteorder/swab.h
index b7e30f0503..9f817e3c44 100644
--- a/xen/include/xen/byteorder/swab.h
+++ b/xen/include/xen/byteorder/swab.h
@@ -123,7 +123,7 @@
 #endif /* OPTIMIZE */
 
 
-static inline __attribute_const__ __u16 __fswab16(__u16 x)
+static inline attr_const __u16 __fswab16(__u16 x)
 {
     return __arch__swab16(x);
 }
@@ -136,7 +136,7 @@ static inline void __swab16s(__u16 *addr)
     __arch__swab16s(addr);
 }
 
-static inline __attribute_const__ __u32 __fswab32(__u32 x)
+static inline attr_const __u32 __fswab32(__u32 x)
 {
     return __arch__swab32(x);
 }
@@ -150,7 +150,7 @@ static inline void __swab32s(__u32 *addr)
 }
 
 #ifdef __BYTEORDER_HAS_U64__
-static inline __attribute_const__ __u64 __fswab64(__u64 x)
+static inline attr_const __u64 __fswab64(__u64 x)
 {
 #  ifdef __SWAB_64_THRU_32__
     __u32 h = x >> 32;
diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
index 444bf80142..b118e4ba62 100644
--- a/xen/include/xen/compiler.h
+++ b/xen/include/xen/compiler.h
@@ -88,7 +88,7 @@
 
 #define __constructor       __attribute__((__constructor__)) cf_check
 #define __pure              __attribute__((__pure__))
-#define __attribute_const__ __attribute__((__const__))
+#define attr_const          __attribute__((__const__))
 #define __transparent__     __attribute__((__transparent_union__))
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 21:22:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 21:22:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.789567.1199153 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slayc-0002p0-RO; Tue, 03 Sep 2024 21:22:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 789567.1199153; Tue, 03 Sep 2024 21:22:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slayc-0002os-Oo; Tue, 03 Sep 2024 21:22:14 +0000
Received: by outflank-mailman (input) for mailman id 789567;
 Tue, 03 Sep 2024 21:22:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slayb-0002oi-GB
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 21:22:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slayb-0005vA-FD
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 21:22:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slayb-0004KW-EB
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 21:22:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Tbfk3xUN4mCzcUsWyLf7WeJZrzS9JxcWLV2eRqYtkLE=; b=gxl/ZWeLlKWAJqYl/xx8omWvvf
	fyrRRLT7bV3FBvNMORSm0LTCoEBnCI8OJZIxWAKTx4QcdyieYgOhIXWuwYOm9jLJ9kssn9mc3dsch
	D3R0zdegGjcPrSuzL/venpQm7RMi+usoR/+W63v/XkL95hcSGnM87RmWypEL5F/eoqjU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/bitops: Switch from __pure to attr_const
Message-Id: <E1slayb-0004KW-EB@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 21:22:13 +0000

commit 11aa8f5ff8b85f51890a425c03f1ee30231b8e77
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Aug 28 20:43:28 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 20:22:18 2024 +0100

    xen/bitops: Switch from __pure to attr_const
    
    All of the ffs()/fls() infrastructure is in fact (attr) const, because it
    doesn't even read global state.  This allows the compiler even more
    flexibility to optimise.
    
    No functional change.
    
    Reported-by: Jan Beulich <JBeulich@suse.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/bitops.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
index 1cd43e464d..94af6da18b 100644
--- a/xen/include/xen/bitops.h
+++ b/xen/include/xen/bitops.h
@@ -32,8 +32,8 @@ extern void __bitop_bad_size(void);
  *
  * Bits are labelled from 1.  Returns 0 if given 0.
  */
-unsigned int __pure generic_ffsl(unsigned long x);
-unsigned int __pure generic_flsl(unsigned long x);
+unsigned int attr_const generic_ffsl(unsigned long x);
+unsigned int attr_const generic_flsl(unsigned long x);
 
 /**
  * generic__test_and_set_bit - Set a bit and return its old value
@@ -204,7 +204,7 @@ static always_inline bool test_bit(int nr, const volatile void *addr)
     test_bit(nr, addr);                                 \
 })
 
-static always_inline __pure unsigned int ffs(unsigned int x)
+static always_inline attr_const unsigned int ffs(unsigned int x)
 {
     if ( __builtin_constant_p(x) )
         return __builtin_ffs(x);
@@ -216,7 +216,7 @@ static always_inline __pure unsigned int ffs(unsigned int x)
 #endif
 }
 
-static always_inline __pure unsigned int ffsl(unsigned long x)
+static always_inline attr_const unsigned int ffsl(unsigned long x)
 {
     if ( __builtin_constant_p(x) )
         return __builtin_ffsl(x);
@@ -228,7 +228,7 @@ static always_inline __pure unsigned int ffsl(unsigned long x)
 #endif
 }
 
-static always_inline __pure unsigned int ffs64(uint64_t x)
+static always_inline attr_const unsigned int ffs64(uint64_t x)
 {
     if ( BITS_PER_LONG == 64 )
         return ffsl(x);
@@ -246,7 +246,7 @@ static always_inline __pure unsigned int ffs64(uint64_t x)
      sizeof(x) <= sizeof(uint64_t) ? ffs64(x) :         \
      ({ BUILD_ERROR("ffs_g() Bad input type"); 0; }))
 
-static always_inline __pure unsigned int fls(unsigned int x)
+static always_inline attr_const unsigned int fls(unsigned int x)
 {
     if ( __builtin_constant_p(x) )
         return x ? 32 - __builtin_clz(x) : 0;
@@ -258,7 +258,7 @@ static always_inline __pure unsigned int fls(unsigned int x)
 #endif
 }
 
-static always_inline __pure unsigned int flsl(unsigned long x)
+static always_inline attr_const unsigned int flsl(unsigned long x)
 {
     if ( __builtin_constant_p(x) )
         return x ? BITS_PER_LONG - __builtin_clzl(x) : 0;
@@ -270,7 +270,7 @@ static always_inline __pure unsigned int flsl(unsigned long x)
 #endif
 }
 
-static always_inline __pure unsigned int fls64(uint64_t x)
+static always_inline attr_const unsigned int fls64(uint64_t x)
 {
     if ( BITS_PER_LONG == 64 )
         return flsl(x);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 21:22:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 21:22:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.789568.1199156 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slaym-0002rw-TT; Tue, 03 Sep 2024 21:22:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 789568.1199156; Tue, 03 Sep 2024 21:22:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slaym-0002ro-QH; Tue, 03 Sep 2024 21:22:24 +0000
Received: by outflank-mailman (input) for mailman id 789568;
 Tue, 03 Sep 2024 21:22:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slayl-0002rM-Is
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 21:22:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slayl-0005vO-IC
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 21:22:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slayl-0004L0-HK
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 21:22:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JGMYcePbI62xTIoMZ9rNXNfai4rNcg0fcf9rYOUi5Yw=; b=YopH+grXXKX3Aiu3jfdOc2rz54
	MX0nYk6FDC3nBPE8OPXkT9dDXU8Riuo55TKxPi3HBYxgWB0JtrzxsDUvajCDKvZY0Yzqmk61aX9hC
	mGiWsC02a91drHLFoRQltaaihopJH5UmjfudMIRMCw0ZTlwm5FYJyAl4BuQNomkA1dAY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/bitops: Introduce a multiple_bits_set() helper
Message-Id: <E1slayl-0004L0-HK@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 21:22:23 +0000

commit bd1664db7b7d1646b9dcd01658c8667bf01a68d5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 22 16:38:53 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 20:22:18 2024 +0100

    xen/bitops: Introduce a multiple_bits_set() helper
    
    This will be used to simplify real logic in the following patch.  Add compile
    and boot time testing as with other bitops.
    
    Because the expression is so simple, implement it as a function-like macro
    which is generic on the type of it's argument, rather than having multiple
    variants.
    
    Testing function-like macros needs a minor adjustments to the infrastructure
    in xen/self-tests.h to avoid bracketing the fn parameter.  The utility of this
    outweighs the associated risks.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/bitops.c          | 23 +++++++++++++++++++++++
 xen/include/xen/bitops.h     | 10 ++++++++++
 xen/include/xen/self-tests.h | 10 ++++++++--
 3 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/xen/common/bitops.c b/xen/common/bitops.c
index 9e532f0d87..b504dd1308 100644
--- a/xen/common/bitops.c
+++ b/xen/common/bitops.c
@@ -112,9 +112,32 @@ static void __init test_for_each_set_bit(void)
         panic("for_each_set_bit(uint64) expected %#"PRIx64", got %#"PRIx64"\n", ull, ull_res);
 }
 
+static void __init test_multiple_bits_set(void)
+{
+    /*
+     * multiple_bits_set() is generic on the type of it's parameter, as the
+     * internal expression is so simple.
+     */
+
+    CHECK(multiple_bits_set, 0, false);
+    CHECK(multiple_bits_set, 1, false);
+    CHECK(multiple_bits_set, 2, false);
+    CHECK(multiple_bits_set, 3, true);
+
+    CHECK(multiple_bits_set, 1 | (1UL << (BITS_PER_LONG - 1)), true);
+#if BITS_PER_LONG > 32
+    CHECK(multiple_bits_set, 1 | (1UL << 32), true);
+#endif
+
+    CHECK(multiple_bits_set, 0x8000000000000001ULL, true);
+    CHECK(multiple_bits_set, 0xc000000000000000ULL, true);
+}
+
 static void __init __constructor test_bitops(void)
 {
     test_ffs();
     test_fls();
     test_for_each_set_bit();
+
+    test_multiple_bits_set();
 }
diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
index 94af6da18b..4d51708c4a 100644
--- a/xen/include/xen/bitops.h
+++ b/xen/include/xen/bitops.h
@@ -296,6 +296,16 @@ static always_inline attr_const unsigned int fls64(uint64_t x)
               __v && ((iter) = ffs_g(__v) - 1, true);   \
               __v &= __v - 1 )
 
+/*
+ * Calculate if a value has two or more bits set.  Always use this in
+ * preference to an expression of the form 'hweight(x) > 1'.
+ */
+#define multiple_bits_set(x)                    \
+    ({                                          \
+        typeof(x) _v = (x);                     \
+        (_v & (_v - 1)) != 0;                   \
+    })
+
 /* --------------------- Please tidy below here --------------------- */
 
 #ifndef find_next_bit
diff --git a/xen/include/xen/self-tests.h b/xen/include/xen/self-tests.h
index e9a8794893..bd8a4867aa 100644
--- a/xen/include/xen/self-tests.h
+++ b/xen/include/xen/self-tests.h
@@ -15,11 +15,14 @@
  *
  * Clang < 8 can't fold constants through static inlines, causing this to
  * fail.  Simply skip it for incredibly old compilers.
+ *
+ * N.B. fn is intentionally not bracketed to allow us to test function-like
+ * macros too.
  */
 #if !defined(CONFIG_CC_IS_CLANG) || CONFIG_CLANG_VERSION >= 80000
 #define COMPILE_CHECK(fn, val, res)                                     \
     do {                                                                \
-        typeof((fn)(val)) real = (fn)(val);                             \
+        typeof(fn(val)) real = fn(val);                                 \
                                                                         \
         if ( !__builtin_constant_p(real) )                              \
             BUILD_ERROR("'" STR(fn(val)) "' not compile-time constant"); \
@@ -34,10 +37,13 @@
  * Check that Xen's runtime logic for fn(val) gives the expected answer.  This
  * requires using HIDE() to prevent the optimiser from collapsing the logic
  * into a constant.
+ *
+ * N.B. fn is intentionally not bracketed to allow us to test function-like
+ * macros too.
  */
 #define RUNTIME_CHECK(fn, val, res)                     \
     do {                                                \
-        typeof((fn)(val)) real = (fn)(HIDE(val));       \
+        typeof(fn(val)) real = fn(HIDE(val));           \
                                                         \
         if ( real != (res) )                            \
             panic("%s: %s(%s) expected %u, got %u\n",   \
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 21:22:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 21:22:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.789571.1199161 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slayw-0002vN-W1; Tue, 03 Sep 2024 21:22:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 789571.1199161; Tue, 03 Sep 2024 21:22:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slayw-0002vF-TE; Tue, 03 Sep 2024 21:22:34 +0000
Received: by outflank-mailman (input) for mailman id 789571;
 Tue, 03 Sep 2024 21:22:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slayv-0002v2-N1
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 21:22:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slayv-0005vW-LQ
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 21:22:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slayv-0004Li-KO
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 21:22:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uvhKtGdvwcGFmzs2RqYWrSO7UdEeY2TOJ/EcgUyvp4w=; b=qsNuFfak9fNwM1xVxaHK7JohKO
	LYPbqDBG5QWgKNpQ/JP8snR7K8IVvsJiIDkcYkmal1dgC5he+/mgJSBxrZr48ctgDbvMGXMPjxt78
	SI/CwjOd1MVi3XoRAFmQHGZEAhQFvetKGyX5qNkdv96/WlaWz/fKjJIllJGHstK6z+wM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/bitops: Convert 'hweight(x) > 1' to new multiple_bits_set()
Message-Id: <E1slayv-0004Li-KO@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 21:22:33 +0000

commit d35fb45d3c7b6d80f290ea6feea978d6ac6cca89
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 22 17:01:53 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 20:22:18 2024 +0100

    xen/bitops: Convert 'hweight(x) > 1' to new multiple_bits_set()
    
    Using hweight() is an especially expensive way of determining simply if
    multiple bits are set in a value.  Worse, 4 of the 10 hweight() calls in Xen
    are of this form.
    
    Switch to the new multiple_bits_set() helper.  This is far more efficient than
    the longhand hweight() algorithm and, owing to its simplicity, likely more
    efficient than even a dedicated instruction on a superscalar processor.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/vpmu.c   |  2 +-
 xen/arch/x86/hvm/vlapic.c | 10 ++++++----
 xen/common/numa.c         |  2 +-
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/cpu/vpmu.c b/xen/arch/x86/cpu/vpmu.c
index b2ba999412..a5bb1689c7 100644
--- a/xen/arch/x86/cpu/vpmu.c
+++ b/xen/arch/x86/cpu/vpmu.c
@@ -673,7 +673,7 @@ long do_xenpmu_op(
     {
         if ( (pmu_params.val &
               ~(XENPMU_MODE_SELF | XENPMU_MODE_HV | XENPMU_MODE_ALL)) ||
-             (hweight64(pmu_params.val) > 1) )
+             multiple_bits_set(pmu_params.val) )
             return -EINVAL;
 
         /* 32-bit dom0 can only sample itself. */
diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 2ec9594271..4a3e21a65f 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -467,12 +467,14 @@ static bool is_multicast_dest(struct vlapic *vlapic, unsigned int short_hand,
         return short_hand != APIC_DEST_SELF;
 
     if ( vlapic_x2apic_mode(vlapic) )
-        return dest_mode ? hweight16(dest) > 1 : dest == 0xffffffffU;
+        return dest_mode ? multiple_bits_set((uint16_t)dest)
+                         : dest == 0xffffffffU;
 
     if ( dest_mode )
-        return hweight8(dest &
-                        GET_xAPIC_DEST_FIELD(vlapic_get_reg(vlapic,
-                                                            APIC_DFR))) > 1;
+    {
+        dest &= GET_xAPIC_DEST_FIELD(vlapic_get_reg(vlapic, APIC_DFR));
+        return multiple_bits_set((uint8_t)dest);
+    }
 
     return dest == 0xff;
 }
diff --git a/xen/common/numa.c b/xen/common/numa.c
index 28a09766fa..ce3991929c 100644
--- a/xen/common/numa.c
+++ b/xen/common/numa.c
@@ -546,7 +546,7 @@ static int __init numa_emulation(unsigned long start_pfn,
     uint64_t sz = pfn_to_paddr(end_pfn - start_pfn) / numa_fake;
 
     /* Kludge needed for the hash function */
-    if ( hweight64(sz) > 1 )
+    if ( multiple_bits_set(sz) )
     {
         uint64_t x = 1;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 21:22:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 21:22:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.789573.1199165 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slaz7-0002yD-18; Tue, 03 Sep 2024 21:22:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 789573.1199165; Tue, 03 Sep 2024 21:22:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slaz6-0002y6-Ug; Tue, 03 Sep 2024 21:22:44 +0000
Received: by outflank-mailman (input) for mailman id 789573;
 Tue, 03 Sep 2024 21:22:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slaz5-0002xn-P5
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 21:22:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slaz5-0005vd-OJ
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 21:22:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slaz5-0004M8-NU
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 21:22:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RAnIBR14vkXxzABO0+ep3NBg8Eb2XLUuYNu/fPSLUas=; b=JhWl4BNVFyyGGwbtRQ6lm6vau+
	abysEs+uguiRFvzdha7y5Gm2AeRzKj7Re3pctco7kHwGY3TH7W35+63+G9wIfCp+4RdcCxuhIoA/M
	dTubyvltqyziU8vS6T2hBSCOsolcleZSk3xr9JAVJmg3u0knQ9YMC9g/Rmn4oW4EJo8Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/bitops: Introduce generic_hweightl() and hweightl()
Message-Id: <E1slaz5-0004M8-NU@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 21:22:43 +0000

commit 6bb2a4ff2df5b39a560beae4b6186e8061a38d66
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 22 19:04:44 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 20:22:18 2024 +0100

    xen/bitops: Introduce generic_hweightl() and hweightl()
    
    There are 6 remaining callers in Xen:
    
      * The two hweight32() calls, _domain_struct_bits() and efi_find_gop_mode(),
        are __init only.
      * The two hweight_long() calls are both in bitmap_weight().
      * The two hweight64() calls are hv_vpset_nr_banks() and x86_emulate().
    
    Only bitmap_weight() and possibly hv_vpset_nr_banks() can be considered fast
    paths, and they're all of GPR-width form.
    
    Furthermore, the differences between a generic int and generic long form is
    only an ADD and SHIFT, and only in !CONFIG_HAS_FAST_MULTIPLY builds.
    
    Therefore, it is definitely not worth having both generic implemenations.
    
    Implement generic_hweightl() based on the current generic_hweight64(),
    adjusted to be compatible with ARM32, along with standard SELF_TESTS.
    
    Implement hweightl() with usual constant-folding and arch opt-in support.  PPC
    is the only architecture that devates from generic, and it simply uses the
    builtin.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/ppc/include/asm/bitops.h |  2 ++
 xen/common/bitops.c               | 14 +++++++++++
 xen/include/xen/bitops.h          | 18 ++++++++++++++
 xen/lib/Makefile                  |  1 +
 xen/lib/generic-hweightl.c        | 49 +++++++++++++++++++++++++++++++++++++++
 5 files changed, 84 insertions(+)

diff --git a/xen/arch/ppc/include/asm/bitops.h b/xen/arch/ppc/include/asm/bitops.h
index eb3355812e..6e4e112b8b 100644
--- a/xen/arch/ppc/include/asm/bitops.h
+++ b/xen/arch/ppc/include/asm/bitops.h
@@ -124,6 +124,8 @@ static inline int test_and_set_bit(unsigned int nr, volatile void *addr)
 #define arch_fls(x)  ((x) ? 32 - __builtin_clz(x) : 0)
 #define arch_flsl(x) ((x) ? BITS_PER_LONG - __builtin_clzl(x) : 0)
 
+#define arch_hweightl(x) __builtin_popcountl(x)
+
 /**
  * hweightN - returns the hamming weight of a N-bit word
  * @x: the word to weigh
diff --git a/xen/common/bitops.c b/xen/common/bitops.c
index b504dd1308..5e5d20d225 100644
--- a/xen/common/bitops.c
+++ b/xen/common/bitops.c
@@ -133,6 +133,19 @@ static void __init test_multiple_bits_set(void)
     CHECK(multiple_bits_set, 0xc000000000000000ULL, true);
 }
 
+static void __init test_hweight(void)
+{
+    /* unsigned int hweightl(unsigned long) */
+    CHECK(hweightl, 0, 0);
+    CHECK(hweightl, 1, 1);
+    CHECK(hweightl, 3, 2);
+    CHECK(hweightl, 7, 3);
+    CHECK(hweightl, 0xff, 8);
+
+    CHECK(hweightl, 1 | (1UL << (BITS_PER_LONG - 1)), 2);
+    CHECK(hweightl, -1UL, BITS_PER_LONG);
+}
+
 static void __init __constructor test_bitops(void)
 {
     test_ffs();
@@ -140,4 +153,5 @@ static void __init __constructor test_bitops(void)
     test_for_each_set_bit();
 
     test_multiple_bits_set();
+    test_hweight();
 }
diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
index 4d51708c4a..dde84443a9 100644
--- a/xen/include/xen/bitops.h
+++ b/xen/include/xen/bitops.h
@@ -35,6 +35,12 @@ extern void __bitop_bad_size(void);
 unsigned int attr_const generic_ffsl(unsigned long x);
 unsigned int attr_const generic_flsl(unsigned long x);
 
+/*
+ * Hamming Weight, also called Population Count.  Returns the number of set
+ * bits in @x.
+ */
+unsigned int attr_const generic_hweightl(unsigned long x);
+
 /**
  * generic__test_and_set_bit - Set a bit and return its old value
  * @nr: Bit to set
@@ -306,6 +312,18 @@ static always_inline attr_const unsigned int fls64(uint64_t x)
         (_v & (_v - 1)) != 0;                   \
     })
 
+static always_inline attr_const unsigned int hweightl(unsigned long x)
+{
+    if ( __builtin_constant_p(x) )
+        return __builtin_popcountl(x);
+
+#ifdef arch_hweightl
+    return arch_hweightl(x);
+#else
+    return generic_hweightl(x);
+#endif
+}
+
 /* --------------------- Please tidy below here --------------------- */
 
 #ifndef find_next_bit
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index a485415964..b6558e108b 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -6,6 +6,7 @@ lib-y += ctype.o
 lib-y += find-next-bit.o
 lib-y += generic-ffsl.o
 lib-y += generic-flsl.o
+lib-y += generic-hweightl.o
 lib-y += list-sort.o
 lib-y += memchr.o
 lib-y += memchr_inv.o
diff --git a/xen/lib/generic-hweightl.c b/xen/lib/generic-hweightl.c
new file mode 100644
index 0000000000..c242d4c2d9
--- /dev/null
+++ b/xen/lib/generic-hweightl.c
@@ -0,0 +1,49 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <xen/bitops.h>
+#include <xen/init.h>
+#include <xen/self-tests.h>
+
+/* Value @b broadcast to every byte in a long */
+#if BITS_PER_LONG == 32
+# define BCST(b) ((b) * 0x01010101UL)
+#elif BITS_PER_LONG == 64
+# define BCST(b) ((b) * 0x0101010101010101UL)
+#else
+# error Extend me please
+#endif
+
+unsigned int generic_hweightl(unsigned long x)
+{
+    x -= (x >> 1) & BCST(0x55);
+    x =  (x & BCST(0x33)) + ((x >> 2) & BCST(0x33));
+    x =  (x + (x >> 4)) & BCST(0x0f);
+
+    if ( IS_ENABLED(CONFIG_HAS_FAST_MULTIPLY) )
+        return (x * BCST(0x01)) >> (BITS_PER_LONG - 8);
+
+    x += x >> 8;
+    x += x >> 16;
+#if BITS_PER_LONG > 32
+    x += x >> 32;
+#endif
+
+    return x & 0xff;
+}
+
+#ifdef CONFIG_SELF_TESTS
+static void __init __constructor test_generic_hweightl(void)
+{
+    RUNTIME_CHECK(generic_hweightl, 0, 0);
+    RUNTIME_CHECK(generic_hweightl, 1, 1);
+    RUNTIME_CHECK(generic_hweightl, 3, 2);
+    RUNTIME_CHECK(generic_hweightl, 7, 3);
+    RUNTIME_CHECK(generic_hweightl, 0xff, 8);
+
+    RUNTIME_CHECK(generic_hweightl, BCST(0x55), BITS_PER_LONG / 2);
+    RUNTIME_CHECK(generic_hweightl, BCST(0xaa), BITS_PER_LONG / 2);
+
+    RUNTIME_CHECK(generic_hweightl, 1 | (1UL << (BITS_PER_LONG - 1)), 2);
+    RUNTIME_CHECK(generic_hweightl, -1UL, BITS_PER_LONG);
+}
+#endif /* CONFIG_SELF_TESTS */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 03 21:22:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Sep 2024 21:22:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.789575.1199169 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slazH-00030w-2b; Tue, 03 Sep 2024 21:22:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 789575.1199169; Tue, 03 Sep 2024 21:22:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slazG-00030o-WE; Tue, 03 Sep 2024 21:22:55 +0000
Received: by outflank-mailman (input) for mailman id 789575;
 Tue, 03 Sep 2024 21:22:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slazF-00030b-T6
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 21:22:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slazF-0005vl-Rw
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 21:22:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slazF-0004Mv-QI
 for xen-changelog@lists.xenproject.org; Tue, 03 Sep 2024 21:22:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/AskD+iLLSKnJkAcoftOlPF+2R7c//jc1fZvXLNir78=; b=IqmTTB+8hogIcxjbq8uvOq4OLl
	n0VYOBA6w/+5aDA7GLDxWugLY0YVccNmozAFBbiLf+owd/NdrxJynaSZQdTXEIjC4B13eUKLMmTxw
	ES3AC1GQpaFBuLjBbIts018QdO72xMOH1+gP6Kzul749avirzR/Nu21bhei9qtn6mNIE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/bitops: Drop hweight_long() and use hweightl()
Message-Id: <E1slazF-0004Mv-QI@xenbits.xenproject.org>
Date: Tue, 03 Sep 2024 21:22:53 +0000

commit 57c8f93fc163a4a4a744aa6ee0301222a44bac4f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 22 21:37:06 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 20:22:18 2024 +0100

    xen/bitops: Drop hweight_long() and use hweightl()
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/bitmap.c      | 4 ++--
 xen/include/xen/bitops.h | 5 -----
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/xen/common/bitmap.c b/xen/common/bitmap.c
index 9d9ff09f3d..3da63a32a6 100644
--- a/xen/common/bitmap.c
+++ b/xen/common/bitmap.c
@@ -191,10 +191,10 @@ unsigned int __bitmap_weight(const unsigned long *bitmap, unsigned int bits)
 	unsigned int k, w = 0, lim = bits / BITS_PER_LONG;
 
 	for (k = 0; k < lim; k++)
-		w += hweight_long(bitmap[k]);
+		w += hweightl(bitmap[k]);
 
 	if (bits % BITS_PER_LONG)
-		w += hweight_long(bitmap[k] & BITMAP_LAST_WORD_MASK(bits));
+		w += hweightl(bitmap[k] & BITMAP_LAST_WORD_MASK(bits));
 
 	return w;
 }
diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
index dde84443a9..ed6b9ccc72 100644
--- a/xen/include/xen/bitops.h
+++ b/xen/include/xen/bitops.h
@@ -446,11 +446,6 @@ static inline unsigned int generic_hweight64(uint64_t w)
     return (w + (w >> 32)) & 0xFF;
 }
 
-static inline unsigned int hweight_long(unsigned long w)
-{
-    return sizeof(w) == 4 ? generic_hweight32(w) : generic_hweight64(w);
-}
-
 /*
  * rol32 - rotate a 32-bit value left
  *
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 04 02:44:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Sep 2024 02:44:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.789712.1199332 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slg04-0002g3-Io; Wed, 04 Sep 2024 02:44:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 789712.1199332; Wed, 04 Sep 2024 02: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 <xen-changelog-bounces@lists.xenproject.org>)
	id 1slg04-0002fv-Fz; Wed, 04 Sep 2024 02:44:04 +0000
Received: by outflank-mailman (input) for mailman id 789712;
 Wed, 04 Sep 2024 02:44:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slg03-0002fn-Kx
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 02:44:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slg03-0003IL-C3
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 02:44:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slg03-00088p-Ab
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 02:44:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9SFK0PJGnbu0xJJ08iJ5NpK3UhMOSjvVvhNspB7Et9Y=; b=c7gG0Z6c4NfqZi9v4VslyNozWW
	yjAPVu2iKHDEJbXmDrLEZSifLMiVEzMTK9D/uoWvAvBHRVM3CYQPztl+tNWY8cOGBHjDg894GILnj
	vTf6fTcJhXEcVcYkCr3T4t6cyaeY1tAWD2bwqThxIta4qdMfSCHhkMAfw6kBxEPo2b/k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs: fusa: Add requirements for generic timer
Message-Id: <E1slg03-00088p-Ab@xenbits.xenproject.org>
Date: Wed, 04 Sep 2024 02:44:03 +0000

commit 51ad2c57a2d21b583a5944a0dc21c709af022f3c
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Thu Aug 29 12:31:20 2024 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 3 19:39:50 2024 -0700

    docs: fusa: Add requirements for generic timer
    
    Add the requirements for the use of generic timer by a domain
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 docs/fusa/reqs/design-reqs/arm64/generic-timer.rst | 123 +++++++++++++++++++++
 docs/fusa/reqs/index.rst                           |   3 +
 docs/fusa/reqs/intro.rst                           |   3 +-
 docs/fusa/reqs/market-reqs/reqs.rst                |  34 ++++++
 docs/fusa/reqs/product-reqs/arm64/reqs.rst         |  23 ++++
 5 files changed, 185 insertions(+), 1 deletion(-)

diff --git a/docs/fusa/reqs/design-reqs/arm64/generic-timer.rst b/docs/fusa/reqs/design-reqs/arm64/generic-timer.rst
new file mode 100644
index 0000000000..f2a0cd7fb8
--- /dev/null
+++ b/docs/fusa/reqs/design-reqs/arm64/generic-timer.rst
@@ -0,0 +1,123 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+Generic Timer
+=============
+
+The following are the requirements related to ARM Generic Timer [1] interface
+exposed by Xen to Arm64 domains.
+
+Probe the Generic Timer device tree node from a domain
+------------------------------------------------------
+
+`XenSwdgn~arm64_generic_timer_probe_dt~1`
+
+Description:
+Xen shall generate a device tree node for the Generic Timer (in accordance to
+ARM architected timer device tree binding [2]) in the domain device tree.
+
+Rationale:
+
+Comments:
+Domains can detect the presence of the Generic Timer device tree node.
+
+Covers:
+ - `XenProd~emulated_timer~1`
+
+Read system counter frequency
+-----------------------------
+
+`XenSwdgn~arm64_generic_timer_read_freq~1`
+
+Description:
+Xen shall expose the frequency of the system counter to the domains in
+CNTFRQ_EL0 register and/or domain device tree's "clock-frequency" property.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_timer~1`
+
+Access CNTKCTL_EL1 system register from a domain
+------------------------------------------------
+
+`XenSwdgn~arm64_generic_timer_access_cntkctlel1~1`
+
+Description:
+Xen shall expose Counter-timer Kernel Control register (CNTKCTL_EL1) to the
+domains.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_timer~1`
+
+Access virtual timer from a domain
+----------------------------------
+
+`XenSwdgn~arm64_generic_timer_access_virtual_timer~1`
+
+Description:
+Xen shall expose the virtual timer registers (CNTVCT_EL0, CNTV_CTL_EL0,
+CNTV_CVAL_EL0, CNTV_TVAL_EL0) to the domains.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_timer~1`
+
+Access physical timer from a domain
+-----------------------------------
+
+`XenSwdgn~arm64_generic_timer_access_physical_timer~1`
+
+Description:
+Xen shall expose physical timer registers (CNTPCT_EL0, CNTP_CTL_EL0,
+CNTP_CVAL_EL0, CNTP_TVAL_EL0) to the domains.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_timer~1`
+
+Trigger the virtual timer interrupt from a domain
+-------------------------------------------------
+
+`XenSwdgn~arm64_generic_timer_trigger_virtual_interrupt~1`
+
+Description:
+Xen shall generate virtual timer interrupts to domains when the virtual timer
+condition is met.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_timer~1`
+
+Trigger the physical timer interrupt from a domain
+--------------------------------------------------
+
+`XenSwdgn~arm64_generic_timer_trigger_physical_interrupt~1`
+
+Description:
+Xen shall generate physical timer interrupts to domains when the physical timer
+condition is met.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_timer~1`
+
+[1] Arm Architecture Reference Manual for A-profile architecture, Chapter 11
+[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/timer/arm,arch_timer.yaml
diff --git a/docs/fusa/reqs/index.rst b/docs/fusa/reqs/index.rst
index 78c02b1d9b..183f183b1f 100644
--- a/docs/fusa/reqs/index.rst
+++ b/docs/fusa/reqs/index.rst
@@ -7,3 +7,6 @@ Requirements documentation
    :maxdepth: 2
 
    intro
+   market-reqs
+   product-reqs
+   design-reqs/arm64
diff --git a/docs/fusa/reqs/intro.rst b/docs/fusa/reqs/intro.rst
index d67b18dd9f..245a219ff2 100644
--- a/docs/fusa/reqs/intro.rst
+++ b/docs/fusa/reqs/intro.rst
@@ -55,7 +55,8 @@ Title of the requirement
   be 'XenMkt', 'XenProd' or 'XenSwdgn' to denote market, product or design
   requirement.
   name - This denotes name of the requirement. In case of architecture specific
-  requirements, this starts with the architecture type (ie x86_64, arm64).
+  requirements, this starts with the architecture type (eg x86_64, arm64)
+  followed by component name (eg generic_timer) and action (eg read_xxx).
   revision number - This gets incremented each time the requirement is modified.
 
 
diff --git a/docs/fusa/reqs/market-reqs/reqs.rst b/docs/fusa/reqs/market-reqs/reqs.rst
new file mode 100644
index 0000000000..9c98c84a9a
--- /dev/null
+++ b/docs/fusa/reqs/market-reqs/reqs.rst
@@ -0,0 +1,34 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+Functional Requirements
+=======================
+
+Run Arm64 VMs
+-------------
+
+`XenMkt~run_arm64_vms~1`
+
+Description:
+Xen shall run Arm64 VMs.
+
+Rationale:
+
+Comments:
+
+Needs:
+ - XenProd
+
+Provide timer to the VMs
+------------------------
+
+`XenMkt~provide_timer_vms~1`
+
+Description:
+Xen shall provide a timer to a VM.
+
+Rationale:
+
+Comments:
+
+Needs:
+ - XenProd
diff --git a/docs/fusa/reqs/product-reqs/arm64/reqs.rst b/docs/fusa/reqs/product-reqs/arm64/reqs.rst
new file mode 100644
index 0000000000..7aa3eeab6a
--- /dev/null
+++ b/docs/fusa/reqs/product-reqs/arm64/reqs.rst
@@ -0,0 +1,23 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+Domain Creation And Runtime
+===========================
+
+Emulated Timer
+--------------
+
+`XenProd~emulated_timer~1`
+
+Description:
+Xen shall grant access to "Arm Generic Timer" for the domains.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenMkt~run_arm64_vms~1`
+ - `XenMkt~provide_timer_vms~1`
+
+Needs:
+ - XenSwdgn
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 04 02:44:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Sep 2024 02:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.789713.1199335 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slg0E-0002jt-Ke; Wed, 04 Sep 2024 02:44:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 789713.1199335; Wed, 04 Sep 2024 02:44:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slg0E-0002je-HY; Wed, 04 Sep 2024 02:44:14 +0000
Received: by outflank-mailman (input) for mailman id 789713;
 Wed, 04 Sep 2024 02:44:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slg0D-0002il-GW
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 02:44:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slg0D-0003IP-Fh
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 02:44:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slg0D-00089o-EK
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 02:44:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=m6cwVt6Yk3baZpUzmarqeMAYA2wkLYjZvpT1v5UEQkI=; b=N21MVWMz1VcErVT+S2odiq4NE+
	y+IRCVkZ3GCm7Fo8wkcZ0S3oiSqdRFhKYzkZUcFtLd6WuCD4DCuEACSJ1p2YzINy/krupepmOFzFV
	IlaeQxObZtyAqCPSPJMBOlH6jqPOwX5IzIZDilY1gBze1DJyKFstocQYdlMKKMj8luFw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: make VMAP support in MMU system only
Message-Id: <E1slg0D-00089o-EK@xenbits.xenproject.org>
Date: Wed, 04 Sep 2024 02:44:13 +0000

commit 82b8aa7680b62f6f469fbc5f5d31ab1568baf5c2
Author:     Penny Zheng <penny.zheng@arm.com>
AuthorDate: Fri Aug 30 10:08:21 2024 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 3 19:40:20 2024 -0700

    xen: make VMAP support in MMU system only
    
    Introduce CONFIG_HAS_VMAP which is selected by the architectures that
    use MMU. vm_init() does not do anything if CONFIG_HAS_VMAP is not
    enabled.
    
    HAS_VMAP is widely used in ALTERNATIVE feature to remap a range of
    memory with new memory attributes. Since this is highly dependent on
    virtual address translation, we choose to make HAS_VMAP selected by
    MMU. And ALTERNATIVE depends on HAS_VMAP.
    
    At the moment, the users of HARDEN_BRANCH_PREDICTOR requires to use the
    vmap() to update the exceptions vectors. While it might be possible to
    rework the code, it is believed that speculative attackes would be
    difficult to exploit on non-MMU because the software is tightly
    controlled. So for now make HARDEN_BRANCH_PREDICTOR to depend on the
    MMU.
    
    Also took the opportunity to remove "#ifdef VMAP_VIRT_START .. endif"
    from vmap.c. Instead vmap.c is compiled when HAS_VMAP is enabled. Thus,
    HAS_VMAP is now enabled from x86, ppc and riscv architectures as all of
    them use MMU and has VMAP_VIRT_START defined.
    
    Signed-off-by: Penny Zheng <penny.zheng@arm.com>
    Signed-off-by: Wei Chen <wei.chen@arm.com>
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/arm/Kconfig   | 4 +++-
 xen/arch/arm/setup.c   | 2 ++
 xen/arch/ppc/Kconfig   | 1 +
 xen/arch/riscv/Kconfig | 1 +
 xen/arch/x86/Kconfig   | 1 +
 xen/common/Kconfig     | 3 +++
 xen/common/Makefile    | 2 +-
 xen/common/vmap.c      | 2 --
 xen/include/xen/vmap.h | 2 ++
 9 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 21d03d9f44..323c967361 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -12,7 +12,7 @@ config ARM_64
 config ARM
 	def_bool y
 	select FUNCTION_ALIGNMENT_4B
-	select HAS_ALTERNATIVE
+	select HAS_ALTERNATIVE if HAS_VMAP
 	select HAS_DEVICE_TREE
 	select HAS_PASSTHROUGH
 	select HAS_UBSAN
@@ -61,6 +61,7 @@ config PADDR_BITS
 config MMU
 	def_bool y
 	select HAS_PMAP
+	select HAS_VMAP
 
 source "arch/Kconfig"
 
@@ -171,6 +172,7 @@ config ARM_SSBD
 
 config HARDEN_BRANCH_PREDICTOR
 	bool "Harden the branch predictor against aliasing attacks" if EXPERT
+	depends on MMU
 	default y
 	help
 	  Speculation attacks against some high-performance processors rely on
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 961d3ea670..71ebaa77ca 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -446,7 +446,9 @@ void asmlinkage __init start_xen(unsigned long fdt_paddr)
      * It needs to be called after do_initcalls to be able to use
      * stop_machine (tasklets initialized via an initcall).
      */
+#ifdef CONFIG_HAS_ALTERNATIVE
     apply_alternatives_all();
+#endif
     enable_errata_workarounds();
     enable_cpu_features();
 
diff --git a/xen/arch/ppc/Kconfig b/xen/arch/ppc/Kconfig
index f6a77a8200..6db575a48d 100644
--- a/xen/arch/ppc/Kconfig
+++ b/xen/arch/ppc/Kconfig
@@ -2,6 +2,7 @@ config PPC
 	def_bool y
 	select FUNCTION_ALIGNMENT_4B
 	select HAS_DEVICE_TREE
+	select HAS_VMAP
 
 config PPC64
 	def_bool y
diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig
index 259eea8d3b..7a113c7774 100644
--- a/xen/arch/riscv/Kconfig
+++ b/xen/arch/riscv/Kconfig
@@ -3,6 +3,7 @@ config RISCV
 	select FUNCTION_ALIGNMENT_16B
 	select GENERIC_BUG_FRAME
 	select HAS_DEVICE_TREE
+	select HAS_VMAP
 
 config RISCV_64
 	def_bool y
diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index d0aaf359eb..dee8db45e8 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -29,6 +29,7 @@ config X86
 	select HAS_PIRQ
 	select HAS_SCHED_GRANULARITY
 	select HAS_UBSAN
+	select HAS_VMAP
 	select HAS_VPCI if HVM
 	select NEEDS_LIBELF
 
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 565ceda741..90268d9249 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -83,6 +83,9 @@ config HAS_SCHED_GRANULARITY
 config HAS_UBSAN
 	bool
 
+config HAS_VMAP
+	bool
+
 config MEM_ACCESS_ALWAYS_ON
 	bool
 
diff --git a/xen/common/Makefile b/xen/common/Makefile
index 7e66802a9e..fc52e0857d 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -52,7 +52,7 @@ obj-$(CONFIG_TRACEBUFFER) += trace.o
 obj-y += version.o
 obj-y += virtual_region.o
 obj-y += vm_event.o
-obj-y += vmap.o
+obj-$(CONFIG_HAS_VMAP) += vmap.o
 obj-y += vsprintf.o
 obj-y += wait.o
 obj-bin-y += warning.init.o
diff --git a/xen/common/vmap.c b/xen/common/vmap.c
index ced9cbf26f..47225fecc0 100644
--- a/xen/common/vmap.c
+++ b/xen/common/vmap.c
@@ -1,4 +1,3 @@
-#ifdef VMAP_VIRT_START
 #include <xen/bitmap.h>
 #include <xen/sections.h>
 #include <xen/init.h>
@@ -427,4 +426,3 @@ void *_xvrealloc(void *va, size_t size, unsigned int align)
 
     return ptr;
 }
-#endif
diff --git a/xen/include/xen/vmap.h b/xen/include/xen/vmap.h
index fdae37e950..c1dd7ac22f 100644
--- a/xen/include/xen/vmap.h
+++ b/xen/include/xen/vmap.h
@@ -141,7 +141,9 @@ void *arch_vmap_virt_end(void);
 /* Initialises the VMAP_DEFAULT virtual range */
 static inline void vm_init(void)
 {
+#ifdef CONFIG_HAS_VMAP
     vm_init_type(VMAP_DEFAULT, (void *)VMAP_VIRT_START, arch_vmap_virt_end());
+#endif
 }
 
 #endif /* __XEN_VMAP_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 04 02:44:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Sep 2024 02:44:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.789714.1199340 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slg0O-0002nZ-N3; Wed, 04 Sep 2024 02:44:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 789714.1199340; Wed, 04 Sep 2024 02:44:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slg0O-0002nP-KS; Wed, 04 Sep 2024 02:44:24 +0000
Received: by outflank-mailman (input) for mailman id 789714;
 Wed, 04 Sep 2024 02:44:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slg0N-0002nF-JN
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 02:44:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slg0N-0003It-IY
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 02:44:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slg0N-0008AX-Hj
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 02:44:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aMFRhot9jlHUsseKkMjirq25F1q6rrpQZ/Wu4TCSidA=; b=M+PjQriAunR66+VFUOfHvQUUTJ
	Z1Qf2h0jLRC6eufZFrmXuhxurFGKBWHEA9kGa5hEe23v7Vidgpe4gSgVcVztYW+hJ17K34ywsYbOV
	PEkbe4Hyhox3y2sBFNQwMbp7RnvRUxbsxrdGy33mr2YL53D3U2o+LEvtWphH8osYccFw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arm/div64: Drop do_div() macro for GCC version < 4
Message-Id: <E1slg0N-0008AX-Hj@xenbits.xenproject.org>
Date: Wed, 04 Sep 2024 02:44:23 +0000

commit 92b6f2f742431c8fc5328ebcc178da7fbeae85b2
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Sep 3 14:48:34 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 3 19:41:31 2024 -0700

    arm/div64: Drop do_div() macro for GCC version < 4
    
    As stated in README, the minimum supported GCC version for arm32 is
    4.9, therefore drop the custom do_div() macro in favor of using the
    optimized version.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/div64.h | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/xen/arch/arm/include/asm/div64.h b/xen/arch/arm/include/asm/div64.h
index da1f1fcbd5..8fe17f0ff2 100644
--- a/xen/arch/arm/include/asm/div64.h
+++ b/xen/arch/arm/include/asm/div64.h
@@ -54,20 +54,6 @@
 	__rem;							\
 })
 
-#if __GNUC__ < 4
-
-/*
- * gcc versions earlier than 4.0 are simply too problematic for the
- * optimized implementation below. First there is gcc PR 15089 that
- * tend to trig on more complex constructs, spurious .global __udivsi3
- * are inserted even if none of those symbols are referenced in the
- * generated code, and those gcc versions are not able to do constant
- * propagation on long long values anyway.
- */
-#define do_div(n, base) __do_div_asm(n, base)
-
-#elif __GNUC__ >= 4
-
 #include <xen/bug.h>
 
 /*
@@ -217,8 +203,6 @@
 	__r;								\
 })
 
-#endif /* GCC version */
-
 #endif /* BITS_PER_LONG */
 
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 04 03:55:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Sep 2024 03:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.789738.1199363 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slh6l-0008T9-1w; Wed, 04 Sep 2024 03:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 789738.1199363; Wed, 04 Sep 2024 03:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slh6k-0008T2-VV; Wed, 04 Sep 2024 03:55:02 +0000
Received: by outflank-mailman (input) for mailman id 789738;
 Wed, 04 Sep 2024 03:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slh6j-0008Sv-Sx
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 03:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slh6j-0004aa-GA
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 03:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slh6j-0007ee-Dd
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 03:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9a00crA3gNEAsDxi1mzVkRuqUJDRiFRzZThC3Pek0LY=; b=1CAAE342ntSQWysGxW7AinHWGV
	PFBkLDRKezzG1CDqTg98TyVdIkpaKz7qiF5KhdrO3xiQsl0C4FYGyLkt832+gpaB+Oud00a+NbwVF
	F/j7KujixLUTk3v1CprYAitc2xCKfXU86RatRX3PJ6NSXltExoRrBYqldfBP9o+l08kY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: Fix nul-termination of the return value of libxl_xen_console_read_line()
Message-Id: <E1slh6j-0007ee-Dd@xenbits.xenproject.org>
Date: Wed, 04 Sep 2024 03:55:01 +0000

commit bb03169bcb6ecccf372de1f6b9285cd519a26bb8
Author:     Javi Merino <javi.merino@cloud.com>
AuthorDate: Mon Sep 2 17:38:37 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 10:53:44 2024 +0100

    libxl: Fix nul-termination of the return value of libxl_xen_console_read_line()
    
    When built with ASAN, "xl dmesg" crashes in the "printf("%s", line)"
    call in main_dmesg().  ASAN reports a heap buffer overflow: an
    off-by-one access to cr->buffer.
    
    The readconsole sysctl copies up to count characters into the buffer,
    but it does not add a null character at the end.  Despite the
    documentation of libxl_xen_console_read_line(), line_r is not
    nul-terminated if 16384 characters were copied to the buffer.
    
    Fix this by asking xc_readconsolering() to fill the buffer up to size
    - 1.  As the number of characters in the buffer is only needed in
    libxl_xen_console_read_line(), make it a local variable there instead
    of part of the libxl__xen_console_reader struct.
    
    Fixes: 4024bae739cc ("xl: Add subcommand 'xl dmesg'")
    Reported-by: Edwin Török <edwin.torok@cloud.com>
    Signed-off-by: Javi Merino <javi.merino@cloud.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/libs/light/libxl_console.c  | 19 +++++++++++++++----
 tools/libs/light/libxl_internal.h |  1 -
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/tools/libs/light/libxl_console.c b/tools/libs/light/libxl_console.c
index a563c9d3c7..9f736b8913 100644
--- a/tools/libs/light/libxl_console.c
+++ b/tools/libs/light/libxl_console.c
@@ -774,12 +774,17 @@ libxl_xen_console_reader *
 {
     GC_INIT(ctx);
     libxl_xen_console_reader *cr;
-    unsigned int size = 16384;
+    /*
+     * We want xen to fill the buffer in as few hypercalls as
+     * possible, but xen will not nul-terminate it.  The default size
+     * of Xen's console buffer is 16384.  Leave one byte at the end
+     * for the null character.
+     */
+    unsigned int size = 16384 + 1;
 
     cr = libxl__zalloc(NOGC, sizeof(libxl_xen_console_reader));
     cr->buffer = libxl__zalloc(NOGC, size);
     cr->size = size;
-    cr->count = size;
     cr->clear = clear;
     cr->incremental = 1;
 
@@ -800,10 +805,16 @@ int libxl_xen_console_read_line(libxl_ctx *ctx,
                                 char **line_r)
 {
     int ret;
+    /*
+     * Number of chars to copy into the buffer.  xc_readconsolering()
+     * does not add a null character at the end, so leave a space for
+     * us to add it.
+     */
+    unsigned int nr_chars = cr->size - 1;
     GC_INIT(ctx);
 
     memset(cr->buffer, 0, cr->size);
-    ret = xc_readconsolering(ctx->xch, cr->buffer, &cr->count,
+    ret = xc_readconsolering(ctx->xch, cr->buffer, &nr_chars,
                              cr->clear, cr->incremental, &cr->index);
     if (ret < 0) {
         LOGE(ERROR, "reading console ring buffer");
@@ -811,7 +822,7 @@ int libxl_xen_console_read_line(libxl_ctx *ctx,
         return ERROR_FAIL;
     }
     if (!ret) {
-        if (cr->count) {
+        if (nr_chars) {
             *line_r = cr->buffer;
             ret = 1;
         } else {
diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h
index 089a2f949c..cfac8e18b6 100644
--- a/tools/libs/light/libxl_internal.h
+++ b/tools/libs/light/libxl_internal.h
@@ -2077,7 +2077,6 @@ _hidden char *libxl__uuid2string(libxl__gc *gc, const libxl_uuid uuid);
 struct libxl__xen_console_reader {
     char *buffer;
     unsigned int size;
-    unsigned int count;
     unsigned int clear;
     unsigned int incremental;
     unsigned int index;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 04 03:55:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Sep 2024 03:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.789739.1199368 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slh6v-0008VF-3X; Wed, 04 Sep 2024 03:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 789739.1199368; Wed, 04 Sep 2024 03:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slh6v-0008V5-0t; Wed, 04 Sep 2024 03:55:13 +0000
Received: by outflank-mailman (input) for mailman id 789739;
 Wed, 04 Sep 2024 03:55:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slh6t-0008Ut-LO
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 03:55:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slh6t-0004as-KC
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 03:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slh6t-0007gX-IL
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 03:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ukMUskyGwUv6NebEPVYBvDMjQswfLoNhYy6Aj7suWZY=; b=gYB8vn5fWQRtWIxC3mD42dqdKh
	V6eUxu/UGONW9QsyWmIIRS6QjKwCj7lNeEjMveBuAtmtVd/KoTBYlX+tTXpfLq4zvu1ixuTSvJPZg
	Gm9fp5yedqLMwZVIF9FuOCiBJRSVUk6MxHME/3pZYcezq67FVFQ100z7xulZBxpvPkYA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: Remove unnecessary buffer zeroing and zalloc()
Message-Id: <E1slh6t-0007gX-IL@xenbits.xenproject.org>
Date: Wed, 04 Sep 2024 03:55:11 +0000

commit ba5755798e9daf85617876276a3aee5e749d5f2a
Author:     Javi Merino <javi.merino@cloud.com>
AuthorDate: Mon Sep 2 17:38:38 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 10:53:44 2024 +0100

    libxl: Remove unnecessary buffer zeroing and zalloc()
    
    When reading the console, xen overwrites the contents of the buffer,
    so there is no need to zero the buffer before passing it to xen.
    Instead, add a NULL at the end of the buffer.
    
    While we are at it, change the zalloc() of the buffer back to
    malloc() as it was before bdf4131 (libxl: don't leak buf in
    libxl_xen_console_read_start error handling, 2013-12-03).  The comment
    in that commit message says that the intent of the commit was to
    change malloc+memset to zalloc(), but only for the
    libxl_xen_console_reader struct, not for the buffer.
    
    Signed-off-by: Javi Merino <javi.merino@cloud.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/libs/light/libxl_console.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/libs/light/libxl_console.c b/tools/libs/light/libxl_console.c
index 9f736b8913..6c4414fcc1 100644
--- a/tools/libs/light/libxl_console.c
+++ b/tools/libs/light/libxl_console.c
@@ -783,7 +783,7 @@ libxl_xen_console_reader *
     unsigned int size = 16384 + 1;
 
     cr = libxl__zalloc(NOGC, sizeof(libxl_xen_console_reader));
-    cr->buffer = libxl__zalloc(NOGC, size);
+    cr->buffer = libxl__malloc(NOGC, size);
     cr->size = size;
     cr->clear = clear;
     cr->incremental = 1;
@@ -813,7 +813,6 @@ int libxl_xen_console_read_line(libxl_ctx *ctx,
     unsigned int nr_chars = cr->size - 1;
     GC_INIT(ctx);
 
-    memset(cr->buffer, 0, cr->size);
     ret = xc_readconsolering(ctx->xch, cr->buffer, &nr_chars,
                              cr->clear, cr->incremental, &cr->index);
     if (ret < 0) {
@@ -823,6 +822,7 @@ int libxl_xen_console_read_line(libxl_ctx *ctx,
     }
     if (!ret) {
         if (nr_chars) {
+            cr->buffer[nr_chars] = '\0';
             *line_r = cr->buffer;
             ret = 1;
         } else {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 04 03:55:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Sep 2024 03:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.789740.1199371 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slh75-00006h-55; Wed, 04 Sep 2024 03:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 789740.1199371; Wed, 04 Sep 2024 03:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slh75-00006Z-2G; Wed, 04 Sep 2024 03:55:23 +0000
Received: by outflank-mailman (input) for mailman id 789740;
 Wed, 04 Sep 2024 03:55:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slh73-000067-Oe
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 03:55:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slh73-0004bM-Nt
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 03:55:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slh73-0007hP-MK
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 03:55:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=C7eYcqpx+77GdlXWGh5PukJutKv50ix9+ykUv5eBB5U=; b=dFQUuVGDnvjAS7hu+E/xjxJUcB
	OjlivSv5pi8EPslF6bt9jzV7r5laK63Ez1WN3aSYg24/I4q6FkmWewSw2a1Lk+txJufPPGp+FGByK
	zCgLWgqH3w/VrdDs7Hk6b67rKAI8y75NI57+iRoupeWR2s+oVZ9dz/eLlfydeb5fXY5c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: Update the documentation of libxl_xen_console_read_line()
Message-Id: <E1slh73-0007hP-MK@xenbits.xenproject.org>
Date: Wed, 04 Sep 2024 03:55:21 +0000

commit 87b307ff1de8f5f261eb7c9b94d370fc08e1983e
Author:     Javi Merino <javi.merino@cloud.com>
AuthorDate: Mon Sep 2 17:38:39 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 10:53:44 2024 +0100

    libxl: Update the documentation of libxl_xen_console_read_line()
    
    Despite its name, libxl_xen_console_read_line() does not read a line,
    it fills the buffer with as many characters as fit.  Update the
    documentation to reflect the real behaviour of the function.  Rename
    line_r to avoid confusion since it is a pointer to an array of
    characters.
    
    Signed-off-by: Javi Merino <javi.merino@cloud.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/include/libxl.h            |  2 +-
 tools/libs/light/libxl_console.c | 29 ++++++++++++++++++-----------
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index f5c7167742..8d32428ea9 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -2813,7 +2813,7 @@ libxl_xen_console_reader *
     libxl_xen_console_read_start(libxl_ctx *ctx, int clear);
 int libxl_xen_console_read_line(libxl_ctx *ctx,
                                 libxl_xen_console_reader *cr,
-                                char **line_r);
+                                char **buff);
 void libxl_xen_console_read_finish(libxl_ctx *ctx,
                                    libxl_xen_console_reader *cr);
 
diff --git a/tools/libs/light/libxl_console.c b/tools/libs/light/libxl_console.c
index 6c4414fcc1..044ca64676 100644
--- a/tools/libs/light/libxl_console.c
+++ b/tools/libs/light/libxl_console.c
@@ -792,17 +792,24 @@ libxl_xen_console_reader *
     return cr;
 }
 
-/* return values:                                          *line_r
- *   1          success, whole line obtained from buffer    non-0
- *   0          no more lines available right now           0
- *   negative   error code ERROR_*                          0
- * On success *line_r is updated to point to a nul-terminated
- * string which is valid until the next call on the same console
- * reader.  The libxl caller may overwrite parts of the string
- * if it wishes. */
+/*
+ * Copy part of the console ring into a buffer
+ *
+ * Return values:
+ *   1: Success, *buff points to the string
+ *   0: No more lines available right now
+ *   -ERROR_* on error
+ *
+ * Despite its name, libxl_xen_console_read_line() does not
+ * necessarily read a complete line.  It attempts to fill the buffer
+ * with as many characters as it can accommodate.  The buffer pointed
+ * to by *buff is updated to contain a nul-terminated string.  This
+ * string remains valid until the next call to
+ * libxl_xen_console_read_line() on the same console reader.
+ */
 int libxl_xen_console_read_line(libxl_ctx *ctx,
                                 libxl_xen_console_reader *cr,
-                                char **line_r)
+                                char **buff)
 {
     int ret;
     /*
@@ -823,10 +830,10 @@ int libxl_xen_console_read_line(libxl_ctx *ctx,
     if (!ret) {
         if (nr_chars) {
             cr->buffer[nr_chars] = '\0';
-            *line_r = cr->buffer;
+            *buff = cr->buffer;
             ret = 1;
         } else {
-            *line_r = NULL;
+            *buff = NULL;
             ret = 0;
         }
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 04 10:55:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Sep 2024 10:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.790139.1199844 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slnfF-0000Y3-7T; Wed, 04 Sep 2024 10:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 790139.1199844; Wed, 04 Sep 2024 10:55:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slnfF-0000Xv-4l; Wed, 04 Sep 2024 10:55:05 +0000
Received: by outflank-mailman (input) for mailman id 790139;
 Wed, 04 Sep 2024 10:55:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slnfD-0000Xp-Rw
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 10:55:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slnfD-0004wh-Mc
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 10:55:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slnfD-0003gA-L5
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 10:55:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1Wglm0+fjuC7GB86GamhKJYqbR+oqvmT5mOP+zOHi44=; b=eweCdIIIEmHCnT7p1dWVMGWRft
	X+gMdBGwBUaLGsjAve7tI8zt38Lu2yaH0yrsP0HRnMSFFauplPUxoaDxZimeRihRoxet1Gfp0Cba0
	adNkAXgKA1kErMF5wqksNrdzfd+Ao2NrbopzgMaEvEAWYQn2fOJz0CwCTKKQfpW1DD6s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] RISCV/shutdown: Implement machine_{halt,restart}()
Message-Id: <E1slnfD-0003gA-L5@xenbits.xenproject.org>
Date: Wed, 04 Sep 2024 10:55:03 +0000

commit 6471badeeec92db1cb8155066551f7509cd82efd
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 3 15:01:20 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Sep 4 11:27:50 2024 +0100

    RISCV/shutdown: Implement machine_{halt,restart}()
    
    SBI has an API for shutdown so wire it up.  However, the spec does allow the
    call not to be implemented, so we have to cope with sbi_shutdown() returning.
    
    There is a reboot-capable SBI extention, but in the short term route
    machine_restart() into machine_halt().
    
    Then, use use machine_halt() rather than an infinite loop at the end of
    start_xen().  This avoids the Qemu smoke test needing to wait for the full
    timeout in order to succeed.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 xen/arch/riscv/Makefile          |  1 +
 xen/arch/riscv/include/asm/sbi.h |  3 +++
 xen/arch/riscv/sbi.c             |  5 +++++
 xen/arch/riscv/setup.c           |  6 ++----
 xen/arch/riscv/shutdown.c        | 27 +++++++++++++++++++++++++++
 xen/arch/riscv/stubs.c           | 12 ------------
 6 files changed, 38 insertions(+), 16 deletions(-)

diff --git a/xen/arch/riscv/Makefile b/xen/arch/riscv/Makefile
index 81b77b13d6..d192be7b55 100644
--- a/xen/arch/riscv/Makefile
+++ b/xen/arch/riscv/Makefile
@@ -4,6 +4,7 @@ obj-y += mm.o
 obj-$(CONFIG_RISCV_64) += riscv64/
 obj-y += sbi.o
 obj-y += setup.o
+obj-y += shutdown.o
 obj-y += stubs.o
 obj-y += traps.o
 obj-y += vm_event.o
diff --git a/xen/arch/riscv/include/asm/sbi.h b/xen/arch/riscv/include/asm/sbi.h
index 0e6820a4ed..4d72a2295e 100644
--- a/xen/arch/riscv/include/asm/sbi.h
+++ b/xen/arch/riscv/include/asm/sbi.h
@@ -13,6 +13,7 @@
 #define __ASM_RISCV_SBI_H__
 
 #define SBI_EXT_0_1_CONSOLE_PUTCHAR		0x1
+#define SBI_EXT_0_1_SHUTDOWN			0x8
 
 struct sbiret {
     long error;
@@ -31,4 +32,6 @@ struct sbiret sbi_ecall(unsigned long ext, unsigned long fid,
  */
 void sbi_console_putchar(int ch);
 
+void sbi_shutdown(void);
+
 #endif /* __ASM_RISCV_SBI_H__ */
diff --git a/xen/arch/riscv/sbi.c b/xen/arch/riscv/sbi.c
index 0ae166c861..c7984344bc 100644
--- a/xen/arch/riscv/sbi.c
+++ b/xen/arch/riscv/sbi.c
@@ -42,3 +42,8 @@ void sbi_console_putchar(int ch)
 {
     sbi_ecall(SBI_EXT_0_1_CONSOLE_PUTCHAR, 0, ch, 0, 0, 0, 0, 0);
 }
+
+void sbi_shutdown(void)
+{
+    sbi_ecall(SBI_EXT_0_1_SHUTDOWN, 0, 0, 0, 0, 0, 0, 0);
+}
diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index a6a29a1508..bf9078f36a 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -4,6 +4,7 @@
 #include <xen/compile.h>
 #include <xen/init.h>
 #include <xen/mm.h>
+#include <xen/shutdown.h>
 
 #include <public/version.h>
 
@@ -28,8 +29,5 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
 
     printk("All set up\n");
 
-    for ( ;; )
-        asm volatile ("wfi");
-
-    unreachable();
+    machine_halt();
 }
diff --git a/xen/arch/riscv/shutdown.c b/xen/arch/riscv/shutdown.c
new file mode 100644
index 0000000000..3513d9af47
--- /dev/null
+++ b/xen/arch/riscv/shutdown.c
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#include <xen/shutdown.h>
+
+#include <asm/sbi.h>
+
+void machine_halt(void)
+{
+    sbi_shutdown();
+
+    /* TODO: Cope with sbi_shutdown() not being implemented. */
+
+    for ( ;; )
+        asm volatile ( "wfi" );
+
+    unreachable();
+}
+
+void machine_restart(unsigned int delay_millisecs)
+{
+    /*
+     * TODO: mdelay(delay_millisecs)
+     * TODO: Probe for #SRST support, where sbi_system_reset() has a
+     *       shutdown/reboot parameter.
+     */
+
+    machine_halt();
+}
diff --git a/xen/arch/riscv/stubs.c b/xen/arch/riscv/stubs.c
index 3285d18899..2aa245f272 100644
--- a/xen/arch/riscv/stubs.c
+++ b/xen/arch/riscv/stubs.c
@@ -49,18 +49,6 @@ void domain_set_time_offset(struct domain *d, int64_t time_offset_seconds)
     BUG_ON("unimplemented");
 }
 
-/* shutdown.c */
-
-void machine_restart(unsigned int delay_millisecs)
-{
-    BUG_ON("unimplemented");
-}
-
-void machine_halt(void)
-{
-    BUG_ON("unimplemented");
-}
-
 /* domctl.c */
 
 long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 04 14:22:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Sep 2024 14:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.790405.1200149 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slqtY-0002cW-QR; Wed, 04 Sep 2024 14:22:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 790405.1200149; Wed, 04 Sep 2024 14:22:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slqtY-0002cO-Nq; Wed, 04 Sep 2024 14:22:04 +0000
Received: by outflank-mailman (input) for mailman id 790405;
 Wed, 04 Sep 2024 14:22:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slqtX-0002cI-SG
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 14:22:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slqtX-0000D5-Lb
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 14:22:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slqtX-0000XL-Jk
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 14:22:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gSpAbvxywyp25uYuUBvFFX2ZUeRfNtsVZ3xwJj1qxXs=; b=UguH5jLaqiarWuHmAkx4XegrsI
	ILFqBPIwpoDwCFeRktbKX83u/J2J3rRHrPUBrEKxJnBSHjY9o4M3oBefoGUPSrf32a9bMLeuHMGOd
	pzuJK1dbwNozY6NKyKNXvkjXwg9svaM8so7KlwpkXmAKOkRnYYyTIlgNByBRvwNHmA7c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] SUPPORT.md: split XSM from Flask
Message-Id: <E1slqtX-0000XL-Jk@xenbits.xenproject.org>
Date: Wed, 04 Sep 2024 14:22:03 +0000

commit d7c18b8720824d7efc39ffa7296751e1812865a9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Sep 4 16:05:03 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 4 16:05:03 2024 +0200

    SUPPORT.md: split XSM from Flask
    
    XSM is a generic framework, which in particular is also used by SILO.
    With this it can't really be experimental: Arm mandates SILO for having
    a security supported configuration.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 SUPPORT.md | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index f822a7e607..23dd7e6424 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -769,13 +769,21 @@ Compile time disabled for ARM by default.
 
     Status, x86: Supported, not security supported
 
-### XSM & FLASK
+### XSM (Xen Security Module) Framework
+
+XSM is a security policy framework.  The dummy implementation is covered by this
+statement, and implements a policy whereby dom0 is all powerful.  See below for
+alternative modules (FLASK, SILO).
+
+    Status: Supported
+
+### FLASK XSM Module
 
     Status: Experimental
 
 Compile time disabled by default.
 
-Also note that using XSM
+Also note that using FLASK
 to delegate various domain control hypercalls
 to particular other domains, rather than only permitting use by dom0,
 is also specifically excluded from security support for many hypercalls.
@@ -788,6 +796,13 @@ Please see XSA-77 for more details.
 The default policy includes FLASK labels and roles for a "typical" Xen-based system
 with dom0, driver domains, stub domains, domUs, and so on.
 
+### SILO XSM Module
+
+SILO extends the dummy policy by enforcing that DomU-s can only communicate
+with Dom0, yet not with each other.
+
+    Status: Supported
+
 ## Virtual Hardware, Hypervisor
 
 ### x86/Nested PV
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 04 14:22:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Sep 2024 14:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.790406.1200153 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slqti-0002eM-SR; Wed, 04 Sep 2024 14:22:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 790406.1200153; Wed, 04 Sep 2024 14:22:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slqti-0002eE-PI; Wed, 04 Sep 2024 14:22:14 +0000
Received: by outflank-mailman (input) for mailman id 790406;
 Wed, 04 Sep 2024 14:22:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slqth-0002e8-S0
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 14:22:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slqth-0000DB-QF
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 14:22:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slqth-0000Y8-O5
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 14:22:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WHKURCwRWOq6hpdUTr4ONIq2ca3ZAUGiM2siAwzTM90=; b=m0orpwxQ0HVSFUzGvod6LcMg0g
	kaWkOF/ZojIFVndjirj2KiWcTHhRu9Gbm63h/VLcEyhlcPG+rl9gnB8O3ZNCyv5ELJaOD9/5OEQZg
	gxHUuPoeQqkoURSynKakUPUXukl08jE0dYuhWSZuSaG5cMIgVQjfb72H32d+iomG5V/o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86emul/test: rename "cp"
Message-Id: <E1slqth-0000Y8-O5@xenbits.xenproject.org>
Date: Wed, 04 Sep 2024 14:22:13 +0000

commit 3c93a0da6bc201ebeb8a08d6bd339c9982985fcc
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Sep 4 16:06:21 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 4 16:06:21 2024 +0200

    x86emul/test: rename "cp"
    
    In preparation of introducing a const struct cpu_policy * local in
    x86_emulate(), rename that global variable to something more suitable:
    "cp" is our commonly used name for function parameters or local
    variables of type struct cpu_policy *, and the present name of the
    global could hence have interfered already.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/fuzz/x86_instruction_emulator/fuzz-emul.c |   2 +-
 tools/tests/x86_emulator/test_x86_emulator.c    |  19 ++--
 tools/tests/x86_emulator/x86-emulate.c          |  16 +--
 tools/tests/x86_emulator/x86-emulate.h          | 135 +++++++++++++-----------
 4 files changed, 95 insertions(+), 77 deletions(-)

diff --git a/tools/fuzz/x86_instruction_emulator/fuzz-emul.c b/tools/fuzz/x86_instruction_emulator/fuzz-emul.c
index 2ba9ca9e0b..28c4fb13c5 100644
--- a/tools/fuzz/x86_instruction_emulator/fuzz-emul.c
+++ b/tools/fuzz/x86_instruction_emulator/fuzz-emul.c
@@ -899,7 +899,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data_p, size_t size)
     int rc;
 
     /* Not part of the initializer, for old gcc to cope. */
-    ctxt.cpu_policy = &cp;
+    ctxt.cpu_policy = &cpu_policy;
 
     /* Reset all global state variables */
     memset(&input, 0, sizeof(input));
diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index 2d52d21742..94a2bbab93 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -779,7 +779,8 @@ static void zap_fpsel(unsigned int *env, bool is_32bit)
         env[3] &= ~0xffff;
     }
 
-    if ( cp.x86_vendor != X86_VENDOR_AMD && cp.x86_vendor != X86_VENDOR_HYGON )
+    if ( cpu_policy.x86_vendor != X86_VENDOR_AMD &&
+         cpu_policy.x86_vendor != X86_VENDOR_HYGON )
         return;
 
     if ( is_32bit )
@@ -913,7 +914,7 @@ int main(int argc, char **argv)
 
     ctxt.regs = &regs;
     ctxt.force_writeback = 0;
-    ctxt.cpu_policy = &cp;
+    ctxt.cpu_policy = &cpu_policy;
     ctxt.lma       = sizeof(void *) == 8;
     ctxt.addr_size = 8 * sizeof(void *);
     ctxt.sp_size   = 8 * sizeof(void *);
@@ -1487,11 +1488,11 @@ int main(int argc, char **argv)
         goto fail;
     printf("okay\n");
 
-    vendor_native = cp.x86_vendor;
-    for ( cp.x86_vendor = X86_VENDOR_AMD; ; )
+    vendor_native = cpu_policy.x86_vendor;
+    for ( cpu_policy.x86_vendor = X86_VENDOR_AMD; ; )
     {
-        unsigned int v = cp.x86_vendor == X86_VENDOR_INTEL;
-        const char *vendor = cp.x86_vendor == X86_VENDOR_INTEL ? "Intel" : "AMD";
+        unsigned int v = cpu_policy.x86_vendor == X86_VENDOR_INTEL;
+        const char *vendor = cpu_policy.x86_vendor == X86_VENDOR_INTEL ? "Intel" : "AMD";
         uint64_t *stk = (void *)res + MMAP_SZ - 16;
 
         regs.rcx = 2;
@@ -1527,11 +1528,11 @@ int main(int argc, char **argv)
             printf("okay\n");
         }
 
-        if ( cp.x86_vendor == X86_VENDOR_INTEL )
+        if ( cpu_policy.x86_vendor == X86_VENDOR_INTEL )
             break;
-        cp.x86_vendor = X86_VENDOR_INTEL;
+        cpu_policy.x86_vendor = X86_VENDOR_INTEL;
     }
-    cp.x86_vendor = vendor_native;
+    cpu_policy.x86_vendor = vendor_native;
 #endif /* x86-64 */
 
     printf("%-40s", "Testing shld $1,%ecx,(%edx)...");
diff --git a/tools/tests/x86_emulator/x86-emulate.c b/tools/tests/x86_emulator/x86-emulate.c
index 70ce15be50..379e206dd3 100644
--- a/tools/tests/x86_emulator/x86-emulate.c
+++ b/tools/tests/x86_emulator/x86-emulate.c
@@ -25,7 +25,7 @@
 #endif
 
 uint32_t mxcsr_mask = 0x0000ffbf;
-struct cpu_policy cp;
+struct cpu_policy cpu_policy;
 
 static char fpu_save_area[0x4000] __attribute__((__aligned__((64))));
 static bool use_xsave;
@@ -75,18 +75,18 @@ bool emul_test_init(void)
 
     unsigned long sp;
 
-    x86_cpu_policy_fill_native(&cp);
+    x86_cpu_policy_fill_native(&cpu_policy);
 
     /*
      * The emulator doesn't use these instructions, so can always emulate
      * them.
      */
-    cp.basic.movbe = true;
-    cp.feat.invpcid = true;
-    cp.feat.adx = true;
-    cp.feat.rdpid = true;
-    cp.feat.wrmsrns = true;
-    cp.extd.clzero = true;
+    cpu_policy.basic.movbe = true;
+    cpu_policy.feat.invpcid = true;
+    cpu_policy.feat.adx = true;
+    cpu_policy.feat.rdpid = true;
+    cpu_policy.feat.wrmsrns = true;
+    cpu_policy.extd.clzero = true;
 
     if ( cpu_has_xsave )
     {
diff --git a/tools/tests/x86_emulator/x86-emulate.h b/tools/tests/x86_emulator/x86-emulate.h
index 4fca051152..112ec53d99 100644
--- a/tools/tests/x86_emulator/x86-emulate.h
+++ b/tools/tests/x86_emulator/x86-emulate.h
@@ -68,7 +68,7 @@
 #define is_canonical_address(x) (((int64_t)(x) >> 47) == ((int64_t)(x) >> 63))
 
 extern uint32_t mxcsr_mask;
-extern struct cpu_policy cp;
+extern struct cpu_policy cpu_policy;
 
 #define MMAP_SZ 16384
 bool emul_test_init(void);
@@ -122,7 +122,7 @@ static inline uint64_t xgetbv(uint32_t xcr)
 }
 
 /* Intentionally checking OSXSAVE here. */
-#define cpu_has_xsave     (cp.basic.raw[1].c & (1u << 27))
+#define cpu_has_xsave     (cpu_policy.basic.raw[1].c & (1u << 27))
 
 static inline bool xcr0_mask(uint64_t mask)
 {
@@ -132,63 +132,80 @@ static inline bool xcr0_mask(uint64_t mask)
 unsigned int rdpkru(void);
 void wrpkru(unsigned int val);
 
-#define cache_line_size() (cp.basic.clflush_size * 8)
-#define cpu_has_fpu        cp.basic.fpu
-#define cpu_has_mmx        cp.basic.mmx
-#define cpu_has_fxsr       cp.basic.fxsr
-#define cpu_has_sse        cp.basic.sse
-#define cpu_has_sse2       cp.basic.sse2
-#define cpu_has_sse3       cp.basic.sse3
-#define cpu_has_pclmulqdq  cp.basic.pclmulqdq
-#define cpu_has_ssse3      cp.basic.ssse3
-#define cpu_has_fma       (cp.basic.fma && xcr0_mask(6))
-#define cpu_has_sse4_1     cp.basic.sse4_1
-#define cpu_has_sse4_2     cp.basic.sse4_2
-#define cpu_has_popcnt     cp.basic.popcnt
-#define cpu_has_aesni      cp.basic.aesni
-#define cpu_has_avx       (cp.basic.avx  && xcr0_mask(6))
-#define cpu_has_f16c      (cp.basic.f16c && xcr0_mask(6))
-
-#define cpu_has_avx2      (cp.feat.avx2 && xcr0_mask(6))
-#define cpu_has_bmi1       cp.feat.bmi1
-#define cpu_has_bmi2       cp.feat.bmi2
-#define cpu_has_avx512f   (cp.feat.avx512f  && xcr0_mask(0xe6))
-#define cpu_has_avx512dq  (cp.feat.avx512dq && xcr0_mask(0xe6))
-#define cpu_has_avx512_ifma (cp.feat.avx512_ifma && xcr0_mask(0xe6))
-#define cpu_has_avx512cd  (cp.feat.avx512cd && xcr0_mask(0xe6))
-#define cpu_has_sha        cp.feat.sha
-#define cpu_has_avx512bw  (cp.feat.avx512bw && xcr0_mask(0xe6))
-#define cpu_has_avx512vl  (cp.feat.avx512vl && xcr0_mask(0xe6))
-#define cpu_has_avx512_vbmi (cp.feat.avx512_vbmi && xcr0_mask(0xe6))
-#define cpu_has_avx512_vbmi2 (cp.feat.avx512_vbmi2 && xcr0_mask(0xe6))
-#define cpu_has_gfni       cp.feat.gfni
-#define cpu_has_vaes      (cp.feat.vaes && xcr0_mask(6))
-#define cpu_has_vpclmulqdq (cp.feat.vpclmulqdq && xcr0_mask(6))
-#define cpu_has_avx512_vnni (cp.feat.avx512_vnni && xcr0_mask(0xe6))
-#define cpu_has_avx512_bitalg (cp.feat.avx512_bitalg && xcr0_mask(0xe6))
-#define cpu_has_avx512_vpopcntdq (cp.feat.avx512_vpopcntdq && xcr0_mask(0xe6))
-#define cpu_has_movdiri    cp.feat.movdiri
-#define cpu_has_movdir64b  cp.feat.movdir64b
-#define cpu_has_avx512_vp2intersect (cp.feat.avx512_vp2intersect && xcr0_mask(0xe6))
-#define cpu_has_serialize  cp.feat.serialize
-#define cpu_has_avx512_fp16 (cp.feat.avx512_fp16 && xcr0_mask(0xe6))
-#define cpu_has_sha512     (cp.feat.sha512 && xcr0_mask(6))
-#define cpu_has_sm3        (cp.feat.sm3 && xcr0_mask(6))
-#define cpu_has_sm4        (cp.feat.sm4 && xcr0_mask(6))
-#define cpu_has_avx_vnni   (cp.feat.avx_vnni && xcr0_mask(6))
-#define cpu_has_avx512_bf16 (cp.feat.avx512_bf16 && xcr0_mask(0xe6))
-#define cpu_has_avx_ifma   (cp.feat.avx_ifma && xcr0_mask(6))
-#define cpu_has_avx_vnni_int8 (cp.feat.avx_vnni_int8 && xcr0_mask(6))
-#define cpu_has_avx_ne_convert (cp.feat.avx_ne_convert && xcr0_mask(6))
-#define cpu_has_avx_vnni_int16 (cp.feat.avx_vnni_int16 && xcr0_mask(6))
-
-#define cpu_has_xgetbv1   (cpu_has_xsave && cp.xstate.xgetbv1)
-
-#define cpu_has_3dnow_ext  cp.extd._3dnowext
-#define cpu_has_sse4a      cp.extd.sse4a
-#define cpu_has_xop       (cp.extd.xop  && xcr0_mask(6))
-#define cpu_has_fma4      (cp.extd.fma4 && xcr0_mask(6))
-#define cpu_has_tbm        cp.extd.tbm
+#define cache_line_size()           (cpu_policy.basic.clflush_size * 8)
+#define cpu_has_fpu                  cpu_policy.basic.fpu
+#define cpu_has_mmx                  cpu_policy.basic.mmx
+#define cpu_has_fxsr                 cpu_policy.basic.fxsr
+#define cpu_has_sse                  cpu_policy.basic.sse
+#define cpu_has_sse2                 cpu_policy.basic.sse2
+#define cpu_has_sse3                 cpu_policy.basic.sse3
+#define cpu_has_pclmulqdq            cpu_policy.basic.pclmulqdq
+#define cpu_has_ssse3                cpu_policy.basic.ssse3
+#define cpu_has_fma                 (cpu_policy.basic.fma && xcr0_mask(6))
+#define cpu_has_sse4_1               cpu_policy.basic.sse4_1
+#define cpu_has_sse4_2               cpu_policy.basic.sse4_2
+#define cpu_has_popcnt               cpu_policy.basic.popcnt
+#define cpu_has_aesni                cpu_policy.basic.aesni
+#define cpu_has_avx                 (cpu_policy.basic.avx  && xcr0_mask(6))
+#define cpu_has_f16c                (cpu_policy.basic.f16c && xcr0_mask(6))
+
+#define cpu_has_avx2                (cpu_policy.feat.avx2 && xcr0_mask(6))
+#define cpu_has_bmi1                 cpu_policy.feat.bmi1
+#define cpu_has_bmi2                 cpu_policy.feat.bmi2
+#define cpu_has_avx512f             (cpu_policy.feat.avx512f && \
+                                     xcr0_mask(0xe6))
+#define cpu_has_avx512dq            (cpu_policy.feat.avx512dq && \
+                                     xcr0_mask(0xe6))
+#define cpu_has_avx512_ifma         (cpu_policy.feat.avx512_ifma && \
+                                     xcr0_mask(0xe6))
+#define cpu_has_avx512cd            (cpu_policy.feat.avx512cd && \
+                                     xcr0_mask(0xe6))
+#define cpu_has_sha                  cpu_policy.feat.sha
+#define cpu_has_avx512bw            (cpu_policy.feat.avx512bw && \
+                                     xcr0_mask(0xe6))
+#define cpu_has_avx512vl            (cpu_policy.feat.avx512vl && \
+                                     xcr0_mask(0xe6))
+#define cpu_has_avx512_vbmi         (cpu_policy.feat.avx512_vbmi && \
+                                     xcr0_mask(0xe6))
+#define cpu_has_avx512_vbmi2        (cpu_policy.feat.avx512_vbmi2 && \
+                                     xcr0_mask(0xe6))
+#define cpu_has_gfni                 cpu_policy.feat.gfni
+#define cpu_has_vaes                (cpu_policy.feat.vaes && xcr0_mask(6))
+#define cpu_has_vpclmulqdq          (cpu_policy.feat.vpclmulqdq && xcr0_mask(6))
+#define cpu_has_avx512_vnni         (cpu_policy.feat.avx512_vnni && \
+                                     xcr0_mask(0xe6))
+#define cpu_has_avx512_bitalg       (cpu_policy.feat.avx512_bitalg && \
+                                     xcr0_mask(0xe6))
+#define cpu_has_avx512_vpopcntdq    (cpu_policy.feat.avx512_vpopcntdq && \
+                                     xcr0_mask(0xe6))
+#define cpu_has_movdiri              cpu_policy.feat.movdiri
+#define cpu_has_movdir64b            cpu_policy.feat.movdir64b
+#define cpu_has_avx512_vp2intersect (cpu_policy.feat.avx512_vp2intersect && \
+                                     xcr0_mask(0xe6))
+#define cpu_has_serialize            cpu_policy.feat.serialize
+#define cpu_has_avx512_fp16         (cpu_policy.feat.avx512_fp16 && \
+                                     xcr0_mask(0xe6))
+#define cpu_has_sha512              (cpu_policy.feat.sha512 && xcr0_mask(6))
+#define cpu_has_sm3                 (cpu_policy.feat.sm3 && xcr0_mask(6))
+#define cpu_has_sm4                 (cpu_policy.feat.sm4 && xcr0_mask(6))
+#define cpu_has_avx_vnni            (cpu_policy.feat.avx_vnni && xcr0_mask(6))
+#define cpu_has_avx512_bf16         (cpu_policy.feat.avx512_bf16 && \
+                                     xcr0_mask(0xe6))
+#define cpu_has_avx_ifma            (cpu_policy.feat.avx_ifma && xcr0_mask(6))
+#define cpu_has_avx_vnni_int8       (cpu_policy.feat.avx_vnni_int8 && \
+                                     xcr0_mask(6))
+#define cpu_has_avx_ne_convert      (cpu_policy.feat.avx_ne_convert && \
+                                     xcr0_mask(6))
+#define cpu_has_avx_vnni_int16      (cpu_policy.feat.avx_vnni_int16 && \
+                                     xcr0_mask(6))
+
+#define cpu_has_xgetbv1             (cpu_has_xsave && cpu_policy.xstate.xgetbv1)
+
+#define cpu_has_3dnow_ext            cpu_policy.extd._3dnowext
+#define cpu_has_sse4a                cpu_policy.extd.sse4a
+#define cpu_has_xop                 (cpu_policy.extd.xop  && xcr0_mask(6))
+#define cpu_has_fma4                (cpu_policy.extd.fma4 && xcr0_mask(6))
+#define cpu_has_tbm                  cpu_policy.extd.tbm
 
 int emul_test_cpuid(
     uint32_t leaf,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 04 14:22:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Sep 2024 14:22:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.790407.1200157 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slqts-0002gy-TP; Wed, 04 Sep 2024 14:22:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 790407.1200157; Wed, 04 Sep 2024 14:22:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slqts-0002gq-Qx; Wed, 04 Sep 2024 14:22:24 +0000
Received: by outflank-mailman (input) for mailman id 790407;
 Wed, 04 Sep 2024 14:22:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slqtr-0002gX-US
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 14:22:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slqtr-0000Dj-Td
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 14:22:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slqtr-0000ZG-Sf
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 14:22:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=763OQXUw1VD6bWAXLtmseyE+wodfHSDrvtpPl7DFS1o=; b=Ro7uhO9TeYG4p7OptItd9fqQxn
	wdXS5jJCrWyV+jEoZrK3PxjN2quqDR2NYzI/rzSTB8+Kec237jMwcii9hoktmVg/2NJqnVoYe+ctH
	Be+/HhWQFxSe1qDE2pvw8plxrFE+1LbGg9su2vYA4N/TNsh+OHFbQSdPA/35hf/H3IGY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86emul: introduce a struct cpu_policy * local in x86_emulate()
Message-Id: <E1slqtr-0000ZG-Sf@xenbits.xenproject.org>
Date: Wed, 04 Sep 2024 14:22:23 +0000

commit b20e3fbc3ec91b4534e51f6f724c3826dac0bdf3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Sep 4 16:06:42 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 4 16:06:42 2024 +0200

    x86emul: introduce a struct cpu_policy * local in x86_emulate()
    
    While of little effect right here, future patches (AVX10, AMX,
    KeyLocker) will benefit more significantly.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 0a6d5a35b1..53742b4796 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -1233,6 +1233,7 @@ x86_emulate(
 {
     /* Shadow copy of register state. Committed on successful emulation. */
     struct cpu_user_regs _regs = *ctxt->regs;
+    const struct cpu_policy *cp = ctxt->cpu_policy;
     struct x86_emulate_state state;
     int rc;
     uint8_t b, d, *opc = NULL;
@@ -3075,7 +3076,7 @@ x86_emulate(
          * in fact risking to make guest OSes vulnerable to the equivalent of
          * XSA-7 (CVE-2012-0217).
          */
-        generate_exception_if(ctxt->cpuid->x86_vendor == X86_VENDOR_INTEL &&
+        generate_exception_if(cp->x86_vendor == X86_VENDOR_INTEL &&
                               op_bytes == 8 && !is_canonical_address(_regs.rcx),
                               X86_EXC_GP, 0);
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 04 14:22:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Sep 2024 14:22:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.790409.1200160 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slqu2-0002kF-V2; Wed, 04 Sep 2024 14:22:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 790409.1200160; Wed, 04 Sep 2024 14:22:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slqu2-0002k7-SL; Wed, 04 Sep 2024 14:22:34 +0000
Received: by outflank-mailman (input) for mailman id 790409;
 Wed, 04 Sep 2024 14:22:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slqu2-0002jw-2S
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 14:22:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slqu2-0000Dq-1Z
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 14:22:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slqu1-0000aB-Vo
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 14:22:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kmV678k+Wz+MDUM4d6hlWuLt1c+0e5LRE5Q4WjaxwLM=; b=7DWX56iZ/cSmNelem31MKF4mfh
	taPCN25mbyRSMvX21e2ircE+RypMJaxWEWJ6TYtPdnahGHyobIRDTfOF2cIQIAPljDs6l5aaOTPBw
	98/oLn5pZBhbeyYyapejZ2zaF4FUxMiMH4WdbaWyGEcNApnKFcghoZn3sHniI2xv4G7o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] mktarball: only archive Xen
Message-Id: <E1slqu1-0000aB-Vo@xenbits.xenproject.org>
Date: Wed, 04 Sep 2024 14:22:33 +0000

commit c5be91eb81403195643e8de287c86fbd728ad6cb
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Sep 4 16:07:41 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 4 16:07:41 2024 +0200

    mktarball: only archive Xen
    
    As was basically decided already a while ago, remove - in the simplest
    possible way - the archiving of both qemu-s and mini-os from tarball
    generation.
    
    With this the subtree-force-update-all prereq isn't needed anymore in
    the top level Makefile. That goal, including the respective ones
    underneath tools/, then also are unreferenced and hence are being
    dropped, too.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 Makefile                |  8 ++------
 tools/Makefile          |  5 -----
 tools/Rules.mk          |  2 +-
 tools/firmware/Makefile |  4 ----
 tools/misc/mktarball    | 22 +---------------------
 5 files changed, 4 insertions(+), 37 deletions(-)

diff --git a/Makefile b/Makefile
index a6ca348476..c9d80a6dc6 100644
--- a/Makefile
+++ b/Makefile
@@ -200,10 +200,6 @@ rpmball: dist
 subtree-force-update: mini-os-dir-force-update
 	$(MAKE) -C tools subtree-force-update
 
-.PHONY: subtree-force-update-all
-subtree-force-update-all: mini-os-dir-force-update
-	$(MAKE) -C tools subtree-force-update-all
-
 # Make a source tarball, including qemu sub-trees.
 #
 # src-tarball will use "git describe" for the version number.  This
@@ -214,11 +210,11 @@ subtree-force-update-all: mini-os-dir-force-update
 # src-tarball-release will use "make xenversion" as the version
 # number.  This is suitable for release tarballs.
 .PHONY: src-tarball-release
-src-tarball-release: subtree-force-update-all
+src-tarball-release:
 	bash ./tools/misc/mktarball $(XEN_ROOT) $$($(MAKE) -C xen xenversion --no-print-directory)
 
 .PHONY: src-tarball
-src-tarball: subtree-force-update-all
+src-tarball:
 	bash ./tools/misc/mktarball $(XEN_ROOT) $$(git describe)
 
 .PHONY: clean
diff --git a/tools/Makefile b/tools/Makefile
index 7d17211782..e9e1cda305 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -282,8 +282,3 @@ endif
 ifeq ($(CONFIG_X86),y)
 	$(MAKE) -C firmware subtree-force-update
 endif
-
-subtree-force-update-all:
-	$(MAKE) qemu-xen-dir-force-update
-	$(MAKE) qemu-xen-traditional-dir-force-update
-	$(MAKE) -C firmware subtree-force-update-all
diff --git a/tools/Rules.mk b/tools/Rules.mk
index 18cf83f5be..e2289c25b4 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -206,7 +206,7 @@ subdir-all-% subdir-clean-% subdir-install-% subdir-uninstall-%: .phony
 subdir-distclean-%: .phony
 	$(MAKE) -C $* distclean
 
-no-configure-targets := distclean subdir-distclean% clean subdir-clean% subtree-force-update-all %-dir-force-update
+no-configure-targets := distclean subdir-distclean% clean subdir-clean% %-dir-force-update
 ifeq (,$(filter $(no-configure-targets),$(MAKECMDGOALS)))
 $(XEN_ROOT)/config/Tools.mk:
 	$(error You have to run ./configure before building or installing the tools)
diff --git a/tools/firmware/Makefile b/tools/firmware/Makefile
index 345037b93b..d69f7c69ea 100644
--- a/tools/firmware/Makefile
+++ b/tools/firmware/Makefile
@@ -127,9 +127,5 @@ ifeq ($(CONFIG_OVMF),y)
 	$(MAKE) ovmf-dir-force-update
 endif
 
-subtree-force-update-all:
-	$(MAKE) seabios-dir-force-update
-	$(MAKE) ovmf-dir-force-update
-
 subdir-all-seabios-dir: seabios-dir
 	$(MAKE) -C $< CC=$(SEABIOSCC) LD=$(SEABIOSLD) PYTHON=$(PYTHON) EXTRAVERSION=$(SEABIOS_EXTRAVERSION) all;
diff --git a/tools/misc/mktarball b/tools/misc/mktarball
index 42d543073c..7f9b61da43 100755
--- a/tools/misc/mktarball
+++ b/tools/misc/mktarball
@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# mktarball: Make a release tarball (including xen, qemu, and qemu-traditional)
+# mktarball: Make a release tarball (including just xen)
 #
 # Takes 2 arguments, the path to the dist directory and the version
 set -ex
@@ -29,26 +29,6 @@ mkdir -p $tdir
 
 git_archive_into $xen_root $tdir/xen-$desc
 
-# We can't use git_archive_into with qemu upstream because it uses
-# git-submodules.  git-submodules are an inherently broken git feature
-# which should never be used in any circumstance.  Unfortunately, qemu
-# upstream uses them.  Relevantly for us, git archive does not work
-# properly when there are submodules.
-(
-    cd $xen_root/tools/qemu-xen-dir-remote
-    # if it's not clean, the qemu script will call `git stash' !
-    git --no-pager diff --stat HEAD
-    scripts/archive-source.sh $tdir/xen-$desc/tools/qemu-xen.tar
-    cd $tdir/xen-$desc/tools
-    mkdir qemu-xen
-    tar <qemu-xen.tar Cxf qemu-xen -
-    rm qemu-xen.tar
-)
-
-git_archive_into $xen_root/tools/qemu-xen-traditional-dir-remote $tdir/xen-$desc/tools/qemu-xen-traditional
-
-git_archive_into $xen_root/extras/mini-os-remote $tdir/xen-$desc/extras/mini-os
-
 GZIP=-9v tar cz -f $xen_root/dist/xen-$desc.tar.gz -C $tdir xen-$desc
 
 echo "Source tarball in $xen_root/dist/xen-$desc.tar.gz"
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 04 14:22:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Sep 2024 14:22:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.790411.1200165 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slquD-0002n1-0P; Wed, 04 Sep 2024 14:22:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 790411.1200165; Wed, 04 Sep 2024 14:22:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slquC-0002mt-Tp; Wed, 04 Sep 2024 14:22:44 +0000
Received: by outflank-mailman (input) for mailman id 790411;
 Wed, 04 Sep 2024 14:22:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slquC-0002mh-6Q
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 14:22:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slquC-0000Dx-4p
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 14:22:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slquC-0000bF-3l
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 14:22:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hRPPGK8FHDDrpuP/TYHtGkLhB+iQ6C86ii6pO9ZrhJA=; b=1owcVTQrIdtkxd/m+YEKSpNPks
	TXAOQhINnq58RlzHkaMD0ymmC/Dx1Azny4Int0upeHDqKpCxLUgFmtFERKN/YpdwqSd2c8ZEcBx6c
	i6GxGHTIsmgDgwsaGWyRRIQYvI1Rt7CXbovGdP2As+abs+SGpM6S50OW7GIBWiAHZ2Ew=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/tboot: add Intel dependency
Message-Id: <E1slquC-0000bF-3l@xenbits.xenproject.org>
Date: Wed, 04 Sep 2024 14:22:44 +0000

commit 3117e58ce03a0aecd945abe99778407a176fe2f1
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Wed Sep 4 16:08:37 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 4 16:08:37 2024 +0200

    x86/tboot: add Intel dependency
    
    Make the Intel-specific Trusted Boot implementation dependant on general Intel CPU support.
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index dee8db45e8..62f0b5e0f4 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -222,7 +222,7 @@ config HVM_FEP
 
 config TBOOT
 	bool "Xen tboot support (UNSUPPORTED)"
-	depends on UNSUPPORTED
+	depends on INTEL && UNSUPPORTED
 	default !PV_SHIM_EXCLUSIVE
 	select CRYPTO
 	help
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 04 14:22:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Sep 2024 14:22:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.790413.1200168 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slquN-0002qJ-2y; Wed, 04 Sep 2024 14:22:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 790413.1200168; Wed, 04 Sep 2024 14:22:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slquN-0002qC-0T; Wed, 04 Sep 2024 14:22:55 +0000
Received: by outflank-mailman (input) for mailman id 790413;
 Wed, 04 Sep 2024 14:22:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slquM-0002q6-8z
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 14:22:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slquM-0000E4-8E
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 14:22:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slquM-0000ck-6w
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 14:22:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=W0GuJ0JKKOOzp7QS3bfbPRe7CJRNWBFEQAcMlcuVOSU=; b=iQRyNX28HBMLDpKq15Y6Sfqucd
	rDipoHJtrwOkgG+DcfdC2zHEXpA+1CogovY6B249PsZttaMutfzLxbLol1MWqNFdiuzut86Bik9Xd
	EErWOVS3WxzGylvJD8UzIiz52SdbZmZl+poiXE70OQCMFaaKyvMRf/ovpAgXEW0DocLU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: fix UP build with gcc14
Message-Id: <E1slquM-0000ck-6w@xenbits.xenproject.org>
Date: Wed, 04 Sep 2024 14:22:54 +0000

commit a2de7dc4d845738e734b10fce6550c89c6b1092c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Sep 4 16:09:28 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 4 16:09:28 2024 +0200

    x86: fix UP build with gcc14
    
    The complaint is:
    
    In file included from ././include/xen/config.h:17,
                     from <command-line>:
    arch/x86/smpboot.c: In function ‘link_thread_siblings.constprop’:
    ./include/asm-generic/percpu.h:16:51: error: array subscript [0, 0] is outside array bounds of ‘long unsigned int[1]’ [-Werror=array-bounds=]
       16 |     (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
    ./include/xen/compiler.h:140:29: note: in definition of macro ‘RELOC_HIDE’
      140 |     (typeof(ptr)) (__ptr + (off)); })
          |                             ^~~
    arch/x86/smpboot.c:238:27: note: in expansion of macro ‘per_cpu’
      238 |     cpumask_set_cpu(cpu2, per_cpu(cpu_sibling_mask, cpu1));
          |                           ^~~~~~~
    In file included from ./arch/x86/include/generated/asm/percpu.h:1,
                     from ./include/xen/percpu.h:30,
                     from ./arch/x86/include/asm/cpuid.h:9,
                     from ./arch/x86/include/asm/cpufeature.h:11,
                     from ./arch/x86/include/asm/system.h:6,
                     from ./include/xen/list.h:11,
                     from ./include/xen/mm.h:68,
                     from arch/x86/smpboot.c:12:
    ./include/asm-generic/percpu.h:12:22: note: while referencing ‘__per_cpu_offset’
       12 | extern unsigned long __per_cpu_offset[NR_CPUS];
          |                      ^~~~~~~~~~~~~~~~
    
    Which I consider bogus in the first place ("array subscript [0, 0]" vs a
    1-element array). Yet taking the experience from 99f942f3d410 ("Arm64:
    adjust __irq_to_desc() to fix build with gcc14") I guessed that
    switching function parameters to unsigned int (which they should have
    been anyway) might help. And voilà ...
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/smpboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 8aa621533f..0a89f22a39 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -226,7 +226,7 @@ static int booting_cpu;
 /* CPUs for which sibling maps can be computed. */
 static cpumask_t cpu_sibling_setup_map;
 
-static void link_thread_siblings(int cpu1, int cpu2)
+static void link_thread_siblings(unsigned int cpu1, unsigned int cpu2)
 {
     cpumask_set_cpu(cpu1, per_cpu(cpu_sibling_mask, cpu2));
     cpumask_set_cpu(cpu2, per_cpu(cpu_sibling_mask, cpu1));
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 04 19:11:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Sep 2024 19:11:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.790673.1200493 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slvPD-0002z6-M8; Wed, 04 Sep 2024 19:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 790673.1200493; Wed, 04 Sep 2024 19:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slvPD-0002yy-Je; Wed, 04 Sep 2024 19:11:03 +0000
Received: by outflank-mailman (input) for mailman id 790673;
 Wed, 04 Sep 2024 19:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvPC-0002ys-KM
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvPC-0005yt-5z
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvPC-0000Lk-4F
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7WEU1HaNl2z5OjKk7935l5x4YM/enOq0QuLVzif5Fwo=; b=jDMT5yZJUUuJbzCmtVie0mPMxd
	9F4U/T733pQ0b7RkJVgEj1HDuCArYSGuQRzdDt+Y2Kbdqm/rXuYagnCJvHVSxSwlJDSSkRb4faSCu
	W/7sa/ruiVcfB90Q9bJ9Eh1QJkiNMCfPlb9M2Y+C6WLVbcThdsl1NvNGJYWXOMA93HAk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Fix include paths for 32bit objects
Message-Id: <E1slvPC-0000Lk-4F@xenbits.xenproject.org>
Date: Wed, 04 Sep 2024 19:11:02 +0000

commit 5f36fab2406299bd2c54074d81fe482af11fb2b9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 3 11:41:56 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 15:51:14 2024 +0100

    x86/boot: Fix include paths for 32bit objects
    
    Most of Xen is build using -nostdinc and a fully specified include path.
    However, the makefile line:
    
      $(head-bin-objs): XEN_CFLAGS := $(CFLAGS_x86_32) -fpic
    
    discards XEN_CFLAGS and replaces them with CFLAGS_x86_32.
    
    Reinstate -nostdinc, and copy the -include and all -I arguments from
    XEN_CFLAGS.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/boot/Makefile | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index 03d8ce3a9e..de47740277 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -14,10 +14,8 @@ $(obj)/head.o: $(head-bin-objs:.o=.bin)
 CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_TREEWIDE_CFLAGS))
 $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
 CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float
-ifneq ($(abs_objtree),$(abs_srctree))
-CFLAGS_x86_32 += -I$(objtree)/include
-endif
-CFLAGS_x86_32 += -I$(srctree)/include
+CFLAGS_x86_32 += -nostdinc -include $(filter %/include/xen/config.h,$(XEN_CFLAGS))
+CFLAGS_x86_32 += $(filter -I%,$(XEN_CFLAGS))
 
 # override for 32bit binaries
 $(head-bin-objs): CFLAGS_stack_boundary :=
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 04 19:11:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Sep 2024 19:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.790674.1200496 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slvPN-000317-NR; Wed, 04 Sep 2024 19:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 790674.1200496; Wed, 04 Sep 2024 19:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slvPN-000310-L3; Wed, 04 Sep 2024 19:11:13 +0000
Received: by outflank-mailman (input) for mailman id 790674;
 Wed, 04 Sep 2024 19:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvPM-00030b-Bi
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvPM-0005yy-At
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvPM-0000Ms-8K
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aTkcgbEN25wAwb6Kn7rFakas/OBDI1xlUxC60Qcgvhw=; b=OmQ58HTVBbj6lskN4gbzomkI4y
	X6W4BlZFNNR9FDpUT67O7o0pfTMHtYOMOA3UX9E1KPhIn3WGoqBZzKmHKY8BUl+sd0vQEFJNYHWM/
	+QK9L4z7HhZqkdnIEvGc1OPTufcihX2vjOU967Ge/tK45FNUn9mP2JveoTiGlN0r1XAo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Use <xen/types.h>
Message-Id: <E1slvPM-0000Ms-8K@xenbits.xenproject.org>
Date: Wed, 04 Sep 2024 19:11:12 +0000

commit 43d4c10dfae19cbdbbcf38e50752b43845638137
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Sep 2 11:54:14 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 15:51:44 2024 +0100

    x86/boot: Use <xen/types.h>
    
    ... rather than opencoding locally.  This also covers NULL and *_MAX.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/boot/cmdline.c |  2 ++
 xen/arch/x86/boot/defs.h    | 17 -----------------
 xen/arch/x86/boot/reloc.c   |  2 ++
 3 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/xen/arch/x86/boot/cmdline.c b/xen/arch/x86/boot/cmdline.c
index b8ad7f3a14..28a47da7ab 100644
--- a/xen/arch/x86/boot/cmdline.c
+++ b/xen/arch/x86/boot/cmdline.c
@@ -31,6 +31,8 @@ asm (
     );
 
 #include <xen/kconfig.h>
+#include <xen/types.h>
+
 #include "defs.h"
 #include "video.h"
 
diff --git a/xen/arch/x86/boot/defs.h b/xen/arch/x86/boot/defs.h
index ee1a4da6af..cf9a80d116 100644
--- a/xen/arch/x86/boot/defs.h
+++ b/xen/arch/x86/boot/defs.h
@@ -20,14 +20,10 @@
 #ifndef __BOOT_DEFS_H__
 #define __BOOT_DEFS_H__
 
-#include <xen/stdbool.h>
-
 #define __maybe_unused	__attribute__((__unused__))
 #define __packed	__attribute__((__packed__))
 #define __stdcall	__attribute__((__stdcall__))
 
-#define NULL		((void *)0)
-
 #define ALIGN_UP(arg, align) \
                 (((arg) + (align) - 1) & ~((typeof(arg))(align) - 1))
 
@@ -47,17 +43,4 @@
 
 #define tolower(c)	((c) | 0x20)
 
-typedef unsigned char u8;
-typedef unsigned short u16;
-typedef unsigned int u32;
-typedef unsigned long long u64;
-typedef unsigned int size_t;
-typedef u8 uint8_t;
-typedef u16 uint16_t;
-typedef u32 uint32_t;
-typedef u64 uint64_t;
-
-#define UINT16_MAX	((uint16_t)(~0U))
-#define UINT_MAX	(~0U)
-
 #endif /* __BOOT_DEFS_H__ */
diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c
index 589e026ff9..ac8b58b695 100644
--- a/xen/arch/x86/boot/reloc.c
+++ b/xen/arch/x86/boot/reloc.c
@@ -26,6 +26,8 @@ asm (
     "    jmp  reloc                    \n"
     );
 
+#include <xen/types.h>
+
 #include "defs.h"
 
 #include <xen/kconfig.h>
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 04 19:11:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Sep 2024 19:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.790675.1200502 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slvPX-000343-Pm; Wed, 04 Sep 2024 19:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 790675.1200502; Wed, 04 Sep 2024 19:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slvPX-00033v-MV; Wed, 04 Sep 2024 19:11:23 +0000
Received: by outflank-mailman (input) for mailman id 790675;
 Wed, 04 Sep 2024 19:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvPW-00033i-F3
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvPW-0005z9-EC
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvPW-0000Nx-DG
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=z/9a3r33GmCsiGvsLUApkFsyYrsi7ARwiau1hSvr5BQ=; b=QBcQJEZz9Bj9Xe9ge9zpZ9nWzl
	Latg086GzMKPdvwkxLZdegEX6HCqxWnrU8NOfWdydF2Y/6Al6eYIsbbvg3Jjl5ZrUNGcvlBGq6yvM
	MuIs8QAKJFtWhqOxqZy5QkJvn+tnIAnkuehrz5+6JEBmUy26cZHzP5SJCc3oaFz527d4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Use <xen/macros.h>
Message-Id: <E1slvPW-0000Nx-DG@xenbits.xenproject.org>
Date: Wed, 04 Sep 2024 19:11:22 +0000

commit a268cdc05a1e24e80ed936c94b04785fa64a172a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Sep 2 13:58:09 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 15:51:44 2024 +0100

    x86/boot: Use <xen/macros.h>
    
    ... rather than opencoding locally.
    
    This involve collecting various macros scattered around Xen (min()/max()
    macros from kernel.h, and _p() from lib.h) and moving them into macros.h
    
    In reloc.c, replace ALIGN_UP() with ROUNDUP().
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/boot/cmdline.c |  4 ++++
 xen/arch/x86/boot/defs.h    | 19 -------------------
 xen/arch/x86/boot/reloc.c   | 11 ++++++-----
 xen/include/xen/kernel.h    | 36 +-----------------------------------
 xen/include/xen/lib.h       |  2 --
 xen/include/xen/macros.h    | 44 ++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 55 insertions(+), 61 deletions(-)

diff --git a/xen/arch/x86/boot/cmdline.c b/xen/arch/x86/boot/cmdline.c
index 28a47da7ab..b7375d1066 100644
--- a/xen/arch/x86/boot/cmdline.c
+++ b/xen/arch/x86/boot/cmdline.c
@@ -31,6 +31,7 @@ asm (
     );
 
 #include <xen/kconfig.h>
+#include <xen/macros.h>
 #include <xen/types.h>
 
 #include "defs.h"
@@ -50,6 +51,9 @@ typedef struct __packed {
 #endif
 } early_boot_opts_t;
 
+/* Avoid pulling in all of ctypes.h for this. */
+#define tolower(c)	((c) | 0x20)
+
 /*
  * Space and TAB are obvious delimiters. However, I am
  * adding "\n" and "\r" here too. Just in case when
diff --git a/xen/arch/x86/boot/defs.h b/xen/arch/x86/boot/defs.h
index cf9a80d116..4d519ac4f5 100644
--- a/xen/arch/x86/boot/defs.h
+++ b/xen/arch/x86/boot/defs.h
@@ -24,23 +24,4 @@
 #define __packed	__attribute__((__packed__))
 #define __stdcall	__attribute__((__stdcall__))
 
-#define ALIGN_UP(arg, align) \
-                (((arg) + (align) - 1) & ~((typeof(arg))(align) - 1))
-
-#define min(x,y) ({ \
-        const typeof(x) _x = (x);       \
-        const typeof(y) _y = (y);       \
-        (void) (&_x == &_y);            \
-        _x < _y ? _x : _y; })
-
-#define max(x,y) ({ \
-        const typeof(x) _x = (x);       \
-        const typeof(y) _y = (y);       \
-        (void) (&_x == &_y);            \
-        _x > _y ? _x : _y; })
-
-#define _p(val)		((void *)(unsigned long)(val))
-
-#define tolower(c)	((c) | 0x20)
-
 #endif /* __BOOT_DEFS_H__ */
diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c
index ac8b58b695..eb9902d73f 100644
--- a/xen/arch/x86/boot/reloc.c
+++ b/xen/arch/x86/boot/reloc.c
@@ -26,6 +26,7 @@ asm (
     "    jmp  reloc                    \n"
     );
 
+#include <xen/macros.h>
 #include <xen/types.h>
 
 #include "defs.h"
@@ -76,7 +77,7 @@ static uint32_t alloc;
 
 static uint32_t alloc_mem(uint32_t bytes)
 {
-    return alloc -= ALIGN_UP(bytes, 16);
+    return alloc -= ROUNDUP(bytes, 16);
 }
 
 static void zero_mem(uint32_t s, uint32_t bytes)
@@ -202,11 +203,11 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
     zero_mem(ptr, sizeof(*mbi_out));
 
     /* Skip Multiboot2 information fixed part. */
-    ptr = ALIGN_UP(mbi_in + sizeof(*mbi_fix), MULTIBOOT2_TAG_ALIGN);
+    ptr = ROUNDUP(mbi_in + sizeof(*mbi_fix), MULTIBOOT2_TAG_ALIGN);
 
     /* Get the number of modules. */
     for ( tag = _p(ptr); (uint32_t)tag - mbi_in < mbi_fix->total_size;
-          tag = _p(ALIGN_UP((uint32_t)tag + tag->size, MULTIBOOT2_TAG_ALIGN)) )
+          tag = _p(ROUNDUP((uint32_t)tag + tag->size, MULTIBOOT2_TAG_ALIGN)) )
     {
         if ( tag->type == MULTIBOOT2_TAG_TYPE_MODULE )
             ++mbi_out->mods_count;
@@ -227,11 +228,11 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
     }
 
     /* Skip Multiboot2 information fixed part. */
-    ptr = ALIGN_UP(mbi_in + sizeof(*mbi_fix), MULTIBOOT2_TAG_ALIGN);
+    ptr = ROUNDUP(mbi_in + sizeof(*mbi_fix), MULTIBOOT2_TAG_ALIGN);
 
     /* Put all needed data into mbi_out. */
     for ( tag = _p(ptr); (uint32_t)tag - mbi_in < mbi_fix->total_size;
-          tag = _p(ALIGN_UP((uint32_t)tag + tag->size, MULTIBOOT2_TAG_ALIGN)) )
+          tag = _p(ROUNDUP((uint32_t)tag + tag->size, MULTIBOOT2_TAG_ALIGN)) )
     {
         switch ( tag->type )
         {
diff --git a/xen/include/xen/kernel.h b/xen/include/xen/kernel.h
index bc2440b5f9..c5b6cc9777 100644
--- a/xen/include/xen/kernel.h
+++ b/xen/include/xen/kernel.h
@@ -5,43 +5,9 @@
  * 'kernel.h' contains some often-used function prototypes etc
  */
 
+#include <xen/macros.h>
 #include <xen/types.h>
 
-/*
- * min()/max() macros that also do
- * strict type-checking.. See the
- * "unnecessary" pointer comparison.
- */
-#define min(x,y) ({ \
-        const typeof(x) _x = (x);       \
-        const typeof(y) _y = (y);       \
-        (void) (&_x == &_y);            \
-        _x < _y ? _x : _y; })
-
-#define max(x,y) ({ \
-        const typeof(x) _x = (x);       \
-        const typeof(y) _y = (y);       \
-        (void) (&_x == &_y);            \
-        _x > _y ? _x : _y; })
-
-/*
- * ..and if you can't take the strict
- * types, you can specify one yourself.
- *
- * Or not use min/max at all, of course.
- */
-#define min_t(type,x,y) \
-        ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
-#define max_t(type,x,y) \
-        ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
-
-/*
- * pre-processor, array size, and bit field width suitable variants;
- * please don't use in "normal" expressions.
- */
-#define MIN(x,y) ((x) < (y) ? (x) : (y))
-#define MAX(x,y) ((x) > (y) ? (x) : (y))
-
 /**
  * container_of - cast a member of a structure out to the containing structure
  *
diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
index 394319c818..e884a02ee8 100644
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -57,8 +57,6 @@ static inline void
 debugtrace_printk(const char *fmt, ...) {}
 #endif
 
-/* Allows us to use '%p' as general-purpose machine-word format char. */
-#define _p(_x) ((void *)(unsigned long)(_x))
 extern void printk(const char *fmt, ...)
     __attribute__ ((format (printf, 1, 2), cold));
 
diff --git a/xen/include/xen/macros.h b/xen/include/xen/macros.h
index 44d723fd12..19caaa8026 100644
--- a/xen/include/xen/macros.h
+++ b/xen/include/xen/macros.h
@@ -101,6 +101,50 @@
  */
 #define sizeof_field(type, member) sizeof(((type *)NULL)->member)
 
+/* Cast an arbitrary integer to a pointer. */
+#define _p(x) ((void *)(unsigned long)(x))
+
+/*
+ * min()/max() macros that also do strict type-checking..
+ */
+#define min(x, y)                               \
+    ({                                          \
+        const typeof(x) _x = (x);               \
+        const typeof(y) _y = (y);               \
+        (void)(&_x == &_y); /* typecheck */     \
+        _x < _y ? _x : _y;                      \
+    })
+#define max(x, y)                               \
+    ({                                          \
+        const typeof(x) _x = (x);               \
+        const typeof(y) _y = (y);               \
+        (void)(&_x == &_y); /* typecheck */     \
+        _x > _y ? _x : _y;                      \
+    })
+
+/*
+ * ..and if you can't take the strict types, you can specify one yourself.
+ */
+#define min_t(type, x, y)                       \
+    ({                                          \
+        type __x = (x);                         \
+        type __y = (y);                         \
+        __x < __y ? __x: __y;                   \
+    })
+#define max_t(type, x, y)                       \
+    ({                                          \
+        type __x = (x);                         \
+        type __y = (y);                         \
+        __x > __y ? __x: __y;                   \
+    })
+
+/*
+ * pre-processor, array size, and bit field width suitable variants;
+ * please don't use in "normal" expressions.
+ */
+#define MIN(x, y) ((x) < (y) ? (x) : (y))
+#define MAX(x, y) ((x) > (y) ? (x) : (y))
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __MACROS_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 04 19:11:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Sep 2024 19:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.790678.1200504 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slvPh-000376-Qa; Wed, 04 Sep 2024 19:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 790678.1200504; Wed, 04 Sep 2024 19:11:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slvPh-00036z-Ny; Wed, 04 Sep 2024 19:11:33 +0000
Received: by outflank-mailman (input) for mailman id 790678;
 Wed, 04 Sep 2024 19:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvPg-00036l-Io
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvPg-0005zc-Hz
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvPg-0000Ox-GR
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ckp8etiP22LmYMWNc6OnvgWtfQlGHhqe8yn0h/bTB3k=; b=Elgxe1QhCJhXkcco9r5b2Wnfkw
	oGkHFOlGyY7xHNKp3P4/x+fFtzvr1xth81nboUZU7d53G+szEmApbDt3f3LR46jUY/vi99YHRHFAv
	fITERTc4CT3IS9gtly4NsYhtFycY88B/mem8JyPMtjZc04PUJndXowGvZNNejvr+PKgU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Use fastcall for 32bit code
Message-Id: <E1slvPg-0000Ox-GR@xenbits.xenproject.org>
Date: Wed, 04 Sep 2024 19:11:32 +0000

commit 62da0b364a507d3fe48dcdb7c38592cc1848342f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Sep 2 12:11:51 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 15:51:44 2024 +0100

    x86/boot: Use fastcall for 32bit code
    
    This is marginally more efficient, but is mostly to get rid of the use of
    stdcall in cmdline.c and reloc.c
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/boot/Makefile  |  2 +-
 xen/arch/x86/boot/cmdline.c |  6 +++---
 xen/arch/x86/boot/defs.h    |  1 -
 xen/arch/x86/boot/head.S    | 15 ++++++++-------
 xen/arch/x86/boot/reloc.c   | 12 ++++++------
 5 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index de47740277..8f5bbff0cc 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -13,7 +13,7 @@ $(obj)/head.o: $(head-bin-objs:.o=.bin)
 
 CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_TREEWIDE_CFLAGS))
 $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
-CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float
+CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float -mregparm=3
 CFLAGS_x86_32 += -nostdinc -include $(filter %/include/xen/config.h,$(XEN_CFLAGS))
 CFLAGS_x86_32 += $(filter -I%,$(XEN_CFLAGS))
 
diff --git a/xen/arch/x86/boot/cmdline.c b/xen/arch/x86/boot/cmdline.c
index b7375d1066..c1d21180b6 100644
--- a/xen/arch/x86/boot/cmdline.c
+++ b/xen/arch/x86/boot/cmdline.c
@@ -20,8 +20,8 @@
 
 /*
  * This entry point is entered from xen/arch/x86/boot/head.S with:
- *   - 0x4(%esp) = &cmdline,
- *   - 0x8(%esp) = &early_boot_opts.
+ *   - %eax      = &cmdline,
+ *   - %edx      = &early_boot_opts.
  */
 asm (
     "    .text                         \n"
@@ -347,7 +347,7 @@ static void vga_parse(const char *cmdline, early_boot_opts_t *ebo)
 #endif
 
 /* SAF-1-safe */
-void __stdcall cmdline_parse_early(const char *cmdline, early_boot_opts_t *ebo)
+void cmdline_parse_early(const char *cmdline, early_boot_opts_t *ebo)
 {
     if ( !cmdline )
         return;
diff --git a/xen/arch/x86/boot/defs.h b/xen/arch/x86/boot/defs.h
index 4d519ac4f5..d733ee9b8b 100644
--- a/xen/arch/x86/boot/defs.h
+++ b/xen/arch/x86/boot/defs.h
@@ -22,6 +22,5 @@
 
 #define __maybe_unused	__attribute__((__unused__))
 #define __packed	__attribute__((__packed__))
-#define __stdcall	__attribute__((__stdcall__))
 
 #endif /* __BOOT_DEFS_H__ */
diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index d867b015d9..12bbb97f33 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -613,10 +613,11 @@ trampoline_setup:
 
         /* Save Multiboot / PVH info struct (after relocation) for later use. */
         push    %edx                /* Boot video info to be filled from MB2. */
-        push    %ecx                /* Bottom-most low-memory stack address. */
-        push    %ebx                /* Multiboot / PVH information address. */
-        push    %eax                /* Magic number. */
+        mov     %ebx, %edx          /* Multiboot / PVH information address. */
+        /*      reloc(magic/eax, info/edx, trampoline/ecx, video/stk) using fastcall. */
         call    reloc
+        add     $4, %esp
+
 #ifdef CONFIG_PVH_GUEST
         cmpb    $0, sym_esi(pvh_boot)
         je      1f
@@ -848,9 +849,9 @@ trampoline_setup:
         testl   $MBI_CMDLINE,MB_flags(%ebx)
         jz      1f
 
-        lea     sym_esi(early_boot_opts),%eax
-        push    %eax
-        pushl   MB_cmdline(%ebx)
+        lea     sym_esi(early_boot_opts), %edx
+        mov     MB_cmdline(%ebx), %eax
+        /*      cmdline_parse_early(cmdline/eax, opts/edx) using fastcall. */
         call    cmdline_parse_early
 
 1:
@@ -871,7 +872,7 @@ trampoline_setup:
 
         /*
          * cmdline and reloc are written in C, and linked to be 32bit PIC with
-         * entrypoints at 0 and using the stdcall convention.
+         * entrypoints at 0 and using the fastcall convention.
          */
         ALIGN
 cmdline_parse_early:
diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c
index eb9902d73f..38adca1f36 100644
--- a/xen/arch/x86/boot/reloc.c
+++ b/xen/arch/x86/boot/reloc.c
@@ -14,10 +14,10 @@
 
 /*
  * This entry point is entered from xen/arch/x86/boot/head.S with:
- *   - 0x04(%esp) = MAGIC,
- *   - 0x08(%esp) = INFORMATION_ADDRESS,
- *   - 0x0c(%esp) = TOPMOST_LOW_MEMORY_STACK_ADDRESS.
- *   - 0x10(%esp) = BOOT_VIDEO_INFO_ADDRESS.
+ *   - %eax       = MAGIC,
+ *   - %edx       = INFORMATION_ADDRESS,
+ *   - %ecx       = TOPMOST_LOW_MEMORY_STACK_ADDRESS.
+ *   - 0x04(%esp) = BOOT_VIDEO_INFO_ADDRESS.
  */
 asm (
     "    .text                         \n"
@@ -354,8 +354,8 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
 }
 
 /* SAF-1-safe */
-void *__stdcall reloc(uint32_t magic, uint32_t in, uint32_t trampoline,
-                      uint32_t video_info)
+void *reloc(uint32_t magic, uint32_t in, uint32_t trampoline,
+            uint32_t video_info)
 {
     alloc = trampoline;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 04 19:11:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Sep 2024 19:11:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.790680.1200508 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slvPr-0003AE-TK; Wed, 04 Sep 2024 19:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 790680.1200508; Wed, 04 Sep 2024 19:11:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slvPr-0003A7-Qu; Wed, 04 Sep 2024 19:11:43 +0000
Received: by outflank-mailman (input) for mailman id 790680;
 Wed, 04 Sep 2024 19:11:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvPq-00039v-LY
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:11:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvPq-0005zl-Kt
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvPq-0000Pf-K2
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:11:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=y3b4kIUg9FWvB4lS5qJU31sFEItwg560A0wlpBPpvXs=; b=49n6hsRB0/ULHoH0CKDLuMfyBU
	RxunqbjOHoZw1fc9XvU5DBGlhlRAfo3yiuJ4wntDPlYKEQVXdVqCd0GsMi9XDQzOvEQjUl+gquK5H
	87q8ckTmczNzL3T8XZoVwo/P4Vc1ICPrZb4lfm26h63mvfyJD0ofPuqY/Y3I8yDcr7Xo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Use <xen/compiler.h>
Message-Id: <E1slvPq-0000Pf-K2@xenbits.xenproject.org>
Date: Wed, 04 Sep 2024 19:11:42 +0000

commit ad783c71f75f4938d00e2c234816e7656d4822a5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Sep 2 13:01:40 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 15:51:44 2024 +0100

    x86/boot: Use <xen/compiler.h>
    
    ... rather than opencoding locally.  With this, defs.h is empty so delete it.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/boot/cmdline.c |  2 +-
 xen/arch/x86/boot/defs.h    | 26 --------------------------
 xen/arch/x86/boot/reloc.c   |  3 +--
 3 files changed, 2 insertions(+), 29 deletions(-)

diff --git a/xen/arch/x86/boot/cmdline.c b/xen/arch/x86/boot/cmdline.c
index c1d21180b6..fc9241ede9 100644
--- a/xen/arch/x86/boot/cmdline.c
+++ b/xen/arch/x86/boot/cmdline.c
@@ -30,11 +30,11 @@ asm (
     "    jmp  cmdline_parse_early      \n"
     );
 
+#include <xen/compiler.h>
 #include <xen/kconfig.h>
 #include <xen/macros.h>
 #include <xen/types.h>
 
-#include "defs.h"
 #include "video.h"
 
 /* Keep in sync with trampoline.S:early_boot_opts label! */
diff --git a/xen/arch/x86/boot/defs.h b/xen/arch/x86/boot/defs.h
deleted file mode 100644
index d733ee9b8b..0000000000
--- a/xen/arch/x86/boot/defs.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * max() was copied from xen/xen/include/xen/kernel.h.
- */
-
-#ifndef __BOOT_DEFS_H__
-#define __BOOT_DEFS_H__
-
-#define __maybe_unused	__attribute__((__unused__))
-#define __packed	__attribute__((__packed__))
-
-#endif /* __BOOT_DEFS_H__ */
diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c
index 38adca1f36..201e38d544 100644
--- a/xen/arch/x86/boot/reloc.c
+++ b/xen/arch/x86/boot/reloc.c
@@ -26,11 +26,10 @@ asm (
     "    jmp  reloc                    \n"
     );
 
+#include <xen/compiler.h>
 #include <xen/macros.h>
 #include <xen/types.h>
 
-#include "defs.h"
-
 #include <xen/kconfig.h>
 #include <xen/multiboot.h>
 #include <xen/multiboot2.h>
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 04 19:11:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Sep 2024 19:11:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.790682.1200513 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slvQ1-0003Cv-VM; Wed, 04 Sep 2024 19:11:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 790682.1200513; Wed, 04 Sep 2024 19:11:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slvQ1-0003Cn-SN; Wed, 04 Sep 2024 19:11:53 +0000
Received: by outflank-mailman (input) for mailman id 790682;
 Wed, 04 Sep 2024 19:11:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvQ0-0003Ca-Oj
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:11:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvQ0-0005zy-Ny
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvQ0-0000Qp-My
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:11:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=faov6M+B3by7XqPTg0ouKpVrZYnP86oOWfuraFpWcB0=; b=CrtXammgHgAkpDPJnV/3Ar408x
	Fh+Y1PVL7qkWhxVvTuWlqjWAKyiJYzOLfiveC1wGZhxg/M/lxsTxASjJRNDLj9hhO/cDTj0TTrmxD
	MF6ITm4onLUzV2fb4urIlq/PcXQmJyNE9Tv0lp9+9IxOJKjs7YX0/fnI/YkQKfv6FkXU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ARM/div: Drop __div64_fls()
Message-Id: <E1slvQ0-0000Qp-My@xenbits.xenproject.org>
Date: Wed, 04 Sep 2024 19:11:52 +0000

commit 2eb32c6c2d3ae25a85409e7388ab01bf3f0487ac
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 23 13:23:00 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 15:51:44 2024 +0100

    ARM/div: Drop __div64_fls()
    
    Following the improvements to Xen's bitops, fls() does constant propagation in
    all cases.  Use it, and drop the local opencoded helper.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/include/asm/div64.h | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/xen/arch/arm/include/asm/div64.h b/xen/arch/arm/include/asm/div64.h
index 0459d5cc01..da1f1fcbd5 100644
--- a/xen/arch/arm/include/asm/div64.h
+++ b/xen/arch/arm/include/asm/div64.h
@@ -102,7 +102,7 @@
 		/* preserve low part of n for reminder computation */	\
 		__r = __n;						\
 		/* determine number of bits to represent __b */		\
-		__p = 1 << __div64_fls(__b);				\
+		__p = 1 << fls(__b);					\
 		/* compute __m = ((__p << 64) + __b - 1) / __b */	\
 		__m = (~0ULL / __b) * __p;				\
 		__m += (((~0ULL % __b + 1) * __p) + __b - 1) / __b;	\
@@ -150,8 +150,8 @@
 				__p /= (__m & -__m);			\
 				__m /= (__m & -__m);			\
 			} else {					\
-				__p >>= __div64_fls(__bits);		\
-				__m >>= __div64_fls(__bits);		\
+				__p >>= fls(__bits);			\
+				__m >>= fls(__bits);			\
 			}						\
 			/* No correction needed. */			\
 			__c = 0;					\
@@ -217,18 +217,6 @@
 	__r;								\
 })
 
-/* our own fls implementation to make sure constant propagation is fine */
-#define __div64_fls(bits)						\
-({									\
-	unsigned int __left = (bits), __nr = 0;				\
-	if (__left & 0xffff0000) __nr += 16, __left >>= 16;		\
-	if (__left & 0x0000ff00) __nr +=  8, __left >>=  8;		\
-	if (__left & 0x000000f0) __nr +=  4, __left >>=  4;		\
-	if (__left & 0x0000000c) __nr +=  2, __left >>=  2;		\
-	if (__left & 0x00000002) __nr +=  1;				\
-	__nr;								\
-})
-
 #endif /* GCC version */
 
 #endif /* BITS_PER_LONG */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 04 19:12:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Sep 2024 19:12:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.790684.1200517 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slvQC-0003G0-0L; Wed, 04 Sep 2024 19:12:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 790684.1200517; Wed, 04 Sep 2024 19:12:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slvQB-0003Fr-Ty; Wed, 04 Sep 2024 19:12:03 +0000
Received: by outflank-mailman (input) for mailman id 790684;
 Wed, 04 Sep 2024 19:12:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvQA-0003Ff-Ri
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:12:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvQA-00060J-Qv
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:12:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvQA-0000UJ-Q8
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:12:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=i8yH8mk09ZH2PbszApbEI/JrXhz6JKYd8+UzPiwn34c=; b=3LkKij2S4e5R6hI9zMWNJDJXbW
	Ljgj95O65aChPZ4fbmA2oHDMk1Aqli1mmUvsz9iiwrg0RkTxvnKR74IBYqrgcM4Nfnk/F4MA3aRkt
	uoNlTr59tas4Eu2KgebE2M5inQXrerW28Yv5ZQyw9zAW4PFBBZYeFNPMemsWRHpxP49M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ARM/vgic: Correct the expression for lr_all_full()
Message-Id: <E1slvQA-0000UJ-Q8@xenbits.xenproject.org>
Date: Wed, 04 Sep 2024 19:12:02 +0000

commit bad717f845782b4aa9699544428d4d5f3073cd24
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 30 15:20:17 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 15:51:44 2024 +0100

    ARM/vgic: Correct the expression for lr_all_full()
    
    The current expression hits UB with 31 LRs (shifting into the sign bit), and
    malfunctions with 32 LRs (shifting beyond the range of int).  Swapping 1 for
    1ULL fixes some of these, but still malfunctions at 64 LRs which is the
    architectural limit.
    
    Instead, shift -1ULL right in order to create the mask.
    
    Fixes: 596f885a3202 ("xen/arm: set GICH_HCR_UIE if all the LRs are in use")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/gic-vgic.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/gic-vgic.c b/xen/arch/arm/gic-vgic.c
index 9aa245a36d..3f14aab2ef 100644
--- a/xen/arch/arm/gic-vgic.c
+++ b/xen/arch/arm/gic-vgic.c
@@ -16,7 +16,8 @@
 #include <asm/gic.h>
 #include <asm/vgic.h>
 
-#define lr_all_full() (this_cpu(lr_mask) == ((1 << gic_get_nr_lrs()) - 1))
+#define lr_all_full()                                           \
+    (this_cpu(lr_mask) == (-1ULL >> (64 - gic_get_nr_lrs())))
 
 #undef GIC_DEBUG
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 04 19:12:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Sep 2024 19:12:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.790686.1200520 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slvQM-0003Iu-1n; Wed, 04 Sep 2024 19:12:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 790686.1200520; Wed, 04 Sep 2024 19:12:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slvQL-0003Im-VO; Wed, 04 Sep 2024 19:12:13 +0000
Received: by outflank-mailman (input) for mailman id 790686;
 Wed, 04 Sep 2024 19:12:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvQK-0003IM-UU
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:12:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvQK-00060Q-Tn
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:12:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvQK-0000V4-Sx
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:12:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RWByyVqyfpELwQ7EQAeMMiB6lNqGctFNu0MLOvfsRnU=; b=3lwz4jka1zdQdlb8m3DI7NaZhQ
	V6yzZtFMojdbGIh6XMLSYnuP0W2ZeKELjHLG1NkjYFW/8DnxjWdy92dsG1DuFS4BbzZsZ/NHYAkwA
	0qeWkzBKtts4Re0/SPUcqdc0r7vz512mP+NPz9YOTSAdUU14NCYCeK0u5m0cXYKV6AhA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ARM/vgic: Use for_each_set_bit() in gic_find_unused_lr()
Message-Id: <E1slvQK-0000V4-Sx@xenbits.xenproject.org>
Date: Wed, 04 Sep 2024 19:12:12 +0000

commit e9c703f85efcb61f67625c39b1e60c62e90d19fd
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 30 16:32:08 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 15:51:44 2024 +0100

    ARM/vgic: Use for_each_set_bit() in gic_find_unused_lr()
    
    There are no bits set in lr_mask beyond nr_lrs, so when substituting
    bitmap_for_each() for for_each_set_bit(), we don't need to worry about the
    upper bound.
    
    However, the type of lr_mask does matter, so switch it to be uint64_t * and
    move unsigned long * override until the find_next_zero_bit() call.
    
    Move lr_val into a narrower scope and drop used_lr as it's declared by
    for_each_set_bit() itself.
    
    Drop the nr_lrs variable and use gic_get_nr_lrs() in the one location its now
    used.  It hides a triple pointer dereference, and while it may not be needed
    in the PRISTINE case, it certainly doesn't need to be live across the rest of
    the function.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/gic-vgic.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/xen/arch/arm/gic-vgic.c b/xen/arch/arm/gic-vgic.c
index 3f14aab2ef..ea48c5375a 100644
--- a/xen/arch/arm/gic-vgic.c
+++ b/xen/arch/arm/gic-vgic.c
@@ -102,25 +102,23 @@ static unsigned int gic_find_unused_lr(struct vcpu *v,
                                        struct pending_irq *p,
                                        unsigned int lr)
 {
-    unsigned int nr_lrs = gic_get_nr_lrs();
-    unsigned long *lr_mask = (unsigned long *) &this_cpu(lr_mask);
-    struct gic_lr lr_val;
+    uint64_t *lr_mask = &this_cpu(lr_mask);
 
     ASSERT(spin_is_locked(&v->arch.vgic.lock));
 
     if ( unlikely(test_bit(GIC_IRQ_GUEST_PRISTINE_LPI, &p->status)) )
     {
-        unsigned int used_lr;
-
-        bitmap_for_each ( used_lr, lr_mask, nr_lrs )
+        for_each_set_bit ( used_lr, *lr_mask )
         {
+            struct gic_lr lr_val;
+
             gic_hw_ops->read_lr(used_lr, &lr_val);
             if ( lr_val.virq == p->irq )
                 return used_lr;
         }
     }
 
-    lr = find_next_zero_bit(lr_mask, nr_lrs, lr);
+    lr = find_next_zero_bit((unsigned long *)lr_mask, gic_get_nr_lrs(), lr);
 
     return lr;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 04 19:12:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Sep 2024 19:12:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.790688.1200524 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slvQW-0003Lb-3C; Wed, 04 Sep 2024 19:12:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 790688.1200524; Wed, 04 Sep 2024 19:12:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slvQW-0003LU-0g; Wed, 04 Sep 2024 19:12:24 +0000
Received: by outflank-mailman (input) for mailman id 790688;
 Wed, 04 Sep 2024 19:12:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvQV-0003LH-1P
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:12:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvQV-00060d-0g
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:12:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvQU-0000Vz-W5
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:12:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9VMx1PgXUXg9akdoE9JRiFu7lerPMmfYq4yXHb9qmI8=; b=D+OHC0jf5R2SGB4xIEOJYOC6b2
	dGy641kX3Bd1NnvGzIdy6megXjtlQP30RJen0OrAju4ec3Kp5hQ0xNA7Xk49zPXXbfcuAoykytOyB
	Tr6mtZoOCQRaB0xLB4TBjhtLE4rr6BNsp8RBA7DPuA8GZMFcYi51+ScgVLH4YgnWc6zk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/compiler: Rename __attribute_const__ to attr_const
Message-Id: <E1slvQU-0000Vz-W5@xenbits.xenproject.org>
Date: Wed, 04 Sep 2024 19:12:22 +0000

commit 3cbd5f0c187d4f8bf4db80024302cd240a61364d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Aug 28 20:42:15 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 20:22:18 2024 +0100

    xen/compiler: Rename __attribute_const__ to attr_const
    
    There's no need for the name to be so verbose.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/libs/guest/xg_dom_decompress_unsafe_zstd.c |  2 +-
 xen/arch/arm/include/asm/arm64/cpufeature.h      | 12 ++++++------
 xen/arch/x86/include/asm/byteorder.h             |  4 ++--
 xen/arch/x86/include/asm/endbr.h                 |  4 ++--
 xen/include/xen/byteorder/swab.h                 |  6 +++---
 xen/include/xen/compiler.h                       |  2 +-
 6 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/tools/libs/guest/xg_dom_decompress_unsafe_zstd.c b/tools/libs/guest/xg_dom_decompress_unsafe_zstd.c
index 7cd266444b..ff45732a36 100644
--- a/tools/libs/guest/xg_dom_decompress_unsafe_zstd.c
+++ b/tools/libs/guest/xg_dom_decompress_unsafe_zstd.c
@@ -22,7 +22,7 @@ typedef uint16_t __be16;
 typedef uint32_t __be32;
 typedef uint64_t __be64;
 
-#define __attribute_const__
+#define attr_const
 #define __force
 #define always_inline
 #define noinline
diff --git a/xen/arch/arm/include/asm/arm64/cpufeature.h b/xen/arch/arm/include/asm/arm64/cpufeature.h
index d9b9fa77cb..1bb503e857 100644
--- a/xen/arch/arm/include/asm/arm64/cpufeature.h
+++ b/xen/arch/arm/include/asm/arm64/cpufeature.h
@@ -44,25 +44,25 @@ struct arm64_ftr_bits {
 	s64		safe_val; /* safe value for FTR_EXACT features */
 };
 
-static inline int __attribute_const__
+static inline int attr_const
 cpuid_feature_extract_signed_field_width(u64 features, int field, int width)
 {
 	return (s64)(features << (64 - width - field)) >> (64 - width);
 }
 
-static inline int __attribute_const__
+static inline int attr_const
 cpuid_feature_extract_signed_field(u64 features, int field)
 {
 	return cpuid_feature_extract_signed_field_width(features, field, 4);
 }
 
-static inline unsigned int __attribute_const__
+static inline unsigned int attr_const
 cpuid_feature_extract_unsigned_field_width(u64 features, int field, int width)
 {
 	return (u64)(features << (64 - width - field)) >> (64 - width);
 }
 
-static inline unsigned int __attribute_const__
+static inline unsigned int attr_const
 cpuid_feature_extract_unsigned_field(u64 features, int field)
 {
 	return cpuid_feature_extract_unsigned_field_width(features, field, 4);
@@ -73,7 +73,7 @@ static inline u64 arm64_ftr_mask(const struct arm64_ftr_bits *ftrp)
 	return (u64)GENMASK(ftrp->shift + ftrp->width - 1, ftrp->shift);
 }
 
-static inline int __attribute_const__
+static inline int attr_const
 cpuid_feature_extract_field_width(u64 features, int field, int width, bool sign)
 {
 	return (sign) ?
@@ -81,7 +81,7 @@ cpuid_feature_extract_field_width(u64 features, int field, int width, bool sign)
 		cpuid_feature_extract_unsigned_field_width(features, field, width);
 }
 
-static inline int __attribute_const__
+static inline int attr_const
 cpuid_feature_extract_field(u64 features, int field, bool sign)
 {
 	return cpuid_feature_extract_field_width(features, field, 4, sign);
diff --git a/xen/arch/x86/include/asm/byteorder.h b/xen/arch/x86/include/asm/byteorder.h
index e935f7b2b0..a877c07f67 100644
--- a/xen/arch/x86/include/asm/byteorder.h
+++ b/xen/arch/x86/include/asm/byteorder.h
@@ -4,13 +4,13 @@
 #include <xen/types.h>
 #include <xen/compiler.h>
 
-static inline __attribute_const__ __u32 ___arch__swab32(__u32 x)
+static inline attr_const __u32 ___arch__swab32(__u32 x)
 {
     asm("bswap %0" : "=r" (x) : "0" (x));
     return x;
 }
 
-static inline __attribute_const__ __u64 ___arch__swab64(__u64 val)
+static inline attr_const __u64 ___arch__swab64(__u64 val)
 { 
     union { 
         struct { __u32 a,b; } s;
diff --git a/xen/arch/x86/include/asm/endbr.h b/xen/arch/x86/include/asm/endbr.h
index 3033e40d29..ba3bae7147 100644
--- a/xen/arch/x86/include/asm/endbr.h
+++ b/xen/arch/x86/include/asm/endbr.h
@@ -19,7 +19,7 @@
  * gen_endbr64() is written deliberately to avoid the problematic operand, and
  * marked __const__ as it is safe for the optimiser to hoist/merge/etc.
  */
-static inline uint32_t __attribute_const__ gen_endbr64(void)
+static inline uint32_t attr_const gen_endbr64(void)
 {
     uint32_t res;
 
@@ -45,7 +45,7 @@ static inline void place_endbr64(void *ptr)
  * contain an ENDBR64 instruction.  Use an encoding which isn't the default
  * P6_NOP4.  Specifically, nopw (%rcx)
  */
-static inline uint32_t __attribute_const__ gen_endbr64_poison(void)
+static inline uint32_t attr_const gen_endbr64_poison(void)
 {
     uint32_t res;
 
diff --git a/xen/include/xen/byteorder/swab.h b/xen/include/xen/byteorder/swab.h
index b7e30f0503..9f817e3c44 100644
--- a/xen/include/xen/byteorder/swab.h
+++ b/xen/include/xen/byteorder/swab.h
@@ -123,7 +123,7 @@
 #endif /* OPTIMIZE */
 
 
-static inline __attribute_const__ __u16 __fswab16(__u16 x)
+static inline attr_const __u16 __fswab16(__u16 x)
 {
     return __arch__swab16(x);
 }
@@ -136,7 +136,7 @@ static inline void __swab16s(__u16 *addr)
     __arch__swab16s(addr);
 }
 
-static inline __attribute_const__ __u32 __fswab32(__u32 x)
+static inline attr_const __u32 __fswab32(__u32 x)
 {
     return __arch__swab32(x);
 }
@@ -150,7 +150,7 @@ static inline void __swab32s(__u32 *addr)
 }
 
 #ifdef __BYTEORDER_HAS_U64__
-static inline __attribute_const__ __u64 __fswab64(__u64 x)
+static inline attr_const __u64 __fswab64(__u64 x)
 {
 #  ifdef __SWAB_64_THRU_32__
     __u32 h = x >> 32;
diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
index 444bf80142..b118e4ba62 100644
--- a/xen/include/xen/compiler.h
+++ b/xen/include/xen/compiler.h
@@ -88,7 +88,7 @@
 
 #define __constructor       __attribute__((__constructor__)) cf_check
 #define __pure              __attribute__((__pure__))
-#define __attribute_const__ __attribute__((__const__))
+#define attr_const          __attribute__((__const__))
 #define __transparent__     __attribute__((__transparent_union__))
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 04 19:12:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Sep 2024 19:12:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.790690.1200530 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slvQg-0003ON-5W; Wed, 04 Sep 2024 19:12:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 790690.1200530; Wed, 04 Sep 2024 19:12:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slvQg-0003OE-2F; Wed, 04 Sep 2024 19:12:34 +0000
Received: by outflank-mailman (input) for mailman id 790690;
 Wed, 04 Sep 2024 19:12:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvQf-0003O3-58
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:12:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvQf-000611-4O
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:12:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvQf-0000We-2o
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:12:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=28UV6SLLLWKHCV7TpQrHWpsDZ+0/PHtgvtB3DQjc8iQ=; b=HsRCeFfXJ3AiRodE0FVlDFcMla
	SH0CFQWqm7yjHnAE4x87ntXEYlxaO25KmROOYmPfwND3FsZJdZgfAR0GaYQzFJycvmj0mzIGokuHb
	xMIGfBEy4hyg1Wi3Jns2yYs/YHv6SlN+4b4BJc5o5ByqlRlphkMAECIWrRW6RJPrbdxw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/bitops: Switch from __pure to attr_const
Message-Id: <E1slvQf-0000We-2o@xenbits.xenproject.org>
Date: Wed, 04 Sep 2024 19:12:33 +0000

commit 11aa8f5ff8b85f51890a425c03f1ee30231b8e77
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Aug 28 20:43:28 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 20:22:18 2024 +0100

    xen/bitops: Switch from __pure to attr_const
    
    All of the ffs()/fls() infrastructure is in fact (attr) const, because it
    doesn't even read global state.  This allows the compiler even more
    flexibility to optimise.
    
    No functional change.
    
    Reported-by: Jan Beulich <JBeulich@suse.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/bitops.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
index 1cd43e464d..94af6da18b 100644
--- a/xen/include/xen/bitops.h
+++ b/xen/include/xen/bitops.h
@@ -32,8 +32,8 @@ extern void __bitop_bad_size(void);
  *
  * Bits are labelled from 1.  Returns 0 if given 0.
  */
-unsigned int __pure generic_ffsl(unsigned long x);
-unsigned int __pure generic_flsl(unsigned long x);
+unsigned int attr_const generic_ffsl(unsigned long x);
+unsigned int attr_const generic_flsl(unsigned long x);
 
 /**
  * generic__test_and_set_bit - Set a bit and return its old value
@@ -204,7 +204,7 @@ static always_inline bool test_bit(int nr, const volatile void *addr)
     test_bit(nr, addr);                                 \
 })
 
-static always_inline __pure unsigned int ffs(unsigned int x)
+static always_inline attr_const unsigned int ffs(unsigned int x)
 {
     if ( __builtin_constant_p(x) )
         return __builtin_ffs(x);
@@ -216,7 +216,7 @@ static always_inline __pure unsigned int ffs(unsigned int x)
 #endif
 }
 
-static always_inline __pure unsigned int ffsl(unsigned long x)
+static always_inline attr_const unsigned int ffsl(unsigned long x)
 {
     if ( __builtin_constant_p(x) )
         return __builtin_ffsl(x);
@@ -228,7 +228,7 @@ static always_inline __pure unsigned int ffsl(unsigned long x)
 #endif
 }
 
-static always_inline __pure unsigned int ffs64(uint64_t x)
+static always_inline attr_const unsigned int ffs64(uint64_t x)
 {
     if ( BITS_PER_LONG == 64 )
         return ffsl(x);
@@ -246,7 +246,7 @@ static always_inline __pure unsigned int ffs64(uint64_t x)
      sizeof(x) <= sizeof(uint64_t) ? ffs64(x) :         \
      ({ BUILD_ERROR("ffs_g() Bad input type"); 0; }))
 
-static always_inline __pure unsigned int fls(unsigned int x)
+static always_inline attr_const unsigned int fls(unsigned int x)
 {
     if ( __builtin_constant_p(x) )
         return x ? 32 - __builtin_clz(x) : 0;
@@ -258,7 +258,7 @@ static always_inline __pure unsigned int fls(unsigned int x)
 #endif
 }
 
-static always_inline __pure unsigned int flsl(unsigned long x)
+static always_inline attr_const unsigned int flsl(unsigned long x)
 {
     if ( __builtin_constant_p(x) )
         return x ? BITS_PER_LONG - __builtin_clzl(x) : 0;
@@ -270,7 +270,7 @@ static always_inline __pure unsigned int flsl(unsigned long x)
 #endif
 }
 
-static always_inline __pure unsigned int fls64(uint64_t x)
+static always_inline attr_const unsigned int fls64(uint64_t x)
 {
     if ( BITS_PER_LONG == 64 )
         return flsl(x);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 04 19:12:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Sep 2024 19:12:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.790692.1200532 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slvQq-0003Rl-7i; Wed, 04 Sep 2024 19:12:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 790692.1200532; Wed, 04 Sep 2024 19:12:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slvQq-0003Re-5H; Wed, 04 Sep 2024 19:12:44 +0000
Received: by outflank-mailman (input) for mailman id 790692;
 Wed, 04 Sep 2024 19:12:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvQp-0003RS-8w
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:12:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvQp-000618-7s
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:12:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvQp-0000XU-6W
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:12:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QIPKRbxICYw2KCRuL8QwLH8JYsC2mGgf/x5sBZ4QOiE=; b=z9t27XuzEwjZ34J4WJCDV8EA2l
	UI6cWd9SNT7+2Vt5lC8NF9scEYJ8n7eEppnBgDidpVjj+GYXf3QvWUCklP1kdldaPEwW0pUOz5rKJ
	avT0U/DPBqpREmdeEky3oKesmqdeMEvmX1+j+XYz4Pkqnx1EwXxPNkyP6iU5pDX1hmbM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/bitops: Introduce a multiple_bits_set() helper
Message-Id: <E1slvQp-0000XU-6W@xenbits.xenproject.org>
Date: Wed, 04 Sep 2024 19:12:43 +0000

commit bd1664db7b7d1646b9dcd01658c8667bf01a68d5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 22 16:38:53 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 20:22:18 2024 +0100

    xen/bitops: Introduce a multiple_bits_set() helper
    
    This will be used to simplify real logic in the following patch.  Add compile
    and boot time testing as with other bitops.
    
    Because the expression is so simple, implement it as a function-like macro
    which is generic on the type of it's argument, rather than having multiple
    variants.
    
    Testing function-like macros needs a minor adjustments to the infrastructure
    in xen/self-tests.h to avoid bracketing the fn parameter.  The utility of this
    outweighs the associated risks.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/bitops.c          | 23 +++++++++++++++++++++++
 xen/include/xen/bitops.h     | 10 ++++++++++
 xen/include/xen/self-tests.h | 10 ++++++++--
 3 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/xen/common/bitops.c b/xen/common/bitops.c
index 9e532f0d87..b504dd1308 100644
--- a/xen/common/bitops.c
+++ b/xen/common/bitops.c
@@ -112,9 +112,32 @@ static void __init test_for_each_set_bit(void)
         panic("for_each_set_bit(uint64) expected %#"PRIx64", got %#"PRIx64"\n", ull, ull_res);
 }
 
+static void __init test_multiple_bits_set(void)
+{
+    /*
+     * multiple_bits_set() is generic on the type of it's parameter, as the
+     * internal expression is so simple.
+     */
+
+    CHECK(multiple_bits_set, 0, false);
+    CHECK(multiple_bits_set, 1, false);
+    CHECK(multiple_bits_set, 2, false);
+    CHECK(multiple_bits_set, 3, true);
+
+    CHECK(multiple_bits_set, 1 | (1UL << (BITS_PER_LONG - 1)), true);
+#if BITS_PER_LONG > 32
+    CHECK(multiple_bits_set, 1 | (1UL << 32), true);
+#endif
+
+    CHECK(multiple_bits_set, 0x8000000000000001ULL, true);
+    CHECK(multiple_bits_set, 0xc000000000000000ULL, true);
+}
+
 static void __init __constructor test_bitops(void)
 {
     test_ffs();
     test_fls();
     test_for_each_set_bit();
+
+    test_multiple_bits_set();
 }
diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
index 94af6da18b..4d51708c4a 100644
--- a/xen/include/xen/bitops.h
+++ b/xen/include/xen/bitops.h
@@ -296,6 +296,16 @@ static always_inline attr_const unsigned int fls64(uint64_t x)
               __v && ((iter) = ffs_g(__v) - 1, true);   \
               __v &= __v - 1 )
 
+/*
+ * Calculate if a value has two or more bits set.  Always use this in
+ * preference to an expression of the form 'hweight(x) > 1'.
+ */
+#define multiple_bits_set(x)                    \
+    ({                                          \
+        typeof(x) _v = (x);                     \
+        (_v & (_v - 1)) != 0;                   \
+    })
+
 /* --------------------- Please tidy below here --------------------- */
 
 #ifndef find_next_bit
diff --git a/xen/include/xen/self-tests.h b/xen/include/xen/self-tests.h
index e9a8794893..bd8a4867aa 100644
--- a/xen/include/xen/self-tests.h
+++ b/xen/include/xen/self-tests.h
@@ -15,11 +15,14 @@
  *
  * Clang < 8 can't fold constants through static inlines, causing this to
  * fail.  Simply skip it for incredibly old compilers.
+ *
+ * N.B. fn is intentionally not bracketed to allow us to test function-like
+ * macros too.
  */
 #if !defined(CONFIG_CC_IS_CLANG) || CONFIG_CLANG_VERSION >= 80000
 #define COMPILE_CHECK(fn, val, res)                                     \
     do {                                                                \
-        typeof((fn)(val)) real = (fn)(val);                             \
+        typeof(fn(val)) real = fn(val);                                 \
                                                                         \
         if ( !__builtin_constant_p(real) )                              \
             BUILD_ERROR("'" STR(fn(val)) "' not compile-time constant"); \
@@ -34,10 +37,13 @@
  * Check that Xen's runtime logic for fn(val) gives the expected answer.  This
  * requires using HIDE() to prevent the optimiser from collapsing the logic
  * into a constant.
+ *
+ * N.B. fn is intentionally not bracketed to allow us to test function-like
+ * macros too.
  */
 #define RUNTIME_CHECK(fn, val, res)                     \
     do {                                                \
-        typeof((fn)(val)) real = (fn)(HIDE(val));       \
+        typeof(fn(val)) real = fn(HIDE(val));           \
                                                         \
         if ( real != (res) )                            \
             panic("%s: %s(%s) expected %u, got %u\n",   \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 04 19:12:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Sep 2024 19:12:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.790697.1200549 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slvR0-0003jT-MK; Wed, 04 Sep 2024 19:12:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 790697.1200549; Wed, 04 Sep 2024 19:12:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slvR0-0003jA-Hf; Wed, 04 Sep 2024 19:12:54 +0000
Received: by outflank-mailman (input) for mailman id 790697;
 Wed, 04 Sep 2024 19:12:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvQz-0003il-BY
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:12:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvQz-00061K-Ap
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:12:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvQz-0000YZ-A7
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:12:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fdL7sLWEAaJghKllnN6qYUYqghfHzUGIJw3JUM7XTXE=; b=VTZr7+mMObhSfSoyol+KgkcLYE
	kFFxLGPdVrR3/7gfHLMErZGdiOCin45jy7Eb+QCk3rFV0bh8IDQia04lbTAkrAykLjN8Bcu6UCEP4
	hxCegZ6LDkfT8UWeSuH3ty6psQrCN+i7BCz6rhQazTiiUCxWoSi2BCwZUA/VAXMel5rQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/bitops: Convert 'hweight(x) > 1' to new multiple_bits_set()
Message-Id: <E1slvQz-0000YZ-A7@xenbits.xenproject.org>
Date: Wed, 04 Sep 2024 19:12:53 +0000

commit d35fb45d3c7b6d80f290ea6feea978d6ac6cca89
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 22 17:01:53 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 20:22:18 2024 +0100

    xen/bitops: Convert 'hweight(x) > 1' to new multiple_bits_set()
    
    Using hweight() is an especially expensive way of determining simply if
    multiple bits are set in a value.  Worse, 4 of the 10 hweight() calls in Xen
    are of this form.
    
    Switch to the new multiple_bits_set() helper.  This is far more efficient than
    the longhand hweight() algorithm and, owing to its simplicity, likely more
    efficient than even a dedicated instruction on a superscalar processor.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/vpmu.c   |  2 +-
 xen/arch/x86/hvm/vlapic.c | 10 ++++++----
 xen/common/numa.c         |  2 +-
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/cpu/vpmu.c b/xen/arch/x86/cpu/vpmu.c
index b2ba999412..a5bb1689c7 100644
--- a/xen/arch/x86/cpu/vpmu.c
+++ b/xen/arch/x86/cpu/vpmu.c
@@ -673,7 +673,7 @@ long do_xenpmu_op(
     {
         if ( (pmu_params.val &
               ~(XENPMU_MODE_SELF | XENPMU_MODE_HV | XENPMU_MODE_ALL)) ||
-             (hweight64(pmu_params.val) > 1) )
+             multiple_bits_set(pmu_params.val) )
             return -EINVAL;
 
         /* 32-bit dom0 can only sample itself. */
diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 2ec9594271..4a3e21a65f 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -467,12 +467,14 @@ static bool is_multicast_dest(struct vlapic *vlapic, unsigned int short_hand,
         return short_hand != APIC_DEST_SELF;
 
     if ( vlapic_x2apic_mode(vlapic) )
-        return dest_mode ? hweight16(dest) > 1 : dest == 0xffffffffU;
+        return dest_mode ? multiple_bits_set((uint16_t)dest)
+                         : dest == 0xffffffffU;
 
     if ( dest_mode )
-        return hweight8(dest &
-                        GET_xAPIC_DEST_FIELD(vlapic_get_reg(vlapic,
-                                                            APIC_DFR))) > 1;
+    {
+        dest &= GET_xAPIC_DEST_FIELD(vlapic_get_reg(vlapic, APIC_DFR));
+        return multiple_bits_set((uint8_t)dest);
+    }
 
     return dest == 0xff;
 }
diff --git a/xen/common/numa.c b/xen/common/numa.c
index 28a09766fa..ce3991929c 100644
--- a/xen/common/numa.c
+++ b/xen/common/numa.c
@@ -546,7 +546,7 @@ static int __init numa_emulation(unsigned long start_pfn,
     uint64_t sz = pfn_to_paddr(end_pfn - start_pfn) / numa_fake;
 
     /* Kludge needed for the hash function */
-    if ( hweight64(sz) > 1 )
+    if ( multiple_bits_set(sz) )
     {
         uint64_t x = 1;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 04 19:13:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Sep 2024 19:13:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.790699.1200551 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slvRA-0003q5-M7; Wed, 04 Sep 2024 19:13:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 790699.1200551; Wed, 04 Sep 2024 19:13:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slvRA-0003pv-JP; Wed, 04 Sep 2024 19:13:04 +0000
Received: by outflank-mailman (input) for mailman id 790699;
 Wed, 04 Sep 2024 19:13:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvR9-0003pN-EQ
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:13:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvR9-00061n-Dm
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:13:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvR9-0000ZU-Cy
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:13:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/5z0grH3C/hwIiXmJ0d/ej1147C+iWNjnys7G/XTark=; b=bba4vG+rvCZbu8Mt3tEMAXCdRF
	H1zmVdcEltE0NGCQybePdp2LFTfHMJaYcAEFB82bUTM4OYmYtnPNW0Ow9DkJsQcAtGfEelp7HX8V8
	8tTn12F1jv4JvNYeunNmlUYWBgk8rhFw04Yda3yN/WDcCTXk//qlL/dZhqZ3DbMFf5rA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/bitops: Introduce generic_hweightl() and hweightl()
Message-Id: <E1slvR9-0000ZU-Cy@xenbits.xenproject.org>
Date: Wed, 04 Sep 2024 19:13:03 +0000

commit 6bb2a4ff2df5b39a560beae4b6186e8061a38d66
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 22 19:04:44 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 20:22:18 2024 +0100

    xen/bitops: Introduce generic_hweightl() and hweightl()
    
    There are 6 remaining callers in Xen:
    
      * The two hweight32() calls, _domain_struct_bits() and efi_find_gop_mode(),
        are __init only.
      * The two hweight_long() calls are both in bitmap_weight().
      * The two hweight64() calls are hv_vpset_nr_banks() and x86_emulate().
    
    Only bitmap_weight() and possibly hv_vpset_nr_banks() can be considered fast
    paths, and they're all of GPR-width form.
    
    Furthermore, the differences between a generic int and generic long form is
    only an ADD and SHIFT, and only in !CONFIG_HAS_FAST_MULTIPLY builds.
    
    Therefore, it is definitely not worth having both generic implemenations.
    
    Implement generic_hweightl() based on the current generic_hweight64(),
    adjusted to be compatible with ARM32, along with standard SELF_TESTS.
    
    Implement hweightl() with usual constant-folding and arch opt-in support.  PPC
    is the only architecture that devates from generic, and it simply uses the
    builtin.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/ppc/include/asm/bitops.h |  2 ++
 xen/common/bitops.c               | 14 +++++++++++
 xen/include/xen/bitops.h          | 18 ++++++++++++++
 xen/lib/Makefile                  |  1 +
 xen/lib/generic-hweightl.c        | 49 +++++++++++++++++++++++++++++++++++++++
 5 files changed, 84 insertions(+)

diff --git a/xen/arch/ppc/include/asm/bitops.h b/xen/arch/ppc/include/asm/bitops.h
index eb3355812e..6e4e112b8b 100644
--- a/xen/arch/ppc/include/asm/bitops.h
+++ b/xen/arch/ppc/include/asm/bitops.h
@@ -124,6 +124,8 @@ static inline int test_and_set_bit(unsigned int nr, volatile void *addr)
 #define arch_fls(x)  ((x) ? 32 - __builtin_clz(x) : 0)
 #define arch_flsl(x) ((x) ? BITS_PER_LONG - __builtin_clzl(x) : 0)
 
+#define arch_hweightl(x) __builtin_popcountl(x)
+
 /**
  * hweightN - returns the hamming weight of a N-bit word
  * @x: the word to weigh
diff --git a/xen/common/bitops.c b/xen/common/bitops.c
index b504dd1308..5e5d20d225 100644
--- a/xen/common/bitops.c
+++ b/xen/common/bitops.c
@@ -133,6 +133,19 @@ static void __init test_multiple_bits_set(void)
     CHECK(multiple_bits_set, 0xc000000000000000ULL, true);
 }
 
+static void __init test_hweight(void)
+{
+    /* unsigned int hweightl(unsigned long) */
+    CHECK(hweightl, 0, 0);
+    CHECK(hweightl, 1, 1);
+    CHECK(hweightl, 3, 2);
+    CHECK(hweightl, 7, 3);
+    CHECK(hweightl, 0xff, 8);
+
+    CHECK(hweightl, 1 | (1UL << (BITS_PER_LONG - 1)), 2);
+    CHECK(hweightl, -1UL, BITS_PER_LONG);
+}
+
 static void __init __constructor test_bitops(void)
 {
     test_ffs();
@@ -140,4 +153,5 @@ static void __init __constructor test_bitops(void)
     test_for_each_set_bit();
 
     test_multiple_bits_set();
+    test_hweight();
 }
diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
index 4d51708c4a..dde84443a9 100644
--- a/xen/include/xen/bitops.h
+++ b/xen/include/xen/bitops.h
@@ -35,6 +35,12 @@ extern void __bitop_bad_size(void);
 unsigned int attr_const generic_ffsl(unsigned long x);
 unsigned int attr_const generic_flsl(unsigned long x);
 
+/*
+ * Hamming Weight, also called Population Count.  Returns the number of set
+ * bits in @x.
+ */
+unsigned int attr_const generic_hweightl(unsigned long x);
+
 /**
  * generic__test_and_set_bit - Set a bit and return its old value
  * @nr: Bit to set
@@ -306,6 +312,18 @@ static always_inline attr_const unsigned int fls64(uint64_t x)
         (_v & (_v - 1)) != 0;                   \
     })
 
+static always_inline attr_const unsigned int hweightl(unsigned long x)
+{
+    if ( __builtin_constant_p(x) )
+        return __builtin_popcountl(x);
+
+#ifdef arch_hweightl
+    return arch_hweightl(x);
+#else
+    return generic_hweightl(x);
+#endif
+}
+
 /* --------------------- Please tidy below here --------------------- */
 
 #ifndef find_next_bit
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index a485415964..b6558e108b 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -6,6 +6,7 @@ lib-y += ctype.o
 lib-y += find-next-bit.o
 lib-y += generic-ffsl.o
 lib-y += generic-flsl.o
+lib-y += generic-hweightl.o
 lib-y += list-sort.o
 lib-y += memchr.o
 lib-y += memchr_inv.o
diff --git a/xen/lib/generic-hweightl.c b/xen/lib/generic-hweightl.c
new file mode 100644
index 0000000000..c242d4c2d9
--- /dev/null
+++ b/xen/lib/generic-hweightl.c
@@ -0,0 +1,49 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <xen/bitops.h>
+#include <xen/init.h>
+#include <xen/self-tests.h>
+
+/* Value @b broadcast to every byte in a long */
+#if BITS_PER_LONG == 32
+# define BCST(b) ((b) * 0x01010101UL)
+#elif BITS_PER_LONG == 64
+# define BCST(b) ((b) * 0x0101010101010101UL)
+#else
+# error Extend me please
+#endif
+
+unsigned int generic_hweightl(unsigned long x)
+{
+    x -= (x >> 1) & BCST(0x55);
+    x =  (x & BCST(0x33)) + ((x >> 2) & BCST(0x33));
+    x =  (x + (x >> 4)) & BCST(0x0f);
+
+    if ( IS_ENABLED(CONFIG_HAS_FAST_MULTIPLY) )
+        return (x * BCST(0x01)) >> (BITS_PER_LONG - 8);
+
+    x += x >> 8;
+    x += x >> 16;
+#if BITS_PER_LONG > 32
+    x += x >> 32;
+#endif
+
+    return x & 0xff;
+}
+
+#ifdef CONFIG_SELF_TESTS
+static void __init __constructor test_generic_hweightl(void)
+{
+    RUNTIME_CHECK(generic_hweightl, 0, 0);
+    RUNTIME_CHECK(generic_hweightl, 1, 1);
+    RUNTIME_CHECK(generic_hweightl, 3, 2);
+    RUNTIME_CHECK(generic_hweightl, 7, 3);
+    RUNTIME_CHECK(generic_hweightl, 0xff, 8);
+
+    RUNTIME_CHECK(generic_hweightl, BCST(0x55), BITS_PER_LONG / 2);
+    RUNTIME_CHECK(generic_hweightl, BCST(0xaa), BITS_PER_LONG / 2);
+
+    RUNTIME_CHECK(generic_hweightl, 1 | (1UL << (BITS_PER_LONG - 1)), 2);
+    RUNTIME_CHECK(generic_hweightl, -1UL, BITS_PER_LONG);
+}
+#endif /* CONFIG_SELF_TESTS */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 04 19:13:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Sep 2024 19:13:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.790702.1200554 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slvRK-00040j-NU; Wed, 04 Sep 2024 19:13:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 790702.1200554; Wed, 04 Sep 2024 19:13:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1slvRK-00040b-Kr; Wed, 04 Sep 2024 19:13:14 +0000
Received: by outflank-mailman (input) for mailman id 790702;
 Wed, 04 Sep 2024 19:13:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvRJ-00040C-H6
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:13:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvRJ-000620-GU
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:13:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1slvRJ-0000aW-Fu
 for xen-changelog@lists.xenproject.org; Wed, 04 Sep 2024 19:13:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1FGiwTZiZakzZGFESA9hwpCC32GUov7C6CPoY3ZZOxQ=; b=3tJFc01esHcorrONljMLcaqCaz
	Y0ea0o7GLLdKeCqIApvfWaiTNq/nehD64zlxaY5It2HB79Wf1HaxhdjlXTnqQMsknQQ4gqTZEmjlu
	lsNcUe/yU7+j34msjAw417LhTQkbW2Zd0Ckfr8j1JBG1MJUzFuSFNU5XXCXSo9+weJUE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/bitops: Drop hweight_long() and use hweightl()
Message-Id: <E1slvRJ-0000aW-Fu@xenbits.xenproject.org>
Date: Wed, 04 Sep 2024 19:13:13 +0000

commit 57c8f93fc163a4a4a744aa6ee0301222a44bac4f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 22 21:37:06 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 3 20:22:18 2024 +0100

    xen/bitops: Drop hweight_long() and use hweightl()
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/bitmap.c      | 4 ++--
 xen/include/xen/bitops.h | 5 -----
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/xen/common/bitmap.c b/xen/common/bitmap.c
index 9d9ff09f3d..3da63a32a6 100644
--- a/xen/common/bitmap.c
+++ b/xen/common/bitmap.c
@@ -191,10 +191,10 @@ unsigned int __bitmap_weight(const unsigned long *bitmap, unsigned int bits)
 	unsigned int k, w = 0, lim = bits / BITS_PER_LONG;
 
 	for (k = 0; k < lim; k++)
-		w += hweight_long(bitmap[k]);
+		w += hweightl(bitmap[k]);
 
 	if (bits % BITS_PER_LONG)
-		w += hweight_long(bitmap[k] & BITMAP_LAST_WORD_MASK(bits));
+		w += hweightl(bitmap[k] & BITMAP_LAST_WORD_MASK(bits));
 
 	return w;
 }
diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
index dde84443a9..ed6b9ccc72 100644
--- a/xen/include/xen/bitops.h
+++ b/xen/include/xen/bitops.h
@@ -446,11 +446,6 @@ static inline unsigned int generic_hweight64(uint64_t w)
     return (w + (w >> 32)) & 0xFF;
 }
 
-static inline unsigned int hweight_long(unsigned long w)
-{
-    return sizeof(w) == 4 ? generic_hweight32(w) : generic_hweight64(w);
-}
-
 /*
  * rol32 - rotate a 32-bit value left
  *
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 05 15:11:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 05 Sep 2024 15:11:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.791173.1200977 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1smE8V-0006VJ-Sw; Thu, 05 Sep 2024 15:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 791173.1200977; Thu, 05 Sep 2024 15:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1smE8V-0006VB-Or; Thu, 05 Sep 2024 15:11:03 +0000
Received: by outflank-mailman (input) for mailman id 791173;
 Thu, 05 Sep 2024 15:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smE8T-0006Uz-Va
 for xen-changelog@lists.xenproject.org; Thu, 05 Sep 2024 15:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smE8T-0003Br-Tb
 for xen-changelog@lists.xenproject.org; Thu, 05 Sep 2024 15:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smE8T-0002p8-S2
 for xen-changelog@lists.xenproject.org; Thu, 05 Sep 2024 15:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/JzIfJVNlmTL/SiiYqb0AUqtsnqGUq1AJw8W5roNyVk=; b=QPO3LSeXqh3KpflvNRJnpQnFJs
	fU5ANxfXj6+ylzDl2eaTMoNWKzpxJU+4Voy5FcHRuEpkexBcIl4fRxwO0ZLeDUnxHptU/Ft1pUVCv
	tt3hQ1dlKKTO2h2nIYNsvlOc5/JPhzFQXXM7h0f9zew+8YlJ4gI/cpvCU4pLsDKQRys0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs: fusa: Add requirements for generic timer
Message-Id: <E1smE8T-0002p8-S2@xenbits.xenproject.org>
Date: Thu, 05 Sep 2024 15:11:01 +0000

commit 51ad2c57a2d21b583a5944a0dc21c709af022f3c
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Thu Aug 29 12:31:20 2024 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 3 19:39:50 2024 -0700

    docs: fusa: Add requirements for generic timer
    
    Add the requirements for the use of generic timer by a domain
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 docs/fusa/reqs/design-reqs/arm64/generic-timer.rst | 123 +++++++++++++++++++++
 docs/fusa/reqs/index.rst                           |   3 +
 docs/fusa/reqs/intro.rst                           |   3 +-
 docs/fusa/reqs/market-reqs/reqs.rst                |  34 ++++++
 docs/fusa/reqs/product-reqs/arm64/reqs.rst         |  23 ++++
 5 files changed, 185 insertions(+), 1 deletion(-)

diff --git a/docs/fusa/reqs/design-reqs/arm64/generic-timer.rst b/docs/fusa/reqs/design-reqs/arm64/generic-timer.rst
new file mode 100644
index 0000000000..f2a0cd7fb8
--- /dev/null
+++ b/docs/fusa/reqs/design-reqs/arm64/generic-timer.rst
@@ -0,0 +1,123 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+Generic Timer
+=============
+
+The following are the requirements related to ARM Generic Timer [1] interface
+exposed by Xen to Arm64 domains.
+
+Probe the Generic Timer device tree node from a domain
+------------------------------------------------------
+
+`XenSwdgn~arm64_generic_timer_probe_dt~1`
+
+Description:
+Xen shall generate a device tree node for the Generic Timer (in accordance to
+ARM architected timer device tree binding [2]) in the domain device tree.
+
+Rationale:
+
+Comments:
+Domains can detect the presence of the Generic Timer device tree node.
+
+Covers:
+ - `XenProd~emulated_timer~1`
+
+Read system counter frequency
+-----------------------------
+
+`XenSwdgn~arm64_generic_timer_read_freq~1`
+
+Description:
+Xen shall expose the frequency of the system counter to the domains in
+CNTFRQ_EL0 register and/or domain device tree's "clock-frequency" property.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_timer~1`
+
+Access CNTKCTL_EL1 system register from a domain
+------------------------------------------------
+
+`XenSwdgn~arm64_generic_timer_access_cntkctlel1~1`
+
+Description:
+Xen shall expose Counter-timer Kernel Control register (CNTKCTL_EL1) to the
+domains.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_timer~1`
+
+Access virtual timer from a domain
+----------------------------------
+
+`XenSwdgn~arm64_generic_timer_access_virtual_timer~1`
+
+Description:
+Xen shall expose the virtual timer registers (CNTVCT_EL0, CNTV_CTL_EL0,
+CNTV_CVAL_EL0, CNTV_TVAL_EL0) to the domains.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_timer~1`
+
+Access physical timer from a domain
+-----------------------------------
+
+`XenSwdgn~arm64_generic_timer_access_physical_timer~1`
+
+Description:
+Xen shall expose physical timer registers (CNTPCT_EL0, CNTP_CTL_EL0,
+CNTP_CVAL_EL0, CNTP_TVAL_EL0) to the domains.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_timer~1`
+
+Trigger the virtual timer interrupt from a domain
+-------------------------------------------------
+
+`XenSwdgn~arm64_generic_timer_trigger_virtual_interrupt~1`
+
+Description:
+Xen shall generate virtual timer interrupts to domains when the virtual timer
+condition is met.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_timer~1`
+
+Trigger the physical timer interrupt from a domain
+--------------------------------------------------
+
+`XenSwdgn~arm64_generic_timer_trigger_physical_interrupt~1`
+
+Description:
+Xen shall generate physical timer interrupts to domains when the physical timer
+condition is met.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_timer~1`
+
+[1] Arm Architecture Reference Manual for A-profile architecture, Chapter 11
+[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/timer/arm,arch_timer.yaml
diff --git a/docs/fusa/reqs/index.rst b/docs/fusa/reqs/index.rst
index 78c02b1d9b..183f183b1f 100644
--- a/docs/fusa/reqs/index.rst
+++ b/docs/fusa/reqs/index.rst
@@ -7,3 +7,6 @@ Requirements documentation
    :maxdepth: 2
 
    intro
+   market-reqs
+   product-reqs
+   design-reqs/arm64
diff --git a/docs/fusa/reqs/intro.rst b/docs/fusa/reqs/intro.rst
index d67b18dd9f..245a219ff2 100644
--- a/docs/fusa/reqs/intro.rst
+++ b/docs/fusa/reqs/intro.rst
@@ -55,7 +55,8 @@ Title of the requirement
   be 'XenMkt', 'XenProd' or 'XenSwdgn' to denote market, product or design
   requirement.
   name - This denotes name of the requirement. In case of architecture specific
-  requirements, this starts with the architecture type (ie x86_64, arm64).
+  requirements, this starts with the architecture type (eg x86_64, arm64)
+  followed by component name (eg generic_timer) and action (eg read_xxx).
   revision number - This gets incremented each time the requirement is modified.
 
 
diff --git a/docs/fusa/reqs/market-reqs/reqs.rst b/docs/fusa/reqs/market-reqs/reqs.rst
new file mode 100644
index 0000000000..9c98c84a9a
--- /dev/null
+++ b/docs/fusa/reqs/market-reqs/reqs.rst
@@ -0,0 +1,34 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+Functional Requirements
+=======================
+
+Run Arm64 VMs
+-------------
+
+`XenMkt~run_arm64_vms~1`
+
+Description:
+Xen shall run Arm64 VMs.
+
+Rationale:
+
+Comments:
+
+Needs:
+ - XenProd
+
+Provide timer to the VMs
+------------------------
+
+`XenMkt~provide_timer_vms~1`
+
+Description:
+Xen shall provide a timer to a VM.
+
+Rationale:
+
+Comments:
+
+Needs:
+ - XenProd
diff --git a/docs/fusa/reqs/product-reqs/arm64/reqs.rst b/docs/fusa/reqs/product-reqs/arm64/reqs.rst
new file mode 100644
index 0000000000..7aa3eeab6a
--- /dev/null
+++ b/docs/fusa/reqs/product-reqs/arm64/reqs.rst
@@ -0,0 +1,23 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+Domain Creation And Runtime
+===========================
+
+Emulated Timer
+--------------
+
+`XenProd~emulated_timer~1`
+
+Description:
+Xen shall grant access to "Arm Generic Timer" for the domains.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenMkt~run_arm64_vms~1`
+ - `XenMkt~provide_timer_vms~1`
+
+Needs:
+ - XenSwdgn
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 05 15:11:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 05 Sep 2024 15:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.791175.1200979 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1smE8e-0006XK-TA; Thu, 05 Sep 2024 15:11:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 791175.1200979; Thu, 05 Sep 2024 15:11:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1smE8e-0006XC-QP; Thu, 05 Sep 2024 15:11:12 +0000
Received: by outflank-mailman (input) for mailman id 791175;
 Thu, 05 Sep 2024 15:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smE8e-0006X6-27
 for xen-changelog@lists.xenproject.org; Thu, 05 Sep 2024 15:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smE8e-0003Bv-1G
 for xen-changelog@lists.xenproject.org; Thu, 05 Sep 2024 15:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smE8d-0002qI-WB
 for xen-changelog@lists.xenproject.org; Thu, 05 Sep 2024 15:11:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nQDCZ8bUR+lzZVpinmVqBTwsuiyQBZwdKyZAsqOd/I0=; b=W1bCmsqMYac7HygXk3rNP2bsKH
	9vbYB5wgSiZNK7mFgpwhTA6IJ+DXqZ3ZjxoM5E6LKIbQjK0co0AmROma3aMS95HOw/3IUP7mMamjx
	yX37GsqeaaFhXAI4l4tgKwPV9/9ZUokL1LYOA6g3DIMeSDl38JtKWK/0jVg1A8egcJFg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: make VMAP support in MMU system only
Message-Id: <E1smE8d-0002qI-WB@xenbits.xenproject.org>
Date: Thu, 05 Sep 2024 15:11:11 +0000

commit 82b8aa7680b62f6f469fbc5f5d31ab1568baf5c2
Author:     Penny Zheng <penny.zheng@arm.com>
AuthorDate: Fri Aug 30 10:08:21 2024 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 3 19:40:20 2024 -0700

    xen: make VMAP support in MMU system only
    
    Introduce CONFIG_HAS_VMAP which is selected by the architectures that
    use MMU. vm_init() does not do anything if CONFIG_HAS_VMAP is not
    enabled.
    
    HAS_VMAP is widely used in ALTERNATIVE feature to remap a range of
    memory with new memory attributes. Since this is highly dependent on
    virtual address translation, we choose to make HAS_VMAP selected by
    MMU. And ALTERNATIVE depends on HAS_VMAP.
    
    At the moment, the users of HARDEN_BRANCH_PREDICTOR requires to use the
    vmap() to update the exceptions vectors. While it might be possible to
    rework the code, it is believed that speculative attackes would be
    difficult to exploit on non-MMU because the software is tightly
    controlled. So for now make HARDEN_BRANCH_PREDICTOR to depend on the
    MMU.
    
    Also took the opportunity to remove "#ifdef VMAP_VIRT_START .. endif"
    from vmap.c. Instead vmap.c is compiled when HAS_VMAP is enabled. Thus,
    HAS_VMAP is now enabled from x86, ppc and riscv architectures as all of
    them use MMU and has VMAP_VIRT_START defined.
    
    Signed-off-by: Penny Zheng <penny.zheng@arm.com>
    Signed-off-by: Wei Chen <wei.chen@arm.com>
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/arm/Kconfig   | 4 +++-
 xen/arch/arm/setup.c   | 2 ++
 xen/arch/ppc/Kconfig   | 1 +
 xen/arch/riscv/Kconfig | 1 +
 xen/arch/x86/Kconfig   | 1 +
 xen/common/Kconfig     | 3 +++
 xen/common/Makefile    | 2 +-
 xen/common/vmap.c      | 2 --
 xen/include/xen/vmap.h | 2 ++
 9 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 21d03d9f44..323c967361 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -12,7 +12,7 @@ config ARM_64
 config ARM
 	def_bool y
 	select FUNCTION_ALIGNMENT_4B
-	select HAS_ALTERNATIVE
+	select HAS_ALTERNATIVE if HAS_VMAP
 	select HAS_DEVICE_TREE
 	select HAS_PASSTHROUGH
 	select HAS_UBSAN
@@ -61,6 +61,7 @@ config PADDR_BITS
 config MMU
 	def_bool y
 	select HAS_PMAP
+	select HAS_VMAP
 
 source "arch/Kconfig"
 
@@ -171,6 +172,7 @@ config ARM_SSBD
 
 config HARDEN_BRANCH_PREDICTOR
 	bool "Harden the branch predictor against aliasing attacks" if EXPERT
+	depends on MMU
 	default y
 	help
 	  Speculation attacks against some high-performance processors rely on
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 961d3ea670..71ebaa77ca 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -446,7 +446,9 @@ void asmlinkage __init start_xen(unsigned long fdt_paddr)
      * It needs to be called after do_initcalls to be able to use
      * stop_machine (tasklets initialized via an initcall).
      */
+#ifdef CONFIG_HAS_ALTERNATIVE
     apply_alternatives_all();
+#endif
     enable_errata_workarounds();
     enable_cpu_features();
 
diff --git a/xen/arch/ppc/Kconfig b/xen/arch/ppc/Kconfig
index f6a77a8200..6db575a48d 100644
--- a/xen/arch/ppc/Kconfig
+++ b/xen/arch/ppc/Kconfig
@@ -2,6 +2,7 @@ config PPC
 	def_bool y
 	select FUNCTION_ALIGNMENT_4B
 	select HAS_DEVICE_TREE
+	select HAS_VMAP
 
 config PPC64
 	def_bool y
diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig
index 259eea8d3b..7a113c7774 100644
--- a/xen/arch/riscv/Kconfig
+++ b/xen/arch/riscv/Kconfig
@@ -3,6 +3,7 @@ config RISCV
 	select FUNCTION_ALIGNMENT_16B
 	select GENERIC_BUG_FRAME
 	select HAS_DEVICE_TREE
+	select HAS_VMAP
 
 config RISCV_64
 	def_bool y
diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index d0aaf359eb..dee8db45e8 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -29,6 +29,7 @@ config X86
 	select HAS_PIRQ
 	select HAS_SCHED_GRANULARITY
 	select HAS_UBSAN
+	select HAS_VMAP
 	select HAS_VPCI if HVM
 	select NEEDS_LIBELF
 
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 565ceda741..90268d9249 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -83,6 +83,9 @@ config HAS_SCHED_GRANULARITY
 config HAS_UBSAN
 	bool
 
+config HAS_VMAP
+	bool
+
 config MEM_ACCESS_ALWAYS_ON
 	bool
 
diff --git a/xen/common/Makefile b/xen/common/Makefile
index 7e66802a9e..fc52e0857d 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -52,7 +52,7 @@ obj-$(CONFIG_TRACEBUFFER) += trace.o
 obj-y += version.o
 obj-y += virtual_region.o
 obj-y += vm_event.o
-obj-y += vmap.o
+obj-$(CONFIG_HAS_VMAP) += vmap.o
 obj-y += vsprintf.o
 obj-y += wait.o
 obj-bin-y += warning.init.o
diff --git a/xen/common/vmap.c b/xen/common/vmap.c
index ced9cbf26f..47225fecc0 100644
--- a/xen/common/vmap.c
+++ b/xen/common/vmap.c
@@ -1,4 +1,3 @@
-#ifdef VMAP_VIRT_START
 #include <xen/bitmap.h>
 #include <xen/sections.h>
 #include <xen/init.h>
@@ -427,4 +426,3 @@ void *_xvrealloc(void *va, size_t size, unsigned int align)
 
     return ptr;
 }
-#endif
diff --git a/xen/include/xen/vmap.h b/xen/include/xen/vmap.h
index fdae37e950..c1dd7ac22f 100644
--- a/xen/include/xen/vmap.h
+++ b/xen/include/xen/vmap.h
@@ -141,7 +141,9 @@ void *arch_vmap_virt_end(void);
 /* Initialises the VMAP_DEFAULT virtual range */
 static inline void vm_init(void)
 {
+#ifdef CONFIG_HAS_VMAP
     vm_init_type(VMAP_DEFAULT, (void *)VMAP_VIRT_START, arch_vmap_virt_end());
+#endif
 }
 
 #endif /* __XEN_VMAP_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 05 15:11:22 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 05 Sep 2024 15:11:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.791177.1200984 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1smE8o-0006as-VD; Thu, 05 Sep 2024 15:11:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 791177.1200984; Thu, 05 Sep 2024 15:11:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1smE8o-0006ak-Rr; Thu, 05 Sep 2024 15:11:22 +0000
Received: by outflank-mailman (input) for mailman id 791177;
 Thu, 05 Sep 2024 15:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smE8o-0006aM-5L
 for xen-changelog@lists.xenproject.org; Thu, 05 Sep 2024 15:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smE8o-0003C9-4a
 for xen-changelog@lists.xenproject.org; Thu, 05 Sep 2024 15:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smE8o-0002tF-3T
 for xen-changelog@lists.xenproject.org; Thu, 05 Sep 2024 15:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=u8H/HMXic/1LlBieejsgs6oVmA3B9/6OnPXIDaeu2Jo=; b=UbzUPH6Mn8NdmcTWZsUrQ1TE7n
	Z6DDPgt7Lnidq27Ge9lMY+acSH0WQ3kh5NUbxb1gxe+PFlS0/9eyvgt6YXkBdSsBnGMKyG3Hpnqf+
	oH5o3lB/TjMherC8Ewcvvt/RoRW/WwaSGh2cff2O74tSM9QVtoGlNFsrQSdn2j53KQkY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arm/div64: Drop do_div() macro for GCC version < 4
Message-Id: <E1smE8o-0002tF-3T@xenbits.xenproject.org>
Date: Thu, 05 Sep 2024 15:11:22 +0000

commit 92b6f2f742431c8fc5328ebcc178da7fbeae85b2
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Sep 3 14:48:34 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Sep 3 19:41:31 2024 -0700

    arm/div64: Drop do_div() macro for GCC version < 4
    
    As stated in README, the minimum supported GCC version for arm32 is
    4.9, therefore drop the custom do_div() macro in favor of using the
    optimized version.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/div64.h | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/xen/arch/arm/include/asm/div64.h b/xen/arch/arm/include/asm/div64.h
index da1f1fcbd5..8fe17f0ff2 100644
--- a/xen/arch/arm/include/asm/div64.h
+++ b/xen/arch/arm/include/asm/div64.h
@@ -54,20 +54,6 @@
 	__rem;							\
 })
 
-#if __GNUC__ < 4
-
-/*
- * gcc versions earlier than 4.0 are simply too problematic for the
- * optimized implementation below. First there is gcc PR 15089 that
- * tend to trig on more complex constructs, spurious .global __udivsi3
- * are inserted even if none of those symbols are referenced in the
- * generated code, and those gcc versions are not able to do constant
- * propagation on long long values anyway.
- */
-#define do_div(n, base) __do_div_asm(n, base)
-
-#elif __GNUC__ >= 4
-
 #include <xen/bug.h>
 
 /*
@@ -217,8 +203,6 @@
 	__r;								\
 })
 
-#endif /* GCC version */
-
 #endif /* BITS_PER_LONG */
 
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 05 15:11:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 05 Sep 2024 15:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.791179.1200986 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1smE8y-0006e7-Vh; Thu, 05 Sep 2024 15:11:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 791179.1200986; Thu, 05 Sep 2024 15:11:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1smE8y-0006e0-TG; Thu, 05 Sep 2024 15:11:32 +0000
Received: by outflank-mailman (input) for mailman id 791179;
 Thu, 05 Sep 2024 15:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smE8y-0006ds-9J
 for xen-changelog@lists.xenproject.org; Thu, 05 Sep 2024 15:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smE8y-0003CR-8Y
 for xen-changelog@lists.xenproject.org; Thu, 05 Sep 2024 15:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smE8y-0002v3-6s
 for xen-changelog@lists.xenproject.org; Thu, 05 Sep 2024 15:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ARv7w8KgGM03GmKUWCYagSUIDAT2drOAfRn9I8yvLH0=; b=bLLVIDicwQw9igo/SgWdV9DIVE
	4SkgYwuYBBfuttFL9d39s5gAG1FeYX3RR5FiBhfWttcqJxsmrvd2HSGJzyahKPII2KwcK+9xS2Sqh
	qBtC6X8pBrShwPsboEfDF3pJgg5+Qv/7/wqmK/S5DqiDqYo+8MNflWWbSed7RmSOsuSA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] RISCV/shutdown: Implement machine_{halt,restart}()
Message-Id: <E1smE8y-0002v3-6s@xenbits.xenproject.org>
Date: Thu, 05 Sep 2024 15:11:32 +0000

commit 6471badeeec92db1cb8155066551f7509cd82efd
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 3 15:01:20 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Sep 4 11:27:50 2024 +0100

    RISCV/shutdown: Implement machine_{halt,restart}()
    
    SBI has an API for shutdown so wire it up.  However, the spec does allow the
    call not to be implemented, so we have to cope with sbi_shutdown() returning.
    
    There is a reboot-capable SBI extention, but in the short term route
    machine_restart() into machine_halt().
    
    Then, use use machine_halt() rather than an infinite loop at the end of
    start_xen().  This avoids the Qemu smoke test needing to wait for the full
    timeout in order to succeed.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 xen/arch/riscv/Makefile          |  1 +
 xen/arch/riscv/include/asm/sbi.h |  3 +++
 xen/arch/riscv/sbi.c             |  5 +++++
 xen/arch/riscv/setup.c           |  6 ++----
 xen/arch/riscv/shutdown.c        | 27 +++++++++++++++++++++++++++
 xen/arch/riscv/stubs.c           | 12 ------------
 6 files changed, 38 insertions(+), 16 deletions(-)

diff --git a/xen/arch/riscv/Makefile b/xen/arch/riscv/Makefile
index 81b77b13d6..d192be7b55 100644
--- a/xen/arch/riscv/Makefile
+++ b/xen/arch/riscv/Makefile
@@ -4,6 +4,7 @@ obj-y += mm.o
 obj-$(CONFIG_RISCV_64) += riscv64/
 obj-y += sbi.o
 obj-y += setup.o
+obj-y += shutdown.o
 obj-y += stubs.o
 obj-y += traps.o
 obj-y += vm_event.o
diff --git a/xen/arch/riscv/include/asm/sbi.h b/xen/arch/riscv/include/asm/sbi.h
index 0e6820a4ed..4d72a2295e 100644
--- a/xen/arch/riscv/include/asm/sbi.h
+++ b/xen/arch/riscv/include/asm/sbi.h
@@ -13,6 +13,7 @@
 #define __ASM_RISCV_SBI_H__
 
 #define SBI_EXT_0_1_CONSOLE_PUTCHAR		0x1
+#define SBI_EXT_0_1_SHUTDOWN			0x8
 
 struct sbiret {
     long error;
@@ -31,4 +32,6 @@ struct sbiret sbi_ecall(unsigned long ext, unsigned long fid,
  */
 void sbi_console_putchar(int ch);
 
+void sbi_shutdown(void);
+
 #endif /* __ASM_RISCV_SBI_H__ */
diff --git a/xen/arch/riscv/sbi.c b/xen/arch/riscv/sbi.c
index 0ae166c861..c7984344bc 100644
--- a/xen/arch/riscv/sbi.c
+++ b/xen/arch/riscv/sbi.c
@@ -42,3 +42,8 @@ void sbi_console_putchar(int ch)
 {
     sbi_ecall(SBI_EXT_0_1_CONSOLE_PUTCHAR, 0, ch, 0, 0, 0, 0, 0);
 }
+
+void sbi_shutdown(void)
+{
+    sbi_ecall(SBI_EXT_0_1_SHUTDOWN, 0, 0, 0, 0, 0, 0, 0);
+}
diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index a6a29a1508..bf9078f36a 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -4,6 +4,7 @@
 #include <xen/compile.h>
 #include <xen/init.h>
 #include <xen/mm.h>
+#include <xen/shutdown.h>
 
 #include <public/version.h>
 
@@ -28,8 +29,5 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
 
     printk("All set up\n");
 
-    for ( ;; )
-        asm volatile ("wfi");
-
-    unreachable();
+    machine_halt();
 }
diff --git a/xen/arch/riscv/shutdown.c b/xen/arch/riscv/shutdown.c
new file mode 100644
index 0000000000..3513d9af47
--- /dev/null
+++ b/xen/arch/riscv/shutdown.c
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#include <xen/shutdown.h>
+
+#include <asm/sbi.h>
+
+void machine_halt(void)
+{
+    sbi_shutdown();
+
+    /* TODO: Cope with sbi_shutdown() not being implemented. */
+
+    for ( ;; )
+        asm volatile ( "wfi" );
+
+    unreachable();
+}
+
+void machine_restart(unsigned int delay_millisecs)
+{
+    /*
+     * TODO: mdelay(delay_millisecs)
+     * TODO: Probe for #SRST support, where sbi_system_reset() has a
+     *       shutdown/reboot parameter.
+     */
+
+    machine_halt();
+}
diff --git a/xen/arch/riscv/stubs.c b/xen/arch/riscv/stubs.c
index 3285d18899..2aa245f272 100644
--- a/xen/arch/riscv/stubs.c
+++ b/xen/arch/riscv/stubs.c
@@ -49,18 +49,6 @@ void domain_set_time_offset(struct domain *d, int64_t time_offset_seconds)
     BUG_ON("unimplemented");
 }
 
-/* shutdown.c */
-
-void machine_restart(unsigned int delay_millisecs)
-{
-    BUG_ON("unimplemented");
-}
-
-void machine_halt(void)
-{
-    BUG_ON("unimplemented");
-}
-
 /* domctl.c */
 
 long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 06 06:44:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Sep 2024 06:44:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.791579.1201478 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1smShQ-00051v-Hp; Fri, 06 Sep 2024 06:44:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 791579.1201478; Fri, 06 Sep 2024 06: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 <xen-changelog-bounces@lists.xenproject.org>)
	id 1smShQ-00051n-Er; Fri, 06 Sep 2024 06:44:04 +0000
Received: by outflank-mailman (input) for mailman id 791579;
 Fri, 06 Sep 2024 06:44:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smShP-00051h-Lw
 for xen-changelog@lists.xenproject.org; Fri, 06 Sep 2024 06:44:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smShP-0003z7-9M
 for xen-changelog@lists.xenproject.org; Fri, 06 Sep 2024 06:44:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smShP-0004r8-87
 for xen-changelog@lists.xenproject.org; Fri, 06 Sep 2024 06:44:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Vxl50GD1SsUsHQC7aLa9l/7LhsAlPFy2YjUV3ZE84ec=; b=BLiAI9li3tmcZQhOVeIb8dlqsZ
	innm7fIfCHtKqD8TViXX51yfRJqtoRmCDkv0hd5TnnjisiobxSy9Gv1/QCc0aATnle0oXUH3cDITh
	cOsATrL2DwKl/z7Zy51kxjmXmgUv1Phd5UQWmOcDnZNLo/aJOwiQW/UoMrsMBHDm2SEY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/xstate: enable AMX components
Message-Id: <E1smShP-0004r8-87@xenbits.xenproject.org>
Date: Fri, 06 Sep 2024 06:44:03 +0000

commit e3b5440012721560ff48859ba8c4ea7f72f9ef20
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Sep 6 08:40:21 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Sep 6 08:40:21 2024 +0200

    x86/xstate: enable AMX components
    
    These being controlled by XCR0, enabling support is relatively
    straightforward. Note however that there won't be any use of them until
    their dependent ISA extension CPUID flags are exposed, not the least due
    to recalculate_xstate() handling the dependencies in kind of a reverse
    manner.
    
    Note that xstate_check_sizes() already covers the two new states.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/cpu-policy.c                   | 3 +++
 xen/arch/x86/include/asm/xstate.h           | 3 ++-
 xen/include/public/arch-x86/cpufeatureset.h | 4 ++++
 xen/tools/gen-cpuid.py                      | 9 +++++++--
 4 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/cpu-policy.c b/xen/arch/x86/cpu-policy.c
index 888e7ac4d4..1f5e42db5b 100644
--- a/xen/arch/x86/cpu-policy.c
+++ b/xen/arch/x86/cpu-policy.c
@@ -216,6 +216,9 @@ static void recalculate_xstate(struct cpu_policy *p)
     if ( p->feat.pku )
         xstates |= X86_XCR0_PKRU;
 
+    if ( p->feat.amx_tile )
+        xstates |= X86_XCR0_TILE_CFG | X86_XCR0_TILE_DATA;
+
     /* Subleaf 0 */
     p->xstate.max_size =
         xstate_uncompressed_size(xstates & ~XSTATE_XSAVES_ONLY);
diff --git a/xen/arch/x86/include/asm/xstate.h b/xen/arch/x86/include/asm/xstate.h
index ebeb2a3dca..b4ee555953 100644
--- a/xen/arch/x86/include/asm/xstate.h
+++ b/xen/arch/x86/include/asm/xstate.h
@@ -35,7 +35,8 @@ extern uint32_t mxcsr_mask;
                         XSTATE_NONLAZY)
 
 #define XSTATE_ALL     (~(1ULL << 63))
-#define XSTATE_NONLAZY (X86_XCR0_BNDREGS | X86_XCR0_BNDCSR | X86_XCR0_PKRU)
+#define XSTATE_NONLAZY (X86_XCR0_BNDREGS | X86_XCR0_BNDCSR | X86_XCR0_PKRU | \
+                        X86_XCR0_TILE_CFG | X86_XCR0_TILE_DATA)
 #define XSTATE_LAZY    (XSTATE_ALL & ~XSTATE_NONLAZY)
 #define XSTATE_XSAVES_ONLY         0
 #define XSTATE_COMPACTION_ENABLED  (1ULL << 63)
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index abab78fa86..420ed21a20 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -278,8 +278,10 @@ XEN_CPUFEATURE(HYBRID,        9*32+15) /*   Heterogeneous platform */
 XEN_CPUFEATURE(TSXLDTRK,      9*32+16) /*a  TSX load tracking suspend/resume insns */
 XEN_CPUFEATURE(ARCH_LBR,      9*32+19) /*   Architectural Last Branch Record */
 XEN_CPUFEATURE(CET_IBT,       9*32+20) /*   CET - Indirect Branch Tracking */
+XEN_CPUFEATURE(AMX_BF16,      9*32+22) /*   AMX BFloat16 instruction */
 XEN_CPUFEATURE(AVX512_FP16,   9*32+23) /*A  AVX512 FP16 instructions */
 XEN_CPUFEATURE(AMX_TILE,      9*32+24) /*   AMX Tile architecture */
+XEN_CPUFEATURE(AMX_INT8,      9*32+25) /*   AMX 8-bit integer instructions */
 XEN_CPUFEATURE(IBRSB,         9*32+26) /*A  IBRS and IBPB support (used by Intel) */
 XEN_CPUFEATURE(STIBP,         9*32+27) /*A  STIBP */
 XEN_CPUFEATURE(L1D_FLUSH,     9*32+28) /*S  MSR_FLUSH_CMD and L1D flush. */
@@ -297,6 +299,7 @@ XEN_CPUFEATURE(FZRM,         10*32+10) /*A  Fast Zero-length REP MOVSB */
 XEN_CPUFEATURE(FSRS,         10*32+11) /*A  Fast Short REP STOSB */
 XEN_CPUFEATURE(FSRCS,        10*32+12) /*A  Fast Short REP CMPSB/SCASB */
 XEN_CPUFEATURE(WRMSRNS,      10*32+19) /*S  WRMSR Non-Serialising */
+XEN_CPUFEATURE(AMX_FP16,     10*32+21) /*   AMX FP16 instruction */
 XEN_CPUFEATURE(AVX_IFMA,     10*32+23) /*A  AVX-IFMA Instructions */
 
 /* AMD-defined CPU features, CPUID level 0x80000021.eax, word 11 */
@@ -331,6 +334,7 @@ XEN_CPUFEATURE(MCDT_NO,            13*32+ 5) /*A  MCDT_NO */
 /* Intel-defined CPU features, CPUID level 0x00000007:1.edx, word 15 */
 XEN_CPUFEATURE(AVX_VNNI_INT8,      15*32+ 4) /*A  AVX-VNNI-INT8 Instructions */
 XEN_CPUFEATURE(AVX_NE_CONVERT,     15*32+ 5) /*A  AVX-NE-CONVERT Instructions */
+XEN_CPUFEATURE(AMX_COMPLEX,        15*32+ 8) /*   AMX Complex Instructions */
 XEN_CPUFEATURE(AVX_VNNI_INT16,     15*32+10) /*A  AVX-VNNI-INT16 Instructions */
 XEN_CPUFEATURE(PREFETCHI,          15*32+14) /*A  PREFETCHIT{0,1} Instructions */
 XEN_CPUFEATURE(CET_SSS,            15*32+18) /*   CET Supervisor Shadow Stacks safe to use */
diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index 601eec6089..f7cad255da 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -252,7 +252,7 @@ def crunch_numbers(state):
         # instruction groups which are specified to require XSAVE for state
         # management.
         XSAVE: [XSAVEOPT, XSAVEC, XGETBV1, XSAVES,
-                AVX, MPX, PKU, LWP],
+                AVX, MPX, PKU, AMX_TILE, LWP],
 
         # AVX is taken to mean hardware support for 256bit registers (which in
         # practice depends on the VEX prefix to encode), and the instructions
@@ -274,7 +274,7 @@ def crunch_numbers(state):
         # superpages, PCID and PKU are only available in 4 level paging.
         # NO_LMSL indicates the absense of Long Mode Segment Limits, which
         # have been dropped in hardware.
-        LM: [CX16, PCID, LAHF_LM, PAGE1GB, PKU, NO_LMSL],
+        LM: [CX16, PCID, LAHF_LM, PAGE1GB, PKU, NO_LMSL, AMX_TILE],
 
         # AMD K6-2+ and K6-III processors shipped with 3DNow+, beyond the
         # standard 3DNow in the earlier K6 processors.
@@ -338,6 +338,11 @@ def crunch_numbers(state):
 
         # The behaviour described by RRSBA depend on eIBRS being active.
         EIBRS: [RRSBA],
+
+        # AMX-TILE means hardware support for tile registers and general non-
+        # computational instructions.  All further AMX features are built on top
+        # of AMX-TILE.
+        AMX_TILE: [AMX_BF16, AMX_INT8, AMX_FP16, AMX_COMPLEX],
     }
 
     deep_features = tuple(sorted(deps.keys()))
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Sep 06 06:44:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Sep 2024 06:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.791580.1201482 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1smSha-00055c-KZ; Fri, 06 Sep 2024 06:44:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 791580.1201482; Fri, 06 Sep 2024 06:44:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1smSha-00055U-Ho; Fri, 06 Sep 2024 06:44:14 +0000
Received: by outflank-mailman (input) for mailman id 791580;
 Fri, 06 Sep 2024 06:44:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smShZ-00053y-DA
 for xen-changelog@lists.xenproject.org; Fri, 06 Sep 2024 06:44:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smShZ-0003zF-CM
 for xen-changelog@lists.xenproject.org; Fri, 06 Sep 2024 06:44:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smShZ-0004tS-BT
 for xen-changelog@lists.xenproject.org; Fri, 06 Sep 2024 06:44:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YDJEkXbNa0wekeCp86gos2aPyugmCPdNPop/wQP9POs=; b=AFPatmj+NnZYTo9l8lx3HuXSPr
	SCSyDYOewk77LWq3eYw4K7bj/eYH7JG2QE8qEtoKuLN1Ok5FYktPG6m+YeOAW4ZvS6C3agsdjjLmb
	LynCfOuWcLODZuq/0dI1RfB9EhvpWFpU0Osb1NFY4uGiY4kaPohDubnD8jLJdsu87QLI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86emul/test: fix build with gas 2.43
Message-Id: <E1smShZ-0004tS-BT@xenbits.xenproject.org>
Date: Fri, 06 Sep 2024 06:44:13 +0000

commit 3c09288298af881ea1bb568740deb2d2a06bcd41
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Sep 6 08:41:18 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Sep 6 08:41:18 2024 +0200

    x86emul/test: fix build with gas 2.43
    
    Drop explicit {evex} pseudo-prefixes. New gas (validly) complains when
    they're used on things other than instructions. Our use was potentially
    ahead of macro invocations - see simd.h's "override" macro.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/tests/x86_emulator/simd.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/tests/x86_emulator/simd.c b/tools/tests/x86_emulator/simd.c
index 263cea662d..d68a7364c2 100644
--- a/tools/tests/x86_emulator/simd.c
+++ b/tools/tests/x86_emulator/simd.c
@@ -333,7 +333,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # if FLOAT_SIZE == 4
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vbroadcastss %1, %0" \
+    asm ( "vbroadcastss %1, %0" \
           : "=v" (t_) : "m" (*(float[1]){ x }) ); \
     t_; \
 })
@@ -401,14 +401,14 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 #  if VEC_SIZE >= 32
 #   define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vbroadcastsd %1, %0" : "=v" (t_) \
+    asm ( "vbroadcastsd %1, %0" : "=v" (t_) \
           : "m" (*(double[1]){ x }) ); \
     t_; \
 })
 #  else
 #   define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastq %1, %0" \
+    asm ( "vpbroadcastq %1, %0" \
           : "=v" (t_) : "m" (*(double[1]){ x }) ); \
     t_; \
 })
@@ -601,7 +601,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # if INT_SIZE == 4 || UINT_SIZE == 4
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastd %1, %0" \
+    asm ( "vpbroadcastd %1, %0" \
           : "=v" (t_) : "m" (*(int[1]){ x }) ); \
     t_; \
 })
@@ -649,7 +649,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # elif INT_SIZE == 8 || UINT_SIZE == 8
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastq %1, %0" \
+    asm ( "vpbroadcastq %1, %0" \
           : "=v" (t_) : "m" (*(long long[1]){ x }) ); \
     t_; \
 })
@@ -716,7 +716,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # if INT_SIZE == 1 || UINT_SIZE == 1
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastb %1, %0" \
+    asm ( "vpbroadcastb %1, %0" \
           : "=v" (t_) : "m" (*(char[1]){ x }) ); \
     t_; \
 })
@@ -745,7 +745,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # elif INT_SIZE == 2 || UINT_SIZE == 2
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastw %1, %0" \
+    asm ( "vpbroadcastw %1, %0" \
           : "=v" (t_) : "m" (*(short[1]){ x }) ); \
     t_; \
 })
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Sep 06 10:55:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Sep 2024 10:55:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.791738.1201723 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1smWcK-0001h7-Ui; Fri, 06 Sep 2024 10:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 791738.1201723; Fri, 06 Sep 2024 10:55:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1smWcK-0001gz-S0; Fri, 06 Sep 2024 10:55:04 +0000
Received: by outflank-mailman (input) for mailman id 791738;
 Fri, 06 Sep 2024 10:55:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smWcJ-0001gt-Nw
 for xen-changelog@lists.xenproject.org; Fri, 06 Sep 2024 10:55:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smWcJ-0000TZ-JX
 for xen-changelog@lists.xenproject.org; Fri, 06 Sep 2024 10:55:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smWcJ-0000JE-I2
 for xen-changelog@lists.xenproject.org; Fri, 06 Sep 2024 10:55:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sj3Dh0yfyL/FC3au9GAtvuWiyk8KAX2tYJ4orAU++u4=; b=beFBcmjq6ZnMRfK7FhPpdKWCVi
	SyaY3csGig9RgRKlaQMKDwDTHUDPu7TTxxAKq3vr6pDDOHllpkCZo+19TmKNzKa2xeTWn/JFRAF5E
	XEnuerq7TN+qFnY5lCBp+n3RLIu731ycoPHowNVb+lJ/KIyn2fUPNZqPRfbwXFrjZGAA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86emul: mark new "cp" local var maybe-unused
Message-Id: <E1smWcJ-0000JE-I2@xenbits.xenproject.org>
Date: Fri, 06 Sep 2024 10:55:03 +0000

commit d092002824a1fa675c936170d099c5646ecf8082
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Sep 6 12:47:58 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Sep 6 12:47:58 2024 +0200

    x86emul: mark new "cp" local var maybe-unused
    
    Just for the sake of the 32-bit build of the test harness. This wants
    reverting once unconditional uses of the variable appear (AMX, AVX10).
    
    Fixes: b20e3fbc3ec9 ("x86emul: introduce a struct cpu_policy * local in x86_emulate()")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 53742b4796..e12fbe3100 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -1233,7 +1233,7 @@ x86_emulate(
 {
     /* Shadow copy of register state. Committed on successful emulation. */
     struct cpu_user_regs _regs = *ctxt->regs;
-    const struct cpu_policy *cp = ctxt->cpu_policy;
+    const struct cpu_policy *__maybe_unused cp = ctxt->cpu_policy;
     struct x86_emulate_state state;
     int rc;
     uint8_t b, d, *opc = NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Sep 06 10:55:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Sep 2024 10:55:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.791739.1201727 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1smWcU-0001iw-W4; Fri, 06 Sep 2024 10:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 791739.1201727; Fri, 06 Sep 2024 10:55:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1smWcU-0001io-TN; Fri, 06 Sep 2024 10:55:14 +0000
Received: by outflank-mailman (input) for mailman id 791739;
 Fri, 06 Sep 2024 10:55:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smWcT-0001ib-Nh
 for xen-changelog@lists.xenproject.org; Fri, 06 Sep 2024 10:55:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smWcT-0000Th-Mr
 for xen-changelog@lists.xenproject.org; Fri, 06 Sep 2024 10:55:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smWcT-0000KS-Lq
 for xen-changelog@lists.xenproject.org; Fri, 06 Sep 2024 10:55:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=v1gVbpwPh+tufg3yFMFb6HZtQpOhods7msmSrJxz48U=; b=FmNcAF08lIraA5JfjUJeEfVV7Z
	mWz5OM4QaKnrYPK938V0RM0kE0YjEK3/GAET0M2M3Ml0LFzEGjY869OQPyHKjX5mbFxDNtNPhPLna
	iwZeS0P79V9rH/0Psxx32GVMhIxbT3cCVUcgQ7W5E2F9RlKawEfAEwNcXgBrL7EiqSfc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86emul/test: use MSR constants
Message-Id: <E1smWcT-0000KS-Lq@xenbits.xenproject.org>
Date: Fri, 06 Sep 2024 10:55:13 +0000

commit 01ffbe8bcffdc5c6c98f0715bac95f3348b1c0cc
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Sep 6 12:48:42 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Sep 6 12:48:42 2024 +0200

    x86emul/test: use MSR constants
    
    msr-index.h has been in use for a while, so use the identifiers it
    provides in place of raw numbers plus comments.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/tests/x86_emulator/test_x86_emulator.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index 94a2bbab93..3a6054441a 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -689,11 +689,11 @@ static int read_msr(
 {
     switch ( reg )
     {
-    case 0xc0000080: /* EFER */
-        *val = ctxt->addr_size > 32 ? 0x500 /* LME|LMA */ : 0;
+    case MSR_EFER:
+        *val = ctxt->addr_size > 32 ? EFER_LME | EFER_LMA : 0;
         return X86EMUL_OKAY;
 
-    case 0xc0000103: /* TSC_AUX */
+    case MSR_TSC_AUX:
 #define TSC_AUX_VALUE 0xCACACACA
         *val = TSC_AUX_VALUE;
         return X86EMUL_OKAY;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Sep 06 17:11:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Sep 2024 17:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.791955.1201972 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1smcUC-0006yQ-Sq; Fri, 06 Sep 2024 17:11:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 791955.1201972; Fri, 06 Sep 2024 17:11:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1smcUC-0006yI-Q4; Fri, 06 Sep 2024 17:11:04 +0000
Received: by outflank-mailman (input) for mailman id 791955;
 Fri, 06 Sep 2024 17:11:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smcUB-0006yC-VG
 for xen-changelog@lists.xenproject.org; Fri, 06 Sep 2024 17:11:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smcUB-0007NB-HP
 for xen-changelog@lists.xenproject.org; Fri, 06 Sep 2024 17:11:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smcUB-0004eR-E5
 for xen-changelog@lists.xenproject.org; Fri, 06 Sep 2024 17:11:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QosbZtjyJ4v6CVrQl/PEom1mU+D3dt3rv+PS3HneJIQ=; b=nAjFf9IZszZJ+qI1sxxyclRnNS
	LECc13+BwhmTvYafUedRRL7yjk31Ht133NIk4ymEyVc/wfTJDfVBwQePRn4JWBHXyi/7v6Tt7DXjA
	HfVo/cg/kC8okkmbwobRrllCwvBrg/Yy2HQW5ZZS/YNPZVwcFjxa4oNu05b+h/2LaPCo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/cpufeatures: Add new cpuid features in SPR to featureset
Message-Id: <E1smcUB-0004eR-E5@xenbits.xenproject.org>
Date: Fri, 06 Sep 2024 17:11:03 +0000

commit 5afb11ac409185d862f405b2509b89abc2311bf5
Author:     Matthew Barnes <matthew.barnes@cloud.com>
AuthorDate: Wed Aug 21 16:34:37 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Sep 6 14:42:18 2024 +0100

    x86/cpufeatures: Add new cpuid features in SPR to featureset
    
    Upon running `xen-cpuid -v` on a host machine with Sapphire Rapids
    within Dom0, there exist unrecognised features.
    
    This patch adds these features as macros to the CPU featureset,
    disabled by default.
    
    Signed-off-by: Matthew Barnes <matthew.barnes@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/include/public/arch-x86/cpufeatureset.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 420ed21a20..adc1fa34cc 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -121,6 +121,7 @@ XEN_CPUFEATURE(SMX,           1*32+ 6) /*   Safer Mode Extensions */
 XEN_CPUFEATURE(EIST,          1*32+ 7) /*   Enhanced SpeedStep */
 XEN_CPUFEATURE(TM2,           1*32+ 8) /*   Thermal Monitor 2 */
 XEN_CPUFEATURE(SSSE3,         1*32+ 9) /*A  Supplemental Streaming SIMD Extensions-3 */
+XEN_CPUFEATURE(SDBG,          1*32+11) /*   IA32_DEBUG_INTERFACE MSR for silicon debugging support */
 XEN_CPUFEATURE(FMA,           1*32+12) /*A  Fused Multiply Add */
 XEN_CPUFEATURE(CX16,          1*32+13) /*A  CMPXCHG16B */
 XEN_CPUFEATURE(XTPR,          1*32+14) /*   Send Task Priority Messages */
@@ -181,6 +182,7 @@ XEN_CPUFEATURE(XSAVEOPT,      4*32+ 0) /*A  XSAVEOPT instruction */
 XEN_CPUFEATURE(XSAVEC,        4*32+ 1) /*A  XSAVEC/XRSTORC instructions */
 XEN_CPUFEATURE(XGETBV1,       4*32+ 2) /*A  XGETBV with %ecx=1 */
 XEN_CPUFEATURE(XSAVES,        4*32+ 3) /*S  XSAVES/XRSTORS instructions */
+XEN_CPUFEATURE(XFD,           4*32+ 4) /*   MSR_XFD{,_ERR} (eXtended Feature Disable) */
 
 /* Intel-defined CPU features, CPUID level 0x00000007:0.ebx, word 5 */
 XEN_CPUFEATURE(FSGSBASE,      5*32+ 0) /*A  {RD,WR}{FS,GS}BASE instructions */
@@ -221,6 +223,7 @@ XEN_CPUFEATURE(AVX512_VBMI,   6*32+ 1) /*A  AVX-512 Vector Byte Manipulation Ins
 XEN_CPUFEATURE(UMIP,          6*32+ 2) /*S  User Mode Instruction Prevention */
 XEN_CPUFEATURE(PKU,           6*32+ 3) /*H  Protection Keys for Userspace */
 XEN_CPUFEATURE(OSPKE,         6*32+ 4) /*!  OS Protection Keys Enable */
+XEN_CPUFEATURE(WAITPKG,       6*32+ 5) /*   UMONITOR/UMWAIT/TPAUSE */
 XEN_CPUFEATURE(AVX512_VBMI2,  6*32+ 6) /*A  Additional AVX-512 Vector Byte Manipulation Instrs */
 XEN_CPUFEATURE(CET_SS,        6*32+ 7) /*   CET - Shadow Stacks */
 XEN_CPUFEATURE(GFNI,          6*32+ 8) /*A  Galois Field Instrs */
@@ -228,13 +231,16 @@ XEN_CPUFEATURE(VAES,          6*32+ 9) /*A  Vector AES Instrs */
 XEN_CPUFEATURE(VPCLMULQDQ,    6*32+10) /*A  Vector Carry-less Multiplication Instrs */
 XEN_CPUFEATURE(AVX512_VNNI,   6*32+11) /*A  Vector Neural Network Instrs */
 XEN_CPUFEATURE(AVX512_BITALG, 6*32+12) /*A  Support for VPOPCNT[B,W] and VPSHUFBITQMB */
+XEN_CPUFEATURE(TME,           6*32+13) /*   Total Memory Encryption */
 XEN_CPUFEATURE(AVX512_VPOPCNTDQ, 6*32+14) /*A  POPCNT for vectors of DW/QW */
+XEN_CPUFEATURE(LA57,          6*32+16) /*   5-level paging (57-bit linear address) */
 XEN_CPUFEATURE(RDPID,         6*32+22) /*A  RDPID instruction */
 XEN_CPUFEATURE(BLD,           6*32+24) /*   BusLock Detect (#DB trap) support */
 XEN_CPUFEATURE(CLDEMOTE,      6*32+25) /*A  CLDEMOTE instruction */
 XEN_CPUFEATURE(MOVDIRI,       6*32+27) /*a  MOVDIRI instruction */
 XEN_CPUFEATURE(MOVDIR64B,     6*32+28) /*a  MOVDIR64B instruction */
 XEN_CPUFEATURE(ENQCMD,        6*32+29) /*   ENQCMD{,S} instructions */
+XEN_CPUFEATURE(SGX_LC,        6*32+30) /*   SGX Launch Configuration */
 XEN_CPUFEATURE(PKS,           6*32+31) /*H  Protection Key for Supervisor */
 
 /* AMD-defined CPU features, CPUID level 0x80000007.edx, word 7 */
@@ -264,6 +270,7 @@ XEN_CPUFEATURE(BTC_NO,        8*32+29) /*A  Hardware not vulnerable to Branch Ty
 XEN_CPUFEATURE(IBPB_RET,      8*32+30) /*A  IBPB clears RSB/RAS too. */
 
 /* Intel-defined CPU features, CPUID level 0x00000007:0.edx, word 9 */
+XEN_CPUFEATURE(SGX_KEYS,      9*32+ 1) /*   SGX Attestation Service */
 XEN_CPUFEATURE(AVX512_4VNNIW, 9*32+ 2) /*   Xeon Phi AVX512 Neural Network Instructions */
 XEN_CPUFEATURE(AVX512_4FMAPS, 9*32+ 3) /*   Xeon Phi AVX512 Multiply Accumulation Single Precision */
 XEN_CPUFEATURE(FSRM,          9*32+ 4) /*A  Fast Short REP MOVS */
@@ -276,6 +283,7 @@ XEN_CPUFEATURE(TSX_FORCE_ABORT, 9*32+13) /* MSR_TSX_FORCE_ABORT.RTM_ABORT */
 XEN_CPUFEATURE(SERIALIZE,     9*32+14) /*A  SERIALIZE insn */
 XEN_CPUFEATURE(HYBRID,        9*32+15) /*   Heterogeneous platform */
 XEN_CPUFEATURE(TSXLDTRK,      9*32+16) /*a  TSX load tracking suspend/resume insns */
+XEN_CPUFEATURE(PCONFIG,       9*32+18) /*   PCONFIG instruction */
 XEN_CPUFEATURE(ARCH_LBR,      9*32+19) /*   Architectural Last Branch Record */
 XEN_CPUFEATURE(CET_IBT,       9*32+20) /*   CET - Indirect Branch Tracking */
 XEN_CPUFEATURE(AMX_BF16,      9*32+22) /*   AMX BFloat16 instruction */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Sep 06 17:11:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Sep 2024 17:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.791956.1201975 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1smcUM-000707-UA; Fri, 06 Sep 2024 17:11:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 791956.1201975; Fri, 06 Sep 2024 17:11:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1smcUM-000700-RT; Fri, 06 Sep 2024 17:11:14 +0000
Received: by outflank-mailman (input) for mailman id 791956;
 Fri, 06 Sep 2024 17:11:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smcUL-0006zp-N8
 for xen-changelog@lists.xenproject.org; Fri, 06 Sep 2024 17:11:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smcUL-0007NG-Lv
 for xen-changelog@lists.xenproject.org; Fri, 06 Sep 2024 17:11:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smcUL-0004fm-JZ
 for xen-changelog@lists.xenproject.org; Fri, 06 Sep 2024 17:11:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=l82n8nFsFSj9PqgIssOZK8FQkuU9dzeOSsTl4ahnW4I=; b=plgqoxqngHAgPlkJhD+5ZGhc0i
	2a9POHkfkWE6NeXnzT8tuUzli+3++m01Yo+EdYy4w43ooJlObWwRqxBETY/z9Aw5120f0i0FUdN+C
	SFKZ6ezYZ2v5xGO6RF2YviIebqeKLs+LOCve4f5Qo9Ea25eSBvUH5s4dx6zGfn4YTYd0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/ppc: Adjust ppc64_defconfig
Message-Id: <E1smcUL-0004fm-JZ@xenbits.xenproject.org>
Date: Fri, 06 Sep 2024 17:11:13 +0000

commit 8c3ab4ffa953b5ea4724e825ffa7356532814093
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 21 20:05:15 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Sep 6 14:42:18 2024 +0100

    xen/ppc: Adjust ppc64_defconfig
    
    All of CONFIG_SCHED_*, and CONFIG_HYPFS build fine.
    
    Add a stub for share_xen_page_with_guest(), which is all that is necessary to
    make CONFIG_TRACEBUFFER build.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/ppc/configs/ppc64_defconfig | 6 ------
 xen/arch/ppc/stubs.c                 | 6 ++++++
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/xen/arch/ppc/configs/ppc64_defconfig b/xen/arch/ppc/configs/ppc64_defconfig
index 48a053237a..4924d881a2 100644
--- a/xen/arch/ppc/configs/ppc64_defconfig
+++ b/xen/arch/ppc/configs/ppc64_defconfig
@@ -1,9 +1,3 @@
-# CONFIG_SCHED_CREDIT is not set
-# CONFIG_SCHED_RTDS is not set
-# CONFIG_SCHED_NULL is not set
-# CONFIG_SCHED_ARINC653 is not set
-# CONFIG_TRACEBUFFER is not set
-# CONFIG_HYPFS is not set
 # CONFIG_GRANT_TABLE is not set
 # CONFIG_SPECULATIVE_HARDEN_ARRAY is not set
 # CONFIG_MEM_ACCESS is not set
diff --git a/xen/arch/ppc/stubs.c b/xen/arch/ppc/stubs.c
index 50e54d61c0..bdb5f8c66d 100644
--- a/xen/arch/ppc/stubs.c
+++ b/xen/arch/ppc/stubs.c
@@ -322,3 +322,9 @@ void udelay(unsigned long usecs)
 {
     BUG_ON("unimplemented");
 }
+
+void share_xen_page_with_guest(struct page_info *page, struct domain *d,
+                               enum XENSHARE_flags flags)
+{
+    BUG_ON("unimplemented");
+}
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Sep 06 17:11:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Sep 2024 17:11:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.791957.1201980 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1smcUW-00072Q-Vq; Fri, 06 Sep 2024 17:11:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 791957.1201980; Fri, 06 Sep 2024 17:11:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1smcUW-00072I-T4; Fri, 06 Sep 2024 17:11:24 +0000
Received: by outflank-mailman (input) for mailman id 791957;
 Fri, 06 Sep 2024 17:11:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smcUV-00072A-QS
 for xen-changelog@lists.xenproject.org; Fri, 06 Sep 2024 17:11:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smcUV-0007NU-Ov
 for xen-changelog@lists.xenproject.org; Fri, 06 Sep 2024 17:11:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smcUV-0004gt-O3
 for xen-changelog@lists.xenproject.org; Fri, 06 Sep 2024 17:11:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LvmipPcW8bnWUHmKwoJuej4EIGgQ2dRUv+9MfRS8gnM=; b=zHyESCD6wkZ1vgTWhAg+VBPaeu
	eDoNqtHY/nM5RxkfpQAxWgAEyUoUceyQRcIORuCARaOf4YwgfZJrUH/InAxZxF17YE2D/tXmIoKt1
	Cqj3BEZtNaUIDxZaLKnam3HnwWKu1OMB38eEKc4PEUwDcOBne2/MX8b1vubqesKbDxZY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/ocaml: Build infrastructure for OCaml dynamic libraries
Message-Id: <E1smcUV-0004gt-O3@xenbits.xenproject.org>
Date: Fri, 06 Sep 2024 17:11:23 +0000

commit 81d48d857efa451ca3ed46e3d0633f54084b6f5b
Author:     Andrii Sultanov <andrii.sultanov@cloud.com>
AuthorDate: Tue Sep 3 12:44:42 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Sep 6 14:43:39 2024 +0100

    tools/ocaml: Build infrastructure for OCaml dynamic libraries
    
    Dynamic libraries in OCaml require an additional compilation step on top
    of the already specified steps for static libraries. Add an appropriate
    template to Makefile.rules.
    
    Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
---
 tools/ocaml/Makefile.rules | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/tools/ocaml/Makefile.rules b/tools/ocaml/Makefile.rules
index 5d534d8754..b9d4b51f0a 100644
--- a/tools/ocaml/Makefile.rules
+++ b/tools/ocaml/Makefile.rules
@@ -51,12 +51,13 @@ ifneq ($(MAKECMDGOALS),clean)
 endif
 
 clean: $(CLEAN_HOOKS)
-	$(Q)rm -f .*.d *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot *.spot *.spit $(LIBS) $(PROGRAMS) $(GENERATED_FILES) .ocamldep.make META
+	$(Q)rm -f .*.d *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.cmxs *.annot *.spot *.spit $(LIBS) $(PROGRAMS) $(GENERATED_FILES) .ocamldep.make META
 
 distclean: clean
 
 quiet-command = $(if $(V),$1,@printf " %-8s %s\n" "$2" "$3" && $1)
 
+mk-caml-shared-lib-native = $(call quiet-command, $(OCAMLOPT) $(OCAMLOPTFLAGS) -shared -linkall -o $1 $2 $3,MLA,$1)
 mk-caml-lib-native = $(call quiet-command, $(OCAMLOPT) $(OCAMLOPTFLAGS) -a -o $1 $2 $3,MLA,$1)
 mk-caml-lib-bytecode = $(call quiet-command, $(OCAMLC) $(OCAMLCFLAGS) -a -o $1 $2 $3,MLA,$1)
 
@@ -76,6 +77,19 @@ define OCAML_LIBRARY_template
 	$(call mk-caml-lib-stubs,$$@, $$+, $(foreach lib,$(LIBS_$(1)),$(lib)))
 endef
 
+# Dynamically linked OCaml libraries ("plugins" in Dynlink parlance)
+# need to compile an .cmxs file
+define OCAML_DYN_LIBRARY_template
+ $(1).cmxs: $(1).cmxa
+	$(call mk-caml-shared-lib-native,$$@, $(1).cmxa)
+ $(1).cmxa: lib$(1)_stubs.a $(foreach obj,$($(1)_OBJS),$(obj).cmx)
+	$(call mk-caml-lib-native,$$@, -cclib -l$(1)_stubs $(foreach lib,$(LIBS_$(1)),-cclib $(lib)), $(foreach obj,$($(1)_OBJS),$(obj).cmx))
+ $(1)_stubs.a: $(foreach obj,$$($(1)_C_OBJS),$(obj).o)
+	$(call mk-caml-stubs,$$@, $$+)
+ lib$(1)_stubs.a: $(foreach obj,$($(1)_C_OBJS),$(obj).o)
+	$(call mk-caml-lib-stubs,$$@, $$+)
+endef
+
 define OCAML_NOC_LIBRARY_template
  $(1).cmxa: $(foreach obj,$($(1)_OBJS),$(obj).cmx)
 	$(call mk-caml-lib-native,$$@, , $(foreach obj,$($(1)_OBJS),$(obj).cmx))
@@ -98,6 +112,7 @@ endef
 -include .ocamldep.make
 
 $(foreach lib,$(OCAML_LIBRARY),$(eval $(call OCAML_LIBRARY_template,$(lib))))
+$(foreach lib,$(OCAML_DYN_LIBRARY),$(eval $(call OCAML_DYN_LIBRARY_template,$(lib))))
 $(foreach lib,$(OCAML_NOC_LIBRARY),$(eval $(call OCAML_NOC_LIBRARY_template,$(lib))))
 $(foreach p,$(OCAML_PROGRAM),$(eval $(call OCAML_PROGRAM_template,$(p))))
 $(foreach p,$(C_PROGRAM),$(eval $(call C_PROGRAM_template,$(p))))
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Sep 06 17:11:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Sep 2024 17:11:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.791958.1201984 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1smcUh-00075f-11; Fri, 06 Sep 2024 17:11:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 791958.1201984; Fri, 06 Sep 2024 17:11:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1smcUg-00075X-Uc; Fri, 06 Sep 2024 17:11:34 +0000
Received: by outflank-mailman (input) for mailman id 791958;
 Fri, 06 Sep 2024 17:11:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smcUf-00075G-UA
 for xen-changelog@lists.xenproject.org; Fri, 06 Sep 2024 17:11:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smcUf-0007Nd-TK
 for xen-changelog@lists.xenproject.org; Fri, 06 Sep 2024 17:11:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smcUf-0004iE-RF
 for xen-changelog@lists.xenproject.org; Fri, 06 Sep 2024 17:11:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=u+M5EU+LQKsdxFGbvBAQ1nK73zWH5TxKWFtzz4vD4WU=; b=PvXnh9sJTBB7tF0qD3LxKPTqvy
	M1U1I0D4sZUjhedR9dT9Rgckf9v36JykR8rYxpnVSuxAsg58uSCiEJsm9DSyEefcyWeb2x4rM66LU
	c33/OPyVf9AdRQBV/BlMQPP9qClZy4WWgvSGUkTOGYKJRWug5ssZGgT/l4SHhRozS/Tg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/acpi: Drop acpi_video_flags and use bootsym(video_flags) directly
Message-Id: <E1smcUf-0004iE-RF@xenbits.xenproject.org>
Date: Fri, 06 Sep 2024 17:11:33 +0000

commit b34d5e3de9df64d26457bb4808c3b809965ee16c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Sep 4 14:48:53 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Sep 6 18:04:41 2024 +0100

    x86/acpi: Drop acpi_video_flags and use bootsym(video_flags) directly
    
    This removes a level of indirection, as well as removing a somewhat misleading
    name; the variable is really "S3 video quirks".
    
    More importantly however it makes it very clear that, right now, parsing the
    cmdline and quirks depends on having already placed the trampoline; a
    dependency which is going to be gnarly to untangle.
    
    That said, fixing the quirk is easy.  The Toshiba Satellite 4030CDT has an
    Intel Celeron 300Mhz CPU (Pentium 2 era) from 1998 when MMX was the headline
    feature, sporting 64M of RAM.  Being a 32-bit processor, it hasn't been able
    to run Xen for about a decade now, so drop the quirk entirely.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
---
 xen/arch/x86/acpi/power.c       |  2 +-
 xen/arch/x86/dmi_scan.c         | 12 ------------
 xen/arch/x86/include/asm/acpi.h |  1 -
 3 files changed, 1 insertion(+), 14 deletions(-)

diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index 610937f42e..557faf312b 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -56,7 +56,7 @@ static int __init cf_check parse_acpi_sleep(const char *s)
         s = ss + 1;
     } while ( *ss );
 
-    acpi_video_flags |= flag;
+    bootsym(video_flags) |= flag;
 
     return rc;
 }
diff --git a/xen/arch/x86/dmi_scan.c b/xen/arch/x86/dmi_scan.c
index 81f80c053a..9257aee2ab 100644
--- a/xen/arch/x86/dmi_scan.c
+++ b/xen/arch/x86/dmi_scan.c
@@ -499,13 +499,6 @@ static int __init cf_check ich10_bios_quirk(const struct dmi_system_id *d)
     return 0;
 }
 
-static __init int cf_check reset_videomode_after_s3(const struct dmi_blacklist *d)
-{
-	/* See wakeup.S */
-	acpi_video_flags |= 2;
-	return 0;
-}
-
 static __init int cf_check dmi_disable_acpi(const struct dmi_blacklist *d)
 { 
 	if (!acpi_force) { 
@@ -546,11 +539,6 @@ static __init int cf_check force_acpi_ht(const struct dmi_blacklist *d)
  
 static const struct dmi_blacklist __initconstrel dmi_blacklist[] = {
 
-	{ reset_videomode_after_s3, "Toshiba Satellite 4030cdt", { /* Reset video mode after returning from ACPI S3 sleep */
-			MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),
-			NO_MATCH, NO_MATCH, NO_MATCH
-			} },
-
 	{ ich10_bios_quirk, "Intel board & BIOS",
 		/*
 		 * BIOS leaves legacy USB emulation enabled while
diff --git a/xen/arch/x86/include/asm/acpi.h b/xen/arch/x86/include/asm/acpi.h
index 3c47b216d0..217819dd61 100644
--- a/xen/arch/x86/include/asm/acpi.h
+++ b/xen/arch/x86/include/asm/acpi.h
@@ -103,7 +103,6 @@ extern unsigned long acpi_wakeup_address;
 extern int8_t acpi_numa;
 
 extern struct acpi_sleep_info acpi_sinfo;
-#define acpi_video_flags bootsym(video_flags)
 struct xenpf_enter_acpi_sleep;
 extern int acpi_enter_sleep(const struct xenpf_enter_acpi_sleep *sleep);
 extern int acpi_enter_state(u32 state);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Sep 06 17:11:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Sep 2024 17:11:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.791959.1201987 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1smcUr-000798-2g; Fri, 06 Sep 2024 17:11:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 791959.1201987; Fri, 06 Sep 2024 17:11:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1smcUq-000790-W5; Fri, 06 Sep 2024 17:11:44 +0000
Received: by outflank-mailman (input) for mailman id 791959;
 Fri, 06 Sep 2024 17:11:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smcUq-00078m-2H
 for xen-changelog@lists.xenproject.org; Fri, 06 Sep 2024 17:11:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smcUq-0007Nk-0i
 for xen-changelog@lists.xenproject.org; Fri, 06 Sep 2024 17:11:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1smcUp-0004j4-W7
 for xen-changelog@lists.xenproject.org; Fri, 06 Sep 2024 17:11:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RV5uQUoZnY4KnuGiCpBzVrOTw6gkoXhrEQTegZhrItk=; b=qSmGyp8Ua3pZZZmb0iT6j05Mpp
	hkZzr4e5GXBKy9+fwGbEnKkQyziNFsowdn/KVULW15Jv1mWfsaAjGuVqI8sPnGBE8Ys/q/znak+HB
	wJYYC0UQZYnw+nQeXDV2ezBYQmnUzYo0qaF2i4gV1f9zlOTNWDrjkIldl63v7jqoCmCk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/trampoline: Move the trampoline declarations out of <asm/config.h>
Message-Id: <E1smcUp-0004j4-W7@xenbits.xenproject.org>
Date: Fri, 06 Sep 2024 17:11:43 +0000

commit 65e4bc585c28b50ec76f679e1001a81fea9d690b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Sep 4 13:27:03 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Sep 6 18:04:48 2024 +0100

    x86/trampoline: Move the trampoline declarations out of <asm/config.h>
    
    asm/config.h is included in every translation unit (via xen/config.h), while
    only a handful of functions actually interact with the trampoline.
    
    Move the infrastructure into its own header, and take the opportunity to
    document everything.
    
    Change trampoline_realmode_entry() and wakeup_start() to be nocall functions,
    rather than char arrays.  Also switch to fixed width integers which are less
    likely to diverge from the asm declaration.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/acpi/power.c             |  2 +
 xen/arch/x86/cpu/intel.c              |  2 +
 xen/arch/x86/efi/efi-boot.h           |  1 +
 xen/arch/x86/guest/xen/pvh-boot.c     |  1 +
 xen/arch/x86/include/asm/config.h     | 19 -------
 xen/arch/x86/include/asm/trampoline.h | 95 +++++++++++++++++++++++++++++++++++
 xen/arch/x86/mm.c                     |  1 +
 xen/arch/x86/platform_hypercall.c     |  2 +
 xen/arch/x86/setup.c                  |  1 +
 xen/arch/x86/smpboot.c                |  1 +
 xen/arch/x86/tboot.c                  |  2 +
 xen/arch/x86/x86_64/mm.c              |  2 +
 12 files changed, 110 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index 557faf312b..08a7fc2508 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -31,6 +31,8 @@
 #include <asm/microcode.h>
 #include <asm/prot-key.h>
 #include <asm/spec_ctrl.h>
+#include <asm/trampoline.h>
+
 #include <acpi/cpufreq/cpufreq.h>
 
 uint32_t system_reset_counter = 1;
diff --git a/xen/arch/x86/cpu/intel.c b/xen/arch/x86/cpu/intel.c
index af56e57bd8..807b708217 100644
--- a/xen/arch/x86/cpu/intel.c
+++ b/xen/arch/x86/cpu/intel.c
@@ -12,6 +12,8 @@
 #include <asm/mpspec.h>
 #include <asm/apic.h>
 #include <asm/i387.h>
+#include <asm/trampoline.h>
+
 #include <mach_apic.h>
 
 #include "cpu.h"
diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index f282358435..23e510c77e 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -9,6 +9,7 @@
 #include <asm/microcode.h>
 #include <asm/msr.h>
 #include <asm/setup.h>
+#include <asm/trampoline.h>
 
 static struct file __initdata ucode;
 static multiboot_info_t __initdata mbi = {
diff --git a/xen/arch/x86/guest/xen/pvh-boot.c b/xen/arch/x86/guest/xen/pvh-boot.c
index cc57ab2cbc..e14d7e20e9 100644
--- a/xen/arch/x86/guest/xen/pvh-boot.c
+++ b/xen/arch/x86/guest/xen/pvh-boot.c
@@ -12,6 +12,7 @@
 
 #include <asm/e820.h>
 #include <asm/guest.h>
+#include <asm/trampoline.h>
 
 #include <public/arch-x86/hvm/start_info.h>
 
diff --git a/xen/arch/x86/include/asm/config.h b/xen/arch/x86/include/asm/config.h
index 2a260a2581..1f828bfd52 100644
--- a/xen/arch/x86/include/asm/config.h
+++ b/xen/arch/x86/include/asm/config.h
@@ -83,25 +83,6 @@
 #define LIST_POISON1  ((void *)0x0100100100100100UL)
 #define LIST_POISON2  ((void *)0x0200200200200200UL)
 
-#ifndef __ASSEMBLY__
-extern unsigned long trampoline_phys;
-#define bootsym_phys(sym)                                 \
-    (((unsigned long)&(sym)-(unsigned long)&trampoline_start)+trampoline_phys)
-#define bootsym(sym)                                      \
-    (*((typeof(sym) *)__va(bootsym_phys(sym))))
-
-extern char trampoline_start[], trampoline_end[];
-extern char trampoline_realmode_entry[];
-extern unsigned int trampoline_xen_phys_start;
-extern unsigned char trampoline_cpu_started;
-extern char wakeup_start[];
-
-extern unsigned char video_flags;
-
-extern unsigned short boot_edid_caps;
-extern unsigned char boot_edid_info[128];
-#endif
-
 #include <xen/const.h>
 
 #define PML4_ENTRY_BITS  39
diff --git a/xen/arch/x86/include/asm/trampoline.h b/xen/arch/x86/include/asm/trampoline.h
new file mode 100644
index 0000000000..57a1f85a53
--- /dev/null
+++ b/xen/arch/x86/include/asm/trampoline.h
@@ -0,0 +1,95 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#ifndef X86_ASM_TRAMPOLINE_H
+#define X86_ASM_TRAMPOLINE_H
+
+/*
+ * Data in or about the low memory trampoline.
+ *
+ * x86 systems software typically needs a block of logic below the 1M
+ * boundary, commonly called the trampoline, containing 16-bit logic.  Xen has
+ * a combined trampoline of all necessary 16-bit logic, formed of two parts.
+ *
+ * 1) The permanent trampoline; a single 4k page containing:
+ *
+ *    - The INIT-SIPI-SIPI entrypoint for APs, and
+ *    - The S3 wakeup vector.
+ *
+ *    Both of these are 16-bit entrypoints, responsible for activating paging
+ *    and getting into 64-bit mode.  This requires the permanent trampoline to
+ *    be identity mapped in idle_pg_table[].
+ *
+ *    The SIPI64 spec deprecates the 16-bit AP entrypoint, while S0ix (also
+ *    called Low Power Idle or Connected Standby) deprecates S3.
+ *
+ * 2) The boot trampoline:
+ *
+ *    This is used by the BSP to drop into 16-bit mode, make various BIOS
+ *    calls to obtain E820/EDID/etc.  It follows the permanent and exceeds 4k,
+ *    but is only used in 16-bit and 32-bit unpaged mode so does not need
+ *    mapping in pagetables.
+ *
+ *    When the BIOS calls are complete, execution does join back with the AP
+ *    path, and becomes subject to the same paging requirements.  This path is
+ *    not needed for non-BIOS boots.
+ *
+ * The location of trampoline is not fixed.  The layout of low memory varies
+ * greatly from platform to platform.  Therefore, the trampoline is relocated
+ * manually as part of placement.
+ */
+
+#include <xen/compiler.h>
+#include <xen/types.h>
+
+/*
+ * Start and end of the trampoline section, as linked into Xen.  It is within
+ * the .init section and reclaimed after boot.
+ */
+/* SAF-0-safe */
+extern char trampoline_start[], trampoline_end[];
+
+/*
+ * The physical address of trampoline_start[] in low memory.  It must be below
+ * the 1M boundary (as the trampoline contains 16-bit code), and must be 4k
+ * aligned (SIPI requirement for APs).
+ */
+extern unsigned long trampoline_phys;
+
+/*
+ * Calculate the physical address of a symbol in the trampoline.
+ *
+ * Should only be used on symbols declared later in this header.  Specifying
+ * other symbols will compile but malfunction when used, as will using this
+ * helper before the trampoline is placed.
+ */
+#define bootsym_phys(sym)                                       \
+    (trampoline_phys + ((unsigned long)&(sym) -                 \
+                        (unsigned long)trampoline_start))
+
+/* Given a trampoline symbol, construct a pointer to it in the directmap. */
+#define bootsym(sym) (*((typeof(sym) *)__va(bootsym_phys(sym))))
+
+/* The INIT-SIPI-SIPI entrypoint.  16-bit code. */
+void nocall trampoline_realmode_entry(void);
+
+/* The S3 wakeup vector.  16-bit code. */
+void nocall wakeup_start(void);
+
+/*
+ * A variable in the trampoline, containing Xen's physical address.  Amongst
+ * other things, it is used to find idle_pg_table[] in order to enable paging
+ * and activate 64-bit mode.  This variable needs keeping in sync with
+ * xen_phys_start.
+ */
+extern uint32_t trampoline_xen_phys_start;
+
+/* A semaphore to indicate signs-of-life at the start of the AP boot path. */
+extern uint8_t trampoline_cpu_started;
+
+/* Quirks about video mode-setting on S3 resume. */
+extern uint8_t video_flags;
+
+/* Extended Display Identification Data, gathered from the BIOS. */
+extern uint16_t boot_edid_caps;
+extern uint8_t boot_edid_info[128];
+
+#endif /* X86_ASM_TRAMPOLINE_H */
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 608583a113..c735aaf0e8 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -131,6 +131,7 @@
 #include <asm/guest.h>
 #include <asm/pv/domain.h>
 #include <asm/pv/mm.h>
+#include <asm/trampoline.h>
 
 #ifdef CONFIG_PV
 #include "pv/mm.h"
diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hypercall.c
index 7e32781093..67f851237d 100644
--- a/xen/arch/x86/platform_hypercall.c
+++ b/xen/arch/x86/platform_hypercall.c
@@ -32,6 +32,8 @@
 #include <asm/mtrr.h>
 #include <asm/io_apic.h>
 #include <asm/setup.h>
+#include <asm/trampoline.h>
+
 #include "cpu/mcheck/mce.h"
 #include "cpu/mtrr/mtrr.h"
 #include <xsm/xsm.h>
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index cd69198326..a6e77c9ed9 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -59,6 +59,7 @@
 #include <asm/microcode.h>
 #include <asm/prot-key.h>
 #include <asm/pv/domain.h>
+#include <asm/trampoline.h>
 
 /* opt_nosmp: If true, secondary processors are ignored. */
 static bool __initdata opt_nosmp;
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 0a89f22a39..9e79c1a6d6 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -35,6 +35,7 @@
 #include <asm/spec_ctrl.h>
 #include <asm/time.h>
 #include <asm/tboot.h>
+#include <asm/trampoline.h>
 #include <irq_vectors.h>
 #include <mach_apic.h>
 
diff --git a/xen/arch/x86/tboot.c b/xen/arch/x86/tboot.c
index ba0700d2d5..d5db60d335 100644
--- a/xen/arch/x86/tboot.c
+++ b/xen/arch/x86/tboot.c
@@ -14,6 +14,8 @@
 #include <asm/e820.h>
 #include <asm/tboot.h>
 #include <asm/setup.h>
+#include <asm/trampoline.h>
+
 #include <crypto/vmac.h>
 
 /* tboot=<physical address of shared page> */
diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
index b2a280fba3..0d8e602529 100644
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -37,6 +37,8 @@ EMIT_FILE;
 #include <asm/numa.h>
 #include <asm/mem_paging.h>
 #include <asm/mem_sharing.h>
+#include <asm/trampoline.h>
+
 #include <public/memory.h>
 
 #ifdef CONFIG_PV32
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sun Sep 08 02:55:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 08 Sep 2024 02:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.792424.1202319 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn84s-0000Rs-T0; Sun, 08 Sep 2024 02:55:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 792424.1202319; Sun, 08 Sep 2024 02:55:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn84s-0000Rl-QK; Sun, 08 Sep 2024 02:55:02 +0000
Received: by outflank-mailman (input) for mailman id 792424;
 Sun, 08 Sep 2024 02:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn84r-0000Rf-Pk
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn84r-0002hq-Oq
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn84r-00008W-Kp
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4bkZBuPTvJMnW7xVPYCWGnYy5b+yyMC7YaoblY2jvKw=; b=WbyAWna5Lowx7joGeFrtGzmxdR
	WaHQ+Jntva5+XZDlhoNH2vvMU9gATdrnbk3Sjybpes9YDv0e9z8YgDGCPqajvoxJIy/HftY60tidM
	1y2aMkwVnq4aA69OnTIWVM9c+cz4M51TdkMEgZfEtNqJDdV3CyK2YhHh1cQedVUSiYvo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] SUPPORT.md: split XSM from Flask
Message-Id: <E1sn84r-00008W-Kp@xenbits.xenproject.org>
Date: Sun, 08 Sep 2024 02:55:01 +0000

commit d7c18b8720824d7efc39ffa7296751e1812865a9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Sep 4 16:05:03 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 4 16:05:03 2024 +0200

    SUPPORT.md: split XSM from Flask
    
    XSM is a generic framework, which in particular is also used by SILO.
    With this it can't really be experimental: Arm mandates SILO for having
    a security supported configuration.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 SUPPORT.md | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index f822a7e607..23dd7e6424 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -769,13 +769,21 @@ Compile time disabled for ARM by default.
 
     Status, x86: Supported, not security supported
 
-### XSM & FLASK
+### XSM (Xen Security Module) Framework
+
+XSM is a security policy framework.  The dummy implementation is covered by this
+statement, and implements a policy whereby dom0 is all powerful.  See below for
+alternative modules (FLASK, SILO).
+
+    Status: Supported
+
+### FLASK XSM Module
 
     Status: Experimental
 
 Compile time disabled by default.
 
-Also note that using XSM
+Also note that using FLASK
 to delegate various domain control hypercalls
 to particular other domains, rather than only permitting use by dom0,
 is also specifically excluded from security support for many hypercalls.
@@ -788,6 +796,13 @@ Please see XSA-77 for more details.
 The default policy includes FLASK labels and roles for a "typical" Xen-based system
 with dom0, driver domains, stub domains, domUs, and so on.
 
+### SILO XSM Module
+
+SILO extends the dummy policy by enforcing that DomU-s can only communicate
+with Dom0, yet not with each other.
+
+    Status: Supported
+
 ## Virtual Hardware, Hypervisor
 
 ### x86/Nested PV
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Sep 08 02:55:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 08 Sep 2024 02:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.792425.1202325 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn852-0000UH-Vf; Sun, 08 Sep 2024 02:55:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 792425.1202325; Sun, 08 Sep 2024 02:55:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn852-0000U5-S4; Sun, 08 Sep 2024 02:55:12 +0000
Received: by outflank-mailman (input) for mailman id 792425;
 Sun, 08 Sep 2024 02:55:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn851-0000Tt-UO
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:55:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn851-0002i7-TZ
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn851-0000A7-RS
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ocrXaO3L2Zh2ye5VM8Y4gy3SFqYc0BaeG/gSkkDLFGg=; b=endeLZ1iUqkQxUhoEDF3p5lrkS
	E69Nfkxsp5BMLQtfqMnHPJzkWYpdZILlGOXaL9P8Z37K9OZdICflUp6Vb5kO1ENnJ7OuU4afXr9sh
	93jQqSPq71KPiHkpGiz8Dpd10gOR2aEkr/GV3zlPCjrVK+/0PlX4rlnMa85uXGKgLod0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86emul/test: rename "cp"
Message-Id: <E1sn851-0000A7-RS@xenbits.xenproject.org>
Date: Sun, 08 Sep 2024 02:55:11 +0000

commit 3c93a0da6bc201ebeb8a08d6bd339c9982985fcc
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Sep 4 16:06:21 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 4 16:06:21 2024 +0200

    x86emul/test: rename "cp"
    
    In preparation of introducing a const struct cpu_policy * local in
    x86_emulate(), rename that global variable to something more suitable:
    "cp" is our commonly used name for function parameters or local
    variables of type struct cpu_policy *, and the present name of the
    global could hence have interfered already.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/fuzz/x86_instruction_emulator/fuzz-emul.c |   2 +-
 tools/tests/x86_emulator/test_x86_emulator.c    |  19 ++--
 tools/tests/x86_emulator/x86-emulate.c          |  16 +--
 tools/tests/x86_emulator/x86-emulate.h          | 135 +++++++++++++-----------
 4 files changed, 95 insertions(+), 77 deletions(-)

diff --git a/tools/fuzz/x86_instruction_emulator/fuzz-emul.c b/tools/fuzz/x86_instruction_emulator/fuzz-emul.c
index 2ba9ca9e0b..28c4fb13c5 100644
--- a/tools/fuzz/x86_instruction_emulator/fuzz-emul.c
+++ b/tools/fuzz/x86_instruction_emulator/fuzz-emul.c
@@ -899,7 +899,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data_p, size_t size)
     int rc;
 
     /* Not part of the initializer, for old gcc to cope. */
-    ctxt.cpu_policy = &cp;
+    ctxt.cpu_policy = &cpu_policy;
 
     /* Reset all global state variables */
     memset(&input, 0, sizeof(input));
diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index 2d52d21742..94a2bbab93 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -779,7 +779,8 @@ static void zap_fpsel(unsigned int *env, bool is_32bit)
         env[3] &= ~0xffff;
     }
 
-    if ( cp.x86_vendor != X86_VENDOR_AMD && cp.x86_vendor != X86_VENDOR_HYGON )
+    if ( cpu_policy.x86_vendor != X86_VENDOR_AMD &&
+         cpu_policy.x86_vendor != X86_VENDOR_HYGON )
         return;
 
     if ( is_32bit )
@@ -913,7 +914,7 @@ int main(int argc, char **argv)
 
     ctxt.regs = &regs;
     ctxt.force_writeback = 0;
-    ctxt.cpu_policy = &cp;
+    ctxt.cpu_policy = &cpu_policy;
     ctxt.lma       = sizeof(void *) == 8;
     ctxt.addr_size = 8 * sizeof(void *);
     ctxt.sp_size   = 8 * sizeof(void *);
@@ -1487,11 +1488,11 @@ int main(int argc, char **argv)
         goto fail;
     printf("okay\n");
 
-    vendor_native = cp.x86_vendor;
-    for ( cp.x86_vendor = X86_VENDOR_AMD; ; )
+    vendor_native = cpu_policy.x86_vendor;
+    for ( cpu_policy.x86_vendor = X86_VENDOR_AMD; ; )
     {
-        unsigned int v = cp.x86_vendor == X86_VENDOR_INTEL;
-        const char *vendor = cp.x86_vendor == X86_VENDOR_INTEL ? "Intel" : "AMD";
+        unsigned int v = cpu_policy.x86_vendor == X86_VENDOR_INTEL;
+        const char *vendor = cpu_policy.x86_vendor == X86_VENDOR_INTEL ? "Intel" : "AMD";
         uint64_t *stk = (void *)res + MMAP_SZ - 16;
 
         regs.rcx = 2;
@@ -1527,11 +1528,11 @@ int main(int argc, char **argv)
             printf("okay\n");
         }
 
-        if ( cp.x86_vendor == X86_VENDOR_INTEL )
+        if ( cpu_policy.x86_vendor == X86_VENDOR_INTEL )
             break;
-        cp.x86_vendor = X86_VENDOR_INTEL;
+        cpu_policy.x86_vendor = X86_VENDOR_INTEL;
     }
-    cp.x86_vendor = vendor_native;
+    cpu_policy.x86_vendor = vendor_native;
 #endif /* x86-64 */
 
     printf("%-40s", "Testing shld $1,%ecx,(%edx)...");
diff --git a/tools/tests/x86_emulator/x86-emulate.c b/tools/tests/x86_emulator/x86-emulate.c
index 70ce15be50..379e206dd3 100644
--- a/tools/tests/x86_emulator/x86-emulate.c
+++ b/tools/tests/x86_emulator/x86-emulate.c
@@ -25,7 +25,7 @@
 #endif
 
 uint32_t mxcsr_mask = 0x0000ffbf;
-struct cpu_policy cp;
+struct cpu_policy cpu_policy;
 
 static char fpu_save_area[0x4000] __attribute__((__aligned__((64))));
 static bool use_xsave;
@@ -75,18 +75,18 @@ bool emul_test_init(void)
 
     unsigned long sp;
 
-    x86_cpu_policy_fill_native(&cp);
+    x86_cpu_policy_fill_native(&cpu_policy);
 
     /*
      * The emulator doesn't use these instructions, so can always emulate
      * them.
      */
-    cp.basic.movbe = true;
-    cp.feat.invpcid = true;
-    cp.feat.adx = true;
-    cp.feat.rdpid = true;
-    cp.feat.wrmsrns = true;
-    cp.extd.clzero = true;
+    cpu_policy.basic.movbe = true;
+    cpu_policy.feat.invpcid = true;
+    cpu_policy.feat.adx = true;
+    cpu_policy.feat.rdpid = true;
+    cpu_policy.feat.wrmsrns = true;
+    cpu_policy.extd.clzero = true;
 
     if ( cpu_has_xsave )
     {
diff --git a/tools/tests/x86_emulator/x86-emulate.h b/tools/tests/x86_emulator/x86-emulate.h
index 4fca051152..112ec53d99 100644
--- a/tools/tests/x86_emulator/x86-emulate.h
+++ b/tools/tests/x86_emulator/x86-emulate.h
@@ -68,7 +68,7 @@
 #define is_canonical_address(x) (((int64_t)(x) >> 47) == ((int64_t)(x) >> 63))
 
 extern uint32_t mxcsr_mask;
-extern struct cpu_policy cp;
+extern struct cpu_policy cpu_policy;
 
 #define MMAP_SZ 16384
 bool emul_test_init(void);
@@ -122,7 +122,7 @@ static inline uint64_t xgetbv(uint32_t xcr)
 }
 
 /* Intentionally checking OSXSAVE here. */
-#define cpu_has_xsave     (cp.basic.raw[1].c & (1u << 27))
+#define cpu_has_xsave     (cpu_policy.basic.raw[1].c & (1u << 27))
 
 static inline bool xcr0_mask(uint64_t mask)
 {
@@ -132,63 +132,80 @@ static inline bool xcr0_mask(uint64_t mask)
 unsigned int rdpkru(void);
 void wrpkru(unsigned int val);
 
-#define cache_line_size() (cp.basic.clflush_size * 8)
-#define cpu_has_fpu        cp.basic.fpu
-#define cpu_has_mmx        cp.basic.mmx
-#define cpu_has_fxsr       cp.basic.fxsr
-#define cpu_has_sse        cp.basic.sse
-#define cpu_has_sse2       cp.basic.sse2
-#define cpu_has_sse3       cp.basic.sse3
-#define cpu_has_pclmulqdq  cp.basic.pclmulqdq
-#define cpu_has_ssse3      cp.basic.ssse3
-#define cpu_has_fma       (cp.basic.fma && xcr0_mask(6))
-#define cpu_has_sse4_1     cp.basic.sse4_1
-#define cpu_has_sse4_2     cp.basic.sse4_2
-#define cpu_has_popcnt     cp.basic.popcnt
-#define cpu_has_aesni      cp.basic.aesni
-#define cpu_has_avx       (cp.basic.avx  && xcr0_mask(6))
-#define cpu_has_f16c      (cp.basic.f16c && xcr0_mask(6))
-
-#define cpu_has_avx2      (cp.feat.avx2 && xcr0_mask(6))
-#define cpu_has_bmi1       cp.feat.bmi1
-#define cpu_has_bmi2       cp.feat.bmi2
-#define cpu_has_avx512f   (cp.feat.avx512f  && xcr0_mask(0xe6))
-#define cpu_has_avx512dq  (cp.feat.avx512dq && xcr0_mask(0xe6))
-#define cpu_has_avx512_ifma (cp.feat.avx512_ifma && xcr0_mask(0xe6))
-#define cpu_has_avx512cd  (cp.feat.avx512cd && xcr0_mask(0xe6))
-#define cpu_has_sha        cp.feat.sha
-#define cpu_has_avx512bw  (cp.feat.avx512bw && xcr0_mask(0xe6))
-#define cpu_has_avx512vl  (cp.feat.avx512vl && xcr0_mask(0xe6))
-#define cpu_has_avx512_vbmi (cp.feat.avx512_vbmi && xcr0_mask(0xe6))
-#define cpu_has_avx512_vbmi2 (cp.feat.avx512_vbmi2 && xcr0_mask(0xe6))
-#define cpu_has_gfni       cp.feat.gfni
-#define cpu_has_vaes      (cp.feat.vaes && xcr0_mask(6))
-#define cpu_has_vpclmulqdq (cp.feat.vpclmulqdq && xcr0_mask(6))
-#define cpu_has_avx512_vnni (cp.feat.avx512_vnni && xcr0_mask(0xe6))
-#define cpu_has_avx512_bitalg (cp.feat.avx512_bitalg && xcr0_mask(0xe6))
-#define cpu_has_avx512_vpopcntdq (cp.feat.avx512_vpopcntdq && xcr0_mask(0xe6))
-#define cpu_has_movdiri    cp.feat.movdiri
-#define cpu_has_movdir64b  cp.feat.movdir64b
-#define cpu_has_avx512_vp2intersect (cp.feat.avx512_vp2intersect && xcr0_mask(0xe6))
-#define cpu_has_serialize  cp.feat.serialize
-#define cpu_has_avx512_fp16 (cp.feat.avx512_fp16 && xcr0_mask(0xe6))
-#define cpu_has_sha512     (cp.feat.sha512 && xcr0_mask(6))
-#define cpu_has_sm3        (cp.feat.sm3 && xcr0_mask(6))
-#define cpu_has_sm4        (cp.feat.sm4 && xcr0_mask(6))
-#define cpu_has_avx_vnni   (cp.feat.avx_vnni && xcr0_mask(6))
-#define cpu_has_avx512_bf16 (cp.feat.avx512_bf16 && xcr0_mask(0xe6))
-#define cpu_has_avx_ifma   (cp.feat.avx_ifma && xcr0_mask(6))
-#define cpu_has_avx_vnni_int8 (cp.feat.avx_vnni_int8 && xcr0_mask(6))
-#define cpu_has_avx_ne_convert (cp.feat.avx_ne_convert && xcr0_mask(6))
-#define cpu_has_avx_vnni_int16 (cp.feat.avx_vnni_int16 && xcr0_mask(6))
-
-#define cpu_has_xgetbv1   (cpu_has_xsave && cp.xstate.xgetbv1)
-
-#define cpu_has_3dnow_ext  cp.extd._3dnowext
-#define cpu_has_sse4a      cp.extd.sse4a
-#define cpu_has_xop       (cp.extd.xop  && xcr0_mask(6))
-#define cpu_has_fma4      (cp.extd.fma4 && xcr0_mask(6))
-#define cpu_has_tbm        cp.extd.tbm
+#define cache_line_size()           (cpu_policy.basic.clflush_size * 8)
+#define cpu_has_fpu                  cpu_policy.basic.fpu
+#define cpu_has_mmx                  cpu_policy.basic.mmx
+#define cpu_has_fxsr                 cpu_policy.basic.fxsr
+#define cpu_has_sse                  cpu_policy.basic.sse
+#define cpu_has_sse2                 cpu_policy.basic.sse2
+#define cpu_has_sse3                 cpu_policy.basic.sse3
+#define cpu_has_pclmulqdq            cpu_policy.basic.pclmulqdq
+#define cpu_has_ssse3                cpu_policy.basic.ssse3
+#define cpu_has_fma                 (cpu_policy.basic.fma && xcr0_mask(6))
+#define cpu_has_sse4_1               cpu_policy.basic.sse4_1
+#define cpu_has_sse4_2               cpu_policy.basic.sse4_2
+#define cpu_has_popcnt               cpu_policy.basic.popcnt
+#define cpu_has_aesni                cpu_policy.basic.aesni
+#define cpu_has_avx                 (cpu_policy.basic.avx  && xcr0_mask(6))
+#define cpu_has_f16c                (cpu_policy.basic.f16c && xcr0_mask(6))
+
+#define cpu_has_avx2                (cpu_policy.feat.avx2 && xcr0_mask(6))
+#define cpu_has_bmi1                 cpu_policy.feat.bmi1
+#define cpu_has_bmi2                 cpu_policy.feat.bmi2
+#define cpu_has_avx512f             (cpu_policy.feat.avx512f && \
+                                     xcr0_mask(0xe6))
+#define cpu_has_avx512dq            (cpu_policy.feat.avx512dq && \
+                                     xcr0_mask(0xe6))
+#define cpu_has_avx512_ifma         (cpu_policy.feat.avx512_ifma && \
+                                     xcr0_mask(0xe6))
+#define cpu_has_avx512cd            (cpu_policy.feat.avx512cd && \
+                                     xcr0_mask(0xe6))
+#define cpu_has_sha                  cpu_policy.feat.sha
+#define cpu_has_avx512bw            (cpu_policy.feat.avx512bw && \
+                                     xcr0_mask(0xe6))
+#define cpu_has_avx512vl            (cpu_policy.feat.avx512vl && \
+                                     xcr0_mask(0xe6))
+#define cpu_has_avx512_vbmi         (cpu_policy.feat.avx512_vbmi && \
+                                     xcr0_mask(0xe6))
+#define cpu_has_avx512_vbmi2        (cpu_policy.feat.avx512_vbmi2 && \
+                                     xcr0_mask(0xe6))
+#define cpu_has_gfni                 cpu_policy.feat.gfni
+#define cpu_has_vaes                (cpu_policy.feat.vaes && xcr0_mask(6))
+#define cpu_has_vpclmulqdq          (cpu_policy.feat.vpclmulqdq && xcr0_mask(6))
+#define cpu_has_avx512_vnni         (cpu_policy.feat.avx512_vnni && \
+                                     xcr0_mask(0xe6))
+#define cpu_has_avx512_bitalg       (cpu_policy.feat.avx512_bitalg && \
+                                     xcr0_mask(0xe6))
+#define cpu_has_avx512_vpopcntdq    (cpu_policy.feat.avx512_vpopcntdq && \
+                                     xcr0_mask(0xe6))
+#define cpu_has_movdiri              cpu_policy.feat.movdiri
+#define cpu_has_movdir64b            cpu_policy.feat.movdir64b
+#define cpu_has_avx512_vp2intersect (cpu_policy.feat.avx512_vp2intersect && \
+                                     xcr0_mask(0xe6))
+#define cpu_has_serialize            cpu_policy.feat.serialize
+#define cpu_has_avx512_fp16         (cpu_policy.feat.avx512_fp16 && \
+                                     xcr0_mask(0xe6))
+#define cpu_has_sha512              (cpu_policy.feat.sha512 && xcr0_mask(6))
+#define cpu_has_sm3                 (cpu_policy.feat.sm3 && xcr0_mask(6))
+#define cpu_has_sm4                 (cpu_policy.feat.sm4 && xcr0_mask(6))
+#define cpu_has_avx_vnni            (cpu_policy.feat.avx_vnni && xcr0_mask(6))
+#define cpu_has_avx512_bf16         (cpu_policy.feat.avx512_bf16 && \
+                                     xcr0_mask(0xe6))
+#define cpu_has_avx_ifma            (cpu_policy.feat.avx_ifma && xcr0_mask(6))
+#define cpu_has_avx_vnni_int8       (cpu_policy.feat.avx_vnni_int8 && \
+                                     xcr0_mask(6))
+#define cpu_has_avx_ne_convert      (cpu_policy.feat.avx_ne_convert && \
+                                     xcr0_mask(6))
+#define cpu_has_avx_vnni_int16      (cpu_policy.feat.avx_vnni_int16 && \
+                                     xcr0_mask(6))
+
+#define cpu_has_xgetbv1             (cpu_has_xsave && cpu_policy.xstate.xgetbv1)
+
+#define cpu_has_3dnow_ext            cpu_policy.extd._3dnowext
+#define cpu_has_sse4a                cpu_policy.extd.sse4a
+#define cpu_has_xop                 (cpu_policy.extd.xop  && xcr0_mask(6))
+#define cpu_has_fma4                (cpu_policy.extd.fma4 && xcr0_mask(6))
+#define cpu_has_tbm                  cpu_policy.extd.tbm
 
 int emul_test_cpuid(
     uint32_t leaf,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Sep 08 02:55:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 08 Sep 2024 02:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.792426.1202327 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn85C-0000X4-W3; Sun, 08 Sep 2024 02:55:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 792426.1202327; Sun, 08 Sep 2024 02:55:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn85C-0000Wx-Ta; Sun, 08 Sep 2024 02:55:22 +0000
Received: by outflank-mailman (input) for mailman id 792426;
 Sun, 08 Sep 2024 02:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn85C-0000Wj-2I
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn85C-0002ie-1a
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn85B-0000At-W2
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:55:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ob9bEpRpwsKF7OyUsmy9P6rKkPPWzY5O/V6Mstmhi70=; b=zNUuaC1q/0K900yto1o/Hx1/+l
	82x+RbciWZ6/kDcEEFssn3UUwSwEHBxZLkeyBbVRkVUqoZr+K/3kR201m/kV+DtVGv89yeMQrZsBw
	+zKekMZqX3X1cuOS4TJwIWmd2nCMouEIWvxor2CFiT0f+IEQFENlfIv0V1DrCB1QCceA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86emul: introduce a struct cpu_policy * local in x86_emulate()
Message-Id: <E1sn85B-0000At-W2@xenbits.xenproject.org>
Date: Sun, 08 Sep 2024 02:55:21 +0000

commit b20e3fbc3ec91b4534e51f6f724c3826dac0bdf3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Sep 4 16:06:42 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 4 16:06:42 2024 +0200

    x86emul: introduce a struct cpu_policy * local in x86_emulate()
    
    While of little effect right here, future patches (AVX10, AMX,
    KeyLocker) will benefit more significantly.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 0a6d5a35b1..53742b4796 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -1233,6 +1233,7 @@ x86_emulate(
 {
     /* Shadow copy of register state. Committed on successful emulation. */
     struct cpu_user_regs _regs = *ctxt->regs;
+    const struct cpu_policy *cp = ctxt->cpu_policy;
     struct x86_emulate_state state;
     int rc;
     uint8_t b, d, *opc = NULL;
@@ -3075,7 +3076,7 @@ x86_emulate(
          * in fact risking to make guest OSes vulnerable to the equivalent of
          * XSA-7 (CVE-2012-0217).
          */
-        generate_exception_if(ctxt->cpuid->x86_vendor == X86_VENDOR_INTEL &&
+        generate_exception_if(cp->x86_vendor == X86_VENDOR_INTEL &&
                               op_bytes == 8 && !is_canonical_address(_regs.rcx),
                               X86_EXC_GP, 0);
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Sep 08 02:55:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 08 Sep 2024 02:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.792427.1202331 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn85N-0000aa-1G; Sun, 08 Sep 2024 02:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 792427.1202331; Sun, 08 Sep 2024 02:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn85M-0000aT-V4; Sun, 08 Sep 2024 02:55:32 +0000
Received: by outflank-mailman (input) for mailman id 792427;
 Sun, 08 Sep 2024 02:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn85M-0000aG-5X
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn85M-0002ip-4f
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn85M-0000Bs-3i
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IivSZZM/6sQ/NC89mEC5CPr4pvhWxWdvVmQsLrakHfU=; b=bXCnD9W32TosZMsJ3roBt2ZdJA
	zqhROfdcz5LgCqku57CSTm/e9pBiLvFt28o53YPj5U8VfcxuypwQzK7y9vSHkwaE+w9mByYcdhhy7
	uiAkrbGxEmXMTHUIpK6LDWUiV/SjVRFtFKtBm1aaLgZ0J1YUN7QWplzCRNyakyYph9Cw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] mktarball: only archive Xen
Message-Id: <E1sn85M-0000Bs-3i@xenbits.xenproject.org>
Date: Sun, 08 Sep 2024 02:55:32 +0000

commit c5be91eb81403195643e8de287c86fbd728ad6cb
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Sep 4 16:07:41 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 4 16:07:41 2024 +0200

    mktarball: only archive Xen
    
    As was basically decided already a while ago, remove - in the simplest
    possible way - the archiving of both qemu-s and mini-os from tarball
    generation.
    
    With this the subtree-force-update-all prereq isn't needed anymore in
    the top level Makefile. That goal, including the respective ones
    underneath tools/, then also are unreferenced and hence are being
    dropped, too.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 Makefile                |  8 ++------
 tools/Makefile          |  5 -----
 tools/Rules.mk          |  2 +-
 tools/firmware/Makefile |  4 ----
 tools/misc/mktarball    | 22 +---------------------
 5 files changed, 4 insertions(+), 37 deletions(-)

diff --git a/Makefile b/Makefile
index a6ca348476..c9d80a6dc6 100644
--- a/Makefile
+++ b/Makefile
@@ -200,10 +200,6 @@ rpmball: dist
 subtree-force-update: mini-os-dir-force-update
 	$(MAKE) -C tools subtree-force-update
 
-.PHONY: subtree-force-update-all
-subtree-force-update-all: mini-os-dir-force-update
-	$(MAKE) -C tools subtree-force-update-all
-
 # Make a source tarball, including qemu sub-trees.
 #
 # src-tarball will use "git describe" for the version number.  This
@@ -214,11 +210,11 @@ subtree-force-update-all: mini-os-dir-force-update
 # src-tarball-release will use "make xenversion" as the version
 # number.  This is suitable for release tarballs.
 .PHONY: src-tarball-release
-src-tarball-release: subtree-force-update-all
+src-tarball-release:
 	bash ./tools/misc/mktarball $(XEN_ROOT) $$($(MAKE) -C xen xenversion --no-print-directory)
 
 .PHONY: src-tarball
-src-tarball: subtree-force-update-all
+src-tarball:
 	bash ./tools/misc/mktarball $(XEN_ROOT) $$(git describe)
 
 .PHONY: clean
diff --git a/tools/Makefile b/tools/Makefile
index 7d17211782..e9e1cda305 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -282,8 +282,3 @@ endif
 ifeq ($(CONFIG_X86),y)
 	$(MAKE) -C firmware subtree-force-update
 endif
-
-subtree-force-update-all:
-	$(MAKE) qemu-xen-dir-force-update
-	$(MAKE) qemu-xen-traditional-dir-force-update
-	$(MAKE) -C firmware subtree-force-update-all
diff --git a/tools/Rules.mk b/tools/Rules.mk
index 18cf83f5be..e2289c25b4 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -206,7 +206,7 @@ subdir-all-% subdir-clean-% subdir-install-% subdir-uninstall-%: .phony
 subdir-distclean-%: .phony
 	$(MAKE) -C $* distclean
 
-no-configure-targets := distclean subdir-distclean% clean subdir-clean% subtree-force-update-all %-dir-force-update
+no-configure-targets := distclean subdir-distclean% clean subdir-clean% %-dir-force-update
 ifeq (,$(filter $(no-configure-targets),$(MAKECMDGOALS)))
 $(XEN_ROOT)/config/Tools.mk:
 	$(error You have to run ./configure before building or installing the tools)
diff --git a/tools/firmware/Makefile b/tools/firmware/Makefile
index 345037b93b..d69f7c69ea 100644
--- a/tools/firmware/Makefile
+++ b/tools/firmware/Makefile
@@ -127,9 +127,5 @@ ifeq ($(CONFIG_OVMF),y)
 	$(MAKE) ovmf-dir-force-update
 endif
 
-subtree-force-update-all:
-	$(MAKE) seabios-dir-force-update
-	$(MAKE) ovmf-dir-force-update
-
 subdir-all-seabios-dir: seabios-dir
 	$(MAKE) -C $< CC=$(SEABIOSCC) LD=$(SEABIOSLD) PYTHON=$(PYTHON) EXTRAVERSION=$(SEABIOS_EXTRAVERSION) all;
diff --git a/tools/misc/mktarball b/tools/misc/mktarball
index 42d543073c..7f9b61da43 100755
--- a/tools/misc/mktarball
+++ b/tools/misc/mktarball
@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# mktarball: Make a release tarball (including xen, qemu, and qemu-traditional)
+# mktarball: Make a release tarball (including just xen)
 #
 # Takes 2 arguments, the path to the dist directory and the version
 set -ex
@@ -29,26 +29,6 @@ mkdir -p $tdir
 
 git_archive_into $xen_root $tdir/xen-$desc
 
-# We can't use git_archive_into with qemu upstream because it uses
-# git-submodules.  git-submodules are an inherently broken git feature
-# which should never be used in any circumstance.  Unfortunately, qemu
-# upstream uses them.  Relevantly for us, git archive does not work
-# properly when there are submodules.
-(
-    cd $xen_root/tools/qemu-xen-dir-remote
-    # if it's not clean, the qemu script will call `git stash' !
-    git --no-pager diff --stat HEAD
-    scripts/archive-source.sh $tdir/xen-$desc/tools/qemu-xen.tar
-    cd $tdir/xen-$desc/tools
-    mkdir qemu-xen
-    tar <qemu-xen.tar Cxf qemu-xen -
-    rm qemu-xen.tar
-)
-
-git_archive_into $xen_root/tools/qemu-xen-traditional-dir-remote $tdir/xen-$desc/tools/qemu-xen-traditional
-
-git_archive_into $xen_root/extras/mini-os-remote $tdir/xen-$desc/extras/mini-os
-
 GZIP=-9v tar cz -f $xen_root/dist/xen-$desc.tar.gz -C $tdir xen-$desc
 
 echo "Source tarball in $xen_root/dist/xen-$desc.tar.gz"
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Sep 08 02:55:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 08 Sep 2024 02:55:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.792428.1202335 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn85X-0000dL-2q; Sun, 08 Sep 2024 02:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 792428.1202335; Sun, 08 Sep 2024 02:55:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn85X-0000dE-0I; Sun, 08 Sep 2024 02:55:43 +0000
Received: by outflank-mailman (input) for mailman id 792428;
 Sun, 08 Sep 2024 02:55:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn85W-0000d8-BS
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn85W-0002j2-7j
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn85W-0000Cm-6q
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=b3Ixw7Gpfs4AcM3uxYHfI8lxR641iG6Q3lzodC32EiI=; b=Y7WvGMxBU0ldLnrn7lj+wD38fz
	YFq5zCdGDQbpvlcuK0NHIJ6raLYahus9B48HiyPfE2AdsoKGuOdv+vDpvfomnBj9BfgFPz5LByAT5
	4AqnHL7lV2YX3dAYL1wBPeXs5iM8DRP91P7aj97gaDTzURdz1lu3qq9Hjmt0y6Q/6T2k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/tboot: add Intel dependency
Message-Id: <E1sn85W-0000Cm-6q@xenbits.xenproject.org>
Date: Sun, 08 Sep 2024 02:55:42 +0000

commit 3117e58ce03a0aecd945abe99778407a176fe2f1
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Wed Sep 4 16:08:37 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 4 16:08:37 2024 +0200

    x86/tboot: add Intel dependency
    
    Make the Intel-specific Trusted Boot implementation dependant on general Intel CPU support.
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index dee8db45e8..62f0b5e0f4 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -222,7 +222,7 @@ config HVM_FEP
 
 config TBOOT
 	bool "Xen tboot support (UNSUPPORTED)"
-	depends on UNSUPPORTED
+	depends on INTEL && UNSUPPORTED
 	default !PV_SHIM_EXCLUSIVE
 	select CRYPTO
 	help
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Sep 08 02:55:53 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 08 Sep 2024 02:55:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.792429.1202340 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn85h-0000gm-5X; Sun, 08 Sep 2024 02:55:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 792429.1202340; Sun, 08 Sep 2024 02:55:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn85h-0000ge-2z; Sun, 08 Sep 2024 02:55:53 +0000
Received: by outflank-mailman (input) for mailman id 792429;
 Sun, 08 Sep 2024 02:55:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn85g-0000gY-C2
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:55:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn85g-0002j9-BN
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn85g-0000DZ-9p
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:55:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=m6hMelzFmjwNhByo6qHIPn7JYlRNuAGKltp4pw08DLI=; b=rJkI70YVZONMgWxwHx7fFkzXRf
	p3IUVbV+oaAH1qUEqNe3b7iBcq9EobYuDFCGmrDmZ3MNFcNt5c4Y5zxj/1Jjyngbii/MFU8Njyq8R
	Wkz7iSuX76Vv5qXRw212sjH4Q1OgJxpqdo/VtlswdBzG9brkkdezGJ+5lvVj5/wLy5u4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: fix UP build with gcc14
Message-Id: <E1sn85g-0000DZ-9p@xenbits.xenproject.org>
Date: Sun, 08 Sep 2024 02:55:52 +0000

commit a2de7dc4d845738e734b10fce6550c89c6b1092c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Sep 4 16:09:28 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 4 16:09:28 2024 +0200

    x86: fix UP build with gcc14
    
    The complaint is:
    
    In file included from ././include/xen/config.h:17,
                     from <command-line>:
    arch/x86/smpboot.c: In function ‘link_thread_siblings.constprop’:
    ./include/asm-generic/percpu.h:16:51: error: array subscript [0, 0] is outside array bounds of ‘long unsigned int[1]’ [-Werror=array-bounds=]
       16 |     (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
    ./include/xen/compiler.h:140:29: note: in definition of macro ‘RELOC_HIDE’
      140 |     (typeof(ptr)) (__ptr + (off)); })
          |                             ^~~
    arch/x86/smpboot.c:238:27: note: in expansion of macro ‘per_cpu’
      238 |     cpumask_set_cpu(cpu2, per_cpu(cpu_sibling_mask, cpu1));
          |                           ^~~~~~~
    In file included from ./arch/x86/include/generated/asm/percpu.h:1,
                     from ./include/xen/percpu.h:30,
                     from ./arch/x86/include/asm/cpuid.h:9,
                     from ./arch/x86/include/asm/cpufeature.h:11,
                     from ./arch/x86/include/asm/system.h:6,
                     from ./include/xen/list.h:11,
                     from ./include/xen/mm.h:68,
                     from arch/x86/smpboot.c:12:
    ./include/asm-generic/percpu.h:12:22: note: while referencing ‘__per_cpu_offset’
       12 | extern unsigned long __per_cpu_offset[NR_CPUS];
          |                      ^~~~~~~~~~~~~~~~
    
    Which I consider bogus in the first place ("array subscript [0, 0]" vs a
    1-element array). Yet taking the experience from 99f942f3d410 ("Arm64:
    adjust __irq_to_desc() to fix build with gcc14") I guessed that
    switching function parameters to unsigned int (which they should have
    been anyway) might help. And voilà ...
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/smpboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 8aa621533f..0a89f22a39 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -226,7 +226,7 @@ static int booting_cpu;
 /* CPUs for which sibling maps can be computed. */
 static cpumask_t cpu_sibling_setup_map;
 
-static void link_thread_siblings(int cpu1, int cpu2)
+static void link_thread_siblings(unsigned int cpu1, unsigned int cpu2)
 {
     cpumask_set_cpu(cpu1, per_cpu(cpu_sibling_mask, cpu2));
     cpumask_set_cpu(cpu2, per_cpu(cpu_sibling_mask, cpu1));
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Sep 08 02:56:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 08 Sep 2024 02:56:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.792430.1202343 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn85s-0000k0-7j; Sun, 08 Sep 2024 02:56:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 792430.1202343; Sun, 08 Sep 2024 02:56:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn85s-0000js-4l; Sun, 08 Sep 2024 02:56:04 +0000
Received: by outflank-mailman (input) for mailman id 792430;
 Sun, 08 Sep 2024 02:56:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn85q-0000jU-FD
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:56:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn85q-0002jU-EX
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:56:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn85q-0000FS-Di
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:56:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6nDMtKJfqpG2XmWJZ99xjwL5pW8zbf/TsEJH/8Yrfms=; b=hIKIt03JASuofbDa/mhQt+oN1L
	N85oIQH2g2sxLGNhUs8DxFUSAMIlDG8TFLgkP8Kl0LC0BQQQ8IswyffHFPzz4He6z0GCHQ8/HzBzW
	QSAlsGHSW4WYaTomh49aeDRr/a6TUaiTDbwPxl/hX1bmCjO95h3OsOCPZ3JrewWFyOls=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/xstate: enable AMX components
Message-Id: <E1sn85q-0000FS-Di@xenbits.xenproject.org>
Date: Sun, 08 Sep 2024 02:56:02 +0000

commit e3b5440012721560ff48859ba8c4ea7f72f9ef20
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Sep 6 08:40:21 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Sep 6 08:40:21 2024 +0200

    x86/xstate: enable AMX components
    
    These being controlled by XCR0, enabling support is relatively
    straightforward. Note however that there won't be any use of them until
    their dependent ISA extension CPUID flags are exposed, not the least due
    to recalculate_xstate() handling the dependencies in kind of a reverse
    manner.
    
    Note that xstate_check_sizes() already covers the two new states.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/cpu-policy.c                   | 3 +++
 xen/arch/x86/include/asm/xstate.h           | 3 ++-
 xen/include/public/arch-x86/cpufeatureset.h | 4 ++++
 xen/tools/gen-cpuid.py                      | 9 +++++++--
 4 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/cpu-policy.c b/xen/arch/x86/cpu-policy.c
index 888e7ac4d4..1f5e42db5b 100644
--- a/xen/arch/x86/cpu-policy.c
+++ b/xen/arch/x86/cpu-policy.c
@@ -216,6 +216,9 @@ static void recalculate_xstate(struct cpu_policy *p)
     if ( p->feat.pku )
         xstates |= X86_XCR0_PKRU;
 
+    if ( p->feat.amx_tile )
+        xstates |= X86_XCR0_TILE_CFG | X86_XCR0_TILE_DATA;
+
     /* Subleaf 0 */
     p->xstate.max_size =
         xstate_uncompressed_size(xstates & ~XSTATE_XSAVES_ONLY);
diff --git a/xen/arch/x86/include/asm/xstate.h b/xen/arch/x86/include/asm/xstate.h
index ebeb2a3dca..b4ee555953 100644
--- a/xen/arch/x86/include/asm/xstate.h
+++ b/xen/arch/x86/include/asm/xstate.h
@@ -35,7 +35,8 @@ extern uint32_t mxcsr_mask;
                         XSTATE_NONLAZY)
 
 #define XSTATE_ALL     (~(1ULL << 63))
-#define XSTATE_NONLAZY (X86_XCR0_BNDREGS | X86_XCR0_BNDCSR | X86_XCR0_PKRU)
+#define XSTATE_NONLAZY (X86_XCR0_BNDREGS | X86_XCR0_BNDCSR | X86_XCR0_PKRU | \
+                        X86_XCR0_TILE_CFG | X86_XCR0_TILE_DATA)
 #define XSTATE_LAZY    (XSTATE_ALL & ~XSTATE_NONLAZY)
 #define XSTATE_XSAVES_ONLY         0
 #define XSTATE_COMPACTION_ENABLED  (1ULL << 63)
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index abab78fa86..420ed21a20 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -278,8 +278,10 @@ XEN_CPUFEATURE(HYBRID,        9*32+15) /*   Heterogeneous platform */
 XEN_CPUFEATURE(TSXLDTRK,      9*32+16) /*a  TSX load tracking suspend/resume insns */
 XEN_CPUFEATURE(ARCH_LBR,      9*32+19) /*   Architectural Last Branch Record */
 XEN_CPUFEATURE(CET_IBT,       9*32+20) /*   CET - Indirect Branch Tracking */
+XEN_CPUFEATURE(AMX_BF16,      9*32+22) /*   AMX BFloat16 instruction */
 XEN_CPUFEATURE(AVX512_FP16,   9*32+23) /*A  AVX512 FP16 instructions */
 XEN_CPUFEATURE(AMX_TILE,      9*32+24) /*   AMX Tile architecture */
+XEN_CPUFEATURE(AMX_INT8,      9*32+25) /*   AMX 8-bit integer instructions */
 XEN_CPUFEATURE(IBRSB,         9*32+26) /*A  IBRS and IBPB support (used by Intel) */
 XEN_CPUFEATURE(STIBP,         9*32+27) /*A  STIBP */
 XEN_CPUFEATURE(L1D_FLUSH,     9*32+28) /*S  MSR_FLUSH_CMD and L1D flush. */
@@ -297,6 +299,7 @@ XEN_CPUFEATURE(FZRM,         10*32+10) /*A  Fast Zero-length REP MOVSB */
 XEN_CPUFEATURE(FSRS,         10*32+11) /*A  Fast Short REP STOSB */
 XEN_CPUFEATURE(FSRCS,        10*32+12) /*A  Fast Short REP CMPSB/SCASB */
 XEN_CPUFEATURE(WRMSRNS,      10*32+19) /*S  WRMSR Non-Serialising */
+XEN_CPUFEATURE(AMX_FP16,     10*32+21) /*   AMX FP16 instruction */
 XEN_CPUFEATURE(AVX_IFMA,     10*32+23) /*A  AVX-IFMA Instructions */
 
 /* AMD-defined CPU features, CPUID level 0x80000021.eax, word 11 */
@@ -331,6 +334,7 @@ XEN_CPUFEATURE(MCDT_NO,            13*32+ 5) /*A  MCDT_NO */
 /* Intel-defined CPU features, CPUID level 0x00000007:1.edx, word 15 */
 XEN_CPUFEATURE(AVX_VNNI_INT8,      15*32+ 4) /*A  AVX-VNNI-INT8 Instructions */
 XEN_CPUFEATURE(AVX_NE_CONVERT,     15*32+ 5) /*A  AVX-NE-CONVERT Instructions */
+XEN_CPUFEATURE(AMX_COMPLEX,        15*32+ 8) /*   AMX Complex Instructions */
 XEN_CPUFEATURE(AVX_VNNI_INT16,     15*32+10) /*A  AVX-VNNI-INT16 Instructions */
 XEN_CPUFEATURE(PREFETCHI,          15*32+14) /*A  PREFETCHIT{0,1} Instructions */
 XEN_CPUFEATURE(CET_SSS,            15*32+18) /*   CET Supervisor Shadow Stacks safe to use */
diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index 601eec6089..f7cad255da 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -252,7 +252,7 @@ def crunch_numbers(state):
         # instruction groups which are specified to require XSAVE for state
         # management.
         XSAVE: [XSAVEOPT, XSAVEC, XGETBV1, XSAVES,
-                AVX, MPX, PKU, LWP],
+                AVX, MPX, PKU, AMX_TILE, LWP],
 
         # AVX is taken to mean hardware support for 256bit registers (which in
         # practice depends on the VEX prefix to encode), and the instructions
@@ -274,7 +274,7 @@ def crunch_numbers(state):
         # superpages, PCID and PKU are only available in 4 level paging.
         # NO_LMSL indicates the absense of Long Mode Segment Limits, which
         # have been dropped in hardware.
-        LM: [CX16, PCID, LAHF_LM, PAGE1GB, PKU, NO_LMSL],
+        LM: [CX16, PCID, LAHF_LM, PAGE1GB, PKU, NO_LMSL, AMX_TILE],
 
         # AMD K6-2+ and K6-III processors shipped with 3DNow+, beyond the
         # standard 3DNow in the earlier K6 processors.
@@ -338,6 +338,11 @@ def crunch_numbers(state):
 
         # The behaviour described by RRSBA depend on eIBRS being active.
         EIBRS: [RRSBA],
+
+        # AMX-TILE means hardware support for tile registers and general non-
+        # computational instructions.  All further AMX features are built on top
+        # of AMX-TILE.
+        AMX_TILE: [AMX_BF16, AMX_INT8, AMX_FP16, AMX_COMPLEX],
     }
 
     deep_features = tuple(sorted(deps.keys()))
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Sep 08 02:56:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 08 Sep 2024 02:56:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.792431.1202350 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn862-0001Fm-AP; Sun, 08 Sep 2024 02:56:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 792431.1202350; Sun, 08 Sep 2024 02:56:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn862-0001FI-6L; Sun, 08 Sep 2024 02:56:14 +0000
Received: by outflank-mailman (input) for mailman id 792431;
 Sun, 08 Sep 2024 02:56:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn860-0000nB-Iw
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:56:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn860-0002jb-HS
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:56:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn860-0000GT-Gj
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:56:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HBYb0jtt9zjeOANNxGuQlwG5bfOw1nH4NGspUULg9pQ=; b=vgzj4Zkly2gdbKLE1lpo2E7l2u
	c8KIh97reC3YHWLfw+u0tG4L8JxH8dzanD5ngvdbl4PjP0RGFDKwFW+kW5OpkjkYIbTcdGemW+NSX
	GUxZGebtqvlCf97BpW8I6NOjPpwmARyoMMCYU0lMrh5poPUUOCGepLMFx951yf1sEAJE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86emul/test: fix build with gas 2.43
Message-Id: <E1sn860-0000GT-Gj@xenbits.xenproject.org>
Date: Sun, 08 Sep 2024 02:56:12 +0000

commit 3c09288298af881ea1bb568740deb2d2a06bcd41
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Sep 6 08:41:18 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Sep 6 08:41:18 2024 +0200

    x86emul/test: fix build with gas 2.43
    
    Drop explicit {evex} pseudo-prefixes. New gas (validly) complains when
    they're used on things other than instructions. Our use was potentially
    ahead of macro invocations - see simd.h's "override" macro.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/tests/x86_emulator/simd.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/tests/x86_emulator/simd.c b/tools/tests/x86_emulator/simd.c
index 263cea662d..d68a7364c2 100644
--- a/tools/tests/x86_emulator/simd.c
+++ b/tools/tests/x86_emulator/simd.c
@@ -333,7 +333,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # if FLOAT_SIZE == 4
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vbroadcastss %1, %0" \
+    asm ( "vbroadcastss %1, %0" \
           : "=v" (t_) : "m" (*(float[1]){ x }) ); \
     t_; \
 })
@@ -401,14 +401,14 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 #  if VEC_SIZE >= 32
 #   define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vbroadcastsd %1, %0" : "=v" (t_) \
+    asm ( "vbroadcastsd %1, %0" : "=v" (t_) \
           : "m" (*(double[1]){ x }) ); \
     t_; \
 })
 #  else
 #   define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastq %1, %0" \
+    asm ( "vpbroadcastq %1, %0" \
           : "=v" (t_) : "m" (*(double[1]){ x }) ); \
     t_; \
 })
@@ -601,7 +601,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # if INT_SIZE == 4 || UINT_SIZE == 4
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastd %1, %0" \
+    asm ( "vpbroadcastd %1, %0" \
           : "=v" (t_) : "m" (*(int[1]){ x }) ); \
     t_; \
 })
@@ -649,7 +649,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # elif INT_SIZE == 8 || UINT_SIZE == 8
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastq %1, %0" \
+    asm ( "vpbroadcastq %1, %0" \
           : "=v" (t_) : "m" (*(long long[1]){ x }) ); \
     t_; \
 })
@@ -716,7 +716,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # if INT_SIZE == 1 || UINT_SIZE == 1
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastb %1, %0" \
+    asm ( "vpbroadcastb %1, %0" \
           : "=v" (t_) : "m" (*(char[1]){ x }) ); \
     t_; \
 })
@@ -745,7 +745,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # elif INT_SIZE == 2 || UINT_SIZE == 2
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastw %1, %0" \
+    asm ( "vpbroadcastw %1, %0" \
           : "=v" (t_) : "m" (*(short[1]){ x }) ); \
     t_; \
 })
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Sep 08 02:56:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 08 Sep 2024 02:56:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.792432.1202352 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn86C-0001Tx-Ad; Sun, 08 Sep 2024 02:56:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 792432.1202352; Sun, 08 Sep 2024 02:56:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn86C-0001Tp-7m; Sun, 08 Sep 2024 02:56:24 +0000
Received: by outflank-mailman (input) for mailman id 792432;
 Sun, 08 Sep 2024 02:56:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn86A-0001Tf-LR
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:56:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn86A-0002k2-Kj
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:56:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn86A-0000HV-Jv
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:56:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kEjX7eAqfLcSpQApR1+DWHbbmhEgZueRtadk+mY+wsw=; b=5Acl/9DkDhO/3XNjpCIIlVCgu/
	9yvWQxKJ6BAbwhgI0A4bkp6UzStXr2RGa/ebQwz5B3Xi6bX2465N9pvjEzP++0muGHNw/1cczJoCB
	2ivPovDgSvHOi4CmYDc1agxCyKBEZprWIQLsLPt4V8QdKfslGmAMuOfzaTtiu1x4wqkg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86emul: mark new "cp" local var maybe-unused
Message-Id: <E1sn86A-0000HV-Jv@xenbits.xenproject.org>
Date: Sun, 08 Sep 2024 02:56:22 +0000

commit d092002824a1fa675c936170d099c5646ecf8082
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Sep 6 12:47:58 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Sep 6 12:47:58 2024 +0200

    x86emul: mark new "cp" local var maybe-unused
    
    Just for the sake of the 32-bit build of the test harness. This wants
    reverting once unconditional uses of the variable appear (AMX, AVX10).
    
    Fixes: b20e3fbc3ec9 ("x86emul: introduce a struct cpu_policy * local in x86_emulate()")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 53742b4796..e12fbe3100 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -1233,7 +1233,7 @@ x86_emulate(
 {
     /* Shadow copy of register state. Committed on successful emulation. */
     struct cpu_user_regs _regs = *ctxt->regs;
-    const struct cpu_policy *cp = ctxt->cpu_policy;
+    const struct cpu_policy *__maybe_unused cp = ctxt->cpu_policy;
     struct x86_emulate_state state;
     int rc;
     uint8_t b, d, *opc = NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Sep 08 02:56:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 08 Sep 2024 02:56:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.792433.1202356 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn86M-0001Wb-Bx; Sun, 08 Sep 2024 02:56:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 792433.1202356; Sun, 08 Sep 2024 02:56:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn86M-0001WT-9E; Sun, 08 Sep 2024 02:56:34 +0000
Received: by outflank-mailman (input) for mailman id 792433;
 Sun, 08 Sep 2024 02:56:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn86K-0001WG-OT
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:56:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn86K-0002kE-Nk
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:56:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn86K-0000IQ-N4
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:56:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aNkvTv1wAAB/UXfTYHM9ItMNSO4+5nQDLRQYnqkw924=; b=wAmTzfyGF1DgMRMz8P18IphtKQ
	DmQg43D2+Pl1C4H4N0z5B6CbulyHlsIvJWOuq/QngWfvTY8wzxoPkDS8bIty4hFjxigWwYyEoEOcy
	nQ6DBDsYjTmz1L7MdKqfYXAgxwk0dgwTx9n4A2kSeuymzsEQswqQ7Ck/9/0EkM5qskF0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86emul/test: use MSR constants
Message-Id: <E1sn86K-0000IQ-N4@xenbits.xenproject.org>
Date: Sun, 08 Sep 2024 02:56:32 +0000

commit 01ffbe8bcffdc5c6c98f0715bac95f3348b1c0cc
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Sep 6 12:48:42 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Sep 6 12:48:42 2024 +0200

    x86emul/test: use MSR constants
    
    msr-index.h has been in use for a while, so use the identifiers it
    provides in place of raw numbers plus comments.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/tests/x86_emulator/test_x86_emulator.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index 94a2bbab93..3a6054441a 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -689,11 +689,11 @@ static int read_msr(
 {
     switch ( reg )
     {
-    case 0xc0000080: /* EFER */
-        *val = ctxt->addr_size > 32 ? 0x500 /* LME|LMA */ : 0;
+    case MSR_EFER:
+        *val = ctxt->addr_size > 32 ? EFER_LME | EFER_LMA : 0;
         return X86EMUL_OKAY;
 
-    case 0xc0000103: /* TSC_AUX */
+    case MSR_TSC_AUX:
 #define TSC_AUX_VALUE 0xCACACACA
         *val = TSC_AUX_VALUE;
         return X86EMUL_OKAY;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Sep 08 02:56:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 08 Sep 2024 02:56:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.792434.1202359 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn86W-0001ZK-DC; Sun, 08 Sep 2024 02:56:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 792434.1202359; Sun, 08 Sep 2024 02:56:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn86W-0001ZC-Af; Sun, 08 Sep 2024 02:56:44 +0000
Received: by outflank-mailman (input) for mailman id 792434;
 Sun, 08 Sep 2024 02:56:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn86U-0001Yw-RN
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:56:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn86U-0002kL-Qh
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:56:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn86U-0000JM-Pw
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:56:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RgnvUDKGpRyUucLb2UvL4AGy4ttIk65LH1waHm3B4Ks=; b=m+R7ea9HMH5NemO5YTfUN1VJny
	63ec2AXWSDhmQ+MGPe3DtsUzYpbEp2Pbp5eIEd4q7LlA7H78kpAft8NUOjQRRILcKB1XtUP/0EyAK
	FZqRxU40phnFroQ2ioOe5aC13H94nUWEQskbC4cYyE7SmEq3Aw0P7rVtf8B6O9pZi4Wc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/cpufeatures: Add new cpuid features in SPR to featureset
Message-Id: <E1sn86U-0000JM-Pw@xenbits.xenproject.org>
Date: Sun, 08 Sep 2024 02:56:42 +0000

commit 5afb11ac409185d862f405b2509b89abc2311bf5
Author:     Matthew Barnes <matthew.barnes@cloud.com>
AuthorDate: Wed Aug 21 16:34:37 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Sep 6 14:42:18 2024 +0100

    x86/cpufeatures: Add new cpuid features in SPR to featureset
    
    Upon running `xen-cpuid -v` on a host machine with Sapphire Rapids
    within Dom0, there exist unrecognised features.
    
    This patch adds these features as macros to the CPU featureset,
    disabled by default.
    
    Signed-off-by: Matthew Barnes <matthew.barnes@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/include/public/arch-x86/cpufeatureset.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 420ed21a20..adc1fa34cc 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -121,6 +121,7 @@ XEN_CPUFEATURE(SMX,           1*32+ 6) /*   Safer Mode Extensions */
 XEN_CPUFEATURE(EIST,          1*32+ 7) /*   Enhanced SpeedStep */
 XEN_CPUFEATURE(TM2,           1*32+ 8) /*   Thermal Monitor 2 */
 XEN_CPUFEATURE(SSSE3,         1*32+ 9) /*A  Supplemental Streaming SIMD Extensions-3 */
+XEN_CPUFEATURE(SDBG,          1*32+11) /*   IA32_DEBUG_INTERFACE MSR for silicon debugging support */
 XEN_CPUFEATURE(FMA,           1*32+12) /*A  Fused Multiply Add */
 XEN_CPUFEATURE(CX16,          1*32+13) /*A  CMPXCHG16B */
 XEN_CPUFEATURE(XTPR,          1*32+14) /*   Send Task Priority Messages */
@@ -181,6 +182,7 @@ XEN_CPUFEATURE(XSAVEOPT,      4*32+ 0) /*A  XSAVEOPT instruction */
 XEN_CPUFEATURE(XSAVEC,        4*32+ 1) /*A  XSAVEC/XRSTORC instructions */
 XEN_CPUFEATURE(XGETBV1,       4*32+ 2) /*A  XGETBV with %ecx=1 */
 XEN_CPUFEATURE(XSAVES,        4*32+ 3) /*S  XSAVES/XRSTORS instructions */
+XEN_CPUFEATURE(XFD,           4*32+ 4) /*   MSR_XFD{,_ERR} (eXtended Feature Disable) */
 
 /* Intel-defined CPU features, CPUID level 0x00000007:0.ebx, word 5 */
 XEN_CPUFEATURE(FSGSBASE,      5*32+ 0) /*A  {RD,WR}{FS,GS}BASE instructions */
@@ -221,6 +223,7 @@ XEN_CPUFEATURE(AVX512_VBMI,   6*32+ 1) /*A  AVX-512 Vector Byte Manipulation Ins
 XEN_CPUFEATURE(UMIP,          6*32+ 2) /*S  User Mode Instruction Prevention */
 XEN_CPUFEATURE(PKU,           6*32+ 3) /*H  Protection Keys for Userspace */
 XEN_CPUFEATURE(OSPKE,         6*32+ 4) /*!  OS Protection Keys Enable */
+XEN_CPUFEATURE(WAITPKG,       6*32+ 5) /*   UMONITOR/UMWAIT/TPAUSE */
 XEN_CPUFEATURE(AVX512_VBMI2,  6*32+ 6) /*A  Additional AVX-512 Vector Byte Manipulation Instrs */
 XEN_CPUFEATURE(CET_SS,        6*32+ 7) /*   CET - Shadow Stacks */
 XEN_CPUFEATURE(GFNI,          6*32+ 8) /*A  Galois Field Instrs */
@@ -228,13 +231,16 @@ XEN_CPUFEATURE(VAES,          6*32+ 9) /*A  Vector AES Instrs */
 XEN_CPUFEATURE(VPCLMULQDQ,    6*32+10) /*A  Vector Carry-less Multiplication Instrs */
 XEN_CPUFEATURE(AVX512_VNNI,   6*32+11) /*A  Vector Neural Network Instrs */
 XEN_CPUFEATURE(AVX512_BITALG, 6*32+12) /*A  Support for VPOPCNT[B,W] and VPSHUFBITQMB */
+XEN_CPUFEATURE(TME,           6*32+13) /*   Total Memory Encryption */
 XEN_CPUFEATURE(AVX512_VPOPCNTDQ, 6*32+14) /*A  POPCNT for vectors of DW/QW */
+XEN_CPUFEATURE(LA57,          6*32+16) /*   5-level paging (57-bit linear address) */
 XEN_CPUFEATURE(RDPID,         6*32+22) /*A  RDPID instruction */
 XEN_CPUFEATURE(BLD,           6*32+24) /*   BusLock Detect (#DB trap) support */
 XEN_CPUFEATURE(CLDEMOTE,      6*32+25) /*A  CLDEMOTE instruction */
 XEN_CPUFEATURE(MOVDIRI,       6*32+27) /*a  MOVDIRI instruction */
 XEN_CPUFEATURE(MOVDIR64B,     6*32+28) /*a  MOVDIR64B instruction */
 XEN_CPUFEATURE(ENQCMD,        6*32+29) /*   ENQCMD{,S} instructions */
+XEN_CPUFEATURE(SGX_LC,        6*32+30) /*   SGX Launch Configuration */
 XEN_CPUFEATURE(PKS,           6*32+31) /*H  Protection Key for Supervisor */
 
 /* AMD-defined CPU features, CPUID level 0x80000007.edx, word 7 */
@@ -264,6 +270,7 @@ XEN_CPUFEATURE(BTC_NO,        8*32+29) /*A  Hardware not vulnerable to Branch Ty
 XEN_CPUFEATURE(IBPB_RET,      8*32+30) /*A  IBPB clears RSB/RAS too. */
 
 /* Intel-defined CPU features, CPUID level 0x00000007:0.edx, word 9 */
+XEN_CPUFEATURE(SGX_KEYS,      9*32+ 1) /*   SGX Attestation Service */
 XEN_CPUFEATURE(AVX512_4VNNIW, 9*32+ 2) /*   Xeon Phi AVX512 Neural Network Instructions */
 XEN_CPUFEATURE(AVX512_4FMAPS, 9*32+ 3) /*   Xeon Phi AVX512 Multiply Accumulation Single Precision */
 XEN_CPUFEATURE(FSRM,          9*32+ 4) /*A  Fast Short REP MOVS */
@@ -276,6 +283,7 @@ XEN_CPUFEATURE(TSX_FORCE_ABORT, 9*32+13) /* MSR_TSX_FORCE_ABORT.RTM_ABORT */
 XEN_CPUFEATURE(SERIALIZE,     9*32+14) /*A  SERIALIZE insn */
 XEN_CPUFEATURE(HYBRID,        9*32+15) /*   Heterogeneous platform */
 XEN_CPUFEATURE(TSXLDTRK,      9*32+16) /*a  TSX load tracking suspend/resume insns */
+XEN_CPUFEATURE(PCONFIG,       9*32+18) /*   PCONFIG instruction */
 XEN_CPUFEATURE(ARCH_LBR,      9*32+19) /*   Architectural Last Branch Record */
 XEN_CPUFEATURE(CET_IBT,       9*32+20) /*   CET - Indirect Branch Tracking */
 XEN_CPUFEATURE(AMX_BF16,      9*32+22) /*   AMX BFloat16 instruction */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Sep 08 02:56:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 08 Sep 2024 02:56:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.792435.1202364 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn86g-0001cW-Fw; Sun, 08 Sep 2024 02:56:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 792435.1202364; Sun, 08 Sep 2024 02:56:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn86g-0001cO-DL; Sun, 08 Sep 2024 02:56:54 +0000
Received: by outflank-mailman (input) for mailman id 792435;
 Sun, 08 Sep 2024 02:56:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn86e-0001cI-UQ
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:56:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn86e-0002kX-Tb
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:56:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn86e-0000KI-Su
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:56:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vS3YrABc3S3x8SI2xUbwWZwmF5Brpx4Rp1aVxV+/EaI=; b=Ak1KvLmqUPsyv5AAXZfha0zwbD
	zgpFRIYhro5+Dq5M8T3N50795YKgpvp2GZH40CojckP4L+HzifL2eBiYato1P+CWK0/gFnde6DUxb
	wiz0u0HRLir3Aatk+oD/A75n2HWzjhDDzVvJa1A6KbUwcnDyoM2Ve4D4n/c7kDd9jneo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/ppc: Adjust ppc64_defconfig
Message-Id: <E1sn86e-0000KI-Su@xenbits.xenproject.org>
Date: Sun, 08 Sep 2024 02:56:52 +0000

commit 8c3ab4ffa953b5ea4724e825ffa7356532814093
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 21 20:05:15 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Sep 6 14:42:18 2024 +0100

    xen/ppc: Adjust ppc64_defconfig
    
    All of CONFIG_SCHED_*, and CONFIG_HYPFS build fine.
    
    Add a stub for share_xen_page_with_guest(), which is all that is necessary to
    make CONFIG_TRACEBUFFER build.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/ppc/configs/ppc64_defconfig | 6 ------
 xen/arch/ppc/stubs.c                 | 6 ++++++
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/xen/arch/ppc/configs/ppc64_defconfig b/xen/arch/ppc/configs/ppc64_defconfig
index 48a053237a..4924d881a2 100644
--- a/xen/arch/ppc/configs/ppc64_defconfig
+++ b/xen/arch/ppc/configs/ppc64_defconfig
@@ -1,9 +1,3 @@
-# CONFIG_SCHED_CREDIT is not set
-# CONFIG_SCHED_RTDS is not set
-# CONFIG_SCHED_NULL is not set
-# CONFIG_SCHED_ARINC653 is not set
-# CONFIG_TRACEBUFFER is not set
-# CONFIG_HYPFS is not set
 # CONFIG_GRANT_TABLE is not set
 # CONFIG_SPECULATIVE_HARDEN_ARRAY is not set
 # CONFIG_MEM_ACCESS is not set
diff --git a/xen/arch/ppc/stubs.c b/xen/arch/ppc/stubs.c
index 50e54d61c0..bdb5f8c66d 100644
--- a/xen/arch/ppc/stubs.c
+++ b/xen/arch/ppc/stubs.c
@@ -322,3 +322,9 @@ void udelay(unsigned long usecs)
 {
     BUG_ON("unimplemented");
 }
+
+void share_xen_page_with_guest(struct page_info *page, struct domain *d,
+                               enum XENSHARE_flags flags)
+{
+    BUG_ON("unimplemented");
+}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Sep 08 02:57:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 08 Sep 2024 02:57:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.792436.1202368 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn86q-0001fI-HJ; Sun, 08 Sep 2024 02:57:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 792436.1202368; Sun, 08 Sep 2024 02:57:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn86q-0001fA-Ek; Sun, 08 Sep 2024 02:57:04 +0000
Received: by outflank-mailman (input) for mailman id 792436;
 Sun, 08 Sep 2024 02:57:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn86p-0001eu-0v
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:57:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn86p-0002kv-0H
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:57:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn86o-0000OW-Vh
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:57:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0cfdfELoYjZvDZziwpsFJFtuu7aeYjMYL7eDt+WCZ4k=; b=S3LfT6jfmGCfcfoKpQuFjKqBXI
	fsF33hVqyGOm9ii5yLrVhiTAzX+6DhbE1d8cHogJ5WIWyvbEnsVHetLFWuabzbxUI3yRqa4UNrHUR
	CTyXl29Q1PBH/+ESPRuiPT9PXU0v7eB00FE5c8phaPAXb/+JBL0aUENxAX4/aPyANPRU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml: Build infrastructure for OCaml dynamic libraries
Message-Id: <E1sn86o-0000OW-Vh@xenbits.xenproject.org>
Date: Sun, 08 Sep 2024 02:57:02 +0000

commit 81d48d857efa451ca3ed46e3d0633f54084b6f5b
Author:     Andrii Sultanov <andrii.sultanov@cloud.com>
AuthorDate: Tue Sep 3 12:44:42 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Sep 6 14:43:39 2024 +0100

    tools/ocaml: Build infrastructure for OCaml dynamic libraries
    
    Dynamic libraries in OCaml require an additional compilation step on top
    of the already specified steps for static libraries. Add an appropriate
    template to Makefile.rules.
    
    Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
---
 tools/ocaml/Makefile.rules | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/tools/ocaml/Makefile.rules b/tools/ocaml/Makefile.rules
index 5d534d8754..b9d4b51f0a 100644
--- a/tools/ocaml/Makefile.rules
+++ b/tools/ocaml/Makefile.rules
@@ -51,12 +51,13 @@ ifneq ($(MAKECMDGOALS),clean)
 endif
 
 clean: $(CLEAN_HOOKS)
-	$(Q)rm -f .*.d *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot *.spot *.spit $(LIBS) $(PROGRAMS) $(GENERATED_FILES) .ocamldep.make META
+	$(Q)rm -f .*.d *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.cmxs *.annot *.spot *.spit $(LIBS) $(PROGRAMS) $(GENERATED_FILES) .ocamldep.make META
 
 distclean: clean
 
 quiet-command = $(if $(V),$1,@printf " %-8s %s\n" "$2" "$3" && $1)
 
+mk-caml-shared-lib-native = $(call quiet-command, $(OCAMLOPT) $(OCAMLOPTFLAGS) -shared -linkall -o $1 $2 $3,MLA,$1)
 mk-caml-lib-native = $(call quiet-command, $(OCAMLOPT) $(OCAMLOPTFLAGS) -a -o $1 $2 $3,MLA,$1)
 mk-caml-lib-bytecode = $(call quiet-command, $(OCAMLC) $(OCAMLCFLAGS) -a -o $1 $2 $3,MLA,$1)
 
@@ -76,6 +77,19 @@ define OCAML_LIBRARY_template
 	$(call mk-caml-lib-stubs,$$@, $$+, $(foreach lib,$(LIBS_$(1)),$(lib)))
 endef
 
+# Dynamically linked OCaml libraries ("plugins" in Dynlink parlance)
+# need to compile an .cmxs file
+define OCAML_DYN_LIBRARY_template
+ $(1).cmxs: $(1).cmxa
+	$(call mk-caml-shared-lib-native,$$@, $(1).cmxa)
+ $(1).cmxa: lib$(1)_stubs.a $(foreach obj,$($(1)_OBJS),$(obj).cmx)
+	$(call mk-caml-lib-native,$$@, -cclib -l$(1)_stubs $(foreach lib,$(LIBS_$(1)),-cclib $(lib)), $(foreach obj,$($(1)_OBJS),$(obj).cmx))
+ $(1)_stubs.a: $(foreach obj,$$($(1)_C_OBJS),$(obj).o)
+	$(call mk-caml-stubs,$$@, $$+)
+ lib$(1)_stubs.a: $(foreach obj,$($(1)_C_OBJS),$(obj).o)
+	$(call mk-caml-lib-stubs,$$@, $$+)
+endef
+
 define OCAML_NOC_LIBRARY_template
  $(1).cmxa: $(foreach obj,$($(1)_OBJS),$(obj).cmx)
 	$(call mk-caml-lib-native,$$@, , $(foreach obj,$($(1)_OBJS),$(obj).cmx))
@@ -98,6 +112,7 @@ endef
 -include .ocamldep.make
 
 $(foreach lib,$(OCAML_LIBRARY),$(eval $(call OCAML_LIBRARY_template,$(lib))))
+$(foreach lib,$(OCAML_DYN_LIBRARY),$(eval $(call OCAML_DYN_LIBRARY_template,$(lib))))
 $(foreach lib,$(OCAML_NOC_LIBRARY),$(eval $(call OCAML_NOC_LIBRARY_template,$(lib))))
 $(foreach p,$(OCAML_PROGRAM),$(eval $(call OCAML_PROGRAM_template,$(p))))
 $(foreach p,$(C_PROGRAM),$(eval $(call C_PROGRAM_template,$(p))))
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Sep 08 02:57:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 08 Sep 2024 02:57:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.792437.1202371 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn870-0001iP-If; Sun, 08 Sep 2024 02:57:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 792437.1202371; Sun, 08 Sep 2024 02:57:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn870-0001iI-G9; Sun, 08 Sep 2024 02:57:14 +0000
Received: by outflank-mailman (input) for mailman id 792437;
 Sun, 08 Sep 2024 02:57:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn86z-0001i0-3j
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:57:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn86z-0002l4-36
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:57:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn86z-0000Pf-2N
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:57:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ud0Fe6tmxjxXGVDiPhUj9DTYJuUXBdCRJl7lVt+Aa8I=; b=YvmVdRtxCpYkTCeJlyNu/enR63
	fBS2rSNg/FFioeGEFusEY1er31GirvOXQMKqCQVjr+5aE9IJyJgPqepH0hszE1E736KflcGFKYiEG
	0AiggAAU9WEYT8tkED/hcENOb2X0+i/bgtR8duDAku3Azc76BfBcvXsl0RLO5/yKCASM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/acpi: Drop acpi_video_flags and use bootsym(video_flags) directly
Message-Id: <E1sn86z-0000Pf-2N@xenbits.xenproject.org>
Date: Sun, 08 Sep 2024 02:57:13 +0000

commit b34d5e3de9df64d26457bb4808c3b809965ee16c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Sep 4 14:48:53 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Sep 6 18:04:41 2024 +0100

    x86/acpi: Drop acpi_video_flags and use bootsym(video_flags) directly
    
    This removes a level of indirection, as well as removing a somewhat misleading
    name; the variable is really "S3 video quirks".
    
    More importantly however it makes it very clear that, right now, parsing the
    cmdline and quirks depends on having already placed the trampoline; a
    dependency which is going to be gnarly to untangle.
    
    That said, fixing the quirk is easy.  The Toshiba Satellite 4030CDT has an
    Intel Celeron 300Mhz CPU (Pentium 2 era) from 1998 when MMX was the headline
    feature, sporting 64M of RAM.  Being a 32-bit processor, it hasn't been able
    to run Xen for about a decade now, so drop the quirk entirely.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
---
 xen/arch/x86/acpi/power.c       |  2 +-
 xen/arch/x86/dmi_scan.c         | 12 ------------
 xen/arch/x86/include/asm/acpi.h |  1 -
 3 files changed, 1 insertion(+), 14 deletions(-)

diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index 610937f42e..557faf312b 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -56,7 +56,7 @@ static int __init cf_check parse_acpi_sleep(const char *s)
         s = ss + 1;
     } while ( *ss );
 
-    acpi_video_flags |= flag;
+    bootsym(video_flags) |= flag;
 
     return rc;
 }
diff --git a/xen/arch/x86/dmi_scan.c b/xen/arch/x86/dmi_scan.c
index 81f80c053a..9257aee2ab 100644
--- a/xen/arch/x86/dmi_scan.c
+++ b/xen/arch/x86/dmi_scan.c
@@ -499,13 +499,6 @@ static int __init cf_check ich10_bios_quirk(const struct dmi_system_id *d)
     return 0;
 }
 
-static __init int cf_check reset_videomode_after_s3(const struct dmi_blacklist *d)
-{
-	/* See wakeup.S */
-	acpi_video_flags |= 2;
-	return 0;
-}
-
 static __init int cf_check dmi_disable_acpi(const struct dmi_blacklist *d)
 { 
 	if (!acpi_force) { 
@@ -546,11 +539,6 @@ static __init int cf_check force_acpi_ht(const struct dmi_blacklist *d)
  
 static const struct dmi_blacklist __initconstrel dmi_blacklist[] = {
 
-	{ reset_videomode_after_s3, "Toshiba Satellite 4030cdt", { /* Reset video mode after returning from ACPI S3 sleep */
-			MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),
-			NO_MATCH, NO_MATCH, NO_MATCH
-			} },
-
 	{ ich10_bios_quirk, "Intel board & BIOS",
 		/*
 		 * BIOS leaves legacy USB emulation enabled while
diff --git a/xen/arch/x86/include/asm/acpi.h b/xen/arch/x86/include/asm/acpi.h
index 3c47b216d0..217819dd61 100644
--- a/xen/arch/x86/include/asm/acpi.h
+++ b/xen/arch/x86/include/asm/acpi.h
@@ -103,7 +103,6 @@ extern unsigned long acpi_wakeup_address;
 extern int8_t acpi_numa;
 
 extern struct acpi_sleep_info acpi_sinfo;
-#define acpi_video_flags bootsym(video_flags)
 struct xenpf_enter_acpi_sleep;
 extern int acpi_enter_sleep(const struct xenpf_enter_acpi_sleep *sleep);
 extern int acpi_enter_state(u32 state);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Sep 08 02:57:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 08 Sep 2024 02:57:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.792438.1202376 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn87A-0001l4-KH; Sun, 08 Sep 2024 02:57:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 792438.1202376; Sun, 08 Sep 2024 02:57:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sn87A-0001kx-HZ; Sun, 08 Sep 2024 02:57:24 +0000
Received: by outflank-mailman (input) for mailman id 792438;
 Sun, 08 Sep 2024 02:57:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn879-0001kl-7C
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:57:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn879-0002lX-6W
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:57:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sn879-0000SD-5n
 for xen-changelog@lists.xenproject.org; Sun, 08 Sep 2024 02:57:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AOQ+A7jl4BGr5UPi4/zZX8q9ImQJQc/knDe+JPeyvdI=; b=B+FoLWPdAJ4Kp7I4MN6Bu5RHuZ
	pjU8lKUwX9HQkNEYzNlVpw/0BbO8+x0MPNDJ599eetPoFHYQfnI4gnfkGfUvI7gr+xpxLthXdf1V0
	/iufkcxZ5k1TMEWVKMSf3Q00iuzw/aTE2MQQLRxySyeLrv033V9QMYRipVLu6A4Bev7g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/trampoline: Move the trampoline declarations out of <asm/config.h>
Message-Id: <E1sn879-0000SD-5n@xenbits.xenproject.org>
Date: Sun, 08 Sep 2024 02:57:23 +0000

commit 65e4bc585c28b50ec76f679e1001a81fea9d690b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Sep 4 13:27:03 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Sep 6 18:04:48 2024 +0100

    x86/trampoline: Move the trampoline declarations out of <asm/config.h>
    
    asm/config.h is included in every translation unit (via xen/config.h), while
    only a handful of functions actually interact with the trampoline.
    
    Move the infrastructure into its own header, and take the opportunity to
    document everything.
    
    Change trampoline_realmode_entry() and wakeup_start() to be nocall functions,
    rather than char arrays.  Also switch to fixed width integers which are less
    likely to diverge from the asm declaration.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/acpi/power.c             |  2 +
 xen/arch/x86/cpu/intel.c              |  2 +
 xen/arch/x86/efi/efi-boot.h           |  1 +
 xen/arch/x86/guest/xen/pvh-boot.c     |  1 +
 xen/arch/x86/include/asm/config.h     | 19 -------
 xen/arch/x86/include/asm/trampoline.h | 95 +++++++++++++++++++++++++++++++++++
 xen/arch/x86/mm.c                     |  1 +
 xen/arch/x86/platform_hypercall.c     |  2 +
 xen/arch/x86/setup.c                  |  1 +
 xen/arch/x86/smpboot.c                |  1 +
 xen/arch/x86/tboot.c                  |  2 +
 xen/arch/x86/x86_64/mm.c              |  2 +
 12 files changed, 110 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index 557faf312b..08a7fc2508 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -31,6 +31,8 @@
 #include <asm/microcode.h>
 #include <asm/prot-key.h>
 #include <asm/spec_ctrl.h>
+#include <asm/trampoline.h>
+
 #include <acpi/cpufreq/cpufreq.h>
 
 uint32_t system_reset_counter = 1;
diff --git a/xen/arch/x86/cpu/intel.c b/xen/arch/x86/cpu/intel.c
index af56e57bd8..807b708217 100644
--- a/xen/arch/x86/cpu/intel.c
+++ b/xen/arch/x86/cpu/intel.c
@@ -12,6 +12,8 @@
 #include <asm/mpspec.h>
 #include <asm/apic.h>
 #include <asm/i387.h>
+#include <asm/trampoline.h>
+
 #include <mach_apic.h>
 
 #include "cpu.h"
diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index f282358435..23e510c77e 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -9,6 +9,7 @@
 #include <asm/microcode.h>
 #include <asm/msr.h>
 #include <asm/setup.h>
+#include <asm/trampoline.h>
 
 static struct file __initdata ucode;
 static multiboot_info_t __initdata mbi = {
diff --git a/xen/arch/x86/guest/xen/pvh-boot.c b/xen/arch/x86/guest/xen/pvh-boot.c
index cc57ab2cbc..e14d7e20e9 100644
--- a/xen/arch/x86/guest/xen/pvh-boot.c
+++ b/xen/arch/x86/guest/xen/pvh-boot.c
@@ -12,6 +12,7 @@
 
 #include <asm/e820.h>
 #include <asm/guest.h>
+#include <asm/trampoline.h>
 
 #include <public/arch-x86/hvm/start_info.h>
 
diff --git a/xen/arch/x86/include/asm/config.h b/xen/arch/x86/include/asm/config.h
index 2a260a2581..1f828bfd52 100644
--- a/xen/arch/x86/include/asm/config.h
+++ b/xen/arch/x86/include/asm/config.h
@@ -83,25 +83,6 @@
 #define LIST_POISON1  ((void *)0x0100100100100100UL)
 #define LIST_POISON2  ((void *)0x0200200200200200UL)
 
-#ifndef __ASSEMBLY__
-extern unsigned long trampoline_phys;
-#define bootsym_phys(sym)                                 \
-    (((unsigned long)&(sym)-(unsigned long)&trampoline_start)+trampoline_phys)
-#define bootsym(sym)                                      \
-    (*((typeof(sym) *)__va(bootsym_phys(sym))))
-
-extern char trampoline_start[], trampoline_end[];
-extern char trampoline_realmode_entry[];
-extern unsigned int trampoline_xen_phys_start;
-extern unsigned char trampoline_cpu_started;
-extern char wakeup_start[];
-
-extern unsigned char video_flags;
-
-extern unsigned short boot_edid_caps;
-extern unsigned char boot_edid_info[128];
-#endif
-
 #include <xen/const.h>
 
 #define PML4_ENTRY_BITS  39
diff --git a/xen/arch/x86/include/asm/trampoline.h b/xen/arch/x86/include/asm/trampoline.h
new file mode 100644
index 0000000000..57a1f85a53
--- /dev/null
+++ b/xen/arch/x86/include/asm/trampoline.h
@@ -0,0 +1,95 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#ifndef X86_ASM_TRAMPOLINE_H
+#define X86_ASM_TRAMPOLINE_H
+
+/*
+ * Data in or about the low memory trampoline.
+ *
+ * x86 systems software typically needs a block of logic below the 1M
+ * boundary, commonly called the trampoline, containing 16-bit logic.  Xen has
+ * a combined trampoline of all necessary 16-bit logic, formed of two parts.
+ *
+ * 1) The permanent trampoline; a single 4k page containing:
+ *
+ *    - The INIT-SIPI-SIPI entrypoint for APs, and
+ *    - The S3 wakeup vector.
+ *
+ *    Both of these are 16-bit entrypoints, responsible for activating paging
+ *    and getting into 64-bit mode.  This requires the permanent trampoline to
+ *    be identity mapped in idle_pg_table[].
+ *
+ *    The SIPI64 spec deprecates the 16-bit AP entrypoint, while S0ix (also
+ *    called Low Power Idle or Connected Standby) deprecates S3.
+ *
+ * 2) The boot trampoline:
+ *
+ *    This is used by the BSP to drop into 16-bit mode, make various BIOS
+ *    calls to obtain E820/EDID/etc.  It follows the permanent and exceeds 4k,
+ *    but is only used in 16-bit and 32-bit unpaged mode so does not need
+ *    mapping in pagetables.
+ *
+ *    When the BIOS calls are complete, execution does join back with the AP
+ *    path, and becomes subject to the same paging requirements.  This path is
+ *    not needed for non-BIOS boots.
+ *
+ * The location of trampoline is not fixed.  The layout of low memory varies
+ * greatly from platform to platform.  Therefore, the trampoline is relocated
+ * manually as part of placement.
+ */
+
+#include <xen/compiler.h>
+#include <xen/types.h>
+
+/*
+ * Start and end of the trampoline section, as linked into Xen.  It is within
+ * the .init section and reclaimed after boot.
+ */
+/* SAF-0-safe */
+extern char trampoline_start[], trampoline_end[];
+
+/*
+ * The physical address of trampoline_start[] in low memory.  It must be below
+ * the 1M boundary (as the trampoline contains 16-bit code), and must be 4k
+ * aligned (SIPI requirement for APs).
+ */
+extern unsigned long trampoline_phys;
+
+/*
+ * Calculate the physical address of a symbol in the trampoline.
+ *
+ * Should only be used on symbols declared later in this header.  Specifying
+ * other symbols will compile but malfunction when used, as will using this
+ * helper before the trampoline is placed.
+ */
+#define bootsym_phys(sym)                                       \
+    (trampoline_phys + ((unsigned long)&(sym) -                 \
+                        (unsigned long)trampoline_start))
+
+/* Given a trampoline symbol, construct a pointer to it in the directmap. */
+#define bootsym(sym) (*((typeof(sym) *)__va(bootsym_phys(sym))))
+
+/* The INIT-SIPI-SIPI entrypoint.  16-bit code. */
+void nocall trampoline_realmode_entry(void);
+
+/* The S3 wakeup vector.  16-bit code. */
+void nocall wakeup_start(void);
+
+/*
+ * A variable in the trampoline, containing Xen's physical address.  Amongst
+ * other things, it is used to find idle_pg_table[] in order to enable paging
+ * and activate 64-bit mode.  This variable needs keeping in sync with
+ * xen_phys_start.
+ */
+extern uint32_t trampoline_xen_phys_start;
+
+/* A semaphore to indicate signs-of-life at the start of the AP boot path. */
+extern uint8_t trampoline_cpu_started;
+
+/* Quirks about video mode-setting on S3 resume. */
+extern uint8_t video_flags;
+
+/* Extended Display Identification Data, gathered from the BIOS. */
+extern uint16_t boot_edid_caps;
+extern uint8_t boot_edid_info[128];
+
+#endif /* X86_ASM_TRAMPOLINE_H */
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 608583a113..c735aaf0e8 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -131,6 +131,7 @@
 #include <asm/guest.h>
 #include <asm/pv/domain.h>
 #include <asm/pv/mm.h>
+#include <asm/trampoline.h>
 
 #ifdef CONFIG_PV
 #include "pv/mm.h"
diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hypercall.c
index 7e32781093..67f851237d 100644
--- a/xen/arch/x86/platform_hypercall.c
+++ b/xen/arch/x86/platform_hypercall.c
@@ -32,6 +32,8 @@
 #include <asm/mtrr.h>
 #include <asm/io_apic.h>
 #include <asm/setup.h>
+#include <asm/trampoline.h>
+
 #include "cpu/mcheck/mce.h"
 #include "cpu/mtrr/mtrr.h"
 #include <xsm/xsm.h>
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index cd69198326..a6e77c9ed9 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -59,6 +59,7 @@
 #include <asm/microcode.h>
 #include <asm/prot-key.h>
 #include <asm/pv/domain.h>
+#include <asm/trampoline.h>
 
 /* opt_nosmp: If true, secondary processors are ignored. */
 static bool __initdata opt_nosmp;
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 0a89f22a39..9e79c1a6d6 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -35,6 +35,7 @@
 #include <asm/spec_ctrl.h>
 #include <asm/time.h>
 #include <asm/tboot.h>
+#include <asm/trampoline.h>
 #include <irq_vectors.h>
 #include <mach_apic.h>
 
diff --git a/xen/arch/x86/tboot.c b/xen/arch/x86/tboot.c
index ba0700d2d5..d5db60d335 100644
--- a/xen/arch/x86/tboot.c
+++ b/xen/arch/x86/tboot.c
@@ -14,6 +14,8 @@
 #include <asm/e820.h>
 #include <asm/tboot.h>
 #include <asm/setup.h>
+#include <asm/trampoline.h>
+
 #include <crypto/vmac.h>
 
 /* tboot=<physical address of shared page> */
diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
index b2a280fba3..0d8e602529 100644
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -37,6 +37,8 @@ EMIT_FILE;
 #include <asm/numa.h>
 #include <asm/mem_paging.h>
 #include <asm/mem_sharing.h>
+#include <asm/trampoline.h>
+
 #include <public/memory.h>
 
 #ifdef CONFIG_PV32
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Sep 09 11:44:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Sep 2024 11:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.794348.1203190 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sncoP-0002oO-N3; Mon, 09 Sep 2024 11:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 794348.1203190; Mon, 09 Sep 2024 11:44:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sncoP-0002oG-KH; Mon, 09 Sep 2024 11:44:05 +0000
Received: by outflank-mailman (input) for mailman id 794348;
 Mon, 09 Sep 2024 11:44:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sncoN-0002oA-Mo
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 11:44:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sncoN-0005GT-KE
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 11:44:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sncoN-000876-IM
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 11:44:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=J3uLvfR/jQry7ugn15KzYk0zQZygkqTx4XVLLWftCug=; b=uCyefctc3y0MJ2zflR0GpERxYE
	6SQmO/DNlNVyIZjwW7nbNlxtBwL+qNiHIfsvNfmXpZHJ4jI3LfzJbYyV9QjOFs4E3VpSUR2yvfSRo
	JINXsHRd2ozEaSYNJIy+iCoBDafZSrS+RiYV5siVznPcXr+ovRbISSk8f6f8W1uEdGU0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/pci: Add hypercall to support reset of pcidev
Message-Id: <E1sncoN-000876-IM@xenbits.xenproject.org>
Date: Mon, 09 Sep 2024 11:44:03 +0000

commit 9a2d7b5bb6e93b8c15ee088a3e9237a1900285b1
Author:     Jiqian Chen <Jiqian.Chen@amd.com>
AuthorDate: Mon Sep 9 13:39:32 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 9 13:39:32 2024 +0200

    xen/pci: Add hypercall to support reset of pcidev
    
    When a device has been reset on dom0 side, the Xen hypervisor
    doesn't get notification, so the cached state in vpci is all
    out of date compare with the real device state.
    
    To solve that problem, add a new hypercall to support the reset
    of pcidev and clear the vpci state of device. So that once the
    state of device is reset on dom0 side, dom0 can call this
    hypercall to notify hypervisor.
    
    The behavior of different reset types may be different in the
    future, so divide them now so that they can be easily modified
    in the future without affecting the hypercall interface.
    
    Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
    Signed-off-by: Huang Rui <ray.huang@amd.com>
    Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/hypercall.c |  1 +
 xen/drivers/pci/physdev.c    | 52 ++++++++++++++++++++++++++++++++++++++++++++
 xen/include/public/physdev.h | 17 +++++++++++++++
 xen/include/xen/vpci.h       |  6 +++++
 4 files changed, 76 insertions(+)

diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c
index 44342e7e7f..f023f7879e 100644
--- a/xen/arch/x86/hvm/hypercall.c
+++ b/xen/arch/x86/hvm/hypercall.c
@@ -84,6 +84,7 @@ long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
     case PHYSDEVOP_pci_mmcfg_reserved:
     case PHYSDEVOP_pci_device_add:
     case PHYSDEVOP_pci_device_remove:
+    case PHYSDEVOP_pci_device_reset:
     case PHYSDEVOP_dbgp_op:
         if ( !is_hardware_domain(currd) )
             return -ENOSYS;
diff --git a/xen/drivers/pci/physdev.c b/xen/drivers/pci/physdev.c
index 42db3e6d13..0161a85e1e 100644
--- a/xen/drivers/pci/physdev.c
+++ b/xen/drivers/pci/physdev.c
@@ -2,6 +2,7 @@
 #include <xen/guest_access.h>
 #include <xen/hypercall.h>
 #include <xen/init.h>
+#include <xen/vpci.h>
 
 #ifndef COMPAT
 typedef long ret_t;
@@ -67,6 +68,57 @@ ret_t pci_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         break;
     }
 
+    case PHYSDEVOP_pci_device_reset:
+    {
+        struct pci_device_reset dev_reset;
+        struct pci_dev *pdev;
+        pci_sbdf_t sbdf;
+
+        ret = -EFAULT;
+        if ( copy_from_guest(&dev_reset, arg, 1) != 0 )
+            break;
+
+        ret = -EINVAL;
+        if ( dev_reset.flags & ~PCI_DEVICE_RESET_MASK )
+            break;
+
+        sbdf = PCI_SBDF(dev_reset.dev.seg,
+                        dev_reset.dev.bus,
+                        dev_reset.dev.devfn);
+
+        ret = xsm_resource_setup_pci(XSM_PRIV, sbdf.sbdf);
+        if ( ret )
+            break;
+
+        pcidevs_lock();
+        pdev = pci_get_pdev(NULL, sbdf);
+        if ( !pdev )
+        {
+            pcidevs_unlock();
+            ret = -ENODEV;
+            break;
+        }
+
+        write_lock(&pdev->domain->pci_lock);
+        pcidevs_unlock();
+        switch ( dev_reset.flags & PCI_DEVICE_RESET_MASK )
+        {
+        case PCI_DEVICE_RESET_COLD:
+        case PCI_DEVICE_RESET_WARM:
+        case PCI_DEVICE_RESET_HOT:
+        case PCI_DEVICE_RESET_FLR:
+            ret = vpci_reset_device(pdev);
+            break;
+
+        default:
+            ret = -EINVAL;
+            break;
+        }
+        write_unlock(&pdev->domain->pci_lock);
+
+        break;
+    }
+
     default:
         ret = -ENOSYS;
         break;
diff --git a/xen/include/public/physdev.h b/xen/include/public/physdev.h
index f0c0d4727c..45e1c18541 100644
--- a/xen/include/public/physdev.h
+++ b/xen/include/public/physdev.h
@@ -296,6 +296,13 @@ DEFINE_XEN_GUEST_HANDLE(physdev_pci_device_add_t);
  */
 #define PHYSDEVOP_prepare_msix          30
 #define PHYSDEVOP_release_msix          31
+/*
+ * Notify the hypervisor that a PCI device has been reset, so that any
+ * internally cached state is regenerated.  Should be called after any
+ * device reset performed by the hardware domain.
+ */
+#define PHYSDEVOP_pci_device_reset      32
+
 struct physdev_pci_device {
     /* IN */
     uint16_t seg;
@@ -305,6 +312,16 @@ struct physdev_pci_device {
 typedef struct physdev_pci_device physdev_pci_device_t;
 DEFINE_XEN_GUEST_HANDLE(physdev_pci_device_t);
 
+struct pci_device_reset {
+    physdev_pci_device_t dev;
+#define PCI_DEVICE_RESET_COLD 0x0
+#define PCI_DEVICE_RESET_WARM 0x1
+#define PCI_DEVICE_RESET_HOT  0x2
+#define PCI_DEVICE_RESET_FLR  0x3
+#define PCI_DEVICE_RESET_MASK 0x3
+    uint32_t flags;
+};
+
 #define PHYSDEVOP_DBGP_RESET_PREPARE    1
 #define PHYSDEVOP_DBGP_RESET_DONE       2
 
diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h
index da8d0f41e6..41e7c3bc27 100644
--- a/xen/include/xen/vpci.h
+++ b/xen/include/xen/vpci.h
@@ -304,6 +304,12 @@ static inline bool __must_check vpci_process_pending(struct vcpu *v)
 }
 #endif
 
+static inline int __must_check vpci_reset_device(struct pci_dev *pdev)
+{
+    vpci_deassign_device(pdev);
+    return vpci_assign_device(pdev);
+}
+
 #endif
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 09 11:44:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Sep 2024 11:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.794349.1203195 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sncoZ-0002q2-Pm; Mon, 09 Sep 2024 11:44:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 794349.1203195; Mon, 09 Sep 2024 11:44:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sncoZ-0002pu-Lh; Mon, 09 Sep 2024 11:44:15 +0000
Received: by outflank-mailman (input) for mailman id 794349;
 Mon, 09 Sep 2024 11:44:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sncoX-0002pk-Ps
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 11:44:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sncoX-0005GZ-OQ
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 11:44:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sncoX-00088K-Me
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 11:44:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cCUtMoPQVbtHSKX/mAAqCKmVH6Q2h6Lnk132Aoks/aM=; b=LynI123A0SFTBYFnnLoN273Xsa
	/Fk6HOhOUl2VQns/etyHnBMJ6sPuATFAz0H4UOikktVA+7Iezy/Mi7BCy6sWEccMPqwX3+u/vLB1k
	MhgW/TVlfU9ZsxcrcLw9R3+2UkyimnY+rD+nJ6N8//gN+S5yWF7jtkUHcZD+kFeop6DE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/HVM: reduce recursion in linear_{read,write}()
Message-Id: <E1sncoX-00088K-Me@xenbits.xenproject.org>
Date: Mon, 09 Sep 2024 11:44:13 +0000

commit 18053054b7583810dd356efc8d7018bbc8720f36
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Sep 9 13:40:47 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 9 13:40:47 2024 +0200

    x86/HVM: reduce recursion in linear_{read,write}()
    
    Let's make explicit what the compiler may or may not do on our behalf:
    The 2nd of the recursive invocations each can fall through rather than
    re-invoking the function. This will save us from adding yet another
    parameter (or more) to the function, just for the recursive invocations.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/emulate.c | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index feb4792cc5..ecf83795fa 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -1146,7 +1146,7 @@ static int linear_read(unsigned long addr, unsigned int bytes, void *p_data,
     pagefault_info_t pfinfo;
     struct hvm_vcpu_io *hvio = &current->arch.hvm.hvm_io;
     unsigned int offset = addr & ~PAGE_MASK;
-    int rc = HVMTRANS_bad_gfn_to_mfn;
+    int rc;
 
     if ( offset + bytes > PAGE_SIZE )
     {
@@ -1154,12 +1154,16 @@ static int linear_read(unsigned long addr, unsigned int bytes, void *p_data,
 
         /* Split the access at the page boundary. */
         rc = linear_read(addr, part1, p_data, pfec, hvmemul_ctxt);
-        if ( rc == X86EMUL_OKAY )
-            rc = linear_read(addr + part1, bytes - part1, p_data + part1,
-                             pfec, hvmemul_ctxt);
-        return rc;
+        if ( rc != X86EMUL_OKAY )
+            return rc;
+
+        addr += part1;
+        bytes -= part1;
+        p_data += part1;
     }
 
+    rc = HVMTRANS_bad_gfn_to_mfn;
+
     /*
      * If there is an MMIO cache entry for the access then we must be re-issuing
      * an access that was previously handled as MMIO. Thus it is imperative that
@@ -1201,7 +1205,7 @@ static int linear_write(unsigned long addr, unsigned int bytes, void *p_data,
     pagefault_info_t pfinfo;
     struct hvm_vcpu_io *hvio = &current->arch.hvm.hvm_io;
     unsigned int offset = addr & ~PAGE_MASK;
-    int rc = HVMTRANS_bad_gfn_to_mfn;
+    int rc;
 
     if ( offset + bytes > PAGE_SIZE )
     {
@@ -1209,12 +1213,16 @@ static int linear_write(unsigned long addr, unsigned int bytes, void *p_data,
 
         /* Split the access at the page boundary. */
         rc = linear_write(addr, part1, p_data, pfec, hvmemul_ctxt);
-        if ( rc == X86EMUL_OKAY )
-            rc = linear_write(addr + part1, bytes - part1, p_data + part1,
-                              pfec, hvmemul_ctxt);
-        return rc;
+        if ( rc != X86EMUL_OKAY )
+            return rc;
+
+        addr += part1;
+        bytes -= part1;
+        p_data += part1;
     }
 
+    rc = HVMTRANS_bad_gfn_to_mfn;
+
     /*
      * If there is an MMIO cache entry for the access then we must be re-issuing
      * an access that was previously handled as MMIO. Thus it is imperative that
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 09 11:44:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Sep 2024 11:44:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.794350.1203198 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sncoj-0002t1-Ps; Mon, 09 Sep 2024 11:44:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 794350.1203198; Mon, 09 Sep 2024 11:44:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sncoj-0002ss-N4; Mon, 09 Sep 2024 11:44:25 +0000
Received: by outflank-mailman (input) for mailman id 794350;
 Mon, 09 Sep 2024 11:44:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sncoh-0002se-T7
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 11:44:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sncoh-0005H0-SN
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 11:44:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sncoh-0008B8-Qc
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 11:44:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NtRmj61sNOVLoxX7emmAVUOytMzXfZ9zybfJuInZBGc=; b=XUHVwNlnn27P6zQUy3ApdTjnAg
	I2lVtuqC/VBmV/bWHy2ZccEN0cEjOvYsGbMf1GyCTtUPIAN4AFt0SS+HmRRlQ2bdPJz3vrVBhXLn/
	MT5JxiPApValHZf0YQ7mb9pR3g7CCBYPao3ukqGqipzkC7wciDUVhfkDYuJ/u1PPGSPQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/time: introduce helper to fetch Xen wallclock when running as a guest
Message-Id: <E1sncoh-0008B8-Qc@xenbits.xenproject.org>
Date: Mon, 09 Sep 2024 11:44:23 +0000

commit 9f16d4e65342668a573e06b7517a4bc3ea8a65f2
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Sep 9 13:41:16 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 9 13:41:16 2024 +0200

    x86/time: introduce helper to fetch Xen wallclock when running as a guest
    
    Move the current code in get_wallclock_time() to fetch the Xen wallclock
    information from the shared page when running as a guest into a separate
    helper.
    
    No functional change intended.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/time.c | 42 +++++++++++++++++++++++++-----------------
 1 file changed, 25 insertions(+), 17 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index a97d784841..3c4cd1b595 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -787,6 +787,30 @@ static struct platform_timesource __initdata_cf_clobber plt_xen_timer =
 };
 #endif
 
+static unsigned long read_xen_wallclock(void)
+{
+#ifdef CONFIG_XEN_GUEST
+    const struct shared_info *sh_info = XEN_shared_info;
+    uint32_t wc_version;
+    uint64_t wc_sec;
+
+    ASSERT(xen_guest);
+
+    do {
+        wc_version = sh_info->wc_version & ~1;
+        smp_rmb();
+
+        wc_sec  = sh_info->wc_sec;
+        smp_rmb();
+    } while ( wc_version != sh_info->wc_version );
+
+    return wc_sec + read_xen_timer() / 1000000000;
+#else
+    ASSERT_UNREACHABLE();
+    return 0;
+#endif
+}
+
 #ifdef CONFIG_HYPERV_GUEST
 /************************************************************
  * HYPER-V REFERENCE TSC
@@ -1497,24 +1521,8 @@ void rtc_guest_write(unsigned int port, unsigned int data)
 
 static unsigned long get_wallclock_time(void)
 {
-#ifdef CONFIG_XEN_GUEST
     if ( xen_guest )
-    {
-        struct shared_info *sh_info = XEN_shared_info;
-        uint32_t wc_version;
-        uint64_t wc_sec;
-
-        do {
-            wc_version = sh_info->wc_version & ~1;
-            smp_rmb();
-
-            wc_sec  = sh_info->wc_sec;
-            smp_rmb();
-        } while ( wc_version != sh_info->wc_version );
-
-        return wc_sec + read_xen_timer() / 1000000000;
-    }
-#endif
+        return read_xen_wallclock();
 
     return get_cmos_time();
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 09 11:44:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Sep 2024 11:44:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.794351.1203202 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sncot-0002vb-R1; Mon, 09 Sep 2024 11:44:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 794351.1203202; Mon, 09 Sep 2024 11:44:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sncot-0002vT-OT; Mon, 09 Sep 2024 11:44:35 +0000
Received: by outflank-mailman (input) for mailman id 794351;
 Mon, 09 Sep 2024 11:44:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sncor-0002vF-W8
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 11:44:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sncor-0005HG-VT
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 11:44:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sncor-0008EH-Ud
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 11:44:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZssL42lAcQoFcCLUrpxJejL9Int6JT2UAJ8GU5KLKo4=; b=VMeGTOsLvun/OKIeeUSPztRtJ+
	ZhEJCztowmrrmJ2UqqtZMAo1ZUe+j+RWLMphGdu9DU1a+qnF1qeMkwhBtBRra/p4QYvN+PW9064kR
	zKrlaE2pWDg246mK/HdaEA4yVwsyB2jxI9mYT8yqVmJLyfnSaxjmGp7NiKBC8JTIlkeM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/time: move CMOS edge detection into read helper
Message-Id: <E1sncor-0008EH-Ud@xenbits.xenproject.org>
Date: Mon, 09 Sep 2024 11:44:33 +0000

commit 91df743c45a5cca0de84e6ebe4651272c9656692
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Sep 9 13:41:48 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 9 13:41:48 2024 +0200

    x86/time: move CMOS edge detection into read helper
    
    Move the logic that ensures the CMOS RTC data is read just after it's been
    updated into the __get_cmos_time() function that does the register reads.  This
    requires returning a boolean from __get_cmos_time() to signal whether the read
    has been successfully performed after an update.
    
    Note that while __get_cmos_time() can be used without waiting for the update
    edge, so far the only caller does wait for it, hence move the code inside of
    the function.
    
    The goal, albeit not accomplished by this patch, is to be able to split the
    probing and the reading of the CMOS RTC data into two separate functions.
    
    No functional change intended.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/time.c | 50 ++++++++++++++++++++++++++------------------------
 1 file changed, 26 insertions(+), 24 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 3c4cd1b595..e55e76bd63 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1246,8 +1246,26 @@ struct rtc_time {
     unsigned int year, mon, day, hour, min, sec;
 };
 
-static void __get_cmos_time(struct rtc_time *rtc)
+static bool __get_cmos_time(struct rtc_time *rtc)
 {
+    s_time_t start, t1, t2;
+    unsigned long flags;
+
+    spin_lock_irqsave(&rtc_lock, flags);
+
+    /* read RTC exactly on falling edge of update flag */
+    start = NOW();
+    do { /* may take up to 1 second... */
+        t1 = NOW() - start;
+    } while ( !(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP) &&
+              t1 <= SECONDS(1) );
+
+    start = NOW();
+    do { /* must try at least 2.228 ms */
+        t2 = NOW() - start;
+    } while ( (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP) &&
+              t2 < MILLISECS(3) );
+
     rtc->sec  = CMOS_READ(RTC_SECONDS);
     rtc->min  = CMOS_READ(RTC_MINUTES);
     rtc->hour = CMOS_READ(RTC_HOURS);
@@ -1265,13 +1283,17 @@ static void __get_cmos_time(struct rtc_time *rtc)
         BCD_TO_BIN(rtc->year);
     }
 
+    spin_unlock_irqrestore(&rtc_lock, flags);
+
     if ( (rtc->year += 1900) < 1970 )
         rtc->year += 100;
+
+    return t1 <= SECONDS(1) && t2 < MILLISECS(3);
 }
 
 static unsigned long get_cmos_time(void)
 {
-    unsigned long res, flags;
+    unsigned long res;
     struct rtc_time rtc;
     unsigned int seconds = 60;
     static bool __read_mostly cmos_rtc_probe;
@@ -1292,29 +1314,9 @@ static unsigned long get_cmos_time(void)
 
     for ( ; ; )
     {
-        s_time_t start, t1, t2;
-
-        spin_lock_irqsave(&rtc_lock, flags);
-
-        /* read RTC exactly on falling edge of update flag */
-        start = NOW();
-        do { /* may take up to 1 second... */
-            t1 = NOW() - start;
-        } while ( !(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP) &&
-                  t1 <= SECONDS(1) );
-
-        start = NOW();
-        do { /* must try at least 2.228 ms */
-            t2 = NOW() - start;
-        } while ( (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP) &&
-                  t2 < MILLISECS(3) );
-
-        __get_cmos_time(&rtc);
-
-        spin_unlock_irqrestore(&rtc_lock, flags);
+        bool success = __get_cmos_time(&rtc);
 
-        if ( likely(!cmos_rtc_probe) ||
-             t1 > SECONDS(1) || t2 >= MILLISECS(3) ||
+        if ( likely(!cmos_rtc_probe) || !success ||
              rtc.sec >= 60 || rtc.min >= 60 || rtc.hour >= 24 ||
              !rtc.day || rtc.day > 31 ||
              !rtc.mon || rtc.mon > 12 )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 09 11:44:46 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Sep 2024 11:44:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.794352.1203206 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sncp3-0002yQ-ST; Mon, 09 Sep 2024 11:44:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 794352.1203206; Mon, 09 Sep 2024 11:44:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sncp3-0002yI-Pu; Mon, 09 Sep 2024 11:44:45 +0000
Received: by outflank-mailman (input) for mailman id 794352;
 Mon, 09 Sep 2024 11:44:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sncp2-0002y6-33
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 11:44:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sncp2-0005HN-2L
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 11:44:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sncp2-0008Gs-1S
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 11:44:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6qqLx8lKyVPA9sm+T3+RtwTZcENgti0lheU4pCjJFmA=; b=jvQGaESIIgx78QZSzltIAWaFyo
	HjX3lEP/PjW6Jw8rh1bjbzQOalhOOUmQkQSKcjaosM9/7eSwhSuGjwnI5rYbhBjCNXYVuHxqP/5MY
	l6vY95Mr3irDHfw1mYXigbfxSb6JBWa8cVjFWKcWdWgjxVNjf7Hq/XeVi31vhJT8rfm0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/time: split CMOS read and probe logic into function
Message-Id: <E1sncp2-0008Gs-1S@xenbits.xenproject.org>
Date: Mon, 09 Sep 2024 11:44:44 +0000

commit 413c25e03e4c6d140b65cd01e8c36c28af6dbed6
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Sep 9 13:42:17 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 9 13:42:17 2024 +0200

    x86/time: split CMOS read and probe logic into function
    
    The current logic to probe for the CMOS RTC is open-coded in get_cmos_time(),
    move it to a separate function that both serves the purpose of testing for the
    CMOS RTC existence and returning its value.
    
    The goal is to be able to split the probing and the reading logic into separate
    helpers, and putting the current logic in a separate function helps simplifying
    further changes.
    
    A transient *rtc_p variable is introduced as a parameter to the function, that
    will be removed by further changes.  Also note that due to the code movement,
    now cmos_rtc_probe will only get cleared on a second call to get_cmos_time(),
    as the newly introduced cmos_probe() function doesn't modify the variable
    anymore.
    
    No functional change intended.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/time.c | 59 +++++++++++++++++++++++++++++++----------------------
 1 file changed, 35 insertions(+), 24 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index e55e76bd63..f37300946e 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1291,45 +1291,32 @@ static bool __get_cmos_time(struct rtc_time *rtc)
     return t1 <= SECONDS(1) && t2 < MILLISECS(3);
 }
 
-static unsigned long get_cmos_time(void)
+static bool cmos_probe(struct rtc_time *rtc_p, bool cmos_rtc_probe)
 {
-    unsigned long res;
-    struct rtc_time rtc;
     unsigned int seconds = 60;
-    static bool __read_mostly cmos_rtc_probe;
-    boolean_param("cmos-rtc-probe", cmos_rtc_probe);
-
-    if ( efi_enabled(EFI_RS) )
-    {
-        res = efi_get_time();
-        if ( res )
-            return res;
-    }
-
-    if ( likely(!(acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_CMOS_RTC)) )
-        cmos_rtc_probe = false;
-    else if ( system_state < SYS_STATE_smp_boot && !cmos_rtc_probe )
-        panic("System with no CMOS RTC advertised must be booted from EFI"
-              " (or with command line option \"cmos-rtc-probe\")\n");
 
     for ( ; ; )
     {
-        bool success = __get_cmos_time(&rtc);
+        bool success = __get_cmos_time(rtc_p);
+        struct rtc_time rtc = *rtc_p;
 
-        if ( likely(!cmos_rtc_probe) || !success ||
+        if ( likely(!cmos_rtc_probe) )
+            return true;
+
+        if ( !success ||
              rtc.sec >= 60 || rtc.min >= 60 || rtc.hour >= 24 ||
              !rtc.day || rtc.day > 31 ||
              !rtc.mon || rtc.mon > 12 )
-            break;
+            return false;
 
         if ( seconds < 60 )
         {
             if ( rtc.sec != seconds )
             {
-                cmos_rtc_probe = false;
                 acpi_gbl_FADT.boot_flags &= ~ACPI_FADT_NO_CMOS_RTC;
+                return true;
             }
-            break;
+            return false;
         }
 
         process_pending_softirqs();
@@ -1337,7 +1324,31 @@ static unsigned long get_cmos_time(void)
         seconds = rtc.sec;
     }
 
-    if ( unlikely(cmos_rtc_probe) )
+    ASSERT_UNREACHABLE();
+    return false;
+}
+
+static unsigned long get_cmos_time(void)
+{
+    unsigned long res;
+    struct rtc_time rtc;
+    static bool __read_mostly cmos_rtc_probe;
+    boolean_param("cmos-rtc-probe", cmos_rtc_probe);
+
+    if ( efi_enabled(EFI_RS) )
+    {
+        res = efi_get_time();
+        if ( res )
+            return res;
+    }
+
+    if ( likely(!(acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_CMOS_RTC)) )
+        cmos_rtc_probe = false;
+    else if ( system_state < SYS_STATE_smp_boot && !cmos_rtc_probe )
+        panic("System with no CMOS RTC advertised must be booted from EFI"
+              " (or with command line option \"cmos-rtc-probe\")\n");
+
+    if ( !cmos_probe(&rtc, cmos_rtc_probe) )
         panic("No CMOS RTC found - system must be booted from EFI\n");
 
     return mktime(rtc.year, rtc.mon, rtc.day, rtc.hour, rtc.min, rtc.sec);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 09 11:44:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Sep 2024 11:44:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.794353.1203210 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sncpD-00030x-UK; Mon, 09 Sep 2024 11:44:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 794353.1203210; Mon, 09 Sep 2024 11:44:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sncpD-00030p-RO; Mon, 09 Sep 2024 11:44:55 +0000
Received: by outflank-mailman (input) for mailman id 794353;
 Mon, 09 Sep 2024 11:44:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sncpC-00030h-5z
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 11:44:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sncpC-0005HU-5F
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 11:44:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sncpC-0008I3-4T
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 11:44:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BwOpYvGoQV5ccnZA+QZQs9p5f61eZ2meUrjChR9fuuY=; b=7Om3YPibFSAF3w7CU0leorXw+K
	J7AVw8AzYI0OsRcGLX7TDyHF5rIBDeS7c6vlbah9mFe5Z87Yr0rdxjCYKEnbrbP+uDWE8/Nk0cO/c
	RqFcx7pqL294TUGrnBwj3ckdJQkWlMX4Aic9zSvysOif9/fipeFdZHPjhksF/cNXi2qo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Avoid usage of global in reloc.c
Message-Id: <E1sncpC-0008I3-4T@xenbits.xenproject.org>
Date: Mon, 09 Sep 2024 11:44:54 +0000

commit 71df9234431ec12ae8d658b29fd106e50a7e41a8
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Mon Sep 9 13:42:38 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 9 13:42:38 2024 +0200

    x86/boot: Avoid usage of global in reloc.c
    
    All code and data from this file will go into a text section
    which we want to not be writeable.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/boot/reloc.c | 67 ++++++++++++++++++++++++++---------------------
 1 file changed, 37 insertions(+), 30 deletions(-)

diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c
index 201e38d544..8c58affcd9 100644
--- a/xen/arch/x86/boot/reloc.c
+++ b/xen/arch/x86/boot/reloc.c
@@ -72,11 +72,18 @@ struct vesa_mode_info {
 #define get_mb2_data(tag, type, member)   (((const multiboot2_tag_##type##_t *)(tag))->member)
 #define get_mb2_string(tag, type, member) ((uint32_t)get_mb2_data(tag, type, member))
 
-static uint32_t alloc;
+typedef struct memctx {
+    /*
+     * Simple bump allocator.
+     *
+     * It starts from the base of the trampoline and allocates downwards.
+     */
+    uint32_t ptr;
+} memctx;
 
-static uint32_t alloc_mem(uint32_t bytes)
+static uint32_t alloc_mem(uint32_t bytes, memctx *ctx)
 {
-    return alloc -= ROUNDUP(bytes, 16);
+    return ctx->ptr -= ROUNDUP(bytes, 16);
 }
 
 static void zero_mem(uint32_t s, uint32_t bytes)
@@ -85,11 +92,11 @@ static void zero_mem(uint32_t s, uint32_t bytes)
         *(char *)s++ = 0;
 }
 
-static uint32_t copy_mem(uint32_t src, uint32_t bytes)
+static uint32_t copy_mem(uint32_t src, uint32_t bytes, memctx *ctx)
 {
     uint32_t dst, dst_ret;
 
-    dst = alloc_mem(bytes);
+    dst = alloc_mem(bytes, ctx);
     dst_ret = dst;
 
     while ( bytes-- )
@@ -98,7 +105,7 @@ static uint32_t copy_mem(uint32_t src, uint32_t bytes)
     return dst_ret;
 }
 
-static uint32_t copy_string(uint32_t src)
+static uint32_t copy_string(uint32_t src, memctx *ctx)
 {
     uint32_t p;
 
@@ -108,17 +115,17 @@ static uint32_t copy_string(uint32_t src)
     for ( p = src; *(char *)p != '\0'; p++ )
         continue;
 
-    return copy_mem(src, p - src + 1);
+    return copy_mem(src, p - src + 1, ctx);
 }
 
-static struct hvm_start_info *pvh_info_reloc(uint32_t in)
+static struct hvm_start_info *pvh_info_reloc(uint32_t in, memctx *ctx)
 {
     struct hvm_start_info *out;
 
-    out = _p(copy_mem(in, sizeof(*out)));
+    out = _p(copy_mem(in, sizeof(*out), ctx));
 
     if ( out->cmdline_paddr )
-        out->cmdline_paddr = copy_string(out->cmdline_paddr);
+        out->cmdline_paddr = copy_string(out->cmdline_paddr, ctx);
 
     if ( out->nr_modules )
     {
@@ -127,51 +134,51 @@ static struct hvm_start_info *pvh_info_reloc(uint32_t in)
 
         out->modlist_paddr =
             copy_mem(out->modlist_paddr,
-                     out->nr_modules * sizeof(struct hvm_modlist_entry));
+                     out->nr_modules * sizeof(struct hvm_modlist_entry), ctx);
 
         mods = _p(out->modlist_paddr);
 
         for ( i = 0; i < out->nr_modules; i++ )
         {
             if ( mods[i].cmdline_paddr )
-                mods[i].cmdline_paddr = copy_string(mods[i].cmdline_paddr);
+                mods[i].cmdline_paddr = copy_string(mods[i].cmdline_paddr, ctx);
         }
     }
 
     return out;
 }
 
-static multiboot_info_t *mbi_reloc(uint32_t mbi_in)
+static multiboot_info_t *mbi_reloc(uint32_t mbi_in, memctx *ctx)
 {
     int i;
     multiboot_info_t *mbi_out;
 
-    mbi_out = _p(copy_mem(mbi_in, sizeof(*mbi_out)));
+    mbi_out = _p(copy_mem(mbi_in, sizeof(*mbi_out), ctx));
 
     if ( mbi_out->flags & MBI_CMDLINE )
-        mbi_out->cmdline = copy_string(mbi_out->cmdline);
+        mbi_out->cmdline = copy_string(mbi_out->cmdline, ctx);
 
     if ( mbi_out->flags & MBI_MODULES )
     {
         module_t *mods;
 
         mbi_out->mods_addr = copy_mem(mbi_out->mods_addr,
-                                      mbi_out->mods_count * sizeof(module_t));
+                                      mbi_out->mods_count * sizeof(module_t), ctx);
 
         mods = _p(mbi_out->mods_addr);
 
         for ( i = 0; i < mbi_out->mods_count; i++ )
         {
             if ( mods[i].string )
-                mods[i].string = copy_string(mods[i].string);
+                mods[i].string = copy_string(mods[i].string, ctx);
         }
     }
 
     if ( mbi_out->flags & MBI_MEMMAP )
-        mbi_out->mmap_addr = copy_mem(mbi_out->mmap_addr, mbi_out->mmap_length);
+        mbi_out->mmap_addr = copy_mem(mbi_out->mmap_addr, mbi_out->mmap_length, ctx);
 
     if ( mbi_out->flags & MBI_LOADERNAME )
-        mbi_out->boot_loader_name = copy_string(mbi_out->boot_loader_name);
+        mbi_out->boot_loader_name = copy_string(mbi_out->boot_loader_name, ctx);
 
     /* Mask features we don't understand or don't relocate. */
     mbi_out->flags &= (MBI_MEMLIMITS |
@@ -183,7 +190,7 @@ static multiboot_info_t *mbi_reloc(uint32_t mbi_in)
     return mbi_out;
 }
 
-static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
+static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out, memctx *ctx)
 {
     const multiboot2_fixed_t *mbi_fix = _p(mbi_in);
     const multiboot2_memory_map_t *mmap_src;
@@ -197,7 +204,7 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
     uint32_t ptr;
     unsigned int i, mod_idx = 0;
 
-    ptr = alloc_mem(sizeof(*mbi_out));
+    ptr = alloc_mem(sizeof(*mbi_out), ctx);
     mbi_out = _p(ptr);
     zero_mem(ptr, sizeof(*mbi_out));
 
@@ -222,7 +229,7 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
          * __start_xen() may put Xen image placement into it.
          */
         mbi_out->mods_addr = alloc_mem((mbi_out->mods_count + 1) *
-                                       sizeof(*mbi_out_mods));
+                                       sizeof(*mbi_out_mods), ctx);
         mbi_out_mods = _p(mbi_out->mods_addr);
     }
 
@@ -238,13 +245,13 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
         case MULTIBOOT2_TAG_TYPE_BOOT_LOADER_NAME:
             mbi_out->flags |= MBI_LOADERNAME;
             ptr = get_mb2_string(tag, string, string);
-            mbi_out->boot_loader_name = copy_string(ptr);
+            mbi_out->boot_loader_name = copy_string(ptr, ctx);
             break;
 
         case MULTIBOOT2_TAG_TYPE_CMDLINE:
             mbi_out->flags |= MBI_CMDLINE;
             ptr = get_mb2_string(tag, string, string);
-            mbi_out->cmdline = copy_string(ptr);
+            mbi_out->cmdline = copy_string(ptr, ctx);
             break;
 
         case MULTIBOOT2_TAG_TYPE_BASIC_MEMINFO:
@@ -263,7 +270,7 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
             mbi_out->mmap_length /= get_mb2_data(tag, mmap, entry_size);
             mbi_out->mmap_length *= sizeof(*mmap_dst);
 
-            mbi_out->mmap_addr = alloc_mem(mbi_out->mmap_length);
+            mbi_out->mmap_addr = alloc_mem(mbi_out->mmap_length, ctx);
 
             mmap_src = get_mb2_data(tag, mmap, entries);
             mmap_dst = _p(mbi_out->mmap_addr);
@@ -290,7 +297,7 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
             mbi_out_mods[mod_idx].mod_start = get_mb2_data(tag, module, mod_start);
             mbi_out_mods[mod_idx].mod_end = get_mb2_data(tag, module, mod_end);
             ptr = get_mb2_string(tag, module, cmdline);
-            mbi_out_mods[mod_idx].string = copy_string(ptr);
+            mbi_out_mods[mod_idx].string = copy_string(ptr, ctx);
             mbi_out_mods[mod_idx].reserved = 0;
             ++mod_idx;
             break;
@@ -356,19 +363,19 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
 void *reloc(uint32_t magic, uint32_t in, uint32_t trampoline,
             uint32_t video_info)
 {
-    alloc = trampoline;
+    memctx ctx = { trampoline };
 
     switch ( magic )
     {
     case MULTIBOOT_BOOTLOADER_MAGIC:
-        return mbi_reloc(in);
+        return mbi_reloc(in, &ctx);
 
     case MULTIBOOT2_BOOTLOADER_MAGIC:
-        return mbi2_reloc(in, video_info);
+        return mbi2_reloc(in, video_info, &ctx);
 
     case XEN_HVM_START_MAGIC_VALUE:
         if ( IS_ENABLED(CONFIG_PVH_GUEST) )
-            return pvh_info_reloc(in);
+            return pvh_info_reloc(in, &ctx);
         /* Fallthrough */
 
     default:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 09 11:45:06 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Sep 2024 11:45:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.794354.1203214 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sncpO-000348-1C; Mon, 09 Sep 2024 11:45:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 794354.1203214; Mon, 09 Sep 2024 11:45:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sncpN-000341-Uq; Mon, 09 Sep 2024 11:45:05 +0000
Received: by outflank-mailman (input) for mailman id 794354;
 Mon, 09 Sep 2024 11:45:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sncpM-00033o-8h
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 11:45:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sncpM-0005IE-7u
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 11:45:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sncpM-0008JL-7I
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 11:45:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=94U/GjJoId/BOJKY+hImd3H1u9cYmV93ceQsYEspwWE=; b=yoVBS3jKwQomB/wLNYBvY3uxpT
	alfJqr2jL4vvrbp6hemo5FnwC3BtYYDmh0+4LdgUW0kS4dJ2RSAU0vwkZTPHVUpnLamCYxY7vmIoD
	ub/Rb/eoNFsnSybxgzyCtQ4x49aMe4VO4LLC5Oahd4TAbHWo4yQj8zfVyKmRoCalQxdg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: fix type mismatch in read_atomic_size()
Message-Id: <E1sncpM-0008JL-7I@xenbits.xenproject.org>
Date: Mon, 09 Sep 2024 11:45:04 +0000

commit 4e56d0a9f9c5612c724299136c8ef55bc436419b
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Mon Sep 9 13:42:57 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 9 13:42:57 2024 +0200

    xen/riscv: fix type mismatch in read_atomic_size()
    
    Correct a typo in read_atomic_size() where a 64-bit result
    was incorrectly cast to a `uint32_t` instead of `uint64_t`
    in the case of 8-byte reads.
    
    Fixes: 3cd46d4ec8b9 ("xen/riscv: introduce atomic.h")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/atomic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/riscv/include/asm/atomic.h b/xen/arch/riscv/include/asm/atomic.h
index 31b91a79c8..41f03b2e0c 100644
--- a/xen/arch/riscv/include/asm/atomic.h
+++ b/xen/arch/riscv/include/asm/atomic.h
@@ -45,7 +45,7 @@ static always_inline void read_atomic_size(const volatile void *p,
     case 2: *(uint16_t *)res = readw(p); break;
     case 4: *(uint32_t *)res = readl(p); break;
 #ifndef CONFIG_RISCV_32
-    case 8: *(uint32_t *)res = readq(p); break;
+    case 8: *(uint64_t *)res = readq(p); break;
 #endif
     default: __bad_atomic_size(); break;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 09 15:22:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Sep 2024 15:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.794681.1203703 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngDN-0003tR-Jd; Mon, 09 Sep 2024 15:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 794681.1203703; Mon, 09 Sep 2024 15:22:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngDN-0003tJ-HB; Mon, 09 Sep 2024 15:22:05 +0000
Received: by outflank-mailman (input) for mailman id 794681;
 Mon, 09 Sep 2024 15:22:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngDM-0003t7-AZ
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:22:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngDM-00012p-8Z
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngDM-0000VO-7B
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:22:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UGlwHd3+gCFmTND/6kbwUhiIo862vQZgPZ5QmjIldjc=; b=5vA8gl6iXO7fBMXMdLhoB9jt0E
	YHS89hkSGXkqMYSbWTgVyubBgL0Jm1cRPPb8o+l6iLCRH3ybWMOOmkMvCYukTFz7unP0vH5DnGO/G
	sZ85mPWDGAaYRBg3lvIRoa7FZCC9KAS6aurJF9Fr3zJlRQE4a3pX3przMzHiKu2xyHvA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/bitops: Reinstate the please tidy message
Message-Id: <E1sngDM-0000VO-7B@xenbits.xenproject.org>
Date: Mon, 09 Sep 2024 15:22:04 +0000

commit f7dc0862945155dd05814c46d7741a23319dae01
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 22 16:33:56 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    xen/bitops: Reinstate the please tidy message
    
    Recent additions have undone prior tidying at the top of the file.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/include/xen/bitops.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
index ed6b9ccc72..6f8e36f1c7 100644
--- a/xen/include/xen/bitops.h
+++ b/xen/include/xen/bitops.h
@@ -210,6 +210,8 @@ static always_inline bool test_bit(int nr, const volatile void *addr)
     test_bit(nr, addr);                                 \
 })
 
+/* --------------------- Please tidy above here --------------------- */
+
 static always_inline attr_const unsigned int ffs(unsigned int x)
 {
     if ( __builtin_constant_p(x) )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 09 15:22:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Sep 2024 15:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.794682.1203708 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngDX-0003vH-L5; Mon, 09 Sep 2024 15:22:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 794682.1203708; Mon, 09 Sep 2024 15:22:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngDX-0003v9-IX; Mon, 09 Sep 2024 15:22:15 +0000
Received: by outflank-mailman (input) for mailman id 794682;
 Mon, 09 Sep 2024 15:22:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngDW-0003v1-DG
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:22:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngDW-000132-Bg
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:22:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngDW-0000WA-Ap
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:22:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0iu+1S0W/Ogtw3Juj8uRG/xlop8fmm+3KZSvc2+Hyek=; b=wFKky+RbgOxubIFmuwg7MrMKMA
	P3Aw1lV1RPT2BzSqqmyujoifUoQRYg9nET/Eub0JIysEsZmw72NeW2stu7JUqo0Rw9op/uVE4+E8u
	yZbYfFfKhhZApQPrLkM9w0YWnROdKHg8RxDfiVl72zoBvQ7EA8GOHUXhx09p119zH0qo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/bitops: Drop the remnants of hweight{8,16}()
Message-Id: <E1sngDW-0000WA-Ap@xenbits.xenproject.org>
Date: Mon, 09 Sep 2024 15:22:14 +0000

commit e8f0cc77dc3ce82d61afddfd889e3e1773a5192a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 22 18:13:57 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    xen/bitops: Drop the remnants of hweight{8,16}()
    
    They are no more.  No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/bitops.h |  2 --
 xen/arch/ppc/include/asm/bitops.h |  2 --
 xen/arch/x86/include/asm/bitops.h |  2 --
 xen/include/xen/bitops.h          | 17 -----------------
 4 files changed, 23 deletions(-)

diff --git a/xen/arch/arm/include/asm/bitops.h b/xen/arch/arm/include/asm/bitops.h
index 3c023103f7..91cd167b6b 100644
--- a/xen/arch/arm/include/asm/bitops.h
+++ b/xen/arch/arm/include/asm/bitops.h
@@ -86,8 +86,6 @@ bool clear_mask16_timeout(uint16_t mask, volatile void *p,
  */
 #define hweight64(x) generic_hweight64(x)
 #define hweight32(x) generic_hweight32(x)
-#define hweight16(x) generic_hweight16(x)
-#define hweight8(x) generic_hweight8(x)
 
 #endif /* _ARM_BITOPS_H */
 /*
diff --git a/xen/arch/ppc/include/asm/bitops.h b/xen/arch/ppc/include/asm/bitops.h
index 6e4e112b8b..64512e9495 100644
--- a/xen/arch/ppc/include/asm/bitops.h
+++ b/xen/arch/ppc/include/asm/bitops.h
@@ -134,7 +134,5 @@ static inline int test_and_set_bit(unsigned int nr, volatile void *addr)
  */
 #define hweight64(x) __builtin_popcountll(x)
 #define hweight32(x) __builtin_popcount(x)
-#define hweight16(x) __builtin_popcount((uint16_t)(x))
-#define hweight8(x)  __builtin_popcount((uint8_t)(x))
 
 #endif /* _ASM_PPC_BITOPS_H */
diff --git a/xen/arch/x86/include/asm/bitops.h b/xen/arch/x86/include/asm/bitops.h
index 8c0403405a..4c5b21907a 100644
--- a/xen/arch/x86/include/asm/bitops.h
+++ b/xen/arch/x86/include/asm/bitops.h
@@ -483,7 +483,5 @@ static always_inline unsigned int arch_flsl(unsigned long x)
  */
 #define hweight64(x) generic_hweight64(x)
 #define hweight32(x) generic_hweight32(x)
-#define hweight16(x) generic_hweight16(x)
-#define hweight8(x) generic_hweight8(x)
 
 #endif /* _X86_BITOPS_H */
diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
index 6f8e36f1c7..58c600155f 100644
--- a/xen/include/xen/bitops.h
+++ b/xen/include/xen/bitops.h
@@ -413,23 +413,6 @@ static inline unsigned int generic_hweight32(unsigned int w)
     return (w + (w >> 16)) & 0xff;
 }
 
-static inline unsigned int generic_hweight16(unsigned int w)
-{
-    w -= ((w >> 1) & 0x5555);
-    w =  (w & 0x3333) + ((w >> 2) & 0x3333);
-    w =  (w + (w >> 4)) & 0x0f0f;
-
-    return (w + (w >> 8)) & 0xff;
-}
-
-static inline unsigned int generic_hweight8(unsigned int w)
-{
-    w -= ((w >> 1) & 0x55);
-    w =  (w & 0x33) + ((w >> 2) & 0x33);
-
-    return (w + (w >> 4)) & 0x0f;
-}
-
 static inline unsigned int generic_hweight64(uint64_t w)
 {
     if ( BITS_PER_LONG < 64 )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 09 15:22:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Sep 2024 15:22:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.794683.1203712 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngDh-0003yL-Mv; Mon, 09 Sep 2024 15:22:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 794683.1203712; Mon, 09 Sep 2024 15:22:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngDh-0003yD-Ju; Mon, 09 Sep 2024 15:22:25 +0000
Received: by outflank-mailman (input) for mailman id 794683;
 Mon, 09 Sep 2024 15:22:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngDg-0003xq-FW
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:22:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngDg-000155-Eb
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:22:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngDg-0000Wo-Dq
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:22:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LSSSxe/GZUB3+Bk0z5fXYIYL79spwRfyA71tV6JydHA=; b=osu0bpfe964t9AGQJb9awdIJ+c
	XmBFSXxs02F8ZZSH5VFxLTox41DpnU6PqY5pR5jyNoTYLP2BOmGJtfJcyqtZ8A8bAnTgjMIz7rud+
	kvgrarb8OlItkym8ujOn5qjShyuvxWWN57yNZgQiQ16v+y1Xo1GE/tYDMKN+o8P3+1YQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/bitops: Implement hweight32() in terms of hweightl()
Message-Id: <E1sngDg-0000Wo-Dq@xenbits.xenproject.org>
Date: Mon, 09 Sep 2024 15:22:24 +0000

commit f20504e1cf78c90a50335f080f6393af02b8372f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 22 21:40:11 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    xen/bitops: Implement hweight32() in terms of hweightl()
    
    ... and drop generic_hweight32().
    
    As noted previously, the only two users of hweight32() are in __init paths.
    
    The int-optimised form of generic_hweight() is only two instructions shorter
    than the long-optimised form, and even then only on architectures which lack
    fast multiplication, so there's no point providing an int-optimised form.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/bitops.h | 1 -
 xen/arch/ppc/include/asm/bitops.h | 1 -
 xen/arch/x86/include/asm/bitops.h | 1 -
 xen/include/xen/bitops.h          | 5 +++++
 4 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/include/asm/bitops.h b/xen/arch/arm/include/asm/bitops.h
index 91cd167b6b..b28c25b3d5 100644
--- a/xen/arch/arm/include/asm/bitops.h
+++ b/xen/arch/arm/include/asm/bitops.h
@@ -85,7 +85,6 @@ bool clear_mask16_timeout(uint16_t mask, volatile void *p,
  * The Hamming Weight of a number is the total number of bits set in it.
  */
 #define hweight64(x) generic_hweight64(x)
-#define hweight32(x) generic_hweight32(x)
 
 #endif /* _ARM_BITOPS_H */
 /*
diff --git a/xen/arch/ppc/include/asm/bitops.h b/xen/arch/ppc/include/asm/bitops.h
index 64512e9495..f488a7c034 100644
--- a/xen/arch/ppc/include/asm/bitops.h
+++ b/xen/arch/ppc/include/asm/bitops.h
@@ -133,6 +133,5 @@ static inline int test_and_set_bit(unsigned int nr, volatile void *addr)
  * The Hamming Weight of a number is the total number of bits set in it.
  */
 #define hweight64(x) __builtin_popcountll(x)
-#define hweight32(x) __builtin_popcount(x)
 
 #endif /* _ASM_PPC_BITOPS_H */
diff --git a/xen/arch/x86/include/asm/bitops.h b/xen/arch/x86/include/asm/bitops.h
index 4c5b21907a..507b043b8a 100644
--- a/xen/arch/x86/include/asm/bitops.h
+++ b/xen/arch/x86/include/asm/bitops.h
@@ -482,6 +482,5 @@ static always_inline unsigned int arch_flsl(unsigned long x)
  * The Hamming Weight of a number is the total number of bits set in it.
  */
 #define hweight64(x) generic_hweight64(x)
-#define hweight32(x) generic_hweight32(x)
 
 #endif /* _X86_BITOPS_H */
diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
index 58c600155f..a462c30651 100644
--- a/xen/include/xen/bitops.h
+++ b/xen/include/xen/bitops.h
@@ -326,6 +326,11 @@ static always_inline attr_const unsigned int hweightl(unsigned long x)
 #endif
 }
 
+static always_inline attr_const unsigned int hweight32(uint32_t x)
+{
+    return hweightl(x);
+}
+
 /* --------------------- Please tidy below here --------------------- */
 
 #ifndef find_next_bit
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 09 15:22:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Sep 2024 15:22:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.794684.1203716 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngDr-00040z-Ns; Mon, 09 Sep 2024 15:22:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 794684.1203716; Mon, 09 Sep 2024 15:22:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngDr-00040r-LO; Mon, 09 Sep 2024 15:22:35 +0000
Received: by outflank-mailman (input) for mailman id 794684;
 Mon, 09 Sep 2024 15:22:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngDq-00040g-IU
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:22:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngDq-00015E-Hk
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:22:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngDq-0000Ym-Gn
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:22:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mvVbDcP4yh7zipqibVTkBzTIJz0363zPdggIlE2Fr9o=; b=Sv64HMt3IXR/7IEbY4U9KsU6CH
	rAWdufp0d0d6L3b4D+zs0seM7P04osI+2+0s7l3r/7TKFfOWkdd6TxXKMfRAOWroBXjbVfLRsytBn
	yE/ESW504SEDx45x9JdgDBNETImMhovQoMrldIeiFiml4XHUspBWBnVmQ0HMdb0CE4Ls=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/bitops: Implement hweight64() in terms of hweight{l,32}()
Message-Id: <E1sngDq-0000Ym-Gn@xenbits.xenproject.org>
Date: Mon, 09 Sep 2024 15:22:34 +0000

commit d177793f70b52455264bcae94912a818a362aa49
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 22 21:39:59 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    xen/bitops: Implement hweight64() in terms of hweight{l,32}()
    
    ... and drop generic_hweight{32,64}().
    
    This is identical on all architectures except ARM32.  Add one extra SELF_TEST
    to check that hweight64() works when the input is split in half.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/bitops.h |  8 -------
 xen/arch/ppc/include/asm/bitops.h |  8 -------
 xen/arch/x86/include/asm/bitops.h |  8 -------
 xen/common/bitops.c               |  3 +++
 xen/include/xen/bitops.h          | 45 +++++++--------------------------------
 5 files changed, 11 insertions(+), 61 deletions(-)

diff --git a/xen/arch/arm/include/asm/bitops.h b/xen/arch/arm/include/asm/bitops.h
index b28c25b3d5..f163d9bb45 100644
--- a/xen/arch/arm/include/asm/bitops.h
+++ b/xen/arch/arm/include/asm/bitops.h
@@ -78,14 +78,6 @@ bool clear_mask16_timeout(uint16_t mask, volatile void *p,
 #define arch_fls(x)  ((x) ? 32 - __builtin_clz(x) : 0)
 #define arch_flsl(x) ((x) ? BITS_PER_LONG - __builtin_clzl(x) : 0)
 
-/**
- * hweightN - returns the hamming weight of a N-bit word
- * @x: the word to weigh
- *
- * The Hamming Weight of a number is the total number of bits set in it.
- */
-#define hweight64(x) generic_hweight64(x)
-
 #endif /* _ARM_BITOPS_H */
 /*
  * Local variables:
diff --git a/xen/arch/ppc/include/asm/bitops.h b/xen/arch/ppc/include/asm/bitops.h
index f488a7c034..c942e9432e 100644
--- a/xen/arch/ppc/include/asm/bitops.h
+++ b/xen/arch/ppc/include/asm/bitops.h
@@ -126,12 +126,4 @@ static inline int test_and_set_bit(unsigned int nr, volatile void *addr)
 
 #define arch_hweightl(x) __builtin_popcountl(x)
 
-/**
- * hweightN - returns the hamming weight of a N-bit word
- * @x: the word to weigh
- *
- * The Hamming Weight of a number is the total number of bits set in it.
- */
-#define hweight64(x) __builtin_popcountll(x)
-
 #endif /* _ASM_PPC_BITOPS_H */
diff --git a/xen/arch/x86/include/asm/bitops.h b/xen/arch/x86/include/asm/bitops.h
index 507b043b8a..642d8e58b2 100644
--- a/xen/arch/x86/include/asm/bitops.h
+++ b/xen/arch/x86/include/asm/bitops.h
@@ -475,12 +475,4 @@ static always_inline unsigned int arch_flsl(unsigned long x)
 }
 #define arch_flsl arch_flsl
 
-/**
- * hweightN - returns the hamming weight of a N-bit word
- * @x: the word to weigh
- *
- * The Hamming Weight of a number is the total number of bits set in it.
- */
-#define hweight64(x) generic_hweight64(x)
-
 #endif /* _X86_BITOPS_H */
diff --git a/xen/common/bitops.c b/xen/common/bitops.c
index 5e5d20d225..91ae961440 100644
--- a/xen/common/bitops.c
+++ b/xen/common/bitops.c
@@ -144,6 +144,9 @@ static void __init test_hweight(void)
 
     CHECK(hweightl, 1 | (1UL << (BITS_PER_LONG - 1)), 2);
     CHECK(hweightl, -1UL, BITS_PER_LONG);
+
+    /* unsigned int hweight64(uint64_t) */
+    CHECK(hweight64, -1ULL, 64);
 }
 
 static void __init __constructor test_bitops(void)
diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
index a462c30651..12eb88fb12 100644
--- a/xen/include/xen/bitops.h
+++ b/xen/include/xen/bitops.h
@@ -331,6 +331,14 @@ static always_inline attr_const unsigned int hweight32(uint32_t x)
     return hweightl(x);
 }
 
+static always_inline attr_const unsigned int hweight64(uint64_t x)
+{
+    if ( BITS_PER_LONG >= 64 )
+        return hweightl(x);
+    else
+        return hweight32(x >> 32) + hweight32(x);
+}
+
 /* --------------------- Please tidy below here --------------------- */
 
 #ifndef find_next_bit
@@ -399,43 +407,6 @@ static inline int get_count_order(unsigned int count)
     return order;
 }
 
-/*
- * hweightN: returns the hamming weight (i.e. the number
- * of bits set) of a N-bit word
- */
-
-static inline unsigned int generic_hweight32(unsigned int w)
-{
-    w -= (w >> 1) & 0x55555555;
-    w =  (w & 0x33333333) + ((w >> 2) & 0x33333333);
-    w =  (w + (w >> 4)) & 0x0f0f0f0f;
-
-    if ( IS_ENABLED(CONFIG_HAS_FAST_MULTIPLY) )
-        return (w * 0x01010101) >> 24;
-
-    w += w >> 8;
-
-    return (w + (w >> 16)) & 0xff;
-}
-
-static inline unsigned int generic_hweight64(uint64_t w)
-{
-    if ( BITS_PER_LONG < 64 )
-        return generic_hweight32(w >> 32) + generic_hweight32(w);
-
-    w -= (w >> 1) & 0x5555555555555555UL;
-    w =  (w & 0x3333333333333333UL) + ((w >> 2) & 0x3333333333333333UL);
-    w =  (w + (w >> 4)) & 0x0f0f0f0f0f0f0f0fUL;
-
-    if ( IS_ENABLED(CONFIG_HAS_FAST_MULTIPLY) )
-        return (w * 0x0101010101010101UL) >> 56;
-
-    w += w >> 8;
-    w += w >> 16;
-
-    return (w + (w >> 32)) & 0xFF;
-}
-
 /*
  * rol32 - rotate a 32-bit value left
  *
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 09 15:22:46 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Sep 2024 15:22:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.794685.1203720 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngE1-00043X-PP; Mon, 09 Sep 2024 15:22:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 794685.1203720; Mon, 09 Sep 2024 15:22:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngE1-00043P-Ml; Mon, 09 Sep 2024 15:22:45 +0000
Received: by outflank-mailman (input) for mailman id 794685;
 Mon, 09 Sep 2024 15:22:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngE0-00043H-Lj
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:22:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngE0-00015P-Kn
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:22:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngE0-0000ZX-Jv
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:22:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/7cWNzTo1VBK71YUY2C5wQZcYrdvQlebjQA3GCwMd5E=; b=yu0EV8YfIKq3dDd0s1CmiZfG7P
	amtNpKp2oJxmQ45sT9xS6fCqnB8rcNHq7v0TKInxc8l70tv0Bk4Q04ZgnPNhBkLuPhjim0/r73tSR
	P0Iy0HXf/LGsSflLrF1IonfyxEF9nPGRU4/Ss1T6U8wDViZqkhKbEFggvzKekME+dSKA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/bitops: Use the POPCNT instruction when available
Message-Id: <E1sngE0-0000ZX-Jv@xenbits.xenproject.org>
Date: Mon, 09 Sep 2024 15:22:44 +0000

commit 6978602334d92378269ca0dcea794ddc83b4dae7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 22 20:18:15 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    x86/bitops: Use the POPCNT instruction when available
    
    It has existed in x86 CPUs since 2008, so we're only 16 years late adding
    support.  With all the other scafolding in place, implement arch_hweightl()
    for x86.
    
    The only complication is that the call to arch_generic_hweightl() is behind
    the compilers back.  Address this by writing it in ASM and ensure that it
    preserves all registers.
    
    Copy the code generation from generic_hweightl().  It's not a complicated
    algorithm, and is easy to regenerate if needs be, but cover it with the same
    unit tests as test_generic_hweightl() just for piece of mind.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/bitops.h | 23 +++++++++++++
 xen/lib/Makefile                  |  1 +
 xen/lib/x86-generic-hweightl.c    | 71 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 95 insertions(+)

diff --git a/xen/arch/x86/include/asm/bitops.h b/xen/arch/x86/include/asm/bitops.h
index 642d8e58b2..39e37f1cbe 100644
--- a/xen/arch/x86/include/asm/bitops.h
+++ b/xen/arch/x86/include/asm/bitops.h
@@ -6,6 +6,7 @@
  */
 
 #include <asm/alternative.h>
+#include <asm/asm_defns.h>
 #include <asm/cpufeatureset.h>
 
 /*
@@ -475,4 +476,26 @@ static always_inline unsigned int arch_flsl(unsigned long x)
 }
 #define arch_flsl arch_flsl
 
+unsigned int arch_generic_hweightl(unsigned long x);
+
+static always_inline unsigned int arch_hweightl(unsigned long x)
+{
+    unsigned int r;
+
+    /*
+     * arch_generic_hweightl() is written in ASM in order to preserve all
+     * registers, as the compiler can't see the call.
+     *
+     * This limits the POPCNT instruction to using the same ABI as a function
+     * call (input in %rdi, output in %eax) but that's fine.
+     */
+    alternative_io("call arch_generic_hweightl",
+                   "popcnt %[val], %q[res]", X86_FEATURE_POPCNT,
+                   ASM_OUTPUT2([res] "=a" (r) ASM_CALL_CONSTRAINT),
+                   [val] "D" (x));
+
+    return r;
+}
+#define arch_hweightl arch_hweightl
+
 #endif /* _X86_BITOPS_H */
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index b6558e108b..54440f628a 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -36,6 +36,7 @@ lib-y += strtol.o
 lib-y += strtoll.o
 lib-y += strtoul.o
 lib-y += strtoull.o
+lib-$(CONFIG_X86) += x86-generic-hweightl.o
 lib-$(CONFIG_X86) += xxhash32.o
 lib-$(CONFIG_X86) += xxhash64.o
 
diff --git a/xen/lib/x86-generic-hweightl.c b/xen/lib/x86-generic-hweightl.c
new file mode 100644
index 0000000000..123a5b4392
--- /dev/null
+++ b/xen/lib/x86-generic-hweightl.c
@@ -0,0 +1,71 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <xen/bitops.h>
+#include <xen/init.h>
+#include <xen/self-tests.h>
+
+/*
+ * An implementation of generic_hweightl() used on hardware without the POPCNT
+ * instruction.
+ *
+ * This function is called from within an ALTERNATIVE in arch_hweightl().
+ * i.e. behind the back of the compiler.  Therefore all registers are callee
+ * preserved.
+ *
+ * The ASM is what GCC-12 emits for generic_hweightl() in a release build of
+ * Xen, with spilling of %rdi/%rdx to preserve the callers registers.
+ *
+ * Note: When we can use __attribute__((no_caller_saved_registers))
+ *       unconditionally (GCC 7, Clang 5), we can implement this in plain C.
+ */
+asm (
+    ".type arch_generic_hweightl, STT_FUNC\n\t"
+    ".globl arch_generic_hweightl\n\t"
+    ".hidden arch_generic_hweightl\n\t"
+    ".balign " STR(CONFIG_FUNCTION_ALIGNMENT) ", 0x90\n" /* CODE_FILL */
+    "arch_generic_hweightl:\n\t"
+
+    "push   %rdi\n\t"
+    "push   %rdx\n\t"
+
+    "movabs $0x5555555555555555, %rdx\n\t"
+    "mov    %rdi, %rax\n\t"
+    "shr    $1, %rax\n\t"
+    "and    %rdx, %rax\n\t"
+    "sub    %rax, %rdi\n\t"
+    "movabs $0x3333333333333333, %rax\n\t"
+    "mov    %rdi, %rdx\n\t"
+    "shr    $2, %rdi\n\t"
+    "and    %rax, %rdx\n\t"
+    "and    %rax, %rdi\n\t"
+    "add    %rdi, %rdx\n\t"
+    "mov    %rdx, %rax\n\t"
+    "shr    $4, %rax\n\t"
+    "add    %rdx, %rax\n\t"
+    "movabs $0x0f0f0f0f0f0f0f0f, %rdx\n\t"
+    "and    %rdx, %rax\n\t"
+    "movabs $0x0101010101010101, %rdx\n\t"
+    "imul   %rdx, %rax\n\t"
+    "shr    $" STR(BITS_PER_LONG) "- 8, %rax\n\t"
+
+    "pop    %rdx\n\t"
+    "pop    %rdi\n\t"
+
+    "ret\n\t"
+
+    ".size arch_generic_hweightl, . - arch_generic_hweightl\n\t"
+);
+
+#ifdef CONFIG_SELF_TESTS
+static void __init __constructor test_arch_generic_hweightl(void)
+{
+    RUNTIME_CHECK(arch_generic_hweightl, 0, 0);
+    RUNTIME_CHECK(arch_generic_hweightl, 1, 1);
+    RUNTIME_CHECK(arch_generic_hweightl, 3, 2);
+    RUNTIME_CHECK(arch_generic_hweightl, 7, 3);
+    RUNTIME_CHECK(arch_generic_hweightl, 0xff, 8);
+
+    RUNTIME_CHECK(arch_generic_hweightl, 1 | (1UL << (BITS_PER_LONG - 1)), 2);
+    RUNTIME_CHECK(arch_generic_hweightl, -1UL, BITS_PER_LONG);
+}
+#endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 09 15:22:56 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Sep 2024 15:22:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.794686.1203724 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngEC-000464-RF; Mon, 09 Sep 2024 15:22:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 794686.1203724; Mon, 09 Sep 2024 15:22:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngEC-00045w-OH; Mon, 09 Sep 2024 15:22:56 +0000
Received: by outflank-mailman (input) for mailman id 794686;
 Mon, 09 Sep 2024 15:22:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngEA-00045j-P4
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:22:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngEA-00015X-OA
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:22:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngEA-0000aG-Mw
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:22:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UbcfM6xSj1LA5Mz2DKyZWAo52SVJMg6yrrLaM4If1aE=; b=Tu2/1UaA7XWIV5HF3akAQXN1r/
	ETBpLwygczC4JpH7ZgdIhfexfaxt1ScSBcsU2pBi7VAoYwV2KYIoIo27R9WsFZqAokhbxCh83U+zC
	lPOUMpRvnJcCxbGAcPQOaFz+aPaYFM53sH5+reJ/c89Om/fW/TWV/D+20YlhcQCiCdyY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/ocaml: Rationalise .gitignore
Message-Id: <E1sngEA-0000aG-Mw@xenbits.xenproject.org>
Date: Mon, 09 Sep 2024 15:22:54 +0000

commit 0a15b7695bd983fa49da2e4c5daf8606497f0671
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Sep 6 15:36:37 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    tools/ocaml: Rationalise .gitignore
    
    The root .gitignore is quite stale from recent (and less recent) removals, but
    also fails to work for the forthcoming dynamic plugin work.
    
    Strip all Ocaml content out of the root .gitignore, and provide a more local
    .gitignore's with up-to-date patterns.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
---
 .gitignore                       | 28 ----------------------------
 tools/ocaml/.gitignore           |  6 ++++++
 tools/ocaml/libs/xc/.gitignore   |  1 +
 tools/ocaml/libs/xs/.gitignore   |  1 +
 tools/ocaml/xenstored/.gitignore |  3 +++
 5 files changed, 11 insertions(+), 28 deletions(-)

diff --git a/.gitignore b/.gitignore
index d8b57e32f8..d88be80b28 100644
--- a/.gitignore
+++ b/.gitignore
@@ -92,7 +92,6 @@ stubdom/mini-os-*
 stubdom/mk-headers-*
 stubdom/newlib-1.*
 stubdom/newlib-x86*
-stubdom/ocaml-*
 stubdom/pciutils-*
 stubdom/pkg-config/*
 stubdom/polarssl-*
@@ -339,33 +338,6 @@ tools/misc/xen-hvmcrash
 tools/misc/xen-lowmemd
 tools/vchan/vchan-node[12]
 tools/vchan/vchan-socket-proxy
-tools/ocaml/*/.ocamldep.make
-tools/ocaml/*/*.cm[ixao]
-tools/ocaml/*/*.cmxa
-tools/ocaml/*/*.annot
-tools/ocaml/*/*/.ocamldep.make
-tools/ocaml/*/*/*.cm[ixao]
-tools/ocaml/*/*/*.cmxa
-tools/ocaml/*/*/*.annot
-tools/ocaml/*/*/META
-tools/ocaml/libs/xl/_libxl_types.inc
-tools/ocaml/libs/xl/_libxl_types.ml.in
-tools/ocaml/libs/xl/_libxl_types.mli.in
-tools/ocaml/libs/xl/xenlight.ml
-tools/ocaml/libs/xl/xenlight.mli
-tools/ocaml/libs/xentoollog/_xtl_levels.*
-tools/ocaml/libs/xentoollog/xentoollog.ml
-tools/ocaml/libs/xentoollog/xentoollog.mli
-tools/ocaml/libs/xs/paths.ml
-tools/ocaml/libs/xc/xenctrl_abi_check.h
-tools/ocaml/xenstored/oxenstored
-tools/ocaml/xenstored/oxenstored.conf
-tools/ocaml/xenstored/paths.ml
-tools/ocaml/test/xtl
-tools/ocaml/test/send_debug_keys
-tools/ocaml/test/list_domains
-tools/ocaml/test/dmesg
-tools/ocaml/test/raise_exception
 tools/debugger/kdd/kdd
 tools/firmware/etherboot/ipxe.tar.gz
 tools/firmware/etherboot/ipxe/
diff --git a/tools/ocaml/.gitignore b/tools/ocaml/.gitignore
new file mode 100644
index 0000000000..c97bc8444c
--- /dev/null
+++ b/tools/ocaml/.gitignore
@@ -0,0 +1,6 @@
+**/META
+**/.ocamldep.make
+**/*.annot
+**/*.cm[ixaot]
+**/*.cmti
+**/*.cmx[as]
diff --git a/tools/ocaml/libs/xc/.gitignore b/tools/ocaml/libs/xc/.gitignore
new file mode 100644
index 0000000000..1b26ad32b6
--- /dev/null
+++ b/tools/ocaml/libs/xc/.gitignore
@@ -0,0 +1 @@
+/xenctrl_abi_check.h
diff --git a/tools/ocaml/libs/xs/.gitignore b/tools/ocaml/libs/xs/.gitignore
new file mode 100644
index 0000000000..4d556ef38c
--- /dev/null
+++ b/tools/ocaml/libs/xs/.gitignore
@@ -0,0 +1 @@
+/paths.ml
diff --git a/tools/ocaml/xenstored/.gitignore b/tools/ocaml/xenstored/.gitignore
new file mode 100644
index 0000000000..2b432de4fc
--- /dev/null
+++ b/tools/ocaml/xenstored/.gitignore
@@ -0,0 +1,3 @@
+/oxenstored
+/oxenstored.conf
+/paths.ml
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 09 15:23:06 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Sep 2024 15:23:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.794687.1203728 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngEM-00049M-U8; Mon, 09 Sep 2024 15:23:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 794687.1203728; Mon, 09 Sep 2024 15:23:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngEM-00049D-RO; Mon, 09 Sep 2024 15:23:06 +0000
Received: by outflank-mailman (input) for mailman id 794687;
 Mon, 09 Sep 2024 15:23:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngEK-000493-SX
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:23:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngEK-00015v-Rb
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:23:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngEK-0000bN-QM
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:23:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xHvGIR8C5X70C5aGpwLX8zkVfIhB81OKkP+Ka+wJifQ=; b=TZlNIHHoPTiYAhQzrOhTs1Lcnt
	5DTO3QvYud0gFpbI6VH/HYoC82TJw02JPftpfNJo2onI0giVDQcRVeA1B8ZyHQQ5LQVZ0K8LOb04/
	TbbgjK1yvdpvBahXbAT9yzjbk9IJ/zCDBneng/cOumHMGhVohoIx3lyErBhML0ItpITw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] ocaml/libs: Implement a dynamically-loaded plugin for Xenctrl.domain_getinfo
Message-Id: <E1sngEK-0000bN-QM@xenbits.xenproject.org>
Date: Mon, 09 Sep 2024 15:23:04 +0000

commit a6576011a4d21a6e88daba1308d5a19e2d964d9b
Author:     Andrii Sultanov <andrii.sultanov@cloud.com>
AuthorDate: Mon Sep 9 13:02:40 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    ocaml/libs: Implement a dynamically-loaded plugin for Xenctrl.domain_getinfo
    
    This plugin intends to hide the unstable Xenctrl interface under a
    stable one. In case of the change in the interface, a V2 of this plugin
    would need to be produced, but V1 with the old interface would
    need to be kept (with potential change in the implementation) in the
    meantime.
    
    To reduce the need for such changes in the future, this plugin only
    provides the absolute minimum functionality that Oxenstored uses - only
    three fields of the domaininfo struct are used and presented here.
    
    Oxenstored currently uses the single-domain domain_getinfo function,
    whereas domain_getinfolist is a potentially more efficient option. Both
    of these are provided in the plugin to allow a transition from one to
    the other without modifying the interface in the future. Both return
    identical structures and rely on the same fields in xenctrl, thus if one
    of them breaks, both will break, and a new version of the interface
    would need to be issued.
    
    Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/ocaml/Makefile                               |   1 +
 tools/ocaml/libs/Makefile                          |   2 +-
 tools/ocaml/libs/xsd_glue/META.in                  |   4 +
 tools/ocaml/libs/xsd_glue/Makefile                 |  46 ++++++
 .../libs/xsd_glue/domain_getinfo_plugin_v1/META.in |   5 +
 .../xsd_glue/domain_getinfo_plugin_v1/Makefile     |  37 +++++
 .../domain_getinfo_stubs_v1.c                      | 160 +++++++++++++++++++++
 .../domain_getinfo_plugin_v1/domain_getinfo_v1.ml  |  35 +++++
 .../domain_getinfo_plugin_v1/domain_getinfo_v1.mli |   1 +
 tools/ocaml/libs/xsd_glue/plugin_interface_v1.ml   |  30 ++++
 tools/ocaml/libs/xsd_glue/plugin_interface_v1.mli  |  38 +++++
 11 files changed, 358 insertions(+), 1 deletion(-)

diff --git a/tools/ocaml/Makefile b/tools/ocaml/Makefile
index 1557fd6c3c..7252eb23d7 100644
--- a/tools/ocaml/Makefile
+++ b/tools/ocaml/Makefile
@@ -29,6 +29,7 @@ build-tools-oxenstored:
 	$(MAKE) -s -C libs/mmap
 	$(MAKE) -s -C libs/xb
 	$(MAKE) -s -C libs/xc
+	$(MAKE) -s -C libs/xsd_glue
 	$(MAKE) -C xenstored
 
 .PHONY: format
diff --git a/tools/ocaml/libs/Makefile b/tools/ocaml/libs/Makefile
index 89350aa12f..6bcec58502 100644
--- a/tools/ocaml/libs/Makefile
+++ b/tools/ocaml/libs/Makefile
@@ -4,7 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 SUBDIRS= \
 	mmap \
 	eventchn xc \
-	xb xs
+	xb xs xsd_glue
 
 .PHONY: all
 all: subdirs-all
diff --git a/tools/ocaml/libs/xsd_glue/META.in b/tools/ocaml/libs/xsd_glue/META.in
new file mode 100644
index 0000000000..dbd584ac17
--- /dev/null
+++ b/tools/ocaml/libs/xsd_glue/META.in
@@ -0,0 +1,4 @@
+version = "@VERSION@"
+description = "A small library on top of unstable Xenctrl interfaces used by Oxenstored"
+archive(byte) = "plugin_interface_v1.cma"
+archive(native) = "plugin_interface_v1.cmxa"
diff --git a/tools/ocaml/libs/xsd_glue/Makefile b/tools/ocaml/libs/xsd_glue/Makefile
new file mode 100644
index 0000000000..f84291f7fe
--- /dev/null
+++ b/tools/ocaml/libs/xsd_glue/Makefile
@@ -0,0 +1,46 @@
+OCAML_TOPLEVEL=$(CURDIR)/../..
+XEN_ROOT=$(OCAML_TOPLEVEL)/../..
+include $(OCAML_TOPLEVEL)/common.make
+
+SUBDIRS= domain_getinfo_plugin_v1
+
+CFLAGS += $(CFLAGS_xeninclude)
+OCAMLOPTFLAGS += -opaque
+
+OBJS = plugin_interface_v1
+INTF = $(foreach obj, $(OBJS),$(obj).cmi)
+LIBS = plugin_interface_v1.cma plugin_interface_v1.cmxa
+LIBS_plugin_interface_v1 =
+plugin_interface_v1_OBJS=$(OBJS)
+
+.PHONY: all
+all: $(INTF) $(LIBS) $(PROGRAMS) subdirs-all
+
+bins: $(PROGRAMS)
+
+libs: $(LIBS)
+
+plugin_interface_v1 = $(OBJS)
+
+OCAML_NOC_LIBRARY = plugin_interface_v1
+
+.PHONY: install
+install: $(LIBS) META subdirs-install
+	mkdir -p $(OCAMLDESTDIR)
+	$(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xsd_glue
+	$(OCAMLFIND) install -destdir $(OCAMLDESTDIR) -ldconf ignore xsd_glue META $(INTF) $(LIBS)
+	$(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xsd_glue_dev
+	$(OCAMLFIND) install -destdir $(OCAMLDESTDIR) -ldconf ignore xsd_glue_dev META $(INTF) $(LIBS) *.ml *.mli
+
+.PHONY: uninstall
+uninstall: subdirs-uninstall
+	$(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xsd_glue
+	$(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xsd_glue_dev
+
+.PHONY: clean
+clean: subdirs-clean
+
+.PHONY: distclean
+distclean: subdirs-distclean
+
+include $(OCAML_TOPLEVEL)/Makefile.rules
diff --git a/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/META.in b/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/META.in
new file mode 100644
index 0000000000..fb917def62
--- /dev/null
+++ b/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/META.in
@@ -0,0 +1,5 @@
+version = "@VERSION@"
+description = "Xenstored plugin for Xenctrl.domain_getinfo unstable interface - V1"
+requires = "plugin_interface_v1"
+archive(byte) = "domain_getinfo_v1.cma"
+archive(native) = "domain_getinfo_v1.cmxa"
diff --git a/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/Makefile b/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/Makefile
new file mode 100644
index 0000000000..4be1feacfe
--- /dev/null
+++ b/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/Makefile
@@ -0,0 +1,37 @@
+OCAML_TOPLEVEL=$(CURDIR)/../../..
+XEN_ROOT=$(OCAML_TOPLEVEL)/../..
+include $(OCAML_TOPLEVEL)/common.make
+
+CFLAGS += -I $(OCAML_TOPLEVEL)/libs -I $(OCAML_TOPLEVEL)/libs/xsd_glue
+CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_xeninclude) $(APPEND_CFLAGS)
+OCAMLOPTFLAGS += -opaque
+OCAMLINCLUDE += -I ./ -I ../
+
+OBJS = domain_getinfo_v1
+INTF = $(foreach obj, $(OBJS),$(obj).cmi)
+LIBS = domain_getinfo_v1.cmxa domain_getinfo_v1.cmxs
+
+LIBS_xsd_glue = $(call xenlibs-ldflags-ldlibs,xenctrl)
+
+all: $(INTF) $(LIBS) $(PROGRAMS)
+
+bins: $(PROGRAMS)
+
+libs: $(LIBS)
+
+domain_getinfo_v1_OBJS = $(OBJS)
+domain_getinfo_v1 = $(OBJS)
+domain_getinfo_v1_C_OBJS = domain_getinfo_stubs_v1
+
+OCAML_DYN_LIBRARY = domain_getinfo_v1
+
+.PHONY: install
+install: $(LIBS) META
+	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)/ocaml/xsd_glue/xenctrl_plugin
+	$(INSTALL_PROG) domain_getinfo_v1.cmxs $(DESTDIR)$(LIBEXEC)/ocaml/xsd_glue/xenctrl_plugin
+
+.PHONY: uninstall
+uninstall:
+	rm -f $(DESTDIR)$(LIBEXEC)/ocaml/xsd_glue/xenctrl_plugin/domain_getinfo_v1.cmxs
+
+include $(OCAML_TOPLEVEL)/Makefile.rules
diff --git a/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/domain_getinfo_stubs_v1.c b/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/domain_getinfo_stubs_v1.c
new file mode 100644
index 0000000000..7be386f4d4
--- /dev/null
+++ b/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/domain_getinfo_stubs_v1.c
@@ -0,0 +1,160 @@
+/* SPDX-License-Identifier: LGPL-2.1-only WITH OCaml-LGPL-linking-exception */
+
+#define _GNU_SOURCE
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#define CAML_NAME_SPACE
+#include <caml/alloc.h>
+#include <caml/memory.h>
+#include <caml/signals.h>
+#include <caml/fail.h>
+#include <caml/callback.h>
+#include <caml/custom.h>
+
+#include <xen-tools/common-macros.h>
+#include <xenctrl.h>
+
+#include "xen-caml-compat.h"
+
+static inline xc_interface *xsd_glue_xch_of_val(value v)
+{
+	xc_interface *xch = *(xc_interface **)Data_custom_val(v);
+
+	return xch;
+}
+
+static void xsd_glue_xenctrl_finalize(value v)
+{
+	xc_interface *xch = xsd_glue_xch_of_val(v);
+
+	xc_interface_close(xch);
+}
+
+static struct custom_operations xsd_glue_xenctrl_ops = {
+	.identifier  = "xsd_glue.domain_getinfo_v1.xenctrl",
+	.finalize    = xsd_glue_xenctrl_finalize,
+	.compare     = custom_compare_default,     /* Can't compare     */
+	.hash        = custom_hash_default,        /* Can't hash        */
+	.serialize   = custom_serialize_default,   /* Can't serialize   */
+	.deserialize = custom_deserialize_default, /* Can't deserialize */
+	.compare_ext = custom_compare_ext_default, /* Can't compare     */
+};
+
+static void Noreturn xsd_glue_failwith(
+	xc_interface *xch, const char *func, unsigned int line)
+{
+	CAMLparam0();
+	CAMLlocal1(msg);
+	const xc_error *error = xch ? xc_get_last_error(xch) : NULL;
+	char *str = NULL;
+
+#define ERR (error && error->code != XC_ERROR_NONE)
+
+	int ret = asprintf(&str,
+			"%d: %s%s%s - called from %s:%u",
+			ERR ? error->code : errno,
+			ERR ? xc_error_code_to_desc(error->code) : strerror(errno),
+			ERR ? ": " : "",
+			ERR ? error->message : "",
+			func, line);
+
+#undef ERR
+
+	if (!*str || (ret == -1))
+		caml_raise_out_of_memory();
+
+	msg = caml_copy_string(str);
+	free(str);
+
+	caml_raise_with_arg(*caml_named_value("xsg.error_v1"), msg);
+}
+#define xsd_glue_failwith(xch) xsd_glue_failwith(xch, __func__, __LINE__)
+
+CAMLprim value stub_xsd_glue_xc_interface_open(value unit)
+{
+	CAMLparam1(unit);
+	CAMLlocal1(result);
+	xc_interface *xch;
+
+	result = caml_alloc_custom(&xsd_glue_xenctrl_ops, sizeof(xch), 0, 1);
+
+	caml_enter_blocking_section();
+	xch = xc_interface_open(NULL, NULL, 0);
+	caml_leave_blocking_section();
+
+	if (!xch)
+		xsd_glue_failwith(xch);
+
+	*(xc_interface **)Data_custom_val(result) = xch;
+
+	CAMLreturn(result);
+}
+
+static value xsd_glue_alloc_domaininfo(const xc_domaininfo_t *info)
+{
+	CAMLparam0();
+	CAMLlocal1(result);
+
+	result = caml_alloc_tuple(4);
+
+	Store_field(result,  0, Val_int(info->domain));
+	Store_field(result,  1, Val_bool(info->flags & XEN_DOMINF_dying));
+	Store_field(result,  2, Val_bool(info->flags & XEN_DOMINF_shutdown));
+	Store_field(result,  3, Val_int(MASK_EXTR(info->flags, XEN_DOMINF_shutdownmask)));
+
+	CAMLreturn(result);
+}
+
+CAMLprim value stub_xsd_glue_xc_domain_getinfo(value xch_val, value domid)
+{
+	CAMLparam2(xch_val, domid);
+	CAMLlocal1(result);
+	xc_interface *xch = xsd_glue_xch_of_val(xch_val);
+	xc_domaininfo_t info;
+	int ret;
+	int domid_c = Int_val(domid);
+
+	caml_enter_blocking_section();
+	ret = xc_domain_getinfo_single(xch, domid_c, &info);
+	caml_leave_blocking_section();
+
+	if (ret < 0)
+		xsd_glue_failwith(xch);
+
+	result = xsd_glue_alloc_domaininfo(&info);
+
+	CAMLreturn(result);
+}
+
+CAMLprim value stub_xsd_glue_xc_domain_getinfolist(value xch_val)
+{
+	CAMLparam1(xch_val);
+	CAMLlocal1(result);
+	xc_interface *xch = xsd_glue_xch_of_val(xch_val);
+	xc_domaininfo_t *info;
+	int i, retval;
+
+	/* get the minimum number of allocate byte we need and bump it up to page boundary */
+	info = malloc(sizeof(xc_domaininfo_t) * DOMID_FIRST_RESERVED);
+	if (!info)
+		caml_raise_out_of_memory();
+
+	caml_enter_blocking_section();
+	retval = xc_domain_getinfolist(xch, 0, DOMID_FIRST_RESERVED, info);
+	caml_leave_blocking_section();
+
+	if (retval <= 0) {
+		free(info);
+		xsd_glue_failwith(xch);
+	}
+
+	result = caml_alloc(retval, 0);
+	for (i = 0; i < retval; i++) {
+		caml_modify(&Field(result, i), xsd_glue_alloc_domaininfo(info + i));
+	}
+
+	free(info);
+	CAMLreturn(result);
+}
diff --git a/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/domain_getinfo_v1.ml b/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/domain_getinfo_v1.ml
new file mode 100644
index 0000000000..be50853c4b
--- /dev/null
+++ b/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/domain_getinfo_v1.ml
@@ -0,0 +1,35 @@
+(* SPDX-License-Identifier: LGPL-2.1-only WITH OCaml-LGPL-linking-exception *)
+(** Minimal interface on top of unstable Xenctrl for Oxenstored's usage *)
+
+module P = Plugin_interface_v1
+
+module M : P.Domain_getinfo_V1 = struct
+  exception Error of string
+
+  type domid = int
+  type handle
+
+  type domaininfo = {
+    domid : domid;
+    dying : bool;
+    shutdown : bool;
+    shutdown_code : int;
+  }
+
+  external interface_open : unit -> handle = "stub_xsd_glue_xc_interface_open"
+
+  external domain_getinfo : handle -> domid -> domaininfo
+    = "stub_xsd_glue_xc_domain_getinfo"
+
+  external domain_getinfolist : handle -> domaininfo array
+    = "stub_xsd_glue_xc_domain_getinfolist"
+
+  let _ = Callback.register_exception "xsg.error_v1" (Error "register_callback")
+end
+
+let () =
+  Printf.ksprintf !P.logging_function "Registration of %s plugin started\n%!"
+    __MODULE__;
+  P.register_plugin_v1 (module M : P.Domain_getinfo_V1);
+  Printf.ksprintf !P.logging_function "Registration of %s plugin successful\n%!"
+    __MODULE__
diff --git a/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/domain_getinfo_v1.mli b/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/domain_getinfo_v1.mli
new file mode 100644
index 0000000000..465beda1a3
--- /dev/null
+++ b/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/domain_getinfo_v1.mli
@@ -0,0 +1 @@
+(* SPDX-License-Identifier: LGPL-2.1-only WITH OCaml-LGPL-linking-exception *)
diff --git a/tools/ocaml/libs/xsd_glue/plugin_interface_v1.ml b/tools/ocaml/libs/xsd_glue/plugin_interface_v1.ml
new file mode 100644
index 0000000000..5ab98b83bd
--- /dev/null
+++ b/tools/ocaml/libs/xsd_glue/plugin_interface_v1.ml
@@ -0,0 +1,30 @@
+(* SPDX-License-Identifier: LGPL-2.1-only WITH OCaml-LGPL-linking-exception *)
+
+module type Domain_getinfo_V1 = sig
+  exception Error of string
+
+  type domid = int
+  type handle
+
+  type domaininfo = {
+    domid : domid;
+    dying : bool;
+    shutdown : bool;
+    shutdown_code : int;
+  }
+
+  val interface_open : unit -> handle
+  val domain_getinfo : handle -> domid -> domaininfo
+  val domain_getinfolist : handle -> domaininfo array
+end
+
+let ignore_logging : string -> unit = ignore
+let logging_function = ref ignore_logging
+let register_logging_function func = logging_function := func
+let plugin_implementation_v1 : (module Domain_getinfo_V1) option ref = ref None
+let register_plugin_v1 m = plugin_implementation_v1 := Some m
+
+let get_plugin_v1 () : (module Domain_getinfo_V1) =
+  match !plugin_implementation_v1 with
+  | Some s -> s
+  | None -> failwith "No plugin loaded"
diff --git a/tools/ocaml/libs/xsd_glue/plugin_interface_v1.mli b/tools/ocaml/libs/xsd_glue/plugin_interface_v1.mli
new file mode 100644
index 0000000000..69f91510f7
--- /dev/null
+++ b/tools/ocaml/libs/xsd_glue/plugin_interface_v1.mli
@@ -0,0 +1,38 @@
+(* SPDX-License-Identifier: LGPL-2.1-only WITH OCaml-LGPL-linking-exception *)
+
+(** To avoid breaking the plugin interface, this module needs to be
+    standalone and can't rely on any other Xen library. Even unrelated
+    changes in the interfaces of those modules would change the hash
+    of this interface and break the plugin system.
+    It can only depend on Stdlib, therefore all of the types (domid,
+    domaininfo etc.) are redefined here instead of using alternatives
+    defined elsewhere.
+
+    NOTE: The signature of this interface should not be changed (no
+    functions or types can be added, modified, or removed). If
+    underlying Xenctrl changes require a new interface, a V2 with a
+    corresponding plugin should be created.
+*)
+
+module type Domain_getinfo_V1 = sig
+  exception Error of string
+
+  type domid = int
+  type handle
+
+  type domaininfo = {
+    domid : domid;
+    dying : bool;
+    shutdown : bool;
+    shutdown_code : int;
+  }
+
+  val interface_open : unit -> handle
+  val domain_getinfo : handle -> domid -> domaininfo
+  val domain_getinfolist : handle -> domaininfo array
+end
+
+val register_logging_function : (string -> unit) -> unit
+val logging_function : (string -> unit) ref
+val register_plugin_v1 : (module Domain_getinfo_V1) -> unit
+val get_plugin_v1 : unit -> (module Domain_getinfo_V1)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 09 15:23:17 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Sep 2024 15:23:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.794689.1203732 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngEW-0004CG-VV; Mon, 09 Sep 2024 15:23:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 794689.1203732; Mon, 09 Sep 2024 15:23:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngEW-0004C9-Sn; Mon, 09 Sep 2024 15:23:16 +0000
Received: by outflank-mailman (input) for mailman id 794689;
 Mon, 09 Sep 2024 15:23:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngEU-0004Bl-Va
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:23:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngEU-000166-Uk
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:23:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngEU-0000cH-Ti
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:23:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=G+P6qWM73MQpd72gFlyBvqzIKTXxlTwJgNVv6lITtbw=; b=rSf/q/W9k7p21MlaOEj6XeMfTs
	LavtxeqgEtoNHw8VgFheW2SSBcjZjDl9sH1RA9Mkl9tHROTJQFafqqzZhC/D53+sMzPbwLtDlX8TW
	rytSiwhc5/yPRE3sXFS4F3r9nCpNfuY2veteEuwokhlIKlnSM5488zAR+zCDApxS2RJU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/oxenstored: Load the plugin for Xenctrl.domain_getinfo
Message-Id: <E1sngEU-0000cH-Ti@xenbits.xenproject.org>
Date: Mon, 09 Sep 2024 15:23:14 +0000

commit 8d3ca1b23b5413ea68109f9d0d719aef65819d9a
Author:     Andrii Sultanov <andrii.sultanov@cloud.com>
AuthorDate: Mon Sep 9 13:02:41 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    tools/oxenstored: Load the plugin for Xenctrl.domain_getinfo
    
    Oxenstored dynamically loads the plugin provided in ocaml/libs/xsd_glue.
    The plugin is verified to be providing the specified plugin_interface
    during its loading.
    
    If a V2 of the plugin is produced, V1 will still be present, and a new
    version should only be loaded if it's verified to exist
    (New oxenstored can run in an environment with only V1 of the plugin).
    
    The plugin is not switched to as of yet, the old Xenctrl stubs are still
    used.
    
    Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/ocaml/xenstored/Makefile    |  5 ++++-
 tools/ocaml/xenstored/domains.ml  | 28 ++++++++++++++++++++++++++++
 tools/ocaml/xenstored/paths.ml.in |  1 +
 3 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/tools/ocaml/xenstored/Makefile b/tools/ocaml/xenstored/Makefile
index fa45305d8c..5e8210a906 100644
--- a/tools/ocaml/xenstored/Makefile
+++ b/tools/ocaml/xenstored/Makefile
@@ -15,7 +15,8 @@ OCAMLINCLUDE += \
 	-I $(OCAML_TOPLEVEL)/libs/xb \
 	-I $(OCAML_TOPLEVEL)/libs/mmap \
 	-I $(OCAML_TOPLEVEL)/libs/xc \
-	-I $(OCAML_TOPLEVEL)/libs/eventchn
+	-I $(OCAML_TOPLEVEL)/libs/eventchn \
+	-I $(OCAML_TOPLEVEL)/libs/xsd_glue
 
 LIBS = syslog.cma syslog.cmxa poll.cma poll.cmxa
 syslog_OBJS = syslog
@@ -59,6 +60,7 @@ INTF = symbol.cmi trie.cmi syslog.cmi systemd.cmi poll.cmi
 
 XENSTOREDLIBS = \
 	unix.cmxa \
+	dynlink.cmxa \
 	-ccopt -L -ccopt . syslog.cmxa \
 	-ccopt -L -ccopt . systemd.cmxa \
 	-ccopt -L -ccopt . poll.cmxa \
@@ -66,6 +68,7 @@ XENSTOREDLIBS = \
 	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/eventchn $(OCAML_TOPLEVEL)/libs/eventchn/xeneventchn.cmxa \
 	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/xc $(OCAML_TOPLEVEL)/libs/xc/xenctrl.cmxa \
 	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/xb $(OCAML_TOPLEVEL)/libs/xb/xenbus.cmxa \
+	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/xsd_glue $(OCAML_TOPLEVEL)/libs/xsd_glue/plugin_interface_v1.cmxa \
 	-ccopt -L -ccopt $(XEN_ROOT)/tools/libs/ctrl
 
 PROGRAMS = oxenstored
diff --git a/tools/ocaml/xenstored/domains.ml b/tools/ocaml/xenstored/domains.ml
index 7a3056c364..c233065711 100644
--- a/tools/ocaml/xenstored/domains.ml
+++ b/tools/ocaml/xenstored/domains.ml
@@ -20,6 +20,34 @@ let warn fmt  = Logging.warn  "domains" fmt
 
 let xc = Xenctrl.interface_open ()
 
+let load_plug fname =
+  let fail_with fmt = Printf.ksprintf failwith fmt in
+  let fname = Dynlink.adapt_filename fname in
+  if Sys.file_exists fname then
+    try Dynlink.loadfile fname with
+    | Dynlink.Error err as e ->
+      error "ERROR loading plugin '%s': %s\n%!" fname
+        (Dynlink.error_message err);
+      raise e
+    | _ -> fail_with "Unknown error while loading plugin"
+  else fail_with "Plugin file '%s' does not exist" fname
+
+let () =
+  let plugins_dir = Paths.libexec ^ "/ocaml/xsd_glue/xenctrl_plugin/" in
+  let filepath = plugins_dir ^ "domain_getinfo_v1.cmxs" in
+  debug "Trying to load plugin '%s'\n%!" filepath;
+  let list_files = Sys.readdir plugins_dir in
+  debug "Directory listing of '%s'\n%!" plugins_dir ;
+  Array.iter (fun x -> debug "\t%s\n%!" x) list_files;
+  Dynlink.allow_only [ "Plugin_interface_v1" ];
+  load_plug filepath
+
+module Plugin =
+  (val Plugin_interface_v1.get_plugin_v1 ()
+    : Plugin_interface_v1.Domain_getinfo_V1)
+
+let handle = Plugin.interface_open ()
+
 type domains = {
   eventchn: Event.t;
   table: (Xenctrl.domid, Domain.t) Hashtbl.t;
diff --git a/tools/ocaml/xenstored/paths.ml.in b/tools/ocaml/xenstored/paths.ml.in
index 37949dc8f3..acb6ea4ca7 100644
--- a/tools/ocaml/xenstored/paths.ml.in
+++ b/tools/ocaml/xenstored/paths.ml.in
@@ -2,3 +2,4 @@ let xen_log_dir = "@XEN_LOG_DIR@"
 let xen_config_dir = "@XEN_CONFIG_DIR@"
 let xen_run_dir = "@XEN_RUN_DIR@"
 let xen_run_stored = "@XEN_RUN_STORED@"
+let libexec = "@LIBEXEC@"
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 09 15:23:27 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Sep 2024 15:23:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.794690.1203736 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngEh-0004FA-0y; Mon, 09 Sep 2024 15:23:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 794690.1203736; Mon, 09 Sep 2024 15:23:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngEg-0004F2-UI; Mon, 09 Sep 2024 15:23:26 +0000
Received: by outflank-mailman (input) for mailman id 794690;
 Mon, 09 Sep 2024 15:23:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngEf-0004El-2b
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:23:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngEf-00016b-1O
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:23:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngEf-0000dH-0h
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:23:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZW04Dd4cTI0JW9f05a3/TL8QuYrkhG8GW5OumdQi0Fg=; b=wQOrwJUabEs2NPHQvNhQstLxRZ
	yEdEhOodS0Juh9ryYZzVKvB6exqwNHE424AI14NZj04HDp3lIM5WqG3OocUuQr4eq5qlbYtTPAler
	pOW/SMtmM6sMBecgUITlRJZ1fxz3ylr32bf0yI/d/n62dtZW3Zy2WLjIJJio518Ka+kk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/oxenstored: Switch to using the plugin for Xenctrl.domain_getinfo
Message-Id: <E1sngEf-0000dH-0h@xenbits.xenproject.org>
Date: Mon, 09 Sep 2024 15:23:25 +0000

commit 52e6db7a8cc5654562fc821e836edfbab374e06c
Author:     Andrii Sultanov <andrii.sultanov@cloud.com>
AuthorDate: Mon Sep 9 13:02:42 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    tools/oxenstored: Switch to using the plugin for Xenctrl.domain_getinfo
    
    Also run 'make format' on the file to reformat an adjacent block of code
    correctly.
    
    Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/ocaml/xenstored/domains.ml | 51 ++++++++++++++++++++--------------------
 1 file changed, 25 insertions(+), 26 deletions(-)

diff --git a/tools/ocaml/xenstored/domains.ml b/tools/ocaml/xenstored/domains.ml
index c233065711..fabca00e6b 100644
--- a/tools/ocaml/xenstored/domains.ml
+++ b/tools/ocaml/xenstored/domains.ml
@@ -49,8 +49,8 @@ module Plugin =
 let handle = Plugin.interface_open ()
 
 type domains = {
-  eventchn: Event.t;
-  table: (Xenctrl.domid, Domain.t) Hashtbl.t;
+  eventchn : Event.t;
+  table : (Plugin.domid, Domain.t) Hashtbl.t;
 
   (* N.B. the Queue module is not thread-safe but oxenstored is single-threaded. *)
   (* Domains queue up to regain conflict-credit; we have a queue for
@@ -121,30 +121,29 @@ let cleanup doms =
   let notify = ref false in
   let dead_dom = ref [] in
 
-  Hashtbl.iter (fun id _ -> if id <> 0 then
-                   try
-                     let info = Xenctrl.domain_getinfo xc id in
-                     if info.Xenctrl.shutdown || info.Xenctrl.dying then (
-                       debug "Domain %u died (dying=%b, shutdown %b -- code %d)"
-                         id info.Xenctrl.dying info.Xenctrl.shutdown info.Xenctrl.shutdown_code;
-                       if info.Xenctrl.dying then
-                         dead_dom := id :: !dead_dom
-                       else
-                         notify := true;
-                     )
-                   with Xenctrl.Error _ ->
-                     debug "Domain %u died -- no domain info" id;
-                     dead_dom := id :: !dead_dom;
-               ) doms.table;
-  List.iter (fun id ->
-      let dom = Hashtbl.find doms.table id in
-      Domain.close dom;
-      Hashtbl.remove doms.table id;
-      if dom.Domain.conflict_credit <= !Define.conflict_burst_limit
-      then (
-        remove_from_queue dom doms.doms_with_conflict_penalty;
-        if (dom.Domain.conflict_credit <= 0.) then remove_from_queue dom doms.doms_conflict_paused
-      )
+  Hashtbl.iter
+    (fun id _ ->
+       if id <> 0 then (
+         try
+           let info = Plugin.domain_getinfo handle id in
+           if info.Plugin.shutdown || info.Plugin.dying then (
+             debug "Domain %u died (dying=%b, shutdown %b -- code %d)" id
+               info.Plugin.dying info.Plugin.shutdown info.Plugin.shutdown_code;
+             if info.Plugin.dying then dead_dom := id :: !dead_dom else notify := true)
+         with Plugin.Error _ ->
+           debug "Domain %u died -- no domain info" id;
+           dead_dom := id :: !dead_dom))
+    doms.table;
+  List.iter
+    (fun id ->
+       let dom = Hashtbl.find doms.table id in
+       Domain.close dom;
+       Hashtbl.remove doms.table id;
+       if dom.Domain.conflict_credit <= !Define.conflict_burst_limit
+       then (
+         remove_from_queue dom doms.doms_with_conflict_penalty;
+         if (dom.Domain.conflict_credit <= 0.) then remove_from_queue dom doms.doms_conflict_paused
+       )
     ) !dead_dom;
   !notify, !dead_dom
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 09 15:23:36 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Sep 2024 15:23:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.794691.1203740 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngEq-0004Hh-2H; Mon, 09 Sep 2024 15:23:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 794691.1203740; Mon, 09 Sep 2024 15:23:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngEp-0004Ha-Vf; Mon, 09 Sep 2024 15:23:35 +0000
Received: by outflank-mailman (input) for mailman id 794691;
 Mon, 09 Sep 2024 15:23:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngEp-0004HR-5E
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:23:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngEp-00016m-4Q
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:23:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngEp-0000fj-3U
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:23:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GFT26XqU7vxqNDDlmbBddU4Oju7u6ldxHFpgtRYkWMc=; b=mgZvxpY4ymw95fRMvJ1R1FGKPy
	oFN/t/QDBZWRTbk564MtRRdyAjH3/3876HKLcqRqLkxs6m+dKbT0mNIWqoyFdljNV53HOcl1Cx1Mp
	lw3jOF30z9ckGCL52EbgztkPbGgK9Q4R4kPQXyy2ofn2dJnWSUM7FjvLHSG7xIsQcLgU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Optimise 32 bit C source code
Message-Id: <E1sngEp-0000fj-3U@xenbits.xenproject.org>
Date: Mon, 09 Sep 2024 15:23:35 +0000

commit bbe4035e6727d259dbb65c3ce432a508822a8957
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Mon Sep 9 14:22:15 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    x86/boot: Optimise 32 bit C source code
    
    The various filters are removing all optimisations.
    No need to have all optimisations turned off.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/boot/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index 8f5bbff0cc..dfe3cb7034 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -15,7 +15,7 @@ CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_TREEWIDE_CFLAGS))
 $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
 CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float -mregparm=3
 CFLAGS_x86_32 += -nostdinc -include $(filter %/include/xen/config.h,$(XEN_CFLAGS))
-CFLAGS_x86_32 += $(filter -I%,$(XEN_CFLAGS))
+CFLAGS_x86_32 += $(filter -I% -O%,$(XEN_CFLAGS))
 
 # override for 32bit binaries
 $(head-bin-objs): CFLAGS_stack_boundary :=
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 09 15:23:46 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Sep 2024 15:23:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.794692.1203744 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngF0-0004Kj-4p; Mon, 09 Sep 2024 15:23:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 794692.1203744; Mon, 09 Sep 2024 15:23:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngF0-0004Kc-2H; Mon, 09 Sep 2024 15:23:46 +0000
Received: by outflank-mailman (input) for mailman id 794692;
 Mon, 09 Sep 2024 15:23:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngEz-0004KW-82
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:23:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngEz-00016v-7F
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:23:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngEz-0000gY-6b
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:23:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lTF7N/dYSc/I+62Ti42ON36BDHTAwP8mWbrMZOPpIQ8=; b=TVC6NjIErWbln+J72MBGpL+kYZ
	Q+a/e6PkK2zxJDLZm+Ve6mfyXLaAJyVEzyZ16dvpBUKtmTks5Ttxuj7k9xmvfxiKdH4+U0o2GrdI/
	7ZhY8mFpzuQ5c6P7Bv6VoFw1+gOU3DcxFcdDaTF3T3xe8wxqENrbIF5VzPex3KSw3ef0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Add missing __XEN__ definition for 32 bit code
Message-Id: <E1sngEz-0000gY-6b@xenbits.xenproject.org>
Date: Mon, 09 Sep 2024 15:23:45 +0000

commit be21da24c6a264eafbdd3b41ade838771fc56a2d
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Mon Sep 9 14:22:16 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    x86/boot: Add missing __XEN__ definition for 32 bit code
    
    We are compiling Xen source code so we should define __XEN__ macro.
    We don't want to import all definitions from XEN_CFLAGS (as done for
    other options) because most of them are processor dependent and
    do not apply to 32 bit.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/boot/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index dfe3cb7034..ff0f965876 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -15,7 +15,7 @@ CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_TREEWIDE_CFLAGS))
 $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
 CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float -mregparm=3
 CFLAGS_x86_32 += -nostdinc -include $(filter %/include/xen/config.h,$(XEN_CFLAGS))
-CFLAGS_x86_32 += $(filter -I% -O%,$(XEN_CFLAGS))
+CFLAGS_x86_32 += $(filter -I% -O%,$(XEN_CFLAGS)) -D__XEN__
 
 # override for 32bit binaries
 $(head-bin-objs): CFLAGS_stack_boundary :=
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 09 15:23:56 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Sep 2024 15:23:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.794693.1203748 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngFA-0004NM-7O; Mon, 09 Sep 2024 15:23:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 794693.1203748; Mon, 09 Sep 2024 15:23:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngFA-0004NE-4t; Mon, 09 Sep 2024 15:23:56 +0000
Received: by outflank-mailman (input) for mailman id 794693;
 Mon, 09 Sep 2024 15:23:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngF9-0004N6-Ah
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:23:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngF9-000176-A0
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:23:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngF9-0000hK-9Q
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:23:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HDcidwhIJepkZJtTRqUHz6grG+GdVddQocrw9YxNbjw=; b=Ic22T9OR1PeNf0/67JyAG+K/Vy
	uCLCWHvolOzGzkkL/ah0f4NI5qXWAGo25sbgP09lXccBS6Zi1GAl1HLAA5OJxx/JWwha0Drwondio
	csWhi2VabVvEm9PD/O7w+dauPZhIRH1C7+XF3I4cZx41eBmCgu09TYGeZXHAPiDRtZnw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/build: Rework includes in genapic/probe.c
Message-Id: <E1sngF9-0000hK-9Q@xenbits.xenproject.org>
Date: Mon, 09 Sep 2024 15:23:55 +0000

commit e58d41e9f00aa759122adb7dbe2d0bb0176a02ba
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Sep 5 21:40:20 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    x86/build: Rework includes in genapic/probe.c
    
    probe.c includes a large number of headers which are unused, and not from
    churn so far as I can see in history.  Strip back to a reasonable set.
    
    One complication is that genapic.h has to include xen/cpumask.h because
    there's no way to forward declare a cpumask_t.
    
    Also strip trailing whitespace while adjusting the file.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/genapic/probe.c       | 34 ++++++++++++++++------------------
 xen/arch/x86/include/asm/genapic.h |  2 ++
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/xen/arch/x86/genapic/probe.c b/xen/arch/x86/genapic/probe.c
index 10ceeae4d2..946c3d3ce3 100644
--- a/xen/arch/x86/genapic/probe.c
+++ b/xen/arch/x86/genapic/probe.c
@@ -1,25 +1,23 @@
-/* Copyright 2003 Andi Kleen, SuSE Labs. 
- * Subject to the GNU Public License, v.2 
- * 
+/* Copyright 2003 Andi Kleen, SuSE Labs.
+ * Subject to the GNU Public License, v.2
+ *
  * Generic x86 APIC driver probe layer.
- */  
-#include <xen/cpumask.h>
-#include <xen/string.h>
-#include <xen/kernel.h>
-#include <xen/ctype.h>
+ */
+#include <xen/bug.h>
+#include <xen/errno.h>
 #include <xen/init.h>
 #include <xen/param.h>
-#include <asm/cache.h>
-#include <asm/fixmap.h>
-#include <asm/mpspec.h>
-#include <asm/apicdef.h>
-#include <asm/mach-generic/mach_apic.h>
-#include <asm/setup.h>
+#include <xen/sections.h>
+#include <xen/string.h>
+#include <xen/types.h>
+
+#include <asm/apic.h>
+#include <asm/genapic.h>
 
 struct genapic __ro_after_init genapic;
 
 static const struct genapic *const __initconstrel apic_probe[] = {
-	&apic_bigsmp, 
+	&apic_bigsmp,
 	&apic_default,	/* must be last */
 	NULL,
 };
@@ -57,8 +55,8 @@ static int __init cf_check genapic_apic_force(const char *str)
 }
 custom_param("apic", genapic_apic_force);
 
-void __init generic_apic_probe(void) 
-{ 
+void __init generic_apic_probe(void)
+{
 	int i;
 
 	record_boot_APIC_mode();
@@ -75,4 +73,4 @@ void __init generic_apic_probe(void)
 	BUG_ON(!genapic.name);
 
 	printk(KERN_INFO "Using APIC driver %s\n", genapic.name);
-} 
+}
diff --git a/xen/arch/x86/include/asm/genapic.h b/xen/arch/x86/include/asm/genapic.h
index 970df8ffe0..a694371c6d 100644
--- a/xen/arch/x86/include/asm/genapic.h
+++ b/xen/arch/x86/include/asm/genapic.h
@@ -1,6 +1,8 @@
 #ifndef _ASM_GENAPIC_H
 #define _ASM_GENAPIC_H 1
 
+#include <xen/cpumask.h>
+
 /*
  * Generic APIC driver interface.
  *
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 09 15:24:06 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Sep 2024 15:24:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.794694.1203752 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngFK-0004PT-8x; Mon, 09 Sep 2024 15:24:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 794694.1203752; Mon, 09 Sep 2024 15:24:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngFK-0004PL-6M; Mon, 09 Sep 2024 15:24:06 +0000
Received: by outflank-mailman (input) for mailman id 794694;
 Mon, 09 Sep 2024 15:24:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngFJ-0004PD-Dj
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:24:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngFJ-00017Q-Cw
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:24:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngFJ-0000kO-CI
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:24:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Fymtj0L5boMmEPat61PmAC4LX0Di7lHV/jDnlgsCkWY=; b=ET4OErnE4qNce3UpMIRtLXyqXW
	yuyJyp49eGQD4vdHpie39rkMxeXZQqjVLO8Ip//ishllFeeeifjYVm1qWxHd0RfiwqxN8YHSJE3lJ
	adUx17KpcZ72520CLIBlq+YmI3GX5bDJJrU6Q0cuSZn5um4bOinYModbiXErTLX2j8o8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/build: Drop unused includes of xen/cache.h
Message-Id: <E1sngFJ-0000kO-CI@xenbits.xenproject.org>
Date: Mon, 09 Sep 2024 15:24:05 +0000

commit a4194782da80f530e58dc8d074cab03ece25ee0e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu May 30 21:22:56 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    xen/build: Drop unused includes of xen/cache.h
    
    None of these are used, not even transitively.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/bzimage.c               | 1 -
 xen/arch/x86/dmi_scan.c              | 1 -
 xen/arch/x86/include/asm/processor.h | 1 -
 xen/common/decompress.h              | 1 -
 xen/include/acpi/platform/aclinux.h  | 1 -
 xen/include/xen/rcupdate.h           | 1 -
 6 files changed, 6 deletions(-)

diff --git a/xen/arch/x86/bzimage.c b/xen/arch/x86/bzimage.c
index ac4fd428be..66f648f311 100644
--- a/xen/arch/x86/bzimage.c
+++ b/xen/arch/x86/bzimage.c
@@ -1,4 +1,3 @@
-#include <xen/cache.h>
 #include <xen/errno.h>
 #include <xen/lib.h>
 #include <xen/mm.h>
diff --git a/xen/arch/x86/dmi_scan.c b/xen/arch/x86/dmi_scan.c
index 9257aee2ab..2fcc485295 100644
--- a/xen/arch/x86/dmi_scan.c
+++ b/xen/arch/x86/dmi_scan.c
@@ -3,7 +3,6 @@
 #include <xen/kernel.h>
 #include <xen/string.h>
 #include <xen/init.h>
-#include <xen/cache.h>
 #include <xen/acpi.h>
 #include <asm/io.h>
 #include <asm/system.h>
diff --git a/xen/arch/x86/include/asm/processor.h b/xen/arch/x86/include/asm/processor.h
index e71dbb8d3f..26e2fb1369 100644
--- a/xen/arch/x86/include/asm/processor.h
+++ b/xen/arch/x86/include/asm/processor.h
@@ -5,7 +5,6 @@
 #define __ASM_X86_PROCESSOR_H
 
 #ifndef __ASSEMBLY__
-#include <xen/cache.h>
 #include <xen/types.h>
 #include <xen/smp.h>
 #include <xen/percpu.h>
diff --git a/xen/common/decompress.h b/xen/common/decompress.h
index e8195b353a..4683eb6c7e 100644
--- a/xen/common/decompress.h
+++ b/xen/common/decompress.h
@@ -1,6 +1,5 @@
 #ifdef __XEN__
 
-#include <xen/cache.h>
 #include <xen/decompress.h>
 #include <xen/init.h>
 #include <xen/string.h>
diff --git a/xen/include/acpi/platform/aclinux.h b/xen/include/acpi/platform/aclinux.h
index f5e0a6108e..a66c2e6d1d 100644
--- a/xen/include/acpi/platform/aclinux.h
+++ b/xen/include/acpi/platform/aclinux.h
@@ -47,7 +47,6 @@
 #define ACPI_USE_SYSTEM_CLIBRARY
 #define ACPI_USE_DO_WHILE_0
 
-#include <xen/cache.h>
 #include <xen/string.h>
 #include <xen/kernel.h>
 #include <xen/ctype.h>
diff --git a/xen/include/xen/rcupdate.h b/xen/include/xen/rcupdate.h
index 6f2587058e..95f4ad81c4 100644
--- a/xen/include/xen/rcupdate.h
+++ b/xen/include/xen/rcupdate.h
@@ -31,7 +31,6 @@
 #ifndef __XEN_RCUPDATE_H
 #define __XEN_RCUPDATE_H
 
-#include <xen/cache.h>
 #include <xen/compiler.h>
 #include <xen/spinlock.h>
 #include <xen/cpumask.h>
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 09 15:24:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Sep 2024 15:24:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.794696.1203757 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngFU-0004SP-Az; Mon, 09 Sep 2024 15:24:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 794696.1203757; Mon, 09 Sep 2024 15:24:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngFU-0004SH-82; Mon, 09 Sep 2024 15:24:16 +0000
Received: by outflank-mailman (input) for mailman id 794696;
 Mon, 09 Sep 2024 15:24:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngFT-0004S9-Gn
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:24:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngFT-00017h-G8
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:24:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngFT-0000lD-FE
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:24:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=T4OsGZEqiHpv2CVBqxCrNK0guYYC1SPX2+rWyB2+7/8=; b=j9nBx4LshIEjbYmOiHlwxrbUNC
	duY19dBIwsC8BlZcjwQ2WZgw1/GUEdlCaVdARFkxt4mvtMLYmBd+x+N3lgYPvOqJsjMC6CwaJ2MLg
	Hzen5oanPK9lBKBFGQv7f0XJAdapHOap5hE7bb29w01IhMD77a97eSWugLx0OyhJe51o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/build: Swap cache.h includes for xen/sections.h
Message-Id: <E1sngFT-0000lD-FE@xenbits.xenproject.org>
Date: Mon, 09 Sep 2024 15:24:15 +0000

commit 41556be010f447df2683649a149a8c0ca2abc76b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Sep 5 20:18:06 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    x86/build: Swap cache.h includes for xen/sections.h
    
    These include {xen/asm}/cache.h but only want xen/sections.h.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/acpi/cpu_idle.c    | 3 ++-
 xen/arch/x86/cpu-policy.c       | 2 +-
 xen/arch/x86/guest/hypervisor.c | 2 +-
 xen/common/efi/runtime.c        | 3 ++-
 4 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index f175e4d7d3..876317fad0 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -40,7 +40,8 @@
 #include <xen/param.h>
 #include <xen/trace.h>
 #include <xen/irq.h>
-#include <asm/cache.h>
+#include <xen/sections.h>
+
 #include <asm/io.h>
 #include <asm/iocap.h>
 #include <asm/hpet.h>
diff --git a/xen/arch/x86/cpu-policy.c b/xen/arch/x86/cpu-policy.c
index 1f5e42db5b..b6d9fad567 100644
--- a/xen/arch/x86/cpu-policy.c
+++ b/xen/arch/x86/cpu-policy.c
@@ -1,8 +1,8 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
-#include <xen/cache.h>
 #include <xen/kernel.h>
 #include <xen/param.h>
 #include <xen/sched.h>
+#include <xen/sections.h>
 
 #include <xen/lib/x86/cpu-policy.h>
 
diff --git a/xen/arch/x86/guest/hypervisor.c b/xen/arch/x86/guest/hypervisor.c
index ac80e83245..7afc5038b4 100644
--- a/xen/arch/x86/guest/hypervisor.c
+++ b/xen/arch/x86/guest/hypervisor.c
@@ -8,9 +8,9 @@
  */
 #include <xen/cpumask.h>
 #include <xen/init.h>
+#include <xen/sections.h>
 #include <xen/types.h>
 
-#include <asm/cache.h>
 #include <asm/guest.h>
 
 static struct hypervisor_ops __ro_after_init ops;
diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c
index d952c3ba78..d03e5c90ce 100644
--- a/xen/common/efi/runtime.c
+++ b/xen/common/efi/runtime.c
@@ -1,9 +1,10 @@
 #include "efi.h"
 #include "runtime.h"
-#include <xen/cache.h>
+
 #include <xen/errno.h>
 #include <xen/guest_access.h>
 #include <xen/irq.h>
+#include <xen/sections.h>
 #include <xen/time.h>
 
 DEFINE_XEN_GUEST_HANDLE(CHAR16);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 09 15:24:26 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Sep 2024 15:24:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.794697.1203760 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngFe-0004Vy-CC; Mon, 09 Sep 2024 15:24:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 794697.1203760; Mon, 09 Sep 2024 15:24:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngFe-0004Vq-9S; Mon, 09 Sep 2024 15:24:26 +0000
Received: by outflank-mailman (input) for mailman id 794697;
 Mon, 09 Sep 2024 15:24:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngFd-0004Vi-Jr
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:24:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngFd-000189-J7
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:24:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngFd-0000lv-IM
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:24:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2Ug+3ZL+fGBabwYp1X5vdpF4Rto2irleQAJd2OYMRog=; b=MwaNGeksA5+3YwoJy2Yykwhfr5
	82zg9b2wDMqE718oflyZqD8LdcJao7WE6eqx+w108RD36Rl9Ojg8ZMBCrb03XmTnrs4+y937UkMHb
	2zQUQPPj95mDlphLzUdim5HgTz6BiQr9K6ksQgWlooHuqqVNdcIpwZr5AcqnUy2zXXRA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/cache: Drop legacy __read_mostly/__ro_after_init definitions
Message-Id: <E1sngFd-0000lv-IM@xenbits.xenproject.org>
Date: Mon, 09 Sep 2024 15:24:25 +0000

commit afc8d7dd300aae4b45eb74970b6db91d1161e397
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 21 20:59:46 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    x86/cache: Drop legacy __read_mostly/__ro_after_init definitions
    
    Lots of files were picking these up transitively, including lib.h
    
    However, lib.h needs __read_mostly for printk_once() and this has the side
    effect of kicking the transitive can down the road.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/cache.h | 3 ---
 xen/include/xen/cache.h          | 2 +-
 xen/include/xen/lib.h            | 1 +
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/include/asm/cache.h b/xen/arch/x86/include/asm/cache.h
index 956c05493e..f15d10dc7f 100644
--- a/xen/arch/x86/include/asm/cache.h
+++ b/xen/arch/x86/include/asm/cache.h
@@ -9,9 +9,6 @@
 #define L1_CACHE_SHIFT	(CONFIG_X86_L1_CACHE_SHIFT)
 #define L1_CACHE_BYTES	(1 << L1_CACHE_SHIFT)
 
-/* TODO: Phase out the use of this via cache.h */
-#define __read_mostly __section(".data.read_mostly")
-
 #ifndef __ASSEMBLY__
 
 void cache_flush(const void *addr, unsigned int size);
diff --git a/xen/include/xen/cache.h b/xen/include/xen/cache.h
index a19942fd63..90816ba05b 100644
--- a/xen/include/xen/cache.h
+++ b/xen/include/xen/cache.h
@@ -15,7 +15,7 @@
 #define __cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES)))
 #endif
 
-#if defined(CONFIG_ARM) || defined(CONFIG_X86)
+#if defined(CONFIG_ARM)
 /* TODO: Phase out the use of this via cache.h */
 #define __ro_after_init __section(".data.ro_after_init")
 #endif
diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
index e884a02ee8..81b722ea3e 100644
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -10,6 +10,7 @@
 #include <xen/types.h>
 #include <xen/xmalloc.h>
 #include <xen/string.h>
+#include <xen/sections.h>
 
 #define __ACCESS_ONCE(x) ({                             \
             (void)(typeof(x))0; /* Scalar typecheck. */ \
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 09 15:24:36 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Sep 2024 15:24:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.794698.1203764 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngFo-0004Yb-EE; Mon, 09 Sep 2024 15:24:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 794698.1203764; Mon, 09 Sep 2024 15:24:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngFo-0004YV-Aw; Mon, 09 Sep 2024 15:24:36 +0000
Received: by outflank-mailman (input) for mailman id 794698;
 Mon, 09 Sep 2024 15:24:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngFn-0004YK-Ms
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:24:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngFn-00018L-M6
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:24:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngFn-0000mt-LV
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:24:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rJg0wewKdsRd6vNUAwoekw769/KAt0zSLtuSS9o5708=; b=Z2VGYvZiwdlw5F/yucdVyB5nuE
	AEcukPtMfLvsDwuH14UdtRaX9Gn63+ryOywOt8SMe9hoK6wr8zNfzcTcmhB/M41Z9HII25GrMnkoo
	djVYvG7QnS/4tDMx3BDIjI4AIWEgBmB61zBI8zLsRiiArolCtXAjK0pN84P0hulLejCo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/ucode: Utilize ucode_force and remove opt_ucode_allow_same
Message-Id: <E1sngFn-0000mt-LV@xenbits.xenproject.org>
Date: Mon, 09 Sep 2024 15:24:35 +0000

commit 9a6250d80b9ec274852bdc6f8eb825d55ff4b45e
Author:     Fouad Hilly <fouad.hilly@cloud.com>
AuthorDate: Thu Aug 22 14:04:26 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    x86/ucode: Utilize ucode_force and remove opt_ucode_allow_same
    
    Pass xen-ucode flags to do low level checks on microcode version and utilize
    it to allow for microcode downgrade or reapply the same version of the
    microcode.  ucode_force is required to be passed to a low level Intel and AMD
    for version checks to be done.
    
    While adding ucode_force, opt_ucode_allow_same was removed.  Remove
    opt_ucode_allow_same from documentation.
    
    Update CHANGELOG.md for opt_ucode_allow_same removal.
    
    Signed-off-by: Fouad Hilly <fouad.hilly@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 CHANGELOG.md                         |  1 +
 docs/misc/xen-command-line.pandoc    |  7 +--
 xen/arch/x86/cpu/microcode/amd.c     |  6 ++-
 xen/arch/x86/cpu/microcode/core.c    | 95 +++++++++++++++++++++---------------
 xen/arch/x86/cpu/microcode/intel.c   |  7 +--
 xen/arch/x86/cpu/microcode/private.h |  7 +--
 6 files changed, 70 insertions(+), 53 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5521ae5bb3..26e7d8dd2a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ### Removed
  - On x86:
    - Support for running on Xeon Phi processors.
+   - Removed the `ucode=allow-same` command line option.
 
 ## [4.19.0](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.19.0) - 2024-07-29
 
diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 0a66e1ee2d..959cf45b55 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2650,7 +2650,7 @@ performance.
    Alternatively, selecting `tsx=1` will re-enable TSX at the users own risk.
 
 ### ucode
-> `= List of [ <integer> | scan=<bool>, nmi=<bool>, allow-same=<bool> ]`
+> `= List of [ <integer> | scan=<bool>, nmi=<bool> ]`
 
     Applicability: x86
     Default: `nmi`
@@ -2682,11 +2682,6 @@ precedence over `scan`.
 stop_machine context. In NMI handler, even NMIs are blocked, which is
 considered safer. The default value is `true`.
 
-'allow-same' alters the default acceptance policy for new microcode to permit
-trying to reload the same version.  Many CPUs will actually reload microcode
-of the same version, and this allows for easy testing of the late microcode
-loading path.
-
 ### unrestricted_guest (Intel)
 > `= <boolean>`
 
diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index f76a563c8b..d2a26967c6 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -214,13 +214,15 @@ static enum microcode_match_result cf_check compare_patch(
     return compare_header(new, old);
 }
 
-static int cf_check apply_microcode(const struct microcode_patch *patch)
+static int cf_check apply_microcode(const struct microcode_patch *patch,
+                                    unsigned int flags)
 {
     int hw_err;
     unsigned int cpu = smp_processor_id();
     struct cpu_signature *sig = &per_cpu(cpu_sig, cpu);
     uint32_t rev, old_rev = sig->rev;
     enum microcode_match_result result = microcode_fits(patch);
+    bool ucode_force = flags & XENPF_UCODE_FORCE;
 
     if ( result == MIS_UCODE )
         return -EINVAL;
@@ -229,7 +231,7 @@ static int cf_check apply_microcode(const struct microcode_patch *patch)
      * Allow application of the same revision to pick up SMT-specific changes
      * even if the revision of the other SMT thread is already up-to-date.
      */
-    if ( result == OLD_UCODE )
+    if ( !ucode_force && (result == SAME_UCODE || result == OLD_UCODE) )
         return -EEXIST;
 
     if ( check_final_patch_levels(sig) )
diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index 8a9e744489..8564e4d2c9 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -90,6 +90,11 @@ struct ucode_mod_blob {
     size_t size;
 };
 
+struct patch_with_flags {
+    unsigned int flags;
+    const struct microcode_patch *patch;
+};
+
 static struct ucode_mod_blob __initdata ucode_blob;
 /*
  * By default we will NOT parse the multiboot modules to see if there is
@@ -100,10 +105,8 @@ static bool __initdata ucode_scan;
 /* By default, ucode loading is done in NMI handler */
 static bool ucode_in_nmi = true;
 
-bool __read_mostly opt_ucode_allow_same;
-
 /* Protected by microcode_mutex */
-static struct microcode_patch *microcode_cache;
+static const struct microcode_patch *microcode_cache;
 
 void __init microcode_set_module(unsigned int idx)
 {
@@ -128,8 +131,6 @@ static int __init cf_check parse_ucode(const char *s)
 
         if ( (val = parse_boolean("nmi", s, ss)) >= 0 )
             ucode_in_nmi = val;
-        else if ( (val = parse_boolean("allow-same", s, ss)) >= 0 )
-            opt_ucode_allow_same = val;
         else if ( !ucode_mod_forced ) /* Not forced by EFI */
         {
             if ( (val = parse_boolean("scan", s, ss)) >= 0 )
@@ -237,7 +238,10 @@ static DEFINE_PER_CPU(int, loading_err);
  */
 static cpumask_t cpu_callin_map;
 static atomic_t cpu_out, cpu_updated;
-static const struct microcode_patch *nmi_patch = ZERO_BLOCK_PTR;
+static struct patch_with_flags nmi_patch =
+{
+    .patch  = ZERO_BLOCK_PTR,
+};
 
 /*
  * Return a patch that covers current CPU. If there are multiple patches,
@@ -252,13 +256,13 @@ static struct microcode_patch *parse_blob(const char *buf, size_t len)
     return alternative_call(ucode_ops.cpu_request_microcode, buf, len, true);
 }
 
-static void microcode_free_patch(struct microcode_patch *patch)
+static void microcode_free_patch(const struct microcode_patch *patch)
 {
-    xfree(patch);
+    xfree((struct microcode_patch *)patch);
 }
 
 /* Return true if cache gets updated. Otherwise, return false */
-static bool microcode_update_cache(struct microcode_patch *patch)
+static bool microcode_update_cache(const struct microcode_patch *patch)
 {
     ASSERT(spin_is_locked(&microcode_mutex));
 
@@ -327,7 +331,8 @@ static bool cf_check wait_cpu_callout(unsigned int nr)
  * If no patch is provided, the cached patch will be loaded. Microcode update
  * during APs bringup and CPU resuming falls into this case.
  */
-static int microcode_update_cpu(const struct microcode_patch *patch)
+static int microcode_update_cpu(const struct microcode_patch *patch,
+                                unsigned int flags)
 {
     int err;
 
@@ -335,10 +340,11 @@ static int microcode_update_cpu(const struct microcode_patch *patch)
 
     spin_lock(&microcode_mutex);
     if ( patch )
-        err = alternative_call(ucode_ops.apply_microcode, patch);
+        err = alternative_call(ucode_ops.apply_microcode, patch, flags);
     else if ( microcode_cache )
     {
-        err = alternative_call(ucode_ops.apply_microcode, microcode_cache);
+        err = alternative_call(ucode_ops.apply_microcode, microcode_cache,
+                               flags);
         if ( err == -EIO )
         {
             microcode_free_patch(microcode_cache);
@@ -379,7 +385,8 @@ static int secondary_nmi_work(void)
     return wait_for_state(LOADING_EXIT) ? 0 : -EBUSY;
 }
 
-static int primary_thread_work(const struct microcode_patch *patch)
+static int primary_thread_work(const struct microcode_patch *patch,
+                               unsigned int flags)
 {
     int ret;
 
@@ -388,7 +395,7 @@ static int primary_thread_work(const struct microcode_patch *patch)
     if ( !wait_for_state(LOADING_ENTER) )
         return -EBUSY;
 
-    ret = alternative_call(ucode_ops.apply_microcode, patch);
+    ret = alternative_call(ucode_ops.apply_microcode, patch, flags);
     if ( !ret )
         atomic_inc(&cpu_updated);
     atomic_inc(&cpu_out);
@@ -416,7 +423,8 @@ static int cf_check microcode_nmi_callback(
         return 0;
 
     if ( primary_cpu )
-        ret = primary_thread_work(nmi_patch);
+        ret = primary_thread_work(nmi_patch.patch,
+                                  nmi_patch.flags);
     else
         ret = secondary_nmi_work();
     this_cpu(loading_err) = ret;
@@ -446,7 +454,8 @@ static int secondary_thread_fn(void)
     return this_cpu(loading_err);
 }
 
-static int primary_thread_fn(const struct microcode_patch *patch)
+static int primary_thread_fn(const struct microcode_patch *patch,
+                             unsigned int flags)
 {
     if ( !wait_for_state(LOADING_CALLIN) )
         return -EBUSY;
@@ -466,10 +475,11 @@ static int primary_thread_fn(const struct microcode_patch *patch)
         return this_cpu(loading_err);
     }
 
-    return primary_thread_work(patch);
+    return primary_thread_work(patch, flags);
 }
 
-static int control_thread_fn(const struct microcode_patch *patch)
+static int control_thread_fn(const struct microcode_patch *patch,
+                             unsigned int flags)
 {
     unsigned int cpu = smp_processor_id(), done;
     unsigned long tick;
@@ -482,7 +492,8 @@ static int control_thread_fn(const struct microcode_patch *patch)
      */
     watchdog_disable();
 
-    nmi_patch = patch;
+    nmi_patch.patch = patch;
+    nmi_patch.flags = flags;
     smp_wmb();
     saved_nmi_callback = set_nmi_callback(microcode_nmi_callback);
 
@@ -498,7 +509,7 @@ static int control_thread_fn(const struct microcode_patch *patch)
         goto out;
 
     /* Control thread loads ucode first while others are in NMI handler. */
-    ret = alternative_call(ucode_ops.apply_microcode, patch);
+    ret = alternative_call(ucode_ops.apply_microcode, patch, flags);
     if ( !ret )
         atomic_inc(&cpu_updated);
     atomic_inc(&cpu_out);
@@ -544,17 +555,19 @@ static int control_thread_fn(const struct microcode_patch *patch)
 
     set_nmi_callback(saved_nmi_callback);
     smp_wmb();
-    nmi_patch = ZERO_BLOCK_PTR;
+    nmi_patch.patch = ZERO_BLOCK_PTR;
+    nmi_patch.flags = 0;
 
     watchdog_enable();
 
     return ret;
 }
 
-static int cf_check do_microcode_update(void *patch)
+static int cf_check do_microcode_update(void *_patch_with_flags)
 {
     unsigned int cpu = smp_processor_id();
     int ret;
+    struct patch_with_flags *patch_with_flags = _patch_with_flags;
 
     /*
      * The control thread set state to coordinate ucode loading. Primary
@@ -562,9 +575,11 @@ static int cf_check do_microcode_update(void *patch)
      * the completion of the ucode loading process.
      */
     if ( cpu == cpumask_first(&cpu_online_map) )
-        ret = control_thread_fn(patch);
+        ret = control_thread_fn(patch_with_flags->patch,
+                                patch_with_flags->flags);
     else if ( is_cpu_primary(cpu) )
-        ret = primary_thread_fn(patch);
+        ret = primary_thread_fn(patch_with_flags->patch,
+                                patch_with_flags->flags);
     else
         ret = secondary_thread_fn();
 
@@ -582,7 +597,8 @@ static long cf_check microcode_update_helper(void *data)
     int ret;
     struct ucode_buf *buffer = data;
     unsigned int cpu, updated;
-    struct microcode_patch *patch;
+    struct patch_with_flags patch_with_flags;
+    bool ucode_force = buffer->flags & XENPF_UCODE_FORCE;
 
     /* cpu_online_map must not change during update */
     if ( !get_cpu_maps() )
@@ -606,16 +622,17 @@ static long cf_check microcode_update_helper(void *data)
         goto put;
     }
 
-    patch = parse_blob(buffer->buffer, buffer->len);
+    patch_with_flags.patch = parse_blob(buffer->buffer, buffer->len);
+    patch_with_flags.flags = buffer->flags;
     xfree(buffer);
-    if ( IS_ERR(patch) )
+    if ( IS_ERR(patch_with_flags.patch) )
     {
-        ret = PTR_ERR(patch);
+        ret = PTR_ERR(patch_with_flags.patch);
         printk(XENLOG_WARNING "Parsing microcode blob error %d\n", ret);
         goto put;
     }
 
-    if ( !patch )
+    if ( !patch_with_flags.patch )
     {
         printk(XENLOG_WARNING "microcode: couldn't find any matching ucode in "
                               "the provided blob!\n");
@@ -632,17 +649,17 @@ static long cf_check microcode_update_helper(void *data)
     {
         enum microcode_match_result result;
 
-        result = alternative_call(ucode_ops.compare_patch, patch,
-                                  microcode_cache);
+        result = alternative_call(ucode_ops.compare_patch,
+                                  patch_with_flags.patch, microcode_cache);
 
         if ( result != NEW_UCODE &&
-             !(opt_ucode_allow_same && result == SAME_UCODE) )
+             !(ucode_force && (result == OLD_UCODE || result == SAME_UCODE)) )
         {
             spin_unlock(&microcode_mutex);
             printk(XENLOG_WARNING
                    "microcode: couldn't find any newer%s revision in the provided blob!\n",
-                   opt_ucode_allow_same ? " (or the same)" : "");
-            microcode_free_patch(patch);
+                   ucode_force ? " (or a valid)" : "");
+            microcode_free_patch(patch_with_flags.patch);
             ret = -EEXIST;
 
             goto put;
@@ -674,13 +691,13 @@ static long cf_check microcode_update_helper(void *data)
      *   this requirement can be relaxed in the future. Right now, this is
      *   conservative and good.
      */
-    ret = stop_machine_run(do_microcode_update, patch, NR_CPUS);
+    ret = stop_machine_run(do_microcode_update, &patch_with_flags, NR_CPUS);
 
     updated = atomic_read(&cpu_updated);
     if ( updated > 0 )
     {
         spin_lock(&microcode_mutex);
-        microcode_update_cache(patch);
+        microcode_update_cache(patch_with_flags.patch);
         spin_unlock(&microcode_mutex);
 
         /*
@@ -697,7 +714,7 @@ static long cf_check microcode_update_helper(void *data)
             alternative_vcall(ctxt_switch_masking, current);
     }
     else
-        microcode_free_patch(patch);
+        microcode_free_patch(patch_with_flags.patch);
 
     if ( updated && updated != nr_cores )
         printk(XENLOG_ERR "ERROR: Updating microcode succeeded on %u cores and failed\n"
@@ -775,7 +792,7 @@ int microcode_update_one(void)
     if ( !ucode_ops.apply_microcode )
         return -EOPNOTSUPP;
 
-    return microcode_update_cpu(NULL);
+    return microcode_update_cpu(NULL, 0);
 }
 
 static int __init early_update_cache(const void *data, size_t len)
@@ -858,7 +875,7 @@ static int __init early_microcode_update_cpu(void)
     if ( !patch )
         return -ENOENT;
 
-    return microcode_update_cpu(patch);
+    return microcode_update_cpu(patch, 0);
 }
 
 int __init early_microcode_init(unsigned long *module_map,
diff --git a/xen/arch/x86/cpu/microcode/intel.c b/xen/arch/x86/cpu/microcode/intel.c
index f505aa1b78..6f69570586 100644
--- a/xen/arch/x86/cpu/microcode/intel.c
+++ b/xen/arch/x86/cpu/microcode/intel.c
@@ -284,21 +284,22 @@ static enum microcode_match_result cf_check compare_patch(
     return compare_revisions(old->rev, new->rev);
 }
 
-static int cf_check apply_microcode(const struct microcode_patch *patch)
+static int cf_check apply_microcode(const struct microcode_patch *patch,
+                                    unsigned int flags)
 {
     uint64_t msr_content;
     unsigned int cpu = smp_processor_id();
     struct cpu_signature *sig = &this_cpu(cpu_sig);
     uint32_t rev, old_rev = sig->rev;
     enum microcode_match_result result;
+    bool ucode_force = flags & XENPF_UCODE_FORCE;
 
     result = microcode_update_match(patch);
 
     if ( result == MIS_UCODE )
         return -EINVAL;
 
-    if ( result == OLD_UCODE ||
-         (result == SAME_UCODE && !opt_ucode_allow_same) )
+    if ( !ucode_force && (result == SAME_UCODE || result == OLD_UCODE) )
         return -EEXIST;
 
     wbinvd();
diff --git a/xen/arch/x86/cpu/microcode/private.h b/xen/arch/x86/cpu/microcode/private.h
index da556fe506..c72f060ac3 100644
--- a/xen/arch/x86/cpu/microcode/private.h
+++ b/xen/arch/x86/cpu/microcode/private.h
@@ -1,9 +1,9 @@
 #ifndef ASM_X86_MICROCODE_PRIVATE_H
 #define ASM_X86_MICROCODE_PRIVATE_H
 
-#include <asm/microcode.h>
+#include <public/platform.h>
 
-extern bool opt_ucode_allow_same;
+#include <asm/microcode.h>
 
 enum microcode_match_result {
     OLD_UCODE, /* signature matched, but revision id is older */
@@ -50,7 +50,8 @@ struct microcode_ops {
      * Attempt to load the provided patch into the CPU.  Returns an error if
      * anything didn't go as expected.
      */
-    int (*apply_microcode)(const struct microcode_patch *patch);
+    int (*apply_microcode)(const struct microcode_patch *patch,
+                           unsigned int flags);
 
     /*
      * Given two patches, are they both applicable to the current CPU, and is
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 09 15:24:46 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 09 Sep 2024 15:24:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.794699.1203768 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngFy-0004bY-GY; Mon, 09 Sep 2024 15:24:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 794699.1203768; Mon, 09 Sep 2024 15:24:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sngFy-0004bO-Dn; Mon, 09 Sep 2024 15:24:46 +0000
Received: by outflank-mailman (input) for mailman id 794699;
 Mon, 09 Sep 2024 15:24:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngFx-0004bI-Pl
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:24:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngFx-00018Y-Ox
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:24:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sngFx-0000na-OF
 for xen-changelog@lists.xenproject.org; Mon, 09 Sep 2024 15:24:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wmALJk7ShEG1tf+5ROoOk2dayW0z7UqVHyws2pGwkI8=; b=m/z1gG07ctJgDQh6R9Roqpin/A
	k4dk6ml6sMjia0U01ZIid0bvsJyludIu4cCfH5LmC9wQexeaun/VELEf68/NS+oKgB0YUMGntolUb
	uRR2pYqhgYGFZIYL/QkuT2/9y605ZxlFAf8piBwjuNQ/xSDPBBnaf89vsq+sXMPwaMLw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] cirrus-ci: update to FreeBSD 14.1 image
Message-Id: <E1sngFx-0000na-OF@xenbits.xenproject.org>
Date: Mon, 09 Sep 2024 15:24:45 +0000

commit ebb7c6b2faf27fbbb546282e6096e5680f82fef1
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Sep 9 16:39:02 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 15:47:10 2024 +0100

    cirrus-ci: update to FreeBSD 14.1 image
    
    14.0 is going EOL by the end of the month.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 .cirrus.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 72227916c7..1c2a6cb812 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -23,7 +23,7 @@ task:
 task:
   name: 'FreeBSD 14'
   freebsd_instance:
-    image_family: freebsd-14-0
+    image_family: freebsd-14-1
   << : *FREEBSD_TEMPLATE
 
 task:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 10 05:00:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Sep 2024 05:00:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.795000.1204066 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1snsyx-0005mD-P7; Tue, 10 Sep 2024 05:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 795000.1204066; Tue, 10 Sep 2024 05:00:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1snsyx-0005lt-M7; Tue, 10 Sep 2024 05:00:03 +0000
Received: by outflank-mailman (input) for mailman id 795000;
 Tue, 10 Sep 2024 05:00:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1snsyx-0005io-Ew
 for xen-changelog@lists.xenproject.org; Tue, 10 Sep 2024 05:00:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1snsyx-0007et-DY
 for xen-changelog@lists.xenproject.org; Tue, 10 Sep 2024 05:00:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1snsyx-0007zm-BN
 for xen-changelog@lists.xenproject.org; Tue, 10 Sep 2024 05:00:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kGT7tfEkz47HIcheYYJSMNywxv9Xvnn/1p1hb/8EIdc=; b=gsXe7UoBkNYWw+vMkWnPYceJ7i
	somlUvmaQu4d6M4Sqv1BHqEfSipBB6QJdjza7dLMtU7ulwfOFcY7E/o5gSgh64JbnsB/ziSj3rcbW
	8Xg8/G6jVURuAeQfuT8O2xfe6S8dUaAYTpAHvPqb5QOQatBi26lSlV7evbHQaQBR92S0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: fix xilinx test console settings
Message-Id: <E1snsyx-0007zm-BN@xenbits.xenproject.org>
Date: Tue, 10 Sep 2024 05:00:03 +0000

commit c23571fe3150c2994afabcaa10c218b3d87fa832
Author:     Victor Lira <victorm.lira@amd.com>
AuthorDate: Mon Sep 9 17:31:46 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Sep 9 21:59:06 2024 -0700

    automation: fix xilinx test console settings
    
    The test showed unreliable behavior due to unsupported console settings.
    Update the baud rate used to connect to the UART.
    
    Signed-off-by: Victor Lira <victorm.lira@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/test.yaml                 | 2 +-
 automation/scripts/xilinx-smoke-dom0-x86_64.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index cecc18a019..8675016b6a 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -102,7 +102,7 @@
   variables:
     CONTAINER: ubuntu:xenial-xilinx
     LOGFILE: xilinx-smoke-x86_64.log
-    XEN_CMD_CONSOLE: "console=com2 com2=115200,8n1,0x2F8,4"
+    XEN_CMD_CONSOLE: "console=com2 com2=57600,8n1,0x2F8,4"
     TEST_BOARD: "crater"
     TEST_TIMEOUT: 1000
   artifacts:
diff --git a/automation/scripts/xilinx-smoke-dom0-x86_64.sh b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
index ef6e1361a9..7027f083ba 100755
--- a/automation/scripts/xilinx-smoke-dom0-x86_64.sh
+++ b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
@@ -129,7 +129,7 @@ sleep 5
 sh /scratch/gitlab-runner/${TEST_BOARD}.sh 1
 sleep 5
 set +e
-stty -F ${SERIAL_DEV} 115200
+stty -F ${SERIAL_DEV} 57600
 
 # Capture test result and power off board before exiting.
 export PASSED="${PASS_MSG}"
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 10 10:44:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Sep 2024 10:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.795367.1204701 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1snyM1-0002pq-9V; Tue, 10 Sep 2024 10:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 795367.1204701; Tue, 10 Sep 2024 10:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1snyM1-0002pi-6z; Tue, 10 Sep 2024 10:44:13 +0000
Received: by outflank-mailman (input) for mailman id 795367;
 Tue, 10 Sep 2024 10:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1snyM0-0002pa-E8
 for xen-changelog@lists.xenproject.org; Tue, 10 Sep 2024 10:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1snyM0-0005vG-DQ
 for xen-changelog@lists.xenproject.org; Tue, 10 Sep 2024 10:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1snyM0-0000HT-CN
 for xen-changelog@lists.xenproject.org; Tue, 10 Sep 2024 10:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+GqiBzzYrTwYaIxxXFsBIUjNkQTmuDyaIlhgVNOuhH8=; b=rb5KSliScKh7CS18LhYhYcng+B
	wxF+vljui8D2+g00Dy224mABaLLcC+KZdr9YYugwob35X1Gln0BM+EraNOEuXQi35w945gxfQ1nOR
	RfRiVHahb9b8DkH8VTV2NoASPzr6mgpsi+TkxOzj+zAsilCSTAPb1biIYFnLO6pa8U+I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HVM: reduce recursion in linear_{read,write}()
Message-Id: <E1snyM0-0000HT-CN@xenbits.xenproject.org>
Date: Tue, 10 Sep 2024 10:44:12 +0000

commit 18053054b7583810dd356efc8d7018bbc8720f36
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Sep 9 13:40:47 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 9 13:40:47 2024 +0200

    x86/HVM: reduce recursion in linear_{read,write}()
    
    Let's make explicit what the compiler may or may not do on our behalf:
    The 2nd of the recursive invocations each can fall through rather than
    re-invoking the function. This will save us from adding yet another
    parameter (or more) to the function, just for the recursive invocations.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/emulate.c | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index feb4792cc5..ecf83795fa 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -1146,7 +1146,7 @@ static int linear_read(unsigned long addr, unsigned int bytes, void *p_data,
     pagefault_info_t pfinfo;
     struct hvm_vcpu_io *hvio = &current->arch.hvm.hvm_io;
     unsigned int offset = addr & ~PAGE_MASK;
-    int rc = HVMTRANS_bad_gfn_to_mfn;
+    int rc;
 
     if ( offset + bytes > PAGE_SIZE )
     {
@@ -1154,12 +1154,16 @@ static int linear_read(unsigned long addr, unsigned int bytes, void *p_data,
 
         /* Split the access at the page boundary. */
         rc = linear_read(addr, part1, p_data, pfec, hvmemul_ctxt);
-        if ( rc == X86EMUL_OKAY )
-            rc = linear_read(addr + part1, bytes - part1, p_data + part1,
-                             pfec, hvmemul_ctxt);
-        return rc;
+        if ( rc != X86EMUL_OKAY )
+            return rc;
+
+        addr += part1;
+        bytes -= part1;
+        p_data += part1;
     }
 
+    rc = HVMTRANS_bad_gfn_to_mfn;
+
     /*
      * If there is an MMIO cache entry for the access then we must be re-issuing
      * an access that was previously handled as MMIO. Thus it is imperative that
@@ -1201,7 +1205,7 @@ static int linear_write(unsigned long addr, unsigned int bytes, void *p_data,
     pagefault_info_t pfinfo;
     struct hvm_vcpu_io *hvio = &current->arch.hvm.hvm_io;
     unsigned int offset = addr & ~PAGE_MASK;
-    int rc = HVMTRANS_bad_gfn_to_mfn;
+    int rc;
 
     if ( offset + bytes > PAGE_SIZE )
     {
@@ -1209,12 +1213,16 @@ static int linear_write(unsigned long addr, unsigned int bytes, void *p_data,
 
         /* Split the access at the page boundary. */
         rc = linear_write(addr, part1, p_data, pfec, hvmemul_ctxt);
-        if ( rc == X86EMUL_OKAY )
-            rc = linear_write(addr + part1, bytes - part1, p_data + part1,
-                              pfec, hvmemul_ctxt);
-        return rc;
+        if ( rc != X86EMUL_OKAY )
+            return rc;
+
+        addr += part1;
+        bytes -= part1;
+        p_data += part1;
     }
 
+    rc = HVMTRANS_bad_gfn_to_mfn;
+
     /*
      * If there is an MMIO cache entry for the access then we must be re-issuing
      * an access that was previously handled as MMIO. Thus it is imperative that
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 10 10:44:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Sep 2024 10:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.795366.1204697 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1snyLr-0002oQ-85; Tue, 10 Sep 2024 10:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 795366.1204697; Tue, 10 Sep 2024 10:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1snyLr-0002oI-5Y; Tue, 10 Sep 2024 10:44:03 +0000
Received: by outflank-mailman (input) for mailman id 795366;
 Tue, 10 Sep 2024 10:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1snyLq-0002oC-BR
 for xen-changelog@lists.xenproject.org; Tue, 10 Sep 2024 10:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1snyLq-0005v6-9z
 for xen-changelog@lists.xenproject.org; Tue, 10 Sep 2024 10:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1snyLq-0000Dd-7c
 for xen-changelog@lists.xenproject.org; Tue, 10 Sep 2024 10:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wEQHpISliG436HfolJbXH4gO9yULIBtLN7FUOQS5OAE=; b=xBsLdBwN/cJKGKMpamhGhgKqOH
	7JTJBjh911ulT0b1iJw1tXK6bOTiCsb6+T32tTBSk2gxRqAF239BJHI2npzIC7yq0IMNngHpALnGX
	SlTk7paAtXfN+YezNJM0wclp2gTYIs1EOQSIsfX02CCXtRhQmSjCdmgVVIxuoHrGlJww=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/pci: Add hypercall to support reset of pcidev
Message-Id: <E1snyLq-0000Dd-7c@xenbits.xenproject.org>
Date: Tue, 10 Sep 2024 10:44:02 +0000

commit 9a2d7b5bb6e93b8c15ee088a3e9237a1900285b1
Author:     Jiqian Chen <Jiqian.Chen@amd.com>
AuthorDate: Mon Sep 9 13:39:32 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 9 13:39:32 2024 +0200

    xen/pci: Add hypercall to support reset of pcidev
    
    When a device has been reset on dom0 side, the Xen hypervisor
    doesn't get notification, so the cached state in vpci is all
    out of date compare with the real device state.
    
    To solve that problem, add a new hypercall to support the reset
    of pcidev and clear the vpci state of device. So that once the
    state of device is reset on dom0 side, dom0 can call this
    hypercall to notify hypervisor.
    
    The behavior of different reset types may be different in the
    future, so divide them now so that they can be easily modified
    in the future without affecting the hypercall interface.
    
    Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
    Signed-off-by: Huang Rui <ray.huang@amd.com>
    Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/hypercall.c |  1 +
 xen/drivers/pci/physdev.c    | 52 ++++++++++++++++++++++++++++++++++++++++++++
 xen/include/public/physdev.h | 17 +++++++++++++++
 xen/include/xen/vpci.h       |  6 +++++
 4 files changed, 76 insertions(+)

diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c
index 44342e7e7f..f023f7879e 100644
--- a/xen/arch/x86/hvm/hypercall.c
+++ b/xen/arch/x86/hvm/hypercall.c
@@ -84,6 +84,7 @@ long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
     case PHYSDEVOP_pci_mmcfg_reserved:
     case PHYSDEVOP_pci_device_add:
     case PHYSDEVOP_pci_device_remove:
+    case PHYSDEVOP_pci_device_reset:
     case PHYSDEVOP_dbgp_op:
         if ( !is_hardware_domain(currd) )
             return -ENOSYS;
diff --git a/xen/drivers/pci/physdev.c b/xen/drivers/pci/physdev.c
index 42db3e6d13..0161a85e1e 100644
--- a/xen/drivers/pci/physdev.c
+++ b/xen/drivers/pci/physdev.c
@@ -2,6 +2,7 @@
 #include <xen/guest_access.h>
 #include <xen/hypercall.h>
 #include <xen/init.h>
+#include <xen/vpci.h>
 
 #ifndef COMPAT
 typedef long ret_t;
@@ -67,6 +68,57 @@ ret_t pci_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         break;
     }
 
+    case PHYSDEVOP_pci_device_reset:
+    {
+        struct pci_device_reset dev_reset;
+        struct pci_dev *pdev;
+        pci_sbdf_t sbdf;
+
+        ret = -EFAULT;
+        if ( copy_from_guest(&dev_reset, arg, 1) != 0 )
+            break;
+
+        ret = -EINVAL;
+        if ( dev_reset.flags & ~PCI_DEVICE_RESET_MASK )
+            break;
+
+        sbdf = PCI_SBDF(dev_reset.dev.seg,
+                        dev_reset.dev.bus,
+                        dev_reset.dev.devfn);
+
+        ret = xsm_resource_setup_pci(XSM_PRIV, sbdf.sbdf);
+        if ( ret )
+            break;
+
+        pcidevs_lock();
+        pdev = pci_get_pdev(NULL, sbdf);
+        if ( !pdev )
+        {
+            pcidevs_unlock();
+            ret = -ENODEV;
+            break;
+        }
+
+        write_lock(&pdev->domain->pci_lock);
+        pcidevs_unlock();
+        switch ( dev_reset.flags & PCI_DEVICE_RESET_MASK )
+        {
+        case PCI_DEVICE_RESET_COLD:
+        case PCI_DEVICE_RESET_WARM:
+        case PCI_DEVICE_RESET_HOT:
+        case PCI_DEVICE_RESET_FLR:
+            ret = vpci_reset_device(pdev);
+            break;
+
+        default:
+            ret = -EINVAL;
+            break;
+        }
+        write_unlock(&pdev->domain->pci_lock);
+
+        break;
+    }
+
     default:
         ret = -ENOSYS;
         break;
diff --git a/xen/include/public/physdev.h b/xen/include/public/physdev.h
index f0c0d4727c..45e1c18541 100644
--- a/xen/include/public/physdev.h
+++ b/xen/include/public/physdev.h
@@ -296,6 +296,13 @@ DEFINE_XEN_GUEST_HANDLE(physdev_pci_device_add_t);
  */
 #define PHYSDEVOP_prepare_msix          30
 #define PHYSDEVOP_release_msix          31
+/*
+ * Notify the hypervisor that a PCI device has been reset, so that any
+ * internally cached state is regenerated.  Should be called after any
+ * device reset performed by the hardware domain.
+ */
+#define PHYSDEVOP_pci_device_reset      32
+
 struct physdev_pci_device {
     /* IN */
     uint16_t seg;
@@ -305,6 +312,16 @@ struct physdev_pci_device {
 typedef struct physdev_pci_device physdev_pci_device_t;
 DEFINE_XEN_GUEST_HANDLE(physdev_pci_device_t);
 
+struct pci_device_reset {
+    physdev_pci_device_t dev;
+#define PCI_DEVICE_RESET_COLD 0x0
+#define PCI_DEVICE_RESET_WARM 0x1
+#define PCI_DEVICE_RESET_HOT  0x2
+#define PCI_DEVICE_RESET_FLR  0x3
+#define PCI_DEVICE_RESET_MASK 0x3
+    uint32_t flags;
+};
+
 #define PHYSDEVOP_DBGP_RESET_PREPARE    1
 #define PHYSDEVOP_DBGP_RESET_DONE       2
 
diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h
index da8d0f41e6..41e7c3bc27 100644
--- a/xen/include/xen/vpci.h
+++ b/xen/include/xen/vpci.h
@@ -304,6 +304,12 @@ static inline bool __must_check vpci_process_pending(struct vcpu *v)
 }
 #endif
 
+static inline int __must_check vpci_reset_device(struct pci_dev *pdev)
+{
+    vpci_deassign_device(pdev);
+    return vpci_assign_device(pdev);
+}
+
 #endif
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 10 10:44:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Sep 2024 10:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.795368.1204705 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1snyMB-0002sn-B4; Tue, 10 Sep 2024 10:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 795368.1204705; Tue, 10 Sep 2024 10:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1snyMB-0002sf-8O; Tue, 10 Sep 2024 10:44:23 +0000
Received: by outflank-mailman (input) for mailman id 795368;
 Tue, 10 Sep 2024 10:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1snyMA-0002sY-HN
 for xen-changelog@lists.xenproject.org; Tue, 10 Sep 2024 10:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1snyMA-0005vT-Gd
 for xen-changelog@lists.xenproject.org; Tue, 10 Sep 2024 10:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1snyMA-0000IP-Fa
 for xen-changelog@lists.xenproject.org; Tue, 10 Sep 2024 10:44:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KyO5IzjGRPvrut3KrRFSt6xckUIg7VKRbYG7wf/eqSg=; b=eNMilyjHZh3DqyjKIOzdMGpVJD
	6xzeKVHFQHT/hAP1xFnVWkeVBXBr/8i+N6agjk3x1iNIJmGgbit3dPz7RSk7dXdTJhdCoDCJEr0+t
	FK1syzMCIkZghSANP2oBOj7CenBqO9pXbrsOQJ6H6Y95DbsNjUmN3XnOwDsfjdnVonKM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/time: introduce helper to fetch Xen wallclock when running as a guest
Message-Id: <E1snyMA-0000IP-Fa@xenbits.xenproject.org>
Date: Tue, 10 Sep 2024 10:44:22 +0000

commit 9f16d4e65342668a573e06b7517a4bc3ea8a65f2
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Sep 9 13:41:16 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 9 13:41:16 2024 +0200

    x86/time: introduce helper to fetch Xen wallclock when running as a guest
    
    Move the current code in get_wallclock_time() to fetch the Xen wallclock
    information from the shared page when running as a guest into a separate
    helper.
    
    No functional change intended.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/time.c | 42 +++++++++++++++++++++++++-----------------
 1 file changed, 25 insertions(+), 17 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index a97d784841..3c4cd1b595 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -787,6 +787,30 @@ static struct platform_timesource __initdata_cf_clobber plt_xen_timer =
 };
 #endif
 
+static unsigned long read_xen_wallclock(void)
+{
+#ifdef CONFIG_XEN_GUEST
+    const struct shared_info *sh_info = XEN_shared_info;
+    uint32_t wc_version;
+    uint64_t wc_sec;
+
+    ASSERT(xen_guest);
+
+    do {
+        wc_version = sh_info->wc_version & ~1;
+        smp_rmb();
+
+        wc_sec  = sh_info->wc_sec;
+        smp_rmb();
+    } while ( wc_version != sh_info->wc_version );
+
+    return wc_sec + read_xen_timer() / 1000000000;
+#else
+    ASSERT_UNREACHABLE();
+    return 0;
+#endif
+}
+
 #ifdef CONFIG_HYPERV_GUEST
 /************************************************************
  * HYPER-V REFERENCE TSC
@@ -1497,24 +1521,8 @@ void rtc_guest_write(unsigned int port, unsigned int data)
 
 static unsigned long get_wallclock_time(void)
 {
-#ifdef CONFIG_XEN_GUEST
     if ( xen_guest )
-    {
-        struct shared_info *sh_info = XEN_shared_info;
-        uint32_t wc_version;
-        uint64_t wc_sec;
-
-        do {
-            wc_version = sh_info->wc_version & ~1;
-            smp_rmb();
-
-            wc_sec  = sh_info->wc_sec;
-            smp_rmb();
-        } while ( wc_version != sh_info->wc_version );
-
-        return wc_sec + read_xen_timer() / 1000000000;
-    }
-#endif
+        return read_xen_wallclock();
 
     return get_cmos_time();
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 10 10:44:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Sep 2024 10:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.795369.1204709 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1snyML-0002vZ-CJ; Tue, 10 Sep 2024 10:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 795369.1204709; Tue, 10 Sep 2024 10:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1snyML-0002vP-9m; Tue, 10 Sep 2024 10:44:33 +0000
Received: by outflank-mailman (input) for mailman id 795369;
 Tue, 10 Sep 2024 10:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1snyMK-0002vA-LR
 for xen-changelog@lists.xenproject.org; Tue, 10 Sep 2024 10:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1snyMK-0005vl-Jx
 for xen-changelog@lists.xenproject.org; Tue, 10 Sep 2024 10:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1snyMK-0000JP-Il
 for xen-changelog@lists.xenproject.org; Tue, 10 Sep 2024 10:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nNmuOo+JZK6sTCnjorvHTp8b85slLkbU+dH9wbCX6V4=; b=ac2xTy2i26QIjTUoTyTPts1HIN
	c2M84b1TnMNagWgBwVkOqEfcl1UV2waYFD3+00rF4oqNT/FtzMAeaoXMdQ7qTJW/H1IkqPr86ZdG6
	fQxcXuCww8DDmmiVqodRzhKUCIIUaM0DDLHAoDoBr0lf4Q9cgERgOEmOUqb/a5760mrQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/time: move CMOS edge detection into read helper
Message-Id: <E1snyMK-0000JP-Il@xenbits.xenproject.org>
Date: Tue, 10 Sep 2024 10:44:32 +0000

commit 91df743c45a5cca0de84e6ebe4651272c9656692
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Sep 9 13:41:48 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 9 13:41:48 2024 +0200

    x86/time: move CMOS edge detection into read helper
    
    Move the logic that ensures the CMOS RTC data is read just after it's been
    updated into the __get_cmos_time() function that does the register reads.  This
    requires returning a boolean from __get_cmos_time() to signal whether the read
    has been successfully performed after an update.
    
    Note that while __get_cmos_time() can be used without waiting for the update
    edge, so far the only caller does wait for it, hence move the code inside of
    the function.
    
    The goal, albeit not accomplished by this patch, is to be able to split the
    probing and the reading of the CMOS RTC data into two separate functions.
    
    No functional change intended.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/time.c | 50 ++++++++++++++++++++++++++------------------------
 1 file changed, 26 insertions(+), 24 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 3c4cd1b595..e55e76bd63 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1246,8 +1246,26 @@ struct rtc_time {
     unsigned int year, mon, day, hour, min, sec;
 };
 
-static void __get_cmos_time(struct rtc_time *rtc)
+static bool __get_cmos_time(struct rtc_time *rtc)
 {
+    s_time_t start, t1, t2;
+    unsigned long flags;
+
+    spin_lock_irqsave(&rtc_lock, flags);
+
+    /* read RTC exactly on falling edge of update flag */
+    start = NOW();
+    do { /* may take up to 1 second... */
+        t1 = NOW() - start;
+    } while ( !(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP) &&
+              t1 <= SECONDS(1) );
+
+    start = NOW();
+    do { /* must try at least 2.228 ms */
+        t2 = NOW() - start;
+    } while ( (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP) &&
+              t2 < MILLISECS(3) );
+
     rtc->sec  = CMOS_READ(RTC_SECONDS);
     rtc->min  = CMOS_READ(RTC_MINUTES);
     rtc->hour = CMOS_READ(RTC_HOURS);
@@ -1265,13 +1283,17 @@ static void __get_cmos_time(struct rtc_time *rtc)
         BCD_TO_BIN(rtc->year);
     }
 
+    spin_unlock_irqrestore(&rtc_lock, flags);
+
     if ( (rtc->year += 1900) < 1970 )
         rtc->year += 100;
+
+    return t1 <= SECONDS(1) && t2 < MILLISECS(3);
 }
 
 static unsigned long get_cmos_time(void)
 {
-    unsigned long res, flags;
+    unsigned long res;
     struct rtc_time rtc;
     unsigned int seconds = 60;
     static bool __read_mostly cmos_rtc_probe;
@@ -1292,29 +1314,9 @@ static unsigned long get_cmos_time(void)
 
     for ( ; ; )
     {
-        s_time_t start, t1, t2;
-
-        spin_lock_irqsave(&rtc_lock, flags);
-
-        /* read RTC exactly on falling edge of update flag */
-        start = NOW();
-        do { /* may take up to 1 second... */
-            t1 = NOW() - start;
-        } while ( !(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP) &&
-                  t1 <= SECONDS(1) );
-
-        start = NOW();
-        do { /* must try at least 2.228 ms */
-            t2 = NOW() - start;
-        } while ( (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP) &&
-                  t2 < MILLISECS(3) );
-
-        __get_cmos_time(&rtc);
-
-        spin_unlock_irqrestore(&rtc_lock, flags);
+        bool success = __get_cmos_time(&rtc);
 
-        if ( likely(!cmos_rtc_probe) ||
-             t1 > SECONDS(1) || t2 >= MILLISECS(3) ||
+        if ( likely(!cmos_rtc_probe) || !success ||
              rtc.sec >= 60 || rtc.min >= 60 || rtc.hour >= 24 ||
              !rtc.day || rtc.day > 31 ||
              !rtc.mon || rtc.mon > 12 )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 10 10:44:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Sep 2024 10:44:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.795370.1204712 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1snyMV-0002yh-E7; Tue, 10 Sep 2024 10:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 795370.1204712; Tue, 10 Sep 2024 10:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1snyMV-0002yb-BJ; Tue, 10 Sep 2024 10:44:43 +0000
Received: by outflank-mailman (input) for mailman id 795370;
 Tue, 10 Sep 2024 10:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1snyMU-0002yR-OI
 for xen-changelog@lists.xenproject.org; Tue, 10 Sep 2024 10:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1snyMU-0005wE-Nf
 for xen-changelog@lists.xenproject.org; Tue, 10 Sep 2024 10:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1snyMU-0000M0-MR
 for xen-changelog@lists.xenproject.org; Tue, 10 Sep 2024 10:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2nFFBR9+qDqyIIEoWoopois0DMLn42zeE/gaSC8EDP0=; b=b8V1e1+BcLxPlD3dNrajPDV/jg
	fZou1w92EuaJnOnIs/XMHUzIGJtwNd+A/27xYLD9nZushttu3ppFsZqnj5p9gGw/TsvYddOpwb/mj
	h89nR/F/lo4nxwqY2N1w4uMhHjvwSkBCCGkrDRt+FMpIV1fQprOcLaCA2bJtcTaVmOQs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/time: split CMOS read and probe logic into function
Message-Id: <E1snyMU-0000M0-MR@xenbits.xenproject.org>
Date: Tue, 10 Sep 2024 10:44:42 +0000

commit 413c25e03e4c6d140b65cd01e8c36c28af6dbed6
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Sep 9 13:42:17 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 9 13:42:17 2024 +0200

    x86/time: split CMOS read and probe logic into function
    
    The current logic to probe for the CMOS RTC is open-coded in get_cmos_time(),
    move it to a separate function that both serves the purpose of testing for the
    CMOS RTC existence and returning its value.
    
    The goal is to be able to split the probing and the reading logic into separate
    helpers, and putting the current logic in a separate function helps simplifying
    further changes.
    
    A transient *rtc_p variable is introduced as a parameter to the function, that
    will be removed by further changes.  Also note that due to the code movement,
    now cmos_rtc_probe will only get cleared on a second call to get_cmos_time(),
    as the newly introduced cmos_probe() function doesn't modify the variable
    anymore.
    
    No functional change intended.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/time.c | 59 +++++++++++++++++++++++++++++++----------------------
 1 file changed, 35 insertions(+), 24 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index e55e76bd63..f37300946e 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1291,45 +1291,32 @@ static bool __get_cmos_time(struct rtc_time *rtc)
     return t1 <= SECONDS(1) && t2 < MILLISECS(3);
 }
 
-static unsigned long get_cmos_time(void)
+static bool cmos_probe(struct rtc_time *rtc_p, bool cmos_rtc_probe)
 {
-    unsigned long res;
-    struct rtc_time rtc;
     unsigned int seconds = 60;
-    static bool __read_mostly cmos_rtc_probe;
-    boolean_param("cmos-rtc-probe", cmos_rtc_probe);
-
-    if ( efi_enabled(EFI_RS) )
-    {
-        res = efi_get_time();
-        if ( res )
-            return res;
-    }
-
-    if ( likely(!(acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_CMOS_RTC)) )
-        cmos_rtc_probe = false;
-    else if ( system_state < SYS_STATE_smp_boot && !cmos_rtc_probe )
-        panic("System with no CMOS RTC advertised must be booted from EFI"
-              " (or with command line option \"cmos-rtc-probe\")\n");
 
     for ( ; ; )
     {
-        bool success = __get_cmos_time(&rtc);
+        bool success = __get_cmos_time(rtc_p);
+        struct rtc_time rtc = *rtc_p;
 
-        if ( likely(!cmos_rtc_probe) || !success ||
+        if ( likely(!cmos_rtc_probe) )
+            return true;
+
+        if ( !success ||
              rtc.sec >= 60 || rtc.min >= 60 || rtc.hour >= 24 ||
              !rtc.day || rtc.day > 31 ||
              !rtc.mon || rtc.mon > 12 )
-            break;
+            return false;
 
         if ( seconds < 60 )
         {
             if ( rtc.sec != seconds )
             {
-                cmos_rtc_probe = false;
                 acpi_gbl_FADT.boot_flags &= ~ACPI_FADT_NO_CMOS_RTC;
+                return true;
             }
-            break;
+            return false;
         }
 
         process_pending_softirqs();
@@ -1337,7 +1324,31 @@ static unsigned long get_cmos_time(void)
         seconds = rtc.sec;
     }
 
-    if ( unlikely(cmos_rtc_probe) )
+    ASSERT_UNREACHABLE();
+    return false;
+}
+
+static unsigned long get_cmos_time(void)
+{
+    unsigned long res;
+    struct rtc_time rtc;
+    static bool __read_mostly cmos_rtc_probe;
+    boolean_param("cmos-rtc-probe", cmos_rtc_probe);
+
+    if ( efi_enabled(EFI_RS) )
+    {
+        res = efi_get_time();
+        if ( res )
+            return res;
+    }
+
+    if ( likely(!(acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_CMOS_RTC)) )
+        cmos_rtc_probe = false;
+    else if ( system_state < SYS_STATE_smp_boot && !cmos_rtc_probe )
+        panic("System with no CMOS RTC advertised must be booted from EFI"
+              " (or with command line option \"cmos-rtc-probe\")\n");
+
+    if ( !cmos_probe(&rtc, cmos_rtc_probe) )
         panic("No CMOS RTC found - system must be booted from EFI\n");
 
     return mktime(rtc.year, rtc.mon, rtc.day, rtc.hour, rtc.min, rtc.sec);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 10 10:44:53 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Sep 2024 10:44:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.795371.1204717 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1snyMf-00031y-HB; Tue, 10 Sep 2024 10:44:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 795371.1204717; Tue, 10 Sep 2024 10:44:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1snyMf-00031n-EC; Tue, 10 Sep 2024 10:44:53 +0000
Received: by outflank-mailman (input) for mailman id 795371;
 Tue, 10 Sep 2024 10:44:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1snyMe-00031e-RL
 for xen-changelog@lists.xenproject.org; Tue, 10 Sep 2024 10:44:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1snyMe-0005wP-QZ
 for xen-changelog@lists.xenproject.org; Tue, 10 Sep 2024 10:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1snyMe-0000Oa-Pl
 for xen-changelog@lists.xenproject.org; Tue, 10 Sep 2024 10:44:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=obbyHLYEHct2qa2cK5M4GfrlU5rMKjI6fRToPCy3keE=; b=Fu5uF6gH3tTBnoLX8VT8Gu5apA
	hdscviQMS4CIiG5olIMYDN6JHr10hV//Fu+nRv1N30NPCUgupCaxIWHb9sKj42pl0ilcC5ADopfkK
	Km+qNgz4TKgKk6mCr0Vi3tMtppXSmaQ76pWKR9o4k+ePcXS3kAUijmQXyqtXRBxBnqzM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Avoid usage of global in reloc.c
Message-Id: <E1snyMe-0000Oa-Pl@xenbits.xenproject.org>
Date: Tue, 10 Sep 2024 10:44:52 +0000

commit 71df9234431ec12ae8d658b29fd106e50a7e41a8
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Mon Sep 9 13:42:38 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 9 13:42:38 2024 +0200

    x86/boot: Avoid usage of global in reloc.c
    
    All code and data from this file will go into a text section
    which we want to not be writeable.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/boot/reloc.c | 67 ++++++++++++++++++++++++++---------------------
 1 file changed, 37 insertions(+), 30 deletions(-)

diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c
index 201e38d544..8c58affcd9 100644
--- a/xen/arch/x86/boot/reloc.c
+++ b/xen/arch/x86/boot/reloc.c
@@ -72,11 +72,18 @@ struct vesa_mode_info {
 #define get_mb2_data(tag, type, member)   (((const multiboot2_tag_##type##_t *)(tag))->member)
 #define get_mb2_string(tag, type, member) ((uint32_t)get_mb2_data(tag, type, member))
 
-static uint32_t alloc;
+typedef struct memctx {
+    /*
+     * Simple bump allocator.
+     *
+     * It starts from the base of the trampoline and allocates downwards.
+     */
+    uint32_t ptr;
+} memctx;
 
-static uint32_t alloc_mem(uint32_t bytes)
+static uint32_t alloc_mem(uint32_t bytes, memctx *ctx)
 {
-    return alloc -= ROUNDUP(bytes, 16);
+    return ctx->ptr -= ROUNDUP(bytes, 16);
 }
 
 static void zero_mem(uint32_t s, uint32_t bytes)
@@ -85,11 +92,11 @@ static void zero_mem(uint32_t s, uint32_t bytes)
         *(char *)s++ = 0;
 }
 
-static uint32_t copy_mem(uint32_t src, uint32_t bytes)
+static uint32_t copy_mem(uint32_t src, uint32_t bytes, memctx *ctx)
 {
     uint32_t dst, dst_ret;
 
-    dst = alloc_mem(bytes);
+    dst = alloc_mem(bytes, ctx);
     dst_ret = dst;
 
     while ( bytes-- )
@@ -98,7 +105,7 @@ static uint32_t copy_mem(uint32_t src, uint32_t bytes)
     return dst_ret;
 }
 
-static uint32_t copy_string(uint32_t src)
+static uint32_t copy_string(uint32_t src, memctx *ctx)
 {
     uint32_t p;
 
@@ -108,17 +115,17 @@ static uint32_t copy_string(uint32_t src)
     for ( p = src; *(char *)p != '\0'; p++ )
         continue;
 
-    return copy_mem(src, p - src + 1);
+    return copy_mem(src, p - src + 1, ctx);
 }
 
-static struct hvm_start_info *pvh_info_reloc(uint32_t in)
+static struct hvm_start_info *pvh_info_reloc(uint32_t in, memctx *ctx)
 {
     struct hvm_start_info *out;
 
-    out = _p(copy_mem(in, sizeof(*out)));
+    out = _p(copy_mem(in, sizeof(*out), ctx));
 
     if ( out->cmdline_paddr )
-        out->cmdline_paddr = copy_string(out->cmdline_paddr);
+        out->cmdline_paddr = copy_string(out->cmdline_paddr, ctx);
 
     if ( out->nr_modules )
     {
@@ -127,51 +134,51 @@ static struct hvm_start_info *pvh_info_reloc(uint32_t in)
 
         out->modlist_paddr =
             copy_mem(out->modlist_paddr,
-                     out->nr_modules * sizeof(struct hvm_modlist_entry));
+                     out->nr_modules * sizeof(struct hvm_modlist_entry), ctx);
 
         mods = _p(out->modlist_paddr);
 
         for ( i = 0; i < out->nr_modules; i++ )
         {
             if ( mods[i].cmdline_paddr )
-                mods[i].cmdline_paddr = copy_string(mods[i].cmdline_paddr);
+                mods[i].cmdline_paddr = copy_string(mods[i].cmdline_paddr, ctx);
         }
     }
 
     return out;
 }
 
-static multiboot_info_t *mbi_reloc(uint32_t mbi_in)
+static multiboot_info_t *mbi_reloc(uint32_t mbi_in, memctx *ctx)
 {
     int i;
     multiboot_info_t *mbi_out;
 
-    mbi_out = _p(copy_mem(mbi_in, sizeof(*mbi_out)));
+    mbi_out = _p(copy_mem(mbi_in, sizeof(*mbi_out), ctx));
 
     if ( mbi_out->flags & MBI_CMDLINE )
-        mbi_out->cmdline = copy_string(mbi_out->cmdline);
+        mbi_out->cmdline = copy_string(mbi_out->cmdline, ctx);
 
     if ( mbi_out->flags & MBI_MODULES )
     {
         module_t *mods;
 
         mbi_out->mods_addr = copy_mem(mbi_out->mods_addr,
-                                      mbi_out->mods_count * sizeof(module_t));
+                                      mbi_out->mods_count * sizeof(module_t), ctx);
 
         mods = _p(mbi_out->mods_addr);
 
         for ( i = 0; i < mbi_out->mods_count; i++ )
         {
             if ( mods[i].string )
-                mods[i].string = copy_string(mods[i].string);
+                mods[i].string = copy_string(mods[i].string, ctx);
         }
     }
 
     if ( mbi_out->flags & MBI_MEMMAP )
-        mbi_out->mmap_addr = copy_mem(mbi_out->mmap_addr, mbi_out->mmap_length);
+        mbi_out->mmap_addr = copy_mem(mbi_out->mmap_addr, mbi_out->mmap_length, ctx);
 
     if ( mbi_out->flags & MBI_LOADERNAME )
-        mbi_out->boot_loader_name = copy_string(mbi_out->boot_loader_name);
+        mbi_out->boot_loader_name = copy_string(mbi_out->boot_loader_name, ctx);
 
     /* Mask features we don't understand or don't relocate. */
     mbi_out->flags &= (MBI_MEMLIMITS |
@@ -183,7 +190,7 @@ static multiboot_info_t *mbi_reloc(uint32_t mbi_in)
     return mbi_out;
 }
 
-static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
+static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out, memctx *ctx)
 {
     const multiboot2_fixed_t *mbi_fix = _p(mbi_in);
     const multiboot2_memory_map_t *mmap_src;
@@ -197,7 +204,7 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
     uint32_t ptr;
     unsigned int i, mod_idx = 0;
 
-    ptr = alloc_mem(sizeof(*mbi_out));
+    ptr = alloc_mem(sizeof(*mbi_out), ctx);
     mbi_out = _p(ptr);
     zero_mem(ptr, sizeof(*mbi_out));
 
@@ -222,7 +229,7 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
          * __start_xen() may put Xen image placement into it.
          */
         mbi_out->mods_addr = alloc_mem((mbi_out->mods_count + 1) *
-                                       sizeof(*mbi_out_mods));
+                                       sizeof(*mbi_out_mods), ctx);
         mbi_out_mods = _p(mbi_out->mods_addr);
     }
 
@@ -238,13 +245,13 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
         case MULTIBOOT2_TAG_TYPE_BOOT_LOADER_NAME:
             mbi_out->flags |= MBI_LOADERNAME;
             ptr = get_mb2_string(tag, string, string);
-            mbi_out->boot_loader_name = copy_string(ptr);
+            mbi_out->boot_loader_name = copy_string(ptr, ctx);
             break;
 
         case MULTIBOOT2_TAG_TYPE_CMDLINE:
             mbi_out->flags |= MBI_CMDLINE;
             ptr = get_mb2_string(tag, string, string);
-            mbi_out->cmdline = copy_string(ptr);
+            mbi_out->cmdline = copy_string(ptr, ctx);
             break;
 
         case MULTIBOOT2_TAG_TYPE_BASIC_MEMINFO:
@@ -263,7 +270,7 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
             mbi_out->mmap_length /= get_mb2_data(tag, mmap, entry_size);
             mbi_out->mmap_length *= sizeof(*mmap_dst);
 
-            mbi_out->mmap_addr = alloc_mem(mbi_out->mmap_length);
+            mbi_out->mmap_addr = alloc_mem(mbi_out->mmap_length, ctx);
 
             mmap_src = get_mb2_data(tag, mmap, entries);
             mmap_dst = _p(mbi_out->mmap_addr);
@@ -290,7 +297,7 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
             mbi_out_mods[mod_idx].mod_start = get_mb2_data(tag, module, mod_start);
             mbi_out_mods[mod_idx].mod_end = get_mb2_data(tag, module, mod_end);
             ptr = get_mb2_string(tag, module, cmdline);
-            mbi_out_mods[mod_idx].string = copy_string(ptr);
+            mbi_out_mods[mod_idx].string = copy_string(ptr, ctx);
             mbi_out_mods[mod_idx].reserved = 0;
             ++mod_idx;
             break;
@@ -356,19 +363,19 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
 void *reloc(uint32_t magic, uint32_t in, uint32_t trampoline,
             uint32_t video_info)
 {
-    alloc = trampoline;
+    memctx ctx = { trampoline };
 
     switch ( magic )
     {
     case MULTIBOOT_BOOTLOADER_MAGIC:
-        return mbi_reloc(in);
+        return mbi_reloc(in, &ctx);
 
     case MULTIBOOT2_BOOTLOADER_MAGIC:
-        return mbi2_reloc(in, video_info);
+        return mbi2_reloc(in, video_info, &ctx);
 
     case XEN_HVM_START_MAGIC_VALUE:
         if ( IS_ENABLED(CONFIG_PVH_GUEST) )
-            return pvh_info_reloc(in);
+            return pvh_info_reloc(in, &ctx);
         /* Fallthrough */
 
     default:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 10 10:45:03 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Sep 2024 10:45:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.795373.1204720 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1snyMp-00034b-IJ; Tue, 10 Sep 2024 10:45:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 795373.1204720; Tue, 10 Sep 2024 10:45:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1snyMp-00034T-Fd; Tue, 10 Sep 2024 10:45:03 +0000
Received: by outflank-mailman (input) for mailman id 795373;
 Tue, 10 Sep 2024 10:45:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1snyMo-00034J-VT
 for xen-changelog@lists.xenproject.org; Tue, 10 Sep 2024 10:45:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1snyMo-0005xA-Uo
 for xen-changelog@lists.xenproject.org; Tue, 10 Sep 2024 10:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1snyMo-0000Px-Se
 for xen-changelog@lists.xenproject.org; Tue, 10 Sep 2024 10:45:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=T9cE1VX7Lw0YFLmWZrzhBC06rTL66doh0GVUJKGWHQY=; b=ZA+2v1N8VHI2XydYj7NQ0Lc6tF
	poBiyU9SiR5STgMNYuX3jS8dl28eb34RKdr691Mr/53Lzdrj90O3BboyQveTIpSipZS32rCUcHlQJ
	SXMqaNHxaENw+aKbM5ozxJThjNFxTRdp0jDl0bVhHvohNFa5gpqTWJJyRMWSWzcxHMp0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: fix type mismatch in read_atomic_size()
Message-Id: <E1snyMo-0000Px-Se@xenbits.xenproject.org>
Date: Tue, 10 Sep 2024 10:45:02 +0000

commit 4e56d0a9f9c5612c724299136c8ef55bc436419b
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Mon Sep 9 13:42:57 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 9 13:42:57 2024 +0200

    xen/riscv: fix type mismatch in read_atomic_size()
    
    Correct a typo in read_atomic_size() where a 64-bit result
    was incorrectly cast to a `uint32_t` instead of `uint64_t`
    in the case of 8-byte reads.
    
    Fixes: 3cd46d4ec8b9 ("xen/riscv: introduce atomic.h")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/atomic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/riscv/include/asm/atomic.h b/xen/arch/riscv/include/asm/atomic.h
index 31b91a79c8..41f03b2e0c 100644
--- a/xen/arch/riscv/include/asm/atomic.h
+++ b/xen/arch/riscv/include/asm/atomic.h
@@ -45,7 +45,7 @@ static always_inline void read_atomic_size(const volatile void *p,
     case 2: *(uint16_t *)res = readw(p); break;
     case 4: *(uint32_t *)res = readl(p); break;
 #ifndef CONFIG_RISCV_32
-    case 8: *(uint32_t *)res = readq(p); break;
+    case 8: *(uint64_t *)res = readq(p); break;
 #endif
     default: __bad_atomic_size(); break;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 10:11:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 10:11:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796392.1205963 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soKJV-0007Nh-9F; Wed, 11 Sep 2024 10:11:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796392.1205963; Wed, 11 Sep 2024 10:11:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soKJV-0007NZ-6a; Wed, 11 Sep 2024 10:11:05 +0000
Received: by outflank-mailman (input) for mailman id 796392;
 Wed, 11 Sep 2024 10:11:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soKJU-0007NT-4O
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 10:11:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soKJU-00086L-1o
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 10:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soKJU-0005ob-0k
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 10:11:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dahxozIvGTIIP/yfK/EX0kGS6OU7gNV6v8ET0gPpA7U=; b=AfqzmWTX6j5HTdm4mkl6IPjehb
	CsHp0SN3Qfuk1jkfB6UxAnI/J9k74D9pDb3jYYN/UmfeMoJXvKKyOnbW49g4GDxS/PbQtQByxAcQO
	IYY7C61edKu4Lzpi1mxf/ILcGcALiir3nXwExwzU/92cVqlJPj/GFDMv5KqZC2l9bM7Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arm/gicv3: Fix ICH_VTR_EL2.ListRegs mask
Message-Id: <E1soKJU-0005ob-0k@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 10:11:04 +0000

commit 3502c033f6d60e5fc944e66d7bd1c3c6456caae7
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Sep 3 14:21:47 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Sep 11 10:59:42 2024 +0100

    arm/gicv3: Fix ICH_VTR_EL2.ListRegs mask
    
    According to GIC spec IHI 0069H.b (12.4.9), the ListRegs field of
    ICH_VTR_EL2 can have value between 0b00000..0b01111, as there can
    be maximum 16 LRs (field value + 1). Fix the mask used to extract this
    value which wrongly assumes there can be 64 (case for GICv2).
    
    Fixes: bc183a0235e0 ("xen/arm: Add support for GIC v3")
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/include/asm/gic_v3_defs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/include/asm/gic_v3_defs.h b/xen/arch/arm/include/asm/gic_v3_defs.h
index 227533868f..2af093e774 100644
--- a/xen/arch/arm/include/asm/gic_v3_defs.h
+++ b/xen/arch/arm/include/asm/gic_v3_defs.h
@@ -189,7 +189,7 @@
 #define ICH_LR_GRP1                  (1ULL << 60)
 #define ICH_LR_HW                    (1ULL << 61)
 
-#define ICH_VTR_NRLRGS               0x3f
+#define ICH_VTR_NRLRGS               0xf
 #define ICH_VTR_PRIBITS_MASK         0x7
 #define ICH_VTR_PRIBITS_SHIFT        29
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 11:11:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 11:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796436.1205986 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soLFZ-0007T0-OF; Wed, 11 Sep 2024 11:11:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796436.1205986; Wed, 11 Sep 2024 11:11:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soLFZ-0007St-Lq; Wed, 11 Sep 2024 11:11:05 +0000
Received: by outflank-mailman (input) for mailman id 796436;
 Wed, 11 Sep 2024 11:11:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLFY-0007Sn-8m
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:11:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLFY-0000fU-69
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLFY-0001hV-4J
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:11:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=A7u8qsL3rMmVCHIqCVcNGsVdv7IYoiIT2gviy7vJ0QQ=; b=biKAr/JU0BKqLFmx5jri68+Plu
	SLM1R7Nn5crkKEtcvr/1ib329FhRjMfpflQeDqMrupUiT2drM+DMIW0K+OefJglJuM/RS4juR5bmT
	3E7rh0vXCT/RAh7A4ZtUOEyD5IypgvuvOKuxhk1QnTLrKXfq0qldSQBg3UJkWSSJ6MeM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/mm address violations of MISRA C:2012 Rule 5.3
Message-Id: <E1soLFY-0001hV-4J@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 11:11:04 +0000

commit 5b4664b9e4108ebf57c666662b675601d758a512
Author:     Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
AuthorDate: Wed Sep 11 12:52:15 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 11 12:52:15 2024 +0200

    x86/mm address violations of MISRA C:2012 Rule 5.3
    
    This addresses violations of MISRA C:2012 Rule 5.3 which states as
    following: An identifier declared in an inner scope shall not hide an
    identifier declared in an outer scope.
    
    In /x86/mm.c the object struct e820entry *e820 hides an identifier
    with the same name declared in x86/include/asm/e820.h.
    
    No functional change.
    
    Signed-off-by: Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index c735aaf0e8..d537a799bc 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -4708,7 +4708,7 @@ long arch_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
     {
         struct xen_foreign_memory_map fmap;
         struct domain *d;
-        struct e820entry *e820;
+        struct e820entry *e;
 
         if ( copy_from_guest(&fmap, arg, 1) )
             return -EFAULT;
@@ -4727,23 +4727,23 @@ long arch_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
             return rc;
         }
 
-        e820 = xmalloc_array(e820entry_t, fmap.map.nr_entries);
-        if ( e820 == NULL )
+        e = xmalloc_array(e820entry_t, fmap.map.nr_entries);
+        if ( e == NULL )
         {
             rcu_unlock_domain(d);
             return -ENOMEM;
         }
 
-        if ( copy_from_guest(e820, fmap.map.buffer, fmap.map.nr_entries) )
+        if ( copy_from_guest(e, fmap.map.buffer, fmap.map.nr_entries) )
         {
-            xfree(e820);
+            xfree(e);
             rcu_unlock_domain(d);
             return -EFAULT;
         }
 
         spin_lock(&d->arch.e820_lock);
         xfree(d->arch.e820);
-        d->arch.e820 = e820;
+        d->arch.e820 = e;
         d->arch.nr_e820 = fmap.map.nr_entries;
         spin_unlock(&d->arch.e820_lock);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 11:11:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 11:11:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796437.1205992 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soLFj-0007Uh-QJ; Wed, 11 Sep 2024 11:11:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796437.1205992; Wed, 11 Sep 2024 11:11:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soLFj-0007UZ-NC; Wed, 11 Sep 2024 11:11:15 +0000
Received: by outflank-mailman (input) for mailman id 796437;
 Wed, 11 Sep 2024 11:11:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLFi-0007UP-Av
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:11:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLFi-0000fb-A7
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:11:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLFi-0001i3-8G
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:11:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=M2JPBIFT+FUhEX8NLKxbauUjrklJp2ttL9O7OTbbX/M=; b=sd7wP5nPzGkHQZMWhhE06xi4HL
	Irx2sJus0NSdLNCDbB78RfeA7Hg8JXddeYaCydwmZEgNYpVKybwBO7kxp7XEsuJg9woYnUUeovihr
	hHHZOrHv/mbtRHAUc0jIFVxwohzhrHXkzcsIQKdN62uhEyabKGWw0lPlt+70FAw53yHI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/time: pull cmos_rtc_probe outside of function and rename
Message-Id: <E1soLFi-0001i3-8G@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 11:11:14 +0000

commit 6da090b4b7b913887d0079dff9e18a1abaebcd13
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Sep 11 12:52:57 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 11 12:52:57 2024 +0200

    x86/time: pull cmos_rtc_probe outside of function and rename
    
    Rename cmos_rtc_probe to opt_cmos_rtc_probe in order to better describe it
    being a command line option, and rename cmos_probe() function to
    cmos_rtc_probe().
    
    Also move opt_cmos_rtc_probe to being a static global variable in preparation
    for further changes that will require the variable being global to the file.
    
    No functional change intended.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/time.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index f37300946e..ec48805a22 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1291,7 +1291,10 @@ static bool __get_cmos_time(struct rtc_time *rtc)
     return t1 <= SECONDS(1) && t2 < MILLISECS(3);
 }
 
-static bool cmos_probe(struct rtc_time *rtc_p, bool cmos_rtc_probe)
+static bool __read_mostly opt_cmos_rtc_probe;
+boolean_param("cmos-rtc-probe", opt_cmos_rtc_probe);
+
+static bool cmos_rtc_probe(struct rtc_time *rtc_p)
 {
     unsigned int seconds = 60;
 
@@ -1300,7 +1303,7 @@ static bool cmos_probe(struct rtc_time *rtc_p, bool cmos_rtc_probe)
         bool success = __get_cmos_time(rtc_p);
         struct rtc_time rtc = *rtc_p;
 
-        if ( likely(!cmos_rtc_probe) )
+        if ( likely(!opt_cmos_rtc_probe) )
             return true;
 
         if ( !success ||
@@ -1332,8 +1335,6 @@ static unsigned long get_cmos_time(void)
 {
     unsigned long res;
     struct rtc_time rtc;
-    static bool __read_mostly cmos_rtc_probe;
-    boolean_param("cmos-rtc-probe", cmos_rtc_probe);
 
     if ( efi_enabled(EFI_RS) )
     {
@@ -1343,12 +1344,12 @@ static unsigned long get_cmos_time(void)
     }
 
     if ( likely(!(acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_CMOS_RTC)) )
-        cmos_rtc_probe = false;
-    else if ( system_state < SYS_STATE_smp_boot && !cmos_rtc_probe )
+        opt_cmos_rtc_probe = false;
+    else if ( system_state < SYS_STATE_smp_boot && !opt_cmos_rtc_probe )
         panic("System with no CMOS RTC advertised must be booted from EFI"
               " (or with command line option \"cmos-rtc-probe\")\n");
 
-    if ( !cmos_probe(&rtc, cmos_rtc_probe) )
+    if ( !cmos_rtc_probe(&rtc) )
         panic("No CMOS RTC found - system must be booted from EFI\n");
 
     return mktime(rtc.year, rtc.mon, rtc.day, rtc.hour, rtc.min, rtc.sec);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 11:11:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 11:11:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796438.1205995 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soLFt-0007XA-Rm; Wed, 11 Sep 2024 11:11:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796438.1205995; Wed, 11 Sep 2024 11:11:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soLFt-0007X3-Od; Wed, 11 Sep 2024 11:11:25 +0000
Received: by outflank-mailman (input) for mailman id 796438;
 Wed, 11 Sep 2024 11:11:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLFs-0007Wm-E9
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:11:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLFs-0000fm-DO
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:11:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLFs-0001iz-CI
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:11:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ocG63qtQOrvVwchWTOY+hBJFu8Yp427q52cODpZmkjc=; b=BLcpGVDU/VhoA3ETXLEllbhQGW
	MiV7vg6bmPP12RSKU2sOnVlGgTTeY7xg++AZlxS4qxCxsgV4UfBY+IMRoen4Bgm7C53/XfaUkT4Wo
	4irQMBFaCktX2lZT0bw7ztfUpC6l+1Pe2UlAafzLEQ/CmkWWAO77YQRHnNIC6psvbUh4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/time: introduce probing logic for the wallclock
Message-Id: <E1soLFs-0001iz-CI@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 11:11:24 +0000

commit cb4f22884e77c6bcfaa5f4be984b62106ea7c0d4
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Sep 11 12:53:17 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 11 12:53:17 2024 +0200

    x86/time: introduce probing logic for the wallclock
    
    Adding such probing allows to clearly separate init vs runtime code, and to
    place the probing logic into the init section for the CMOS case.  Note both
    the Xen shared_info page wallclock, and the EFI wallclock don't really have any
    probing-specific logic.  The shared_info wallclock will always be there if
    booted as a Xen guest, while the EFI_GET_TIME method probing relies on checking
    if it returns a value different than 0.
    
    The panic message printed when Xen is unable to find a viable wallclock source
    has been adjusted slightly, I believe the printed guidance still provides the
    same amount of information to the user.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/time.c | 118 ++++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 92 insertions(+), 26 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index ec48805a22..1dcbd9f520 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1291,20 +1291,23 @@ static bool __get_cmos_time(struct rtc_time *rtc)
     return t1 <= SECONDS(1) && t2 < MILLISECS(3);
 }
 
-static bool __read_mostly opt_cmos_rtc_probe;
+static bool __initdata opt_cmos_rtc_probe;
 boolean_param("cmos-rtc-probe", opt_cmos_rtc_probe);
 
-static bool cmos_rtc_probe(struct rtc_time *rtc_p)
+static bool __init cmos_rtc_probe(void)
 {
     unsigned int seconds = 60;
 
+    if ( !(acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_CMOS_RTC) )
+        return true;
+
+    if ( !opt_cmos_rtc_probe )
+        return false;
+
     for ( ; ; )
     {
-        bool success = __get_cmos_time(rtc_p);
-        struct rtc_time rtc = *rtc_p;
-
-        if ( likely(!opt_cmos_rtc_probe) )
-            return true;
+        struct rtc_time rtc;
+        bool success = __get_cmos_time(&rtc);
 
         if ( !success ||
              rtc.sec >= 60 || rtc.min >= 60 || rtc.hour >= 24 ||
@@ -1331,26 +1334,12 @@ static bool cmos_rtc_probe(struct rtc_time *rtc_p)
     return false;
 }
 
-static unsigned long get_cmos_time(void)
+
+static unsigned long cmos_rtc_read(void)
 {
-    unsigned long res;
     struct rtc_time rtc;
 
-    if ( efi_enabled(EFI_RS) )
-    {
-        res = efi_get_time();
-        if ( res )
-            return res;
-    }
-
-    if ( likely(!(acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_CMOS_RTC)) )
-        opt_cmos_rtc_probe = false;
-    else if ( system_state < SYS_STATE_smp_boot && !opt_cmos_rtc_probe )
-        panic("System with no CMOS RTC advertised must be booted from EFI"
-              " (or with command line option \"cmos-rtc-probe\")\n");
-
-    if ( !cmos_rtc_probe(&rtc) )
-        panic("No CMOS RTC found - system must be booted from EFI\n");
+    __get_cmos_time(&rtc);
 
     return mktime(rtc.year, rtc.mon, rtc.day, rtc.hour, rtc.min, rtc.sec);
 }
@@ -1533,12 +1522,85 @@ void rtc_guest_write(unsigned int port, unsigned int data)
     }
 }
 
-static unsigned long get_wallclock_time(void)
+static enum {
+    WALLCLOCK_UNSET,
+    WALLCLOCK_XEN,
+    WALLCLOCK_CMOS,
+    WALLCLOCK_EFI,
+} wallclock_source __ro_after_init;
+
+static const char *__init wallclock_type_to_string(void)
+{
+    switch ( wallclock_source )
+    {
+    case WALLCLOCK_XEN:
+        return "XEN";
+
+    case WALLCLOCK_CMOS:
+        return "CMOS RTC";
+
+    case WALLCLOCK_EFI:
+        return "EFI";
+
+    case WALLCLOCK_UNSET:
+        return "UNSET";
+    }
+
+    ASSERT_UNREACHABLE();
+    return "";
+}
+
+static void __init probe_wallclock(void)
 {
+    ASSERT(wallclock_source == WALLCLOCK_UNSET);
+
     if ( xen_guest )
+    {
+        wallclock_source = WALLCLOCK_XEN;
+        return;
+    }
+    if ( efi_enabled(EFI_RS) && efi_get_time() )
+    {
+        wallclock_source = WALLCLOCK_EFI;
+        return;
+    }
+    if ( cmos_rtc_probe() )
+    {
+        wallclock_source = WALLCLOCK_CMOS;
+        return;
+    }
+
+    panic("No usable wallclock found, probed:%s%s%s\n%s",
+          !opt_cmos_rtc_probe && !efi_enabled(EFI_RS) ? " None" : "",
+          opt_cmos_rtc_probe ? " CMOS" : "",
+          efi_enabled(EFI_RS) ? " EFI" : "",
+          !opt_cmos_rtc_probe
+              ? "Try with command line option \"cmos-rtc-probe\"\n"
+              : !efi_enabled(EFI_RS)
+                  ? "System must be booted from EFI\n"
+                  : "");
+}
+
+static unsigned long get_wallclock_time(void)
+{
+    switch ( wallclock_source )
+    {
+    case WALLCLOCK_XEN:
         return read_xen_wallclock();
 
-    return get_cmos_time();
+    case WALLCLOCK_CMOS:
+        return cmos_rtc_read();
+
+    case WALLCLOCK_EFI:
+        return efi_get_time();
+
+    case WALLCLOCK_UNSET:
+        /* Unexpected state - handled by the ASSERT_UNREACHABLE() below. */
+        break;
+    }
+
+    ASSERT_UNREACHABLE();
+    return 0;
 }
 
 /***************************************************************************
@@ -2463,6 +2525,10 @@ int __init init_xen_time(void)
 
     open_softirq(TIME_CALIBRATE_SOFTIRQ, local_time_calibration);
 
+    probe_wallclock();
+
+    printk(XENLOG_INFO "Wallclock source: %s\n", wallclock_type_to_string());
+
     /* NB. get_wallclock_time() can take over one second to execute. */
     do_settime(get_wallclock_time(), 0, NOW());
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 11:11:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 11:11:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796439.1205998 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soLG3-0007Zx-Sg; Wed, 11 Sep 2024 11:11:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796439.1205998; Wed, 11 Sep 2024 11:11:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soLG3-0007Zp-Q3; Wed, 11 Sep 2024 11:11:35 +0000
Received: by outflank-mailman (input) for mailman id 796439;
 Wed, 11 Sep 2024 11:11:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLG2-0007Ze-IZ
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:11:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLG2-0000ft-GP
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:11:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLG2-0001ja-FS
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:11:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=o4XWn/UjXZeBjSf7OMgYOLuj/3fQxVSn+i0Uk3qXtok=; b=A3DVjye2peLXrWkF7Dro9tG5Wz
	cCNdJZ5HIbLdXopKB76/2e3hNx+KEIGyRvHSOSipBZDvQu7m/VcBdAsnFlo3tTPXjklL8eB5b0IZb
	dzFZ3QL1mqtcvdxBjOIQJTr6+Al+9OQzyVdXUHMbVjsO6g7orCcSMoCq5P81G6Yt5yxk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/cpufreq: address MISRA Rule 7.3 violation
Message-Id: <E1soLG2-0001ja-FS@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 11:11:34 +0000

commit 233ee468bbe05ec453020bbd4b556f46d041bf21
Author:     Nicola Vetrini <nicola.vetrini@bugseng.com>
AuthorDate: Wed Sep 11 12:53:38 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 11 12:53:38 2024 +0200

    x86/cpufreq: address MISRA Rule 7.3 violation
    
    Rule 7.3 states:
    "The lowercase character l shall not be used in a literal suffix",
    but the INTEL_MSR_RANGE macro uses the "ull" suffix.
    The "u" is transformed in uppercase for consistency.
    
    No functional change.
    
    Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/acpi/cpufreq/acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/acpi/cpufreq/acpi.c b/xen/arch/x86/acpi/cpufreq/acpi.c
index c6d7d02faa..0c25376406 100644
--- a/xen/arch/x86/acpi/cpufreq/acpi.c
+++ b/xen/arch/x86/acpi/cpufreq/acpi.c
@@ -25,7 +25,7 @@ enum {
     SYSTEM_IO_CAPABLE,
 };
 
-#define INTEL_MSR_RANGE         (0xffffull)
+#define INTEL_MSR_RANGE         0xffffULL
 
 static bool __read_mostly acpi_pstate_strict;
 boolean_param("acpi_pstate_strict", acpi_pstate_strict);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 11:11:46 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 11:11:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796440.1206002 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soLGD-0007cp-U6; Wed, 11 Sep 2024 11:11:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796440.1206002; Wed, 11 Sep 2024 11:11:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soLGD-0007ch-RR; Wed, 11 Sep 2024 11:11:45 +0000
Received: by outflank-mailman (input) for mailman id 796440;
 Wed, 11 Sep 2024 11:11:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLGC-0007cX-KD
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:11:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLGC-0000g0-JR
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:11:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLGC-0001k7-IU
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:11:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yMI7hKe+/f0yXGemIalGQxKGwWOxG6Si0WTegc+Z/zI=; b=M3UYRNbL370fttVyYaewTpfiU6
	uCcTlwkbXb5/dq6ERJF2abYvs4L4pQJWaflEDdsuKlgAixP7KJSJQuuSE5qEz1JxmIjeQGCXavG7N
	vOlL9F4ea5+xcSTNPGox9+rmTrMyzqy7Rx0UTIx0MG9GkzNvVJ/PAUdQYgGXCe/Ejilg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/APIC: address violation of MISRA C Rule 21.2
Message-Id: <E1soLGC-0001k7-IU@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 11:11:44 +0000

commit 09217c2618b85c783585946ef23f409c19813bb4
Author:     Nicola Vetrini <nicola.vetrini@bugseng.com>
AuthorDate: Wed Sep 11 12:54:00 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 11 12:54:00 2024 +0200

    x86/APIC: address violation of MISRA C Rule 21.2
    
    The rule disallows the usage of an identifier reserved by the C standard.
    All identfiers starting with '__' are reserved for any use, so the label
    can be renamed in order to avoid the violation.
    
    No functional change.
    
    Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Signed-off-by: Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/apic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index e077bf7edc..254ab5d388 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -925,7 +925,7 @@ void __init init_apic_mappings(void)
     unsigned long apic_phys;
 
     if ( x2apic_enabled )
-        goto __next;
+        goto next;
     /*
      * If no local APIC can be found then set up a fake all
      * zeroes page to simulate the local APIC and another
@@ -941,7 +941,7 @@ void __init init_apic_mappings(void)
     apic_printk(APIC_VERBOSE, "mapped APIC to %p (%08lx)\n",
                 fix_to_virt(FIX_APIC_BASE), apic_phys);
 
-__next:
+ next:
     /*
      * Fetch the APIC ID of the BSP in case we have a
      * default configuration (or the MP table is broken).
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 11:11:56 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 11:11:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796441.1206007 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soLGN-0007h6-Vl; Wed, 11 Sep 2024 11:11:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796441.1206007; Wed, 11 Sep 2024 11:11:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soLGN-0007gy-Sr; Wed, 11 Sep 2024 11:11:55 +0000
Received: by outflank-mailman (input) for mailman id 796441;
 Wed, 11 Sep 2024 11:11:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLGM-0007gl-N7
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:11:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLGM-0000gR-MO
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:11:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLGM-0001ka-LX
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:11:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EGEy7jHj73l7jpJ4+K1X9SqiNtjAvuiVKZkftiQDigM=; b=YcY/APTI3JlP6X0s+vGu7ebY4r
	iniy+TUMPWm1/M+uIP6dMpZcxb+j/xnCPKBWaiZ1NlJ9qj+Zh4Gmzgeq5o/kkXflLexdKI8le1v1/
	sGqjWJD1oijK3RMIIrQVOh+Gx2EVmNGPKcHfdNV8l2D62dAQAb9O1zZYcBrRssLHel2Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/psr: address violation of MISRA C Rule 16.3
Message-Id: <E1soLGM-0001ka-LX@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 11:11:54 +0000

commit 76529a1ce1ea81bfd14ef3bc69f999f2df18d1da
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Wed Sep 11 12:54:22 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 11 12:54:22 2024 +0200

    x86/psr: address violation of MISRA C Rule 16.3
    
    Address a violation of MISRA C:2012 Rule 16.3:
    "An unconditional `break' statement shall terminate every
    switch-clause".
    
    No functional change.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/psr.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c
index 0b9631ac44..5815a35335 100644
--- a/xen/arch/x86/psr.c
+++ b/xen/arch/x86/psr.c
@@ -276,6 +276,7 @@ static enum psr_feat_type psr_type_to_feat_type(enum psr_type type)
 
     default:
         ASSERT_UNREACHABLE();
+        break;
     }
 
     return feat_type;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 11:12:06 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 11:12:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796442.1206011 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soLGY-0007kK-2h; Wed, 11 Sep 2024 11:12:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796442.1206011; Wed, 11 Sep 2024 11:12:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soLGY-0007kC-01; Wed, 11 Sep 2024 11:12:06 +0000
Received: by outflank-mailman (input) for mailman id 796442;
 Wed, 11 Sep 2024 11:12:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLGW-0007k2-R5
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:12:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLGW-0000gl-Pb
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:12:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLGW-0001lq-Ob
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:12:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fENSORo897KtXcA7G9LaR5VDkVjgDZM8cGeEECvUnKU=; b=iElNsosCZgqe8Mw2MUKw1Fv/0V
	WtLGXeShsyIsrwH+oTP6qK44o16cAWIBs39dZrbK9UnLzbXJXKF1VFpzSyVvnxC9QyPtRGw8V4nUJ
	OQFkF2uCvPKuDqyHIXU2IrVgk7K6NZVszzdinqmhPvk8NZNaQ/bU/4ps4rZh1eD+ZbqI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/time: address violations of MISRA C Rule 16.3
Message-Id: <E1soLGW-0001lq-Ob@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 11:12:04 +0000

commit b3173a25ba8b766e4cba701d79333935d8ccf3c2
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Wed Sep 11 12:54:52 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 11 12:54:52 2024 +0200

    x86/time: address violations of MISRA C Rule 16.3
    
    Address violations of MISRA C:2012 Rule 16.3:
    "An unconditional `break' statement shall terminate every
    switch-clause".
    
    No functional change.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/time.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 1dcbd9f520..9588502f28 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1467,6 +1467,7 @@ unsigned int rtc_guest_read(unsigned int port)
 
     default:
         ASSERT_UNREACHABLE();
+        break;
     }
 
     return data;
@@ -1519,6 +1520,7 @@ void rtc_guest_write(unsigned int port, unsigned int data)
 
     default:
         ASSERT_UNREACHABLE();
+        break;
     }
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 11:12:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 11:12:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796443.1206015 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soLGi-0007mu-48; Wed, 11 Sep 2024 11:12:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796443.1206015; Wed, 11 Sep 2024 11:12:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soLGi-0007mn-1N; Wed, 11 Sep 2024 11:12:16 +0000
Received: by outflank-mailman (input) for mailman id 796443;
 Wed, 11 Sep 2024 11:12:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLGg-0007mf-T9
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:12:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLGg-0000gu-SW
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:12:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLGg-0001mW-Rc
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:12:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Y+nEgFCqn4kl59MQTn6w7Z8Sse4YypDhyldtyH/hWhk=; b=ZMXndbbTTkfB9WNB7jXrrGpx+I
	30Ryud3E9KXA03L3SuwyR5NT5PrEF9HDSxe6lKPrWs0nwH2mkhRAXuYp/apM17Wjy+VfAr4ee+5wa
	/9xJqwdqxSJqkGSQQ8gzz7Zb413d9Hs8+T7MS0il+bV4Y29j5YD9XB/mHjfcjuNw+0qA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vm_event: address violation of MISRA C Rule 16.3
Message-Id: <E1soLGg-0001mW-Rc@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 11:12:14 +0000

commit a42c3ec62f2036fcc953dd4a3980bc7b36b8fd3f
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Wed Sep 11 12:55:14 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 11 12:55:14 2024 +0200

    x86/vm_event: address violation of MISRA C Rule 16.3
    
    Address a violation of MISRA C:2012 Rule 16.3:
    "An unconditional `break' statement shall terminate every
    switch-clause".
    
    No functional change.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
---
 xen/arch/x86/vm_event.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/vm_event.c b/xen/arch/x86/vm_event.c
index e6c7ad5337..0d15d363c3 100644
--- a/xen/arch/x86/vm_event.c
+++ b/xen/arch/x86/vm_event.c
@@ -190,6 +190,7 @@ static void vm_event_pack_segment_register(enum x86_segment segment,
 
     default:
         ASSERT_UNREACHABLE();
+        break;
     }
 }
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 11:12:27 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 11:12:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796444.1206019 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soLGt-0007pO-5h; Wed, 11 Sep 2024 11:12:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796444.1206019; Wed, 11 Sep 2024 11:12:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soLGt-0007pF-34; Wed, 11 Sep 2024 11:12:27 +0000
Received: by outflank-mailman (input) for mailman id 796444;
 Wed, 11 Sep 2024 11:12:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLGr-0007p0-1X
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:12:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLGr-0000iZ-0h
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:12:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLGq-0001na-V7
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:12:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hMayOMsMtjCQZTJkXPSZCGDSdZVE3NZdkaJU4sK8wcc=; b=JbU585tHAv/wBVGJRWe17N65Sn
	BhcieInX1/Eq6hVF6nwQL5sYgIm1twisLiZxP/MuKoco09PgT11w67AHHO4IuzWqYtg3/uPqYs3EI
	9mXbjlwPXT8vqzySlo2mGCj4MtzLwZR6XliNS8+MnoS3Tu4loQdBBKYGZGR/FyCfN41A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/hypercall: address violations of MISRA C Rule 16.3
Message-Id: <E1soLGq-0001na-V7@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 11:12:24 +0000

commit c4fe5296e614a8d5b1d195d70dec257c5a67cc97
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Wed Sep 11 12:55:35 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 11 12:55:35 2024 +0200

    x86/hypercall: address violations of MISRA C Rule 16.3
    
    Address violations of MISRA C:2012 Rule 16.3:
    "An unconditional `break' statement shall terminate every
    switch-clause".
    
    No functional change.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/hypercall.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/hypercall.h b/xen/arch/x86/include/asm/hypercall.h
index 389fa62af2..f6e9e2313b 100644
--- a/xen/arch/x86/include/asm/hypercall.h
+++ b/xen/arch/x86/include/asm/hypercall.h
@@ -55,7 +55,7 @@ static inline void clobber_regs64(struct cpu_user_regs *regs,
     case 4: regs->r10 = 0xdeadbeefdeadf00dUL; fallthrough;
     case 3: regs->rdx = 0xdeadbeefdeadf00dUL; fallthrough;
     case 2: regs->rsi = 0xdeadbeefdeadf00dUL; fallthrough;
-    case 1: regs->rdi = 0xdeadbeefdeadf00dUL;
+    case 1: regs->rdi = 0xdeadbeefdeadf00dUL; break;
     }
 #endif
 }
@@ -71,7 +71,7 @@ static inline void clobber_regs32(struct cpu_user_regs *regs,
     case 4: regs->esi = 0xdeadf00dU; fallthrough;
     case 3: regs->edx = 0xdeadf00dU; fallthrough;
     case 2: regs->ecx = 0xdeadf00dU; fallthrough;
-    case 1: regs->ebx = 0xdeadf00dU;
+    case 1: regs->ebx = 0xdeadf00dU; break;
     }
 #endif
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 11:12:36 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 11:12:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796445.1206023 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soLH2-0007rw-7N; Wed, 11 Sep 2024 11:12:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796445.1206023; Wed, 11 Sep 2024 11:12:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soLH2-0007rm-4m; Wed, 11 Sep 2024 11:12:36 +0000
Received: by outflank-mailman (input) for mailman id 796445;
 Wed, 11 Sep 2024 11:12:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLH1-0007rg-4d
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:12:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLH1-0000ii-3s
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:12:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLH1-0001o7-2x
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:12:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ROYgfT4ZJyTevBO1HikRh6R5qIVXoq64TtmtdSHcrK8=; b=Mf8LgNmIqSaOZQcefjiqHHTKkP
	nRm72Otaj6erTLfJfjZSjogQvmvIXquyTZyTpFPvWS5bCtyQFVMHIWo8kEbvx55Nvs73W/1xsGqz5
	Co4LLbgFZTlY5kT67/65Pz+7J1D1En2N7JDRcYUz2+9p9K8wXX+stfEoH+uox52NR4Wo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/monitor: address violation of MISRA C Rule 16.3
Message-Id: <E1soLH1-0001o7-2x@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 11:12:35 +0000

commit 6f5b873600ec5678d5fcaaa5ff047514a6721392
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Wed Sep 11 12:56:03 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 11 12:56:03 2024 +0200

    x86/monitor: address violation of MISRA C Rule 16.3
    
    Address a violation of MISRA C:2012 Rule 16.3:
    "An unconditional `break' statement shall terminate every
    switch-clause".
    
    No functional change.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
---
 xen/arch/x86/include/asm/monitor.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/include/asm/monitor.h b/xen/arch/x86/include/asm/monitor.h
index 96e6a9d0d8..3c64d8258f 100644
--- a/xen/arch/x86/include/asm/monitor.h
+++ b/xen/arch/x86/include/asm/monitor.h
@@ -65,6 +65,7 @@ int arch_monitor_domctl_op(struct domain *d, struct xen_domctl_monitor_op *mop)
 
     default:
         rc = -EOPNOTSUPP;
+        break;
     }
 
     return rc;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 11:12:46 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 11:12:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796446.1206027 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soLHC-0007uZ-8k; Wed, 11 Sep 2024 11:12:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796446.1206027; Wed, 11 Sep 2024 11:12:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soLHC-0007uS-67; Wed, 11 Sep 2024 11:12:46 +0000
Received: by outflank-mailman (input) for mailman id 796446;
 Wed, 11 Sep 2024 11:12:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLHB-0007uI-7e
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:12:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLHB-0000j2-6z
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:12:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLHB-0001oe-66
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:12:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PwoMBBZ18PqsLrw9CVmleHRfn+XF5ceOCKZgqqLizas=; b=LvX/cbdHOQfJKV8E30YOUJQ8dG
	0HqFnYVnuOh9/WAJR/3KFFuquOjShIHAxc6BMXVyAsX21gLl8ZcDNbIqUepuw/9HP16Lp2BnA949l
	x1KhQKOPQbvZBPt4tow5BF7jH2BCtQ/g16010Fu//ptRREmYHW9GTpnZrL5i68K+13vg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/mm: address violations of MISRA C Rule 16.3
Message-Id: <E1soLHB-0001oe-66@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 11:12:45 +0000

commit f6cc23e234b57412a32cb13b1a118cb653fc49c9
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Wed Sep 11 12:56:33 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 11 12:56:33 2024 +0200

    x86/mm: address violations of MISRA C Rule 16.3
    
    Address violations of MISRA C:2012 Rule 16.3:
    "An unconditional `break' statement shall terminate every
    switch-clause".
    
    No functional change.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm/guest_walk.c     | 1 +
 xen/arch/x86/mm/hap/hap.c        | 2 +-
 xen/arch/x86/mm/hap/nested_hap.c | 1 +
 xen/arch/x86/mm/paging.c         | 2 +-
 4 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/guest_walk.c b/xen/arch/x86/mm/guest_walk.c
index fe7393334f..f48c3ef75f 100644
--- a/xen/arch/x86/mm/guest_walk.c
+++ b/xen/arch/x86/mm/guest_walk.c
@@ -498,6 +498,7 @@ guest_walk_tables(const struct vcpu *v, struct p2m_domain *p2m,
             hvmemul_write_cache(v, l4gpa, &gw->l4e, sizeof(gw->l4e));
         }
 #endif
+        break;
     }
 
  out:
diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c
index d2011fde24..ec5043a8aa 100644
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -652,7 +652,7 @@ int hap_domctl(struct domain *d, struct xen_domctl_shadow_op *sc,
         return rc;
     case XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION:
         sc->mb = hap_get_allocation(d);
-        /* Fall through... */
+        fallthrough;
     case XEN_DOMCTL_SHADOW_OP_OFF:
         return 0;
     default:
diff --git a/xen/arch/x86/mm/hap/nested_hap.c b/xen/arch/x86/mm/hap/nested_hap.c
index 080b60adf0..cc7bc6e5ea 100644
--- a/xen/arch/x86/mm/hap/nested_hap.c
+++ b/xen/arch/x86/mm/hap/nested_hap.c
@@ -217,6 +217,7 @@ int nestedhvm_hap_nested_page_fault(
         p2ma_10 = p2m_access_n;
         /* For safety, remove all permissions. */
         gdprintk(XENLOG_ERR, "Unhandled p2m access type:%d\n", p2ma_10);
+        break;
     }
     /* Use minimal permission for nested p2m. */
     p2ma_10 &= (p2m_access_t)p2ma_21;
diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index dd47bde5ce..c77f4c1dac 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -726,7 +726,7 @@ int paging_domctl(struct domain *d, struct xen_domctl_shadow_op *sc,
     case XEN_DOMCTL_SHADOW_OP_ENABLE:
         if ( !(sc->mode & XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY) )
             break;
-        /* Else fall through... */
+        fallthrough;
     case XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY:
         return paging_log_dirty_enable(d);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 11:12:56 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 11:12:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796447.1206031 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soLHM-0007xM-AK; Wed, 11 Sep 2024 11:12:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796447.1206031; Wed, 11 Sep 2024 11:12:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soLHM-0007xE-7q; Wed, 11 Sep 2024 11:12:56 +0000
Received: by outflank-mailman (input) for mailman id 796447;
 Wed, 11 Sep 2024 11:12:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLHL-0007x4-AW
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:12:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLHL-0000jP-9q
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:12:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLHL-0001pb-91
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:12:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZyW0hKEyeM9kzH89dDKmdMSq2+Ni+Wgk2m83fqC3nWo=; b=aWV/Jp9UbwceeR0utF2cLwTmdZ
	ZEYUQL4QfBE6DqP01A2r/WamjyjES4C5Vix3OSZe97lE/kT0U95AGnFp1y95kAQqhpFUDk1/4OjhB
	Xxlxr5xRyCKA/DHqvnHd5BpyddCVxCK2qwHNLzcLZuYNsEMzMmWNfgHaSBna58SzEjUg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/mmcfg: address violation of MISRA C Rule 16.3
Message-Id: <E1soLHL-0001pb-91@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 11:12:55 +0000

commit 2b24c090d1454fc13fb2fce94565175449aed25e
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Wed Sep 11 12:57:07 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 11 12:57:07 2024 +0200

    x86/mmcfg: address violation of MISRA C Rule 16.3
    
    Address a violation of MISRA C:2012 Rule 16.3:
    "An unconditional `break' statement shall terminate every
    switch-clause".
    
    No functional change.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/x86_64/mmconfig-shared.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/x86_64/mmconfig-shared.c b/xen/arch/x86/x86_64/mmconfig-shared.c
index b3b2da7362..77ba1e28f1 100644
--- a/xen/arch/x86/x86_64/mmconfig-shared.c
+++ b/xen/arch/x86/x86_64/mmconfig-shared.c
@@ -112,6 +112,7 @@ static const char *__init cf_check pci_mmcfg_intel_945(void)
         break;
     default:
         pci_mmcfg_config_num = 0;
+        break;
     }
 
     /* Errata #2, things break when not aligned on a 256Mb boundary */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 11:13:06 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 11:13:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796448.1206034 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soLHW-000800-Bp; Wed, 11 Sep 2024 11:13:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796448.1206034; Wed, 11 Sep 2024 11:13:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soLHW-0007zs-9H; Wed, 11 Sep 2024 11:13:06 +0000
Received: by outflank-mailman (input) for mailman id 796448;
 Wed, 11 Sep 2024 11:13:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLHV-0007zk-DN
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:13:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLHV-0000jj-Cb
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:13:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLHV-0001qc-Bs
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:13:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YKutK5Nqf9frTuFA7+Yc7YLDMSgOCmoGvIB2bDeW96s=; b=JWZ/A5j3S8c+q8h9vWVJFSzh3z
	j7lmwsEipEuPxF7tGf/9QVbJA1ymOyzw2pjHcsXZ0YGpKdZwRPC438C/86yxA4UMXwB9qwYVcFb3Y
	Pr7aH6BD4yzUN322ZSnLONspV2EqKxQtBsSiDxOYAKETgmcS7QUlZGIOXXK7/xROvCR8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/HVM: drop stdvga's "cache" struct member
Message-Id: <E1soLHV-0001qc-Bs@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 11:13:05 +0000

commit 53b7246bdfb3c280adcdf714918e4decb7e108f4
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Sep 11 12:57:53 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 11 12:57:53 2024 +0200

    x86/HVM: drop stdvga's "cache" struct member
    
    Since 68e1183411be ("libxc: introduce a xc_dom_arch for hvm-3.0-x86_32
    guests"), HVM guests are built using XEN_DOMCTL_sethvmcontext, which
    ends up disabling stdvga caching because of arch_hvm_load() being
    involved in the processing of the request. With that the field is
    useless, and can be dropped. Drop the helper functions manipulating /
    checking as well right away, but leave the use sites of
    stdvga_cache_is_enabled() with the hard-coded result the function would
    have produced, to aid validation of subsequent dropping of further code.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/save.c           |  3 ---
 xen/arch/x86/hvm/stdvga.c         | 44 +++------------------------------------
 xen/arch/x86/include/asm/hvm/io.h |  7 -------
 3 files changed, 3 insertions(+), 51 deletions(-)

diff --git a/xen/arch/x86/hvm/save.c b/xen/arch/x86/hvm/save.c
index 99aaf3fc33..8ab6405706 100644
--- a/xen/arch/x86/hvm/save.c
+++ b/xen/arch/x86/hvm/save.c
@@ -69,9 +69,6 @@ static void arch_hvm_load(struct domain *d, const struct hvm_save_header *hdr)
 
     /* Time when restore started  */
     d->arch.hvm.sync_tsc = rdtsc();
-
-    /* VGA state is not saved/restored, so we nobble the cache. */
-    d->arch.hvm.stdvga.cache = STDVGA_CACHE_DISABLED;
 }
 
 /* List of handlers for various HVM save and restore types */
diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index b16c59f772..afd2ca95d6 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -100,37 +100,6 @@ static void vram_put(struct hvm_hw_stdvga *s, void *p)
     unmap_domain_page(p);
 }
 
-static void stdvga_try_cache_enable(struct hvm_hw_stdvga *s)
-{
-    /*
-     * Caching mode can only be enabled if the the cache has
-     * never been used before. As soon as it is disabled, it will
-     * become out-of-sync with the VGA device model and since no
-     * mechanism exists to acquire current VRAM state from the
-     * device model, re-enabling it would lead to stale data being
-     * seen by the guest.
-     */
-    if ( s->cache != STDVGA_CACHE_UNINITIALIZED )
-        return;
-
-    gdprintk(XENLOG_INFO, "entering caching mode\n");
-    s->cache = STDVGA_CACHE_ENABLED;
-}
-
-static void stdvga_cache_disable(struct hvm_hw_stdvga *s)
-{
-    if ( s->cache != STDVGA_CACHE_ENABLED )
-        return;
-
-    gdprintk(XENLOG_INFO, "leaving caching mode\n");
-    s->cache = STDVGA_CACHE_DISABLED;
-}
-
-static bool stdvga_cache_is_enabled(const struct hvm_hw_stdvga *s)
-{
-    return s->cache == STDVGA_CACHE_ENABLED;
-}
-
 static int stdvga_outb(uint64_t addr, uint8_t val)
 {
     struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
@@ -170,7 +139,6 @@ static int stdvga_outb(uint64_t addr, uint8_t val)
     if ( !prev_stdvga && s->stdvga )
     {
         gdprintk(XENLOG_INFO, "entering stdvga mode\n");
-        stdvga_try_cache_enable(s);
     }
     else if ( prev_stdvga && !s->stdvga )
     {
@@ -468,7 +436,7 @@ static int cf_check stdvga_mem_write(
     };
     struct ioreq_server *srv;
 
-    if ( !stdvga_cache_is_enabled(s) || !s->stdvga )
+    if ( true || !s->stdvga )
         goto done;
 
     /* Intercept mmio write */
@@ -536,18 +504,12 @@ static bool cf_check stdvga_mem_accept(
          * We cannot return X86EMUL_UNHANDLEABLE on anything other then the
          * first cycle of an I/O. So, since we cannot guarantee to always be
          * able to send buffered writes, we have to reject any multi-cycle
-         * I/O and, since we are rejecting an I/O, we must invalidate the
-         * cache.
-         * Single-cycle write transactions are accepted even if the cache is
-         * not active since we can assert, when in stdvga mode, that writes
-         * to VRAM have no side effect and thus we can try to buffer them.
+         * I/O.
          */
-        stdvga_cache_disable(s);
-
         goto reject;
     }
     else if ( p->dir == IOREQ_READ &&
-              (!stdvga_cache_is_enabled(s) || !s->stdvga) )
+              (true || !s->stdvga) )
         goto reject;
 
     /* s->lock intentionally held */
diff --git a/xen/arch/x86/include/asm/hvm/io.h b/xen/arch/x86/include/asm/hvm/io.h
index 24d1b6134f..ce171eaca4 100644
--- a/xen/arch/x86/include/asm/hvm/io.h
+++ b/xen/arch/x86/include/asm/hvm/io.h
@@ -110,19 +110,12 @@ struct vpci_arch_msix_entry {
     int pirq;
 };
 
-enum stdvga_cache_state {
-    STDVGA_CACHE_UNINITIALIZED,
-    STDVGA_CACHE_ENABLED,
-    STDVGA_CACHE_DISABLED
-};
-
 struct hvm_hw_stdvga {
     uint8_t sr_index;
     uint8_t sr[8];
     uint8_t gr_index;
     uint8_t gr[9];
     bool stdvga;
-    enum stdvga_cache_state cache;
     uint32_t latch;
     struct page_info *vram_page[64];  /* shadow of 0xa0000-0xaffff */
     spinlock_t lock;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 11:13:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 11:13:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796449.1206039 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soLHg-00082b-DQ; Wed, 11 Sep 2024 11:13:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796449.1206039; Wed, 11 Sep 2024 11:13:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soLHg-00082T-An; Wed, 11 Sep 2024 11:13:16 +0000
Received: by outflank-mailman (input) for mailman id 796449;
 Wed, 11 Sep 2024 11:13:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLHf-00082N-Fz
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:13:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLHf-0000jr-FM
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:13:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soLHf-0001rW-Ea
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 11:13:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=d/oSeYhMHigYVqa078eUdZs41r6nQqOpFV3LNufoHWI=; b=sc5I8rzqcQ4FOR4HYrhYqM+J0L
	yGBuUuRNRMimlbCn5rHopUOHTtK/KcmBgE8Zm3KlM7ovgS5vN8m5uYB0Gqj4yTDO2x+rBybQlCPn3
	DwVcq7CfTM6R8kBdSE0F84JDWEdzdDidlIppys9XtgTC8vF00LUp1A1jfKnSJwFUZe6E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/hvm: allow {,un}map_pirq hypercalls unconditionally
Message-Id: <E1soLHf-0001rW-Ea@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 11:13:15 +0000

commit 035baa203b978b219828d0d3c16057beb344f35c
Author:     Jiqian Chen <Jiqian.Chen@amd.com>
AuthorDate: Wed Sep 11 12:58:24 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 11 12:58:24 2024 +0200

    x86/hvm: allow {,un}map_pirq hypercalls unconditionally
    
    The current hypercall interfaces to manage and assign interrupts to
    domains is mostly based in using pIRQs as handlers.  Such pIRQ values
    are abstract domain-specific references to interrupts.
    
    Classic HVM domains can have access to {,un}map_pirq hypercalls if the
    domain is allowed to route physical interrupts over event channels.
    That's however a different interface, limited to only mapping
    interrupts to itself. PVH domains on the other hand never had access
    to the interface, as PVH domains are not allowed to route interrupts
    over event channels.
    
    In order to allow setting up PCI passthrough from a PVH domain it
    needs access to the {,un}map_pirq hypercalls so interrupts can be
    assigned a pIRQ handler that can then be used by further hypercalls to
    bind the interrupt to a domain.
    
    Note that the {,un}map_pirq hypercalls end up calling helpers that are
    already used against a PVH domain in order to setup interrupts for the
    hardware domain when running in PVH mode.  physdev_map_pirq() will
    call allocate_and_map_{gsi,msi}_pirq() which is already used by the
    vIO-APIC or the vPCI code respectively.  So the exposed code paths are
    not new when targeting a PVH domain, but rather previous callers are
    not hypercall but emulation based.
    
    Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
    Signed-off-by: Huang Rui <ray.huang@amd.com>
    Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hypercall.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c
index f023f7879e..81883c8d4f 100644
--- a/xen/arch/x86/hvm/hypercall.c
+++ b/xen/arch/x86/hvm/hypercall.c
@@ -73,6 +73,8 @@ long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
     {
     case PHYSDEVOP_map_pirq:
     case PHYSDEVOP_unmap_pirq:
+        break;
+
     case PHYSDEVOP_eoi:
     case PHYSDEVOP_irq_status_query:
     case PHYSDEVOP_get_free_pirq:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 12:44:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 12:44:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796578.1206244 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMhX-0005aO-9V; Wed, 11 Sep 2024 12:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796578.1206244; Wed, 11 Sep 2024 12:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMhX-0005aG-6E; Wed, 11 Sep 2024 12:44:03 +0000
Received: by outflank-mailman (input) for mailman id 796578;
 Wed, 11 Sep 2024 12:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMhW-0005a8-0G
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMhV-0002J2-UI
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMhV-0002M4-Sz
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=z3AdTWRMbgnz4iQurM7QGK37h5yMo2brRNWIQgkcjNk=; b=xWw1oTp1fYhkiFmJCOX5eVd+2F
	ESo0NvRpYnifGHennIhYtOJObNpUUyfkrGmHXYOGE/52VJC9BANdzMNvMSOI2zkQlm0hxTi/XNJLM
	k1YyLk+QQsjIjWAaBZCzb17XLIWKWTJUPsOiiej2hxtgm/tE93M15dqAlO4uOByL+GHA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/bitops: Reinstate the please tidy message
Message-Id: <E1soMhV-0002M4-Sz@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 12:44:01 +0000

commit f7dc0862945155dd05814c46d7741a23319dae01
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 22 16:33:56 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    xen/bitops: Reinstate the please tidy message
    
    Recent additions have undone prior tidying at the top of the file.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/include/xen/bitops.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
index ed6b9ccc72..6f8e36f1c7 100644
--- a/xen/include/xen/bitops.h
+++ b/xen/include/xen/bitops.h
@@ -210,6 +210,8 @@ static always_inline bool test_bit(int nr, const volatile void *addr)
     test_bit(nr, addr);                                 \
 })
 
+/* --------------------- Please tidy above here --------------------- */
+
 static always_inline attr_const unsigned int ffs(unsigned int x)
 {
     if ( __builtin_constant_p(x) )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 12:44:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 12:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796579.1206247 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMhh-0005cq-AC; Wed, 11 Sep 2024 12:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796579.1206247; Wed, 11 Sep 2024 12:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMhh-0005cj-7j; Wed, 11 Sep 2024 12:44:13 +0000
Received: by outflank-mailman (input) for mailman id 796579;
 Wed, 11 Sep 2024 12:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMhg-0005cS-2B
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMhg-0002JA-1T
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMhg-0002N1-0H
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=65M+lhbQIwkfGO+0BnsZDbd4G2RdWdE7lg2bVXrCeXI=; b=p3YIlyQWkYSwO4BDUaudKxphZg
	famdGUdX33I1UI4+l1m5qSjWIoXMRWk49Eb61+39v44DBBliBijgAQ2af6AoJ61ygEjD5Fy2wLaBB
	qxrzcg9nDle2GUHaB3pgNv8zdZkwfjnM7STvKMXP0uzE/6hFzSTdO02nVvKbLJKg7jqg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/bitops: Drop the remnants of hweight{8,16}()
Message-Id: <E1soMhg-0002N1-0H@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 12:44:12 +0000

commit e8f0cc77dc3ce82d61afddfd889e3e1773a5192a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 22 18:13:57 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    xen/bitops: Drop the remnants of hweight{8,16}()
    
    They are no more.  No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/bitops.h |  2 --
 xen/arch/ppc/include/asm/bitops.h |  2 --
 xen/arch/x86/include/asm/bitops.h |  2 --
 xen/include/xen/bitops.h          | 17 -----------------
 4 files changed, 23 deletions(-)

diff --git a/xen/arch/arm/include/asm/bitops.h b/xen/arch/arm/include/asm/bitops.h
index 3c023103f7..91cd167b6b 100644
--- a/xen/arch/arm/include/asm/bitops.h
+++ b/xen/arch/arm/include/asm/bitops.h
@@ -86,8 +86,6 @@ bool clear_mask16_timeout(uint16_t mask, volatile void *p,
  */
 #define hweight64(x) generic_hweight64(x)
 #define hweight32(x) generic_hweight32(x)
-#define hweight16(x) generic_hweight16(x)
-#define hweight8(x) generic_hweight8(x)
 
 #endif /* _ARM_BITOPS_H */
 /*
diff --git a/xen/arch/ppc/include/asm/bitops.h b/xen/arch/ppc/include/asm/bitops.h
index 6e4e112b8b..64512e9495 100644
--- a/xen/arch/ppc/include/asm/bitops.h
+++ b/xen/arch/ppc/include/asm/bitops.h
@@ -134,7 +134,5 @@ static inline int test_and_set_bit(unsigned int nr, volatile void *addr)
  */
 #define hweight64(x) __builtin_popcountll(x)
 #define hweight32(x) __builtin_popcount(x)
-#define hweight16(x) __builtin_popcount((uint16_t)(x))
-#define hweight8(x)  __builtin_popcount((uint8_t)(x))
 
 #endif /* _ASM_PPC_BITOPS_H */
diff --git a/xen/arch/x86/include/asm/bitops.h b/xen/arch/x86/include/asm/bitops.h
index 8c0403405a..4c5b21907a 100644
--- a/xen/arch/x86/include/asm/bitops.h
+++ b/xen/arch/x86/include/asm/bitops.h
@@ -483,7 +483,5 @@ static always_inline unsigned int arch_flsl(unsigned long x)
  */
 #define hweight64(x) generic_hweight64(x)
 #define hweight32(x) generic_hweight32(x)
-#define hweight16(x) generic_hweight16(x)
-#define hweight8(x) generic_hweight8(x)
 
 #endif /* _X86_BITOPS_H */
diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
index 6f8e36f1c7..58c600155f 100644
--- a/xen/include/xen/bitops.h
+++ b/xen/include/xen/bitops.h
@@ -413,23 +413,6 @@ static inline unsigned int generic_hweight32(unsigned int w)
     return (w + (w >> 16)) & 0xff;
 }
 
-static inline unsigned int generic_hweight16(unsigned int w)
-{
-    w -= ((w >> 1) & 0x5555);
-    w =  (w & 0x3333) + ((w >> 2) & 0x3333);
-    w =  (w + (w >> 4)) & 0x0f0f;
-
-    return (w + (w >> 8)) & 0xff;
-}
-
-static inline unsigned int generic_hweight8(unsigned int w)
-{
-    w -= ((w >> 1) & 0x55);
-    w =  (w & 0x33) + ((w >> 2) & 0x33);
-
-    return (w + (w >> 4)) & 0x0f;
-}
-
 static inline unsigned int generic_hweight64(uint64_t w)
 {
     if ( BITS_PER_LONG < 64 )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 12:44:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 12:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796580.1206250 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMhr-0005g3-Bj; Wed, 11 Sep 2024 12:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796580.1206250; Wed, 11 Sep 2024 12:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMhr-0005fv-99; Wed, 11 Sep 2024 12:44:23 +0000
Received: by outflank-mailman (input) for mailman id 796580;
 Wed, 11 Sep 2024 12:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMhq-0005fj-7R
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMhq-0002JM-6F
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMhq-0002O4-3f
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:44:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YZLQn/9yiZYcN5iCK6nh68Md90bHOmoKWwNrP/8al3Q=; b=JMxyM5ZB2R0BEWpYKLrhJiKKwS
	wkAerORL5oT9g1+LemxfofbXfmZ1fQ4VHaNbojCBWMQiltjXc/pWyDDzCFEEEi9qeFMPoPg/dynmL
	+nLBnfhvdDbRSO3qQqhzeOLmeHendWNKLlKmtJZA4izC67u+uxnWV1F9oDKHzVyaCcuc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/bitops: Implement hweight32() in terms of hweightl()
Message-Id: <E1soMhq-0002O4-3f@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 12:44:22 +0000

commit f20504e1cf78c90a50335f080f6393af02b8372f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 22 21:40:11 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    xen/bitops: Implement hweight32() in terms of hweightl()
    
    ... and drop generic_hweight32().
    
    As noted previously, the only two users of hweight32() are in __init paths.
    
    The int-optimised form of generic_hweight() is only two instructions shorter
    than the long-optimised form, and even then only on architectures which lack
    fast multiplication, so there's no point providing an int-optimised form.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/bitops.h | 1 -
 xen/arch/ppc/include/asm/bitops.h | 1 -
 xen/arch/x86/include/asm/bitops.h | 1 -
 xen/include/xen/bitops.h          | 5 +++++
 4 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/include/asm/bitops.h b/xen/arch/arm/include/asm/bitops.h
index 91cd167b6b..b28c25b3d5 100644
--- a/xen/arch/arm/include/asm/bitops.h
+++ b/xen/arch/arm/include/asm/bitops.h
@@ -85,7 +85,6 @@ bool clear_mask16_timeout(uint16_t mask, volatile void *p,
  * The Hamming Weight of a number is the total number of bits set in it.
  */
 #define hweight64(x) generic_hweight64(x)
-#define hweight32(x) generic_hweight32(x)
 
 #endif /* _ARM_BITOPS_H */
 /*
diff --git a/xen/arch/ppc/include/asm/bitops.h b/xen/arch/ppc/include/asm/bitops.h
index 64512e9495..f488a7c034 100644
--- a/xen/arch/ppc/include/asm/bitops.h
+++ b/xen/arch/ppc/include/asm/bitops.h
@@ -133,6 +133,5 @@ static inline int test_and_set_bit(unsigned int nr, volatile void *addr)
  * The Hamming Weight of a number is the total number of bits set in it.
  */
 #define hweight64(x) __builtin_popcountll(x)
-#define hweight32(x) __builtin_popcount(x)
 
 #endif /* _ASM_PPC_BITOPS_H */
diff --git a/xen/arch/x86/include/asm/bitops.h b/xen/arch/x86/include/asm/bitops.h
index 4c5b21907a..507b043b8a 100644
--- a/xen/arch/x86/include/asm/bitops.h
+++ b/xen/arch/x86/include/asm/bitops.h
@@ -482,6 +482,5 @@ static always_inline unsigned int arch_flsl(unsigned long x)
  * The Hamming Weight of a number is the total number of bits set in it.
  */
 #define hweight64(x) generic_hweight64(x)
-#define hweight32(x) generic_hweight32(x)
 
 #endif /* _X86_BITOPS_H */
diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
index 58c600155f..a462c30651 100644
--- a/xen/include/xen/bitops.h
+++ b/xen/include/xen/bitops.h
@@ -326,6 +326,11 @@ static always_inline attr_const unsigned int hweightl(unsigned long x)
 #endif
 }
 
+static always_inline attr_const unsigned int hweight32(uint32_t x)
+{
+    return hweightl(x);
+}
+
 /* --------------------- Please tidy below here --------------------- */
 
 #ifndef find_next_bit
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 12:44:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 12:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796581.1206256 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMi1-0005ip-Df; Wed, 11 Sep 2024 12:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796581.1206256; Wed, 11 Sep 2024 12:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMi1-0005ih-Ab; Wed, 11 Sep 2024 12:44:33 +0000
Received: by outflank-mailman (input) for mailman id 796581;
 Wed, 11 Sep 2024 12:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMi0-0005iY-Bo
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMi0-0002Jb-A2
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMi0-0002P5-8R
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UAO1Kbb4dhXJWX6S9cedsFsH9A31zaelHXuoLpihLiI=; b=f7U1crU4Lh+TxLOMVx2MVGUFWX
	xNA4vwb5QwuDt+GeDsXH6L73/z3T91qQEDYbUG7VFtsWH5g885p/EW9oVwAKevzeOQi1rMB5bvT5E
	z6+iSX6HL39ThACouLagstHENNOp1KaQ9XMwn5I6ES60DbkiPUzzXAcZ6xpuuoRQRJew=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/bitops: Implement hweight64() in terms of hweight{l,32}()
Message-Id: <E1soMi0-0002P5-8R@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 12:44:32 +0000

commit d177793f70b52455264bcae94912a818a362aa49
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 22 21:39:59 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    xen/bitops: Implement hweight64() in terms of hweight{l,32}()
    
    ... and drop generic_hweight{32,64}().
    
    This is identical on all architectures except ARM32.  Add one extra SELF_TEST
    to check that hweight64() works when the input is split in half.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/include/asm/bitops.h |  8 -------
 xen/arch/ppc/include/asm/bitops.h |  8 -------
 xen/arch/x86/include/asm/bitops.h |  8 -------
 xen/common/bitops.c               |  3 +++
 xen/include/xen/bitops.h          | 45 +++++++--------------------------------
 5 files changed, 11 insertions(+), 61 deletions(-)

diff --git a/xen/arch/arm/include/asm/bitops.h b/xen/arch/arm/include/asm/bitops.h
index b28c25b3d5..f163d9bb45 100644
--- a/xen/arch/arm/include/asm/bitops.h
+++ b/xen/arch/arm/include/asm/bitops.h
@@ -78,14 +78,6 @@ bool clear_mask16_timeout(uint16_t mask, volatile void *p,
 #define arch_fls(x)  ((x) ? 32 - __builtin_clz(x) : 0)
 #define arch_flsl(x) ((x) ? BITS_PER_LONG - __builtin_clzl(x) : 0)
 
-/**
- * hweightN - returns the hamming weight of a N-bit word
- * @x: the word to weigh
- *
- * The Hamming Weight of a number is the total number of bits set in it.
- */
-#define hweight64(x) generic_hweight64(x)
-
 #endif /* _ARM_BITOPS_H */
 /*
  * Local variables:
diff --git a/xen/arch/ppc/include/asm/bitops.h b/xen/arch/ppc/include/asm/bitops.h
index f488a7c034..c942e9432e 100644
--- a/xen/arch/ppc/include/asm/bitops.h
+++ b/xen/arch/ppc/include/asm/bitops.h
@@ -126,12 +126,4 @@ static inline int test_and_set_bit(unsigned int nr, volatile void *addr)
 
 #define arch_hweightl(x) __builtin_popcountl(x)
 
-/**
- * hweightN - returns the hamming weight of a N-bit word
- * @x: the word to weigh
- *
- * The Hamming Weight of a number is the total number of bits set in it.
- */
-#define hweight64(x) __builtin_popcountll(x)
-
 #endif /* _ASM_PPC_BITOPS_H */
diff --git a/xen/arch/x86/include/asm/bitops.h b/xen/arch/x86/include/asm/bitops.h
index 507b043b8a..642d8e58b2 100644
--- a/xen/arch/x86/include/asm/bitops.h
+++ b/xen/arch/x86/include/asm/bitops.h
@@ -475,12 +475,4 @@ static always_inline unsigned int arch_flsl(unsigned long x)
 }
 #define arch_flsl arch_flsl
 
-/**
- * hweightN - returns the hamming weight of a N-bit word
- * @x: the word to weigh
- *
- * The Hamming Weight of a number is the total number of bits set in it.
- */
-#define hweight64(x) generic_hweight64(x)
-
 #endif /* _X86_BITOPS_H */
diff --git a/xen/common/bitops.c b/xen/common/bitops.c
index 5e5d20d225..91ae961440 100644
--- a/xen/common/bitops.c
+++ b/xen/common/bitops.c
@@ -144,6 +144,9 @@ static void __init test_hweight(void)
 
     CHECK(hweightl, 1 | (1UL << (BITS_PER_LONG - 1)), 2);
     CHECK(hweightl, -1UL, BITS_PER_LONG);
+
+    /* unsigned int hweight64(uint64_t) */
+    CHECK(hweight64, -1ULL, 64);
 }
 
 static void __init __constructor test_bitops(void)
diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
index a462c30651..12eb88fb12 100644
--- a/xen/include/xen/bitops.h
+++ b/xen/include/xen/bitops.h
@@ -331,6 +331,14 @@ static always_inline attr_const unsigned int hweight32(uint32_t x)
     return hweightl(x);
 }
 
+static always_inline attr_const unsigned int hweight64(uint64_t x)
+{
+    if ( BITS_PER_LONG >= 64 )
+        return hweightl(x);
+    else
+        return hweight32(x >> 32) + hweight32(x);
+}
+
 /* --------------------- Please tidy below here --------------------- */
 
 #ifndef find_next_bit
@@ -399,43 +407,6 @@ static inline int get_count_order(unsigned int count)
     return order;
 }
 
-/*
- * hweightN: returns the hamming weight (i.e. the number
- * of bits set) of a N-bit word
- */
-
-static inline unsigned int generic_hweight32(unsigned int w)
-{
-    w -= (w >> 1) & 0x55555555;
-    w =  (w & 0x33333333) + ((w >> 2) & 0x33333333);
-    w =  (w + (w >> 4)) & 0x0f0f0f0f;
-
-    if ( IS_ENABLED(CONFIG_HAS_FAST_MULTIPLY) )
-        return (w * 0x01010101) >> 24;
-
-    w += w >> 8;
-
-    return (w + (w >> 16)) & 0xff;
-}
-
-static inline unsigned int generic_hweight64(uint64_t w)
-{
-    if ( BITS_PER_LONG < 64 )
-        return generic_hweight32(w >> 32) + generic_hweight32(w);
-
-    w -= (w >> 1) & 0x5555555555555555UL;
-    w =  (w & 0x3333333333333333UL) + ((w >> 2) & 0x3333333333333333UL);
-    w =  (w + (w >> 4)) & 0x0f0f0f0f0f0f0f0fUL;
-
-    if ( IS_ENABLED(CONFIG_HAS_FAST_MULTIPLY) )
-        return (w * 0x0101010101010101UL) >> 56;
-
-    w += w >> 8;
-    w += w >> 16;
-
-    return (w + (w >> 32)) & 0xFF;
-}
-
 /*
  * rol32 - rotate a 32-bit value left
  *
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 12:44:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 12:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796582.1206259 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMiB-0005lZ-Eg; Wed, 11 Sep 2024 12:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796582.1206259; Wed, 11 Sep 2024 12:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMiB-0005lR-C4; Wed, 11 Sep 2024 12:44:43 +0000
Received: by outflank-mailman (input) for mailman id 796582;
 Wed, 11 Sep 2024 12:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMiA-0005lJ-Do
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMiA-0002Jq-DC
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMiA-0002Pt-CF
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cSB+brH9Niyz8LyIbL9A/8toXO5uHw6BSwBvdj28NBc=; b=bOimB4SgJTIyIMoiONfVCWXT6y
	jNh6Qm20UHOvL8dSVztND53dNdwDBcIwwNdhw90KaU72oSC8DmJY2ezelwMpEJcUKIFTkzc2v7QUV
	w+bo4Jbejuv0hAyUze9Lfm3NGiqFBOWmqZvdOlDGDa0iWy9RlJKwKLeDkDIW1X+TXXVw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/bitops: Use the POPCNT instruction when available
Message-Id: <E1soMiA-0002Pt-CF@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 12:44:42 +0000

commit 6978602334d92378269ca0dcea794ddc83b4dae7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 22 20:18:15 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    x86/bitops: Use the POPCNT instruction when available
    
    It has existed in x86 CPUs since 2008, so we're only 16 years late adding
    support.  With all the other scafolding in place, implement arch_hweightl()
    for x86.
    
    The only complication is that the call to arch_generic_hweightl() is behind
    the compilers back.  Address this by writing it in ASM and ensure that it
    preserves all registers.
    
    Copy the code generation from generic_hweightl().  It's not a complicated
    algorithm, and is easy to regenerate if needs be, but cover it with the same
    unit tests as test_generic_hweightl() just for piece of mind.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/bitops.h | 23 +++++++++++++
 xen/lib/Makefile                  |  1 +
 xen/lib/x86-generic-hweightl.c    | 71 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 95 insertions(+)

diff --git a/xen/arch/x86/include/asm/bitops.h b/xen/arch/x86/include/asm/bitops.h
index 642d8e58b2..39e37f1cbe 100644
--- a/xen/arch/x86/include/asm/bitops.h
+++ b/xen/arch/x86/include/asm/bitops.h
@@ -6,6 +6,7 @@
  */
 
 #include <asm/alternative.h>
+#include <asm/asm_defns.h>
 #include <asm/cpufeatureset.h>
 
 /*
@@ -475,4 +476,26 @@ static always_inline unsigned int arch_flsl(unsigned long x)
 }
 #define arch_flsl arch_flsl
 
+unsigned int arch_generic_hweightl(unsigned long x);
+
+static always_inline unsigned int arch_hweightl(unsigned long x)
+{
+    unsigned int r;
+
+    /*
+     * arch_generic_hweightl() is written in ASM in order to preserve all
+     * registers, as the compiler can't see the call.
+     *
+     * This limits the POPCNT instruction to using the same ABI as a function
+     * call (input in %rdi, output in %eax) but that's fine.
+     */
+    alternative_io("call arch_generic_hweightl",
+                   "popcnt %[val], %q[res]", X86_FEATURE_POPCNT,
+                   ASM_OUTPUT2([res] "=a" (r) ASM_CALL_CONSTRAINT),
+                   [val] "D" (x));
+
+    return r;
+}
+#define arch_hweightl arch_hweightl
+
 #endif /* _X86_BITOPS_H */
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index b6558e108b..54440f628a 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -36,6 +36,7 @@ lib-y += strtol.o
 lib-y += strtoll.o
 lib-y += strtoul.o
 lib-y += strtoull.o
+lib-$(CONFIG_X86) += x86-generic-hweightl.o
 lib-$(CONFIG_X86) += xxhash32.o
 lib-$(CONFIG_X86) += xxhash64.o
 
diff --git a/xen/lib/x86-generic-hweightl.c b/xen/lib/x86-generic-hweightl.c
new file mode 100644
index 0000000000..123a5b4392
--- /dev/null
+++ b/xen/lib/x86-generic-hweightl.c
@@ -0,0 +1,71 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <xen/bitops.h>
+#include <xen/init.h>
+#include <xen/self-tests.h>
+
+/*
+ * An implementation of generic_hweightl() used on hardware without the POPCNT
+ * instruction.
+ *
+ * This function is called from within an ALTERNATIVE in arch_hweightl().
+ * i.e. behind the back of the compiler.  Therefore all registers are callee
+ * preserved.
+ *
+ * The ASM is what GCC-12 emits for generic_hweightl() in a release build of
+ * Xen, with spilling of %rdi/%rdx to preserve the callers registers.
+ *
+ * Note: When we can use __attribute__((no_caller_saved_registers))
+ *       unconditionally (GCC 7, Clang 5), we can implement this in plain C.
+ */
+asm (
+    ".type arch_generic_hweightl, STT_FUNC\n\t"
+    ".globl arch_generic_hweightl\n\t"
+    ".hidden arch_generic_hweightl\n\t"
+    ".balign " STR(CONFIG_FUNCTION_ALIGNMENT) ", 0x90\n" /* CODE_FILL */
+    "arch_generic_hweightl:\n\t"
+
+    "push   %rdi\n\t"
+    "push   %rdx\n\t"
+
+    "movabs $0x5555555555555555, %rdx\n\t"
+    "mov    %rdi, %rax\n\t"
+    "shr    $1, %rax\n\t"
+    "and    %rdx, %rax\n\t"
+    "sub    %rax, %rdi\n\t"
+    "movabs $0x3333333333333333, %rax\n\t"
+    "mov    %rdi, %rdx\n\t"
+    "shr    $2, %rdi\n\t"
+    "and    %rax, %rdx\n\t"
+    "and    %rax, %rdi\n\t"
+    "add    %rdi, %rdx\n\t"
+    "mov    %rdx, %rax\n\t"
+    "shr    $4, %rax\n\t"
+    "add    %rdx, %rax\n\t"
+    "movabs $0x0f0f0f0f0f0f0f0f, %rdx\n\t"
+    "and    %rdx, %rax\n\t"
+    "movabs $0x0101010101010101, %rdx\n\t"
+    "imul   %rdx, %rax\n\t"
+    "shr    $" STR(BITS_PER_LONG) "- 8, %rax\n\t"
+
+    "pop    %rdx\n\t"
+    "pop    %rdi\n\t"
+
+    "ret\n\t"
+
+    ".size arch_generic_hweightl, . - arch_generic_hweightl\n\t"
+);
+
+#ifdef CONFIG_SELF_TESTS
+static void __init __constructor test_arch_generic_hweightl(void)
+{
+    RUNTIME_CHECK(arch_generic_hweightl, 0, 0);
+    RUNTIME_CHECK(arch_generic_hweightl, 1, 1);
+    RUNTIME_CHECK(arch_generic_hweightl, 3, 2);
+    RUNTIME_CHECK(arch_generic_hweightl, 7, 3);
+    RUNTIME_CHECK(arch_generic_hweightl, 0xff, 8);
+
+    RUNTIME_CHECK(arch_generic_hweightl, 1 | (1UL << (BITS_PER_LONG - 1)), 2);
+    RUNTIME_CHECK(arch_generic_hweightl, -1UL, BITS_PER_LONG);
+}
+#endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 12:44:53 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 12:44:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796583.1206263 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMiL-0005o4-GB; Wed, 11 Sep 2024 12:44:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796583.1206263; Wed, 11 Sep 2024 12:44:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMiL-0005nw-DS; Wed, 11 Sep 2024 12:44:53 +0000
Received: by outflank-mailman (input) for mailman id 796583;
 Wed, 11 Sep 2024 12:44:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMiK-0005no-Gz
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:44:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMiK-0002KD-GD
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMiK-0002Qi-FK
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:44:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IKmqqw0aPOkPX+3MclYk58rE26vEicIHchYuKVMDRk8=; b=AVfJ/bjpXhs21fK/IivvgihaoN
	3MrVG0b5i6rSQoItC6bSNj6JRfwDSqDfJLFvJ2t8sgQqvcixHtaBioMolMoF0GYsf020jEtmw0aNj
	yiBi1HDzXsHw5NvfJhcIB6JAK4tq4OF2uWu8Ik/mH+VAxGyub2hyuzc0DHkDQGRqsLYw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml: Rationalise .gitignore
Message-Id: <E1soMiK-0002Qi-FK@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 12:44:52 +0000

commit 0a15b7695bd983fa49da2e4c5daf8606497f0671
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Sep 6 15:36:37 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    tools/ocaml: Rationalise .gitignore
    
    The root .gitignore is quite stale from recent (and less recent) removals, but
    also fails to work for the forthcoming dynamic plugin work.
    
    Strip all Ocaml content out of the root .gitignore, and provide a more local
    .gitignore's with up-to-date patterns.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
---
 .gitignore                       | 28 ----------------------------
 tools/ocaml/.gitignore           |  6 ++++++
 tools/ocaml/libs/xc/.gitignore   |  1 +
 tools/ocaml/libs/xs/.gitignore   |  1 +
 tools/ocaml/xenstored/.gitignore |  3 +++
 5 files changed, 11 insertions(+), 28 deletions(-)

diff --git a/.gitignore b/.gitignore
index d8b57e32f8..d88be80b28 100644
--- a/.gitignore
+++ b/.gitignore
@@ -92,7 +92,6 @@ stubdom/mini-os-*
 stubdom/mk-headers-*
 stubdom/newlib-1.*
 stubdom/newlib-x86*
-stubdom/ocaml-*
 stubdom/pciutils-*
 stubdom/pkg-config/*
 stubdom/polarssl-*
@@ -339,33 +338,6 @@ tools/misc/xen-hvmcrash
 tools/misc/xen-lowmemd
 tools/vchan/vchan-node[12]
 tools/vchan/vchan-socket-proxy
-tools/ocaml/*/.ocamldep.make
-tools/ocaml/*/*.cm[ixao]
-tools/ocaml/*/*.cmxa
-tools/ocaml/*/*.annot
-tools/ocaml/*/*/.ocamldep.make
-tools/ocaml/*/*/*.cm[ixao]
-tools/ocaml/*/*/*.cmxa
-tools/ocaml/*/*/*.annot
-tools/ocaml/*/*/META
-tools/ocaml/libs/xl/_libxl_types.inc
-tools/ocaml/libs/xl/_libxl_types.ml.in
-tools/ocaml/libs/xl/_libxl_types.mli.in
-tools/ocaml/libs/xl/xenlight.ml
-tools/ocaml/libs/xl/xenlight.mli
-tools/ocaml/libs/xentoollog/_xtl_levels.*
-tools/ocaml/libs/xentoollog/xentoollog.ml
-tools/ocaml/libs/xentoollog/xentoollog.mli
-tools/ocaml/libs/xs/paths.ml
-tools/ocaml/libs/xc/xenctrl_abi_check.h
-tools/ocaml/xenstored/oxenstored
-tools/ocaml/xenstored/oxenstored.conf
-tools/ocaml/xenstored/paths.ml
-tools/ocaml/test/xtl
-tools/ocaml/test/send_debug_keys
-tools/ocaml/test/list_domains
-tools/ocaml/test/dmesg
-tools/ocaml/test/raise_exception
 tools/debugger/kdd/kdd
 tools/firmware/etherboot/ipxe.tar.gz
 tools/firmware/etherboot/ipxe/
diff --git a/tools/ocaml/.gitignore b/tools/ocaml/.gitignore
new file mode 100644
index 0000000000..c97bc8444c
--- /dev/null
+++ b/tools/ocaml/.gitignore
@@ -0,0 +1,6 @@
+**/META
+**/.ocamldep.make
+**/*.annot
+**/*.cm[ixaot]
+**/*.cmti
+**/*.cmx[as]
diff --git a/tools/ocaml/libs/xc/.gitignore b/tools/ocaml/libs/xc/.gitignore
new file mode 100644
index 0000000000..1b26ad32b6
--- /dev/null
+++ b/tools/ocaml/libs/xc/.gitignore
@@ -0,0 +1 @@
+/xenctrl_abi_check.h
diff --git a/tools/ocaml/libs/xs/.gitignore b/tools/ocaml/libs/xs/.gitignore
new file mode 100644
index 0000000000..4d556ef38c
--- /dev/null
+++ b/tools/ocaml/libs/xs/.gitignore
@@ -0,0 +1 @@
+/paths.ml
diff --git a/tools/ocaml/xenstored/.gitignore b/tools/ocaml/xenstored/.gitignore
new file mode 100644
index 0000000000..2b432de4fc
--- /dev/null
+++ b/tools/ocaml/xenstored/.gitignore
@@ -0,0 +1,3 @@
+/oxenstored
+/oxenstored.conf
+/paths.ml
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 12:45:03 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 12:45:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796584.1206267 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMiV-0005rP-KE; Wed, 11 Sep 2024 12:45:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796584.1206267; Wed, 11 Sep 2024 12:45:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMiV-0005rH-HR; Wed, 11 Sep 2024 12:45:03 +0000
Received: by outflank-mailman (input) for mailman id 796584;
 Wed, 11 Sep 2024 12:45:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMiU-0005r6-KE
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:45:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMiU-0002Ko-JK
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMiU-0002S7-IQ
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:45:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2YYQVJgAOh4/Y9C34yGPK/T/B8wKrHEgWGPHNLuHldw=; b=491jMCOFvSXCkzTG9Pt7p6g6fg
	PFf+wFFXr3vz/kDiPUsxw5SktpT9+Gj1YPLPEp6THzsoqsbLnVdzV6yAfY4u+Sb2MOPCPMlWgP4VC
	Ku67FBI5xYKFtVC4Z9w5fQLpGr3HumWy5gNZaRRwOmtN+xEzNCY0bW2ue4gSmchUsYco=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ocaml/libs: Implement a dynamically-loaded plugin for Xenctrl.domain_getinfo
Message-Id: <E1soMiU-0002S7-IQ@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 12:45:02 +0000

commit a6576011a4d21a6e88daba1308d5a19e2d964d9b
Author:     Andrii Sultanov <andrii.sultanov@cloud.com>
AuthorDate: Mon Sep 9 13:02:40 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    ocaml/libs: Implement a dynamically-loaded plugin for Xenctrl.domain_getinfo
    
    This plugin intends to hide the unstable Xenctrl interface under a
    stable one. In case of the change in the interface, a V2 of this plugin
    would need to be produced, but V1 with the old interface would
    need to be kept (with potential change in the implementation) in the
    meantime.
    
    To reduce the need for such changes in the future, this plugin only
    provides the absolute minimum functionality that Oxenstored uses - only
    three fields of the domaininfo struct are used and presented here.
    
    Oxenstored currently uses the single-domain domain_getinfo function,
    whereas domain_getinfolist is a potentially more efficient option. Both
    of these are provided in the plugin to allow a transition from one to
    the other without modifying the interface in the future. Both return
    identical structures and rely on the same fields in xenctrl, thus if one
    of them breaks, both will break, and a new version of the interface
    would need to be issued.
    
    Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/ocaml/Makefile                               |   1 +
 tools/ocaml/libs/Makefile                          |   2 +-
 tools/ocaml/libs/xsd_glue/META.in                  |   4 +
 tools/ocaml/libs/xsd_glue/Makefile                 |  46 ++++++
 .../libs/xsd_glue/domain_getinfo_plugin_v1/META.in |   5 +
 .../xsd_glue/domain_getinfo_plugin_v1/Makefile     |  37 +++++
 .../domain_getinfo_stubs_v1.c                      | 160 +++++++++++++++++++++
 .../domain_getinfo_plugin_v1/domain_getinfo_v1.ml  |  35 +++++
 .../domain_getinfo_plugin_v1/domain_getinfo_v1.mli |   1 +
 tools/ocaml/libs/xsd_glue/plugin_interface_v1.ml   |  30 ++++
 tools/ocaml/libs/xsd_glue/plugin_interface_v1.mli  |  38 +++++
 11 files changed, 358 insertions(+), 1 deletion(-)

diff --git a/tools/ocaml/Makefile b/tools/ocaml/Makefile
index 1557fd6c3c..7252eb23d7 100644
--- a/tools/ocaml/Makefile
+++ b/tools/ocaml/Makefile
@@ -29,6 +29,7 @@ build-tools-oxenstored:
 	$(MAKE) -s -C libs/mmap
 	$(MAKE) -s -C libs/xb
 	$(MAKE) -s -C libs/xc
+	$(MAKE) -s -C libs/xsd_glue
 	$(MAKE) -C xenstored
 
 .PHONY: format
diff --git a/tools/ocaml/libs/Makefile b/tools/ocaml/libs/Makefile
index 89350aa12f..6bcec58502 100644
--- a/tools/ocaml/libs/Makefile
+++ b/tools/ocaml/libs/Makefile
@@ -4,7 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 SUBDIRS= \
 	mmap \
 	eventchn xc \
-	xb xs
+	xb xs xsd_glue
 
 .PHONY: all
 all: subdirs-all
diff --git a/tools/ocaml/libs/xsd_glue/META.in b/tools/ocaml/libs/xsd_glue/META.in
new file mode 100644
index 0000000000..dbd584ac17
--- /dev/null
+++ b/tools/ocaml/libs/xsd_glue/META.in
@@ -0,0 +1,4 @@
+version = "@VERSION@"
+description = "A small library on top of unstable Xenctrl interfaces used by Oxenstored"
+archive(byte) = "plugin_interface_v1.cma"
+archive(native) = "plugin_interface_v1.cmxa"
diff --git a/tools/ocaml/libs/xsd_glue/Makefile b/tools/ocaml/libs/xsd_glue/Makefile
new file mode 100644
index 0000000000..f84291f7fe
--- /dev/null
+++ b/tools/ocaml/libs/xsd_glue/Makefile
@@ -0,0 +1,46 @@
+OCAML_TOPLEVEL=$(CURDIR)/../..
+XEN_ROOT=$(OCAML_TOPLEVEL)/../..
+include $(OCAML_TOPLEVEL)/common.make
+
+SUBDIRS= domain_getinfo_plugin_v1
+
+CFLAGS += $(CFLAGS_xeninclude)
+OCAMLOPTFLAGS += -opaque
+
+OBJS = plugin_interface_v1
+INTF = $(foreach obj, $(OBJS),$(obj).cmi)
+LIBS = plugin_interface_v1.cma plugin_interface_v1.cmxa
+LIBS_plugin_interface_v1 =
+plugin_interface_v1_OBJS=$(OBJS)
+
+.PHONY: all
+all: $(INTF) $(LIBS) $(PROGRAMS) subdirs-all
+
+bins: $(PROGRAMS)
+
+libs: $(LIBS)
+
+plugin_interface_v1 = $(OBJS)
+
+OCAML_NOC_LIBRARY = plugin_interface_v1
+
+.PHONY: install
+install: $(LIBS) META subdirs-install
+	mkdir -p $(OCAMLDESTDIR)
+	$(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xsd_glue
+	$(OCAMLFIND) install -destdir $(OCAMLDESTDIR) -ldconf ignore xsd_glue META $(INTF) $(LIBS)
+	$(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xsd_glue_dev
+	$(OCAMLFIND) install -destdir $(OCAMLDESTDIR) -ldconf ignore xsd_glue_dev META $(INTF) $(LIBS) *.ml *.mli
+
+.PHONY: uninstall
+uninstall: subdirs-uninstall
+	$(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xsd_glue
+	$(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xsd_glue_dev
+
+.PHONY: clean
+clean: subdirs-clean
+
+.PHONY: distclean
+distclean: subdirs-distclean
+
+include $(OCAML_TOPLEVEL)/Makefile.rules
diff --git a/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/META.in b/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/META.in
new file mode 100644
index 0000000000..fb917def62
--- /dev/null
+++ b/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/META.in
@@ -0,0 +1,5 @@
+version = "@VERSION@"
+description = "Xenstored plugin for Xenctrl.domain_getinfo unstable interface - V1"
+requires = "plugin_interface_v1"
+archive(byte) = "domain_getinfo_v1.cma"
+archive(native) = "domain_getinfo_v1.cmxa"
diff --git a/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/Makefile b/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/Makefile
new file mode 100644
index 0000000000..4be1feacfe
--- /dev/null
+++ b/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/Makefile
@@ -0,0 +1,37 @@
+OCAML_TOPLEVEL=$(CURDIR)/../../..
+XEN_ROOT=$(OCAML_TOPLEVEL)/../..
+include $(OCAML_TOPLEVEL)/common.make
+
+CFLAGS += -I $(OCAML_TOPLEVEL)/libs -I $(OCAML_TOPLEVEL)/libs/xsd_glue
+CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_xeninclude) $(APPEND_CFLAGS)
+OCAMLOPTFLAGS += -opaque
+OCAMLINCLUDE += -I ./ -I ../
+
+OBJS = domain_getinfo_v1
+INTF = $(foreach obj, $(OBJS),$(obj).cmi)
+LIBS = domain_getinfo_v1.cmxa domain_getinfo_v1.cmxs
+
+LIBS_xsd_glue = $(call xenlibs-ldflags-ldlibs,xenctrl)
+
+all: $(INTF) $(LIBS) $(PROGRAMS)
+
+bins: $(PROGRAMS)
+
+libs: $(LIBS)
+
+domain_getinfo_v1_OBJS = $(OBJS)
+domain_getinfo_v1 = $(OBJS)
+domain_getinfo_v1_C_OBJS = domain_getinfo_stubs_v1
+
+OCAML_DYN_LIBRARY = domain_getinfo_v1
+
+.PHONY: install
+install: $(LIBS) META
+	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)/ocaml/xsd_glue/xenctrl_plugin
+	$(INSTALL_PROG) domain_getinfo_v1.cmxs $(DESTDIR)$(LIBEXEC)/ocaml/xsd_glue/xenctrl_plugin
+
+.PHONY: uninstall
+uninstall:
+	rm -f $(DESTDIR)$(LIBEXEC)/ocaml/xsd_glue/xenctrl_plugin/domain_getinfo_v1.cmxs
+
+include $(OCAML_TOPLEVEL)/Makefile.rules
diff --git a/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/domain_getinfo_stubs_v1.c b/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/domain_getinfo_stubs_v1.c
new file mode 100644
index 0000000000..7be386f4d4
--- /dev/null
+++ b/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/domain_getinfo_stubs_v1.c
@@ -0,0 +1,160 @@
+/* SPDX-License-Identifier: LGPL-2.1-only WITH OCaml-LGPL-linking-exception */
+
+#define _GNU_SOURCE
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#define CAML_NAME_SPACE
+#include <caml/alloc.h>
+#include <caml/memory.h>
+#include <caml/signals.h>
+#include <caml/fail.h>
+#include <caml/callback.h>
+#include <caml/custom.h>
+
+#include <xen-tools/common-macros.h>
+#include <xenctrl.h>
+
+#include "xen-caml-compat.h"
+
+static inline xc_interface *xsd_glue_xch_of_val(value v)
+{
+	xc_interface *xch = *(xc_interface **)Data_custom_val(v);
+
+	return xch;
+}
+
+static void xsd_glue_xenctrl_finalize(value v)
+{
+	xc_interface *xch = xsd_glue_xch_of_val(v);
+
+	xc_interface_close(xch);
+}
+
+static struct custom_operations xsd_glue_xenctrl_ops = {
+	.identifier  = "xsd_glue.domain_getinfo_v1.xenctrl",
+	.finalize    = xsd_glue_xenctrl_finalize,
+	.compare     = custom_compare_default,     /* Can't compare     */
+	.hash        = custom_hash_default,        /* Can't hash        */
+	.serialize   = custom_serialize_default,   /* Can't serialize   */
+	.deserialize = custom_deserialize_default, /* Can't deserialize */
+	.compare_ext = custom_compare_ext_default, /* Can't compare     */
+};
+
+static void Noreturn xsd_glue_failwith(
+	xc_interface *xch, const char *func, unsigned int line)
+{
+	CAMLparam0();
+	CAMLlocal1(msg);
+	const xc_error *error = xch ? xc_get_last_error(xch) : NULL;
+	char *str = NULL;
+
+#define ERR (error && error->code != XC_ERROR_NONE)
+
+	int ret = asprintf(&str,
+			"%d: %s%s%s - called from %s:%u",
+			ERR ? error->code : errno,
+			ERR ? xc_error_code_to_desc(error->code) : strerror(errno),
+			ERR ? ": " : "",
+			ERR ? error->message : "",
+			func, line);
+
+#undef ERR
+
+	if (!*str || (ret == -1))
+		caml_raise_out_of_memory();
+
+	msg = caml_copy_string(str);
+	free(str);
+
+	caml_raise_with_arg(*caml_named_value("xsg.error_v1"), msg);
+}
+#define xsd_glue_failwith(xch) xsd_glue_failwith(xch, __func__, __LINE__)
+
+CAMLprim value stub_xsd_glue_xc_interface_open(value unit)
+{
+	CAMLparam1(unit);
+	CAMLlocal1(result);
+	xc_interface *xch;
+
+	result = caml_alloc_custom(&xsd_glue_xenctrl_ops, sizeof(xch), 0, 1);
+
+	caml_enter_blocking_section();
+	xch = xc_interface_open(NULL, NULL, 0);
+	caml_leave_blocking_section();
+
+	if (!xch)
+		xsd_glue_failwith(xch);
+
+	*(xc_interface **)Data_custom_val(result) = xch;
+
+	CAMLreturn(result);
+}
+
+static value xsd_glue_alloc_domaininfo(const xc_domaininfo_t *info)
+{
+	CAMLparam0();
+	CAMLlocal1(result);
+
+	result = caml_alloc_tuple(4);
+
+	Store_field(result,  0, Val_int(info->domain));
+	Store_field(result,  1, Val_bool(info->flags & XEN_DOMINF_dying));
+	Store_field(result,  2, Val_bool(info->flags & XEN_DOMINF_shutdown));
+	Store_field(result,  3, Val_int(MASK_EXTR(info->flags, XEN_DOMINF_shutdownmask)));
+
+	CAMLreturn(result);
+}
+
+CAMLprim value stub_xsd_glue_xc_domain_getinfo(value xch_val, value domid)
+{
+	CAMLparam2(xch_val, domid);
+	CAMLlocal1(result);
+	xc_interface *xch = xsd_glue_xch_of_val(xch_val);
+	xc_domaininfo_t info;
+	int ret;
+	int domid_c = Int_val(domid);
+
+	caml_enter_blocking_section();
+	ret = xc_domain_getinfo_single(xch, domid_c, &info);
+	caml_leave_blocking_section();
+
+	if (ret < 0)
+		xsd_glue_failwith(xch);
+
+	result = xsd_glue_alloc_domaininfo(&info);
+
+	CAMLreturn(result);
+}
+
+CAMLprim value stub_xsd_glue_xc_domain_getinfolist(value xch_val)
+{
+	CAMLparam1(xch_val);
+	CAMLlocal1(result);
+	xc_interface *xch = xsd_glue_xch_of_val(xch_val);
+	xc_domaininfo_t *info;
+	int i, retval;
+
+	/* get the minimum number of allocate byte we need and bump it up to page boundary */
+	info = malloc(sizeof(xc_domaininfo_t) * DOMID_FIRST_RESERVED);
+	if (!info)
+		caml_raise_out_of_memory();
+
+	caml_enter_blocking_section();
+	retval = xc_domain_getinfolist(xch, 0, DOMID_FIRST_RESERVED, info);
+	caml_leave_blocking_section();
+
+	if (retval <= 0) {
+		free(info);
+		xsd_glue_failwith(xch);
+	}
+
+	result = caml_alloc(retval, 0);
+	for (i = 0; i < retval; i++) {
+		caml_modify(&Field(result, i), xsd_glue_alloc_domaininfo(info + i));
+	}
+
+	free(info);
+	CAMLreturn(result);
+}
diff --git a/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/domain_getinfo_v1.ml b/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/domain_getinfo_v1.ml
new file mode 100644
index 0000000000..be50853c4b
--- /dev/null
+++ b/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/domain_getinfo_v1.ml
@@ -0,0 +1,35 @@
+(* SPDX-License-Identifier: LGPL-2.1-only WITH OCaml-LGPL-linking-exception *)
+(** Minimal interface on top of unstable Xenctrl for Oxenstored's usage *)
+
+module P = Plugin_interface_v1
+
+module M : P.Domain_getinfo_V1 = struct
+  exception Error of string
+
+  type domid = int
+  type handle
+
+  type domaininfo = {
+    domid : domid;
+    dying : bool;
+    shutdown : bool;
+    shutdown_code : int;
+  }
+
+  external interface_open : unit -> handle = "stub_xsd_glue_xc_interface_open"
+
+  external domain_getinfo : handle -> domid -> domaininfo
+    = "stub_xsd_glue_xc_domain_getinfo"
+
+  external domain_getinfolist : handle -> domaininfo array
+    = "stub_xsd_glue_xc_domain_getinfolist"
+
+  let _ = Callback.register_exception "xsg.error_v1" (Error "register_callback")
+end
+
+let () =
+  Printf.ksprintf !P.logging_function "Registration of %s plugin started\n%!"
+    __MODULE__;
+  P.register_plugin_v1 (module M : P.Domain_getinfo_V1);
+  Printf.ksprintf !P.logging_function "Registration of %s plugin successful\n%!"
+    __MODULE__
diff --git a/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/domain_getinfo_v1.mli b/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/domain_getinfo_v1.mli
new file mode 100644
index 0000000000..465beda1a3
--- /dev/null
+++ b/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/domain_getinfo_v1.mli
@@ -0,0 +1 @@
+(* SPDX-License-Identifier: LGPL-2.1-only WITH OCaml-LGPL-linking-exception *)
diff --git a/tools/ocaml/libs/xsd_glue/plugin_interface_v1.ml b/tools/ocaml/libs/xsd_glue/plugin_interface_v1.ml
new file mode 100644
index 0000000000..5ab98b83bd
--- /dev/null
+++ b/tools/ocaml/libs/xsd_glue/plugin_interface_v1.ml
@@ -0,0 +1,30 @@
+(* SPDX-License-Identifier: LGPL-2.1-only WITH OCaml-LGPL-linking-exception *)
+
+module type Domain_getinfo_V1 = sig
+  exception Error of string
+
+  type domid = int
+  type handle
+
+  type domaininfo = {
+    domid : domid;
+    dying : bool;
+    shutdown : bool;
+    shutdown_code : int;
+  }
+
+  val interface_open : unit -> handle
+  val domain_getinfo : handle -> domid -> domaininfo
+  val domain_getinfolist : handle -> domaininfo array
+end
+
+let ignore_logging : string -> unit = ignore
+let logging_function = ref ignore_logging
+let register_logging_function func = logging_function := func
+let plugin_implementation_v1 : (module Domain_getinfo_V1) option ref = ref None
+let register_plugin_v1 m = plugin_implementation_v1 := Some m
+
+let get_plugin_v1 () : (module Domain_getinfo_V1) =
+  match !plugin_implementation_v1 with
+  | Some s -> s
+  | None -> failwith "No plugin loaded"
diff --git a/tools/ocaml/libs/xsd_glue/plugin_interface_v1.mli b/tools/ocaml/libs/xsd_glue/plugin_interface_v1.mli
new file mode 100644
index 0000000000..69f91510f7
--- /dev/null
+++ b/tools/ocaml/libs/xsd_glue/plugin_interface_v1.mli
@@ -0,0 +1,38 @@
+(* SPDX-License-Identifier: LGPL-2.1-only WITH OCaml-LGPL-linking-exception *)
+
+(** To avoid breaking the plugin interface, this module needs to be
+    standalone and can't rely on any other Xen library. Even unrelated
+    changes in the interfaces of those modules would change the hash
+    of this interface and break the plugin system.
+    It can only depend on Stdlib, therefore all of the types (domid,
+    domaininfo etc.) are redefined here instead of using alternatives
+    defined elsewhere.
+
+    NOTE: The signature of this interface should not be changed (no
+    functions or types can be added, modified, or removed). If
+    underlying Xenctrl changes require a new interface, a V2 with a
+    corresponding plugin should be created.
+*)
+
+module type Domain_getinfo_V1 = sig
+  exception Error of string
+
+  type domid = int
+  type handle
+
+  type domaininfo = {
+    domid : domid;
+    dying : bool;
+    shutdown : bool;
+    shutdown_code : int;
+  }
+
+  val interface_open : unit -> handle
+  val domain_getinfo : handle -> domid -> domaininfo
+  val domain_getinfolist : handle -> domaininfo array
+end
+
+val register_logging_function : (string -> unit) -> unit
+val logging_function : (string -> unit) ref
+val register_plugin_v1 : (module Domain_getinfo_V1) -> unit
+val get_plugin_v1 : unit -> (module Domain_getinfo_V1)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 12:45:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 12:45:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796586.1206271 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMif-0005u9-Lf; Wed, 11 Sep 2024 12:45:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796586.1206271; Wed, 11 Sep 2024 12:45:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMif-0005u1-J3; Wed, 11 Sep 2024 12:45:13 +0000
Received: by outflank-mailman (input) for mailman id 796586;
 Wed, 11 Sep 2024 12:45:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMie-0005tr-NA
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:45:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMie-0002Kx-MQ
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:45:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMie-0002Tn-LU
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:45:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LyewV2LA3mrvtvzP2/48pzog2B++bPaWTX68Sinle1k=; b=OEOYy/QTWiUI4woKYLQoaNhPdY
	fd+fQOKQvyLK6Xgb1Bj9XE956YQxjY7TnT/nM8RybUnFRPsc6Ap7pK63Fbp1tFonWh+j8XbDES6YS
	HNi/fKt1wcmKroHIB7Jhk/KyAlF8Rt+44IduOMcZFI6H6VQrN4uvKaj17zSUadYAvmII=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/oxenstored: Load the plugin for Xenctrl.domain_getinfo
Message-Id: <E1soMie-0002Tn-LU@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 12:45:12 +0000

commit 8d3ca1b23b5413ea68109f9d0d719aef65819d9a
Author:     Andrii Sultanov <andrii.sultanov@cloud.com>
AuthorDate: Mon Sep 9 13:02:41 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    tools/oxenstored: Load the plugin for Xenctrl.domain_getinfo
    
    Oxenstored dynamically loads the plugin provided in ocaml/libs/xsd_glue.
    The plugin is verified to be providing the specified plugin_interface
    during its loading.
    
    If a V2 of the plugin is produced, V1 will still be present, and a new
    version should only be loaded if it's verified to exist
    (New oxenstored can run in an environment with only V1 of the plugin).
    
    The plugin is not switched to as of yet, the old Xenctrl stubs are still
    used.
    
    Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/ocaml/xenstored/Makefile    |  5 ++++-
 tools/ocaml/xenstored/domains.ml  | 28 ++++++++++++++++++++++++++++
 tools/ocaml/xenstored/paths.ml.in |  1 +
 3 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/tools/ocaml/xenstored/Makefile b/tools/ocaml/xenstored/Makefile
index fa45305d8c..5e8210a906 100644
--- a/tools/ocaml/xenstored/Makefile
+++ b/tools/ocaml/xenstored/Makefile
@@ -15,7 +15,8 @@ OCAMLINCLUDE += \
 	-I $(OCAML_TOPLEVEL)/libs/xb \
 	-I $(OCAML_TOPLEVEL)/libs/mmap \
 	-I $(OCAML_TOPLEVEL)/libs/xc \
-	-I $(OCAML_TOPLEVEL)/libs/eventchn
+	-I $(OCAML_TOPLEVEL)/libs/eventchn \
+	-I $(OCAML_TOPLEVEL)/libs/xsd_glue
 
 LIBS = syslog.cma syslog.cmxa poll.cma poll.cmxa
 syslog_OBJS = syslog
@@ -59,6 +60,7 @@ INTF = symbol.cmi trie.cmi syslog.cmi systemd.cmi poll.cmi
 
 XENSTOREDLIBS = \
 	unix.cmxa \
+	dynlink.cmxa \
 	-ccopt -L -ccopt . syslog.cmxa \
 	-ccopt -L -ccopt . systemd.cmxa \
 	-ccopt -L -ccopt . poll.cmxa \
@@ -66,6 +68,7 @@ XENSTOREDLIBS = \
 	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/eventchn $(OCAML_TOPLEVEL)/libs/eventchn/xeneventchn.cmxa \
 	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/xc $(OCAML_TOPLEVEL)/libs/xc/xenctrl.cmxa \
 	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/xb $(OCAML_TOPLEVEL)/libs/xb/xenbus.cmxa \
+	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/xsd_glue $(OCAML_TOPLEVEL)/libs/xsd_glue/plugin_interface_v1.cmxa \
 	-ccopt -L -ccopt $(XEN_ROOT)/tools/libs/ctrl
 
 PROGRAMS = oxenstored
diff --git a/tools/ocaml/xenstored/domains.ml b/tools/ocaml/xenstored/domains.ml
index 7a3056c364..c233065711 100644
--- a/tools/ocaml/xenstored/domains.ml
+++ b/tools/ocaml/xenstored/domains.ml
@@ -20,6 +20,34 @@ let warn fmt  = Logging.warn  "domains" fmt
 
 let xc = Xenctrl.interface_open ()
 
+let load_plug fname =
+  let fail_with fmt = Printf.ksprintf failwith fmt in
+  let fname = Dynlink.adapt_filename fname in
+  if Sys.file_exists fname then
+    try Dynlink.loadfile fname with
+    | Dynlink.Error err as e ->
+      error "ERROR loading plugin '%s': %s\n%!" fname
+        (Dynlink.error_message err);
+      raise e
+    | _ -> fail_with "Unknown error while loading plugin"
+  else fail_with "Plugin file '%s' does not exist" fname
+
+let () =
+  let plugins_dir = Paths.libexec ^ "/ocaml/xsd_glue/xenctrl_plugin/" in
+  let filepath = plugins_dir ^ "domain_getinfo_v1.cmxs" in
+  debug "Trying to load plugin '%s'\n%!" filepath;
+  let list_files = Sys.readdir plugins_dir in
+  debug "Directory listing of '%s'\n%!" plugins_dir ;
+  Array.iter (fun x -> debug "\t%s\n%!" x) list_files;
+  Dynlink.allow_only [ "Plugin_interface_v1" ];
+  load_plug filepath
+
+module Plugin =
+  (val Plugin_interface_v1.get_plugin_v1 ()
+    : Plugin_interface_v1.Domain_getinfo_V1)
+
+let handle = Plugin.interface_open ()
+
 type domains = {
   eventchn: Event.t;
   table: (Xenctrl.domid, Domain.t) Hashtbl.t;
diff --git a/tools/ocaml/xenstored/paths.ml.in b/tools/ocaml/xenstored/paths.ml.in
index 37949dc8f3..acb6ea4ca7 100644
--- a/tools/ocaml/xenstored/paths.ml.in
+++ b/tools/ocaml/xenstored/paths.ml.in
@@ -2,3 +2,4 @@ let xen_log_dir = "@XEN_LOG_DIR@"
 let xen_config_dir = "@XEN_CONFIG_DIR@"
 let xen_run_dir = "@XEN_RUN_DIR@"
 let xen_run_stored = "@XEN_RUN_STORED@"
+let libexec = "@LIBEXEC@"
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 12:45:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 12:45:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796587.1206274 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMip-0005wh-N1; Wed, 11 Sep 2024 12:45:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796587.1206274; Wed, 11 Sep 2024 12:45:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMip-0005wa-KS; Wed, 11 Sep 2024 12:45:23 +0000
Received: by outflank-mailman (input) for mailman id 796587;
 Wed, 11 Sep 2024 12:45:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMio-0005wQ-Po
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:45:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMio-0002L7-PB
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:45:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMio-0002Ub-OV
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:45:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BhzM1QXrGa8LgivaQmgixNnUM0IDXoCbQEQiekpB7AA=; b=ETIIdfUe4wA2UFot7mUv9pWfHG
	EI0t4O4ZZ0suxZI0gr7wnxvRE9rTtgzoA57Rvme2P3I+lxcAxOuA65Idsq6tj75/tLOXvcpq0Pq4v
	sn2j8QPAvnpJdTmj6fF5I75yYO22U4qwzxp3Dx3F2uR+xeBzVlZdW/NSCmp3h9O73X5I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/oxenstored: Switch to using the plugin for Xenctrl.domain_getinfo
Message-Id: <E1soMio-0002Ub-OV@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 12:45:22 +0000

commit 52e6db7a8cc5654562fc821e836edfbab374e06c
Author:     Andrii Sultanov <andrii.sultanov@cloud.com>
AuthorDate: Mon Sep 9 13:02:42 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    tools/oxenstored: Switch to using the plugin for Xenctrl.domain_getinfo
    
    Also run 'make format' on the file to reformat an adjacent block of code
    correctly.
    
    Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/ocaml/xenstored/domains.ml | 51 ++++++++++++++++++++--------------------
 1 file changed, 25 insertions(+), 26 deletions(-)

diff --git a/tools/ocaml/xenstored/domains.ml b/tools/ocaml/xenstored/domains.ml
index c233065711..fabca00e6b 100644
--- a/tools/ocaml/xenstored/domains.ml
+++ b/tools/ocaml/xenstored/domains.ml
@@ -49,8 +49,8 @@ module Plugin =
 let handle = Plugin.interface_open ()
 
 type domains = {
-  eventchn: Event.t;
-  table: (Xenctrl.domid, Domain.t) Hashtbl.t;
+  eventchn : Event.t;
+  table : (Plugin.domid, Domain.t) Hashtbl.t;
 
   (* N.B. the Queue module is not thread-safe but oxenstored is single-threaded. *)
   (* Domains queue up to regain conflict-credit; we have a queue for
@@ -121,30 +121,29 @@ let cleanup doms =
   let notify = ref false in
   let dead_dom = ref [] in
 
-  Hashtbl.iter (fun id _ -> if id <> 0 then
-                   try
-                     let info = Xenctrl.domain_getinfo xc id in
-                     if info.Xenctrl.shutdown || info.Xenctrl.dying then (
-                       debug "Domain %u died (dying=%b, shutdown %b -- code %d)"
-                         id info.Xenctrl.dying info.Xenctrl.shutdown info.Xenctrl.shutdown_code;
-                       if info.Xenctrl.dying then
-                         dead_dom := id :: !dead_dom
-                       else
-                         notify := true;
-                     )
-                   with Xenctrl.Error _ ->
-                     debug "Domain %u died -- no domain info" id;
-                     dead_dom := id :: !dead_dom;
-               ) doms.table;
-  List.iter (fun id ->
-      let dom = Hashtbl.find doms.table id in
-      Domain.close dom;
-      Hashtbl.remove doms.table id;
-      if dom.Domain.conflict_credit <= !Define.conflict_burst_limit
-      then (
-        remove_from_queue dom doms.doms_with_conflict_penalty;
-        if (dom.Domain.conflict_credit <= 0.) then remove_from_queue dom doms.doms_conflict_paused
-      )
+  Hashtbl.iter
+    (fun id _ ->
+       if id <> 0 then (
+         try
+           let info = Plugin.domain_getinfo handle id in
+           if info.Plugin.shutdown || info.Plugin.dying then (
+             debug "Domain %u died (dying=%b, shutdown %b -- code %d)" id
+               info.Plugin.dying info.Plugin.shutdown info.Plugin.shutdown_code;
+             if info.Plugin.dying then dead_dom := id :: !dead_dom else notify := true)
+         with Plugin.Error _ ->
+           debug "Domain %u died -- no domain info" id;
+           dead_dom := id :: !dead_dom))
+    doms.table;
+  List.iter
+    (fun id ->
+       let dom = Hashtbl.find doms.table id in
+       Domain.close dom;
+       Hashtbl.remove doms.table id;
+       if dom.Domain.conflict_credit <= !Define.conflict_burst_limit
+       then (
+         remove_from_queue dom doms.doms_with_conflict_penalty;
+         if (dom.Domain.conflict_credit <= 0.) then remove_from_queue dom doms.doms_conflict_paused
+       )
     ) !dead_dom;
   !notify, !dead_dom
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 12:45:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 12:45:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796588.1206279 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMiz-0005zP-PS; Wed, 11 Sep 2024 12:45:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796588.1206279; Wed, 11 Sep 2024 12:45:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMiz-0005zH-M5; Wed, 11 Sep 2024 12:45:33 +0000
Received: by outflank-mailman (input) for mailman id 796588;
 Wed, 11 Sep 2024 12:45:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMiy-0005z4-Sy
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:45:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMiy-0002LE-SC
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:45:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMiy-0002VJ-RK
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:45:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yVWnq1tbpdXph+8Nkl1j0t0IIXl+qkzA/TxQknqD9e8=; b=Tof5xNIjCzxIc/1Q1oAnE6Vs9F
	lmUaSKYDgbqHa6CZfs9u7xqL5C9AbdoloHPH95Ef+dQfBFcAs/w213IUE3vKd3v0uP3OgaLKZ6rWJ
	hqIG981MD80+O/HUlsc//mLy1f7Wgrx/lCvSk4K6CAeaVfWti3XTyJ1qiDtw50NJgd3Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Optimise 32 bit C source code
Message-Id: <E1soMiy-0002VJ-RK@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 12:45:32 +0000

commit bbe4035e6727d259dbb65c3ce432a508822a8957
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Mon Sep 9 14:22:15 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    x86/boot: Optimise 32 bit C source code
    
    The various filters are removing all optimisations.
    No need to have all optimisations turned off.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/boot/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index 8f5bbff0cc..dfe3cb7034 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -15,7 +15,7 @@ CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_TREEWIDE_CFLAGS))
 $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
 CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float -mregparm=3
 CFLAGS_x86_32 += -nostdinc -include $(filter %/include/xen/config.h,$(XEN_CFLAGS))
-CFLAGS_x86_32 += $(filter -I%,$(XEN_CFLAGS))
+CFLAGS_x86_32 += $(filter -I% -O%,$(XEN_CFLAGS))
 
 # override for 32bit binaries
 $(head-bin-objs): CFLAGS_stack_boundary :=
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 12:45:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 12:45:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796589.1206282 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMj9-00062R-RH; Wed, 11 Sep 2024 12:45:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796589.1206282; Wed, 11 Sep 2024 12:45:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMj9-00062K-Oo; Wed, 11 Sep 2024 12:45:43 +0000
Received: by outflank-mailman (input) for mailman id 796589;
 Wed, 11 Sep 2024 12:45:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMj8-00062D-Vf
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:45:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMj8-0002LN-Uz
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:45:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMj8-0002WA-UJ
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:45:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=S/EJzf4sGjUgEM+d7l+V53GzTbTk7fyp/kR/ZdkA5Q4=; b=Rt4N30wrj3hdw1zIV4AGORPI+4
	8yYj5zguJwHBgNX6JxmhSwu5AjUIds1JcKjccALylyfQ9MOdmhR9yk/sKfRFwwO3Y9n1zlK5rlS/3
	hw5F64M1czb7XB7hcqX1KPSb8XK2pwiQZsBAsOeiwDlGzpg+vJho8ar6a9RBBOuzbeOk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Add missing __XEN__ definition for 32 bit code
Message-Id: <E1soMj8-0002WA-UJ@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 12:45:42 +0000

commit be21da24c6a264eafbdd3b41ade838771fc56a2d
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Mon Sep 9 14:22:16 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    x86/boot: Add missing __XEN__ definition for 32 bit code
    
    We are compiling Xen source code so we should define __XEN__ macro.
    We don't want to import all definitions from XEN_CFLAGS (as done for
    other options) because most of them are processor dependent and
    do not apply to 32 bit.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/boot/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index dfe3cb7034..ff0f965876 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -15,7 +15,7 @@ CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_TREEWIDE_CFLAGS))
 $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
 CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float -mregparm=3
 CFLAGS_x86_32 += -nostdinc -include $(filter %/include/xen/config.h,$(XEN_CFLAGS))
-CFLAGS_x86_32 += $(filter -I% -O%,$(XEN_CFLAGS))
+CFLAGS_x86_32 += $(filter -I% -O%,$(XEN_CFLAGS)) -D__XEN__
 
 # override for 32bit binaries
 $(head-bin-objs): CFLAGS_stack_boundary :=
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 12:45:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 12:45:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796590.1206287 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMjK-00065R-Sx; Wed, 11 Sep 2024 12:45:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796590.1206287; Wed, 11 Sep 2024 12:45:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMjK-00065J-QJ; Wed, 11 Sep 2024 12:45:54 +0000
Received: by outflank-mailman (input) for mailman id 796590;
 Wed, 11 Sep 2024 12:45:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMjJ-00064t-2d
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:45:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMjJ-0002Lo-1v
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:45:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMjJ-0002Wz-0v
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:45:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WFbk6SH+y149H+oyI63QButCRD52jHAQ1Pt5FT4WGqg=; b=2GTi85f7SZ1zNpzP/RE5bjEMij
	Z9svS9YPYJwnlTr23FR2gRvZEy4CWG7O3PE3AYM8DdiTnJwPPfyfwSeIKWVth9vsjhy6P/FEVdEFl
	IwPftjky2epnsOfrvhut3ge+hnDh1P3Cl6voK0mnIIQB33ag3d3Y34mvz7Cr7pMTYIHA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/build: Rework includes in genapic/probe.c
Message-Id: <E1soMjJ-0002Wz-0v@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 12:45:53 +0000

commit e58d41e9f00aa759122adb7dbe2d0bb0176a02ba
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Sep 5 21:40:20 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    x86/build: Rework includes in genapic/probe.c
    
    probe.c includes a large number of headers which are unused, and not from
    churn so far as I can see in history.  Strip back to a reasonable set.
    
    One complication is that genapic.h has to include xen/cpumask.h because
    there's no way to forward declare a cpumask_t.
    
    Also strip trailing whitespace while adjusting the file.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/genapic/probe.c       | 34 ++++++++++++++++------------------
 xen/arch/x86/include/asm/genapic.h |  2 ++
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/xen/arch/x86/genapic/probe.c b/xen/arch/x86/genapic/probe.c
index 10ceeae4d2..946c3d3ce3 100644
--- a/xen/arch/x86/genapic/probe.c
+++ b/xen/arch/x86/genapic/probe.c
@@ -1,25 +1,23 @@
-/* Copyright 2003 Andi Kleen, SuSE Labs. 
- * Subject to the GNU Public License, v.2 
- * 
+/* Copyright 2003 Andi Kleen, SuSE Labs.
+ * Subject to the GNU Public License, v.2
+ *
  * Generic x86 APIC driver probe layer.
- */  
-#include <xen/cpumask.h>
-#include <xen/string.h>
-#include <xen/kernel.h>
-#include <xen/ctype.h>
+ */
+#include <xen/bug.h>
+#include <xen/errno.h>
 #include <xen/init.h>
 #include <xen/param.h>
-#include <asm/cache.h>
-#include <asm/fixmap.h>
-#include <asm/mpspec.h>
-#include <asm/apicdef.h>
-#include <asm/mach-generic/mach_apic.h>
-#include <asm/setup.h>
+#include <xen/sections.h>
+#include <xen/string.h>
+#include <xen/types.h>
+
+#include <asm/apic.h>
+#include <asm/genapic.h>
 
 struct genapic __ro_after_init genapic;
 
 static const struct genapic *const __initconstrel apic_probe[] = {
-	&apic_bigsmp, 
+	&apic_bigsmp,
 	&apic_default,	/* must be last */
 	NULL,
 };
@@ -57,8 +55,8 @@ static int __init cf_check genapic_apic_force(const char *str)
 }
 custom_param("apic", genapic_apic_force);
 
-void __init generic_apic_probe(void) 
-{ 
+void __init generic_apic_probe(void)
+{
 	int i;
 
 	record_boot_APIC_mode();
@@ -75,4 +73,4 @@ void __init generic_apic_probe(void)
 	BUG_ON(!genapic.name);
 
 	printk(KERN_INFO "Using APIC driver %s\n", genapic.name);
-} 
+}
diff --git a/xen/arch/x86/include/asm/genapic.h b/xen/arch/x86/include/asm/genapic.h
index 970df8ffe0..a694371c6d 100644
--- a/xen/arch/x86/include/asm/genapic.h
+++ b/xen/arch/x86/include/asm/genapic.h
@@ -1,6 +1,8 @@
 #ifndef _ASM_GENAPIC_H
 #define _ASM_GENAPIC_H 1
 
+#include <xen/cpumask.h>
+
 /*
  * Generic APIC driver interface.
  *
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 12:46:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 12:46:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796591.1206290 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMjU-00067u-UF; Wed, 11 Sep 2024 12:46:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796591.1206290; Wed, 11 Sep 2024 12:46:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMjU-00067m-Ri; Wed, 11 Sep 2024 12:46:04 +0000
Received: by outflank-mailman (input) for mailman id 796591;
 Wed, 11 Sep 2024 12:46:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMjT-00067b-5h
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:46:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMjT-0002M9-52
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:46:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMjT-0002YW-4E
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:46:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MkMNlMqlez2i1FMUImqA/pNlnN2fLFzByauY3X7y2vI=; b=mIHMmsoAncMZUY85KkmKH8g+u/
	+uxlo+U3AiQ6/cCQd6JATGfuMdsqyYAvHxtyHpP/8KeldxQiT1eyr01ByUzInu1qoj/zuvbofHtS8
	mmiPUdBTg0IyPqCqsMB7XbGzCDFLyxj9grOJHG498fmMubpFE64fFpDb14O7SCAe0PWI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/build: Drop unused includes of xen/cache.h
Message-Id: <E1soMjT-0002YW-4E@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 12:46:03 +0000

commit a4194782da80f530e58dc8d074cab03ece25ee0e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu May 30 21:22:56 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    xen/build: Drop unused includes of xen/cache.h
    
    None of these are used, not even transitively.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/bzimage.c               | 1 -
 xen/arch/x86/dmi_scan.c              | 1 -
 xen/arch/x86/include/asm/processor.h | 1 -
 xen/common/decompress.h              | 1 -
 xen/include/acpi/platform/aclinux.h  | 1 -
 xen/include/xen/rcupdate.h           | 1 -
 6 files changed, 6 deletions(-)

diff --git a/xen/arch/x86/bzimage.c b/xen/arch/x86/bzimage.c
index ac4fd428be..66f648f311 100644
--- a/xen/arch/x86/bzimage.c
+++ b/xen/arch/x86/bzimage.c
@@ -1,4 +1,3 @@
-#include <xen/cache.h>
 #include <xen/errno.h>
 #include <xen/lib.h>
 #include <xen/mm.h>
diff --git a/xen/arch/x86/dmi_scan.c b/xen/arch/x86/dmi_scan.c
index 9257aee2ab..2fcc485295 100644
--- a/xen/arch/x86/dmi_scan.c
+++ b/xen/arch/x86/dmi_scan.c
@@ -3,7 +3,6 @@
 #include <xen/kernel.h>
 #include <xen/string.h>
 #include <xen/init.h>
-#include <xen/cache.h>
 #include <xen/acpi.h>
 #include <asm/io.h>
 #include <asm/system.h>
diff --git a/xen/arch/x86/include/asm/processor.h b/xen/arch/x86/include/asm/processor.h
index e71dbb8d3f..26e2fb1369 100644
--- a/xen/arch/x86/include/asm/processor.h
+++ b/xen/arch/x86/include/asm/processor.h
@@ -5,7 +5,6 @@
 #define __ASM_X86_PROCESSOR_H
 
 #ifndef __ASSEMBLY__
-#include <xen/cache.h>
 #include <xen/types.h>
 #include <xen/smp.h>
 #include <xen/percpu.h>
diff --git a/xen/common/decompress.h b/xen/common/decompress.h
index e8195b353a..4683eb6c7e 100644
--- a/xen/common/decompress.h
+++ b/xen/common/decompress.h
@@ -1,6 +1,5 @@
 #ifdef __XEN__
 
-#include <xen/cache.h>
 #include <xen/decompress.h>
 #include <xen/init.h>
 #include <xen/string.h>
diff --git a/xen/include/acpi/platform/aclinux.h b/xen/include/acpi/platform/aclinux.h
index f5e0a6108e..a66c2e6d1d 100644
--- a/xen/include/acpi/platform/aclinux.h
+++ b/xen/include/acpi/platform/aclinux.h
@@ -47,7 +47,6 @@
 #define ACPI_USE_SYSTEM_CLIBRARY
 #define ACPI_USE_DO_WHILE_0
 
-#include <xen/cache.h>
 #include <xen/string.h>
 #include <xen/kernel.h>
 #include <xen/ctype.h>
diff --git a/xen/include/xen/rcupdate.h b/xen/include/xen/rcupdate.h
index 6f2587058e..95f4ad81c4 100644
--- a/xen/include/xen/rcupdate.h
+++ b/xen/include/xen/rcupdate.h
@@ -31,7 +31,6 @@
 #ifndef __XEN_RCUPDATE_H
 #define __XEN_RCUPDATE_H
 
-#include <xen/cache.h>
 #include <xen/compiler.h>
 #include <xen/spinlock.h>
 #include <xen/cpumask.h>
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 12:46:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 12:46:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796592.1206295 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMje-0006AF-Vx; Wed, 11 Sep 2024 12:46:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796592.1206295; Wed, 11 Sep 2024 12:46:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMje-0006A7-T8; Wed, 11 Sep 2024 12:46:14 +0000
Received: by outflank-mailman (input) for mailman id 796592;
 Wed, 11 Sep 2024 12:46:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMjd-00069x-8s
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:46:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMjd-0002ML-87
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:46:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMjd-0002ZP-7Q
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:46:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JdgRktblnD/0y4ID1tY6A6v+t4pgy6rqttJn1bIyVu4=; b=EfMAyVZFMTFkUH2bDu6ZAUAh7K
	gEHrboL3h4NGUwUP19qUlb70bmpYBGFnpUWQxRybLKKMxdUI8ohnINVnHP9w8DOL7hXZaiTK4e/3A
	0oXr9PwYochXlUJ2NWdfv1iqvS6iJ/cnQvtuuamPQy528llFXAPB4mxKANy1dHl/jbXE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/build: Swap cache.h includes for xen/sections.h
Message-Id: <E1soMjd-0002ZP-7Q@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 12:46:13 +0000

commit 41556be010f447df2683649a149a8c0ca2abc76b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Sep 5 20:18:06 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    x86/build: Swap cache.h includes for xen/sections.h
    
    These include {xen/asm}/cache.h but only want xen/sections.h.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/acpi/cpu_idle.c    | 3 ++-
 xen/arch/x86/cpu-policy.c       | 2 +-
 xen/arch/x86/guest/hypervisor.c | 2 +-
 xen/common/efi/runtime.c        | 3 ++-
 4 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index f175e4d7d3..876317fad0 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -40,7 +40,8 @@
 #include <xen/param.h>
 #include <xen/trace.h>
 #include <xen/irq.h>
-#include <asm/cache.h>
+#include <xen/sections.h>
+
 #include <asm/io.h>
 #include <asm/iocap.h>
 #include <asm/hpet.h>
diff --git a/xen/arch/x86/cpu-policy.c b/xen/arch/x86/cpu-policy.c
index 1f5e42db5b..b6d9fad567 100644
--- a/xen/arch/x86/cpu-policy.c
+++ b/xen/arch/x86/cpu-policy.c
@@ -1,8 +1,8 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
-#include <xen/cache.h>
 #include <xen/kernel.h>
 #include <xen/param.h>
 #include <xen/sched.h>
+#include <xen/sections.h>
 
 #include <xen/lib/x86/cpu-policy.h>
 
diff --git a/xen/arch/x86/guest/hypervisor.c b/xen/arch/x86/guest/hypervisor.c
index ac80e83245..7afc5038b4 100644
--- a/xen/arch/x86/guest/hypervisor.c
+++ b/xen/arch/x86/guest/hypervisor.c
@@ -8,9 +8,9 @@
  */
 #include <xen/cpumask.h>
 #include <xen/init.h>
+#include <xen/sections.h>
 #include <xen/types.h>
 
-#include <asm/cache.h>
 #include <asm/guest.h>
 
 static struct hypervisor_ops __ro_after_init ops;
diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c
index d952c3ba78..d03e5c90ce 100644
--- a/xen/common/efi/runtime.c
+++ b/xen/common/efi/runtime.c
@@ -1,9 +1,10 @@
 #include "efi.h"
 #include "runtime.h"
-#include <xen/cache.h>
+
 #include <xen/errno.h>
 #include <xen/guest_access.h>
 #include <xen/irq.h>
+#include <xen/sections.h>
 #include <xen/time.h>
 
 DEFINE_XEN_GUEST_HANDLE(CHAR16);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 12:46:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 12:46:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796594.1206299 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMjp-0006Cx-1E; Wed, 11 Sep 2024 12:46:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796594.1206299; Wed, 11 Sep 2024 12:46:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMjo-0006Cp-Up; Wed, 11 Sep 2024 12:46:24 +0000
Received: by outflank-mailman (input) for mailman id 796594;
 Wed, 11 Sep 2024 12:46:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMjn-0006Cf-CA
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:46:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMjn-0002MV-BQ
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:46:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMjn-0002aG-AX
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:46:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/Gl60mH1yxpfu5so1CX7ts/SpgPVZEgLmsln2Mxkahs=; b=a5Kqq1hwH5BtePVTJC6YMQZV49
	4QDZuJStfv60oZTDH4vBs702puxVGLz8e7vAUmWcbfaVEIu2OXm8DF4IYJcBLIn8eSBdggSRbCYCV
	y0E4skDOgK1krkQzIYchDFIDtFNhoaokeMFNMtoaQDMGNbF59qiOzx1RA7Z7key3Iw8M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/cache: Drop legacy __read_mostly/__ro_after_init definitions
Message-Id: <E1soMjn-0002aG-AX@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 12:46:23 +0000

commit afc8d7dd300aae4b45eb74970b6db91d1161e397
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 21 20:59:46 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    x86/cache: Drop legacy __read_mostly/__ro_after_init definitions
    
    Lots of files were picking these up transitively, including lib.h
    
    However, lib.h needs __read_mostly for printk_once() and this has the side
    effect of kicking the transitive can down the road.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/cache.h | 3 ---
 xen/include/xen/cache.h          | 2 +-
 xen/include/xen/lib.h            | 1 +
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/include/asm/cache.h b/xen/arch/x86/include/asm/cache.h
index 956c05493e..f15d10dc7f 100644
--- a/xen/arch/x86/include/asm/cache.h
+++ b/xen/arch/x86/include/asm/cache.h
@@ -9,9 +9,6 @@
 #define L1_CACHE_SHIFT	(CONFIG_X86_L1_CACHE_SHIFT)
 #define L1_CACHE_BYTES	(1 << L1_CACHE_SHIFT)
 
-/* TODO: Phase out the use of this via cache.h */
-#define __read_mostly __section(".data.read_mostly")
-
 #ifndef __ASSEMBLY__
 
 void cache_flush(const void *addr, unsigned int size);
diff --git a/xen/include/xen/cache.h b/xen/include/xen/cache.h
index a19942fd63..90816ba05b 100644
--- a/xen/include/xen/cache.h
+++ b/xen/include/xen/cache.h
@@ -15,7 +15,7 @@
 #define __cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES)))
 #endif
 
-#if defined(CONFIG_ARM) || defined(CONFIG_X86)
+#if defined(CONFIG_ARM)
 /* TODO: Phase out the use of this via cache.h */
 #define __ro_after_init __section(".data.ro_after_init")
 #endif
diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
index e884a02ee8..81b722ea3e 100644
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -10,6 +10,7 @@
 #include <xen/types.h>
 #include <xen/xmalloc.h>
 #include <xen/string.h>
+#include <xen/sections.h>
 
 #define __ACCESS_ONCE(x) ({                             \
             (void)(typeof(x))0; /* Scalar typecheck. */ \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 12:46:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 12:46:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796598.1206303 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMjz-0006Lg-3W; Wed, 11 Sep 2024 12:46:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796598.1206303; Wed, 11 Sep 2024 12:46:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMjz-0006LY-01; Wed, 11 Sep 2024 12:46:35 +0000
Received: by outflank-mailman (input) for mailman id 796598;
 Wed, 11 Sep 2024 12:46:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMjx-0006LL-Fi
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:46:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMjx-0002Mf-Ex
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:46:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMjx-0002b5-E9
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:46:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=S2rZMFWQ0cbo3SXAzVsRSLkAF2vqZinODjkzDJM0Eyc=; b=tvZE0D+LVxl9YFWcHx1t5ymWEz
	U4nBIWb9c7USVjeF4wNgUzWr1h8dBBzBqzcN46ncb5hM/gtPKYySggAhmgwqIXu8HK4ih+21iPCdJ
	MVGCrgKymyFHO5qu8xLgShyVNNIgpHHp2Lp/KcOMfrMawEZIHpt92IKTPu3AUbtOFPj0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/ucode: Utilize ucode_force and remove opt_ucode_allow_same
Message-Id: <E1soMjx-0002b5-E9@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 12:46:33 +0000

commit 9a6250d80b9ec274852bdc6f8eb825d55ff4b45e
Author:     Fouad Hilly <fouad.hilly@cloud.com>
AuthorDate: Thu Aug 22 14:04:26 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 14:59:05 2024 +0100

    x86/ucode: Utilize ucode_force and remove opt_ucode_allow_same
    
    Pass xen-ucode flags to do low level checks on microcode version and utilize
    it to allow for microcode downgrade or reapply the same version of the
    microcode.  ucode_force is required to be passed to a low level Intel and AMD
    for version checks to be done.
    
    While adding ucode_force, opt_ucode_allow_same was removed.  Remove
    opt_ucode_allow_same from documentation.
    
    Update CHANGELOG.md for opt_ucode_allow_same removal.
    
    Signed-off-by: Fouad Hilly <fouad.hilly@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 CHANGELOG.md                         |  1 +
 docs/misc/xen-command-line.pandoc    |  7 +--
 xen/arch/x86/cpu/microcode/amd.c     |  6 ++-
 xen/arch/x86/cpu/microcode/core.c    | 95 +++++++++++++++++++++---------------
 xen/arch/x86/cpu/microcode/intel.c   |  7 +--
 xen/arch/x86/cpu/microcode/private.h |  7 +--
 6 files changed, 70 insertions(+), 53 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5521ae5bb3..26e7d8dd2a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ### Removed
  - On x86:
    - Support for running on Xeon Phi processors.
+   - Removed the `ucode=allow-same` command line option.
 
 ## [4.19.0](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.19.0) - 2024-07-29
 
diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 0a66e1ee2d..959cf45b55 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2650,7 +2650,7 @@ performance.
    Alternatively, selecting `tsx=1` will re-enable TSX at the users own risk.
 
 ### ucode
-> `= List of [ <integer> | scan=<bool>, nmi=<bool>, allow-same=<bool> ]`
+> `= List of [ <integer> | scan=<bool>, nmi=<bool> ]`
 
     Applicability: x86
     Default: `nmi`
@@ -2682,11 +2682,6 @@ precedence over `scan`.
 stop_machine context. In NMI handler, even NMIs are blocked, which is
 considered safer. The default value is `true`.
 
-'allow-same' alters the default acceptance policy for new microcode to permit
-trying to reload the same version.  Many CPUs will actually reload microcode
-of the same version, and this allows for easy testing of the late microcode
-loading path.
-
 ### unrestricted_guest (Intel)
 > `= <boolean>`
 
diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index f76a563c8b..d2a26967c6 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -214,13 +214,15 @@ static enum microcode_match_result cf_check compare_patch(
     return compare_header(new, old);
 }
 
-static int cf_check apply_microcode(const struct microcode_patch *patch)
+static int cf_check apply_microcode(const struct microcode_patch *patch,
+                                    unsigned int flags)
 {
     int hw_err;
     unsigned int cpu = smp_processor_id();
     struct cpu_signature *sig = &per_cpu(cpu_sig, cpu);
     uint32_t rev, old_rev = sig->rev;
     enum microcode_match_result result = microcode_fits(patch);
+    bool ucode_force = flags & XENPF_UCODE_FORCE;
 
     if ( result == MIS_UCODE )
         return -EINVAL;
@@ -229,7 +231,7 @@ static int cf_check apply_microcode(const struct microcode_patch *patch)
      * Allow application of the same revision to pick up SMT-specific changes
      * even if the revision of the other SMT thread is already up-to-date.
      */
-    if ( result == OLD_UCODE )
+    if ( !ucode_force && (result == SAME_UCODE || result == OLD_UCODE) )
         return -EEXIST;
 
     if ( check_final_patch_levels(sig) )
diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index 8a9e744489..8564e4d2c9 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -90,6 +90,11 @@ struct ucode_mod_blob {
     size_t size;
 };
 
+struct patch_with_flags {
+    unsigned int flags;
+    const struct microcode_patch *patch;
+};
+
 static struct ucode_mod_blob __initdata ucode_blob;
 /*
  * By default we will NOT parse the multiboot modules to see if there is
@@ -100,10 +105,8 @@ static bool __initdata ucode_scan;
 /* By default, ucode loading is done in NMI handler */
 static bool ucode_in_nmi = true;
 
-bool __read_mostly opt_ucode_allow_same;
-
 /* Protected by microcode_mutex */
-static struct microcode_patch *microcode_cache;
+static const struct microcode_patch *microcode_cache;
 
 void __init microcode_set_module(unsigned int idx)
 {
@@ -128,8 +131,6 @@ static int __init cf_check parse_ucode(const char *s)
 
         if ( (val = parse_boolean("nmi", s, ss)) >= 0 )
             ucode_in_nmi = val;
-        else if ( (val = parse_boolean("allow-same", s, ss)) >= 0 )
-            opt_ucode_allow_same = val;
         else if ( !ucode_mod_forced ) /* Not forced by EFI */
         {
             if ( (val = parse_boolean("scan", s, ss)) >= 0 )
@@ -237,7 +238,10 @@ static DEFINE_PER_CPU(int, loading_err);
  */
 static cpumask_t cpu_callin_map;
 static atomic_t cpu_out, cpu_updated;
-static const struct microcode_patch *nmi_patch = ZERO_BLOCK_PTR;
+static struct patch_with_flags nmi_patch =
+{
+    .patch  = ZERO_BLOCK_PTR,
+};
 
 /*
  * Return a patch that covers current CPU. If there are multiple patches,
@@ -252,13 +256,13 @@ static struct microcode_patch *parse_blob(const char *buf, size_t len)
     return alternative_call(ucode_ops.cpu_request_microcode, buf, len, true);
 }
 
-static void microcode_free_patch(struct microcode_patch *patch)
+static void microcode_free_patch(const struct microcode_patch *patch)
 {
-    xfree(patch);
+    xfree((struct microcode_patch *)patch);
 }
 
 /* Return true if cache gets updated. Otherwise, return false */
-static bool microcode_update_cache(struct microcode_patch *patch)
+static bool microcode_update_cache(const struct microcode_patch *patch)
 {
     ASSERT(spin_is_locked(&microcode_mutex));
 
@@ -327,7 +331,8 @@ static bool cf_check wait_cpu_callout(unsigned int nr)
  * If no patch is provided, the cached patch will be loaded. Microcode update
  * during APs bringup and CPU resuming falls into this case.
  */
-static int microcode_update_cpu(const struct microcode_patch *patch)
+static int microcode_update_cpu(const struct microcode_patch *patch,
+                                unsigned int flags)
 {
     int err;
 
@@ -335,10 +340,11 @@ static int microcode_update_cpu(const struct microcode_patch *patch)
 
     spin_lock(&microcode_mutex);
     if ( patch )
-        err = alternative_call(ucode_ops.apply_microcode, patch);
+        err = alternative_call(ucode_ops.apply_microcode, patch, flags);
     else if ( microcode_cache )
     {
-        err = alternative_call(ucode_ops.apply_microcode, microcode_cache);
+        err = alternative_call(ucode_ops.apply_microcode, microcode_cache,
+                               flags);
         if ( err == -EIO )
         {
             microcode_free_patch(microcode_cache);
@@ -379,7 +385,8 @@ static int secondary_nmi_work(void)
     return wait_for_state(LOADING_EXIT) ? 0 : -EBUSY;
 }
 
-static int primary_thread_work(const struct microcode_patch *patch)
+static int primary_thread_work(const struct microcode_patch *patch,
+                               unsigned int flags)
 {
     int ret;
 
@@ -388,7 +395,7 @@ static int primary_thread_work(const struct microcode_patch *patch)
     if ( !wait_for_state(LOADING_ENTER) )
         return -EBUSY;
 
-    ret = alternative_call(ucode_ops.apply_microcode, patch);
+    ret = alternative_call(ucode_ops.apply_microcode, patch, flags);
     if ( !ret )
         atomic_inc(&cpu_updated);
     atomic_inc(&cpu_out);
@@ -416,7 +423,8 @@ static int cf_check microcode_nmi_callback(
         return 0;
 
     if ( primary_cpu )
-        ret = primary_thread_work(nmi_patch);
+        ret = primary_thread_work(nmi_patch.patch,
+                                  nmi_patch.flags);
     else
         ret = secondary_nmi_work();
     this_cpu(loading_err) = ret;
@@ -446,7 +454,8 @@ static int secondary_thread_fn(void)
     return this_cpu(loading_err);
 }
 
-static int primary_thread_fn(const struct microcode_patch *patch)
+static int primary_thread_fn(const struct microcode_patch *patch,
+                             unsigned int flags)
 {
     if ( !wait_for_state(LOADING_CALLIN) )
         return -EBUSY;
@@ -466,10 +475,11 @@ static int primary_thread_fn(const struct microcode_patch *patch)
         return this_cpu(loading_err);
     }
 
-    return primary_thread_work(patch);
+    return primary_thread_work(patch, flags);
 }
 
-static int control_thread_fn(const struct microcode_patch *patch)
+static int control_thread_fn(const struct microcode_patch *patch,
+                             unsigned int flags)
 {
     unsigned int cpu = smp_processor_id(), done;
     unsigned long tick;
@@ -482,7 +492,8 @@ static int control_thread_fn(const struct microcode_patch *patch)
      */
     watchdog_disable();
 
-    nmi_patch = patch;
+    nmi_patch.patch = patch;
+    nmi_patch.flags = flags;
     smp_wmb();
     saved_nmi_callback = set_nmi_callback(microcode_nmi_callback);
 
@@ -498,7 +509,7 @@ static int control_thread_fn(const struct microcode_patch *patch)
         goto out;
 
     /* Control thread loads ucode first while others are in NMI handler. */
-    ret = alternative_call(ucode_ops.apply_microcode, patch);
+    ret = alternative_call(ucode_ops.apply_microcode, patch, flags);
     if ( !ret )
         atomic_inc(&cpu_updated);
     atomic_inc(&cpu_out);
@@ -544,17 +555,19 @@ static int control_thread_fn(const struct microcode_patch *patch)
 
     set_nmi_callback(saved_nmi_callback);
     smp_wmb();
-    nmi_patch = ZERO_BLOCK_PTR;
+    nmi_patch.patch = ZERO_BLOCK_PTR;
+    nmi_patch.flags = 0;
 
     watchdog_enable();
 
     return ret;
 }
 
-static int cf_check do_microcode_update(void *patch)
+static int cf_check do_microcode_update(void *_patch_with_flags)
 {
     unsigned int cpu = smp_processor_id();
     int ret;
+    struct patch_with_flags *patch_with_flags = _patch_with_flags;
 
     /*
      * The control thread set state to coordinate ucode loading. Primary
@@ -562,9 +575,11 @@ static int cf_check do_microcode_update(void *patch)
      * the completion of the ucode loading process.
      */
     if ( cpu == cpumask_first(&cpu_online_map) )
-        ret = control_thread_fn(patch);
+        ret = control_thread_fn(patch_with_flags->patch,
+                                patch_with_flags->flags);
     else if ( is_cpu_primary(cpu) )
-        ret = primary_thread_fn(patch);
+        ret = primary_thread_fn(patch_with_flags->patch,
+                                patch_with_flags->flags);
     else
         ret = secondary_thread_fn();
 
@@ -582,7 +597,8 @@ static long cf_check microcode_update_helper(void *data)
     int ret;
     struct ucode_buf *buffer = data;
     unsigned int cpu, updated;
-    struct microcode_patch *patch;
+    struct patch_with_flags patch_with_flags;
+    bool ucode_force = buffer->flags & XENPF_UCODE_FORCE;
 
     /* cpu_online_map must not change during update */
     if ( !get_cpu_maps() )
@@ -606,16 +622,17 @@ static long cf_check microcode_update_helper(void *data)
         goto put;
     }
 
-    patch = parse_blob(buffer->buffer, buffer->len);
+    patch_with_flags.patch = parse_blob(buffer->buffer, buffer->len);
+    patch_with_flags.flags = buffer->flags;
     xfree(buffer);
-    if ( IS_ERR(patch) )
+    if ( IS_ERR(patch_with_flags.patch) )
     {
-        ret = PTR_ERR(patch);
+        ret = PTR_ERR(patch_with_flags.patch);
         printk(XENLOG_WARNING "Parsing microcode blob error %d\n", ret);
         goto put;
     }
 
-    if ( !patch )
+    if ( !patch_with_flags.patch )
     {
         printk(XENLOG_WARNING "microcode: couldn't find any matching ucode in "
                               "the provided blob!\n");
@@ -632,17 +649,17 @@ static long cf_check microcode_update_helper(void *data)
     {
         enum microcode_match_result result;
 
-        result = alternative_call(ucode_ops.compare_patch, patch,
-                                  microcode_cache);
+        result = alternative_call(ucode_ops.compare_patch,
+                                  patch_with_flags.patch, microcode_cache);
 
         if ( result != NEW_UCODE &&
-             !(opt_ucode_allow_same && result == SAME_UCODE) )
+             !(ucode_force && (result == OLD_UCODE || result == SAME_UCODE)) )
         {
             spin_unlock(&microcode_mutex);
             printk(XENLOG_WARNING
                    "microcode: couldn't find any newer%s revision in the provided blob!\n",
-                   opt_ucode_allow_same ? " (or the same)" : "");
-            microcode_free_patch(patch);
+                   ucode_force ? " (or a valid)" : "");
+            microcode_free_patch(patch_with_flags.patch);
             ret = -EEXIST;
 
             goto put;
@@ -674,13 +691,13 @@ static long cf_check microcode_update_helper(void *data)
      *   this requirement can be relaxed in the future. Right now, this is
      *   conservative and good.
      */
-    ret = stop_machine_run(do_microcode_update, patch, NR_CPUS);
+    ret = stop_machine_run(do_microcode_update, &patch_with_flags, NR_CPUS);
 
     updated = atomic_read(&cpu_updated);
     if ( updated > 0 )
     {
         spin_lock(&microcode_mutex);
-        microcode_update_cache(patch);
+        microcode_update_cache(patch_with_flags.patch);
         spin_unlock(&microcode_mutex);
 
         /*
@@ -697,7 +714,7 @@ static long cf_check microcode_update_helper(void *data)
             alternative_vcall(ctxt_switch_masking, current);
     }
     else
-        microcode_free_patch(patch);
+        microcode_free_patch(patch_with_flags.patch);
 
     if ( updated && updated != nr_cores )
         printk(XENLOG_ERR "ERROR: Updating microcode succeeded on %u cores and failed\n"
@@ -775,7 +792,7 @@ int microcode_update_one(void)
     if ( !ucode_ops.apply_microcode )
         return -EOPNOTSUPP;
 
-    return microcode_update_cpu(NULL);
+    return microcode_update_cpu(NULL, 0);
 }
 
 static int __init early_update_cache(const void *data, size_t len)
@@ -858,7 +875,7 @@ static int __init early_microcode_update_cpu(void)
     if ( !patch )
         return -ENOENT;
 
-    return microcode_update_cpu(patch);
+    return microcode_update_cpu(patch, 0);
 }
 
 int __init early_microcode_init(unsigned long *module_map,
diff --git a/xen/arch/x86/cpu/microcode/intel.c b/xen/arch/x86/cpu/microcode/intel.c
index f505aa1b78..6f69570586 100644
--- a/xen/arch/x86/cpu/microcode/intel.c
+++ b/xen/arch/x86/cpu/microcode/intel.c
@@ -284,21 +284,22 @@ static enum microcode_match_result cf_check compare_patch(
     return compare_revisions(old->rev, new->rev);
 }
 
-static int cf_check apply_microcode(const struct microcode_patch *patch)
+static int cf_check apply_microcode(const struct microcode_patch *patch,
+                                    unsigned int flags)
 {
     uint64_t msr_content;
     unsigned int cpu = smp_processor_id();
     struct cpu_signature *sig = &this_cpu(cpu_sig);
     uint32_t rev, old_rev = sig->rev;
     enum microcode_match_result result;
+    bool ucode_force = flags & XENPF_UCODE_FORCE;
 
     result = microcode_update_match(patch);
 
     if ( result == MIS_UCODE )
         return -EINVAL;
 
-    if ( result == OLD_UCODE ||
-         (result == SAME_UCODE && !opt_ucode_allow_same) )
+    if ( !ucode_force && (result == SAME_UCODE || result == OLD_UCODE) )
         return -EEXIST;
 
     wbinvd();
diff --git a/xen/arch/x86/cpu/microcode/private.h b/xen/arch/x86/cpu/microcode/private.h
index da556fe506..c72f060ac3 100644
--- a/xen/arch/x86/cpu/microcode/private.h
+++ b/xen/arch/x86/cpu/microcode/private.h
@@ -1,9 +1,9 @@
 #ifndef ASM_X86_MICROCODE_PRIVATE_H
 #define ASM_X86_MICROCODE_PRIVATE_H
 
-#include <asm/microcode.h>
+#include <public/platform.h>
 
-extern bool opt_ucode_allow_same;
+#include <asm/microcode.h>
 
 enum microcode_match_result {
     OLD_UCODE, /* signature matched, but revision id is older */
@@ -50,7 +50,8 @@ struct microcode_ops {
      * Attempt to load the provided patch into the CPU.  Returns an error if
      * anything didn't go as expected.
      */
-    int (*apply_microcode)(const struct microcode_patch *patch);
+    int (*apply_microcode)(const struct microcode_patch *patch,
+                           unsigned int flags);
 
     /*
      * Given two patches, are they both applicable to the current CPU, and is
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 12:46:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 12:46:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796599.1206307 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMk9-0006SZ-5x; Wed, 11 Sep 2024 12:46:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796599.1206307; Wed, 11 Sep 2024 12:46:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMk9-0006SR-3H; Wed, 11 Sep 2024 12:46:45 +0000
Received: by outflank-mailman (input) for mailman id 796599;
 Wed, 11 Sep 2024 12:46:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMk7-0006SH-Iw
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:46:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMk7-0002Mo-IH
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:46:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMk7-0002bs-H1
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:46:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yjtSF0QVbO0fcTmzKFgBCJWfi8+3WvrXoZPE3Dp/pVA=; b=NS7oIle23sgObAQ0sX0HWroold
	fmeEzI5Ft2AAisCfKLQlCfNDsmQdkIIdJQEK7TywuY7lGJt+Xia6VVDSTSVkiFtaKpafEO9Un+10C
	yPp61EcrmOZ997DRM8uHkImIaFRdVJnDohlLOa+yKRKUKEwv5PXTWpdpc4RdnyMzdIhU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] cirrus-ci: update to FreeBSD 14.1 image
Message-Id: <E1soMk7-0002bs-H1@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 12:46:43 +0000

commit ebb7c6b2faf27fbbb546282e6096e5680f82fef1
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Sep 9 16:39:02 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 9 15:47:10 2024 +0100

    cirrus-ci: update to FreeBSD 14.1 image
    
    14.0 is going EOL by the end of the month.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 .cirrus.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 72227916c7..1c2a6cb812 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -23,7 +23,7 @@ task:
 task:
   name: 'FreeBSD 14'
   freebsd_instance:
-    image_family: freebsd-14-0
+    image_family: freebsd-14-1
   << : *FREEBSD_TEMPLATE
 
 task:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 11 12:46:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Sep 2024 12:46:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796600.1206311 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMkJ-0006cA-7D; Wed, 11 Sep 2024 12:46:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796600.1206311; Wed, 11 Sep 2024 12:46:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soMkJ-0006c2-4f; Wed, 11 Sep 2024 12:46:55 +0000
Received: by outflank-mailman (input) for mailman id 796600;
 Wed, 11 Sep 2024 12:46:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMkH-0006br-Lp
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:46:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMkH-0002NB-L6
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:46:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soMkH-0002cd-KT
 for xen-changelog@lists.xenproject.org; Wed, 11 Sep 2024 12:46:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hueu9UU3iI+p5ofbefUYUhdxAMpuFsDyrmFevvsE3LY=; b=zRSBUlwFPdGgBuWsle3i2Vk7Ke
	axGYUm1PDjJscW6EbaXcOV1kspoFTCFwOzG/r9M41UOcZWXyWdJ2HoaMRcPtLaR+sSqcCm+rfaR9m
	HGDiD0mC98Bc5jT2YLsTS9MdPlbPjNKZXyeFRTkWHkn0fXl/AoYC1F9k9j2b8Y/S9gmA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: fix xilinx test console settings
Message-Id: <E1soMkH-0002cd-KT@xenbits.xenproject.org>
Date: Wed, 11 Sep 2024 12:46:53 +0000

commit c23571fe3150c2994afabcaa10c218b3d87fa832
Author:     Victor Lira <victorm.lira@amd.com>
AuthorDate: Mon Sep 9 17:31:46 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Sep 9 21:59:06 2024 -0700

    automation: fix xilinx test console settings
    
    The test showed unreliable behavior due to unsupported console settings.
    Update the baud rate used to connect to the UART.
    
    Signed-off-by: Victor Lira <victorm.lira@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/test.yaml                 | 2 +-
 automation/scripts/xilinx-smoke-dom0-x86_64.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index cecc18a019..8675016b6a 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -102,7 +102,7 @@
   variables:
     CONTAINER: ubuntu:xenial-xilinx
     LOGFILE: xilinx-smoke-x86_64.log
-    XEN_CMD_CONSOLE: "console=com2 com2=115200,8n1,0x2F8,4"
+    XEN_CMD_CONSOLE: "console=com2 com2=57600,8n1,0x2F8,4"
     TEST_BOARD: "crater"
     TEST_TIMEOUT: 1000
   artifacts:
diff --git a/automation/scripts/xilinx-smoke-dom0-x86_64.sh b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
index ef6e1361a9..7027f083ba 100755
--- a/automation/scripts/xilinx-smoke-dom0-x86_64.sh
+++ b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
@@ -129,7 +129,7 @@ sleep 5
 sh /scratch/gitlab-runner/${TEST_BOARD}.sh 1
 sleep 5
 set +e
-stty -F ${SERIAL_DEV} 115200
+stty -F ${SERIAL_DEV} 57600
 
 # Capture test result and power off board before exiting.
 export PASSED="${PASS_MSG}"
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 01:11:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 01:11:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796952.1206685 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soYMT-0005hz-64; Thu, 12 Sep 2024 01:11:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796952.1206685; Thu, 12 Sep 2024 01:11:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soYMT-0005hr-3C; Thu, 12 Sep 2024 01:11:05 +0000
Received: by outflank-mailman (input) for mailman id 796952;
 Thu, 12 Sep 2024 01:11:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soYMR-0005hl-Qo
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 01:11:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soYMR-0007WK-Oo
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 01:11:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soYMR-0003m1-Ma
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 01:11:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7JcxNo1K0PLrZrd/gUMVL6gZU8xSdUc5F9WDuLEhyYo=; b=UJ/t1dbSyGgu4+hqt0YSwuXffD
	2s7ev9OwhGI7eVYUrgrrgcpgEJtEGIeH41miLKGMUMuyz1OKMm6WqMVLMsVIYZ2mLvv8Gq2nEbeOA
	RYrvVyhSCT/7DfREYb83F1l2EM+lpSPq9r1UxzWBkqzTzqNo6K9/EYlBCG7v5n7wnzz4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation/eclair_analysis: fix MISRA Rule 20.7 regression in self-tests.h
Message-Id: <E1soYMR-0003m1-Ma@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 01:11:03 +0000

commit 4b3f30ea3059cd9000af853541354548bbb612db
Author:     Nicola Vetrini <nicola.vetrini@bugseng.com>
AuthorDate: Sun Sep 8 15:27:57 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Sep 11 17:10:27 2024 -0700

    automation/eclair_analysis: fix MISRA Rule 20.7 regression in self-tests.h
    
    Prior to bd1664db7b7d ("xen/bitops: Introduce a multiple_bits_set() helper")
    the definition of {COMPILE,RUNTIME}_CHECK was fully compliant with respect
    to MISRA C Rule 20.7:
    
    "Expressions resulting from the expansion of macro parameters shall be
    enclosed in parentheses."
    
    However, to allow testing function-like macros, parentheses on the "fn"
    parameter were removed and thus new violations of the rule have been
    introduced. Given the usefulness of this functionality,
    it is deemed ok to deviate these two macros for this rule, because
    their scope of (direct) usage is limited to just the file where they
    are defined, and the possibility of misuses is unlikely.
    
    No functional change.
    
    Fixes: bd1664db7b7d ("xen/bitops: Introduce a multiple_bits_set() helper")
    Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/deviations.ecl | 6 ++++++
 docs/misra/deviations.rst                        | 8 ++++++++
 2 files changed, 14 insertions(+)

diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
index 9051f41602..ed80ac7958 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -581,6 +581,12 @@ of this macro do not lead to developer confusion, and can thus be deviated."
 -config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^count_args_$))))"}
 -doc_end
 
+-doc_begin="The argument \"fn\" in macros {COMPILE,RUNTIME}_CHECK is not parenthesized
+on purpose, to be able to test function-like macros. Given the specialized and limited
+use of this macro, it is deemed ok to deviate them."
+-config=MC3R1.R20.7,reports+={deliberate, "any_area(any_loc(any_exp(macro(^(COMPILE_CHECK|RUNTIME_CHECK)$))))"}
+-doc_end
+
 -doc_begin="Uses of variadic macros that have one of their arguments defined as
 a macro and used within the body for both ordinary parameter expansion and as an
 operand to the # or ## operators have a behavior that is well-understood and
diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst
index b66c271c4e..74bb815bf0 100644
--- a/docs/misra/deviations.rst
+++ b/docs/misra/deviations.rst
@@ -534,6 +534,14 @@ Deviations related to MISRA C:2012 Rules:
        refactoring it to add parentheses breaks its functionality.
      - Tagged as `safe` for ECLAIR.
 
+   * - R20.7
+     - The macros `{COMPILE,RUNTIME}_CHECK` defined in
+       `xen/include/xen/self-tests.h` are allowed not to parenthesize the "fn"
+       argument, to allow function-like macros to be tested as well as
+       functions. Given the specialized use of these macros and their limited
+       usage scope, omitting parentheses is deemed unlikely to cause issues.
+     - Tagged as `deliberate` for ECLAIR.
+
    * - R20.12
      - Variadic macros that use token pasting often employ the gcc extension
        `ext_paste_comma`, as detailed in `C-language-toolchain.rst`, which is
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 01:11:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 01:11:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796954.1206689 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soYMd-0005jt-7L; Thu, 12 Sep 2024 01:11:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796954.1206689; Thu, 12 Sep 2024 01:11:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soYMd-0005jl-4h; Thu, 12 Sep 2024 01:11:15 +0000
Received: by outflank-mailman (input) for mailman id 796954;
 Thu, 12 Sep 2024 01:11:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soYMb-0005jb-St
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 01:11:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soYMb-0007WV-S8
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 01:11:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soYMb-0003mv-R6
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 01:11:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oz4ZD6p+pki9XijXJ01zlVyaXr78b/RVANKHPzl/Mro=; b=PELrV6kffM2a8feNzQIe0B0HrF
	WDm+S4P+XvhfBahjpr4Xw4/JHay3AW1qb1AqWTdi0nebQ4KvJO/VpyTrIjYuIEnchr6s02ruuSX3d
	TbPiZUwhVmbj85LKy7LzDg83I8m7gd8kTWHSSZ5SWAGC9ZKqnvKY6W48hyj1ONR3yRA4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation/eclair_analysis: deviate linker symbols for Rule 18.2
Message-Id: <E1soYMb-0003mv-R6@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 01:11:13 +0000

commit 33888e7aaabc2947aeb6d8b0adcf16c6330b55ba
Author:     Nicola Vetrini <nicola.vetrini@bugseng.com>
AuthorDate: Sat Sep 7 15:03:25 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Sep 11 17:11:09 2024 -0700

    automation/eclair_analysis: deviate linker symbols for Rule 18.2
    
    MISRA C Rule 18.2 states: "Subtraction between pointers shall
    only be applied to pointers that address elements of the same array".
    
    Subtractions between pointer where at least one symbol is a
    symbol defined by the linker are safe and thus deviated, because
    the compiler cannot exploit the undefined behaviour that would
    arise from violating the rules in this case.
    
    To create an ECLAIR configuration that contains the list of
    linker-defined symbols, the script "linker-symbols.sh" is used
    after a build of xen (without static analysis) is performed.
    The generated file "linker_symbols.ecl" is then used as part of the
    static analysis configuration.
    
    Additional changes to the ECLAIR integration are:
    - perform a build of xen without static analysis during prepare.sh
    - run the scripts to generated ECL configuration during the prepare.sh,
      rather than analysis.sh
    - export ECLAIR_PROJECT_ROOT earlier, to allow such generation
    
    Additionally, the macro page_to_mfn performs a subtraction that is safe,
    so its uses are deviated.
    
    No functional changes.
    
    Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/analyze.sh       |  6 -----
 automation/eclair_analysis/ECLAIR/deviations.ecl   | 11 ++++++++
 .../ECLAIR/generate-linker-symbols.sh              | 31 ++++++++++++++++++++++
 automation/eclair_analysis/ECLAIR/generate_ecl.sh  |  3 +++
 automation/eclair_analysis/prepare.sh              |  6 ++++-
 automation/scripts/eclair                          |  3 +++
 docs/misra/deviations.rst                          | 10 +++++++
 7 files changed, 63 insertions(+), 7 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/analyze.sh b/automation/eclair_analysis/ECLAIR/analyze.sh
index e96456c3c1..1dc63c1bc2 100755
--- a/automation/eclair_analysis/ECLAIR/analyze.sh
+++ b/automation/eclair_analysis/ECLAIR/analyze.sh
@@ -73,17 +73,11 @@ export ECLAIR_WORKSPACE="${ECLAIR_DATA_DIR}/eclair_workspace"
 
 # Identifies the particular build of the project.
 export ECLAIR_PROJECT_NAME="XEN_${VARIANT}-${SET}"
-# All paths mentioned in ECLAIR reports that are below this directory
-# will be presented as relative to ECLAIR_PROJECT_ROOT.
-export ECLAIR_PROJECT_ROOT="${PWD}"
 
 # Erase and recreate the output directory and the data directory.
 rm -rf "${ECLAIR_OUTPUT_DIR:?}/*"
 mkdir -p "${ECLAIR_DATA_DIR}"
 
-# Generate additional configuration files 
-"${SCRIPT_DIR}/generate_ecl.sh"
-
 # Perform the build (from scratch) in an ECLAIR environment.
 "${ECLAIR_BIN_DIR}eclair_env" \
     "-config_file='${SCRIPT_DIR}/analysis.ecl'" \
diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
index ed80ac7958..9c3ebc9cc7 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -533,6 +533,17 @@ safe."
 # Series 18.
 #
 
+-doc_begin="Subtractions between pointers involving at least one of the linker symbols specified by the regex below
+are guaranteed not to be exploited by a compiler that relies on the absence of
+C99 Undefined Behaviour 45: Pointers that do not point into, or just beyond, the same array object are subtracted (6.5.6)."
+-eval_file=linker_symbols.ecl
+-config=MC3R1.R18.2,reports+={safe, "any_area(stmt(operator(sub)&&child(lhs||rhs, skip(__non_syntactic_paren_stmts, ref(linker_symbols)))))"}
+-doc_end
+
+-doc_begin="The following macro performs a subtraction between pointers to obtain the mfn, but does not lead to undefined behaviour."
+-config=MC3R1.R18.2,reports+={safe, "any_area(any_loc(any_exp(macro(^page_to_mfn$))))"}
+-doc_end
+
 -doc_begin="Flexible array members are deliberately used and XEN developers are aware of the dangers related to them:
 unexpected result when the structure is given as argument to a sizeof() operator and the truncation in assignment between structures."
 -config=MC3R1.R18.7,reports+={deliberate, "any()"}
diff --git a/automation/eclair_analysis/ECLAIR/generate-linker-symbols.sh b/automation/eclair_analysis/ECLAIR/generate-linker-symbols.sh
new file mode 100755
index 0000000000..19943ba98d
--- /dev/null
+++ b/automation/eclair_analysis/ECLAIR/generate-linker-symbols.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+set -e
+
+script_name="$(basename "$0")"
+script_dir="$(
+  cd "$(dirname "$0")"
+  echo "${PWD}"
+)"
+
+fatal() {
+  echo "${script_name}: $*" >&2
+  exit 1
+}
+
+arch=""
+if [ "${XEN_TARGET_ARCH}" == "x86_64" ]; then
+  arch=x86
+elif [ "${XEN_TARGET_ARCH}" == "arm64" ]; then
+  arch=arm
+else
+  fatal "Unknown configuration: $1"
+fi
+
+outfile=${script_dir}/linker_symbols.ecl
+
+(
+  echo -n "-decl_selector+={linker_symbols, \"^(" >"${outfile}"
+  "${script_dir}/../linker-symbols.sh" "${arch}" | sort -u | tr '\n' '|' | sed '$ s/|//' >>"${outfile}"
+  echo -n ")$\"}" >>"${outfile}"
+)
diff --git a/automation/eclair_analysis/ECLAIR/generate_ecl.sh b/automation/eclair_analysis/ECLAIR/generate_ecl.sh
index 66766b23ab..b955783904 100755
--- a/automation/eclair_analysis/ECLAIR/generate_ecl.sh
+++ b/automation/eclair_analysis/ECLAIR/generate_ecl.sh
@@ -17,3 +17,6 @@ accepted_rst="${ECLAIR_PROJECT_ROOT}/docs/misra/rules.rst"
 
 # Generate accepted guidelines
 "${script_dir}/accepted_guidelines.sh" "${accepted_rst}"
+
+# Generate the list of linker-defined symbols (must be run after a Xen build)
+"${script_dir}/generate-linker-symbols.sh"
diff --git a/automation/eclair_analysis/prepare.sh b/automation/eclair_analysis/prepare.sh
index 47b2a2f32a..3a646414a3 100755
--- a/automation/eclair_analysis/prepare.sh
+++ b/automation/eclair_analysis/prepare.sh
@@ -39,10 +39,14 @@ fi
     cp "${CONFIG_FILE}" xen/.config
     make clean
     find . -type f -name "*.safparse" -print -delete
+    "${script_dir}/build.sh" "$1"
+    # Generate additional configuration files
+    "${script_dir}/ECLAIR/generate_ecl.sh"
+    make clean
     cd xen
     make -f "${script_dir}/Makefile.prepare" prepare
     # Translate the /* SAF-n-safe */ comments into ECLAIR CBTs
     scripts/xen-analysis.py --run-eclair --no-build --no-clean
     # Translate function-properties.json into ECLAIR properties
-    python3 ${script_dir}/propertyparser.py
+    python3 "${script_dir}/propertyparser.py"
 )
diff --git a/automation/scripts/eclair b/automation/scripts/eclair
index 3ec760bab8..0a2353c20a 100755
--- a/automation/scripts/eclair
+++ b/automation/scripts/eclair
@@ -3,6 +3,9 @@
 ECLAIR_ANALYSIS_DIR=automation/eclair_analysis
 ECLAIR_DIR="${ECLAIR_ANALYSIS_DIR}/ECLAIR"
 ECLAIR_OUTPUT_DIR=$(realpath "${ECLAIR_OUTPUT_DIR}")
+# All paths mentioned in ECLAIR reports that are below this directory
+# will be presented as relative to ECLAIR_PROJECT_ROOT.
+export ECLAIR_PROJECT_ROOT="${PWD}"
 
 "${ECLAIR_ANALYSIS_DIR}/prepare.sh" "${VARIANT}"
 
diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst
index 74bb815bf0..247e69e7f1 100644
--- a/docs/misra/deviations.rst
+++ b/docs/misra/deviations.rst
@@ -501,6 +501,16 @@ Deviations related to MISRA C:2012 Rules:
          - __builtin_memset()
          - cpumask_check()
 
+   * - R18.2
+     - Subtractions between pointers where at least one of the operand is a
+       pointer to a symbol defined by the linker are safe.
+     - Tagged as `safe` for ECLAIR.
+
+   * - R18.2
+     - Subtraction between pointers encapsulated by macro page_to_mfn
+       are safe.
+     - Tagged as `safe` for ECLAIR.
+
    * - R20.4
      - The override of the keyword \"inline\" in xen/compiler.h is present so
        that section contents checks pass when the compiler chooses not to
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 01:11:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 01:11:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796955.1206693 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soYMn-0005mQ-8u; Thu, 12 Sep 2024 01:11:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796955.1206693; Thu, 12 Sep 2024 01:11:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soYMn-0005mI-6C; Thu, 12 Sep 2024 01:11:25 +0000
Received: by outflank-mailman (input) for mailman id 796955;
 Thu, 12 Sep 2024 01:11:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soYMl-0005lz-Vt
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 01:11:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soYMl-0007Wg-V7
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 01:11:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soYMl-0003oE-UD
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 01:11:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eRedyM/MraWflb1uQCC3IkM0qZevOj8fdUWZYjPiPP4=; b=Y/raHAAnvp0EDcr2FB1NFuBLXM
	YRJ3lT776mCnbrLAV/4uFW5mIs/OQXQf/ikoaUC/RA+TX21lGCrw1SiOgOxLtQGfECrSCE+pTphLX
	pzeba1gljKzCtf41y8IHwcjWJqHG39Y1uHl6r0eIz5YZpN8rtqVVTjKlYafmgzeM8Af0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation/eclair: update configuration of Rule 20.7
Message-Id: <E1soYMl-0003oE-UD@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 01:11:23 +0000

commit 3c5c9743ca5918e265beb4ec52695e67b07df3d4
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Wed Sep 11 17:34:37 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Sep 11 17:34:37 2024 -0700

    automation/eclair: update configuration of Rule 20.7
    
    MISRA C:2012 Rule 20.7 states that "Expressions resulting from the
    expansion of macro parameters shall be enclosed in parentheses".
    The rational of the rule is that if a macro argument expands to an
    expression, there may be problems related to operator precedence, e.g.,
    
    define M(A, B) A * B
    
    M(1+1, 2+2) will expand to: 1+1 * 2+2
    
    Update ECLAIR configuration to tag as 'safe' the expansions of macro
    arguments surrounded tokens '{', '}' and ';', since in their presence
    problems related to operator precedence can not occur.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/deviations.ecl | 4 ++++
 docs/misra/deviations.rst                        | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
index 9c3ebc9cc7..6679caf3da 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -598,6 +598,10 @@ use of this macro, it is deemed ok to deviate them."
 -config=MC3R1.R20.7,reports+={deliberate, "any_area(any_loc(any_exp(macro(^(COMPILE_CHECK|RUNTIME_CHECK)$))))"}
 -doc_end
 
+-doc_begin="Problems related to operator precedence can not occur if the expansion of the macro argument is surrounded by tokens '{', '}' and ';'."
+-config=MC3R1.R20.7,expansion_context+={safe, "left_right(^[\\{;]$,^[;\\}]$)"}
+-doc_end
+
 -doc_begin="Uses of variadic macros that have one of their arguments defined as
 a macro and used within the body for both ordinary parameter expansion and as an
 operand to the # or ## operators have a behavior that is well-understood and
diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst
index 247e69e7f1..15a993d050 100644
--- a/docs/misra/deviations.rst
+++ b/docs/misra/deviations.rst
@@ -552,6 +552,11 @@ Deviations related to MISRA C:2012 Rules:
        usage scope, omitting parentheses is deemed unlikely to cause issues.
      - Tagged as `deliberate` for ECLAIR.
 
+   * - R20.7
+     - Problems related to operator precedence can not occur if the expansion
+       of the macro argument is surrounded by tokens '{', '}' and ';'.
+     - Tagged as `safe` for ECLAIR.
+
    * - R20.12
      - Variadic macros that use token pasting often employ the gcc extension
        `ext_paste_comma`, as detailed in `C-language-toolchain.rst`, which is
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 01:11:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 01:11:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796956.1206697 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soYMx-0005pG-A9; Thu, 12 Sep 2024 01:11:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796956.1206697; Thu, 12 Sep 2024 01:11:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soYMx-0005p8-7b; Thu, 12 Sep 2024 01:11:35 +0000
Received: by outflank-mailman (input) for mailman id 796956;
 Thu, 12 Sep 2024 01:11:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soYMw-0005ox-3V
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 01:11:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soYMw-0007Wr-1z
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 01:11:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soYMw-0003os-16
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 01:11:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NGtQcEPJnibBQGtqXOvG1Gm81/X23RojVmy5q9QxnR8=; b=cE3O5hovXzNIMa1tKBPVoc3oTA
	UdREUX1BfA0xwqcNy8gENHH12A/6H6yDpA373Spxh5usFubgzzGqv9QZhXAEAXZQrm9hNU3yB6eT8
	BzvFe3+R7XT5VDgbvfQ5OH6H0wNiK3kZ2QtPTZE3seZ8Kuh2/Yk/r3NlU57Rd9gCdTDg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/bitmap: remove redundant deviations
Message-Id: <E1soYMw-0003os-16@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 01:11:34 +0000

commit 738db54711e38d5021d87e40192bf69ddc1f8139
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Tue Sep 10 12:50:07 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Sep 11 17:34:59 2024 -0700

    xen/bitmap: remove redundant deviations
    
    Remove comment-based deviations since a project wide deviation that
    cover such cases is present.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/include/xen/bitmap.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/xen/include/xen/bitmap.h b/xen/include/xen/bitmap.h
index 5d668053b0..4b642cd420 100644
--- a/xen/include/xen/bitmap.h
+++ b/xen/include/xen/bitmap.h
@@ -103,13 +103,10 @@ extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order);
 #define bitmap_switch(nbits, zero, small, large)			  \
 	unsigned int n__ = (nbits);					  \
 	if (__builtin_constant_p(nbits) && !n__) {			  \
-		/* SAF-7-safe Rule 20.7 non-parenthesized macro argument */ \
 		zero;							  \
 	} else if (__builtin_constant_p(nbits) && n__ <= BITS_PER_LONG) { \
-		/* SAF-7-safe Rule 20.7 non-parenthesized macro argument */ \
 		small;							  \
 	} else {							  \
-		/* SAF-7-safe Rule 20.7 non-parenthesized macro argument */ \
 		large;							  \
 	}
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 01:11:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 01:11:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.796957.1206701 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soYN7-0005sW-D4; Thu, 12 Sep 2024 01:11:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 796957.1206701; Thu, 12 Sep 2024 01:11:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soYN7-0005sO-AH; Thu, 12 Sep 2024 01:11:45 +0000
Received: by outflank-mailman (input) for mailman id 796957;
 Thu, 12 Sep 2024 01:11:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soYN6-0005s9-5W
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 01:11:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soYN6-0007X0-4q
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 01:11:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soYN6-0003pt-3y
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 01:11:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mZkM8BYXLXwjkLm5baO2/xmPfTTeZN5M7djAxxxmim4=; b=uKwktCzKkAIeV0FkGGBJvJc7u7
	1u04yv73jRS+FQEoxbnsCspB26vAoZoXmgkcN/Cki62LxFEMibieOqihb7NGpuSqzSqOC+Ixab3Co
	T5fBRK40Gmrh/kcPnEZ3BB82olxaHC1IADYTZ0gRjbR1c1ub2X4a/K87KKFHBTgFbus8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation/eclair_analysis: address violation of Rule 20.7
Message-Id: <E1soYN6-0003pt-3y@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 01:11:44 +0000

commit 582fade2a9450b1b229123694af515c1a594c358
Author:     Nicola Vetrini <nicola.vetrini@bugseng.com>
AuthorDate: Tue Sep 10 14:43:21 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Sep 11 17:36:16 2024 -0700

    automation/eclair_analysis: address violation of Rule 20.7
    
    MISRA Rule 20.7 states:
    "Expressions resulting from the expansion of macro parameters
    shall be enclosed in parentheses".
    
    The files imported from the gnu-efi package are already deviated, yet
    the macro NextMemoryDescriptor is used in non-excluded code, so a further
    deviation is needed to exclude also any expansion of the macro.
    
    No functional change.
    
    Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/deviations.ecl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
index 6679caf3da..2bb118248b 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -577,7 +577,7 @@ of the IS_ENABLED or STATIC_IF/STATIC_IF_NOT macros, so it always receives a lit
 not in scope for compliance are allowed, as that is imported code."
 -file_tag+={gnu_efi_include, "^xen/include/efi/.*$"}
 -file_tag+={acpi_cpu_idle, "^xen/arch/x86/acpi/cpu_idle\\.c$"}
--config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(file(gnu_efi_include)))"}
+-config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(file(gnu_efi_include)||any_exp(macro(^NextMemoryDescriptor$))))"}
 -config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(file(acpi_cpu_idle)))"}
 -doc_end
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 07:22:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 07:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797050.1206815 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soe9V-00041o-0T; Thu, 12 Sep 2024 07:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797050.1206815; Thu, 12 Sep 2024 07:22:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soe9U-00041h-Tj; Thu, 12 Sep 2024 07:22:04 +0000
Received: by outflank-mailman (input) for mailman id 797050;
 Thu, 12 Sep 2024 07:22:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soe9T-00041T-Ji
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:22:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soe9T-0006KW-Gx
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:22:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soe9T-0002v9-Dy
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:22:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=edLfmLqWYB56bkfcjJTn5cL+jWFvS9u8BtefsQUKeu4=; b=Scq0RqDmUUKBR1/sC/Na7pgC24
	76xvuDqY0Rf9l7/FK6G1m2rF5pMtL8RYaPicy5uwW62//shsggtOnK2AnKrDhiP+BAmAoUqASyHo4
	l+QkMWY7cz4XNosQU3rNL0rQ7bRYVP81FkUleq4emchG4VomLYrlfdh399KTymFqIalg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86emul: support CMPccXADD
Message-Id: <E1soe9T-0002v9-Dy@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 07:22:03 +0000

commit 3d65f1c0726edc2eee83c69d319ce9bcb4345d3d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 12 09:11:53 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 09:11:53 2024 +0200

    x86emul: support CMPccXADD
    
    Unconditionally wire this through the ->rmw() hook. Since x86_emul_rmw()
    now wants to construct and invoke a stub, make stub_exn available to it
    via a new field in the emulator state structure.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/tests/x86_emulator/predicates.c        | 16 +++++++
 tools/tests/x86_emulator/test_x86_emulator.c | 72 ++++++++++++++++++++++++++++
 tools/tests/x86_emulator/x86-emulate.h       |  1 +
 xen/arch/x86/include/asm/cpufeature.h        |  1 +
 xen/arch/x86/x86_emulate/decode.c            |  3 ++
 xen/arch/x86/x86_emulate/private.h           |  2 +
 xen/arch/x86/x86_emulate/x86_emulate.c       | 53 ++++++++++++++++++++
 xen/include/public/arch-x86/cpufeatureset.h  |  1 +
 xen/tools/gen-cpuid.py                       |  2 +-
 9 files changed, 150 insertions(+), 1 deletion(-)

diff --git a/tools/tests/x86_emulator/predicates.c b/tools/tests/x86_emulator/predicates.c
index 613a1baea2..a688081272 100644
--- a/tools/tests/x86_emulator/predicates.c
+++ b/tools/tests/x86_emulator/predicates.c
@@ -1415,6 +1415,22 @@ static const struct vex {
     { { 0xdd }, 2, T, R, pfx_66, WIG, Ln }, /* vaesenclast */
     { { 0xde }, 2, T, R, pfx_66, WIG, Ln }, /* vaesdec */
     { { 0xdf }, 2, T, R, pfx_66, WIG, Ln }, /* vaesdeclast */
+    { { 0xe0 }, 2, F, W, pfx_66, Wn, L0 }, /* cmpoxadd */
+    { { 0xe1 }, 2, F, W, pfx_66, Wn, L0 }, /* cmpnoxadd */
+    { { 0xe2 }, 2, F, W, pfx_66, Wn, L0 }, /* cmpbxadd */
+    { { 0xe3 }, 2, F, W, pfx_66, Wn, L0 }, /* cmpnbxadd */
+    { { 0xe4 }, 2, F, W, pfx_66, Wn, L0 }, /* cmpexadd */
+    { { 0xe5 }, 2, F, W, pfx_66, Wn, L0 }, /* cmpnexadd */
+    { { 0xe6 }, 2, F, W, pfx_66, Wn, L0 }, /* cmpbexadd */
+    { { 0xe7 }, 2, F, W, pfx_66, Wn, L0 }, /* cmpaxadd */
+    { { 0xe8 }, 2, F, W, pfx_66, Wn, L0 }, /* cmpsxadd */
+    { { 0xe9 }, 2, F, W, pfx_66, Wn, L0 }, /* cmpnsxadd */
+    { { 0xea }, 2, F, W, pfx_66, Wn, L0 }, /* cmppxadd */
+    { { 0xeb }, 2, F, W, pfx_66, Wn, L0 }, /* cmpnpxadd */
+    { { 0xec }, 2, F, W, pfx_66, Wn, L0 }, /* cmplxadd */
+    { { 0xed }, 2, F, W, pfx_66, Wn, L0 }, /* cmpgexadd */
+    { { 0xee }, 2, F, W, pfx_66, Wn, L0 }, /* cmplexadd */
+    { { 0xef }, 2, F, W, pfx_66, Wn, L0 }, /* cmpgxadd */
     { { 0xf2 }, 2, T, R, pfx_no, Wn, L0 }, /* andn */
     { { 0xf3, 0x08 }, 2, T, R, pfx_no, Wn, L0 }, /* blsr */
     { { 0xf3, 0x10 }, 2, T, R, pfx_no, Wn, L0 }, /* blsmsk */
diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index 3a6054441a..24343c5d7f 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -1533,6 +1533,78 @@ int main(int argc, char **argv)
         cpu_policy.x86_vendor = X86_VENDOR_INTEL;
     }
     cpu_policy.x86_vendor = vendor_native;
+
+    printf("%-40s", "Testing cmpbxadd %rbx,%r9,(%rdx)...");
+    if ( stack_exec && cpu_has_cmpccxadd )
+    {
+        instr[0] = 0xc4; instr[1] = 0x62; instr[2] = 0xe1; instr[3] = 0xe2; instr[4] = 0x0a;
+        regs.rip = (unsigned long)&instr[0];
+        regs.eflags = EFLAGS_ALWAYS_SET;
+        res[0] = 0x11223344;
+        res[1] = 0x01020304;
+        regs.rdx = (unsigned long)res;
+        regs.r9  = 0x0001020300112233UL;
+        regs.rbx = 0x0101010101010101UL;
+        rc = x86_emulate(&ctxt, &emulops);
+        if ( (rc != X86EMUL_OKAY) ||
+             (regs.eip != (unsigned long)&instr[5]) ||
+             (regs.r9 != 0x0102030411223344UL) ||
+             (regs.rbx != 0x0101010101010101UL) ||
+             ((regs.eflags & EFLAGS_MASK) !=
+              (X86_EFLAGS_PF | EFLAGS_ALWAYS_SET)) ||
+             (res[0] != 0x11223344) ||
+             (res[1] != 0x01020304) )
+            goto fail;
+
+        regs.rip = (unsigned long)&instr[0];
+        regs.r9 <<= 8;
+        rc = x86_emulate(&ctxt, &emulops);
+        if ( (rc != X86EMUL_OKAY) ||
+             (regs.eip != (unsigned long)&instr[5]) ||
+             (regs.r9 != 0x0102030411223344UL) ||
+             (regs.rbx != 0x0101010101010101UL) ||
+             ((regs.eflags & EFLAGS_MASK) !=
+              (X86_EFLAGS_CF | X86_EFLAGS_PF | X86_EFLAGS_SF |
+               EFLAGS_ALWAYS_SET)) ||
+             (res[0] != 0x12233445) ||
+             (res[1] != 0x02030405) )
+            goto fail;
+        printf("okay\n");
+
+        printf("%-40s", "Testing cmpsxadd %r9d,%ebx,4(%r10)...");
+        instr[1] = 0xc2; instr[2] = 0x31; instr[3] = 0xe8; instr[4] = 0x5a; instr[5] = 0x04;
+        regs.rip = (unsigned long)&instr[0];
+        res[2] = res[0] = ~0;
+        regs.r10 = (unsigned long)res;
+        rc = x86_emulate(&ctxt, &emulops);
+        if ( (rc != X86EMUL_OKAY) ||
+             (regs.eip != (unsigned long)&instr[6]) ||
+             (regs.r9 != 0x0102030411223344UL) ||
+             (regs.rbx != 0x02030405) ||
+             ((regs.eflags & EFLAGS_MASK) != EFLAGS_ALWAYS_SET) ||
+             (res[0] + 1) ||
+             (res[1] != 0x02030405) ||
+             (res[2] + 1) )
+            goto fail;
+
+        regs.rip = (unsigned long)&instr[0];
+        regs.rbx <<= 8;
+        rc = x86_emulate(&ctxt, &emulops);
+        if ( (rc != X86EMUL_OKAY) ||
+             (regs.eip != (unsigned long)&instr[6]) ||
+             (regs.r9 != 0x0102030411223344UL) ||
+             (regs.rbx != 0x02030405) ||
+             ((regs.eflags & EFLAGS_MASK) !=
+              (X86_EFLAGS_CF | X86_EFLAGS_PF | X86_EFLAGS_SF |
+               EFLAGS_ALWAYS_SET)) ||
+             (res[0] + 1) ||
+             (res[1] != 0x13253749) ||
+             (res[2] + 1) )
+            goto fail;
+        printf("okay\n");
+    }
+    else
+        printf("skipped\n");
 #endif /* x86-64 */
 
     printf("%-40s", "Testing shld $1,%ecx,(%edx)...");
diff --git a/tools/tests/x86_emulator/x86-emulate.h b/tools/tests/x86_emulator/x86-emulate.h
index 112ec53d99..00abc829b0 100644
--- a/tools/tests/x86_emulator/x86-emulate.h
+++ b/tools/tests/x86_emulator/x86-emulate.h
@@ -191,6 +191,7 @@ void wrpkru(unsigned int val);
 #define cpu_has_avx_vnni            (cpu_policy.feat.avx_vnni && xcr0_mask(6))
 #define cpu_has_avx512_bf16         (cpu_policy.feat.avx512_bf16 && \
                                      xcr0_mask(0xe6))
+#define cpu_has_cmpccxadd            cpu_policy.feat.cmpccxadd
 #define cpu_has_avx_ifma            (cpu_policy.feat.avx_ifma && xcr0_mask(6))
 #define cpu_has_avx_vnni_int8       (cpu_policy.feat.avx_vnni_int8 && \
                                      xcr0_mask(6))
diff --git a/xen/arch/x86/include/asm/cpufeature.h b/xen/arch/x86/include/asm/cpufeature.h
index dad9ed68aa..3baf9fcdbe 100644
--- a/xen/arch/x86/include/asm/cpufeature.h
+++ b/xen/arch/x86/include/asm/cpufeature.h
@@ -189,6 +189,7 @@ static inline bool boot_cpu_has(unsigned int feat)
 #define cpu_has_sm4             boot_cpu_has(X86_FEATURE_SM4)
 #define cpu_has_avx_vnni        boot_cpu_has(X86_FEATURE_AVX_VNNI)
 #define cpu_has_avx512_bf16     boot_cpu_has(X86_FEATURE_AVX512_BF16)
+#define cpu_has_cmpccxadd       boot_cpu_has(X86_FEATURE_CMPCCXADD)
 #define cpu_has_avx_ifma        boot_cpu_has(X86_FEATURE_AVX_IFMA)
 
 /* CPUID level 0x00000007:1.edx */
diff --git a/xen/arch/x86/x86_emulate/decode.c b/xen/arch/x86/x86_emulate/decode.c
index faaeb2547d..32b9276dc5 100644
--- a/xen/arch/x86/x86_emulate/decode.c
+++ b/xen/arch/x86/x86_emulate/decode.c
@@ -440,6 +440,7 @@ static const struct ext0f38_table {
     [0xda] = { .simd_size = simd_other },
     [0xdb] = { .simd_size = simd_packed_int, .two_op = 1 },
     [0xdc ... 0xdf] = { .simd_size = simd_packed_int, .d8s = d8s_vl },
+    [0xe0 ... 0xef] = { .to_mem = 1 },
     [0xf0] = { .two_op = 1 },
     [0xf1] = { .to_mem = 1, .two_op = 1 },
     [0xf2 ... 0xf3] = {},
@@ -929,6 +930,8 @@ decode_0f38(struct x86_emulate_state *s,
             ctxt->opcode |= MASK_INSR(s->vex.pfx, X86EMUL_OPC_PFX_MASK);
         break;
 
+    case X86EMUL_OPC_VEX_66(0, 0xe0) ...
+         X86EMUL_OPC_VEX_66(0, 0xef): /* cmp<cc>xadd */
     case X86EMUL_OPC_VEX(0, 0xf2):    /* andn */
     case X86EMUL_OPC_VEX(0, 0xf3):    /* Grp 17 */
     case X86EMUL_OPC_VEX(0, 0xf5):    /* bzhi */
diff --git a/xen/arch/x86/x86_emulate/private.h b/xen/arch/x86/x86_emulate/private.h
index f735bb6a5a..172270a458 100644
--- a/xen/arch/x86/x86_emulate/private.h
+++ b/xen/arch/x86/x86_emulate/private.h
@@ -261,6 +261,7 @@ struct x86_emulate_state {
         rmw_btc,
         rmw_btr,
         rmw_bts,
+        rmw_cmpccxadd,
         rmw_dec,
         rmw_inc,
         rmw_neg,
@@ -592,6 +593,7 @@ amd_like(const struct x86_emulate_ctxt *ctxt)
 #define vcpu_has_sm4()         (ctxt->cpuid->feat.sm4)
 #define vcpu_has_avx_vnni()    (ctxt->cpuid->feat.avx_vnni)
 #define vcpu_has_avx512_bf16() (ctxt->cpuid->feat.avx512_bf16)
+#define vcpu_has_cmpccxadd()   (ctxt->cpuid->feat.cmpccxadd)
 #define vcpu_has_wrmsrns()     (ctxt->cpuid->feat.wrmsrns)
 #define vcpu_has_avx_ifma()    (ctxt->cpuid->feat.avx_ifma)
 #define vcpu_has_avx_vnni_int8() (ctxt->cpuid->feat.avx_vnni_int8)
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index e12fbe3100..bbda0ffc2f 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -6811,6 +6811,15 @@ x86_emulate(
 
 #endif /* !X86EMUL_NO_SIMD */
 
+    case X86EMUL_OPC_VEX_66(0x0f38, 0xe0) ...
+         X86EMUL_OPC_VEX_66(0x0f38, 0xef): /* cmp<cc>xadd r,r,m */
+        generate_exception_if(!mode_64bit() || dst.type != OP_MEM || vex.l,
+                              X86_EXC_UD);
+        host_and_vcpu_must_have(cmpccxadd);
+        fail_if(!ops->rmw);
+        state->rmw = rmw_cmpccxadd;
+        break;
+
     case X86EMUL_OPC(0x0f38, 0xf0): /* movbe m,r */
     case X86EMUL_OPC(0x0f38, 0xf1): /* movbe r,m */
         vcpu_must_have(movbe);
@@ -8090,14 +8099,20 @@ x86_emulate(
     {
         ea.val = src.val;
         op_bytes = dst.bytes;
+        state->stub_exn = &stub_exn;
         rc = ops->rmw(dst.mem.seg, dst.mem.off, dst.bytes, &_regs.eflags,
                       state, ctxt);
+#ifdef __XEN__
+        if ( rc == X86EMUL_stub_failure )
+            goto emulation_stub_failure;
+#endif
         if ( rc != X86EMUL_OKAY )
             goto done;
 
         /* Some operations require a register to be written. */
         switch ( state->rmw )
         {
+        case rmw_cmpccxadd:
         case rmw_xchg:
         case rmw_xadd:
             switch ( dst.bytes )
@@ -8372,6 +8387,7 @@ int x86_emul_rmw(
     uint32_t *eflags,
     struct x86_emulate_state *s,
     struct x86_emulate_ctxt *ctxt)
+#define stub_exn (*s->stub_exn) /* for invoke_stub() */
 {
     unsigned long *dst = ptr;
 
@@ -8437,6 +8453,37 @@ int x86_emul_rmw(
 #undef BINOP
 #undef SHIFT
 
+#ifdef __x86_64__
+    case rmw_cmpccxadd:
+    {
+        struct x86_emulate_stub stub = {};
+        uint8_t *buf = get_stub(stub);
+        typeof(s->vex) *pvex = container_of(buf + 1, typeof(s->vex),
+                                            raw[0]);
+        unsigned long dummy;
+
+        buf[0] = 0xc4;
+        *pvex = s->vex;
+        pvex->b = 1;
+        pvex->r = 1;
+        pvex->reg = 0xf; /* rAX */
+        buf[3] = ctxt->opcode;
+        buf[4] = 0x11; /* reg=rDX r/m=(%RCX) */
+        buf[5] = 0xc3;
+
+        *eflags &= ~EFLAGS_MASK;
+        invoke_stub("",
+                    _POST_EFLAGS("[eflags]", "[mask]", "[tmp]"),
+                    "+m" (*dst), "+d" (s->ea.val),
+                    [tmp] "=&r" (dummy), [eflags] "+g" (*eflags)
+                    : "a" (*decode_vex_gpr(s->vex.reg, ctxt->regs, ctxt)),
+                      "c" (dst), [mask] "i" (EFLAGS_MASK));
+
+        put_stub(stub);
+        break;
+    }
+#endif
+
     case rmw_not:
         switch ( s->op_bytes )
         {
@@ -8532,7 +8579,13 @@ int x86_emul_rmw(
 #undef JCXZ
 
     return X86EMUL_OKAY;
+
+#if defined(__XEN__) && defined(__x86_64__)
+ emulation_stub_failure:
+    return X86EMUL_stub_failure;
+#endif
 }
+#undef stub_exn
 
 static void __init __maybe_unused build_assertions(void)
 {
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index adc1fa34cc..8fa3fb711a 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -303,6 +303,7 @@ XEN_CPUFEATURE(SM3,          10*32+ 1) /*A  SM3 Instructions */
 XEN_CPUFEATURE(SM4,          10*32+ 2) /*A  SM4 Instructions */
 XEN_CPUFEATURE(AVX_VNNI,     10*32+ 4) /*A  AVX-VNNI Instructions */
 XEN_CPUFEATURE(AVX512_BF16,  10*32+ 5) /*A  AVX512 BFloat16 Instructions */
+XEN_CPUFEATURE(CMPCCXADD,    10*32+ 7) /*a  CMPccXADD Instructions */
 XEN_CPUFEATURE(FZRM,         10*32+10) /*A  Fast Zero-length REP MOVSB */
 XEN_CPUFEATURE(FSRS,         10*32+11) /*A  Fast Short REP STOSB */
 XEN_CPUFEATURE(FSRCS,        10*32+12) /*A  Fast Short REP CMPSB/SCASB */
diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index f7cad255da..a77cb30bdb 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -274,7 +274,7 @@ def crunch_numbers(state):
         # superpages, PCID and PKU are only available in 4 level paging.
         # NO_LMSL indicates the absense of Long Mode Segment Limits, which
         # have been dropped in hardware.
-        LM: [CX16, PCID, LAHF_LM, PAGE1GB, PKU, NO_LMSL, AMX_TILE],
+        LM: [CX16, PCID, LAHF_LM, PAGE1GB, PKU, NO_LMSL, AMX_TILE, CMPCCXADD],
 
         # AMD K6-2+ and K6-III processors shipped with 3DNow+, beyond the
         # standard 3DNow in the earlier K6 processors.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 07:22:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 07:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797051.1206818 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soe9f-00043w-1c; Thu, 12 Sep 2024 07:22:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797051.1206818; Thu, 12 Sep 2024 07:22:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soe9e-00043o-VN; Thu, 12 Sep 2024 07:22:14 +0000
Received: by outflank-mailman (input) for mailman id 797051;
 Thu, 12 Sep 2024 07:22:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soe9d-00043e-NH
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:22:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soe9d-0006Kv-MT
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:22:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soe9d-0002yC-J7
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:22:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=J97K7armTrM8dCqZxWFCQlBjRDANDYnaCMhasFJU+cY=; b=G3dguxRX/jSIjGCWu438PWzxxk
	5HcDYPyIvqgDXcJHtJonZk1i9M3tMlel66Xcmg1tg4GQ+6pzIr/JlGaZQoufZUMZTv+b8C30x3wdH
	uiXzvXxck3YujtIyWLrCD2TUTqMmGN1nIGtuwwsZVhm04/kxGvdzEYcK95IJWWZ6yVio=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/HVM: properly reject "indirect" VRAM writes
Message-Id: <E1soe9d-0002yC-J7@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 07:22:13 +0000

commit eb7cd0593d88c4b967a24bca8bd30591966676cd
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 12 09:13:04 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 09:13:04 2024 +0200

    x86/HVM: properly reject "indirect" VRAM writes
    
    While ->count will only be different from 1 for "indirect" (data in
    guest memory) accesses, it being 1 does not exclude the request being an
    "indirect" one. Check both to be on the safe side, and bring the ->count
    part also in line with what ioreq_send_buffered() actually refuses to
    handle.
    
    Fixes: 3bbaaec09b1b ("x86/hvm: unify stdvga mmio intercept with standard mmio intercept")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/stdvga.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index afd2ca95d6..2520d0dd01 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -498,13 +498,13 @@ static bool cf_check stdvga_mem_accept(
 
     spin_lock(&s->lock);
 
-    if ( p->dir == IOREQ_WRITE && p->count > 1 )
+    if ( p->dir == IOREQ_WRITE && (p->data_is_ptr || p->count != 1) )
     {
         /*
          * We cannot return X86EMUL_UNHANDLEABLE on anything other then the
          * first cycle of an I/O. So, since we cannot guarantee to always be
          * able to send buffered writes, we have to reject any multi-cycle
-         * I/O.
+         * or "indirect" I/O.
          */
         goto reject;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 07:22:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 07:22:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797052.1206823 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soe9p-00046k-34; Thu, 12 Sep 2024 07:22:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797052.1206823; Thu, 12 Sep 2024 07:22:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soe9p-00046d-0b; Thu, 12 Sep 2024 07:22:25 +0000
Received: by outflank-mailman (input) for mailman id 797052;
 Thu, 12 Sep 2024 07:22:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soe9n-00046Q-Qq
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:22:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soe9n-0006Me-Q5
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:22:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soe9n-0002z7-OV
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:22:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nuKJZfKTVICUUuFO33Sddf9tO3KHJC/dom6+q14y50M=; b=lMz23tcfyb34ufsWe4PLEdPuMY
	PWw6uR5t6IWAg3Rc8CIbE0mFcHBxC98tsrOdS0WFF1dYxrCWoXn2VZeeHkZxqOTYCSVo0klFtDbjd
	RG9VKUVRAzhRanydyuNVKAl5ldtxFEHDgqubkqSN2OcgR4DH9eMOQrV9jgGFEUk+QfIc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/HVM: drop stdvga's "stdvga" struct member
Message-Id: <E1soe9n-0002z7-OV@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 07:22:23 +0000

commit b740a9369e81bdda675a9780130ce2b9e75d4ec9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 12 09:13:27 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 09:13:27 2024 +0200

    x86/HVM: drop stdvga's "stdvga" struct member
    
    Two of its consumers are dead (in compile-time constant conditionals)
    and the only remaining ones are merely controlling debug logging. Hence
    the field is now pointless to set, which in particular allows to get rid
    of the questionable conditional from which the field's value was
    established (afaict 551ceee97513 ["x86, hvm: stdvga cache always on"]
    had dropped too much of the earlier extra check that was there, and
    quite likely further checks were missing).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/stdvga.c         | 30 +++++-------------------------
 xen/arch/x86/include/asm/hvm/io.h |  1 -
 2 files changed, 5 insertions(+), 26 deletions(-)

diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index 2520d0dd01..8a9ce05346 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -103,7 +103,7 @@ static void vram_put(struct hvm_hw_stdvga *s, void *p)
 static int stdvga_outb(uint64_t addr, uint8_t val)
 {
     struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
-    int rc = 1, prev_stdvga = s->stdvga;
+    int rc = 1;
 
     switch ( addr )
     {
@@ -132,19 +132,6 @@ static int stdvga_outb(uint64_t addr, uint8_t val)
         break;
     }
 
-    /* When in standard vga mode, emulate here all writes to the vram buffer
-     * so we can immediately satisfy reads without waiting for qemu. */
-    s->stdvga = (s->sr[7] == 0x00);
-
-    if ( !prev_stdvga && s->stdvga )
-    {
-        gdprintk(XENLOG_INFO, "entering stdvga mode\n");
-    }
-    else if ( prev_stdvga && !s->stdvga )
-    {
-        gdprintk(XENLOG_INFO, "leaving stdvga mode\n");
-    }
-
     return rc;
 }
 
@@ -425,7 +412,6 @@ static int cf_check stdvga_mem_write(
     const struct hvm_io_handler *handler, uint64_t addr, uint32_t size,
     uint64_t data)
 {
-    struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
     ioreq_t p = {
         .type = IOREQ_TYPE_COPY,
         .addr = addr,
@@ -436,8 +422,7 @@ static int cf_check stdvga_mem_write(
     };
     struct ioreq_server *srv;
 
-    if ( true || !s->stdvga )
-        goto done;
+    goto done;
 
     /* Intercept mmio write */
     switch ( size )
@@ -498,19 +483,14 @@ static bool cf_check stdvga_mem_accept(
 
     spin_lock(&s->lock);
 
-    if ( p->dir == IOREQ_WRITE && (p->data_is_ptr || p->count != 1) )
+    if ( p->dir != IOREQ_WRITE || p->data_is_ptr || p->count != 1 )
     {
         /*
-         * We cannot return X86EMUL_UNHANDLEABLE on anything other then the
-         * first cycle of an I/O. So, since we cannot guarantee to always be
-         * able to send buffered writes, we have to reject any multi-cycle
-         * or "indirect" I/O.
+         * Only accept single direct writes, as that's the only thing we can
+         * accelerate using buffered ioreq handling.
          */
         goto reject;
     }
-    else if ( p->dir == IOREQ_READ &&
-              (true || !s->stdvga) )
-        goto reject;
 
     /* s->lock intentionally held */
     return 1;
diff --git a/xen/arch/x86/include/asm/hvm/io.h b/xen/arch/x86/include/asm/hvm/io.h
index ce171eaca4..67f4d033a7 100644
--- a/xen/arch/x86/include/asm/hvm/io.h
+++ b/xen/arch/x86/include/asm/hvm/io.h
@@ -115,7 +115,6 @@ struct hvm_hw_stdvga {
     uint8_t sr[8];
     uint8_t gr_index;
     uint8_t gr[9];
-    bool stdvga;
     uint32_t latch;
     struct page_info *vram_page[64];  /* shadow of 0xa0000-0xaffff */
     spinlock_t lock;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 07:22:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 07:22:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797053.1206826 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soe9z-0004As-4o; Thu, 12 Sep 2024 07:22:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797053.1206826; Thu, 12 Sep 2024 07:22:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soe9z-0004Al-26; Thu, 12 Sep 2024 07:22:35 +0000
Received: by outflank-mailman (input) for mailman id 797053;
 Thu, 12 Sep 2024 07:22:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soe9x-0004Af-UP
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:22:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soe9x-0006Mn-Tg
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:22:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soe9x-0002zp-SB
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:22:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FU+h51AyqSjtSYr7iOEysD1Y6TFuVnqxIJqKm+aG4v8=; b=kwN6Zrjnb6njduXnaDFtplujgn
	fSaGkbXAyRhrsOPYIxznYoqlZ6rBhncu7yn3M4QArnEg30CvudY5lqA3F+vNsDv/g/aeMYrU+U5RV
	SGmvOjbtLNYgmhQYibzgKTfoJRpt2wjSpoulJ4NptKU26paURntaMF3OE7EfLG8QSYoU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/HVM: remove unused MMIO handling code
Message-Id: <E1soe9x-0002zp-SB@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 07:22:33 +0000

commit 89108547af1f230b72893b48351f9c1106189649
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 12 09:13:57 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 09:13:57 2024 +0200

    x86/HVM: remove unused MMIO handling code
    
    All read accesses are rejected by the ->accept handler, while writes
    bypass the bulk of the function body. Drop the dead code, leaving an
    assertion in the read handler.
    
    A number of other static items (and a macro) are then unreferenced and
    hence also need (want) dropping. The same applies to the "latch" field
    of the state structure.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/stdvga.c         | 317 +-------------------------------------
 xen/arch/x86/include/asm/hvm/io.h |   1 -
 2 files changed, 4 insertions(+), 314 deletions(-)

diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index 8a9ce05346..0f0bd10068 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -37,26 +37,6 @@
 #define VGA_MEM_BASE 0xa0000
 #define VGA_MEM_SIZE 0x20000
 
-#define PAT(x) (x)
-static const uint32_t mask16[16] = {
-    PAT(0x00000000U),
-    PAT(0x000000ffU),
-    PAT(0x0000ff00U),
-    PAT(0x0000ffffU),
-    PAT(0x00ff0000U),
-    PAT(0x00ff00ffU),
-    PAT(0x00ffff00U),
-    PAT(0x00ffffffU),
-    PAT(0xff000000U),
-    PAT(0xff0000ffU),
-    PAT(0xff00ff00U),
-    PAT(0xff00ffffU),
-    PAT(0xffff0000U),
-    PAT(0xffff00ffU),
-    PAT(0xffffff00U),
-    PAT(0xffffffffU),
-};
-
 /* force some bits to zero */
 static const uint8_t sr_mask[8] = {
     (uint8_t)~0xfc,
@@ -81,25 +61,6 @@ static const uint8_t gr_mask[9] = {
     (uint8_t)~0x00, /* 0x08 */
 };
 
-static uint8_t *vram_getb(struct hvm_hw_stdvga *s, unsigned int a)
-{
-    struct page_info *pg = s->vram_page[(a >> 12) & 0x3f];
-    uint8_t *p = __map_domain_page(pg);
-    return &p[a & 0xfff];
-}
-
-static uint32_t *vram_getl(struct hvm_hw_stdvga *s, unsigned int a)
-{
-    struct page_info *pg = s->vram_page[(a >> 10) & 0x3f];
-    uint32_t *p = __map_domain_page(pg);
-    return &p[a & 0x3ff];
-}
-
-static void vram_put(struct hvm_hw_stdvga *s, void *p)
-{
-    unmap_domain_page(p);
-}
-
 static int stdvga_outb(uint64_t addr, uint8_t val)
 {
     struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
@@ -168,244 +129,13 @@ static int cf_check stdvga_intercept_pio(
     return X86EMUL_UNHANDLEABLE; /* propagate to external ioemu */
 }
 
-static unsigned int stdvga_mem_offset(
-    struct hvm_hw_stdvga *s, unsigned int mmio_addr)
-{
-    unsigned int memory_map_mode = (s->gr[6] >> 2) & 3;
-    unsigned int offset = mmio_addr & 0x1ffff;
-
-    switch ( memory_map_mode )
-    {
-    case 0:
-        break;
-    case 1:
-        if ( offset >= 0x10000 )
-            goto fail;
-        offset += 0; /* assume bank_offset == 0; */
-        break;
-    case 2:
-        offset -= 0x10000;
-        if ( offset >= 0x8000 )
-            goto fail;
-        break;
-    default:
-    case 3:
-        offset -= 0x18000;
-        if ( offset >= 0x8000 )
-            goto fail;
-        break;
-    }
-
-    return offset;
-
- fail:
-    return ~0u;
-}
-
-#define GET_PLANE(data, p) (((data) >> ((p) * 8)) & 0xff)
-
-static uint8_t stdvga_mem_readb(uint64_t addr)
-{
-    struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
-    int plane;
-    uint32_t ret, *vram_l;
-    uint8_t *vram_b;
-
-    addr = stdvga_mem_offset(s, addr);
-    if ( addr == ~0u )
-        return 0xff;
-
-    if ( s->sr[4] & 0x08 )
-    {
-        /* chain 4 mode : simplest access */
-        vram_b = vram_getb(s, addr);
-        ret = *vram_b;
-        vram_put(s, vram_b);
-    }
-    else if ( s->gr[5] & 0x10 )
-    {
-        /* odd/even mode (aka text mode mapping) */
-        plane = (s->gr[4] & 2) | (addr & 1);
-        vram_b = vram_getb(s, ((addr & ~1) << 1) | plane);
-        ret = *vram_b;
-        vram_put(s, vram_b);
-    }
-    else
-    {
-        /* standard VGA latched access */
-        vram_l = vram_getl(s, addr);
-        s->latch = *vram_l;
-        vram_put(s, vram_l);
-
-        if ( !(s->gr[5] & 0x08) )
-        {
-            /* read mode 0 */
-            plane = s->gr[4];
-            ret = GET_PLANE(s->latch, plane);
-        }
-        else
-        {
-            /* read mode 1 */
-            ret = (s->latch ^ mask16[s->gr[2]]) & mask16[s->gr[7]];
-            ret |= ret >> 16;
-            ret |= ret >> 8;
-            ret = (~ret) & 0xff;
-        }
-    }
-
-    return ret;
-}
-
 static int cf_check stdvga_mem_read(
     const struct hvm_io_handler *handler, uint64_t addr, uint32_t size,
     uint64_t *p_data)
 {
-    uint64_t data = ~0UL;
-
-    switch ( size )
-    {
-    case 1:
-        data = stdvga_mem_readb(addr);
-        break;
-
-    case 2:
-        data = stdvga_mem_readb(addr);
-        data |= stdvga_mem_readb(addr + 1) << 8;
-        break;
-
-    case 4:
-        data = stdvga_mem_readb(addr);
-        data |= stdvga_mem_readb(addr + 1) << 8;
-        data |= stdvga_mem_readb(addr + 2) << 16;
-        data |= (uint32_t)stdvga_mem_readb(addr + 3) << 24;
-        break;
-
-    case 8:
-        data =  (uint64_t)(stdvga_mem_readb(addr));
-        data |= (uint64_t)(stdvga_mem_readb(addr + 1)) << 8;
-        data |= (uint64_t)(stdvga_mem_readb(addr + 2)) << 16;
-        data |= (uint64_t)(stdvga_mem_readb(addr + 3)) << 24;
-        data |= (uint64_t)(stdvga_mem_readb(addr + 4)) << 32;
-        data |= (uint64_t)(stdvga_mem_readb(addr + 5)) << 40;
-        data |= (uint64_t)(stdvga_mem_readb(addr + 6)) << 48;
-        data |= (uint64_t)(stdvga_mem_readb(addr + 7)) << 56;
-        break;
-
-    default:
-        gdprintk(XENLOG_WARNING, "invalid io size: %u\n", size);
-        break;
-    }
-
-    *p_data = data;
-    return X86EMUL_OKAY;
-}
-
-static void stdvga_mem_writeb(uint64_t addr, uint32_t val)
-{
-    struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
-    int plane, write_mode, b, func_select, mask;
-    uint32_t write_mask, bit_mask, set_mask, *vram_l;
-    uint8_t *vram_b;
-
-    addr = stdvga_mem_offset(s, addr);
-    if ( addr == ~0u )
-        return;
-
-    if ( s->sr[4] & 0x08 )
-    {
-        /* chain 4 mode : simplest access */
-        plane = addr & 3;
-        mask = (1 << plane);
-        if ( s->sr[2] & mask )
-        {
-            vram_b = vram_getb(s, addr);
-            *vram_b = val;
-            vram_put(s, vram_b);
-        }
-    }
-    else if ( s->gr[5] & 0x10 )
-    {
-        /* odd/even mode (aka text mode mapping) */
-        plane = (s->gr[4] & 2) | (addr & 1);
-        mask = (1 << plane);
-        if ( s->sr[2] & mask )
-        {
-            addr = ((addr & ~1) << 1) | plane;
-            vram_b = vram_getb(s, addr);
-            *vram_b = val;
-            vram_put(s, vram_b);
-        }
-    }
-    else
-    {
-        write_mode = s->gr[5] & 3;
-        switch ( write_mode )
-        {
-        default:
-        case 0:
-            /* rotate */
-            b = s->gr[3] & 7;
-            val = ((val >> b) | (val << (8 - b))) & 0xff;
-            val |= val << 8;
-            val |= val << 16;
-
-            /* apply set/reset mask */
-            set_mask = mask16[s->gr[1]];
-            val = (val & ~set_mask) | (mask16[s->gr[0]] & set_mask);
-            bit_mask = s->gr[8];
-            break;
-        case 1:
-            val = s->latch;
-            goto do_write;
-        case 2:
-            val = mask16[val & 0x0f];
-            bit_mask = s->gr[8];
-            break;
-        case 3:
-            /* rotate */
-            b = s->gr[3] & 7;
-            val = (val >> b) | (val << (8 - b));
-
-            bit_mask = s->gr[8] & val;
-            val = mask16[s->gr[0]];
-            break;
-        }
-
-        /* apply logical operation */
-        func_select = s->gr[3] >> 3;
-        switch ( func_select )
-        {
-        case 0:
-        default:
-            /* nothing to do */
-            break;
-        case 1:
-            /* and */
-            val &= s->latch;
-            break;
-        case 2:
-            /* or */
-            val |= s->latch;
-            break;
-        case 3:
-            /* xor */
-            val ^= s->latch;
-            break;
-        }
-
-        /* apply bit mask */
-        bit_mask |= bit_mask << 8;
-        bit_mask |= bit_mask << 16;
-        val = (val & bit_mask) | (s->latch & ~bit_mask);
-
-    do_write:
-        /* mask data according to sr[2] */
-        mask = s->sr[2];
-        write_mask = mask16[mask];
-        vram_l = vram_getl(s, addr);
-        *vram_l = (*vram_l & ~write_mask) | (val & write_mask);
-        vram_put(s, vram_l);
-    }
+    ASSERT_UNREACHABLE();
+    *p_data = ~0;
+    return X86EMUL_UNHANDLEABLE;
 }
 
 static int cf_check stdvga_mem_write(
@@ -420,47 +150,8 @@ static int cf_check stdvga_mem_write(
         .dir = IOREQ_WRITE,
         .data = data,
     };
-    struct ioreq_server *srv;
-
-    goto done;
-
-    /* Intercept mmio write */
-    switch ( size )
-    {
-    case 1:
-        stdvga_mem_writeb(addr, (data >>  0) & 0xff);
-        break;
-
-    case 2:
-        stdvga_mem_writeb(addr+0, (data >>  0) & 0xff);
-        stdvga_mem_writeb(addr+1, (data >>  8) & 0xff);
-        break;
-
-    case 4:
-        stdvga_mem_writeb(addr+0, (data >>  0) & 0xff);
-        stdvga_mem_writeb(addr+1, (data >>  8) & 0xff);
-        stdvga_mem_writeb(addr+2, (data >> 16) & 0xff);
-        stdvga_mem_writeb(addr+3, (data >> 24) & 0xff);
-        break;
-
-    case 8:
-        stdvga_mem_writeb(addr+0, (data >>  0) & 0xff);
-        stdvga_mem_writeb(addr+1, (data >>  8) & 0xff);
-        stdvga_mem_writeb(addr+2, (data >> 16) & 0xff);
-        stdvga_mem_writeb(addr+3, (data >> 24) & 0xff);
-        stdvga_mem_writeb(addr+4, (data >> 32) & 0xff);
-        stdvga_mem_writeb(addr+5, (data >> 40) & 0xff);
-        stdvga_mem_writeb(addr+6, (data >> 48) & 0xff);
-        stdvga_mem_writeb(addr+7, (data >> 56) & 0xff);
-        break;
-
-    default:
-        gdprintk(XENLOG_WARNING, "invalid io size: %u\n", size);
-        break;
-    }
+    struct ioreq_server *srv = ioreq_server_select(current->domain, &p);
 
- done:
-    srv = ioreq_server_select(current->domain, &p);
     if ( !srv )
         return X86EMUL_UNHANDLEABLE;
 
diff --git a/xen/arch/x86/include/asm/hvm/io.h b/xen/arch/x86/include/asm/hvm/io.h
index 67f4d033a7..91714f3614 100644
--- a/xen/arch/x86/include/asm/hvm/io.h
+++ b/xen/arch/x86/include/asm/hvm/io.h
@@ -115,7 +115,6 @@ struct hvm_hw_stdvga {
     uint8_t sr[8];
     uint8_t gr_index;
     uint8_t gr[9];
-    uint32_t latch;
     struct page_info *vram_page[64];  /* shadow of 0xa0000-0xaffff */
     spinlock_t lock;
 };
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 07:22:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 07:22:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797054.1206831 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soeA9-0004E4-7l; Thu, 12 Sep 2024 07:22:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797054.1206831; Thu, 12 Sep 2024 07:22:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soeA9-0004Dw-4r; Thu, 12 Sep 2024 07:22:45 +0000
Received: by outflank-mailman (input) for mailman id 797054;
 Thu, 12 Sep 2024 07:22:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soeA8-0004Dj-1b
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:22:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soeA8-0006Mu-0w
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:22:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soeA7-00030e-Vo
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:22:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VOxheEaJxhhLl60VLtgq/NuPmugwuxwElf9RG1bzOXI=; b=ZIztTwd9b5Ylt+ndbls8gHaM12
	eYySzeBQbU7Mq+9VutvbnXGOxUkEZPU9IH8d3BQoKTYTUkWJdMrdB6WmU5E8eruJp7ptFZ/sVvPqa
	74f5t+UEapvVe93xPtHLk+d0dGCfBRi/kGvYJ21Vm0mLxqWu1CRqI/QurnXyBzt2KDaU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/HVM: drop stdvga's "gr[]" struct member
Message-Id: <E1soeA7-00030e-Vo@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 07:22:43 +0000

commit b16c0966a17f19c0e55ed0b9baa28191d2590178
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 12 09:14:27 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 09:14:27 2024 +0200

    x86/HVM: drop stdvga's "gr[]" struct member
    
    No consumers are left, hence the producer and the array itself can also
    go away. The static gr_mask[] is then orphaned and hence needs dropping,
    too.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/stdvga.c         | 18 ------------------
 xen/arch/x86/include/asm/hvm/io.h |  1 -
 2 files changed, 19 deletions(-)

diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index 0f0bd10068..fa25833caa 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -49,18 +49,6 @@ static const uint8_t sr_mask[8] = {
     (uint8_t)~0x00,
 };
 
-static const uint8_t gr_mask[9] = {
-    (uint8_t)~0xf0, /* 0x00 */
-    (uint8_t)~0xf0, /* 0x01 */
-    (uint8_t)~0xf0, /* 0x02 */
-    (uint8_t)~0xe0, /* 0x03 */
-    (uint8_t)~0xfc, /* 0x04 */
-    (uint8_t)~0x84, /* 0x05 */
-    (uint8_t)~0xf0, /* 0x06 */
-    (uint8_t)~0xf0, /* 0x07 */
-    (uint8_t)~0x00, /* 0x08 */
-};
-
 static int stdvga_outb(uint64_t addr, uint8_t val)
 {
     struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
@@ -82,12 +70,6 @@ static int stdvga_outb(uint64_t addr, uint8_t val)
         s->gr_index = val;
         break;
 
-    case 0x3cf:                 /* graphics data register */
-        rc = (s->gr_index < sizeof(s->gr));
-        if ( rc )
-            s->gr[s->gr_index] = val & gr_mask[s->gr_index];
-        break;
-
     default:
         rc = 0;
         break;
diff --git a/xen/arch/x86/include/asm/hvm/io.h b/xen/arch/x86/include/asm/hvm/io.h
index 91714f3614..126622e53c 100644
--- a/xen/arch/x86/include/asm/hvm/io.h
+++ b/xen/arch/x86/include/asm/hvm/io.h
@@ -114,7 +114,6 @@ struct hvm_hw_stdvga {
     uint8_t sr_index;
     uint8_t sr[8];
     uint8_t gr_index;
-    uint8_t gr[9];
     struct page_info *vram_page[64];  /* shadow of 0xa0000-0xaffff */
     spinlock_t lock;
 };
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 07:22:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 07:22:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797055.1206836 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soeAJ-0004Gb-9I; Thu, 12 Sep 2024 07:22:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797055.1206836; Thu, 12 Sep 2024 07:22:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soeAJ-0004GT-6M; Thu, 12 Sep 2024 07:22:55 +0000
Received: by outflank-mailman (input) for mailman id 797055;
 Thu, 12 Sep 2024 07:22:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soeAI-0004GK-4W
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:22:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soeAI-0006N1-3s
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:22:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soeAI-00031b-2y
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:22:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Qb3BPqMgVyV3vvxIHGfoqbGE6WVQ82rmaNI53JiDtKY=; b=v/AKzx5kfUwKqG+cAVZX5MFp/R
	Y0wLgfl8qxacKIacisJ6FgD5udD+VaDYHQGPyObYzaQ2WFWPuFOeB/wbcRosZvUTUrkjfvRuD5Agh
	JDJhoHH4UJj/2Q5qsDS6Clzkt74qa4jLqUCAXSc7SChcDUwh0jLchlqeHwK5AEhfd1f8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/HVM: drop stdvga's "sr[]" struct member
Message-Id: <E1soeAI-00031b-2y@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 07:22:54 +0000

commit 7aba44bdd78aedb97703811948c3b69ccff85032
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 12 09:14:55 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 09:14:55 2024 +0200

    x86/HVM: drop stdvga's "sr[]" struct member
    
    No consumers are left, hence the producer and the array itself can also
    go away. The static sr_mask[] is then orphaned and hence needs dropping,
    too.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/stdvga.c         | 18 ------------------
 xen/arch/x86/include/asm/hvm/io.h |  1 -
 2 files changed, 19 deletions(-)

diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index fa25833caa..5523a441dd 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -37,18 +37,6 @@
 #define VGA_MEM_BASE 0xa0000
 #define VGA_MEM_SIZE 0x20000
 
-/* force some bits to zero */
-static const uint8_t sr_mask[8] = {
-    (uint8_t)~0xfc,
-    (uint8_t)~0xc2,
-    (uint8_t)~0xf0,
-    (uint8_t)~0xc0,
-    (uint8_t)~0xf1,
-    (uint8_t)~0xff,
-    (uint8_t)~0xff,
-    (uint8_t)~0x00,
-};
-
 static int stdvga_outb(uint64_t addr, uint8_t val)
 {
     struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
@@ -60,12 +48,6 @@ static int stdvga_outb(uint64_t addr, uint8_t val)
         s->sr_index = val;
         break;
 
-    case 0x3c5:                 /* sequencer data register */
-        rc = (s->sr_index < sizeof(s->sr));
-        if ( rc )
-            s->sr[s->sr_index] = val & sr_mask[s->sr_index] ;
-        break;
-
     case 0x3ce:                 /* graphics address register */
         s->gr_index = val;
         break;
diff --git a/xen/arch/x86/include/asm/hvm/io.h b/xen/arch/x86/include/asm/hvm/io.h
index 126622e53c..3e9079eab6 100644
--- a/xen/arch/x86/include/asm/hvm/io.h
+++ b/xen/arch/x86/include/asm/hvm/io.h
@@ -112,7 +112,6 @@ struct vpci_arch_msix_entry {
 
 struct hvm_hw_stdvga {
     uint8_t sr_index;
-    uint8_t sr[8];
     uint8_t gr_index;
     struct page_info *vram_page[64];  /* shadow of 0xa0000-0xaffff */
     spinlock_t lock;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 07:23:05 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 07:23:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797056.1206839 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soeAT-0004JF-AO; Thu, 12 Sep 2024 07:23:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797056.1206839; Thu, 12 Sep 2024 07:23:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soeAT-0004J7-7l; Thu, 12 Sep 2024 07:23:05 +0000
Received: by outflank-mailman (input) for mailman id 797056;
 Thu, 12 Sep 2024 07:23:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soeAS-0004Iu-84
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:23:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soeAS-0006Ne-7Q
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:23:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soeAS-00033D-6E
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:23:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vfVj9NsyOjVi7q8MRM69qGPCgfgxZW7nN2ktNyUIvwQ=; b=zldhXi9rePLT2x2S8Xj/wLS1Lt
	mbtzATAQwOejK4Ad/mVEzJMYXFG1Z9pITDT+4WLk/4bSQ5vvOva0423hCoKxAji+SEH8uDd9WmnOF
	aNRDeBrzffzpli3udiOEy0z8y6CER/usZSFZpW0tL1WoP+ypIMYxM5nyR4jj4EHHpgE8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/HVM: drop stdvga's "{g,s}r_index" struct members
Message-Id: <E1soeAS-00033D-6E@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 07:23:04 +0000

commit 86c03372e107f5c18266a62281663861b1144929
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 12 09:15:23 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 09:15:23 2024 +0200

    x86/HVM: drop stdvga's "{g,s}r_index" struct members
    
    No consumers are left, hence the producer and the fields themselves can
    also go away. stdvga_outb() is then useless, rendering stdvga_out()
    useless as well. Hence the entire I/O port intercept can go away.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/stdvga.c         | 61 ---------------------------------------
 xen/arch/x86/include/asm/hvm/io.h |  2 --
 2 files changed, 63 deletions(-)

diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index 5523a441dd..155a67a438 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -37,62 +37,6 @@
 #define VGA_MEM_BASE 0xa0000
 #define VGA_MEM_SIZE 0x20000
 
-static int stdvga_outb(uint64_t addr, uint8_t val)
-{
-    struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
-    int rc = 1;
-
-    switch ( addr )
-    {
-    case 0x3c4:                 /* sequencer address register */
-        s->sr_index = val;
-        break;
-
-    case 0x3ce:                 /* graphics address register */
-        s->gr_index = val;
-        break;
-
-    default:
-        rc = 0;
-        break;
-    }
-
-    return rc;
-}
-
-static void stdvga_out(uint32_t port, uint32_t bytes, uint32_t val)
-{
-    switch ( bytes )
-    {
-    case 1:
-        stdvga_outb(port, val);
-        break;
-
-    case 2:
-        stdvga_outb(port + 0, val >> 0);
-        stdvga_outb(port + 1, val >> 8);
-        break;
-
-    default:
-        break;
-    }
-}
-
-static int cf_check stdvga_intercept_pio(
-    int dir, unsigned int port, unsigned int bytes, uint32_t *val)
-{
-    struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
-
-    if ( dir == IOREQ_WRITE )
-    {
-        spin_lock(&s->lock);
-        stdvga_out(port, bytes, *val);
-        spin_unlock(&s->lock);
-    }
-
-    return X86EMUL_UNHANDLEABLE; /* propagate to external ioemu */
-}
-
 static int cf_check stdvga_mem_read(
     const struct hvm_io_handler *handler, uint64_t addr, uint32_t size,
     uint64_t *p_data)
@@ -194,11 +138,6 @@ void stdvga_init(struct domain *d)
     {
         struct hvm_io_handler *handler;
 
-        /* Sequencer registers. */
-        register_portio_handler(d, 0x3c4, 2, stdvga_intercept_pio);
-        /* Graphics registers. */
-        register_portio_handler(d, 0x3ce, 2, stdvga_intercept_pio);
-
         /* VGA memory */
         handler = hvm_next_io_handler(d);
 
diff --git a/xen/arch/x86/include/asm/hvm/io.h b/xen/arch/x86/include/asm/hvm/io.h
index 3e9079eab6..bf9ddfc70e 100644
--- a/xen/arch/x86/include/asm/hvm/io.h
+++ b/xen/arch/x86/include/asm/hvm/io.h
@@ -111,8 +111,6 @@ struct vpci_arch_msix_entry {
 };
 
 struct hvm_hw_stdvga {
-    uint8_t sr_index;
-    uint8_t gr_index;
     struct page_info *vram_page[64];  /* shadow of 0xa0000-0xaffff */
     spinlock_t lock;
 };
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 07:23:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 07:23:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797057.1206842 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soeAe-0004M9-BY; Thu, 12 Sep 2024 07:23:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797057.1206842; Thu, 12 Sep 2024 07:23:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soeAe-0004M1-9A; Thu, 12 Sep 2024 07:23:16 +0000
Received: by outflank-mailman (input) for mailman id 797057;
 Thu, 12 Sep 2024 07:23:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soeAc-0004Lm-Ba
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:23:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soeAc-0006Nl-An
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:23:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soeAc-00034R-9w
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:23:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=l3YsQWF2GpnTwsK3MoT7qA7y4spSITyMHa+9ml2zQ+0=; b=QXjz5lVQQ0+1fhbRCJbwqjVRLv
	02ipsXT4Sakmv04SMajOvP3HmWSWl0JZ32ZbNJxxdTQhAJUZdCW5uJYE9ujoyUJD6xp+ZmsKQn6Pp
	qFMiKWOnekNDAuc/QORiaQt+cd4DpoR3tXMAAEaw/b/AVAxUpX9jYblBez+0LjYWX3+c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/HVM: drop stdvga's "vram_page[]" struct member
Message-Id: <E1soeAc-00034R-9w@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 07:23:14 +0000

commit 3beb4baf2a0a2eef40d39eb7e6eecbfd36da5d14
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 12 09:15:52 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 09:15:52 2024 +0200

    x86/HVM: drop stdvga's "vram_page[]" struct member
    
    No uses are left, hence its setup, teardown, and the field itself can
    also go away. stdvga_deinit() is then empty and can be dropped as well.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/hvm.c            |  2 --
 xen/arch/x86/hvm/stdvga.c         | 41 ++++-----------------------------------
 xen/arch/x86/include/asm/hvm/io.h |  2 --
 3 files changed, 4 insertions(+), 41 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index f49e29faf7..a64eead368 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -700,7 +700,6 @@ int hvm_domain_initialise(struct domain *d,
     return 0;
 
  fail2:
-    stdvga_deinit(d);
     vioapic_deinit(d);
  fail1:
     if ( is_hardware_domain(d) )
@@ -763,7 +762,6 @@ void hvm_domain_destroy(struct domain *d)
     if ( hvm_funcs.domain_destroy )
         alternative_vcall(hvm_funcs.domain_destroy, d);
 
-    stdvga_deinit(d);
     vioapic_deinit(d);
 
     XFREE(d->arch.hvm.pl_time);
diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index 155a67a438..9f308fc896 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -116,8 +116,7 @@ static const struct hvm_io_ops stdvga_mem_ops = {
 void stdvga_init(struct domain *d)
 {
     struct hvm_hw_stdvga *s = &d->arch.hvm.stdvga;
-    struct page_info *pg;
-    unsigned int i;
+    struct hvm_io_handler *handler;
 
     if ( !has_vvga(d) )
         return;
@@ -125,47 +124,15 @@ void stdvga_init(struct domain *d)
     memset(s, 0, sizeof(*s));
     spin_lock_init(&s->lock);
     
-    for ( i = 0; i != ARRAY_SIZE(s->vram_page); i++ )
+    /* VGA memory */
+    handler = hvm_next_io_handler(d);
+    if ( handler )
     {
-        pg = alloc_domheap_page(d, MEMF_no_owner);
-        if ( pg == NULL )
-            break;
-        s->vram_page[i] = pg;
-        clear_domain_page(page_to_mfn(pg));
-    }
-
-    if ( i == ARRAY_SIZE(s->vram_page) )
-    {
-        struct hvm_io_handler *handler;
-
-        /* VGA memory */
-        handler = hvm_next_io_handler(d);
-
-        if ( handler == NULL )
-            return;
-
         handler->type = IOREQ_TYPE_COPY;
         handler->ops = &stdvga_mem_ops;
     }
 }
 
-void stdvga_deinit(struct domain *d)
-{
-    struct hvm_hw_stdvga *s = &d->arch.hvm.stdvga;
-    int i;
-
-    if ( !has_vvga(d) )
-        return;
-
-    for ( i = 0; i != ARRAY_SIZE(s->vram_page); i++ )
-    {
-        if ( s->vram_page[i] == NULL )
-            continue;
-        free_domheap_page(s->vram_page[i]);
-        s->vram_page[i] = NULL;
-    }
-}
-
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/include/asm/hvm/io.h b/xen/arch/x86/include/asm/hvm/io.h
index bf9ddfc70e..d49f6d6f8c 100644
--- a/xen/arch/x86/include/asm/hvm/io.h
+++ b/xen/arch/x86/include/asm/hvm/io.h
@@ -111,12 +111,10 @@ struct vpci_arch_msix_entry {
 };
 
 struct hvm_hw_stdvga {
-    struct page_info *vram_page[64];  /* shadow of 0xa0000-0xaffff */
     spinlock_t lock;
 };
 
 void stdvga_init(struct domain *d);
-void stdvga_deinit(struct domain *d);
 
 extern void hvm_dpci_msi_eoi(struct domain *d, int vector);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 07:23:26 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 07:23:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797058.1206847 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soeAo-0004Og-DR; Thu, 12 Sep 2024 07:23:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797058.1206847; Thu, 12 Sep 2024 07:23:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soeAo-0004OY-AZ; Thu, 12 Sep 2024 07:23:26 +0000
Received: by outflank-mailman (input) for mailman id 797058;
 Thu, 12 Sep 2024 07:23:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soeAm-0004OJ-EY
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:23:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soeAm-0006Nu-Dt
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:23:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soeAm-00035D-Cx
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:23:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+LAVP7Dua87hzEMUHT2DNs54/zm9nunN/aTt+AHFbfs=; b=Knvk/vSsFZlQ2cSNJKEyb9LktS
	2rKwRFLWa5o432EBnHlYYcKAesPBYKQtxJpCMpWulbkQU3s86bKqK8YBI4czRv0oquoKe+u1lIgif
	F4OhXNz30oYI63oBMbi/BHKT6gT1Rg3gPtQdVteA5EGQbcJrdMdYbtJJ0LjAOWBVhEC8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/HVM: drop stdvga's "lock" struct member
Message-Id: <E1soeAm-00035D-Cx@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 07:23:24 +0000

commit b180a50326c8a2c171f37c1940a0fbbdcad4be90
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 12 09:17:02 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 09:17:02 2024 +0200

    x86/HVM: drop stdvga's "lock" struct member
    
    No state is left to protect. It being the last field, drop the struct
    itself as well. Similarly for then ending up empty, drop the .complete
    handler.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/stdvga.c             | 30 ++----------------------------
 xen/arch/x86/include/asm/hvm/domain.h |  1 -
 xen/arch/x86/include/asm/hvm/io.h     |  4 ----
 3 files changed, 2 insertions(+), 33 deletions(-)

diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index 9f308fc896..d38d30affb 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -69,61 +69,35 @@ static int cf_check stdvga_mem_write(
 static bool cf_check stdvga_mem_accept(
     const struct hvm_io_handler *handler, const ioreq_t *p)
 {
-    struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
-
-    /*
-     * The range check must be done without taking the lock, to avoid
-     * deadlock when hvm_mmio_internal() is called from
-     * hvm_copy_to/from_guest_phys() in hvm_process_io_intercept().
-     */
     if ( (ioreq_mmio_first_byte(p) < VGA_MEM_BASE) ||
          (ioreq_mmio_last_byte(p) >= (VGA_MEM_BASE + VGA_MEM_SIZE)) )
         return 0;
 
-    spin_lock(&s->lock);
-
     if ( p->dir != IOREQ_WRITE || p->data_is_ptr || p->count != 1 )
     {
         /*
          * Only accept single direct writes, as that's the only thing we can
          * accelerate using buffered ioreq handling.
          */
-        goto reject;
+        return false;
     }
 
-    /* s->lock intentionally held */
-    return 1;
-
- reject:
-    spin_unlock(&s->lock);
-    return 0;
-}
-
-static void cf_check stdvga_mem_complete(const struct hvm_io_handler *handler)
-{
-    struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
-
-    spin_unlock(&s->lock);
+    return true;
 }
 
 static const struct hvm_io_ops stdvga_mem_ops = {
     .accept = stdvga_mem_accept,
     .read = stdvga_mem_read,
     .write = stdvga_mem_write,
-    .complete = stdvga_mem_complete
 };
 
 void stdvga_init(struct domain *d)
 {
-    struct hvm_hw_stdvga *s = &d->arch.hvm.stdvga;
     struct hvm_io_handler *handler;
 
     if ( !has_vvga(d) )
         return;
 
-    memset(s, 0, sizeof(*s));
-    spin_lock_init(&s->lock);
-    
     /* VGA memory */
     handler = hvm_next_io_handler(d);
     if ( handler )
diff --git a/xen/arch/x86/include/asm/hvm/domain.h b/xen/arch/x86/include/asm/hvm/domain.h
index dd9d837e84..333501d5f2 100644
--- a/xen/arch/x86/include/asm/hvm/domain.h
+++ b/xen/arch/x86/include/asm/hvm/domain.h
@@ -72,7 +72,6 @@ struct hvm_domain {
     struct hvm_hw_vpic     vpic[2]; /* 0=master; 1=slave */
     struct hvm_vioapic    **vioapic;
     unsigned int           nr_vioapics;
-    struct hvm_hw_stdvga   stdvga;
 
     /*
      * hvm_hw_pmtimer is a publicly-visible name. We will defer renaming
diff --git a/xen/arch/x86/include/asm/hvm/io.h b/xen/arch/x86/include/asm/hvm/io.h
index d49f6d6f8c..d72b29f73f 100644
--- a/xen/arch/x86/include/asm/hvm/io.h
+++ b/xen/arch/x86/include/asm/hvm/io.h
@@ -110,10 +110,6 @@ struct vpci_arch_msix_entry {
     int pirq;
 };
 
-struct hvm_hw_stdvga {
-    spinlock_t lock;
-};
-
 void stdvga_init(struct domain *d);
 
 extern void hvm_dpci_msi_eoi(struct domain *d, int vector);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 07:23:36 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 07:23:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797059.1206851 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soeAy-0004R9-FZ; Thu, 12 Sep 2024 07:23:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797059.1206851; Thu, 12 Sep 2024 07:23:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soeAy-0004R1-CS; Thu, 12 Sep 2024 07:23:36 +0000
Received: by outflank-mailman (input) for mailman id 797059;
 Thu, 12 Sep 2024 07:23:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soeAw-0004Qr-Jz
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:23:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soeAw-0006O1-HJ
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:23:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soeAw-00037a-Fx
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:23:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ncyrsrh7sjaf/mMCFmTKkBYFIrhsaT3P8LwQDw5qLQs=; b=J6rSvVpjGETB4ZfDiekXMtkCxI
	8qD02SaZ9XEhRnBUs2VBuAg827/LUQIBWJHlKAGgXJL2kEbTGREdD92PQr4OaJkHKGpO4CRzd7t1r
	k5/NaGspptvQ98EVNE8rgz2GJ+RCitHLtLDZ8UIngyh9+78FEW1crLQIUlEJMvWv+K8s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/HVM: drop .complete hook for intercept handling
Message-Id: <E1soeAw-00037a-Fx@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 07:23:34 +0000

commit 40f5c7e1389c2c047656f0ed3cc9ed4e194883f2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 12 09:17:43 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 09:17:43 2024 +0200

    x86/HVM: drop .complete hook for intercept handling
    
    No user of the hook exists anymore.
    
    While touching hvm_mmio_internal() also make direction of the request
    explicit - it only so happens that IOREQ_WRITE is zero. Yet it being a
    write is imperative for stdvga.c to "accept" the request.
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/intercept.c      | 24 +++---------------------
 xen/arch/x86/include/asm/hvm/io.h |  2 --
 2 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/hvm/intercept.c b/xen/arch/x86/hvm/intercept.c
index a949419cbe..8f82b82b07 100644
--- a/xen/arch/x86/hvm/intercept.c
+++ b/xen/arch/x86/hvm/intercept.c
@@ -240,21 +240,13 @@ static const struct hvm_io_handler *hvm_find_io_handler(const ioreq_t *p)
 int hvm_io_intercept(ioreq_t *p)
 {
     const struct hvm_io_handler *handler;
-    const struct hvm_io_ops *ops;
-    int rc;
 
     handler = hvm_find_io_handler(p);
 
     if ( handler == NULL )
         return X86EMUL_UNHANDLEABLE;
 
-    rc = hvm_process_io_intercept(handler, p);
-
-    ops = handler->ops;
-    if ( ops->complete != NULL )
-        ops->complete(handler);
-
-    return rc;
+    return hvm_process_io_intercept(handler, p);
 }
 
 struct hvm_io_handler *hvm_next_io_handler(struct domain *d)
@@ -326,25 +318,15 @@ bool relocate_portio_handler(struct domain *d, unsigned int old_port,
 
 bool hvm_mmio_internal(paddr_t gpa)
 {
-    const struct hvm_io_handler *handler;
-    const struct hvm_io_ops *ops;
     ioreq_t p = {
         .type = IOREQ_TYPE_COPY,
         .addr = gpa,
         .count = 1,
         .size = 1,
+        .dir = IOREQ_WRITE, /* for stdvga */
     };
 
-    handler = hvm_find_io_handler(&p);
-
-    if ( handler == NULL )
-        return 0;
-
-    ops = handler->ops;
-    if ( ops->complete != NULL )
-        ops->complete(handler);
-
-    return 1;
+    return hvm_find_io_handler(&p);
 }
 
 /*
diff --git a/xen/arch/x86/include/asm/hvm/io.h b/xen/arch/x86/include/asm/hvm/io.h
index d72b29f73f..f2b8431fac 100644
--- a/xen/arch/x86/include/asm/hvm/io.h
+++ b/xen/arch/x86/include/asm/hvm/io.h
@@ -56,13 +56,11 @@ typedef int (*hvm_io_write_t)(const struct hvm_io_handler *handler,
                               uint64_t data);
 typedef bool (*hvm_io_accept_t)(const struct hvm_io_handler *handler,
                                 const ioreq_t *p);
-typedef void (*hvm_io_complete_t)(const struct hvm_io_handler *handler);
 
 struct hvm_io_ops {
     hvm_io_accept_t   accept;
     hvm_io_read_t     read;
     hvm_io_write_t    write;
-    hvm_io_complete_t complete;
 };
 
 int hvm_process_io_intercept(const struct hvm_io_handler *handler,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 07:23:46 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 07:23:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797060.1206855 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soeB8-0004UN-IL; Thu, 12 Sep 2024 07:23:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797060.1206855; Thu, 12 Sep 2024 07:23:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soeB8-0004UF-Ff; Thu, 12 Sep 2024 07:23:46 +0000
Received: by outflank-mailman (input) for mailman id 797060;
 Thu, 12 Sep 2024 07:23:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soeB6-0004U4-LV
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:23:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soeB6-0006O9-K7
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:23:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soeB6-0003AB-JL
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 07:23:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7BmlZ21sjNAq8J1ZToczJyMV5SfW1V1d4/g6eWWZPPM=; b=GfVE7iAipFTVokKIMCV/9IoYKl
	MQztXaRCKGekvEQN70/guZj+ggR755GRW/HBBWS34jVU6EjMITRt3jpR5flGxA4GWxRSKemz6NMKw
	d1Qo2dISN+RRU+mIcXcDO0rvgA+/3R9q8L1jSFOx5BxD/QJ3mfkJ613EfvJlQYeSOC6s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/x86/pvh: handle ACPI RSDT table in PVH Dom0 build
Message-Id: <E1soeB6-0003AB-JL@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 07:23:44 +0000

commit 6e7f7a0c16c4d406bda6d4a900252ff63a7c5fad
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Thu Sep 12 09:18:25 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 09:18:25 2024 +0200

    xen/x86/pvh: handle ACPI RSDT table in PVH Dom0 build
    
    Xen always generates an XSDT table even if the firmware only provided an
    RSDT table.  Copy the RSDT header from the firmware table, adjusting the
    signature, for the XSDT table when not provided by the firmware.
    
    This is necessary to run Xen on QEMU.
    
    Fixes: 1d74282c455f ('x86: setup PVHv2 Dom0 ACPI tables')
    Suggested-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/dom0_build.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index f3eddb6846..3dd913bdb0 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -1078,7 +1078,16 @@ static int __init pvh_setup_acpi_xsdt(struct domain *d, paddr_t madt_addr,
         rc = -EINVAL;
         goto out;
     }
-    xsdt_paddr = rsdp->xsdt_physical_address;
+    /*
+     * Note the header is the same for both RSDT and XSDT, so it's fine to
+     * copy the native RSDT header to the Xen crafted XSDT if no native
+     * XSDT is available.
+     */
+    if ( rsdp->revision > 1 && rsdp->xsdt_physical_address )
+        xsdt_paddr = rsdp->xsdt_physical_address;
+    else
+        xsdt_paddr = rsdp->rsdt_physical_address;
+
     acpi_os_unmap_memory(rsdp, sizeof(*rsdp));
     table = acpi_os_map_memory(xsdt_paddr, sizeof(*table));
     if ( !table )
@@ -1090,6 +1099,12 @@ static int __init pvh_setup_acpi_xsdt(struct domain *d, paddr_t madt_addr,
     xsdt->header = *table;
     acpi_os_unmap_memory(table, sizeof(*table));
 
+    /*
+     * In case the header is an RSDT copy, unconditionally ensure it has
+     * an XSDT sig.
+     */
+    xsdt->header.signature[0] = 'X';
+
     /* Add the custom MADT. */
     xsdt->table_offset_entry[0] = madt_addr;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 12:11:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 12:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797392.1207329 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soifB-00039O-Ag; Thu, 12 Sep 2024 12:11:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797392.1207329; Thu, 12 Sep 2024 12:11:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soifB-00039G-87; Thu, 12 Sep 2024 12:11:05 +0000
Received: by outflank-mailman (input) for mailman id 797392;
 Thu, 12 Sep 2024 12:11:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soif9-000398-G5
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 12:11:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soif9-0003mh-Ds
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 12:11:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soif9-0001rY-CZ
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 12:11:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=msyKkTTLBNKbA4AN43OELm+BuQO5YMASyhzlSOlY3SU=; b=614ITK2LJ68bghUblIEvUb5jV1
	pkfrp/i4xKR3LOePe7ousnWUJdH7l5P7H+CMKEl0S8kZdeHKjmCM/TNyvI4gg0H8rJEq7pqEjTRz3
	VqZpp00A3b6haZPJlODSNZ8HurHVt1JEGB4y4IqGx/jGUMPJKrRDdaFCNmMr2DWj1dBo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] types: replace remaining uses of s16
Message-Id: <E1soif9-0001rY-CZ@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 12:11:03 +0000

commit 5ffe6d4a02e03838b7b910f80e6137e68b8bfcdb
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 12 14:01:42 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 14:01:42 2024 +0200

    types: replace remaining uses of s16
    
    ... and move the type itself to linux-compat.h.
    
    While doing so switch an adjacent x86 struct page_info field to bool.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/arm/arm32/livepatch.c     | 2 +-
 xen/arch/arm/arm64/livepatch.c     | 2 +-
 xen/arch/x86/include/asm/irq.h     | 4 ++--
 xen/arch/x86/include/asm/mm.h      | 4 ++--
 xen/common/grant_table.c           | 8 ++++----
 xen/drivers/passthrough/arm/smmu.c | 1 +
 xen/include/xen/linux-compat.h     | 2 +-
 xen/include/xen/types.h            | 1 -
 8 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/xen/arch/arm/arm32/livepatch.c b/xen/arch/arm/arm32/livepatch.c
index 80d2659b78..8b9777bf1f 100644
--- a/xen/arch/arm/arm32/livepatch.c
+++ b/xen/arch/arm/arm32/livepatch.c
@@ -135,7 +135,7 @@ static s32 get_addend(unsigned char type, void *dest)
         addend =  (*(u32 *)dest & 0x00000FFF);
         addend |= (*(u32 *)dest & 0x000F0000) >> 4;
         /* Addend is to sign-extend ([19:16],[11:0]). */
-        addend = (s16)addend;
+        addend = (int16_t)addend;
         break;
 
     case R_ARM_CALL:
diff --git a/xen/arch/arm/arm64/livepatch.c b/xen/arch/arm/arm64/livepatch.c
index df2cebedde..5ffcbc02a9 100644
--- a/xen/arch/arm/arm64/livepatch.c
+++ b/xen/arch/arm/arm64/livepatch.c
@@ -124,7 +124,7 @@ static int reloc_data(enum aarch64_reloc_op op, void *place, u64 val, int len)
     switch ( len )
     {
     case 16:
-        *(s16 *)place = sval;
+        *(int16_t *)place = sval;
         if ( sval < INT16_MIN || sval > UINT16_MAX )
 	        return -EOVERFLOW;
         break;
diff --git a/xen/arch/x86/include/asm/irq.h b/xen/arch/x86/include/asm/irq.h
index 5a8352a21e..d3bc768068 100644
--- a/xen/arch/x86/include/asm/irq.h
+++ b/xen/arch/x86/include/asm/irq.h
@@ -67,8 +67,8 @@ struct irq_desc;
  * the old destinations.
  */
 struct arch_irq_desc {
-        s16 vector;                  /* vector itself is only 8 bits, */
-        s16 old_vector;              /* but we use -1 for unassigned  */
+        int16_t vector;                  /* vector itself is only 8 bits, */
+        int16_t old_vector;              /* but we use -1 for unassigned  */
         /*
          * Except for high priority interrupts @cpu_mask may have bits set for
          * offline CPUs.  Consumers need to be careful to mask this down to
diff --git a/xen/arch/x86/include/asm/mm.h b/xen/arch/x86/include/asm/mm.h
index b3853ae734..6b5855e94d 100644
--- a/xen/arch/x86/include/asm/mm.h
+++ b/xen/arch/x86/include/asm/mm.h
@@ -286,8 +286,8 @@ struct page_info
         struct {
             u16 nr_validated_ptes:PAGETABLE_ORDER + 1;
             u16 :16 - PAGETABLE_ORDER - 1 - 1;
-            u16 partial_flags:1;
-            s16 linear_pt_count;
+            bool partial_flags:1;
+            int16_t linear_pt_count;
         };
 
         /*
diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index ab36f45ded..6c77867f8c 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1390,7 +1390,7 @@ unmap_common(
     struct grant_table *lgt, *rgt;
     grant_ref_t ref;
     struct active_grant_entry *act;
-    s16              rc = 0;
+    int16_t          rc;
     struct grant_mapping *map;
     unsigned int flags;
     bool put_handle = false;
@@ -2580,7 +2580,7 @@ acquire_grant_for_copy(
     uint16_t trans_page_off;
     uint16_t trans_length;
     bool is_sub_page;
-    s16 rc = GNTST_okay;
+    int16_t rc = GNTST_okay;
     unsigned int pin_incr = readonly ? GNTPIN_hstr_inc : GNTPIN_hstw_inc;
 
     *page = NULL;
@@ -3416,14 +3416,14 @@ gnttab_get_version(XEN_GUEST_HANDLE_PARAM(gnttab_get_version_t) uop)
     return 0;
 }
 
-static s16
+static int16_t
 swap_grant_ref(grant_ref_t ref_a, grant_ref_t ref_b)
 {
     struct domain *d = rcu_lock_current_domain();
     struct grant_table *gt = d->grant_table;
     struct active_grant_entry *act_a = NULL;
     struct active_grant_entry *act_b = NULL;
-    s16 rc = GNTST_okay;
+    int16_t rc = GNTST_okay;
 
     grant_write_lock(gt);
 
diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index f2cee82f55..c9e28a8509 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -43,6 +43,7 @@
 #include <xen/err.h>
 #include <xen/irq.h>
 #include <xen/lib.h>
+#include <xen/linux-compat.h>
 #include <xen/list.h>
 #include <xen/mm.h>
 #include <xen/vmap.h>
diff --git a/xen/include/xen/linux-compat.h b/xen/include/xen/linux-compat.h
index 1491894feb..9f6be512f8 100644
--- a/xen/include/xen/linux-compat.h
+++ b/xen/include/xen/linux-compat.h
@@ -13,7 +13,7 @@
 
 typedef int8_t  s8, __s8;
 typedef uint8_t __u8;
-typedef int16_t __s16;
+typedef int16_t s16, __s16;
 typedef int32_t __s32;
 typedef int64_t __s64;
 
diff --git a/xen/include/xen/types.h b/xen/include/xen/types.h
index 542dbaf63c..d7c26bdac2 100644
--- a/xen/include/xen/types.h
+++ b/xen/include/xen/types.h
@@ -6,7 +6,6 @@
 
 /* Linux inherited types which are being phased out */
 typedef uint8_t u8;
-typedef int16_t s16;
 typedef uint16_t u16, __u16;
 typedef int32_t s32;
 typedef uint32_t u32, __u32;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 12:11:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 12:11:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797394.1207334 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soifL-0003Bz-CW; Thu, 12 Sep 2024 12:11:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797394.1207334; Thu, 12 Sep 2024 12:11:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soifL-0003Br-9a; Thu, 12 Sep 2024 12:11:15 +0000
Received: by outflank-mailman (input) for mailman id 797394;
 Thu, 12 Sep 2024 12:11:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soifJ-0003BU-Jb
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 12:11:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soifJ-0003n4-IP
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 12:11:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soifJ-0001sk-GV
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 12:11:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WYUYsLpEDIw+krPpZxVUV26Ph9WtVFkqHv3802qR0Bk=; b=UZwhQkzua3qH4wrzgILBN1YHYI
	3ued7ppPduQzOfkuD8+tYubYUqiluTpEdbDXxkO2zAYOWa1NInkY20KSp3v2uQEqQfQuraVprsL1N
	JnIzwqU3DYsZ7W1GIIeZwqsQb38gNJEFhM49amIu8yTVoN9bsDyEWLmRYAsLAQ0XrwIA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] types: replace remaining uses of s32
Message-Id: <E1soifJ-0001sk-GV@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 12:11:13 +0000

commit eb97f879191406768dd772a20f94cd6dc44ef076
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 12 14:03:50 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 14:03:50 2024 +0200

    types: replace remaining uses of s32
    
    ... and move the type itself to linux-compat.h.
    
    While doing so switch a few adjacent types as well, for (a little bit
    of) consistency.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/arm/alternative.c             |  2 +-
 xen/arch/arm/arm32/livepatch.c         | 21 +++++++++++----------
 xen/arch/arm/arm64/insn.c              |  6 +++---
 xen/arch/arm/arm64/livepatch.c         |  2 +-
 xen/arch/arm/include/asm/alternative.h | 10 +++++-----
 xen/arch/arm/include/asm/arm64/insn.h  |  8 ++++----
 xen/arch/x86/efi/efi-boot.h            |  6 +++---
 xen/arch/x86/include/asm/uaccess.h     |  2 +-
 xen/arch/x86/time.c                    |  4 ++--
 xen/common/trace.c                     |  8 ++++----
 xen/include/acpi/actypes.h             |  4 ++--
 xen/include/xen/linux-compat.h         |  2 +-
 xen/include/xen/types.h                |  1 -
 13 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/xen/arch/arm/alternative.c b/xen/arch/arm/alternative.c
index 016e66978b..c56caba010 100644
--- a/xen/arch/arm/alternative.c
+++ b/xen/arch/arm/alternative.c
@@ -63,7 +63,7 @@ static u32 get_alt_insn(const struct alt_instr *alt,
 
     if ( insn_is_branch_imm(insn) )
     {
-        s32 offset = insn_get_branch_offset(insn);
+        int32_t offset = insn_get_branch_offset(insn);
         unsigned long target;
 
         target = (unsigned long)altinsnptr + offset;
diff --git a/xen/arch/arm/arm32/livepatch.c b/xen/arch/arm/arm32/livepatch.c
index 8b9777bf1f..d500665646 100644
--- a/xen/arch/arm/arm32/livepatch.c
+++ b/xen/arch/arm/arm32/livepatch.c
@@ -32,7 +32,7 @@ void arch_livepatch_apply(const struct livepatch_func *func,
 
     if ( func->new_addr )
     {
-        s32 delta;
+        int32_t delta;
 
         /*
          * PC is current address (old_addr) + 8 bytes. The semantics for a
@@ -41,11 +41,11 @@ void arch_livepatch_apply(const struct livepatch_func *func,
          * ARM DDI 0406C.c, see A2.3 (pg 45) and A8.8.18 pg (pg 334,335)
          *
          */
-        delta = (s32)func->new_addr - (s32)(func->old_addr + 8);
+        delta = (int32_t)func->new_addr - (int32_t)(func->old_addr + 8);
 
         /* The arch_livepatch_symbol_ok should have caught it. */
-        ASSERT(delta >= -(s32)ARCH_LIVEPATCH_RANGE ||
-               delta < (s32)ARCH_LIVEPATCH_RANGE);
+        ASSERT(delta >= -(int32_t)ARCH_LIVEPATCH_RANGE ||
+               delta <   (int32_t)ARCH_LIVEPATCH_RANGE);
 
         /* CPU shifts by two (left) when decoding, so we shift right by two. */
         delta = delta >> 2;
@@ -113,9 +113,9 @@ bool arch_livepatch_symbol_deny(const struct livepatch_elf *elf,
     return false;
 }
 
-static s32 get_addend(unsigned char type, void *dest)
+static int32_t get_addend(unsigned char type, void *dest)
 {
-    s32 addend = 0;
+    int32_t addend = 0;
 
     switch ( type ) {
     case R_ARM_NONE:
@@ -149,7 +149,8 @@ static s32 get_addend(unsigned char type, void *dest)
     return addend;
 }
 
-static int perform_rel(unsigned char type, void *dest, uint32_t val, s32 addend)
+static int perform_rel(unsigned char type, void *dest, uint32_t val,
+                       int32_t addend)
 {
 
     switch ( type ) {
@@ -203,8 +204,8 @@ static int perform_rel(unsigned char type, void *dest, uint32_t val, s32 addend)
          * arch_livepatch_verify_distance can't account of addend so we have
          * to do the check here as well.
          */
-        if ( (s32)val < -(s32)ARCH_LIVEPATCH_RANGE ||
-             (s32)val >= (s32)ARCH_LIVEPATCH_RANGE )
+        if ( (int32_t)val < -(int32_t)ARCH_LIVEPATCH_RANGE ||
+             (int32_t)val >= (int32_t)ARCH_LIVEPATCH_RANGE )
             return -EOVERFLOW;
 
         /* CPU always shifts insn by two, so complement it. */
@@ -234,7 +235,7 @@ int arch_livepatch_perform(struct livepatch_elf *elf,
         uint32_t val;
         void *dest;
         unsigned char type;
-        s32 addend;
+        int32_t addend;
 
         if ( use_rela )
         {
diff --git a/xen/arch/arm/arm64/insn.c b/xen/arch/arm/arm64/insn.c
index 773c3749d1..81f7914610 100644
--- a/xen/arch/arm/arm64/insn.c
+++ b/xen/arch/arm/arm64/insn.c
@@ -223,9 +223,9 @@ u32 __kprobes aarch64_insn_gen_nop(void)
  * signed value (so it can be used when computing a new branch
  * target).
  */
-s32 aarch64_get_branch_offset(u32 insn)
+int32_t aarch64_get_branch_offset(uint32_t insn)
 {
-	s32 imm;
+	int32_t imm;
 
 	if (aarch64_insn_is_b(insn) || aarch64_insn_is_bl(insn)) {
 		imm = aarch64_insn_decode_immediate(AARCH64_INSN_IMM_26, insn);
@@ -251,7 +251,7 @@ s32 aarch64_get_branch_offset(u32 insn)
  * Encode the displacement of a branch in the imm field and return the
  * updated instruction.
  */
-u32 aarch64_set_branch_offset(u32 insn, s32 offset)
+uint32_t aarch64_set_branch_offset(uint32_t insn, int32_t offset)
 {
 	if (aarch64_insn_is_b(insn) || aarch64_insn_is_bl(insn))
 		return aarch64_insn_encode_immediate(AARCH64_INSN_IMM_26, insn,
diff --git a/xen/arch/arm/arm64/livepatch.c b/xen/arch/arm/arm64/livepatch.c
index 5ffcbc02a9..dfb72be44f 100644
--- a/xen/arch/arm/arm64/livepatch.c
+++ b/xen/arch/arm/arm64/livepatch.c
@@ -130,7 +130,7 @@ static int reloc_data(enum aarch64_reloc_op op, void *place, u64 val, int len)
         break;
 
     case 32:
-        *(s32 *)place = sval;
+        *(int32_t *)place = sval;
         if ( sval < INT32_MIN || sval > UINT32_MAX )
 	        return -EOVERFLOW;
         break;
diff --git a/xen/arch/arm/include/asm/alternative.h b/xen/arch/arm/include/asm/alternative.h
index c7632668b6..22477d9497 100644
--- a/xen/arch/arm/include/asm/alternative.h
+++ b/xen/arch/arm/include/asm/alternative.h
@@ -12,11 +12,11 @@
 #include <xen/stringify.h>
 
 struct alt_instr {
-	s32 orig_offset;	/* offset to original instruction */
-	s32 repl_offset;	/* offset to replacement instruction */
-	u16 cpufeature;		/* cpufeature bit set for replacement */
-	u8  orig_len;		/* size of original instruction(s) */
-	u8  repl_len;		/* size of new instruction(s), <= orig_len */
+	int32_t  orig_offset;	/* offset to original instruction */
+	int32_t  repl_offset;	/* offset to replacement instruction */
+	uint16_t cpufeature;	/* cpufeature bit set for replacement */
+	uint8_t  orig_len;	/* size of original instruction(s) */
+	uint8_t  repl_len;	/* size of new instruction(s), <= orig_len */
 };
 
 /* Xen: helpers used by common code. */
diff --git a/xen/arch/arm/include/asm/arm64/insn.h b/xen/arch/arm/include/asm/arm64/insn.h
index 6308959449..ab290030ab 100644
--- a/xen/arch/arm/include/asm/arm64/insn.h
+++ b/xen/arch/arm/include/asm/arm64/insn.h
@@ -75,8 +75,8 @@ u64 aarch64_insn_decode_immediate(enum aarch64_insn_imm_type type, u32 insn);
 u32 aarch64_insn_encode_immediate(enum aarch64_insn_imm_type type,
 				  u32 insn, u64 imm);
 
-s32 aarch64_get_branch_offset(u32 insn);
-u32 aarch64_set_branch_offset(u32 insn, s32 offset);
+int32_t aarch64_get_branch_offset(uint32_t insn);
+uint32_t aarch64_set_branch_offset(uint32_t insn, int32_t offset);
 
 u32 aarch64_insn_gen_branch_imm(unsigned long pc, unsigned long addr,
 				enum aarch64_insn_branch_type type);
@@ -89,12 +89,12 @@ static inline bool insn_is_branch_imm(u32 insn)
     return aarch64_insn_is_branch_imm(insn);
 }
 
-static inline s32 insn_get_branch_offset(u32 insn)
+static inline int32_t insn_get_branch_offset(uint32_t insn)
 {
     return aarch64_get_branch_offset(insn);
 }
 
-static inline u32 insn_set_branch_offset(u32 insn, s32 offset)
+static inline uint32_t insn_set_branch_offset(uint32_t insn, int32_t offset)
 {
     return aarch64_set_branch_offset(insn, offset);
 }
diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index 23e510c77e..7aa55e7aaf 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -102,12 +102,12 @@ static void __init efi_arch_relocate_image(unsigned long delta)
     }
 }
 
-extern const s32 __trampoline_rel_start[], __trampoline_rel_stop[];
-extern const s32 __trampoline_seg_start[], __trampoline_seg_stop[];
+extern const int32_t __trampoline_rel_start[], __trampoline_rel_stop[];
+extern const int32_t __trampoline_seg_start[], __trampoline_seg_stop[];
 
 static void __init relocate_trampoline(unsigned long phys)
 {
-    const s32 *trampoline_ptr;
+    const int32_t *trampoline_ptr;
 
     trampoline_phys = phys;
 
diff --git a/xen/arch/x86/include/asm/uaccess.h b/xen/arch/x86/include/asm/uaccess.h
index 48b684c19d..395dc42795 100644
--- a/xen/arch/x86/include/asm/uaccess.h
+++ b/xen/arch/x86/include/asm/uaccess.h
@@ -406,7 +406,7 @@ copy_from_unsafe(void *to, const void __user *from, unsigned int n)
 
 struct exception_table_entry
 {
-	s32 addr, cont;
+	int32_t addr, cont;
 };
 extern struct exception_table_entry __start___ex_table[];
 extern struct exception_table_entry __stop___ex_table[];
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 9588502f28..29b026735e 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1945,8 +1945,8 @@ static void cf_check local_time_calibration(void)
      * This allows us to binary shift a 32-bit tsc_elapsed such that:
      * stime_elapsed < tsc_elapsed <= 2*stime_elapsed
      */
-    while ( ((u32)stime_elapsed64 != stime_elapsed64) ||
-            ((s32)stime_elapsed64 < 0) )
+    while ( ((uint32_t)stime_elapsed64 != stime_elapsed64) ||
+            ((int32_t)stime_elapsed64 < 0) )
     {
         stime_elapsed64 >>= 1;
         tsc_elapsed64   >>= 1;
diff --git a/xen/common/trace.c b/xen/common/trace.c
index c33f115b6c..704edef39f 100644
--- a/xen/common/trace.c
+++ b/xen/common/trace.c
@@ -459,8 +459,8 @@ static inline bool bogus(u32 prod, u32 cons)
 
 static inline u32 calc_unconsumed_bytes(const struct t_buf *buf)
 {
-    u32 prod = buf->prod, cons = buf->cons;
-    s32 x;
+    uint32_t prod = buf->prod, cons = buf->cons;
+    int32_t x;
 
     barrier(); /* must read buf->prod and buf->cons only once */
     if ( bogus(prod, cons) )
@@ -478,8 +478,8 @@ static inline u32 calc_unconsumed_bytes(const struct t_buf *buf)
 
 static inline u32 calc_bytes_to_wrap(const struct t_buf *buf)
 {
-    u32 prod = buf->prod, cons = buf->cons;
-    s32 x;
+    uint32_t prod = buf->prod, cons = buf->cons;
+    int32_t x;
 
     barrier(); /* must read buf->prod and buf->cons only once */
     if ( bogus(prod, cons) )
diff --git a/xen/include/acpi/actypes.h b/xen/include/acpi/actypes.h
index 7023863d03..49e0ab9bb4 100644
--- a/xen/include/acpi/actypes.h
+++ b/xen/include/acpi/actypes.h
@@ -186,8 +186,8 @@ typedef int INT32;
 
 /*! [End] no source code translation !*/
 
-typedef u32 acpi_native_uint;
-typedef s32 acpi_native_int;
+typedef uint32_t acpi_native_uint;
+typedef int32_t acpi_native_int;
 
 typedef u32 acpi_io_address;
 typedef u32 acpi_physical_address;
diff --git a/xen/include/xen/linux-compat.h b/xen/include/xen/linux-compat.h
index 9f6be512f8..1f4186102a 100644
--- a/xen/include/xen/linux-compat.h
+++ b/xen/include/xen/linux-compat.h
@@ -14,7 +14,7 @@
 typedef int8_t  s8, __s8;
 typedef uint8_t __u8;
 typedef int16_t s16, __s16;
-typedef int32_t __s32;
+typedef int32_t s32, __s32;
 typedef int64_t __s64;
 
 typedef paddr_t phys_addr_t;
diff --git a/xen/include/xen/types.h b/xen/include/xen/types.h
index d7c26bdac2..1bcc5a474f 100644
--- a/xen/include/xen/types.h
+++ b/xen/include/xen/types.h
@@ -7,7 +7,6 @@
 /* Linux inherited types which are being phased out */
 typedef uint8_t u8;
 typedef uint16_t u16, __u16;
-typedef int32_t s32;
 typedef uint32_t u32, __u32;
 typedef int64_t s64;
 typedef uint64_t u64, __u64;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 12:11:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 12:11:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797395.1207337 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soifU-0003FK-DS; Thu, 12 Sep 2024 12:11:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797395.1207337; Thu, 12 Sep 2024 12:11:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soifU-0003FC-Aw; Thu, 12 Sep 2024 12:11:24 +0000
Received: by outflank-mailman (input) for mailman id 797395;
 Thu, 12 Sep 2024 12:11:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soifT-0003Et-MA
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 12:11:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soifT-0003nN-LM
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 12:11:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soifT-0001vo-KZ
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 12:11:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LbNOfSVp8ramJ0rgJuFN7R56UmaVtEVu2hyelSt1O74=; b=aog5AuvcI6B63h40bUgWvoc0Ta
	lPvfywl5jLaV5xhSn5nTGtEACES0LzPJ1k0mtCc5d5ANwm6tVxdxGPsh0zC9NSPZFr1vEtSjpIGQn
	zpud1oDwMuEwP9jMUNb4k4hNDcLeWrrrQp8lmOsYmkY/AcvD1v63mEhEiEUmTuh+54pk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] blkif: reconcile protocol specification with in-use implementations
Message-Id: <E1soifT-0001vo-KZ@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 12:11:23 +0000

commit 221f2748e8dabe8361b8cdfcffbeab9102c4c899
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Sep 12 14:04:56 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 14:04:56 2024 +0200

    blkif: reconcile protocol specification with in-use implementations
    
    Current blkif implementations (both backends and frontends) have all slight
    differences about how they handle the 'sector-size' xenstore node, and how
    other fields are derived from this value or hardcoded to be expressed in units
    of 512 bytes.
    
    To give some context, this is an excerpt of how different implementations use
    the value in 'sector-size' as the base unit for to other fields rather than
    just to set the logical sector size of the block device:
    
                            │ sectors xenbus node │ requests sector_number │ requests {first,last}_sect
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    FreeBSD blk{front,back} │     sector-size     │      sector-size       │           512
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    Linux blk{front,back}   │         512         │          512           │           512
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    QEMU blkback            │     sector-size     │      sector-size       │       sector-size
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    Windows blkfront        │     sector-size     │      sector-size       │       sector-size
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    MiniOS                  │     sector-size     │          512           │           512
    
    An attempt was made by 67e1c050e36b in order to change the base units of the
    request fields and the xenstore 'sectors' node.  That however only lead to more
    confusion, as the specification now clearly diverged from the reference
    implementation in Linux.  Such change was only implemented for QEMU Qdisk
    and Windows PV blkfront.
    
    Partially revert to the state before 67e1c050e36b while adjusting the
    documentation for 'sectors' to match what it used to be previous to
    2fa701e5346d:
    
     * Declare 'feature-large-sector-size' deprecated.  Frontends should not expose
       the node, backends should not make decisions based on its presence.
    
     * Clarify that 'sectors' xenstore node and the requests fields are always in
       512-byte units, like it was previous to 2fa701e5346d and 67e1c050e36b.
    
    All base units for the fields used in the protocol are 512-byte based, the
    xenbus 'sector-size' field is only used to signal the logic block size.  When
    'sector-size' is greater than 512, blkfront implementations must make sure that
    the offsets and sizes (despite being expressed in 512-byte units) are aligned
    to the logical block size specified in 'sector-size', otherwise the backend
    will fail to process the requests.
    
    This will require changes to some of the frontends and backends in order to
    properly support 'sector-size' nodes greater than 512.
    
    Fixes: 2fa701e5346d ('blkif.h: Provide more complete documentation of the blkif interface')
    Fixes: 67e1c050e36b ('public/io/blkif.h: try to fix the semantics of sector based quantities')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 xen/include/public/io/blkif.h | 52 ++++++++++++++++++++++++++++++++-----------
 1 file changed, 39 insertions(+), 13 deletions(-)

diff --git a/xen/include/public/io/blkif.h b/xen/include/public/io/blkif.h
index 22f1eef0c0..9b00d633d3 100644
--- a/xen/include/public/io/blkif.h
+++ b/xen/include/public/io/blkif.h
@@ -237,12 +237,16 @@
  * sector-size
  *      Values:         <uint32_t>
  *
- *      The logical block size, in bytes, of the underlying storage. This
- *      must be a power of two with a minimum value of 512.
+ *      The logical block size, in bytes, of the underlying storage. This must
+ *      be a power of two with a minimum value of 512.  The sector size should
+ *      only be used for request segment length and alignment.
  *
- *      NOTE: Because of implementation bugs in some frontends this must be
- *            set to 512, unless the frontend advertizes a non-zero value
- *            in its "feature-large-sector-size" xenbus node. (See below).
+ *      When exposing a device that uses a logical sector size of 4096, the
+ *      only difference xenstore wise will be that 'sector-size' (and possibly
+ *      'physical-sector-size' if supported by the backend) will be 4096, but
+ *      the 'sectors' node will still be calculated using 512 byte units.  The
+ *      sector base units in the ring requests fields will all be 512 byte
+ *      based despite the logical sector size exposed in 'sector-size'.
  *
  * physical-sector-size
  *      Values:         <uint32_t>
@@ -254,9 +258,9 @@
  * sectors
  *      Values:         <uint64_t>
  *
- *      The size of the backend device, expressed in units of "sector-size".
- *      The product of "sector-size" and "sectors" must also be an integer
- *      multiple of "physical-sector-size", if that node is present.
+ *      The size of the backend device, expressed in units of 512b.  The
+ *      product of "sectors" * 512 must also be an integer multiple of
+ *      "physical-sector-size", if that node is present.
  *
  *****************************************************************************
  *                            Frontend XenBus Nodes
@@ -338,6 +342,7 @@
  * feature-large-sector-size
  *      Values:         0/1 (boolean)
  *      Default Value:  0
+ *      Notes:          DEPRECATED, 12
  *
  *      A value of "1" indicates that the frontend will correctly supply and
  *      interpret all sector-based quantities in terms of the "sector-size"
@@ -411,6 +416,11 @@
  *(10) The discard-secure property may be present and will be set to 1 if the
  *     backing device supports secure discard.
  *(11) Only used by Linux and NetBSD.
+ *(12) Possibly only ever implemented by the QEMU Qdisk backend and the Windows
+ *     PV block frontend.  Other backends and frontends supported 'sector-size'
+ *     values greater than 512 before such feature was added.  Frontends should
+ *     not expose this node, neither should backends make any decisions based
+ *     on it being exposed by the frontend.
  */
 
 /*
@@ -619,11 +629,14 @@
 #define BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST 8
 
 /*
- * NB. 'first_sect' and 'last_sect' in blkif_request_segment, as well as
- * 'sector_number' in blkif_request, blkif_request_discard and
- * blkif_request_indirect are sector-based quantities. See the description
- * of the "feature-large-sector-size" frontend xenbus node above for
- * more information.
+ * NB. 'first_sect' and 'last_sect' in blkif_request_segment are all in units
+ * of 512 bytes, despite the 'sector-size' xenstore node possibly having a
+ * value greater than 512.
+ *
+ * The value in 'first_sect' and 'last_sect' fields must be setup so that the
+ * resulting segment offset and size is aligned to the logical sector size
+ * reported by the 'sector-size' xenstore node, see 'Backend Device Properties'
+ * section.
  */
 struct blkif_request_segment {
     grant_ref_t gref;        /* reference to I/O buffer frame        */
@@ -634,6 +647,10 @@ struct blkif_request_segment {
 
 /*
  * Starting ring element for any I/O request.
+ *
+ * The 'sector_number' field is in units of 512b, despite the value of the
+ * 'sector-size' xenstore node.  Note however that the offset in
+ * 'sector_number' must be aligned to 'sector-size'.
  */
 struct blkif_request {
     uint8_t        operation;    /* BLKIF_OP_???                         */
@@ -648,6 +665,10 @@ typedef struct blkif_request blkif_request_t;
 /*
  * Cast to this structure when blkif_request.operation == BLKIF_OP_DISCARD
  * sizeof(struct blkif_request_discard) <= sizeof(struct blkif_request)
+ *
+ * The 'sector_number' field is in units of 512b, despite the value of the
+ * 'sector-size' xenstore node.  Note however that the offset in
+ * 'sector_number' must be aligned to 'sector-size'.
  */
 struct blkif_request_discard {
     uint8_t        operation;    /* BLKIF_OP_DISCARD                     */
@@ -660,6 +681,11 @@ struct blkif_request_discard {
 };
 typedef struct blkif_request_discard blkif_request_discard_t;
 
+/*
+ * The 'sector_number' field is in units of 512b, despite the value of the
+ * 'sector-size' xenstore node.  Note however that the offset in
+ * 'sector_number' must be aligned to 'sector-size'.
+ */
 struct blkif_request_indirect {
     uint8_t        operation;    /* BLKIF_OP_INDIRECT                    */
     uint8_t        indirect_op;  /* BLKIF_OP_{READ/WRITE}                */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 15:55:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 15:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797677.1207701 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1som9x-0004d8-Pr; Thu, 12 Sep 2024 15:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797677.1207701; Thu, 12 Sep 2024 15:55:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1som9x-0004d1-NR; Thu, 12 Sep 2024 15:55:05 +0000
Received: by outflank-mailman (input) for mailman id 797677;
 Thu, 12 Sep 2024 15:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1som9w-0004ct-Au
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 15:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1som9w-0007qd-6D
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 15:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1som9w-0000Tn-42
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 15:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Pl+4TjbFs5VLcit1raW3H7Uf0PWWqU6eP6D1bqL/dqw=; b=TK78oXe+40aSdauL8L6nOf5Tgk
	WxreRmoIl4mnJUKFywX2qoZEppXKnckHo0k6sIsRUZn8jlODiBAsVGsmIblWNBTrEVcZZFYcEKxBy
	J4BoM0reB9ZmBdb/tzEq/mmCpJrAspAvCkh38eiSOOjERD5JFV2y2LfuUXErwimKuCXU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/mm: undo type change of partial_flags
Message-Id: <E1som9w-0000Tn-42@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 15:55:04 +0000

commit ec185ec23938d2b932198a7eca2e06e3dc2601f5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 12 17:52:27 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 17:52:27 2024 +0200

    x86/mm: undo type change of partial_flags
    
    Clang dislikes the boolean type combined with the field being set using
    PTF_partial_set.
    
    Fixes: 5ffe6d4a02e0 ("types: replace remaining uses of s16")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/include/asm/mm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/include/asm/mm.h b/xen/arch/x86/include/asm/mm.h
index 6b5855e94d..2a837f3d59 100644
--- a/xen/arch/x86/include/asm/mm.h
+++ b/xen/arch/x86/include/asm/mm.h
@@ -286,7 +286,7 @@ struct page_info
         struct {
             u16 nr_validated_ptes:PAGETABLE_ORDER + 1;
             u16 :16 - PAGETABLE_ORDER - 1 - 1;
-            bool partial_flags:1;
+            uint16_t partial_flags:1;
             int16_t linear_pt_count;
         };
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 16:11:06 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 16:11:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797703.1207734 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somPO-0001LH-Lp; Thu, 12 Sep 2024 16:11:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797703.1207734; Thu, 12 Sep 2024 16:11:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somPO-0001LA-JO; Thu, 12 Sep 2024 16:11:02 +0000
Received: by outflank-mailman (input) for mailman id 797703;
 Thu, 12 Sep 2024 16:11:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somPN-0001L4-S9
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somPN-0000HL-Qp
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somPN-0002Np-OR
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ro2YWP3L6tsw7MWh8sD4VuwSiDD5YCCMdOv5fPaBWMs=; b=dlls05MmNkwJhetxABn+MVSkS4
	vIuT3Vc0Yq3ABCfcWpRoFIxDhFPiNmgUaEamaxsPoaZD9xaDUYqymIoPv9+AQ84YVGnHjSD6dsIvs
	PAiuvj5lLFrftHEIFhQo2+O7Vq6K3LHVfdyOKZLkChUSE6zsnG9qrNz5Y591W9wopyKE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arm/gicv3: Fix ICH_VTR_EL2.ListRegs mask
Message-Id: <E1somPN-0002Np-OR@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 16:11:01 +0000

commit 3502c033f6d60e5fc944e66d7bd1c3c6456caae7
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Sep 3 14:21:47 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Sep 11 10:59:42 2024 +0100

    arm/gicv3: Fix ICH_VTR_EL2.ListRegs mask
    
    According to GIC spec IHI 0069H.b (12.4.9), the ListRegs field of
    ICH_VTR_EL2 can have value between 0b00000..0b01111, as there can
    be maximum 16 LRs (field value + 1). Fix the mask used to extract this
    value which wrongly assumes there can be 64 (case for GICv2).
    
    Fixes: bc183a0235e0 ("xen/arm: Add support for GIC v3")
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/include/asm/gic_v3_defs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/include/asm/gic_v3_defs.h b/xen/arch/arm/include/asm/gic_v3_defs.h
index 227533868f..2af093e774 100644
--- a/xen/arch/arm/include/asm/gic_v3_defs.h
+++ b/xen/arch/arm/include/asm/gic_v3_defs.h
@@ -189,7 +189,7 @@
 #define ICH_LR_GRP1                  (1ULL << 60)
 #define ICH_LR_HW                    (1ULL << 61)
 
-#define ICH_VTR_NRLRGS               0x3f
+#define ICH_VTR_NRLRGS               0xf
 #define ICH_VTR_PRIBITS_MASK         0x7
 #define ICH_VTR_PRIBITS_SHIFT        29
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 16:11:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 16:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797704.1207739 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somPY-0001NR-NQ; Thu, 12 Sep 2024 16:11:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797704.1207739; Thu, 12 Sep 2024 16:11:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somPY-0001NJ-Kr; Thu, 12 Sep 2024 16:11:12 +0000
Received: by outflank-mailman (input) for mailman id 797704;
 Thu, 12 Sep 2024 16:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somPX-0001ND-V3
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:11:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somPX-0000Hq-UI
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somPX-0002P5-TB
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:11:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6I3K+DQtnjv/H+gAsVYyoMDKRtw6uNfptjhXjPoHJJI=; b=zWrGnch3AVP6OjRXmFfnkf9MNG
	nj8lX+YaoXFbayq/LHq0Z3RpN7k2w2JR2wGIkX8vBg2mp8NK2K9FklM7af6MAgtbhtbnsO52cR6Vq
	G47aaqjgwH6Pz5IbzOwss/ZUHc9OD3162dE+YkkrlNy4ePWNmiec8QT+xiqlZ5Xa2Jio=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mm address violations of MISRA C:2012 Rule 5.3
Message-Id: <E1somPX-0002P5-TB@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 16:11:11 +0000

commit 5b4664b9e4108ebf57c666662b675601d758a512
Author:     Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
AuthorDate: Wed Sep 11 12:52:15 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 11 12:52:15 2024 +0200

    x86/mm address violations of MISRA C:2012 Rule 5.3
    
    This addresses violations of MISRA C:2012 Rule 5.3 which states as
    following: An identifier declared in an inner scope shall not hide an
    identifier declared in an outer scope.
    
    In /x86/mm.c the object struct e820entry *e820 hides an identifier
    with the same name declared in x86/include/asm/e820.h.
    
    No functional change.
    
    Signed-off-by: Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index c735aaf0e8..d537a799bc 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -4708,7 +4708,7 @@ long arch_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
     {
         struct xen_foreign_memory_map fmap;
         struct domain *d;
-        struct e820entry *e820;
+        struct e820entry *e;
 
         if ( copy_from_guest(&fmap, arg, 1) )
             return -EFAULT;
@@ -4727,23 +4727,23 @@ long arch_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
             return rc;
         }
 
-        e820 = xmalloc_array(e820entry_t, fmap.map.nr_entries);
-        if ( e820 == NULL )
+        e = xmalloc_array(e820entry_t, fmap.map.nr_entries);
+        if ( e == NULL )
         {
             rcu_unlock_domain(d);
             return -ENOMEM;
         }
 
-        if ( copy_from_guest(e820, fmap.map.buffer, fmap.map.nr_entries) )
+        if ( copy_from_guest(e, fmap.map.buffer, fmap.map.nr_entries) )
         {
-            xfree(e820);
+            xfree(e);
             rcu_unlock_domain(d);
             return -EFAULT;
         }
 
         spin_lock(&d->arch.e820_lock);
         xfree(d->arch.e820);
-        d->arch.e820 = e820;
+        d->arch.e820 = e;
         d->arch.nr_e820 = fmap.map.nr_entries;
         spin_unlock(&d->arch.e820_lock);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 16:11:22 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 16:11:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797705.1207743 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somPi-0001Q0-Op; Thu, 12 Sep 2024 16:11:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797705.1207743; Thu, 12 Sep 2024 16:11:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somPi-0001Ps-MI; Thu, 12 Sep 2024 16:11:22 +0000
Received: by outflank-mailman (input) for mailman id 797705;
 Thu, 12 Sep 2024 16:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somPi-0001Pi-1e
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somPi-0000I5-0v
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somPi-0002QF-07
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Fx9/5/J1KDuGvqgcQbLCRYz9shyG3tu02Dur9B0u0S0=; b=ZbM8pk1OVsphiQIYR3XHyTJB4Q
	JIkXSIDybFH/HEwYmatDZkiydzpqEEnkUeXQZsNMn8cmgBFkL2huPAGHbDtyMDQ9cVupR1OwRI1s0
	3ZL+jsXyoZNGGMnzaZIZyc6TRRDAlLmM3Q3L/iws66Eb1C4+YPgEFLCKIOQym2z+slmk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/time: pull cmos_rtc_probe outside of function and rename
Message-Id: <E1somPi-0002QF-07@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 16:11:22 +0000

commit 6da090b4b7b913887d0079dff9e18a1abaebcd13
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Sep 11 12:52:57 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 11 12:52:57 2024 +0200

    x86/time: pull cmos_rtc_probe outside of function and rename
    
    Rename cmos_rtc_probe to opt_cmos_rtc_probe in order to better describe it
    being a command line option, and rename cmos_probe() function to
    cmos_rtc_probe().
    
    Also move opt_cmos_rtc_probe to being a static global variable in preparation
    for further changes that will require the variable being global to the file.
    
    No functional change intended.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/time.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index f37300946e..ec48805a22 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1291,7 +1291,10 @@ static bool __get_cmos_time(struct rtc_time *rtc)
     return t1 <= SECONDS(1) && t2 < MILLISECS(3);
 }
 
-static bool cmos_probe(struct rtc_time *rtc_p, bool cmos_rtc_probe)
+static bool __read_mostly opt_cmos_rtc_probe;
+boolean_param("cmos-rtc-probe", opt_cmos_rtc_probe);
+
+static bool cmos_rtc_probe(struct rtc_time *rtc_p)
 {
     unsigned int seconds = 60;
 
@@ -1300,7 +1303,7 @@ static bool cmos_probe(struct rtc_time *rtc_p, bool cmos_rtc_probe)
         bool success = __get_cmos_time(rtc_p);
         struct rtc_time rtc = *rtc_p;
 
-        if ( likely(!cmos_rtc_probe) )
+        if ( likely(!opt_cmos_rtc_probe) )
             return true;
 
         if ( !success ||
@@ -1332,8 +1335,6 @@ static unsigned long get_cmos_time(void)
 {
     unsigned long res;
     struct rtc_time rtc;
-    static bool __read_mostly cmos_rtc_probe;
-    boolean_param("cmos-rtc-probe", cmos_rtc_probe);
 
     if ( efi_enabled(EFI_RS) )
     {
@@ -1343,12 +1344,12 @@ static unsigned long get_cmos_time(void)
     }
 
     if ( likely(!(acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_CMOS_RTC)) )
-        cmos_rtc_probe = false;
-    else if ( system_state < SYS_STATE_smp_boot && !cmos_rtc_probe )
+        opt_cmos_rtc_probe = false;
+    else if ( system_state < SYS_STATE_smp_boot && !opt_cmos_rtc_probe )
         panic("System with no CMOS RTC advertised must be booted from EFI"
               " (or with command line option \"cmos-rtc-probe\")\n");
 
-    if ( !cmos_probe(&rtc, cmos_rtc_probe) )
+    if ( !cmos_rtc_probe(&rtc) )
         panic("No CMOS RTC found - system must be booted from EFI\n");
 
     return mktime(rtc.year, rtc.mon, rtc.day, rtc.hour, rtc.min, rtc.sec);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 16:11:32 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 16:11:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797707.1207748 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somPs-0001Sd-Qr; Thu, 12 Sep 2024 16:11:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797707.1207748; Thu, 12 Sep 2024 16:11:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somPs-0001SV-Nh; Thu, 12 Sep 2024 16:11:32 +0000
Received: by outflank-mailman (input) for mailman id 797707;
 Thu, 12 Sep 2024 16:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somPs-0001SP-4d
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somPs-0000IF-3u
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somPs-0002TF-36
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=W3Pj4PIzJXY4wW0jxeIMwmQFxBuWlC8E9KIEOt8+YU0=; b=WIO6QxISnsGEqa3n2tLBnVTyaV
	8Ki8U/WJJJdmCMd08+QdizF/Q/WgTeQg7G0npA0ioN9m6KMA7Mn/fpMp4ZYZL9bYVY3SiiCnY+DIe
	PVyRgY63ZGuDA5Wq2J8xkZADWe1eTPA1N8v7d3s+KzO6LwmazxSj9U7yXHJZCWA3r4bo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/time: introduce probing logic for the wallclock
Message-Id: <E1somPs-0002TF-36@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 16:11:32 +0000

commit cb4f22884e77c6bcfaa5f4be984b62106ea7c0d4
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Sep 11 12:53:17 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 11 12:53:17 2024 +0200

    x86/time: introduce probing logic for the wallclock
    
    Adding such probing allows to clearly separate init vs runtime code, and to
    place the probing logic into the init section for the CMOS case.  Note both
    the Xen shared_info page wallclock, and the EFI wallclock don't really have any
    probing-specific logic.  The shared_info wallclock will always be there if
    booted as a Xen guest, while the EFI_GET_TIME method probing relies on checking
    if it returns a value different than 0.
    
    The panic message printed when Xen is unable to find a viable wallclock source
    has been adjusted slightly, I believe the printed guidance still provides the
    same amount of information to the user.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/time.c | 118 ++++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 92 insertions(+), 26 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index ec48805a22..1dcbd9f520 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1291,20 +1291,23 @@ static bool __get_cmos_time(struct rtc_time *rtc)
     return t1 <= SECONDS(1) && t2 < MILLISECS(3);
 }
 
-static bool __read_mostly opt_cmos_rtc_probe;
+static bool __initdata opt_cmos_rtc_probe;
 boolean_param("cmos-rtc-probe", opt_cmos_rtc_probe);
 
-static bool cmos_rtc_probe(struct rtc_time *rtc_p)
+static bool __init cmos_rtc_probe(void)
 {
     unsigned int seconds = 60;
 
+    if ( !(acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_CMOS_RTC) )
+        return true;
+
+    if ( !opt_cmos_rtc_probe )
+        return false;
+
     for ( ; ; )
     {
-        bool success = __get_cmos_time(rtc_p);
-        struct rtc_time rtc = *rtc_p;
-
-        if ( likely(!opt_cmos_rtc_probe) )
-            return true;
+        struct rtc_time rtc;
+        bool success = __get_cmos_time(&rtc);
 
         if ( !success ||
              rtc.sec >= 60 || rtc.min >= 60 || rtc.hour >= 24 ||
@@ -1331,26 +1334,12 @@ static bool cmos_rtc_probe(struct rtc_time *rtc_p)
     return false;
 }
 
-static unsigned long get_cmos_time(void)
+
+static unsigned long cmos_rtc_read(void)
 {
-    unsigned long res;
     struct rtc_time rtc;
 
-    if ( efi_enabled(EFI_RS) )
-    {
-        res = efi_get_time();
-        if ( res )
-            return res;
-    }
-
-    if ( likely(!(acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_CMOS_RTC)) )
-        opt_cmos_rtc_probe = false;
-    else if ( system_state < SYS_STATE_smp_boot && !opt_cmos_rtc_probe )
-        panic("System with no CMOS RTC advertised must be booted from EFI"
-              " (or with command line option \"cmos-rtc-probe\")\n");
-
-    if ( !cmos_rtc_probe(&rtc) )
-        panic("No CMOS RTC found - system must be booted from EFI\n");
+    __get_cmos_time(&rtc);
 
     return mktime(rtc.year, rtc.mon, rtc.day, rtc.hour, rtc.min, rtc.sec);
 }
@@ -1533,12 +1522,85 @@ void rtc_guest_write(unsigned int port, unsigned int data)
     }
 }
 
-static unsigned long get_wallclock_time(void)
+static enum {
+    WALLCLOCK_UNSET,
+    WALLCLOCK_XEN,
+    WALLCLOCK_CMOS,
+    WALLCLOCK_EFI,
+} wallclock_source __ro_after_init;
+
+static const char *__init wallclock_type_to_string(void)
+{
+    switch ( wallclock_source )
+    {
+    case WALLCLOCK_XEN:
+        return "XEN";
+
+    case WALLCLOCK_CMOS:
+        return "CMOS RTC";
+
+    case WALLCLOCK_EFI:
+        return "EFI";
+
+    case WALLCLOCK_UNSET:
+        return "UNSET";
+    }
+
+    ASSERT_UNREACHABLE();
+    return "";
+}
+
+static void __init probe_wallclock(void)
 {
+    ASSERT(wallclock_source == WALLCLOCK_UNSET);
+
     if ( xen_guest )
+    {
+        wallclock_source = WALLCLOCK_XEN;
+        return;
+    }
+    if ( efi_enabled(EFI_RS) && efi_get_time() )
+    {
+        wallclock_source = WALLCLOCK_EFI;
+        return;
+    }
+    if ( cmos_rtc_probe() )
+    {
+        wallclock_source = WALLCLOCK_CMOS;
+        return;
+    }
+
+    panic("No usable wallclock found, probed:%s%s%s\n%s",
+          !opt_cmos_rtc_probe && !efi_enabled(EFI_RS) ? " None" : "",
+          opt_cmos_rtc_probe ? " CMOS" : "",
+          efi_enabled(EFI_RS) ? " EFI" : "",
+          !opt_cmos_rtc_probe
+              ? "Try with command line option \"cmos-rtc-probe\"\n"
+              : !efi_enabled(EFI_RS)
+                  ? "System must be booted from EFI\n"
+                  : "");
+}
+
+static unsigned long get_wallclock_time(void)
+{
+    switch ( wallclock_source )
+    {
+    case WALLCLOCK_XEN:
         return read_xen_wallclock();
 
-    return get_cmos_time();
+    case WALLCLOCK_CMOS:
+        return cmos_rtc_read();
+
+    case WALLCLOCK_EFI:
+        return efi_get_time();
+
+    case WALLCLOCK_UNSET:
+        /* Unexpected state - handled by the ASSERT_UNREACHABLE() below. */
+        break;
+    }
+
+    ASSERT_UNREACHABLE();
+    return 0;
 }
 
 /***************************************************************************
@@ -2463,6 +2525,10 @@ int __init init_xen_time(void)
 
     open_softirq(TIME_CALIBRATE_SOFTIRQ, local_time_calibration);
 
+    probe_wallclock();
+
+    printk(XENLOG_INFO "Wallclock source: %s\n", wallclock_type_to_string());
+
     /* NB. get_wallclock_time() can take over one second to execute. */
     do_settime(get_wallclock_time(), 0, NOW());
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 16:11:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 16:11:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797709.1207751 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somQ3-0001V5-Rr; Thu, 12 Sep 2024 16:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797709.1207751; Thu, 12 Sep 2024 16:11:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somQ3-0001Ux-P7; Thu, 12 Sep 2024 16:11:43 +0000
Received: by outflank-mailman (input) for mailman id 797709;
 Thu, 12 Sep 2024 16:11:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somQ2-0001Um-7i
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:11:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somQ2-0000IO-6x
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somQ2-0002Ur-5z
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:11:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dF780AHD58V7D05X0DACysRlKfmz99hsHcEn7+mf+OY=; b=DRe0HCw2LOhApkZekXJv3n0lkV
	C4ib/KoMJnbpY7p5HOg+6kBwILCq0LK/HSxmQE6o98/i/uqXuwHdJxOeoiuc4hdFtPFYrGRxjhQTv
	3L0H7oEu1Hw41u2c58VbNGhKS6tqLYLBM2qjbgCyVtvrwiEcHYOvWxTP4po6WcYLnJg4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/cpufreq: address MISRA Rule 7.3 violation
Message-Id: <E1somQ2-0002Ur-5z@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 16:11:42 +0000

commit 233ee468bbe05ec453020bbd4b556f46d041bf21
Author:     Nicola Vetrini <nicola.vetrini@bugseng.com>
AuthorDate: Wed Sep 11 12:53:38 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 11 12:53:38 2024 +0200

    x86/cpufreq: address MISRA Rule 7.3 violation
    
    Rule 7.3 states:
    "The lowercase character l shall not be used in a literal suffix",
    but the INTEL_MSR_RANGE macro uses the "ull" suffix.
    The "u" is transformed in uppercase for consistency.
    
    No functional change.
    
    Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/acpi/cpufreq/acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/acpi/cpufreq/acpi.c b/xen/arch/x86/acpi/cpufreq/acpi.c
index c6d7d02faa..0c25376406 100644
--- a/xen/arch/x86/acpi/cpufreq/acpi.c
+++ b/xen/arch/x86/acpi/cpufreq/acpi.c
@@ -25,7 +25,7 @@ enum {
     SYSTEM_IO_CAPABLE,
 };
 
-#define INTEL_MSR_RANGE         (0xffffull)
+#define INTEL_MSR_RANGE         0xffffULL
 
 static bool __read_mostly acpi_pstate_strict;
 boolean_param("acpi_pstate_strict", acpi_pstate_strict);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 16:11:53 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 16:11:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797710.1207755 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somQD-0001Xv-TR; Thu, 12 Sep 2024 16:11:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797710.1207755; Thu, 12 Sep 2024 16:11:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somQD-0001Xn-QW; Thu, 12 Sep 2024 16:11:53 +0000
Received: by outflank-mailman (input) for mailman id 797710;
 Thu, 12 Sep 2024 16:11:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somQC-0001XW-De
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:11:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somQC-0000IZ-AC
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somQC-0002WN-96
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:11:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iPJug5Ii8PJryAKJXRKnaW+J6ZbmXpF42AZOOoNheR8=; b=wPdv4ZQioHrIu5nP0porucscjk
	a4es/if4+CVISP6sq6XvVf55DtKztjJ2TXYH3h9e24AEg95KhjQz8U7w9JvozHjevXEaIfsqD1xtK
	aqjZueINF0eTmRwY2Rv2AAn/PMnnuBH8DnUNbDEWxzx2g0eLFxl3p3dSYfz1B/1XQirg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/APIC: address violation of MISRA C Rule 21.2
Message-Id: <E1somQC-0002WN-96@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 16:11:52 +0000

commit 09217c2618b85c783585946ef23f409c19813bb4
Author:     Nicola Vetrini <nicola.vetrini@bugseng.com>
AuthorDate: Wed Sep 11 12:54:00 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 11 12:54:00 2024 +0200

    x86/APIC: address violation of MISRA C Rule 21.2
    
    The rule disallows the usage of an identifier reserved by the C standard.
    All identfiers starting with '__' are reserved for any use, so the label
    can be renamed in order to avoid the violation.
    
    No functional change.
    
    Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Signed-off-by: Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/apic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index e077bf7edc..254ab5d388 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -925,7 +925,7 @@ void __init init_apic_mappings(void)
     unsigned long apic_phys;
 
     if ( x2apic_enabled )
-        goto __next;
+        goto next;
     /*
      * If no local APIC can be found then set up a fake all
      * zeroes page to simulate the local APIC and another
@@ -941,7 +941,7 @@ void __init init_apic_mappings(void)
     apic_printk(APIC_VERBOSE, "mapped APIC to %p (%08lx)\n",
                 fix_to_virt(FIX_APIC_BASE), apic_phys);
 
-__next:
+ next:
     /*
      * Fetch the APIC ID of the BSP in case we have a
      * default configuration (or the MP table is broken).
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 16:12:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 16:12:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797711.1207758 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somQN-0001ax-W1; Thu, 12 Sep 2024 16:12:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797711.1207758; Thu, 12 Sep 2024 16:12:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somQN-0001ap-TK; Thu, 12 Sep 2024 16:12:03 +0000
Received: by outflank-mailman (input) for mailman id 797711;
 Thu, 12 Sep 2024 16:12:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somQM-0001ai-Dx
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:12:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somQM-0000Iw-DL
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:12:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somQM-0002Xi-CR
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:12:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4+rsZL41U8GzhfJw3btU6oUj2woFGZ1DTu4QWIzrSEk=; b=nqXTInlxM/iuNzxgfRjtxcqc88
	vzg5+K9OcsL2M+WhRlvJoYhF7MkIww0A8s7RAdtB8qpaii4p12wruKXFjmDvCOPHmkj1gCrzc01yC
	DZzffwYGcVfj3EpE2xc+39rvvh6nnaw/eWqlsiC1qAR1+lXvbUd+b2RTmE9rXHPyGRfM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/psr: address violation of MISRA C Rule 16.3
Message-Id: <E1somQM-0002Xi-CR@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 16:12:02 +0000

commit 76529a1ce1ea81bfd14ef3bc69f999f2df18d1da
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Wed Sep 11 12:54:22 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 11 12:54:22 2024 +0200

    x86/psr: address violation of MISRA C Rule 16.3
    
    Address a violation of MISRA C:2012 Rule 16.3:
    "An unconditional `break' statement shall terminate every
    switch-clause".
    
    No functional change.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/psr.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c
index 0b9631ac44..5815a35335 100644
--- a/xen/arch/x86/psr.c
+++ b/xen/arch/x86/psr.c
@@ -276,6 +276,7 @@ static enum psr_feat_type psr_type_to_feat_type(enum psr_type type)
 
     default:
         ASSERT_UNREACHABLE();
+        break;
     }
 
     return feat_type;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 16:12:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 16:12:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797712.1207763 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somQY-0001ds-1a; Thu, 12 Sep 2024 16:12:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797712.1207763; Thu, 12 Sep 2024 16:12:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somQX-0001dk-Up; Thu, 12 Sep 2024 16:12:13 +0000
Received: by outflank-mailman (input) for mailman id 797712;
 Thu, 12 Sep 2024 16:12:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somQW-0001dX-HF
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:12:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somQW-0000JS-GV
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:12:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somQW-0002Yp-Ff
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:12:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZM1RVD8NT3gRVpPMLBmtWri7P5ikO/an7aEFy/s0zcc=; b=kwlit4kTWQ3oxvNWWO9N19eNYD
	LOfAIcQPwSI9lrYmZy7QPym9KI2IOz/LbER5GapOy5MtuaOFA9o23BV21cPr03fi+mKcfHvVCImz5
	P5Z9cUMT+5asqwnRUFcGROOUYZa4MD8ucySXOR99AbvBk+HNuz8sxc1Eaqjw//GOlYgk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/time: address violations of MISRA C Rule 16.3
Message-Id: <E1somQW-0002Yp-Ff@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 16:12:12 +0000

commit b3173a25ba8b766e4cba701d79333935d8ccf3c2
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Wed Sep 11 12:54:52 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 11 12:54:52 2024 +0200

    x86/time: address violations of MISRA C Rule 16.3
    
    Address violations of MISRA C:2012 Rule 16.3:
    "An unconditional `break' statement shall terminate every
    switch-clause".
    
    No functional change.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/time.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 1dcbd9f520..9588502f28 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1467,6 +1467,7 @@ unsigned int rtc_guest_read(unsigned int port)
 
     default:
         ASSERT_UNREACHABLE();
+        break;
     }
 
     return data;
@@ -1519,6 +1520,7 @@ void rtc_guest_write(unsigned int port, unsigned int data)
 
     default:
         ASSERT_UNREACHABLE();
+        break;
     }
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 16:12:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 16:12:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797713.1207767 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somQi-0001gN-2U; Thu, 12 Sep 2024 16:12:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797713.1207767; Thu, 12 Sep 2024 16:12:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somQh-0001gF-WF; Thu, 12 Sep 2024 16:12:24 +0000
Received: by outflank-mailman (input) for mailman id 797713;
 Thu, 12 Sep 2024 16:12:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somQg-0001g8-K6
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:12:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somQg-0000KK-JQ
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:12:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somQg-0002aD-IZ
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:12:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BnGvNIWzIiWlez268Ulevagv9PrdQMpj0ebixktBEXw=; b=xzzJUQ27gi6CuHgno+R7vvzv5h
	ZTvf+udAwlpupNK0ktsksGFxy8hzAkggdXh/f21p+baleYtsMrvHFBxSiqX38qDPnmZBTVVOFJ9mD
	pSXkgsztmVpg8XF40pqB+KvAJ8crl6BWsvJBRZhcB20wv3X2mpT+vGA0JvRvNqCBLRQ4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vm_event: address violation of MISRA C Rule 16.3
Message-Id: <E1somQg-0002aD-IZ@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 16:12:22 +0000

commit a42c3ec62f2036fcc953dd4a3980bc7b36b8fd3f
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Wed Sep 11 12:55:14 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 11 12:55:14 2024 +0200

    x86/vm_event: address violation of MISRA C Rule 16.3
    
    Address a violation of MISRA C:2012 Rule 16.3:
    "An unconditional `break' statement shall terminate every
    switch-clause".
    
    No functional change.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
---
 xen/arch/x86/vm_event.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/vm_event.c b/xen/arch/x86/vm_event.c
index e6c7ad5337..0d15d363c3 100644
--- a/xen/arch/x86/vm_event.c
+++ b/xen/arch/x86/vm_event.c
@@ -190,6 +190,7 @@ static void vm_event_pack_segment_register(enum x86_segment segment,
 
     default:
         ASSERT_UNREACHABLE();
+        break;
     }
 }
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 16:12:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 16:12:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797714.1207771 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somQs-0001il-41; Thu, 12 Sep 2024 16:12:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797714.1207771; Thu, 12 Sep 2024 16:12:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somQs-0001ie-1Q; Thu, 12 Sep 2024 16:12:34 +0000
Received: by outflank-mailman (input) for mailman id 797714;
 Thu, 12 Sep 2024 16:12:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somQq-0001iT-Mx
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:12:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somQq-0000LI-MJ
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:12:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somQq-0002bF-LU
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:12:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Aam5InuWWNu0hS1LSuxHPF4p2aRtWiIphj9aVtHK9SQ=; b=I1IzrccapNbYblHHffsXj/VBZS
	8kDE4JfmEc2wPZFhaEzMGduvYLpAh5B7NtFfTkUHrwA2Gv3PXxxEVqZTMhX0kQbaBBTEYwHVWxfXI
	GiiLWKL9YwKNtwJ0ZAFodzmATa0fwuCiHX19vSPSFNEt1jYVPQbXhKFgVgfW2tSzj/lQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hypercall: address violations of MISRA C Rule 16.3
Message-Id: <E1somQq-0002bF-LU@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 16:12:32 +0000

commit c4fe5296e614a8d5b1d195d70dec257c5a67cc97
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Wed Sep 11 12:55:35 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 11 12:55:35 2024 +0200

    x86/hypercall: address violations of MISRA C Rule 16.3
    
    Address violations of MISRA C:2012 Rule 16.3:
    "An unconditional `break' statement shall terminate every
    switch-clause".
    
    No functional change.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/hypercall.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/hypercall.h b/xen/arch/x86/include/asm/hypercall.h
index 389fa62af2..f6e9e2313b 100644
--- a/xen/arch/x86/include/asm/hypercall.h
+++ b/xen/arch/x86/include/asm/hypercall.h
@@ -55,7 +55,7 @@ static inline void clobber_regs64(struct cpu_user_regs *regs,
     case 4: regs->r10 = 0xdeadbeefdeadf00dUL; fallthrough;
     case 3: regs->rdx = 0xdeadbeefdeadf00dUL; fallthrough;
     case 2: regs->rsi = 0xdeadbeefdeadf00dUL; fallthrough;
-    case 1: regs->rdi = 0xdeadbeefdeadf00dUL;
+    case 1: regs->rdi = 0xdeadbeefdeadf00dUL; break;
     }
 #endif
 }
@@ -71,7 +71,7 @@ static inline void clobber_regs32(struct cpu_user_regs *regs,
     case 4: regs->esi = 0xdeadf00dU; fallthrough;
     case 3: regs->edx = 0xdeadf00dU; fallthrough;
     case 2: regs->ecx = 0xdeadf00dU; fallthrough;
-    case 1: regs->ebx = 0xdeadf00dU;
+    case 1: regs->ebx = 0xdeadf00dU; break;
     }
 #endif
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 16:12:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 16:12:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797715.1207775 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somR2-0001lD-5o; Thu, 12 Sep 2024 16:12:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797715.1207775; Thu, 12 Sep 2024 16:12:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somR2-0001l5-3B; Thu, 12 Sep 2024 16:12:44 +0000
Received: by outflank-mailman (input) for mailman id 797715;
 Thu, 12 Sep 2024 16:12:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somR0-0001kt-Pl
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:12:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somR0-0000LV-PC
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:12:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somR0-0002cD-OO
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:12:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=j7ioKRuXjIJO60fiOwGhij6IqQLc85XgtR7OA+f5N3k=; b=XFLadpgxtdE83JiRHiJSUGYyJF
	WFf6zc0eQMBjYnkqDmnoJNhnrZ5snMbrLksHTz524oP1NsGL4cCGxYd7hSV1VX3qiAoI4xJGjcRek
	V8FVy3Ia3WPvKnrXp132lCr6i1vj3Buyyg/t7qtVykXb0KsYqjgiFJGJZI7IPsSitZtw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/monitor: address violation of MISRA C Rule 16.3
Message-Id: <E1somR0-0002cD-OO@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 16:12:42 +0000

commit 6f5b873600ec5678d5fcaaa5ff047514a6721392
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Wed Sep 11 12:56:03 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 11 12:56:03 2024 +0200

    x86/monitor: address violation of MISRA C Rule 16.3
    
    Address a violation of MISRA C:2012 Rule 16.3:
    "An unconditional `break' statement shall terminate every
    switch-clause".
    
    No functional change.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
---
 xen/arch/x86/include/asm/monitor.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/include/asm/monitor.h b/xen/arch/x86/include/asm/monitor.h
index 96e6a9d0d8..3c64d8258f 100644
--- a/xen/arch/x86/include/asm/monitor.h
+++ b/xen/arch/x86/include/asm/monitor.h
@@ -65,6 +65,7 @@ int arch_monitor_domctl_op(struct domain *d, struct xen_domctl_monitor_op *mop)
 
     default:
         rc = -EOPNOTSUPP;
+        break;
     }
 
     return rc;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 16:12:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 16:12:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797716.1207779 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somRC-0001pH-7F; Thu, 12 Sep 2024 16:12:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797716.1207779; Thu, 12 Sep 2024 16:12:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somRC-0001p9-4d; Thu, 12 Sep 2024 16:12:54 +0000
Received: by outflank-mailman (input) for mailman id 797716;
 Thu, 12 Sep 2024 16:12:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somRA-0001oo-Si
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:12:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somRA-0000Lg-S0
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:12:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somRA-0002dl-RN
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:12:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZfLHk0ZGOZXprwBLuIdu0IdQrRj+809T6ZQjFCDBhhk=; b=yTs7jDZJ+fQU4iZUU88Yw0tgsP
	c/M4zfPmdBU6Vwcn6clsgNNlvZn3Q/muXv3M7lSpROuqKmPKsNlz/oDGhJe+U2l6SUgNeFPYhWnrA
	Zf0UaKQCo56J9T60TfF29tvljAnjemruTz90fcktrd+j66taNNg/xUspFmnsdM85vjHI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mm: address violations of MISRA C Rule 16.3
Message-Id: <E1somRA-0002dl-RN@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 16:12:52 +0000

commit f6cc23e234b57412a32cb13b1a118cb653fc49c9
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Wed Sep 11 12:56:33 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 11 12:56:33 2024 +0200

    x86/mm: address violations of MISRA C Rule 16.3
    
    Address violations of MISRA C:2012 Rule 16.3:
    "An unconditional `break' statement shall terminate every
    switch-clause".
    
    No functional change.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm/guest_walk.c     | 1 +
 xen/arch/x86/mm/hap/hap.c        | 2 +-
 xen/arch/x86/mm/hap/nested_hap.c | 1 +
 xen/arch/x86/mm/paging.c         | 2 +-
 4 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/guest_walk.c b/xen/arch/x86/mm/guest_walk.c
index fe7393334f..f48c3ef75f 100644
--- a/xen/arch/x86/mm/guest_walk.c
+++ b/xen/arch/x86/mm/guest_walk.c
@@ -498,6 +498,7 @@ guest_walk_tables(const struct vcpu *v, struct p2m_domain *p2m,
             hvmemul_write_cache(v, l4gpa, &gw->l4e, sizeof(gw->l4e));
         }
 #endif
+        break;
     }
 
  out:
diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c
index d2011fde24..ec5043a8aa 100644
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -652,7 +652,7 @@ int hap_domctl(struct domain *d, struct xen_domctl_shadow_op *sc,
         return rc;
     case XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION:
         sc->mb = hap_get_allocation(d);
-        /* Fall through... */
+        fallthrough;
     case XEN_DOMCTL_SHADOW_OP_OFF:
         return 0;
     default:
diff --git a/xen/arch/x86/mm/hap/nested_hap.c b/xen/arch/x86/mm/hap/nested_hap.c
index 080b60adf0..cc7bc6e5ea 100644
--- a/xen/arch/x86/mm/hap/nested_hap.c
+++ b/xen/arch/x86/mm/hap/nested_hap.c
@@ -217,6 +217,7 @@ int nestedhvm_hap_nested_page_fault(
         p2ma_10 = p2m_access_n;
         /* For safety, remove all permissions. */
         gdprintk(XENLOG_ERR, "Unhandled p2m access type:%d\n", p2ma_10);
+        break;
     }
     /* Use minimal permission for nested p2m. */
     p2ma_10 &= (p2m_access_t)p2ma_21;
diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index dd47bde5ce..c77f4c1dac 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -726,7 +726,7 @@ int paging_domctl(struct domain *d, struct xen_domctl_shadow_op *sc,
     case XEN_DOMCTL_SHADOW_OP_ENABLE:
         if ( !(sc->mode & XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY) )
             break;
-        /* Else fall through... */
+        fallthrough;
     case XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY:
         return paging_log_dirty_enable(d);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 16:13:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 16:13:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797717.1207783 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somRM-0001sL-8u; Thu, 12 Sep 2024 16:13:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797717.1207783; Thu, 12 Sep 2024 16:13:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somRM-0001s9-62; Thu, 12 Sep 2024 16:13:04 +0000
Received: by outflank-mailman (input) for mailman id 797717;
 Thu, 12 Sep 2024 16:13:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somRK-0001s0-Vn
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:13:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somRK-0000M2-V2
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:13:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somRK-0002eu-U7
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:13:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wkM6Ty6hhhb3m59i85QHXXzzKxergvtyJEPIFYYPwbc=; b=G+ABKM2t5TPmQJyiTC4kieSHRW
	PwopZLQ6x2uYD/gs3EV7k28CcicNynKAB8Wt4Z3eO/AMMEt7wdVkuBJrN13IJ/P2zX31Cw4FWWhjS
	90rf/migeWDxjpPvyJQGxDU5iHboCAj5euh00EqWOJ6K27BMI0kXbrgiByER05Ls0KjI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mmcfg: address violation of MISRA C Rule 16.3
Message-Id: <E1somRK-0002eu-U7@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 16:13:02 +0000

commit 2b24c090d1454fc13fb2fce94565175449aed25e
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Wed Sep 11 12:57:07 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 11 12:57:07 2024 +0200

    x86/mmcfg: address violation of MISRA C Rule 16.3
    
    Address a violation of MISRA C:2012 Rule 16.3:
    "An unconditional `break' statement shall terminate every
    switch-clause".
    
    No functional change.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/x86_64/mmconfig-shared.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/x86_64/mmconfig-shared.c b/xen/arch/x86/x86_64/mmconfig-shared.c
index b3b2da7362..77ba1e28f1 100644
--- a/xen/arch/x86/x86_64/mmconfig-shared.c
+++ b/xen/arch/x86/x86_64/mmconfig-shared.c
@@ -112,6 +112,7 @@ static const char *__init cf_check pci_mmcfg_intel_945(void)
         break;
     default:
         pci_mmcfg_config_num = 0;
+        break;
     }
 
     /* Errata #2, things break when not aligned on a 256Mb boundary */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 16:13:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 16:13:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797718.1207786 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somRW-0001v7-9y; Thu, 12 Sep 2024 16:13:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797718.1207786; Thu, 12 Sep 2024 16:13:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somRW-0001uz-7Q; Thu, 12 Sep 2024 16:13:14 +0000
Received: by outflank-mailman (input) for mailman id 797718;
 Thu, 12 Sep 2024 16:13:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somRV-0001ur-2v
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:13:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somRV-0000MU-2H
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:13:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somRV-0002fv-0p
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:13:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IlQO/6OX0NVtE6hMpmpjHDoMuUfGijr4H43GSXn3EHc=; b=c1Ghqe/gta1DQlVVfL+VON70FT
	2R5zp76PNXytvKctxZkal0VdDehEz9d5fcvT1AsvDlippBmNOIY6VADqWag3lAympxBQ8brdSApos
	eK+U1UWktGbrFMH12ojSVavv4YZqTZxZjrhENgvNBtFx/aD89niE9ZFOeUymSQB5NWko=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HVM: drop stdvga's "cache" struct member
Message-Id: <E1somRV-0002fv-0p@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 16:13:13 +0000

commit 53b7246bdfb3c280adcdf714918e4decb7e108f4
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Sep 11 12:57:53 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 11 12:57:53 2024 +0200

    x86/HVM: drop stdvga's "cache" struct member
    
    Since 68e1183411be ("libxc: introduce a xc_dom_arch for hvm-3.0-x86_32
    guests"), HVM guests are built using XEN_DOMCTL_sethvmcontext, which
    ends up disabling stdvga caching because of arch_hvm_load() being
    involved in the processing of the request. With that the field is
    useless, and can be dropped. Drop the helper functions manipulating /
    checking as well right away, but leave the use sites of
    stdvga_cache_is_enabled() with the hard-coded result the function would
    have produced, to aid validation of subsequent dropping of further code.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/save.c           |  3 ---
 xen/arch/x86/hvm/stdvga.c         | 44 +++------------------------------------
 xen/arch/x86/include/asm/hvm/io.h |  7 -------
 3 files changed, 3 insertions(+), 51 deletions(-)

diff --git a/xen/arch/x86/hvm/save.c b/xen/arch/x86/hvm/save.c
index 99aaf3fc33..8ab6405706 100644
--- a/xen/arch/x86/hvm/save.c
+++ b/xen/arch/x86/hvm/save.c
@@ -69,9 +69,6 @@ static void arch_hvm_load(struct domain *d, const struct hvm_save_header *hdr)
 
     /* Time when restore started  */
     d->arch.hvm.sync_tsc = rdtsc();
-
-    /* VGA state is not saved/restored, so we nobble the cache. */
-    d->arch.hvm.stdvga.cache = STDVGA_CACHE_DISABLED;
 }
 
 /* List of handlers for various HVM save and restore types */
diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index b16c59f772..afd2ca95d6 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -100,37 +100,6 @@ static void vram_put(struct hvm_hw_stdvga *s, void *p)
     unmap_domain_page(p);
 }
 
-static void stdvga_try_cache_enable(struct hvm_hw_stdvga *s)
-{
-    /*
-     * Caching mode can only be enabled if the the cache has
-     * never been used before. As soon as it is disabled, it will
-     * become out-of-sync with the VGA device model and since no
-     * mechanism exists to acquire current VRAM state from the
-     * device model, re-enabling it would lead to stale data being
-     * seen by the guest.
-     */
-    if ( s->cache != STDVGA_CACHE_UNINITIALIZED )
-        return;
-
-    gdprintk(XENLOG_INFO, "entering caching mode\n");
-    s->cache = STDVGA_CACHE_ENABLED;
-}
-
-static void stdvga_cache_disable(struct hvm_hw_stdvga *s)
-{
-    if ( s->cache != STDVGA_CACHE_ENABLED )
-        return;
-
-    gdprintk(XENLOG_INFO, "leaving caching mode\n");
-    s->cache = STDVGA_CACHE_DISABLED;
-}
-
-static bool stdvga_cache_is_enabled(const struct hvm_hw_stdvga *s)
-{
-    return s->cache == STDVGA_CACHE_ENABLED;
-}
-
 static int stdvga_outb(uint64_t addr, uint8_t val)
 {
     struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
@@ -170,7 +139,6 @@ static int stdvga_outb(uint64_t addr, uint8_t val)
     if ( !prev_stdvga && s->stdvga )
     {
         gdprintk(XENLOG_INFO, "entering stdvga mode\n");
-        stdvga_try_cache_enable(s);
     }
     else if ( prev_stdvga && !s->stdvga )
     {
@@ -468,7 +436,7 @@ static int cf_check stdvga_mem_write(
     };
     struct ioreq_server *srv;
 
-    if ( !stdvga_cache_is_enabled(s) || !s->stdvga )
+    if ( true || !s->stdvga )
         goto done;
 
     /* Intercept mmio write */
@@ -536,18 +504,12 @@ static bool cf_check stdvga_mem_accept(
          * We cannot return X86EMUL_UNHANDLEABLE on anything other then the
          * first cycle of an I/O. So, since we cannot guarantee to always be
          * able to send buffered writes, we have to reject any multi-cycle
-         * I/O and, since we are rejecting an I/O, we must invalidate the
-         * cache.
-         * Single-cycle write transactions are accepted even if the cache is
-         * not active since we can assert, when in stdvga mode, that writes
-         * to VRAM have no side effect and thus we can try to buffer them.
+         * I/O.
          */
-        stdvga_cache_disable(s);
-
         goto reject;
     }
     else if ( p->dir == IOREQ_READ &&
-              (!stdvga_cache_is_enabled(s) || !s->stdvga) )
+              (true || !s->stdvga) )
         goto reject;
 
     /* s->lock intentionally held */
diff --git a/xen/arch/x86/include/asm/hvm/io.h b/xen/arch/x86/include/asm/hvm/io.h
index 24d1b6134f..ce171eaca4 100644
--- a/xen/arch/x86/include/asm/hvm/io.h
+++ b/xen/arch/x86/include/asm/hvm/io.h
@@ -110,19 +110,12 @@ struct vpci_arch_msix_entry {
     int pirq;
 };
 
-enum stdvga_cache_state {
-    STDVGA_CACHE_UNINITIALIZED,
-    STDVGA_CACHE_ENABLED,
-    STDVGA_CACHE_DISABLED
-};
-
 struct hvm_hw_stdvga {
     uint8_t sr_index;
     uint8_t sr[8];
     uint8_t gr_index;
     uint8_t gr[9];
     bool stdvga;
-    enum stdvga_cache_state cache;
     uint32_t latch;
     struct page_info *vram_page[64];  /* shadow of 0xa0000-0xaffff */
     spinlock_t lock;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 16:13:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 16:13:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797719.1207791 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somRg-0001yH-Dl; Thu, 12 Sep 2024 16:13:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797719.1207791; Thu, 12 Sep 2024 16:13:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1somRg-0001y9-B8; Thu, 12 Sep 2024 16:13:24 +0000
Received: by outflank-mailman (input) for mailman id 797719;
 Thu, 12 Sep 2024 16:13:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somRf-0001xy-61
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:13:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somRf-0000Mk-5O
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:13:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1somRf-0002h7-4H
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 16:13:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cMcwPJbsk/S4eBhT6m6GzhbEpEid9ykwER7rn09FS50=; b=qgjf0Gkzkx1cNdnsm+GMA/m21l
	HjqWqXJSxpfnxszI+1oiO26U7akYbJocYMro7aMwVMy6+KCOeirI2nqJP8xZX0gpBdEY/GNuVjIe0
	91DW9Q8vOwAGVtW9XAoOkLW3wDkzgLIeb7gBRDqAZlVPlHH5TRBwbgjvRU9mHoK3QHG8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hvm: allow {,un}map_pirq hypercalls unconditionally
Message-Id: <E1somRf-0002h7-4H@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 16:13:23 +0000

commit 035baa203b978b219828d0d3c16057beb344f35c
Author:     Jiqian Chen <Jiqian.Chen@amd.com>
AuthorDate: Wed Sep 11 12:58:24 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 11 12:58:24 2024 +0200

    x86/hvm: allow {,un}map_pirq hypercalls unconditionally
    
    The current hypercall interfaces to manage and assign interrupts to
    domains is mostly based in using pIRQs as handlers.  Such pIRQ values
    are abstract domain-specific references to interrupts.
    
    Classic HVM domains can have access to {,un}map_pirq hypercalls if the
    domain is allowed to route physical interrupts over event channels.
    That's however a different interface, limited to only mapping
    interrupts to itself. PVH domains on the other hand never had access
    to the interface, as PVH domains are not allowed to route interrupts
    over event channels.
    
    In order to allow setting up PCI passthrough from a PVH domain it
    needs access to the {,un}map_pirq hypercalls so interrupts can be
    assigned a pIRQ handler that can then be used by further hypercalls to
    bind the interrupt to a domain.
    
    Note that the {,un}map_pirq hypercalls end up calling helpers that are
    already used against a PVH domain in order to setup interrupts for the
    hardware domain when running in PVH mode.  physdev_map_pirq() will
    call allocate_and_map_{gsi,msi}_pirq() which is already used by the
    vIO-APIC or the vPCI code respectively.  So the exposed code paths are
    not new when targeting a PVH domain, but rather previous callers are
    not hypercall but emulation based.
    
    Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
    Signed-off-by: Huang Rui <ray.huang@amd.com>
    Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hypercall.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c
index f023f7879e..81883c8d4f 100644
--- a/xen/arch/x86/hvm/hypercall.c
+++ b/xen/arch/x86/hvm/hypercall.c
@@ -73,6 +73,8 @@ long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
     {
     case PHYSDEVOP_map_pirq:
     case PHYSDEVOP_unmap_pirq:
+        break;
+
     case PHYSDEVOP_eoi:
     case PHYSDEVOP_irq_status_query:
     case PHYSDEVOP_get_free_pirq:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 17:55:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 17:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797755.1207814 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soo24-0006Mc-9c; Thu, 12 Sep 2024 17:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797755.1207814; Thu, 12 Sep 2024 17:55:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soo24-0006MU-7A; Thu, 12 Sep 2024 17:55:04 +0000
Received: by outflank-mailman (input) for mailman id 797755;
 Thu, 12 Sep 2024 17:55:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soo23-0006MO-Hs
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 17:55:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soo23-00023n-E6
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 17:55:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soo23-0001j9-CA
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 17:55:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OxcTEZG7CIh8f7F9ju3wFF58ODwQXgkQP2BB8030XSo=; b=ioTqV1tmYIWB9cUfD19yE0wDVR
	fWDXpEPEf/BWQYD3fh2VZbN4Yxrp7HvxJIEy1wUQorZKq6UIX3RfKxdIZx8Jn1s2rp98OcLnDY23n
	afUjW94CXrIdWVtrwh2wNmQdpkVxdRPzkGDF9JkusS/bOPu4t68rOL3GwQsYyDiC8teE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] ARM/cache: Drop legacy __read_mostly/__ro_after_init definitions
Message-Id: <E1soo23-0001j9-CA@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 17:55:03 +0000

commit 42968684e51974f1181e493d4994ced1f7f3df7a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu May 30 21:09:48 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Sep 12 17:28:52 2024 +0100

    ARM/cache: Drop legacy __read_mostly/__ro_after_init definitions
    
    These are no longer needed.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/include/asm/cache.h | 3 ---
 xen/include/xen/cache.h          | 5 -----
 2 files changed, 8 deletions(-)

diff --git a/xen/arch/arm/include/asm/cache.h b/xen/arch/arm/include/asm/cache.h
index 029b2896fb..b75c970b68 100644
--- a/xen/arch/arm/include/asm/cache.h
+++ b/xen/arch/arm/include/asm/cache.h
@@ -6,9 +6,6 @@
 #define L1_CACHE_SHIFT  (CONFIG_ARM_L1_CACHE_SHIFT)
 #define L1_CACHE_BYTES  (1 << L1_CACHE_SHIFT)
 
-/* TODO: Phase out the use of this via cache.h */
-#define __read_mostly __section(".data.read_mostly")
-
 #endif
 /*
  * Local variables:
diff --git a/xen/include/xen/cache.h b/xen/include/xen/cache.h
index 90816ba05b..6ee174efa4 100644
--- a/xen/include/xen/cache.h
+++ b/xen/include/xen/cache.h
@@ -15,9 +15,4 @@
 #define __cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES)))
 #endif
 
-#if defined(CONFIG_ARM)
-/* TODO: Phase out the use of this via cache.h */
-#define __ro_after_init __section(".data.ro_after_init")
-#endif
-
 #endif /* __LINUX_CACHE_H */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 17:55:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 17:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797756.1207818 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soo2E-0006Op-B5; Thu, 12 Sep 2024 17:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797756.1207818; Thu, 12 Sep 2024 17:55:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soo2E-0006Oi-8d; Thu, 12 Sep 2024 17:55:14 +0000
Received: by outflank-mailman (input) for mailman id 797756;
 Thu, 12 Sep 2024 17:55:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soo2D-0006Oa-Im
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 17:55:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soo2D-000249-Hz
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 17:55:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soo2D-0001kO-GA
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 17:55:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/vf5uwX2RHyMaUY6G6Ry6mfwNwu6zyxraJoaCAk8BKY=; b=wcBCHWcddEfL8k0LKcfGCcywNS
	FlvFtOToDYTczFpHOAH68/UW3D2f1dlisoHvd1o5l4wWHFWkClDT5lFGigfhfyutrcv9GdrQS8LYG
	kFtBVnaqtSmRWK8Yt54B/bKU1ckh52nvEmemDvabMGT6E1n5nu2LPxoa/K7zIWGVzTyo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/hvm: Simplify stdvga_mem_accept() further
Message-Id: <E1soo2D-0001kO-GA@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 17:55:13 +0000

commit 08ffd8705d36c7c445df3ecee8ad9b8f8d65fbe0
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Sep 12 12:04:17 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Sep 12 17:28:52 2024 +0100

    x86/hvm: Simplify stdvga_mem_accept() further
    
    stdvga_mem_accept() is called on almost all IO emulations, and the
    overwhelming likely answer is to reject the ioreq.  Simply rearranging the
    expression yields an improvement:
    
      add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-57 (-57)
      Function                                     old     new   delta
      stdvga_mem_accept                            109      52     -57
    
    which is best explained looking at the disassembly:
    
      Before:                                                    After:
      f3 0f 1e fa           endbr64                              f3 0f 1e fa           endbr64
      0f b6 4e 1e           movzbl 0x1e(%rsi),%ecx            |  0f b6 46 1e           movzbl 0x1e(%rsi),%eax
      48 8b 16              mov    (%rsi),%rdx                |  31 d2                 xor    %edx,%edx
      f6 c1 40              test   $0x40,%cl                  |  a8 30                 test   $0x30,%al
      75 38                 jne    <stdvga_mem_accept+0x48>   |  75 23                 jne    <stdvga_mem_accept+0x31>
      31 c0                 xor    %eax,%eax                  <
      48 81 fa ff ff 09 00  cmp    $0x9ffff,%rdx              <
      76 26                 jbe    <stdvga_mem_accept+0x41>   <
      8b 46 14              mov    0x14(%rsi),%eax            <
      8b 7e 10              mov    0x10(%rsi),%edi            <
      48 0f af c7           imul   %rdi,%rax                  <
      48 8d 54 02 ff        lea    -0x1(%rdx,%rax,1),%rdx     <
      31 c0                 xor    %eax,%eax                  <
      48 81 fa ff ff 0b 00  cmp    $0xbffff,%rdx              <
      77 0c                 ja     <stdvga_mem_accept+0x41>   <
      83 e1 30              and    $0x30,%ecx                 <
      75 07                 jne    <stdvga_mem_accept+0x41>   <
      83 7e 10 01           cmpl   $0x1,0x10(%rsi)               83 7e 10 01           cmpl   $0x1,0x10(%rsi)
      0f 94 c0              sete   %al                        |  75 1d                 jne    <stdvga_mem_accept+0x31>
      c3                    ret                               |  48 8b 0e              mov    (%rsi),%rcx
      66 0f 1f 44 00 00     nopw   0x0(%rax,%rax,1)           |  48 81 f9 ff ff 09 00  cmp    $0x9ffff,%rcx
      8b 46 10              mov    0x10(%rsi),%eax            |  76 11                 jbe    <stdvga_mem_accept+0x31>
      8b 7e 14              mov    0x14(%rsi),%edi            |  8b 46 14              mov    0x14(%rsi),%eax
      49 89 d0              mov    %rdx,%r8                   |  48 8d 44 01 ff        lea    -0x1(%rcx,%rax,1),%rax
      48 83 e8 01           sub    $0x1,%rax                  |  48 3d ff ff 0b 00     cmp    $0xbffff,%rax
      48 8d 54 3a ff        lea    -0x1(%rdx,%rdi,1),%rdx     |  0f 96 c2              setbe  %dl
      48 0f af c7           imul   %rdi,%rax                  |  89 d0                 mov    %edx,%eax
      49 29 c0              sub    %rax,%r8                   <
      31 c0                 xor    %eax,%eax                  <
      49 81 f8 ff ff 09 00  cmp    $0x9ffff,%r8               <
      77 be                 ja     <stdvga_mem_accept+0x2a>   <
      c3                    ret                                  c3                    ret
    
    By moving the "p->count != 1" check ahead of the
    ioreq_mmio_{first,last}_byte() calls, both multiplies disappear along with a
    lot of surrounding logic.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/stdvga.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index d38d30affb..c3c43f59ee 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -69,18 +69,14 @@ static int cf_check stdvga_mem_write(
 static bool cf_check stdvga_mem_accept(
     const struct hvm_io_handler *handler, const ioreq_t *p)
 {
-    if ( (ioreq_mmio_first_byte(p) < VGA_MEM_BASE) ||
+    /*
+     * Only accept single direct writes, as that's the only thing we can
+     * accelerate using buffered ioreq handling.
+     */
+    if ( p->dir != IOREQ_WRITE || p->data_is_ptr || p->count != 1 ||
+         (ioreq_mmio_first_byte(p) < VGA_MEM_BASE) ||
          (ioreq_mmio_last_byte(p) >= (VGA_MEM_BASE + VGA_MEM_SIZE)) )
-        return 0;
-
-    if ( p->dir != IOREQ_WRITE || p->data_is_ptr || p->count != 1 )
-    {
-        /*
-         * Only accept single direct writes, as that's the only thing we can
-         * accelerate using buffered ioreq handling.
-         */
         return false;
-    }
 
     return true;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 12 17:55:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Sep 2024 17:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797757.1207822 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soo2O-0006RY-Cl; Thu, 12 Sep 2024 17:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797757.1207822; Thu, 12 Sep 2024 17:55:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1soo2O-0006RQ-A9; Thu, 12 Sep 2024 17:55:24 +0000
Received: by outflank-mailman (input) for mailman id 797757;
 Thu, 12 Sep 2024 17:55:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soo2N-0006RG-MX
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 17:55:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soo2N-00024K-Li
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 17:55:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1soo2N-0001lF-KD
 for xen-changelog@lists.xenproject.org; Thu, 12 Sep 2024 17:55:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6bngYIKG8Usb+KJUGrJlb8KJEjDMiPb/6ydq+w3rxuU=; b=vznXbKO+vCKBGzHB5OF0hC38cn
	C5hEtpep6Q9k62ukKczce0mEFwxjy8CGmSuJel19qPKGctrCCaPdqIok9tHlGbDB9saHdgsZYzrKM
	sJGBM1oKqmPKGLTtt7qsoXaE4QIP1xXpJsErGyL7WUMirLCRHL7jOJPIrOHyLuntjGsQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/keyhandler: Move key_table[] into __ro_after_init
Message-Id: <E1soo2N-0001lF-KD@xenbits.xenproject.org>
Date: Thu, 12 Sep 2024 17:55:23 +0000

commit 4e23c86bd809d64468407165b40f9976d7186a59
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Sep 12 11:30:44 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Sep 12 17:28:52 2024 +0100

    xen/keyhandler: Move key_table[] into __ro_after_init
    
    All registration is done at boot.  Almost...
    
    iommu_dump_page_tables() is registered in iommu_hwdom_init(), which is called
    twice when LATE_HWDOM is in use.
    
    register_irq_keyhandler() has an ASSERT() guarding againt multiple
    registration attempts, and the absence of bug reports hints at how many
    configurations use LATE_HWDOM in practice.
    
    Move the registration into iommu_setup() just after printing the overall
    status of the IOMMU.  For starters, the hardware domain is specifically
    excluded by iommu_dump_page_tables().
    
    ept_dump_p2m_table is registered in setup_ept_dump() which is non-__init, but
    whose sole caller, start_vmx(), is __init.  Move setup_ept_dump() to match.
    
    With these two tweeks, all keyhandler reigstration is from __init functions,
    so register_{,irq_}keyhandler() can move, and key_table[] can become
    __ro_after_init.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m-ept.c       |  2 +-
 xen/common/keyhandler.c         | 10 +++++-----
 xen/drivers/passthrough/iommu.c |  5 +++--
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 2ea574ca6a..21728397f9 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -1497,7 +1497,7 @@ static void cf_check ept_dump_p2m_table(unsigned char key)
     rcu_read_unlock(&domlist_read_lock);
 }
 
-void setup_ept_dump(void)
+void __init setup_ept_dump(void)
 {
     register_keyhandler('D', ept_dump_p2m_table, "dump VT-x EPT tables", 0);
 }
diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c
index 674e7be39e..6da291b34e 100644
--- a/xen/common/keyhandler.c
+++ b/xen/common/keyhandler.c
@@ -40,7 +40,7 @@ static struct keyhandler {
     const char *desc;    /* Description for help message.                 */
     bool irq_callback,   /* Call in irq context? if not, tasklet context. */
         diagnostic;      /* Include in 'dump all' handler.                */
-} key_table[128] __read_mostly =
+} key_table[128] __ro_after_init =
 {
 #define KEYHANDLER(k, f, desc, diag)            \
     [k] = { { .fn = (f) }, desc, 0, diag }
@@ -99,8 +99,8 @@ void handle_keypress(unsigned char key, bool need_context)
     }
 }
 
-void register_keyhandler(unsigned char key, keyhandler_fn_t *fn,
-                         const char *desc, bool diagnostic)
+void __init register_keyhandler(unsigned char key, keyhandler_fn_t *fn,
+                                const char *desc, bool diagnostic)
 {
     BUG_ON(key >= ARRAY_SIZE(key_table)); /* Key in range? */
     ASSERT(!key_table[key].fn);           /* Clobbering something else? */
@@ -111,8 +111,8 @@ void register_keyhandler(unsigned char key, keyhandler_fn_t *fn,
     key_table[key].diagnostic = diagnostic;
 }
 
-void register_irq_keyhandler(unsigned char key, irq_keyhandler_fn_t *fn,
-                             const char *desc, bool diagnostic)
+void __init register_irq_keyhandler(unsigned char key, irq_keyhandler_fn_t *fn,
+                                    const char *desc, bool diagnostic)
 {
     BUG_ON(key >= ARRAY_SIZE(key_table)); /* Key in range? */
     ASSERT(!key_table[key].irq_fn);       /* Clobbering something else? */
diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index 50bfd62553..9e74a1fc72 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -271,8 +271,6 @@ void __hwdom_init iommu_hwdom_init(struct domain *d)
     if ( !is_iommu_enabled(d) )
         return;
 
-    register_keyhandler('o', &iommu_dump_page_tables, "dump iommu page tables", 0);
-
     iommu_vcall(hd->platform_ops, hwdom_init, d);
 }
 
@@ -605,6 +603,9 @@ int __init iommu_setup(void)
 #ifndef iommu_intremap
         printk("Interrupt remapping %sabled\n", iommu_intremap ? "en" : "dis");
 #endif
+
+        register_keyhandler('o', &iommu_dump_page_tables,
+                            "dump iommu page tables", 0);
     }
 
     return rc;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Sep 13 06:55:07 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Sep 2024 06:55:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797957.1208027 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0Cs-0007zw-Rt; Fri, 13 Sep 2024 06:55:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797957.1208027; Fri, 13 Sep 2024 06:55:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0Cs-0007zp-P8; Fri, 13 Sep 2024 06:55:02 +0000
Received: by outflank-mailman (input) for mailman id 797957;
 Fri, 13 Sep 2024 06:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0Cr-0007zg-OJ
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0Cr-0007wE-Ls
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0Cr-0004iT-J4
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=i0yxc7ZJN2oe3nzgtUO+jt4TwtDsL1rl3SnCDAfVQGs=; b=WbXpaIAKXBsPdNCzQWOWgrzH4e
	45vFzOwWZ5Wn8kq/NLttT/CGUhVI+ip55hifatD4Nzce1ea9+FwnaYmEgTH+8e2SnDcauk707Wsd3
	AsI6hGbxzNiCjlP2kkuqdKDZ1PMWYSJC8k0huz66ApjP1bfLvUOmRsudVePjKBsl6GLI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation/eclair_analysis: fix MISRA Rule 20.7 regression in self-tests.h
Message-Id: <E1sp0Cr-0004iT-J4@xenbits.xenproject.org>
Date: Fri, 13 Sep 2024 06:55:01 +0000

commit 4b3f30ea3059cd9000af853541354548bbb612db
Author:     Nicola Vetrini <nicola.vetrini@bugseng.com>
AuthorDate: Sun Sep 8 15:27:57 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Sep 11 17:10:27 2024 -0700

    automation/eclair_analysis: fix MISRA Rule 20.7 regression in self-tests.h
    
    Prior to bd1664db7b7d ("xen/bitops: Introduce a multiple_bits_set() helper")
    the definition of {COMPILE,RUNTIME}_CHECK was fully compliant with respect
    to MISRA C Rule 20.7:
    
    "Expressions resulting from the expansion of macro parameters shall be
    enclosed in parentheses."
    
    However, to allow testing function-like macros, parentheses on the "fn"
    parameter were removed and thus new violations of the rule have been
    introduced. Given the usefulness of this functionality,
    it is deemed ok to deviate these two macros for this rule, because
    their scope of (direct) usage is limited to just the file where they
    are defined, and the possibility of misuses is unlikely.
    
    No functional change.
    
    Fixes: bd1664db7b7d ("xen/bitops: Introduce a multiple_bits_set() helper")
    Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/deviations.ecl | 6 ++++++
 docs/misra/deviations.rst                        | 8 ++++++++
 2 files changed, 14 insertions(+)

diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
index 9051f41602..ed80ac7958 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -581,6 +581,12 @@ of this macro do not lead to developer confusion, and can thus be deviated."
 -config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^count_args_$))))"}
 -doc_end
 
+-doc_begin="The argument \"fn\" in macros {COMPILE,RUNTIME}_CHECK is not parenthesized
+on purpose, to be able to test function-like macros. Given the specialized and limited
+use of this macro, it is deemed ok to deviate them."
+-config=MC3R1.R20.7,reports+={deliberate, "any_area(any_loc(any_exp(macro(^(COMPILE_CHECK|RUNTIME_CHECK)$))))"}
+-doc_end
+
 -doc_begin="Uses of variadic macros that have one of their arguments defined as
 a macro and used within the body for both ordinary parameter expansion and as an
 operand to the # or ## operators have a behavior that is well-understood and
diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst
index b66c271c4e..74bb815bf0 100644
--- a/docs/misra/deviations.rst
+++ b/docs/misra/deviations.rst
@@ -534,6 +534,14 @@ Deviations related to MISRA C:2012 Rules:
        refactoring it to add parentheses breaks its functionality.
      - Tagged as `safe` for ECLAIR.
 
+   * - R20.7
+     - The macros `{COMPILE,RUNTIME}_CHECK` defined in
+       `xen/include/xen/self-tests.h` are allowed not to parenthesize the "fn"
+       argument, to allow function-like macros to be tested as well as
+       functions. Given the specialized use of these macros and their limited
+       usage scope, omitting parentheses is deemed unlikely to cause issues.
+     - Tagged as `deliberate` for ECLAIR.
+
    * - R20.12
      - Variadic macros that use token pasting often employ the gcc extension
        `ext_paste_comma`, as detailed in `C-language-toolchain.rst`, which is
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 13 06:55:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Sep 2024 06:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797958.1208030 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0D2-00082H-TO; Fri, 13 Sep 2024 06:55:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797958.1208030; Fri, 13 Sep 2024 06:55:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0D2-000829-Qo; Fri, 13 Sep 2024 06:55:12 +0000
Received: by outflank-mailman (input) for mailman id 797958;
 Fri, 13 Sep 2024 06:55:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0D1-000821-Pp
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:55:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0D1-0007wb-P8
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0D1-0004jm-OC
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sMRNPHEX6jyl02QObPVwXqJwJS+OOv39pmGCHS4X99I=; b=qDAc6rv7uMW8Y+2FBkJsZ8t+4M
	6flSTQYloOxDlDb4SsXYXBPU7Vul9+mjCXCZUOEV8AZldNpPHEyPxCOlua7pqI5ZS6wIVftt0/Gmp
	nlVa5ouVCFo+P79e75N3kst/13OZqUzb+umUGixGqRaysi8EBF9k85ALQ9ecra7czkL0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation/eclair_analysis: deviate linker symbols for Rule 18.2
Message-Id: <E1sp0D1-0004jm-OC@xenbits.xenproject.org>
Date: Fri, 13 Sep 2024 06:55:11 +0000

commit 33888e7aaabc2947aeb6d8b0adcf16c6330b55ba
Author:     Nicola Vetrini <nicola.vetrini@bugseng.com>
AuthorDate: Sat Sep 7 15:03:25 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Sep 11 17:11:09 2024 -0700

    automation/eclair_analysis: deviate linker symbols for Rule 18.2
    
    MISRA C Rule 18.2 states: "Subtraction between pointers shall
    only be applied to pointers that address elements of the same array".
    
    Subtractions between pointer where at least one symbol is a
    symbol defined by the linker are safe and thus deviated, because
    the compiler cannot exploit the undefined behaviour that would
    arise from violating the rules in this case.
    
    To create an ECLAIR configuration that contains the list of
    linker-defined symbols, the script "linker-symbols.sh" is used
    after a build of xen (without static analysis) is performed.
    The generated file "linker_symbols.ecl" is then used as part of the
    static analysis configuration.
    
    Additional changes to the ECLAIR integration are:
    - perform a build of xen without static analysis during prepare.sh
    - run the scripts to generated ECL configuration during the prepare.sh,
      rather than analysis.sh
    - export ECLAIR_PROJECT_ROOT earlier, to allow such generation
    
    Additionally, the macro page_to_mfn performs a subtraction that is safe,
    so its uses are deviated.
    
    No functional changes.
    
    Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/analyze.sh       |  6 -----
 automation/eclair_analysis/ECLAIR/deviations.ecl   | 11 ++++++++
 .../ECLAIR/generate-linker-symbols.sh              | 31 ++++++++++++++++++++++
 automation/eclair_analysis/ECLAIR/generate_ecl.sh  |  3 +++
 automation/eclair_analysis/prepare.sh              |  6 ++++-
 automation/scripts/eclair                          |  3 +++
 docs/misra/deviations.rst                          | 10 +++++++
 7 files changed, 63 insertions(+), 7 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/analyze.sh b/automation/eclair_analysis/ECLAIR/analyze.sh
index e96456c3c1..1dc63c1bc2 100755
--- a/automation/eclair_analysis/ECLAIR/analyze.sh
+++ b/automation/eclair_analysis/ECLAIR/analyze.sh
@@ -73,17 +73,11 @@ export ECLAIR_WORKSPACE="${ECLAIR_DATA_DIR}/eclair_workspace"
 
 # Identifies the particular build of the project.
 export ECLAIR_PROJECT_NAME="XEN_${VARIANT}-${SET}"
-# All paths mentioned in ECLAIR reports that are below this directory
-# will be presented as relative to ECLAIR_PROJECT_ROOT.
-export ECLAIR_PROJECT_ROOT="${PWD}"
 
 # Erase and recreate the output directory and the data directory.
 rm -rf "${ECLAIR_OUTPUT_DIR:?}/*"
 mkdir -p "${ECLAIR_DATA_DIR}"
 
-# Generate additional configuration files 
-"${SCRIPT_DIR}/generate_ecl.sh"
-
 # Perform the build (from scratch) in an ECLAIR environment.
 "${ECLAIR_BIN_DIR}eclair_env" \
     "-config_file='${SCRIPT_DIR}/analysis.ecl'" \
diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
index ed80ac7958..9c3ebc9cc7 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -533,6 +533,17 @@ safe."
 # Series 18.
 #
 
+-doc_begin="Subtractions between pointers involving at least one of the linker symbols specified by the regex below
+are guaranteed not to be exploited by a compiler that relies on the absence of
+C99 Undefined Behaviour 45: Pointers that do not point into, or just beyond, the same array object are subtracted (6.5.6)."
+-eval_file=linker_symbols.ecl
+-config=MC3R1.R18.2,reports+={safe, "any_area(stmt(operator(sub)&&child(lhs||rhs, skip(__non_syntactic_paren_stmts, ref(linker_symbols)))))"}
+-doc_end
+
+-doc_begin="The following macro performs a subtraction between pointers to obtain the mfn, but does not lead to undefined behaviour."
+-config=MC3R1.R18.2,reports+={safe, "any_area(any_loc(any_exp(macro(^page_to_mfn$))))"}
+-doc_end
+
 -doc_begin="Flexible array members are deliberately used and XEN developers are aware of the dangers related to them:
 unexpected result when the structure is given as argument to a sizeof() operator and the truncation in assignment between structures."
 -config=MC3R1.R18.7,reports+={deliberate, "any()"}
diff --git a/automation/eclair_analysis/ECLAIR/generate-linker-symbols.sh b/automation/eclair_analysis/ECLAIR/generate-linker-symbols.sh
new file mode 100755
index 0000000000..19943ba98d
--- /dev/null
+++ b/automation/eclair_analysis/ECLAIR/generate-linker-symbols.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+set -e
+
+script_name="$(basename "$0")"
+script_dir="$(
+  cd "$(dirname "$0")"
+  echo "${PWD}"
+)"
+
+fatal() {
+  echo "${script_name}: $*" >&2
+  exit 1
+}
+
+arch=""
+if [ "${XEN_TARGET_ARCH}" == "x86_64" ]; then
+  arch=x86
+elif [ "${XEN_TARGET_ARCH}" == "arm64" ]; then
+  arch=arm
+else
+  fatal "Unknown configuration: $1"
+fi
+
+outfile=${script_dir}/linker_symbols.ecl
+
+(
+  echo -n "-decl_selector+={linker_symbols, \"^(" >"${outfile}"
+  "${script_dir}/../linker-symbols.sh" "${arch}" | sort -u | tr '\n' '|' | sed '$ s/|//' >>"${outfile}"
+  echo -n ")$\"}" >>"${outfile}"
+)
diff --git a/automation/eclair_analysis/ECLAIR/generate_ecl.sh b/automation/eclair_analysis/ECLAIR/generate_ecl.sh
index 66766b23ab..b955783904 100755
--- a/automation/eclair_analysis/ECLAIR/generate_ecl.sh
+++ b/automation/eclair_analysis/ECLAIR/generate_ecl.sh
@@ -17,3 +17,6 @@ accepted_rst="${ECLAIR_PROJECT_ROOT}/docs/misra/rules.rst"
 
 # Generate accepted guidelines
 "${script_dir}/accepted_guidelines.sh" "${accepted_rst}"
+
+# Generate the list of linker-defined symbols (must be run after a Xen build)
+"${script_dir}/generate-linker-symbols.sh"
diff --git a/automation/eclair_analysis/prepare.sh b/automation/eclair_analysis/prepare.sh
index 47b2a2f32a..3a646414a3 100755
--- a/automation/eclair_analysis/prepare.sh
+++ b/automation/eclair_analysis/prepare.sh
@@ -39,10 +39,14 @@ fi
     cp "${CONFIG_FILE}" xen/.config
     make clean
     find . -type f -name "*.safparse" -print -delete
+    "${script_dir}/build.sh" "$1"
+    # Generate additional configuration files
+    "${script_dir}/ECLAIR/generate_ecl.sh"
+    make clean
     cd xen
     make -f "${script_dir}/Makefile.prepare" prepare
     # Translate the /* SAF-n-safe */ comments into ECLAIR CBTs
     scripts/xen-analysis.py --run-eclair --no-build --no-clean
     # Translate function-properties.json into ECLAIR properties
-    python3 ${script_dir}/propertyparser.py
+    python3 "${script_dir}/propertyparser.py"
 )
diff --git a/automation/scripts/eclair b/automation/scripts/eclair
index 3ec760bab8..0a2353c20a 100755
--- a/automation/scripts/eclair
+++ b/automation/scripts/eclair
@@ -3,6 +3,9 @@
 ECLAIR_ANALYSIS_DIR=automation/eclair_analysis
 ECLAIR_DIR="${ECLAIR_ANALYSIS_DIR}/ECLAIR"
 ECLAIR_OUTPUT_DIR=$(realpath "${ECLAIR_OUTPUT_DIR}")
+# All paths mentioned in ECLAIR reports that are below this directory
+# will be presented as relative to ECLAIR_PROJECT_ROOT.
+export ECLAIR_PROJECT_ROOT="${PWD}"
 
 "${ECLAIR_ANALYSIS_DIR}/prepare.sh" "${VARIANT}"
 
diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst
index 74bb815bf0..247e69e7f1 100644
--- a/docs/misra/deviations.rst
+++ b/docs/misra/deviations.rst
@@ -501,6 +501,16 @@ Deviations related to MISRA C:2012 Rules:
          - __builtin_memset()
          - cpumask_check()
 
+   * - R18.2
+     - Subtractions between pointers where at least one of the operand is a
+       pointer to a symbol defined by the linker are safe.
+     - Tagged as `safe` for ECLAIR.
+
+   * - R18.2
+     - Subtraction between pointers encapsulated by macro page_to_mfn
+       are safe.
+     - Tagged as `safe` for ECLAIR.
+
    * - R20.4
      - The override of the keyword \"inline\" in xen/compiler.h is present so
        that section contents checks pass when the compiler chooses not to
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 13 06:55:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Sep 2024 06:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797959.1208035 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0DD-00086Q-0B; Fri, 13 Sep 2024 06:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797959.1208035; Fri, 13 Sep 2024 06:55:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0DC-00086H-Ti; Fri, 13 Sep 2024 06:55:22 +0000
Received: by outflank-mailman (input) for mailman id 797959;
 Fri, 13 Sep 2024 06:55:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0DB-00085u-Tg
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:55:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0DB-0007x0-Sw
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:55:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0DB-0004md-RG
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:55:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bs0VCgPQtk9AYnqG93FZ81fh//YhLnZXxkaMbEfTXKI=; b=jv9YqUoQKO2d0il57k0tJI+NMC
	cwzNj0Pf51lJGKS1ZbzexQluJCuwE1vOuVVfjl8NHpfIOQTM09kwPB8bCucDpHc7PMG2j030m26aC
	GbkBIDsnTbXNCVYOTFvtH0GLEJecgPmrgLOfjeQbF9/WTqZW80AxUETqEa7+BbLsC+Og=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation/eclair: update configuration of Rule 20.7
Message-Id: <E1sp0DB-0004md-RG@xenbits.xenproject.org>
Date: Fri, 13 Sep 2024 06:55:21 +0000

commit 3c5c9743ca5918e265beb4ec52695e67b07df3d4
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Wed Sep 11 17:34:37 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Sep 11 17:34:37 2024 -0700

    automation/eclair: update configuration of Rule 20.7
    
    MISRA C:2012 Rule 20.7 states that "Expressions resulting from the
    expansion of macro parameters shall be enclosed in parentheses".
    The rational of the rule is that if a macro argument expands to an
    expression, there may be problems related to operator precedence, e.g.,
    
    define M(A, B) A * B
    
    M(1+1, 2+2) will expand to: 1+1 * 2+2
    
    Update ECLAIR configuration to tag as 'safe' the expansions of macro
    arguments surrounded tokens '{', '}' and ';', since in their presence
    problems related to operator precedence can not occur.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/deviations.ecl | 4 ++++
 docs/misra/deviations.rst                        | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
index 9c3ebc9cc7..6679caf3da 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -598,6 +598,10 @@ use of this macro, it is deemed ok to deviate them."
 -config=MC3R1.R20.7,reports+={deliberate, "any_area(any_loc(any_exp(macro(^(COMPILE_CHECK|RUNTIME_CHECK)$))))"}
 -doc_end
 
+-doc_begin="Problems related to operator precedence can not occur if the expansion of the macro argument is surrounded by tokens '{', '}' and ';'."
+-config=MC3R1.R20.7,expansion_context+={safe, "left_right(^[\\{;]$,^[;\\}]$)"}
+-doc_end
+
 -doc_begin="Uses of variadic macros that have one of their arguments defined as
 a macro and used within the body for both ordinary parameter expansion and as an
 operand to the # or ## operators have a behavior that is well-understood and
diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst
index 247e69e7f1..15a993d050 100644
--- a/docs/misra/deviations.rst
+++ b/docs/misra/deviations.rst
@@ -552,6 +552,11 @@ Deviations related to MISRA C:2012 Rules:
        usage scope, omitting parentheses is deemed unlikely to cause issues.
      - Tagged as `deliberate` for ECLAIR.
 
+   * - R20.7
+     - Problems related to operator precedence can not occur if the expansion
+       of the macro argument is surrounded by tokens '{', '}' and ';'.
+     - Tagged as `safe` for ECLAIR.
+
    * - R20.12
      - Variadic macros that use token pasting often employ the gcc extension
        `ext_paste_comma`, as detailed in `C-language-toolchain.rst`, which is
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 13 06:55:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Sep 2024 06:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797960.1208039 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0DN-00089j-1j; Fri, 13 Sep 2024 06:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797960.1208039; Fri, 13 Sep 2024 06:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0DM-00089b-VC; Fri, 13 Sep 2024 06:55:32 +0000
Received: by outflank-mailman (input) for mailman id 797960;
 Fri, 13 Sep 2024 06:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0DM-00089Q-0t
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0DL-0007xB-W0
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:55:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0DL-0004nw-V3
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:55:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bCmIL0mhFDnX3onkakBb8Eh53QdR5P8ePg8cgS9vg9E=; b=0vxAXb8VAkOvSZN+zVCminQoZO
	B9rb5sDKKVV7SsTzC0TYA5+BVn5hdSLVlqhWakeOXh2x0ZYy3UxJLDg2rs8HsV7a/zSAk0UYXCavC
	QVwCwNxtlPnBYcCgNmE9C7RueFzBdpMRZxk4b7mZ5YDzQ08/cPrADRZRHLrQvJ8qmpfc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/bitmap: remove redundant deviations
Message-Id: <E1sp0DL-0004nw-V3@xenbits.xenproject.org>
Date: Fri, 13 Sep 2024 06:55:31 +0000

commit 738db54711e38d5021d87e40192bf69ddc1f8139
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Tue Sep 10 12:50:07 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Sep 11 17:34:59 2024 -0700

    xen/bitmap: remove redundant deviations
    
    Remove comment-based deviations since a project wide deviation that
    cover such cases is present.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/include/xen/bitmap.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/xen/include/xen/bitmap.h b/xen/include/xen/bitmap.h
index 5d668053b0..4b642cd420 100644
--- a/xen/include/xen/bitmap.h
+++ b/xen/include/xen/bitmap.h
@@ -103,13 +103,10 @@ extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order);
 #define bitmap_switch(nbits, zero, small, large)			  \
 	unsigned int n__ = (nbits);					  \
 	if (__builtin_constant_p(nbits) && !n__) {			  \
-		/* SAF-7-safe Rule 20.7 non-parenthesized macro argument */ \
 		zero;							  \
 	} else if (__builtin_constant_p(nbits) && n__ <= BITS_PER_LONG) { \
-		/* SAF-7-safe Rule 20.7 non-parenthesized macro argument */ \
 		small;							  \
 	} else {							  \
-		/* SAF-7-safe Rule 20.7 non-parenthesized macro argument */ \
 		large;							  \
 	}
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 13 06:55:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Sep 2024 06:55:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797962.1208043 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0DX-0008Cw-2y; Fri, 13 Sep 2024 06:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797962.1208043; Fri, 13 Sep 2024 06:55:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0DX-0008Cp-0R; Fri, 13 Sep 2024 06:55:43 +0000
Received: by outflank-mailman (input) for mailman id 797962;
 Fri, 13 Sep 2024 06:55:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0DW-0008Cf-3p
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0DW-0007xM-3F
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0DW-0004p3-1y
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=s4ndtlIeaOCwNOo79YLHBGMo/lJLRKWxH5ifcPQfcZU=; b=MaNIM/K21Eo6EBvh0n77SuAQpb
	yOfQpX7Y9+vhPIBwRt8Asxk3AXEktMvlQ4is1KjctZoGfWkijApFobEXliOzGLF2aRp9LPMWhqYWu
	QQsiYIJM4IrdGoEcN5ALLapCoC1R8Sy3v4XSzH1Xcu4D4gIGZ6MeITZ7O1MYrn5UECeg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation/eclair_analysis: address violation of Rule 20.7
Message-Id: <E1sp0DW-0004p3-1y@xenbits.xenproject.org>
Date: Fri, 13 Sep 2024 06:55:42 +0000

commit 582fade2a9450b1b229123694af515c1a594c358
Author:     Nicola Vetrini <nicola.vetrini@bugseng.com>
AuthorDate: Tue Sep 10 14:43:21 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Sep 11 17:36:16 2024 -0700

    automation/eclair_analysis: address violation of Rule 20.7
    
    MISRA Rule 20.7 states:
    "Expressions resulting from the expansion of macro parameters
    shall be enclosed in parentheses".
    
    The files imported from the gnu-efi package are already deviated, yet
    the macro NextMemoryDescriptor is used in non-excluded code, so a further
    deviation is needed to exclude also any expansion of the macro.
    
    No functional change.
    
    Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/deviations.ecl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
index 6679caf3da..2bb118248b 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -577,7 +577,7 @@ of the IS_ENABLED or STATIC_IF/STATIC_IF_NOT macros, so it always receives a lit
 not in scope for compliance are allowed, as that is imported code."
 -file_tag+={gnu_efi_include, "^xen/include/efi/.*$"}
 -file_tag+={acpi_cpu_idle, "^xen/arch/x86/acpi/cpu_idle\\.c$"}
--config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(file(gnu_efi_include)))"}
+-config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(file(gnu_efi_include)||any_exp(macro(^NextMemoryDescriptor$))))"}
 -config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(file(acpi_cpu_idle)))"}
 -doc_end
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 13 06:55:53 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Sep 2024 06:55:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797963.1208046 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0Dh-0008Fi-4X; Fri, 13 Sep 2024 06:55:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797963.1208046; Fri, 13 Sep 2024 06:55:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0Dh-0008Fa-1x; Fri, 13 Sep 2024 06:55:53 +0000
Received: by outflank-mailman (input) for mailman id 797963;
 Fri, 13 Sep 2024 06:55:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0Dg-0008FU-7k
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:55:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0Dg-0007xb-72
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0Dg-0004qo-6J
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:55:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tf1+rD6aQ/+ErXRnfwDYf1v/ztp+1N8TYcW4gbsayps=; b=yGLvwFM3d17EmE1+lf5DG8ZgHg
	T4u7pL2b19aLVBRmedhN8sBdrJq2xySrC+lDP1Yo80rLvRsiL/YTeGtoVv+EcqHaC36WG56nq6dN7
	3OgC5T3IYjtXJrdVx4sonwdIbzS9Z1M5YQg749GblG3wSvJ17Zb6CRwA/vWdwa8Zozi0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86emul: support CMPccXADD
Message-Id: <E1sp0Dg-0004qo-6J@xenbits.xenproject.org>
Date: Fri, 13 Sep 2024 06:55:52 +0000

commit 3d65f1c0726edc2eee83c69d319ce9bcb4345d3d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 12 09:11:53 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 09:11:53 2024 +0200

    x86emul: support CMPccXADD
    
    Unconditionally wire this through the ->rmw() hook. Since x86_emul_rmw()
    now wants to construct and invoke a stub, make stub_exn available to it
    via a new field in the emulator state structure.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/tests/x86_emulator/predicates.c        | 16 +++++++
 tools/tests/x86_emulator/test_x86_emulator.c | 72 ++++++++++++++++++++++++++++
 tools/tests/x86_emulator/x86-emulate.h       |  1 +
 xen/arch/x86/include/asm/cpufeature.h        |  1 +
 xen/arch/x86/x86_emulate/decode.c            |  3 ++
 xen/arch/x86/x86_emulate/private.h           |  2 +
 xen/arch/x86/x86_emulate/x86_emulate.c       | 53 ++++++++++++++++++++
 xen/include/public/arch-x86/cpufeatureset.h  |  1 +
 xen/tools/gen-cpuid.py                       |  2 +-
 9 files changed, 150 insertions(+), 1 deletion(-)

diff --git a/tools/tests/x86_emulator/predicates.c b/tools/tests/x86_emulator/predicates.c
index 613a1baea2..a688081272 100644
--- a/tools/tests/x86_emulator/predicates.c
+++ b/tools/tests/x86_emulator/predicates.c
@@ -1415,6 +1415,22 @@ static const struct vex {
     { { 0xdd }, 2, T, R, pfx_66, WIG, Ln }, /* vaesenclast */
     { { 0xde }, 2, T, R, pfx_66, WIG, Ln }, /* vaesdec */
     { { 0xdf }, 2, T, R, pfx_66, WIG, Ln }, /* vaesdeclast */
+    { { 0xe0 }, 2, F, W, pfx_66, Wn, L0 }, /* cmpoxadd */
+    { { 0xe1 }, 2, F, W, pfx_66, Wn, L0 }, /* cmpnoxadd */
+    { { 0xe2 }, 2, F, W, pfx_66, Wn, L0 }, /* cmpbxadd */
+    { { 0xe3 }, 2, F, W, pfx_66, Wn, L0 }, /* cmpnbxadd */
+    { { 0xe4 }, 2, F, W, pfx_66, Wn, L0 }, /* cmpexadd */
+    { { 0xe5 }, 2, F, W, pfx_66, Wn, L0 }, /* cmpnexadd */
+    { { 0xe6 }, 2, F, W, pfx_66, Wn, L0 }, /* cmpbexadd */
+    { { 0xe7 }, 2, F, W, pfx_66, Wn, L0 }, /* cmpaxadd */
+    { { 0xe8 }, 2, F, W, pfx_66, Wn, L0 }, /* cmpsxadd */
+    { { 0xe9 }, 2, F, W, pfx_66, Wn, L0 }, /* cmpnsxadd */
+    { { 0xea }, 2, F, W, pfx_66, Wn, L0 }, /* cmppxadd */
+    { { 0xeb }, 2, F, W, pfx_66, Wn, L0 }, /* cmpnpxadd */
+    { { 0xec }, 2, F, W, pfx_66, Wn, L0 }, /* cmplxadd */
+    { { 0xed }, 2, F, W, pfx_66, Wn, L0 }, /* cmpgexadd */
+    { { 0xee }, 2, F, W, pfx_66, Wn, L0 }, /* cmplexadd */
+    { { 0xef }, 2, F, W, pfx_66, Wn, L0 }, /* cmpgxadd */
     { { 0xf2 }, 2, T, R, pfx_no, Wn, L0 }, /* andn */
     { { 0xf3, 0x08 }, 2, T, R, pfx_no, Wn, L0 }, /* blsr */
     { { 0xf3, 0x10 }, 2, T, R, pfx_no, Wn, L0 }, /* blsmsk */
diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index 3a6054441a..24343c5d7f 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -1533,6 +1533,78 @@ int main(int argc, char **argv)
         cpu_policy.x86_vendor = X86_VENDOR_INTEL;
     }
     cpu_policy.x86_vendor = vendor_native;
+
+    printf("%-40s", "Testing cmpbxadd %rbx,%r9,(%rdx)...");
+    if ( stack_exec && cpu_has_cmpccxadd )
+    {
+        instr[0] = 0xc4; instr[1] = 0x62; instr[2] = 0xe1; instr[3] = 0xe2; instr[4] = 0x0a;
+        regs.rip = (unsigned long)&instr[0];
+        regs.eflags = EFLAGS_ALWAYS_SET;
+        res[0] = 0x11223344;
+        res[1] = 0x01020304;
+        regs.rdx = (unsigned long)res;
+        regs.r9  = 0x0001020300112233UL;
+        regs.rbx = 0x0101010101010101UL;
+        rc = x86_emulate(&ctxt, &emulops);
+        if ( (rc != X86EMUL_OKAY) ||
+             (regs.eip != (unsigned long)&instr[5]) ||
+             (regs.r9 != 0x0102030411223344UL) ||
+             (regs.rbx != 0x0101010101010101UL) ||
+             ((regs.eflags & EFLAGS_MASK) !=
+              (X86_EFLAGS_PF | EFLAGS_ALWAYS_SET)) ||
+             (res[0] != 0x11223344) ||
+             (res[1] != 0x01020304) )
+            goto fail;
+
+        regs.rip = (unsigned long)&instr[0];
+        regs.r9 <<= 8;
+        rc = x86_emulate(&ctxt, &emulops);
+        if ( (rc != X86EMUL_OKAY) ||
+             (regs.eip != (unsigned long)&instr[5]) ||
+             (regs.r9 != 0x0102030411223344UL) ||
+             (regs.rbx != 0x0101010101010101UL) ||
+             ((regs.eflags & EFLAGS_MASK) !=
+              (X86_EFLAGS_CF | X86_EFLAGS_PF | X86_EFLAGS_SF |
+               EFLAGS_ALWAYS_SET)) ||
+             (res[0] != 0x12233445) ||
+             (res[1] != 0x02030405) )
+            goto fail;
+        printf("okay\n");
+
+        printf("%-40s", "Testing cmpsxadd %r9d,%ebx,4(%r10)...");
+        instr[1] = 0xc2; instr[2] = 0x31; instr[3] = 0xe8; instr[4] = 0x5a; instr[5] = 0x04;
+        regs.rip = (unsigned long)&instr[0];
+        res[2] = res[0] = ~0;
+        regs.r10 = (unsigned long)res;
+        rc = x86_emulate(&ctxt, &emulops);
+        if ( (rc != X86EMUL_OKAY) ||
+             (regs.eip != (unsigned long)&instr[6]) ||
+             (regs.r9 != 0x0102030411223344UL) ||
+             (regs.rbx != 0x02030405) ||
+             ((regs.eflags & EFLAGS_MASK) != EFLAGS_ALWAYS_SET) ||
+             (res[0] + 1) ||
+             (res[1] != 0x02030405) ||
+             (res[2] + 1) )
+            goto fail;
+
+        regs.rip = (unsigned long)&instr[0];
+        regs.rbx <<= 8;
+        rc = x86_emulate(&ctxt, &emulops);
+        if ( (rc != X86EMUL_OKAY) ||
+             (regs.eip != (unsigned long)&instr[6]) ||
+             (regs.r9 != 0x0102030411223344UL) ||
+             (regs.rbx != 0x02030405) ||
+             ((regs.eflags & EFLAGS_MASK) !=
+              (X86_EFLAGS_CF | X86_EFLAGS_PF | X86_EFLAGS_SF |
+               EFLAGS_ALWAYS_SET)) ||
+             (res[0] + 1) ||
+             (res[1] != 0x13253749) ||
+             (res[2] + 1) )
+            goto fail;
+        printf("okay\n");
+    }
+    else
+        printf("skipped\n");
 #endif /* x86-64 */
 
     printf("%-40s", "Testing shld $1,%ecx,(%edx)...");
diff --git a/tools/tests/x86_emulator/x86-emulate.h b/tools/tests/x86_emulator/x86-emulate.h
index 112ec53d99..00abc829b0 100644
--- a/tools/tests/x86_emulator/x86-emulate.h
+++ b/tools/tests/x86_emulator/x86-emulate.h
@@ -191,6 +191,7 @@ void wrpkru(unsigned int val);
 #define cpu_has_avx_vnni            (cpu_policy.feat.avx_vnni && xcr0_mask(6))
 #define cpu_has_avx512_bf16         (cpu_policy.feat.avx512_bf16 && \
                                      xcr0_mask(0xe6))
+#define cpu_has_cmpccxadd            cpu_policy.feat.cmpccxadd
 #define cpu_has_avx_ifma            (cpu_policy.feat.avx_ifma && xcr0_mask(6))
 #define cpu_has_avx_vnni_int8       (cpu_policy.feat.avx_vnni_int8 && \
                                      xcr0_mask(6))
diff --git a/xen/arch/x86/include/asm/cpufeature.h b/xen/arch/x86/include/asm/cpufeature.h
index dad9ed68aa..3baf9fcdbe 100644
--- a/xen/arch/x86/include/asm/cpufeature.h
+++ b/xen/arch/x86/include/asm/cpufeature.h
@@ -189,6 +189,7 @@ static inline bool boot_cpu_has(unsigned int feat)
 #define cpu_has_sm4             boot_cpu_has(X86_FEATURE_SM4)
 #define cpu_has_avx_vnni        boot_cpu_has(X86_FEATURE_AVX_VNNI)
 #define cpu_has_avx512_bf16     boot_cpu_has(X86_FEATURE_AVX512_BF16)
+#define cpu_has_cmpccxadd       boot_cpu_has(X86_FEATURE_CMPCCXADD)
 #define cpu_has_avx_ifma        boot_cpu_has(X86_FEATURE_AVX_IFMA)
 
 /* CPUID level 0x00000007:1.edx */
diff --git a/xen/arch/x86/x86_emulate/decode.c b/xen/arch/x86/x86_emulate/decode.c
index faaeb2547d..32b9276dc5 100644
--- a/xen/arch/x86/x86_emulate/decode.c
+++ b/xen/arch/x86/x86_emulate/decode.c
@@ -440,6 +440,7 @@ static const struct ext0f38_table {
     [0xda] = { .simd_size = simd_other },
     [0xdb] = { .simd_size = simd_packed_int, .two_op = 1 },
     [0xdc ... 0xdf] = { .simd_size = simd_packed_int, .d8s = d8s_vl },
+    [0xe0 ... 0xef] = { .to_mem = 1 },
     [0xf0] = { .two_op = 1 },
     [0xf1] = { .to_mem = 1, .two_op = 1 },
     [0xf2 ... 0xf3] = {},
@@ -929,6 +930,8 @@ decode_0f38(struct x86_emulate_state *s,
             ctxt->opcode |= MASK_INSR(s->vex.pfx, X86EMUL_OPC_PFX_MASK);
         break;
 
+    case X86EMUL_OPC_VEX_66(0, 0xe0) ...
+         X86EMUL_OPC_VEX_66(0, 0xef): /* cmp<cc>xadd */
     case X86EMUL_OPC_VEX(0, 0xf2):    /* andn */
     case X86EMUL_OPC_VEX(0, 0xf3):    /* Grp 17 */
     case X86EMUL_OPC_VEX(0, 0xf5):    /* bzhi */
diff --git a/xen/arch/x86/x86_emulate/private.h b/xen/arch/x86/x86_emulate/private.h
index f735bb6a5a..172270a458 100644
--- a/xen/arch/x86/x86_emulate/private.h
+++ b/xen/arch/x86/x86_emulate/private.h
@@ -261,6 +261,7 @@ struct x86_emulate_state {
         rmw_btc,
         rmw_btr,
         rmw_bts,
+        rmw_cmpccxadd,
         rmw_dec,
         rmw_inc,
         rmw_neg,
@@ -592,6 +593,7 @@ amd_like(const struct x86_emulate_ctxt *ctxt)
 #define vcpu_has_sm4()         (ctxt->cpuid->feat.sm4)
 #define vcpu_has_avx_vnni()    (ctxt->cpuid->feat.avx_vnni)
 #define vcpu_has_avx512_bf16() (ctxt->cpuid->feat.avx512_bf16)
+#define vcpu_has_cmpccxadd()   (ctxt->cpuid->feat.cmpccxadd)
 #define vcpu_has_wrmsrns()     (ctxt->cpuid->feat.wrmsrns)
 #define vcpu_has_avx_ifma()    (ctxt->cpuid->feat.avx_ifma)
 #define vcpu_has_avx_vnni_int8() (ctxt->cpuid->feat.avx_vnni_int8)
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index e12fbe3100..bbda0ffc2f 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -6811,6 +6811,15 @@ x86_emulate(
 
 #endif /* !X86EMUL_NO_SIMD */
 
+    case X86EMUL_OPC_VEX_66(0x0f38, 0xe0) ...
+         X86EMUL_OPC_VEX_66(0x0f38, 0xef): /* cmp<cc>xadd r,r,m */
+        generate_exception_if(!mode_64bit() || dst.type != OP_MEM || vex.l,
+                              X86_EXC_UD);
+        host_and_vcpu_must_have(cmpccxadd);
+        fail_if(!ops->rmw);
+        state->rmw = rmw_cmpccxadd;
+        break;
+
     case X86EMUL_OPC(0x0f38, 0xf0): /* movbe m,r */
     case X86EMUL_OPC(0x0f38, 0xf1): /* movbe r,m */
         vcpu_must_have(movbe);
@@ -8090,14 +8099,20 @@ x86_emulate(
     {
         ea.val = src.val;
         op_bytes = dst.bytes;
+        state->stub_exn = &stub_exn;
         rc = ops->rmw(dst.mem.seg, dst.mem.off, dst.bytes, &_regs.eflags,
                       state, ctxt);
+#ifdef __XEN__
+        if ( rc == X86EMUL_stub_failure )
+            goto emulation_stub_failure;
+#endif
         if ( rc != X86EMUL_OKAY )
             goto done;
 
         /* Some operations require a register to be written. */
         switch ( state->rmw )
         {
+        case rmw_cmpccxadd:
         case rmw_xchg:
         case rmw_xadd:
             switch ( dst.bytes )
@@ -8372,6 +8387,7 @@ int x86_emul_rmw(
     uint32_t *eflags,
     struct x86_emulate_state *s,
     struct x86_emulate_ctxt *ctxt)
+#define stub_exn (*s->stub_exn) /* for invoke_stub() */
 {
     unsigned long *dst = ptr;
 
@@ -8437,6 +8453,37 @@ int x86_emul_rmw(
 #undef BINOP
 #undef SHIFT
 
+#ifdef __x86_64__
+    case rmw_cmpccxadd:
+    {
+        struct x86_emulate_stub stub = {};
+        uint8_t *buf = get_stub(stub);
+        typeof(s->vex) *pvex = container_of(buf + 1, typeof(s->vex),
+                                            raw[0]);
+        unsigned long dummy;
+
+        buf[0] = 0xc4;
+        *pvex = s->vex;
+        pvex->b = 1;
+        pvex->r = 1;
+        pvex->reg = 0xf; /* rAX */
+        buf[3] = ctxt->opcode;
+        buf[4] = 0x11; /* reg=rDX r/m=(%RCX) */
+        buf[5] = 0xc3;
+
+        *eflags &= ~EFLAGS_MASK;
+        invoke_stub("",
+                    _POST_EFLAGS("[eflags]", "[mask]", "[tmp]"),
+                    "+m" (*dst), "+d" (s->ea.val),
+                    [tmp] "=&r" (dummy), [eflags] "+g" (*eflags)
+                    : "a" (*decode_vex_gpr(s->vex.reg, ctxt->regs, ctxt)),
+                      "c" (dst), [mask] "i" (EFLAGS_MASK));
+
+        put_stub(stub);
+        break;
+    }
+#endif
+
     case rmw_not:
         switch ( s->op_bytes )
         {
@@ -8532,7 +8579,13 @@ int x86_emul_rmw(
 #undef JCXZ
 
     return X86EMUL_OKAY;
+
+#if defined(__XEN__) && defined(__x86_64__)
+ emulation_stub_failure:
+    return X86EMUL_stub_failure;
+#endif
 }
+#undef stub_exn
 
 static void __init __maybe_unused build_assertions(void)
 {
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index adc1fa34cc..8fa3fb711a 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -303,6 +303,7 @@ XEN_CPUFEATURE(SM3,          10*32+ 1) /*A  SM3 Instructions */
 XEN_CPUFEATURE(SM4,          10*32+ 2) /*A  SM4 Instructions */
 XEN_CPUFEATURE(AVX_VNNI,     10*32+ 4) /*A  AVX-VNNI Instructions */
 XEN_CPUFEATURE(AVX512_BF16,  10*32+ 5) /*A  AVX512 BFloat16 Instructions */
+XEN_CPUFEATURE(CMPCCXADD,    10*32+ 7) /*a  CMPccXADD Instructions */
 XEN_CPUFEATURE(FZRM,         10*32+10) /*A  Fast Zero-length REP MOVSB */
 XEN_CPUFEATURE(FSRS,         10*32+11) /*A  Fast Short REP STOSB */
 XEN_CPUFEATURE(FSRCS,        10*32+12) /*A  Fast Short REP CMPSB/SCASB */
diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index f7cad255da..a77cb30bdb 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -274,7 +274,7 @@ def crunch_numbers(state):
         # superpages, PCID and PKU are only available in 4 level paging.
         # NO_LMSL indicates the absense of Long Mode Segment Limits, which
         # have been dropped in hardware.
-        LM: [CX16, PCID, LAHF_LM, PAGE1GB, PKU, NO_LMSL, AMX_TILE],
+        LM: [CX16, PCID, LAHF_LM, PAGE1GB, PKU, NO_LMSL, AMX_TILE, CMPCCXADD],
 
         # AMD K6-2+ and K6-III processors shipped with 3DNow+, beyond the
         # standard 3DNow in the earlier K6 processors.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 13 06:56:03 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Sep 2024 06:56:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797965.1208051 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0Dr-0008IS-5z; Fri, 13 Sep 2024 06:56:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797965.1208051; Fri, 13 Sep 2024 06:56:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0Dr-0008IK-3P; Fri, 13 Sep 2024 06:56:03 +0000
Received: by outflank-mailman (input) for mailman id 797965;
 Fri, 13 Sep 2024 06:56:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0Dq-0008IA-Ag
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:56:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0Dq-0007y2-A5
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:56:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0Dq-0004uN-9E
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:56:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cbGEpomp3uBD2j82igei1j9Q1g7c3yML/DtW2VoW+xI=; b=5xiKwLOIAAtedhR91K7U7MxSrg
	9tP7ywCEzSGaqWwo8KFXXCuAYXkQanCbLBDQx6NoTVrlURFL7pHqugerg/xSs0yd7UxzI3BP2UPg5
	oX5j9XupqQ0lzulT/nSKcEir0ylE7gtIwNd8lxR3I159ix58Oqrl/xBVwK7aLKu5CxGs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HVM: properly reject "indirect" VRAM writes
Message-Id: <E1sp0Dq-0004uN-9E@xenbits.xenproject.org>
Date: Fri, 13 Sep 2024 06:56:02 +0000

commit eb7cd0593d88c4b967a24bca8bd30591966676cd
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 12 09:13:04 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 09:13:04 2024 +0200

    x86/HVM: properly reject "indirect" VRAM writes
    
    While ->count will only be different from 1 for "indirect" (data in
    guest memory) accesses, it being 1 does not exclude the request being an
    "indirect" one. Check both to be on the safe side, and bring the ->count
    part also in line with what ioreq_send_buffered() actually refuses to
    handle.
    
    Fixes: 3bbaaec09b1b ("x86/hvm: unify stdvga mmio intercept with standard mmio intercept")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/stdvga.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index afd2ca95d6..2520d0dd01 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -498,13 +498,13 @@ static bool cf_check stdvga_mem_accept(
 
     spin_lock(&s->lock);
 
-    if ( p->dir == IOREQ_WRITE && p->count > 1 )
+    if ( p->dir == IOREQ_WRITE && (p->data_is_ptr || p->count != 1) )
     {
         /*
          * We cannot return X86EMUL_UNHANDLEABLE on anything other then the
          * first cycle of an I/O. So, since we cannot guarantee to always be
          * able to send buffered writes, we have to reject any multi-cycle
-         * I/O.
+         * or "indirect" I/O.
          */
         goto reject;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 13 06:56:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Sep 2024 06:56:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797966.1208054 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0E1-0008Ll-8g; Fri, 13 Sep 2024 06:56:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797966.1208054; Fri, 13 Sep 2024 06:56:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0E1-0008Lc-6C; Fri, 13 Sep 2024 06:56:13 +0000
Received: by outflank-mailman (input) for mailman id 797966;
 Fri, 13 Sep 2024 06:56:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0E0-0008LU-Di
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:56:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0E0-0007yC-D5
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:56:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0E0-0004vc-CG
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:56:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Nr/YITbyc6FvjSVulF+mpQcH1zFrWINEbdQGTvFgQk0=; b=0Rt4qTHUghyNbGC2M485Dj6UX2
	93ASYF/PVMuVMRW3iyt5QGXNL3WHQI8WZqPIigyWqk97aks+18bRw8l6R4v7eH481YcSBBM1CmxN1
	thXXbDzT0yEBc0ryJj2ufQM+7EAeJQyTvdWFCxjraxWjHaa3eI4nmtmlENAZPJB19vq0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HVM: drop stdvga's "stdvga" struct member
Message-Id: <E1sp0E0-0004vc-CG@xenbits.xenproject.org>
Date: Fri, 13 Sep 2024 06:56:12 +0000

commit b740a9369e81bdda675a9780130ce2b9e75d4ec9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 12 09:13:27 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 09:13:27 2024 +0200

    x86/HVM: drop stdvga's "stdvga" struct member
    
    Two of its consumers are dead (in compile-time constant conditionals)
    and the only remaining ones are merely controlling debug logging. Hence
    the field is now pointless to set, which in particular allows to get rid
    of the questionable conditional from which the field's value was
    established (afaict 551ceee97513 ["x86, hvm: stdvga cache always on"]
    had dropped too much of the earlier extra check that was there, and
    quite likely further checks were missing).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/stdvga.c         | 30 +++++-------------------------
 xen/arch/x86/include/asm/hvm/io.h |  1 -
 2 files changed, 5 insertions(+), 26 deletions(-)

diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index 2520d0dd01..8a9ce05346 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -103,7 +103,7 @@ static void vram_put(struct hvm_hw_stdvga *s, void *p)
 static int stdvga_outb(uint64_t addr, uint8_t val)
 {
     struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
-    int rc = 1, prev_stdvga = s->stdvga;
+    int rc = 1;
 
     switch ( addr )
     {
@@ -132,19 +132,6 @@ static int stdvga_outb(uint64_t addr, uint8_t val)
         break;
     }
 
-    /* When in standard vga mode, emulate here all writes to the vram buffer
-     * so we can immediately satisfy reads without waiting for qemu. */
-    s->stdvga = (s->sr[7] == 0x00);
-
-    if ( !prev_stdvga && s->stdvga )
-    {
-        gdprintk(XENLOG_INFO, "entering stdvga mode\n");
-    }
-    else if ( prev_stdvga && !s->stdvga )
-    {
-        gdprintk(XENLOG_INFO, "leaving stdvga mode\n");
-    }
-
     return rc;
 }
 
@@ -425,7 +412,6 @@ static int cf_check stdvga_mem_write(
     const struct hvm_io_handler *handler, uint64_t addr, uint32_t size,
     uint64_t data)
 {
-    struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
     ioreq_t p = {
         .type = IOREQ_TYPE_COPY,
         .addr = addr,
@@ -436,8 +422,7 @@ static int cf_check stdvga_mem_write(
     };
     struct ioreq_server *srv;
 
-    if ( true || !s->stdvga )
-        goto done;
+    goto done;
 
     /* Intercept mmio write */
     switch ( size )
@@ -498,19 +483,14 @@ static bool cf_check stdvga_mem_accept(
 
     spin_lock(&s->lock);
 
-    if ( p->dir == IOREQ_WRITE && (p->data_is_ptr || p->count != 1) )
+    if ( p->dir != IOREQ_WRITE || p->data_is_ptr || p->count != 1 )
     {
         /*
-         * We cannot return X86EMUL_UNHANDLEABLE on anything other then the
-         * first cycle of an I/O. So, since we cannot guarantee to always be
-         * able to send buffered writes, we have to reject any multi-cycle
-         * or "indirect" I/O.
+         * Only accept single direct writes, as that's the only thing we can
+         * accelerate using buffered ioreq handling.
          */
         goto reject;
     }
-    else if ( p->dir == IOREQ_READ &&
-              (true || !s->stdvga) )
-        goto reject;
 
     /* s->lock intentionally held */
     return 1;
diff --git a/xen/arch/x86/include/asm/hvm/io.h b/xen/arch/x86/include/asm/hvm/io.h
index ce171eaca4..67f4d033a7 100644
--- a/xen/arch/x86/include/asm/hvm/io.h
+++ b/xen/arch/x86/include/asm/hvm/io.h
@@ -115,7 +115,6 @@ struct hvm_hw_stdvga {
     uint8_t sr[8];
     uint8_t gr_index;
     uint8_t gr[9];
-    bool stdvga;
     uint32_t latch;
     struct page_info *vram_page[64];  /* shadow of 0xa0000-0xaffff */
     spinlock_t lock;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 13 06:56:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Sep 2024 06:56:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797970.1208069 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0EB-0000EK-I0; Fri, 13 Sep 2024 06:56:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797970.1208069; Fri, 13 Sep 2024 06:56:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0EB-0000ED-FI; Fri, 13 Sep 2024 06:56:23 +0000
Received: by outflank-mailman (input) for mailman id 797970;
 Fri, 13 Sep 2024 06:56:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0EA-0000DZ-Gi
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:56:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0EA-0007yv-G1
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:56:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0EA-0004yD-FE
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:56:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xtawcvjt02z73rHOY5iFmlU7hpQAjJi3NXx1/GWB+Ls=; b=cLq0S4NC+yEsR6EH6waGAVpTu/
	pLosjAyGMnrt20uDzGMJz8j/eSbhsVk8fuLIySEGp2U3Ge/6Uv216FdU8H9gIoRBDzzIKDA6moi7N
	scCFbIpS0uTE+pucNkMGbVfF/6MSywHxLL6JQ9ohkPstJdbgnH6Ntebo8LQ3eC4KVOus=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HVM: remove unused MMIO handling code
Message-Id: <E1sp0EA-0004yD-FE@xenbits.xenproject.org>
Date: Fri, 13 Sep 2024 06:56:22 +0000

commit 89108547af1f230b72893b48351f9c1106189649
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 12 09:13:57 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 09:13:57 2024 +0200

    x86/HVM: remove unused MMIO handling code
    
    All read accesses are rejected by the ->accept handler, while writes
    bypass the bulk of the function body. Drop the dead code, leaving an
    assertion in the read handler.
    
    A number of other static items (and a macro) are then unreferenced and
    hence also need (want) dropping. The same applies to the "latch" field
    of the state structure.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/stdvga.c         | 317 +-------------------------------------
 xen/arch/x86/include/asm/hvm/io.h |   1 -
 2 files changed, 4 insertions(+), 314 deletions(-)

diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index 8a9ce05346..0f0bd10068 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -37,26 +37,6 @@
 #define VGA_MEM_BASE 0xa0000
 #define VGA_MEM_SIZE 0x20000
 
-#define PAT(x) (x)
-static const uint32_t mask16[16] = {
-    PAT(0x00000000U),
-    PAT(0x000000ffU),
-    PAT(0x0000ff00U),
-    PAT(0x0000ffffU),
-    PAT(0x00ff0000U),
-    PAT(0x00ff00ffU),
-    PAT(0x00ffff00U),
-    PAT(0x00ffffffU),
-    PAT(0xff000000U),
-    PAT(0xff0000ffU),
-    PAT(0xff00ff00U),
-    PAT(0xff00ffffU),
-    PAT(0xffff0000U),
-    PAT(0xffff00ffU),
-    PAT(0xffffff00U),
-    PAT(0xffffffffU),
-};
-
 /* force some bits to zero */
 static const uint8_t sr_mask[8] = {
     (uint8_t)~0xfc,
@@ -81,25 +61,6 @@ static const uint8_t gr_mask[9] = {
     (uint8_t)~0x00, /* 0x08 */
 };
 
-static uint8_t *vram_getb(struct hvm_hw_stdvga *s, unsigned int a)
-{
-    struct page_info *pg = s->vram_page[(a >> 12) & 0x3f];
-    uint8_t *p = __map_domain_page(pg);
-    return &p[a & 0xfff];
-}
-
-static uint32_t *vram_getl(struct hvm_hw_stdvga *s, unsigned int a)
-{
-    struct page_info *pg = s->vram_page[(a >> 10) & 0x3f];
-    uint32_t *p = __map_domain_page(pg);
-    return &p[a & 0x3ff];
-}
-
-static void vram_put(struct hvm_hw_stdvga *s, void *p)
-{
-    unmap_domain_page(p);
-}
-
 static int stdvga_outb(uint64_t addr, uint8_t val)
 {
     struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
@@ -168,244 +129,13 @@ static int cf_check stdvga_intercept_pio(
     return X86EMUL_UNHANDLEABLE; /* propagate to external ioemu */
 }
 
-static unsigned int stdvga_mem_offset(
-    struct hvm_hw_stdvga *s, unsigned int mmio_addr)
-{
-    unsigned int memory_map_mode = (s->gr[6] >> 2) & 3;
-    unsigned int offset = mmio_addr & 0x1ffff;
-
-    switch ( memory_map_mode )
-    {
-    case 0:
-        break;
-    case 1:
-        if ( offset >= 0x10000 )
-            goto fail;
-        offset += 0; /* assume bank_offset == 0; */
-        break;
-    case 2:
-        offset -= 0x10000;
-        if ( offset >= 0x8000 )
-            goto fail;
-        break;
-    default:
-    case 3:
-        offset -= 0x18000;
-        if ( offset >= 0x8000 )
-            goto fail;
-        break;
-    }
-
-    return offset;
-
- fail:
-    return ~0u;
-}
-
-#define GET_PLANE(data, p) (((data) >> ((p) * 8)) & 0xff)
-
-static uint8_t stdvga_mem_readb(uint64_t addr)
-{
-    struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
-    int plane;
-    uint32_t ret, *vram_l;
-    uint8_t *vram_b;
-
-    addr = stdvga_mem_offset(s, addr);
-    if ( addr == ~0u )
-        return 0xff;
-
-    if ( s->sr[4] & 0x08 )
-    {
-        /* chain 4 mode : simplest access */
-        vram_b = vram_getb(s, addr);
-        ret = *vram_b;
-        vram_put(s, vram_b);
-    }
-    else if ( s->gr[5] & 0x10 )
-    {
-        /* odd/even mode (aka text mode mapping) */
-        plane = (s->gr[4] & 2) | (addr & 1);
-        vram_b = vram_getb(s, ((addr & ~1) << 1) | plane);
-        ret = *vram_b;
-        vram_put(s, vram_b);
-    }
-    else
-    {
-        /* standard VGA latched access */
-        vram_l = vram_getl(s, addr);
-        s->latch = *vram_l;
-        vram_put(s, vram_l);
-
-        if ( !(s->gr[5] & 0x08) )
-        {
-            /* read mode 0 */
-            plane = s->gr[4];
-            ret = GET_PLANE(s->latch, plane);
-        }
-        else
-        {
-            /* read mode 1 */
-            ret = (s->latch ^ mask16[s->gr[2]]) & mask16[s->gr[7]];
-            ret |= ret >> 16;
-            ret |= ret >> 8;
-            ret = (~ret) & 0xff;
-        }
-    }
-
-    return ret;
-}
-
 static int cf_check stdvga_mem_read(
     const struct hvm_io_handler *handler, uint64_t addr, uint32_t size,
     uint64_t *p_data)
 {
-    uint64_t data = ~0UL;
-
-    switch ( size )
-    {
-    case 1:
-        data = stdvga_mem_readb(addr);
-        break;
-
-    case 2:
-        data = stdvga_mem_readb(addr);
-        data |= stdvga_mem_readb(addr + 1) << 8;
-        break;
-
-    case 4:
-        data = stdvga_mem_readb(addr);
-        data |= stdvga_mem_readb(addr + 1) << 8;
-        data |= stdvga_mem_readb(addr + 2) << 16;
-        data |= (uint32_t)stdvga_mem_readb(addr + 3) << 24;
-        break;
-
-    case 8:
-        data =  (uint64_t)(stdvga_mem_readb(addr));
-        data |= (uint64_t)(stdvga_mem_readb(addr + 1)) << 8;
-        data |= (uint64_t)(stdvga_mem_readb(addr + 2)) << 16;
-        data |= (uint64_t)(stdvga_mem_readb(addr + 3)) << 24;
-        data |= (uint64_t)(stdvga_mem_readb(addr + 4)) << 32;
-        data |= (uint64_t)(stdvga_mem_readb(addr + 5)) << 40;
-        data |= (uint64_t)(stdvga_mem_readb(addr + 6)) << 48;
-        data |= (uint64_t)(stdvga_mem_readb(addr + 7)) << 56;
-        break;
-
-    default:
-        gdprintk(XENLOG_WARNING, "invalid io size: %u\n", size);
-        break;
-    }
-
-    *p_data = data;
-    return X86EMUL_OKAY;
-}
-
-static void stdvga_mem_writeb(uint64_t addr, uint32_t val)
-{
-    struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
-    int plane, write_mode, b, func_select, mask;
-    uint32_t write_mask, bit_mask, set_mask, *vram_l;
-    uint8_t *vram_b;
-
-    addr = stdvga_mem_offset(s, addr);
-    if ( addr == ~0u )
-        return;
-
-    if ( s->sr[4] & 0x08 )
-    {
-        /* chain 4 mode : simplest access */
-        plane = addr & 3;
-        mask = (1 << plane);
-        if ( s->sr[2] & mask )
-        {
-            vram_b = vram_getb(s, addr);
-            *vram_b = val;
-            vram_put(s, vram_b);
-        }
-    }
-    else if ( s->gr[5] & 0x10 )
-    {
-        /* odd/even mode (aka text mode mapping) */
-        plane = (s->gr[4] & 2) | (addr & 1);
-        mask = (1 << plane);
-        if ( s->sr[2] & mask )
-        {
-            addr = ((addr & ~1) << 1) | plane;
-            vram_b = vram_getb(s, addr);
-            *vram_b = val;
-            vram_put(s, vram_b);
-        }
-    }
-    else
-    {
-        write_mode = s->gr[5] & 3;
-        switch ( write_mode )
-        {
-        default:
-        case 0:
-            /* rotate */
-            b = s->gr[3] & 7;
-            val = ((val >> b) | (val << (8 - b))) & 0xff;
-            val |= val << 8;
-            val |= val << 16;
-
-            /* apply set/reset mask */
-            set_mask = mask16[s->gr[1]];
-            val = (val & ~set_mask) | (mask16[s->gr[0]] & set_mask);
-            bit_mask = s->gr[8];
-            break;
-        case 1:
-            val = s->latch;
-            goto do_write;
-        case 2:
-            val = mask16[val & 0x0f];
-            bit_mask = s->gr[8];
-            break;
-        case 3:
-            /* rotate */
-            b = s->gr[3] & 7;
-            val = (val >> b) | (val << (8 - b));
-
-            bit_mask = s->gr[8] & val;
-            val = mask16[s->gr[0]];
-            break;
-        }
-
-        /* apply logical operation */
-        func_select = s->gr[3] >> 3;
-        switch ( func_select )
-        {
-        case 0:
-        default:
-            /* nothing to do */
-            break;
-        case 1:
-            /* and */
-            val &= s->latch;
-            break;
-        case 2:
-            /* or */
-            val |= s->latch;
-            break;
-        case 3:
-            /* xor */
-            val ^= s->latch;
-            break;
-        }
-
-        /* apply bit mask */
-        bit_mask |= bit_mask << 8;
-        bit_mask |= bit_mask << 16;
-        val = (val & bit_mask) | (s->latch & ~bit_mask);
-
-    do_write:
-        /* mask data according to sr[2] */
-        mask = s->sr[2];
-        write_mask = mask16[mask];
-        vram_l = vram_getl(s, addr);
-        *vram_l = (*vram_l & ~write_mask) | (val & write_mask);
-        vram_put(s, vram_l);
-    }
+    ASSERT_UNREACHABLE();
+    *p_data = ~0;
+    return X86EMUL_UNHANDLEABLE;
 }
 
 static int cf_check stdvga_mem_write(
@@ -420,47 +150,8 @@ static int cf_check stdvga_mem_write(
         .dir = IOREQ_WRITE,
         .data = data,
     };
-    struct ioreq_server *srv;
-
-    goto done;
-
-    /* Intercept mmio write */
-    switch ( size )
-    {
-    case 1:
-        stdvga_mem_writeb(addr, (data >>  0) & 0xff);
-        break;
-
-    case 2:
-        stdvga_mem_writeb(addr+0, (data >>  0) & 0xff);
-        stdvga_mem_writeb(addr+1, (data >>  8) & 0xff);
-        break;
-
-    case 4:
-        stdvga_mem_writeb(addr+0, (data >>  0) & 0xff);
-        stdvga_mem_writeb(addr+1, (data >>  8) & 0xff);
-        stdvga_mem_writeb(addr+2, (data >> 16) & 0xff);
-        stdvga_mem_writeb(addr+3, (data >> 24) & 0xff);
-        break;
-
-    case 8:
-        stdvga_mem_writeb(addr+0, (data >>  0) & 0xff);
-        stdvga_mem_writeb(addr+1, (data >>  8) & 0xff);
-        stdvga_mem_writeb(addr+2, (data >> 16) & 0xff);
-        stdvga_mem_writeb(addr+3, (data >> 24) & 0xff);
-        stdvga_mem_writeb(addr+4, (data >> 32) & 0xff);
-        stdvga_mem_writeb(addr+5, (data >> 40) & 0xff);
-        stdvga_mem_writeb(addr+6, (data >> 48) & 0xff);
-        stdvga_mem_writeb(addr+7, (data >> 56) & 0xff);
-        break;
-
-    default:
-        gdprintk(XENLOG_WARNING, "invalid io size: %u\n", size);
-        break;
-    }
+    struct ioreq_server *srv = ioreq_server_select(current->domain, &p);
 
- done:
-    srv = ioreq_server_select(current->domain, &p);
     if ( !srv )
         return X86EMUL_UNHANDLEABLE;
 
diff --git a/xen/arch/x86/include/asm/hvm/io.h b/xen/arch/x86/include/asm/hvm/io.h
index 67f4d033a7..91714f3614 100644
--- a/xen/arch/x86/include/asm/hvm/io.h
+++ b/xen/arch/x86/include/asm/hvm/io.h
@@ -115,7 +115,6 @@ struct hvm_hw_stdvga {
     uint8_t sr[8];
     uint8_t gr_index;
     uint8_t gr[9];
-    uint32_t latch;
     struct page_info *vram_page[64];  /* shadow of 0xa0000-0xaffff */
     spinlock_t lock;
 };
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 13 06:56:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Sep 2024 06:56:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797972.1208072 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0EL-0000ZX-JU; Fri, 13 Sep 2024 06:56:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797972.1208072; Fri, 13 Sep 2024 06:56:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0EL-0000ZQ-H3; Fri, 13 Sep 2024 06:56:33 +0000
Received: by outflank-mailman (input) for mailman id 797972;
 Fri, 13 Sep 2024 06:56:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0EK-0000ZA-Jj
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:56:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0EK-0007z8-J0
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:56:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0EK-0004zp-ID
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:56:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/vBvaT++xYX/N2ZxSOmVOjmhuk9KICySowXc/nUxsjg=; b=yEXOM6J+hlYWc9fxs4ZbB7cDpW
	vMyDvtaKyArUGfaYktL56jel6DMgHREVondhLsUFZHGy0jcfT6JSPGX3JnetN0nytSy35Jha+cfUf
	7ka+/Zclycaw9jzqc3Alu9OSYTsGRz44NLK7kE7jbf5jeBVOi7PE0bVXdcEViPsPQwus=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HVM: drop stdvga's "gr[]" struct member
Message-Id: <E1sp0EK-0004zp-ID@xenbits.xenproject.org>
Date: Fri, 13 Sep 2024 06:56:32 +0000

commit b16c0966a17f19c0e55ed0b9baa28191d2590178
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 12 09:14:27 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 09:14:27 2024 +0200

    x86/HVM: drop stdvga's "gr[]" struct member
    
    No consumers are left, hence the producer and the array itself can also
    go away. The static gr_mask[] is then orphaned and hence needs dropping,
    too.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/stdvga.c         | 18 ------------------
 xen/arch/x86/include/asm/hvm/io.h |  1 -
 2 files changed, 19 deletions(-)

diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index 0f0bd10068..fa25833caa 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -49,18 +49,6 @@ static const uint8_t sr_mask[8] = {
     (uint8_t)~0x00,
 };
 
-static const uint8_t gr_mask[9] = {
-    (uint8_t)~0xf0, /* 0x00 */
-    (uint8_t)~0xf0, /* 0x01 */
-    (uint8_t)~0xf0, /* 0x02 */
-    (uint8_t)~0xe0, /* 0x03 */
-    (uint8_t)~0xfc, /* 0x04 */
-    (uint8_t)~0x84, /* 0x05 */
-    (uint8_t)~0xf0, /* 0x06 */
-    (uint8_t)~0xf0, /* 0x07 */
-    (uint8_t)~0x00, /* 0x08 */
-};
-
 static int stdvga_outb(uint64_t addr, uint8_t val)
 {
     struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
@@ -82,12 +70,6 @@ static int stdvga_outb(uint64_t addr, uint8_t val)
         s->gr_index = val;
         break;
 
-    case 0x3cf:                 /* graphics data register */
-        rc = (s->gr_index < sizeof(s->gr));
-        if ( rc )
-            s->gr[s->gr_index] = val & gr_mask[s->gr_index];
-        break;
-
     default:
         rc = 0;
         break;
diff --git a/xen/arch/x86/include/asm/hvm/io.h b/xen/arch/x86/include/asm/hvm/io.h
index 91714f3614..126622e53c 100644
--- a/xen/arch/x86/include/asm/hvm/io.h
+++ b/xen/arch/x86/include/asm/hvm/io.h
@@ -114,7 +114,6 @@ struct hvm_hw_stdvga {
     uint8_t sr_index;
     uint8_t sr[8];
     uint8_t gr_index;
-    uint8_t gr[9];
     struct page_info *vram_page[64];  /* shadow of 0xa0000-0xaffff */
     spinlock_t lock;
 };
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 13 06:56:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Sep 2024 06:56:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797974.1208076 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0EW-0000gA-LA; Fri, 13 Sep 2024 06:56:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797974.1208076; Fri, 13 Sep 2024 06:56:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0EW-0000g2-Id; Fri, 13 Sep 2024 06:56:44 +0000
Received: by outflank-mailman (input) for mailman id 797974;
 Fri, 13 Sep 2024 06:56:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0EU-0000fk-Mh
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:56:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0EU-0007zK-Ly
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:56:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0EU-00050c-LC
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:56:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mwEQbdna/lq/BthnlUwaUY0ojqvdigKijJyEfZ5ZU/E=; b=q/B2orO2rh3SSGPYQfDnl42yu1
	uV4vGUR2JHj2VqLhGs/2C3Gd6w1T/zJJzXS4p2lkDJpg7xp5+wOXW3zMhhsGX1QTvYSCpD9vhgvOU
	hS9TBDZY4b6TBBdzr+06R8Ju8jVfwMAATQABwL5y5ssExt4MQjyKnXSVUcsG37PH4GZg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HVM: drop stdvga's "sr[]" struct member
Message-Id: <E1sp0EU-00050c-LC@xenbits.xenproject.org>
Date: Fri, 13 Sep 2024 06:56:42 +0000

commit 7aba44bdd78aedb97703811948c3b69ccff85032
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 12 09:14:55 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 09:14:55 2024 +0200

    x86/HVM: drop stdvga's "sr[]" struct member
    
    No consumers are left, hence the producer and the array itself can also
    go away. The static sr_mask[] is then orphaned and hence needs dropping,
    too.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/stdvga.c         | 18 ------------------
 xen/arch/x86/include/asm/hvm/io.h |  1 -
 2 files changed, 19 deletions(-)

diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index fa25833caa..5523a441dd 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -37,18 +37,6 @@
 #define VGA_MEM_BASE 0xa0000
 #define VGA_MEM_SIZE 0x20000
 
-/* force some bits to zero */
-static const uint8_t sr_mask[8] = {
-    (uint8_t)~0xfc,
-    (uint8_t)~0xc2,
-    (uint8_t)~0xf0,
-    (uint8_t)~0xc0,
-    (uint8_t)~0xf1,
-    (uint8_t)~0xff,
-    (uint8_t)~0xff,
-    (uint8_t)~0x00,
-};
-
 static int stdvga_outb(uint64_t addr, uint8_t val)
 {
     struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
@@ -60,12 +48,6 @@ static int stdvga_outb(uint64_t addr, uint8_t val)
         s->sr_index = val;
         break;
 
-    case 0x3c5:                 /* sequencer data register */
-        rc = (s->sr_index < sizeof(s->sr));
-        if ( rc )
-            s->sr[s->sr_index] = val & sr_mask[s->sr_index] ;
-        break;
-
     case 0x3ce:                 /* graphics address register */
         s->gr_index = val;
         break;
diff --git a/xen/arch/x86/include/asm/hvm/io.h b/xen/arch/x86/include/asm/hvm/io.h
index 126622e53c..3e9079eab6 100644
--- a/xen/arch/x86/include/asm/hvm/io.h
+++ b/xen/arch/x86/include/asm/hvm/io.h
@@ -112,7 +112,6 @@ struct vpci_arch_msix_entry {
 
 struct hvm_hw_stdvga {
     uint8_t sr_index;
-    uint8_t sr[8];
     uint8_t gr_index;
     struct page_info *vram_page[64];  /* shadow of 0xa0000-0xaffff */
     spinlock_t lock;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 13 06:56:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Sep 2024 06:56:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797976.1208081 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0Eg-0000j0-Mv; Fri, 13 Sep 2024 06:56:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797976.1208081; Fri, 13 Sep 2024 06:56:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0Eg-0000it-K8; Fri, 13 Sep 2024 06:56:54 +0000
Received: by outflank-mailman (input) for mailman id 797976;
 Fri, 13 Sep 2024 06:56:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0Ee-0000ie-PR
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:56:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0Ee-0007zZ-Om
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:56:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0Ee-00051U-O8
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:56:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4tgVk2TqvbWXbtg/OCbilZbglmFqWIMexpjIFpVQcr8=; b=fFaWB6B+KPSBdz6gAGPcGOLjES
	0SGfs/JEA+sq6l6MIzK+W5HMyFjCbmahqOzGZIGjkGlZw98BQnvsKSYlswZlnGHNzUBsk7bfbrzAo
	z4h9e3DyK7aRC/k6cxC2oBRJS4wznu0XD9HQVkbAftzCQkdb2yydb4Kv7MwaW7hDFTQE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HVM: drop stdvga's "{g,s}r_index" struct members
Message-Id: <E1sp0Ee-00051U-O8@xenbits.xenproject.org>
Date: Fri, 13 Sep 2024 06:56:52 +0000

commit 86c03372e107f5c18266a62281663861b1144929
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 12 09:15:23 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 09:15:23 2024 +0200

    x86/HVM: drop stdvga's "{g,s}r_index" struct members
    
    No consumers are left, hence the producer and the fields themselves can
    also go away. stdvga_outb() is then useless, rendering stdvga_out()
    useless as well. Hence the entire I/O port intercept can go away.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/stdvga.c         | 61 ---------------------------------------
 xen/arch/x86/include/asm/hvm/io.h |  2 --
 2 files changed, 63 deletions(-)

diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index 5523a441dd..155a67a438 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -37,62 +37,6 @@
 #define VGA_MEM_BASE 0xa0000
 #define VGA_MEM_SIZE 0x20000
 
-static int stdvga_outb(uint64_t addr, uint8_t val)
-{
-    struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
-    int rc = 1;
-
-    switch ( addr )
-    {
-    case 0x3c4:                 /* sequencer address register */
-        s->sr_index = val;
-        break;
-
-    case 0x3ce:                 /* graphics address register */
-        s->gr_index = val;
-        break;
-
-    default:
-        rc = 0;
-        break;
-    }
-
-    return rc;
-}
-
-static void stdvga_out(uint32_t port, uint32_t bytes, uint32_t val)
-{
-    switch ( bytes )
-    {
-    case 1:
-        stdvga_outb(port, val);
-        break;
-
-    case 2:
-        stdvga_outb(port + 0, val >> 0);
-        stdvga_outb(port + 1, val >> 8);
-        break;
-
-    default:
-        break;
-    }
-}
-
-static int cf_check stdvga_intercept_pio(
-    int dir, unsigned int port, unsigned int bytes, uint32_t *val)
-{
-    struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
-
-    if ( dir == IOREQ_WRITE )
-    {
-        spin_lock(&s->lock);
-        stdvga_out(port, bytes, *val);
-        spin_unlock(&s->lock);
-    }
-
-    return X86EMUL_UNHANDLEABLE; /* propagate to external ioemu */
-}
-
 static int cf_check stdvga_mem_read(
     const struct hvm_io_handler *handler, uint64_t addr, uint32_t size,
     uint64_t *p_data)
@@ -194,11 +138,6 @@ void stdvga_init(struct domain *d)
     {
         struct hvm_io_handler *handler;
 
-        /* Sequencer registers. */
-        register_portio_handler(d, 0x3c4, 2, stdvga_intercept_pio);
-        /* Graphics registers. */
-        register_portio_handler(d, 0x3ce, 2, stdvga_intercept_pio);
-
         /* VGA memory */
         handler = hvm_next_io_handler(d);
 
diff --git a/xen/arch/x86/include/asm/hvm/io.h b/xen/arch/x86/include/asm/hvm/io.h
index 3e9079eab6..bf9ddfc70e 100644
--- a/xen/arch/x86/include/asm/hvm/io.h
+++ b/xen/arch/x86/include/asm/hvm/io.h
@@ -111,8 +111,6 @@ struct vpci_arch_msix_entry {
 };
 
 struct hvm_hw_stdvga {
-    uint8_t sr_index;
-    uint8_t gr_index;
     struct page_info *vram_page[64];  /* shadow of 0xa0000-0xaffff */
     spinlock_t lock;
 };
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 13 06:57:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Sep 2024 06:57:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797977.1208085 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0Eq-0000ms-Ps; Fri, 13 Sep 2024 06:57:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797977.1208085; Fri, 13 Sep 2024 06:57:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0Eq-0000mi-Mu; Fri, 13 Sep 2024 06:57:04 +0000
Received: by outflank-mailman (input) for mailman id 797977;
 Fri, 13 Sep 2024 06:57:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0Eo-0000mQ-SJ
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:57:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0Eo-0007zw-Rh
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:57:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0Eo-00052g-R7
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:57:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bEJ2HeUgZ5dGG1a9hSIJCd+IYIsMRy2Q3C46kvznfJU=; b=VUyza4hAl0h/Q2xVNrJWq3rIyQ
	OAZgR2Ao4/g5YWEtlK6kc8aG5uEpXUWfJl/Ywrd+qPVI8w6FIqGU5yEgGblIG0V/1gQuXQOWB3K+8
	A5y6hUq4RswGiO5ChaNBdRw3dyakYp8cqtcaUxsgmyv/ANkzp9TDdnyVXuvQF4ZEOwEI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HVM: drop stdvga's "vram_page[]" struct member
Message-Id: <E1sp0Eo-00052g-R7@xenbits.xenproject.org>
Date: Fri, 13 Sep 2024 06:57:02 +0000

commit 3beb4baf2a0a2eef40d39eb7e6eecbfd36da5d14
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 12 09:15:52 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 09:15:52 2024 +0200

    x86/HVM: drop stdvga's "vram_page[]" struct member
    
    No uses are left, hence its setup, teardown, and the field itself can
    also go away. stdvga_deinit() is then empty and can be dropped as well.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/hvm.c            |  2 --
 xen/arch/x86/hvm/stdvga.c         | 41 ++++-----------------------------------
 xen/arch/x86/include/asm/hvm/io.h |  2 --
 3 files changed, 4 insertions(+), 41 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index f49e29faf7..a64eead368 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -700,7 +700,6 @@ int hvm_domain_initialise(struct domain *d,
     return 0;
 
  fail2:
-    stdvga_deinit(d);
     vioapic_deinit(d);
  fail1:
     if ( is_hardware_domain(d) )
@@ -763,7 +762,6 @@ void hvm_domain_destroy(struct domain *d)
     if ( hvm_funcs.domain_destroy )
         alternative_vcall(hvm_funcs.domain_destroy, d);
 
-    stdvga_deinit(d);
     vioapic_deinit(d);
 
     XFREE(d->arch.hvm.pl_time);
diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index 155a67a438..9f308fc896 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -116,8 +116,7 @@ static const struct hvm_io_ops stdvga_mem_ops = {
 void stdvga_init(struct domain *d)
 {
     struct hvm_hw_stdvga *s = &d->arch.hvm.stdvga;
-    struct page_info *pg;
-    unsigned int i;
+    struct hvm_io_handler *handler;
 
     if ( !has_vvga(d) )
         return;
@@ -125,47 +124,15 @@ void stdvga_init(struct domain *d)
     memset(s, 0, sizeof(*s));
     spin_lock_init(&s->lock);
     
-    for ( i = 0; i != ARRAY_SIZE(s->vram_page); i++ )
+    /* VGA memory */
+    handler = hvm_next_io_handler(d);
+    if ( handler )
     {
-        pg = alloc_domheap_page(d, MEMF_no_owner);
-        if ( pg == NULL )
-            break;
-        s->vram_page[i] = pg;
-        clear_domain_page(page_to_mfn(pg));
-    }
-
-    if ( i == ARRAY_SIZE(s->vram_page) )
-    {
-        struct hvm_io_handler *handler;
-
-        /* VGA memory */
-        handler = hvm_next_io_handler(d);
-
-        if ( handler == NULL )
-            return;
-
         handler->type = IOREQ_TYPE_COPY;
         handler->ops = &stdvga_mem_ops;
     }
 }
 
-void stdvga_deinit(struct domain *d)
-{
-    struct hvm_hw_stdvga *s = &d->arch.hvm.stdvga;
-    int i;
-
-    if ( !has_vvga(d) )
-        return;
-
-    for ( i = 0; i != ARRAY_SIZE(s->vram_page); i++ )
-    {
-        if ( s->vram_page[i] == NULL )
-            continue;
-        free_domheap_page(s->vram_page[i]);
-        s->vram_page[i] = NULL;
-    }
-}
-
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/include/asm/hvm/io.h b/xen/arch/x86/include/asm/hvm/io.h
index bf9ddfc70e..d49f6d6f8c 100644
--- a/xen/arch/x86/include/asm/hvm/io.h
+++ b/xen/arch/x86/include/asm/hvm/io.h
@@ -111,12 +111,10 @@ struct vpci_arch_msix_entry {
 };
 
 struct hvm_hw_stdvga {
-    struct page_info *vram_page[64];  /* shadow of 0xa0000-0xaffff */
     spinlock_t lock;
 };
 
 void stdvga_init(struct domain *d);
-void stdvga_deinit(struct domain *d);
 
 extern void hvm_dpci_msi_eoi(struct domain *d, int vector);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 13 06:57:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Sep 2024 06:57:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797978.1208090 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0F0-0000qJ-Sg; Fri, 13 Sep 2024 06:57:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797978.1208090; Fri, 13 Sep 2024 06:57:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0F0-0000q8-OL; Fri, 13 Sep 2024 06:57:14 +0000
Received: by outflank-mailman (input) for mailman id 797978;
 Fri, 13 Sep 2024 06:57:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0Ey-0000pr-VN
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:57:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0Ey-00080G-Ug
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:57:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0Ey-00055M-Tr
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:57:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1d9dnleF057FKpNsCx95VFpbt7eAna9f5Zh7TWHOL4A=; b=lFHO0zMtHPiiOtv9zu4M+jXtlW
	QaCl0JBceabCmkbLoZI6adPZrCctPH+CrOavfZJIWsX31D6eaGS6W+1Y7lUkXYKdNpYUxvvlIkOkz
	24jWW6+v3mTw3krTiT7AxO7+fN4Y8aTmJdBySWRrQg/s+wvArFbtMWGttwGeyBMExVGs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HVM: drop stdvga's "lock" struct member
Message-Id: <E1sp0Ey-00055M-Tr@xenbits.xenproject.org>
Date: Fri, 13 Sep 2024 06:57:12 +0000

commit b180a50326c8a2c171f37c1940a0fbbdcad4be90
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 12 09:17:02 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 09:17:02 2024 +0200

    x86/HVM: drop stdvga's "lock" struct member
    
    No state is left to protect. It being the last field, drop the struct
    itself as well. Similarly for then ending up empty, drop the .complete
    handler.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/stdvga.c             | 30 ++----------------------------
 xen/arch/x86/include/asm/hvm/domain.h |  1 -
 xen/arch/x86/include/asm/hvm/io.h     |  4 ----
 3 files changed, 2 insertions(+), 33 deletions(-)

diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index 9f308fc896..d38d30affb 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -69,61 +69,35 @@ static int cf_check stdvga_mem_write(
 static bool cf_check stdvga_mem_accept(
     const struct hvm_io_handler *handler, const ioreq_t *p)
 {
-    struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
-
-    /*
-     * The range check must be done without taking the lock, to avoid
-     * deadlock when hvm_mmio_internal() is called from
-     * hvm_copy_to/from_guest_phys() in hvm_process_io_intercept().
-     */
     if ( (ioreq_mmio_first_byte(p) < VGA_MEM_BASE) ||
          (ioreq_mmio_last_byte(p) >= (VGA_MEM_BASE + VGA_MEM_SIZE)) )
         return 0;
 
-    spin_lock(&s->lock);
-
     if ( p->dir != IOREQ_WRITE || p->data_is_ptr || p->count != 1 )
     {
         /*
          * Only accept single direct writes, as that's the only thing we can
          * accelerate using buffered ioreq handling.
          */
-        goto reject;
+        return false;
     }
 
-    /* s->lock intentionally held */
-    return 1;
-
- reject:
-    spin_unlock(&s->lock);
-    return 0;
-}
-
-static void cf_check stdvga_mem_complete(const struct hvm_io_handler *handler)
-{
-    struct hvm_hw_stdvga *s = &current->domain->arch.hvm.stdvga;
-
-    spin_unlock(&s->lock);
+    return true;
 }
 
 static const struct hvm_io_ops stdvga_mem_ops = {
     .accept = stdvga_mem_accept,
     .read = stdvga_mem_read,
     .write = stdvga_mem_write,
-    .complete = stdvga_mem_complete
 };
 
 void stdvga_init(struct domain *d)
 {
-    struct hvm_hw_stdvga *s = &d->arch.hvm.stdvga;
     struct hvm_io_handler *handler;
 
     if ( !has_vvga(d) )
         return;
 
-    memset(s, 0, sizeof(*s));
-    spin_lock_init(&s->lock);
-    
     /* VGA memory */
     handler = hvm_next_io_handler(d);
     if ( handler )
diff --git a/xen/arch/x86/include/asm/hvm/domain.h b/xen/arch/x86/include/asm/hvm/domain.h
index dd9d837e84..333501d5f2 100644
--- a/xen/arch/x86/include/asm/hvm/domain.h
+++ b/xen/arch/x86/include/asm/hvm/domain.h
@@ -72,7 +72,6 @@ struct hvm_domain {
     struct hvm_hw_vpic     vpic[2]; /* 0=master; 1=slave */
     struct hvm_vioapic    **vioapic;
     unsigned int           nr_vioapics;
-    struct hvm_hw_stdvga   stdvga;
 
     /*
      * hvm_hw_pmtimer is a publicly-visible name. We will defer renaming
diff --git a/xen/arch/x86/include/asm/hvm/io.h b/xen/arch/x86/include/asm/hvm/io.h
index d49f6d6f8c..d72b29f73f 100644
--- a/xen/arch/x86/include/asm/hvm/io.h
+++ b/xen/arch/x86/include/asm/hvm/io.h
@@ -110,10 +110,6 @@ struct vpci_arch_msix_entry {
     int pirq;
 };
 
-struct hvm_hw_stdvga {
-    spinlock_t lock;
-};
-
 void stdvga_init(struct domain *d);
 
 extern void hvm_dpci_msi_eoi(struct domain *d, int vector);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 13 06:57:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Sep 2024 06:57:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797979.1208093 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0FA-0000t5-SX; Fri, 13 Sep 2024 06:57:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797979.1208093; Fri, 13 Sep 2024 06:57:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0FA-0000sx-Po; Fri, 13 Sep 2024 06:57:24 +0000
Received: by outflank-mailman (input) for mailman id 797979;
 Fri, 13 Sep 2024 06:57:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0F9-0000sn-1m
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:57:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0F9-00082b-1B
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:57:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0F9-00056H-0a
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:57:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Z1d6ZAX9U5MBwL5ZUryyDnEDQVTgSm0lp6Tm0FRSA9I=; b=sZ2vEe7DhaiC3Xakc+ftVOiHej
	Wi2I3t2NOhJ4tr3PmZDhmkbNV2RR8tZpJncREXMTlD1P8Zk5YyID2oa5TUOCH7cj/DxPxKLVcq/d6
	12YKeeExUqELLf1HFrG9m41MhAkZJXdOAXU9t3QeUHZE0NDfaoI6JAI1iWX+2Lpot824=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HVM: drop .complete hook for intercept handling
Message-Id: <E1sp0F9-00056H-0a@xenbits.xenproject.org>
Date: Fri, 13 Sep 2024 06:57:23 +0000

commit 40f5c7e1389c2c047656f0ed3cc9ed4e194883f2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 12 09:17:43 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 09:17:43 2024 +0200

    x86/HVM: drop .complete hook for intercept handling
    
    No user of the hook exists anymore.
    
    While touching hvm_mmio_internal() also make direction of the request
    explicit - it only so happens that IOREQ_WRITE is zero. Yet it being a
    write is imperative for stdvga.c to "accept" the request.
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/intercept.c      | 24 +++---------------------
 xen/arch/x86/include/asm/hvm/io.h |  2 --
 2 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/hvm/intercept.c b/xen/arch/x86/hvm/intercept.c
index a949419cbe..8f82b82b07 100644
--- a/xen/arch/x86/hvm/intercept.c
+++ b/xen/arch/x86/hvm/intercept.c
@@ -240,21 +240,13 @@ static const struct hvm_io_handler *hvm_find_io_handler(const ioreq_t *p)
 int hvm_io_intercept(ioreq_t *p)
 {
     const struct hvm_io_handler *handler;
-    const struct hvm_io_ops *ops;
-    int rc;
 
     handler = hvm_find_io_handler(p);
 
     if ( handler == NULL )
         return X86EMUL_UNHANDLEABLE;
 
-    rc = hvm_process_io_intercept(handler, p);
-
-    ops = handler->ops;
-    if ( ops->complete != NULL )
-        ops->complete(handler);
-
-    return rc;
+    return hvm_process_io_intercept(handler, p);
 }
 
 struct hvm_io_handler *hvm_next_io_handler(struct domain *d)
@@ -326,25 +318,15 @@ bool relocate_portio_handler(struct domain *d, unsigned int old_port,
 
 bool hvm_mmio_internal(paddr_t gpa)
 {
-    const struct hvm_io_handler *handler;
-    const struct hvm_io_ops *ops;
     ioreq_t p = {
         .type = IOREQ_TYPE_COPY,
         .addr = gpa,
         .count = 1,
         .size = 1,
+        .dir = IOREQ_WRITE, /* for stdvga */
     };
 
-    handler = hvm_find_io_handler(&p);
-
-    if ( handler == NULL )
-        return 0;
-
-    ops = handler->ops;
-    if ( ops->complete != NULL )
-        ops->complete(handler);
-
-    return 1;
+    return hvm_find_io_handler(&p);
 }
 
 /*
diff --git a/xen/arch/x86/include/asm/hvm/io.h b/xen/arch/x86/include/asm/hvm/io.h
index d72b29f73f..f2b8431fac 100644
--- a/xen/arch/x86/include/asm/hvm/io.h
+++ b/xen/arch/x86/include/asm/hvm/io.h
@@ -56,13 +56,11 @@ typedef int (*hvm_io_write_t)(const struct hvm_io_handler *handler,
                               uint64_t data);
 typedef bool (*hvm_io_accept_t)(const struct hvm_io_handler *handler,
                                 const ioreq_t *p);
-typedef void (*hvm_io_complete_t)(const struct hvm_io_handler *handler);
 
 struct hvm_io_ops {
     hvm_io_accept_t   accept;
     hvm_io_read_t     read;
     hvm_io_write_t    write;
-    hvm_io_complete_t complete;
 };
 
 int hvm_process_io_intercept(const struct hvm_io_handler *handler,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 13 06:57:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Sep 2024 06:57:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.797980.1208096 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0FK-0000vq-Tn; Fri, 13 Sep 2024 06:57:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 797980.1208096; Fri, 13 Sep 2024 06:57:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sp0FK-0000vi-RF; Fri, 13 Sep 2024 06:57:34 +0000
Received: by outflank-mailman (input) for mailman id 797980;
 Fri, 13 Sep 2024 06:57:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0FJ-0000vZ-4f
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:57:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0FJ-00083I-40
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:57:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sp0FJ-0005B8-3F
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 06:57:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Gv18YlECxXOmDqXxp3isTnrU40w1KXEg4pmkVhzQRlY=; b=ejZLXFel5jQftgovoO5PAQPqBj
	vMOWcttgsx5vpNjHrkLMQYqqrB7X0t8lxhsqcoRzXPhBeYCG1YE0ZdA02UvS4RJWwN//OOLYTGEib
	WcoBouLNvqNOxrO0I4gIn8v6Lmn5e2LDfCsXYWDh2zB7fGSFwtqMsnBwxCzuWnB5Pkk4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/x86/pvh: handle ACPI RSDT table in PVH Dom0 build
Message-Id: <E1sp0FJ-0005B8-3F@xenbits.xenproject.org>
Date: Fri, 13 Sep 2024 06:57:33 +0000

commit 6e7f7a0c16c4d406bda6d4a900252ff63a7c5fad
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Thu Sep 12 09:18:25 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 09:18:25 2024 +0200

    xen/x86/pvh: handle ACPI RSDT table in PVH Dom0 build
    
    Xen always generates an XSDT table even if the firmware only provided an
    RSDT table.  Copy the RSDT header from the firmware table, adjusting the
    signature, for the XSDT table when not provided by the firmware.
    
    This is necessary to run Xen on QEMU.
    
    Fixes: 1d74282c455f ('x86: setup PVHv2 Dom0 ACPI tables')
    Suggested-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/dom0_build.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index f3eddb6846..3dd913bdb0 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -1078,7 +1078,16 @@ static int __init pvh_setup_acpi_xsdt(struct domain *d, paddr_t madt_addr,
         rc = -EINVAL;
         goto out;
     }
-    xsdt_paddr = rsdp->xsdt_physical_address;
+    /*
+     * Note the header is the same for both RSDT and XSDT, so it's fine to
+     * copy the native RSDT header to the Xen crafted XSDT if no native
+     * XSDT is available.
+     */
+    if ( rsdp->revision > 1 && rsdp->xsdt_physical_address )
+        xsdt_paddr = rsdp->xsdt_physical_address;
+    else
+        xsdt_paddr = rsdp->rsdt_physical_address;
+
     acpi_os_unmap_memory(rsdp, sizeof(*rsdp));
     table = acpi_os_map_memory(xsdt_paddr, sizeof(*table));
     if ( !table )
@@ -1090,6 +1099,12 @@ static int __init pvh_setup_acpi_xsdt(struct domain *d, paddr_t madt_addr,
     xsdt->header = *table;
     acpi_os_unmap_memory(table, sizeof(*table));
 
+    /*
+     * In case the header is an RSDT copy, unconditionally ensure it has
+     * an XSDT sig.
+     */
+    xsdt->header.signature[0] = 'X';
+
     /* Add the custom MADT. */
     xsdt->table_offset_entry[0] = madt_addr;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 13 18:00:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Sep 2024 18:00:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.798399.1208603 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1spAaS-00079N-Uy; Fri, 13 Sep 2024 18:00:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 798399.1208603; Fri, 13 Sep 2024 18:00:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1spAaS-00078w-SI; Fri, 13 Sep 2024 18:00:04 +0000
Received: by outflank-mailman (input) for mailman id 798399;
 Fri, 13 Sep 2024 18:00:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1spAaR-0006rV-9y
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 18:00:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1spAaR-00040T-7r
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 18:00:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1spAaR-0002Hh-5u
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 18:00:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=84JRog1TqAAaflLKWQ2E53tp5OY5sKtpwhkgZ+Kq7BY=; b=QfXmbc6/XTLYvDad0pFgP7P7hk
	MoZh+Auxnzpi+w1zTYe8XMplG/cwFmcMkmRz8yzzw5qk3hN+rQ4wOeVJZuh2Md47Ydi9QKUK3SKd9
	ZR41BlIrJouv9+LkLqO6Y8jq55OzjJPAY20+JKv0+eSPg3UWuqqYRx60J8TAh6FhZ/jU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/ucode: Fix buffer under-run when parsing AMD containers
Message-Id: <E1spAaR-0002Hh-5u@xenbits.xenproject.org>
Date: Fri, 13 Sep 2024 18:00:03 +0000

commit a8bf14f6f331d4f428010b4277b67c33f561ed19
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Fri Sep 13 11:29:32 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Sep 13 15:23:30 2024 +0100

    xen/ucode: Fix buffer under-run when parsing AMD containers
    
    The AMD container format has no formal spec.  It is, at best, precision
    guesswork based on AMD's prior contributions to open source projects.  The
    Equivalence Table has both an explicit length, and an expectation of having a
    NULL entry at the end.
    
    Xen was sanity checking the NULL entry, but without confirming that an entry
    was present, resulting in a read off the front of the buffer.  With some
    manual debugging/annotations this manifests as:
    
      (XEN) *** Buf ffff83204c00b19c, eq ffff83204c00b194
      (XEN) *** eq: 0c 00 00 00 44 4d 41 00 00 00 00 00 00 00 00 00 aa aa aa aa
                                ^-Actual buffer-------------------^
      (XEN) *** installed_cpu: 000c
      (XEN) microcode: Bad equivalent cpu table
      (XEN) Parsing microcode blob error -22
    
    When loaded by hypercall, the 4 bytes interpreted as installed_cpu happen to
    be the containing struct ucode_buf's len field, and luckily will be nonzero.
    
    When loaded at boot, it's possible for the access to #PF if the module happens
    to have been placed on a 2M boundary by the bootloader.  Under Linux, it will
    commonly be the end of the CPIO header.
    
    Drop the probe of the NULL entry; Nothing else cares.  A container without one
    is well formed, insofar that we can still parse it correctly.  With this
    dropped, the same container results in:
    
      (XEN) microcode: couldn't find any matching ucode in the provided blob!
    
    Fixes: 4de936a38aa9 ("x86/ucode/amd: Rework parsing logic in cpu_request_microcode()")
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/microcode/amd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index d2a26967c6..32490c8b7d 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -338,8 +338,7 @@ static struct microcode_patch *cf_check cpu_request_microcode(
         if ( size < sizeof(*et) ||
              (et = buf)->type != UCODE_EQUIV_CPU_TABLE_TYPE ||
              size - sizeof(*et) < et->len ||
-             et->len % sizeof(et->eq[0]) ||
-             et->eq[(et->len / sizeof(et->eq[0])) - 1].installed_cpu )
+             et->len % sizeof(et->eq[0]) )
         {
             printk(XENLOG_ERR "microcode: Bad equivalent cpu table\n");
             error = -EINVAL;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Sep 13 18:44:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Sep 2024 18:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.798416.1208631 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1spBH1-0004j0-6R; Fri, 13 Sep 2024 18:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 798416.1208631; Fri, 13 Sep 2024 18:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1spBH1-0004is-3k; Fri, 13 Sep 2024 18:44:03 +0000
Received: by outflank-mailman (input) for mailman id 798416;
 Fri, 13 Sep 2024 18:44:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1spBGz-0004im-OX
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 18:44:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1spBGz-0004iI-N0
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 18:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1spBGz-0007RW-LI
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 18:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EyVCUvDqgqJZKvVecDyOhYY7vaDLOEd/VzOYZ8Banzc=; b=6ukg03hj2V8QVGg30AdnZCcKeB
	/gOraw3LFQ/9uJBTglIkDJT4XF6Of8JjnwhGPu59aJf1k8cwy3Gez9UAsKH6oHC8L+1m3NeortoPe
	bGnel3LJ9401hZL/jzc1XWqN1ZU1GnnAzVwEEOew6wYmLPW3ByIYFu3WpNGAelFZ9/E4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] types: replace remaining uses of s16
Message-Id: <E1spBGz-0007RW-LI@xenbits.xenproject.org>
Date: Fri, 13 Sep 2024 18:44:01 +0000

commit 5ffe6d4a02e03838b7b910f80e6137e68b8bfcdb
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 12 14:01:42 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 14:01:42 2024 +0200

    types: replace remaining uses of s16
    
    ... and move the type itself to linux-compat.h.
    
    While doing so switch an adjacent x86 struct page_info field to bool.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/arm/arm32/livepatch.c     | 2 +-
 xen/arch/arm/arm64/livepatch.c     | 2 +-
 xen/arch/x86/include/asm/irq.h     | 4 ++--
 xen/arch/x86/include/asm/mm.h      | 4 ++--
 xen/common/grant_table.c           | 8 ++++----
 xen/drivers/passthrough/arm/smmu.c | 1 +
 xen/include/xen/linux-compat.h     | 2 +-
 xen/include/xen/types.h            | 1 -
 8 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/xen/arch/arm/arm32/livepatch.c b/xen/arch/arm/arm32/livepatch.c
index 80d2659b78..8b9777bf1f 100644
--- a/xen/arch/arm/arm32/livepatch.c
+++ b/xen/arch/arm/arm32/livepatch.c
@@ -135,7 +135,7 @@ static s32 get_addend(unsigned char type, void *dest)
         addend =  (*(u32 *)dest & 0x00000FFF);
         addend |= (*(u32 *)dest & 0x000F0000) >> 4;
         /* Addend is to sign-extend ([19:16],[11:0]). */
-        addend = (s16)addend;
+        addend = (int16_t)addend;
         break;
 
     case R_ARM_CALL:
diff --git a/xen/arch/arm/arm64/livepatch.c b/xen/arch/arm/arm64/livepatch.c
index df2cebedde..5ffcbc02a9 100644
--- a/xen/arch/arm/arm64/livepatch.c
+++ b/xen/arch/arm/arm64/livepatch.c
@@ -124,7 +124,7 @@ static int reloc_data(enum aarch64_reloc_op op, void *place, u64 val, int len)
     switch ( len )
     {
     case 16:
-        *(s16 *)place = sval;
+        *(int16_t *)place = sval;
         if ( sval < INT16_MIN || sval > UINT16_MAX )
 	        return -EOVERFLOW;
         break;
diff --git a/xen/arch/x86/include/asm/irq.h b/xen/arch/x86/include/asm/irq.h
index 5a8352a21e..d3bc768068 100644
--- a/xen/arch/x86/include/asm/irq.h
+++ b/xen/arch/x86/include/asm/irq.h
@@ -67,8 +67,8 @@ struct irq_desc;
  * the old destinations.
  */
 struct arch_irq_desc {
-        s16 vector;                  /* vector itself is only 8 bits, */
-        s16 old_vector;              /* but we use -1 for unassigned  */
+        int16_t vector;                  /* vector itself is only 8 bits, */
+        int16_t old_vector;              /* but we use -1 for unassigned  */
         /*
          * Except for high priority interrupts @cpu_mask may have bits set for
          * offline CPUs.  Consumers need to be careful to mask this down to
diff --git a/xen/arch/x86/include/asm/mm.h b/xen/arch/x86/include/asm/mm.h
index b3853ae734..6b5855e94d 100644
--- a/xen/arch/x86/include/asm/mm.h
+++ b/xen/arch/x86/include/asm/mm.h
@@ -286,8 +286,8 @@ struct page_info
         struct {
             u16 nr_validated_ptes:PAGETABLE_ORDER + 1;
             u16 :16 - PAGETABLE_ORDER - 1 - 1;
-            u16 partial_flags:1;
-            s16 linear_pt_count;
+            bool partial_flags:1;
+            int16_t linear_pt_count;
         };
 
         /*
diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index ab36f45ded..6c77867f8c 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1390,7 +1390,7 @@ unmap_common(
     struct grant_table *lgt, *rgt;
     grant_ref_t ref;
     struct active_grant_entry *act;
-    s16              rc = 0;
+    int16_t          rc;
     struct grant_mapping *map;
     unsigned int flags;
     bool put_handle = false;
@@ -2580,7 +2580,7 @@ acquire_grant_for_copy(
     uint16_t trans_page_off;
     uint16_t trans_length;
     bool is_sub_page;
-    s16 rc = GNTST_okay;
+    int16_t rc = GNTST_okay;
     unsigned int pin_incr = readonly ? GNTPIN_hstr_inc : GNTPIN_hstw_inc;
 
     *page = NULL;
@@ -3416,14 +3416,14 @@ gnttab_get_version(XEN_GUEST_HANDLE_PARAM(gnttab_get_version_t) uop)
     return 0;
 }
 
-static s16
+static int16_t
 swap_grant_ref(grant_ref_t ref_a, grant_ref_t ref_b)
 {
     struct domain *d = rcu_lock_current_domain();
     struct grant_table *gt = d->grant_table;
     struct active_grant_entry *act_a = NULL;
     struct active_grant_entry *act_b = NULL;
-    s16 rc = GNTST_okay;
+    int16_t rc = GNTST_okay;
 
     grant_write_lock(gt);
 
diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index f2cee82f55..c9e28a8509 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -43,6 +43,7 @@
 #include <xen/err.h>
 #include <xen/irq.h>
 #include <xen/lib.h>
+#include <xen/linux-compat.h>
 #include <xen/list.h>
 #include <xen/mm.h>
 #include <xen/vmap.h>
diff --git a/xen/include/xen/linux-compat.h b/xen/include/xen/linux-compat.h
index 1491894feb..9f6be512f8 100644
--- a/xen/include/xen/linux-compat.h
+++ b/xen/include/xen/linux-compat.h
@@ -13,7 +13,7 @@
 
 typedef int8_t  s8, __s8;
 typedef uint8_t __u8;
-typedef int16_t __s16;
+typedef int16_t s16, __s16;
 typedef int32_t __s32;
 typedef int64_t __s64;
 
diff --git a/xen/include/xen/types.h b/xen/include/xen/types.h
index 542dbaf63c..d7c26bdac2 100644
--- a/xen/include/xen/types.h
+++ b/xen/include/xen/types.h
@@ -6,7 +6,6 @@
 
 /* Linux inherited types which are being phased out */
 typedef uint8_t u8;
-typedef int16_t s16;
 typedef uint16_t u16, __u16;
 typedef int32_t s32;
 typedef uint32_t u32, __u32;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 13 18:44:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Sep 2024 18:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.798417.1208635 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1spBHB-0004kc-7o; Fri, 13 Sep 2024 18:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 798417.1208635; Fri, 13 Sep 2024 18:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1spBHB-0004kU-5D; Fri, 13 Sep 2024 18:44:13 +0000
Received: by outflank-mailman (input) for mailman id 798417;
 Fri, 13 Sep 2024 18:44:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1spBH9-0004kH-Rz
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 18:44:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1spBH9-0004iQ-RB
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 18:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1spBH9-0007XP-PR
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 18:44:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4d16zJWlzBSjm25phT8yRYpHT2UFcyIs4gCCYF8VnCg=; b=O+WXxntJHKcDo9/DfIz526dgl6
	ddTa5PxW486oTuKxXTezr3CAaaP4/zRT/SliuezTOHb0gu/yK8TqoxfAbXO1Y1KQGz5VjQJ/GtVhr
	WCiUDtTdjfXU7A8NpgawWjxeS6cIL0cyO4kNTEhNeYKSW1eY/4MUl9obNlO/PiPoNSog=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] types: replace remaining uses of s32
Message-Id: <E1spBH9-0007XP-PR@xenbits.xenproject.org>
Date: Fri, 13 Sep 2024 18:44:11 +0000

commit eb97f879191406768dd772a20f94cd6dc44ef076
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 12 14:03:50 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 14:03:50 2024 +0200

    types: replace remaining uses of s32
    
    ... and move the type itself to linux-compat.h.
    
    While doing so switch a few adjacent types as well, for (a little bit
    of) consistency.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/arm/alternative.c             |  2 +-
 xen/arch/arm/arm32/livepatch.c         | 21 +++++++++++----------
 xen/arch/arm/arm64/insn.c              |  6 +++---
 xen/arch/arm/arm64/livepatch.c         |  2 +-
 xen/arch/arm/include/asm/alternative.h | 10 +++++-----
 xen/arch/arm/include/asm/arm64/insn.h  |  8 ++++----
 xen/arch/x86/efi/efi-boot.h            |  6 +++---
 xen/arch/x86/include/asm/uaccess.h     |  2 +-
 xen/arch/x86/time.c                    |  4 ++--
 xen/common/trace.c                     |  8 ++++----
 xen/include/acpi/actypes.h             |  4 ++--
 xen/include/xen/linux-compat.h         |  2 +-
 xen/include/xen/types.h                |  1 -
 13 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/xen/arch/arm/alternative.c b/xen/arch/arm/alternative.c
index 016e66978b..c56caba010 100644
--- a/xen/arch/arm/alternative.c
+++ b/xen/arch/arm/alternative.c
@@ -63,7 +63,7 @@ static u32 get_alt_insn(const struct alt_instr *alt,
 
     if ( insn_is_branch_imm(insn) )
     {
-        s32 offset = insn_get_branch_offset(insn);
+        int32_t offset = insn_get_branch_offset(insn);
         unsigned long target;
 
         target = (unsigned long)altinsnptr + offset;
diff --git a/xen/arch/arm/arm32/livepatch.c b/xen/arch/arm/arm32/livepatch.c
index 8b9777bf1f..d500665646 100644
--- a/xen/arch/arm/arm32/livepatch.c
+++ b/xen/arch/arm/arm32/livepatch.c
@@ -32,7 +32,7 @@ void arch_livepatch_apply(const struct livepatch_func *func,
 
     if ( func->new_addr )
     {
-        s32 delta;
+        int32_t delta;
 
         /*
          * PC is current address (old_addr) + 8 bytes. The semantics for a
@@ -41,11 +41,11 @@ void arch_livepatch_apply(const struct livepatch_func *func,
          * ARM DDI 0406C.c, see A2.3 (pg 45) and A8.8.18 pg (pg 334,335)
          *
          */
-        delta = (s32)func->new_addr - (s32)(func->old_addr + 8);
+        delta = (int32_t)func->new_addr - (int32_t)(func->old_addr + 8);
 
         /* The arch_livepatch_symbol_ok should have caught it. */
-        ASSERT(delta >= -(s32)ARCH_LIVEPATCH_RANGE ||
-               delta < (s32)ARCH_LIVEPATCH_RANGE);
+        ASSERT(delta >= -(int32_t)ARCH_LIVEPATCH_RANGE ||
+               delta <   (int32_t)ARCH_LIVEPATCH_RANGE);
 
         /* CPU shifts by two (left) when decoding, so we shift right by two. */
         delta = delta >> 2;
@@ -113,9 +113,9 @@ bool arch_livepatch_symbol_deny(const struct livepatch_elf *elf,
     return false;
 }
 
-static s32 get_addend(unsigned char type, void *dest)
+static int32_t get_addend(unsigned char type, void *dest)
 {
-    s32 addend = 0;
+    int32_t addend = 0;
 
     switch ( type ) {
     case R_ARM_NONE:
@@ -149,7 +149,8 @@ static s32 get_addend(unsigned char type, void *dest)
     return addend;
 }
 
-static int perform_rel(unsigned char type, void *dest, uint32_t val, s32 addend)
+static int perform_rel(unsigned char type, void *dest, uint32_t val,
+                       int32_t addend)
 {
 
     switch ( type ) {
@@ -203,8 +204,8 @@ static int perform_rel(unsigned char type, void *dest, uint32_t val, s32 addend)
          * arch_livepatch_verify_distance can't account of addend so we have
          * to do the check here as well.
          */
-        if ( (s32)val < -(s32)ARCH_LIVEPATCH_RANGE ||
-             (s32)val >= (s32)ARCH_LIVEPATCH_RANGE )
+        if ( (int32_t)val < -(int32_t)ARCH_LIVEPATCH_RANGE ||
+             (int32_t)val >= (int32_t)ARCH_LIVEPATCH_RANGE )
             return -EOVERFLOW;
 
         /* CPU always shifts insn by two, so complement it. */
@@ -234,7 +235,7 @@ int arch_livepatch_perform(struct livepatch_elf *elf,
         uint32_t val;
         void *dest;
         unsigned char type;
-        s32 addend;
+        int32_t addend;
 
         if ( use_rela )
         {
diff --git a/xen/arch/arm/arm64/insn.c b/xen/arch/arm/arm64/insn.c
index 773c3749d1..81f7914610 100644
--- a/xen/arch/arm/arm64/insn.c
+++ b/xen/arch/arm/arm64/insn.c
@@ -223,9 +223,9 @@ u32 __kprobes aarch64_insn_gen_nop(void)
  * signed value (so it can be used when computing a new branch
  * target).
  */
-s32 aarch64_get_branch_offset(u32 insn)
+int32_t aarch64_get_branch_offset(uint32_t insn)
 {
-	s32 imm;
+	int32_t imm;
 
 	if (aarch64_insn_is_b(insn) || aarch64_insn_is_bl(insn)) {
 		imm = aarch64_insn_decode_immediate(AARCH64_INSN_IMM_26, insn);
@@ -251,7 +251,7 @@ s32 aarch64_get_branch_offset(u32 insn)
  * Encode the displacement of a branch in the imm field and return the
  * updated instruction.
  */
-u32 aarch64_set_branch_offset(u32 insn, s32 offset)
+uint32_t aarch64_set_branch_offset(uint32_t insn, int32_t offset)
 {
 	if (aarch64_insn_is_b(insn) || aarch64_insn_is_bl(insn))
 		return aarch64_insn_encode_immediate(AARCH64_INSN_IMM_26, insn,
diff --git a/xen/arch/arm/arm64/livepatch.c b/xen/arch/arm/arm64/livepatch.c
index 5ffcbc02a9..dfb72be44f 100644
--- a/xen/arch/arm/arm64/livepatch.c
+++ b/xen/arch/arm/arm64/livepatch.c
@@ -130,7 +130,7 @@ static int reloc_data(enum aarch64_reloc_op op, void *place, u64 val, int len)
         break;
 
     case 32:
-        *(s32 *)place = sval;
+        *(int32_t *)place = sval;
         if ( sval < INT32_MIN || sval > UINT32_MAX )
 	        return -EOVERFLOW;
         break;
diff --git a/xen/arch/arm/include/asm/alternative.h b/xen/arch/arm/include/asm/alternative.h
index c7632668b6..22477d9497 100644
--- a/xen/arch/arm/include/asm/alternative.h
+++ b/xen/arch/arm/include/asm/alternative.h
@@ -12,11 +12,11 @@
 #include <xen/stringify.h>
 
 struct alt_instr {
-	s32 orig_offset;	/* offset to original instruction */
-	s32 repl_offset;	/* offset to replacement instruction */
-	u16 cpufeature;		/* cpufeature bit set for replacement */
-	u8  orig_len;		/* size of original instruction(s) */
-	u8  repl_len;		/* size of new instruction(s), <= orig_len */
+	int32_t  orig_offset;	/* offset to original instruction */
+	int32_t  repl_offset;	/* offset to replacement instruction */
+	uint16_t cpufeature;	/* cpufeature bit set for replacement */
+	uint8_t  orig_len;	/* size of original instruction(s) */
+	uint8_t  repl_len;	/* size of new instruction(s), <= orig_len */
 };
 
 /* Xen: helpers used by common code. */
diff --git a/xen/arch/arm/include/asm/arm64/insn.h b/xen/arch/arm/include/asm/arm64/insn.h
index 6308959449..ab290030ab 100644
--- a/xen/arch/arm/include/asm/arm64/insn.h
+++ b/xen/arch/arm/include/asm/arm64/insn.h
@@ -75,8 +75,8 @@ u64 aarch64_insn_decode_immediate(enum aarch64_insn_imm_type type, u32 insn);
 u32 aarch64_insn_encode_immediate(enum aarch64_insn_imm_type type,
 				  u32 insn, u64 imm);
 
-s32 aarch64_get_branch_offset(u32 insn);
-u32 aarch64_set_branch_offset(u32 insn, s32 offset);
+int32_t aarch64_get_branch_offset(uint32_t insn);
+uint32_t aarch64_set_branch_offset(uint32_t insn, int32_t offset);
 
 u32 aarch64_insn_gen_branch_imm(unsigned long pc, unsigned long addr,
 				enum aarch64_insn_branch_type type);
@@ -89,12 +89,12 @@ static inline bool insn_is_branch_imm(u32 insn)
     return aarch64_insn_is_branch_imm(insn);
 }
 
-static inline s32 insn_get_branch_offset(u32 insn)
+static inline int32_t insn_get_branch_offset(uint32_t insn)
 {
     return aarch64_get_branch_offset(insn);
 }
 
-static inline u32 insn_set_branch_offset(u32 insn, s32 offset)
+static inline uint32_t insn_set_branch_offset(uint32_t insn, int32_t offset)
 {
     return aarch64_set_branch_offset(insn, offset);
 }
diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index 23e510c77e..7aa55e7aaf 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -102,12 +102,12 @@ static void __init efi_arch_relocate_image(unsigned long delta)
     }
 }
 
-extern const s32 __trampoline_rel_start[], __trampoline_rel_stop[];
-extern const s32 __trampoline_seg_start[], __trampoline_seg_stop[];
+extern const int32_t __trampoline_rel_start[], __trampoline_rel_stop[];
+extern const int32_t __trampoline_seg_start[], __trampoline_seg_stop[];
 
 static void __init relocate_trampoline(unsigned long phys)
 {
-    const s32 *trampoline_ptr;
+    const int32_t *trampoline_ptr;
 
     trampoline_phys = phys;
 
diff --git a/xen/arch/x86/include/asm/uaccess.h b/xen/arch/x86/include/asm/uaccess.h
index 48b684c19d..395dc42795 100644
--- a/xen/arch/x86/include/asm/uaccess.h
+++ b/xen/arch/x86/include/asm/uaccess.h
@@ -406,7 +406,7 @@ copy_from_unsafe(void *to, const void __user *from, unsigned int n)
 
 struct exception_table_entry
 {
-	s32 addr, cont;
+	int32_t addr, cont;
 };
 extern struct exception_table_entry __start___ex_table[];
 extern struct exception_table_entry __stop___ex_table[];
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 9588502f28..29b026735e 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1945,8 +1945,8 @@ static void cf_check local_time_calibration(void)
      * This allows us to binary shift a 32-bit tsc_elapsed such that:
      * stime_elapsed < tsc_elapsed <= 2*stime_elapsed
      */
-    while ( ((u32)stime_elapsed64 != stime_elapsed64) ||
-            ((s32)stime_elapsed64 < 0) )
+    while ( ((uint32_t)stime_elapsed64 != stime_elapsed64) ||
+            ((int32_t)stime_elapsed64 < 0) )
     {
         stime_elapsed64 >>= 1;
         tsc_elapsed64   >>= 1;
diff --git a/xen/common/trace.c b/xen/common/trace.c
index c33f115b6c..704edef39f 100644
--- a/xen/common/trace.c
+++ b/xen/common/trace.c
@@ -459,8 +459,8 @@ static inline bool bogus(u32 prod, u32 cons)
 
 static inline u32 calc_unconsumed_bytes(const struct t_buf *buf)
 {
-    u32 prod = buf->prod, cons = buf->cons;
-    s32 x;
+    uint32_t prod = buf->prod, cons = buf->cons;
+    int32_t x;
 
     barrier(); /* must read buf->prod and buf->cons only once */
     if ( bogus(prod, cons) )
@@ -478,8 +478,8 @@ static inline u32 calc_unconsumed_bytes(const struct t_buf *buf)
 
 static inline u32 calc_bytes_to_wrap(const struct t_buf *buf)
 {
-    u32 prod = buf->prod, cons = buf->cons;
-    s32 x;
+    uint32_t prod = buf->prod, cons = buf->cons;
+    int32_t x;
 
     barrier(); /* must read buf->prod and buf->cons only once */
     if ( bogus(prod, cons) )
diff --git a/xen/include/acpi/actypes.h b/xen/include/acpi/actypes.h
index 7023863d03..49e0ab9bb4 100644
--- a/xen/include/acpi/actypes.h
+++ b/xen/include/acpi/actypes.h
@@ -186,8 +186,8 @@ typedef int INT32;
 
 /*! [End] no source code translation !*/
 
-typedef u32 acpi_native_uint;
-typedef s32 acpi_native_int;
+typedef uint32_t acpi_native_uint;
+typedef int32_t acpi_native_int;
 
 typedef u32 acpi_io_address;
 typedef u32 acpi_physical_address;
diff --git a/xen/include/xen/linux-compat.h b/xen/include/xen/linux-compat.h
index 9f6be512f8..1f4186102a 100644
--- a/xen/include/xen/linux-compat.h
+++ b/xen/include/xen/linux-compat.h
@@ -14,7 +14,7 @@
 typedef int8_t  s8, __s8;
 typedef uint8_t __u8;
 typedef int16_t s16, __s16;
-typedef int32_t __s32;
+typedef int32_t s32, __s32;
 typedef int64_t __s64;
 
 typedef paddr_t phys_addr_t;
diff --git a/xen/include/xen/types.h b/xen/include/xen/types.h
index d7c26bdac2..1bcc5a474f 100644
--- a/xen/include/xen/types.h
+++ b/xen/include/xen/types.h
@@ -7,7 +7,6 @@
 /* Linux inherited types which are being phased out */
 typedef uint8_t u8;
 typedef uint16_t u16, __u16;
-typedef int32_t s32;
 typedef uint32_t u32, __u32;
 typedef int64_t s64;
 typedef uint64_t u64, __u64;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 13 18:44:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Sep 2024 18:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.798418.1208639 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1spBHL-0004n7-9l; Fri, 13 Sep 2024 18:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 798418.1208639; Fri, 13 Sep 2024 18:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1spBHL-0004mz-6f; Fri, 13 Sep 2024 18:44:23 +0000
Received: by outflank-mailman (input) for mailman id 798418;
 Fri, 13 Sep 2024 18:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1spBHJ-0004mm-V5
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 18:44:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1spBHJ-0004iY-UH
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 18:44:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1spBHJ-0007fV-TF
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 18:44:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=P2n6jQmhCpnatEbABjRBHH/jt693oRrVbNK+ToHYcR8=; b=bf8hrX6v2bAN40Pv0MnMLco2KV
	6PDeiogciU+7hgxyOG2BBM+WkYL9MEzxGN6Mpwo0XhMulnDPAspkke/XSeBLvyidnA8NVqLZH41c0
	EqySIt93OG89l++Oywn9fhO1JRFJHB5I0QwdZFskW679N60duy74yWf+lCl+EgJj7WM8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] blkif: reconcile protocol specification with in-use implementations
Message-Id: <E1spBHJ-0007fV-TF@xenbits.xenproject.org>
Date: Fri, 13 Sep 2024 18:44:21 +0000

commit 221f2748e8dabe8361b8cdfcffbeab9102c4c899
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Sep 12 14:04:56 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 14:04:56 2024 +0200

    blkif: reconcile protocol specification with in-use implementations
    
    Current blkif implementations (both backends and frontends) have all slight
    differences about how they handle the 'sector-size' xenstore node, and how
    other fields are derived from this value or hardcoded to be expressed in units
    of 512 bytes.
    
    To give some context, this is an excerpt of how different implementations use
    the value in 'sector-size' as the base unit for to other fields rather than
    just to set the logical sector size of the block device:
    
                            │ sectors xenbus node │ requests sector_number │ requests {first,last}_sect
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    FreeBSD blk{front,back} │     sector-size     │      sector-size       │           512
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    Linux blk{front,back}   │         512         │          512           │           512
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    QEMU blkback            │     sector-size     │      sector-size       │       sector-size
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    Windows blkfront        │     sector-size     │      sector-size       │       sector-size
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    MiniOS                  │     sector-size     │          512           │           512
    
    An attempt was made by 67e1c050e36b in order to change the base units of the
    request fields and the xenstore 'sectors' node.  That however only lead to more
    confusion, as the specification now clearly diverged from the reference
    implementation in Linux.  Such change was only implemented for QEMU Qdisk
    and Windows PV blkfront.
    
    Partially revert to the state before 67e1c050e36b while adjusting the
    documentation for 'sectors' to match what it used to be previous to
    2fa701e5346d:
    
     * Declare 'feature-large-sector-size' deprecated.  Frontends should not expose
       the node, backends should not make decisions based on its presence.
    
     * Clarify that 'sectors' xenstore node and the requests fields are always in
       512-byte units, like it was previous to 2fa701e5346d and 67e1c050e36b.
    
    All base units for the fields used in the protocol are 512-byte based, the
    xenbus 'sector-size' field is only used to signal the logic block size.  When
    'sector-size' is greater than 512, blkfront implementations must make sure that
    the offsets and sizes (despite being expressed in 512-byte units) are aligned
    to the logical block size specified in 'sector-size', otherwise the backend
    will fail to process the requests.
    
    This will require changes to some of the frontends and backends in order to
    properly support 'sector-size' nodes greater than 512.
    
    Fixes: 2fa701e5346d ('blkif.h: Provide more complete documentation of the blkif interface')
    Fixes: 67e1c050e36b ('public/io/blkif.h: try to fix the semantics of sector based quantities')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 xen/include/public/io/blkif.h | 52 ++++++++++++++++++++++++++++++++-----------
 1 file changed, 39 insertions(+), 13 deletions(-)

diff --git a/xen/include/public/io/blkif.h b/xen/include/public/io/blkif.h
index 22f1eef0c0..9b00d633d3 100644
--- a/xen/include/public/io/blkif.h
+++ b/xen/include/public/io/blkif.h
@@ -237,12 +237,16 @@
  * sector-size
  *      Values:         <uint32_t>
  *
- *      The logical block size, in bytes, of the underlying storage. This
- *      must be a power of two with a minimum value of 512.
+ *      The logical block size, in bytes, of the underlying storage. This must
+ *      be a power of two with a minimum value of 512.  The sector size should
+ *      only be used for request segment length and alignment.
  *
- *      NOTE: Because of implementation bugs in some frontends this must be
- *            set to 512, unless the frontend advertizes a non-zero value
- *            in its "feature-large-sector-size" xenbus node. (See below).
+ *      When exposing a device that uses a logical sector size of 4096, the
+ *      only difference xenstore wise will be that 'sector-size' (and possibly
+ *      'physical-sector-size' if supported by the backend) will be 4096, but
+ *      the 'sectors' node will still be calculated using 512 byte units.  The
+ *      sector base units in the ring requests fields will all be 512 byte
+ *      based despite the logical sector size exposed in 'sector-size'.
  *
  * physical-sector-size
  *      Values:         <uint32_t>
@@ -254,9 +258,9 @@
  * sectors
  *      Values:         <uint64_t>
  *
- *      The size of the backend device, expressed in units of "sector-size".
- *      The product of "sector-size" and "sectors" must also be an integer
- *      multiple of "physical-sector-size", if that node is present.
+ *      The size of the backend device, expressed in units of 512b.  The
+ *      product of "sectors" * 512 must also be an integer multiple of
+ *      "physical-sector-size", if that node is present.
  *
  *****************************************************************************
  *                            Frontend XenBus Nodes
@@ -338,6 +342,7 @@
  * feature-large-sector-size
  *      Values:         0/1 (boolean)
  *      Default Value:  0
+ *      Notes:          DEPRECATED, 12
  *
  *      A value of "1" indicates that the frontend will correctly supply and
  *      interpret all sector-based quantities in terms of the "sector-size"
@@ -411,6 +416,11 @@
  *(10) The discard-secure property may be present and will be set to 1 if the
  *     backing device supports secure discard.
  *(11) Only used by Linux and NetBSD.
+ *(12) Possibly only ever implemented by the QEMU Qdisk backend and the Windows
+ *     PV block frontend.  Other backends and frontends supported 'sector-size'
+ *     values greater than 512 before such feature was added.  Frontends should
+ *     not expose this node, neither should backends make any decisions based
+ *     on it being exposed by the frontend.
  */
 
 /*
@@ -619,11 +629,14 @@
 #define BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST 8
 
 /*
- * NB. 'first_sect' and 'last_sect' in blkif_request_segment, as well as
- * 'sector_number' in blkif_request, blkif_request_discard and
- * blkif_request_indirect are sector-based quantities. See the description
- * of the "feature-large-sector-size" frontend xenbus node above for
- * more information.
+ * NB. 'first_sect' and 'last_sect' in blkif_request_segment are all in units
+ * of 512 bytes, despite the 'sector-size' xenstore node possibly having a
+ * value greater than 512.
+ *
+ * The value in 'first_sect' and 'last_sect' fields must be setup so that the
+ * resulting segment offset and size is aligned to the logical sector size
+ * reported by the 'sector-size' xenstore node, see 'Backend Device Properties'
+ * section.
  */
 struct blkif_request_segment {
     grant_ref_t gref;        /* reference to I/O buffer frame        */
@@ -634,6 +647,10 @@ struct blkif_request_segment {
 
 /*
  * Starting ring element for any I/O request.
+ *
+ * The 'sector_number' field is in units of 512b, despite the value of the
+ * 'sector-size' xenstore node.  Note however that the offset in
+ * 'sector_number' must be aligned to 'sector-size'.
  */
 struct blkif_request {
     uint8_t        operation;    /* BLKIF_OP_???                         */
@@ -648,6 +665,10 @@ typedef struct blkif_request blkif_request_t;
 /*
  * Cast to this structure when blkif_request.operation == BLKIF_OP_DISCARD
  * sizeof(struct blkif_request_discard) <= sizeof(struct blkif_request)
+ *
+ * The 'sector_number' field is in units of 512b, despite the value of the
+ * 'sector-size' xenstore node.  Note however that the offset in
+ * 'sector_number' must be aligned to 'sector-size'.
  */
 struct blkif_request_discard {
     uint8_t        operation;    /* BLKIF_OP_DISCARD                     */
@@ -660,6 +681,11 @@ struct blkif_request_discard {
 };
 typedef struct blkif_request_discard blkif_request_discard_t;
 
+/*
+ * The 'sector_number' field is in units of 512b, despite the value of the
+ * 'sector-size' xenstore node.  Note however that the offset in
+ * 'sector_number' must be aligned to 'sector-size'.
+ */
 struct blkif_request_indirect {
     uint8_t        operation;    /* BLKIF_OP_INDIRECT                    */
     uint8_t        indirect_op;  /* BLKIF_OP_{READ/WRITE}                */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 13 18:44:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Sep 2024 18:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.798419.1208642 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1spBHV-0004qY-CC; Fri, 13 Sep 2024 18:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 798419.1208642; Fri, 13 Sep 2024 18:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1spBHV-0004qR-9n; Fri, 13 Sep 2024 18:44:33 +0000
Received: by outflank-mailman (input) for mailman id 798419;
 Fri, 13 Sep 2024 18:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1spBHU-0004q7-1p
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 18:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1spBHU-0004j7-0u
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 18:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1spBHU-0007ne-04
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 18:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9qEef5Z97tBYiuLTnBaABh8uTX+srMuchf5/rDAk4a8=; b=WgWuuoGiyrjaaHdcE/3cUMUOXZ
	edbI1A6dkM/OUifxSlQwPCjbaBZQhCn+ew3bzO9mmF/fDS+GYgssojBRHUcyQpBJXhRAPIk6FzkST
	ci6aHcMPtSaVy+QLwUl8jTbW91g0iOMh2YNgd3cBP/1KGJjXp9gmB4LMWU9THSAis+NQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mm: undo type change of partial_flags
Message-Id: <E1spBHU-0007ne-04@xenbits.xenproject.org>
Date: Fri, 13 Sep 2024 18:44:32 +0000

commit ec185ec23938d2b932198a7eca2e06e3dc2601f5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Sep 12 17:52:27 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Sep 12 17:52:27 2024 +0200

    x86/mm: undo type change of partial_flags
    
    Clang dislikes the boolean type combined with the field being set using
    PTF_partial_set.
    
    Fixes: 5ffe6d4a02e0 ("types: replace remaining uses of s16")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/include/asm/mm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/include/asm/mm.h b/xen/arch/x86/include/asm/mm.h
index 6b5855e94d..2a837f3d59 100644
--- a/xen/arch/x86/include/asm/mm.h
+++ b/xen/arch/x86/include/asm/mm.h
@@ -286,7 +286,7 @@ struct page_info
         struct {
             u16 nr_validated_ptes:PAGETABLE_ORDER + 1;
             u16 :16 - PAGETABLE_ORDER - 1 - 1;
-            bool partial_flags:1;
+            uint16_t partial_flags:1;
             int16_t linear_pt_count;
         };
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 13 18:44:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Sep 2024 18:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.798420.1208647 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1spBHf-0004tc-Dm; Fri, 13 Sep 2024 18:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 798420.1208647; Fri, 13 Sep 2024 18:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1spBHf-0004tU-BA; Fri, 13 Sep 2024 18:44:43 +0000
Received: by outflank-mailman (input) for mailman id 798420;
 Fri, 13 Sep 2024 18:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1spBHe-0004tK-5N
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 18:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1spBHe-0004jS-4f
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 18:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1spBHe-0007to-2w
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 18:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gySmOiQUDdSV7IWgThe5TrAE/wY2cdAkcK/y1xRigWI=; b=qGrmu7McjtspICnrVMDNxq0CvM
	cfHyvy9tC3HwbvX29lBz4mqgjfj7rJ5NlpKD+XncZ5nPPC2/5uQFWL0SEVcK64NzGHK6B/FkAwocs
	hBB7YsOJdFpycgsByrrGD1+J4ME5e5yi2BdNEXxWKxnHiop0CQyxBrZDtP9MHBpC/Y+4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ARM/cache: Drop legacy __read_mostly/__ro_after_init definitions
Message-Id: <E1spBHe-0007to-2w@xenbits.xenproject.org>
Date: Fri, 13 Sep 2024 18:44:42 +0000

commit 42968684e51974f1181e493d4994ced1f7f3df7a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu May 30 21:09:48 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Sep 12 17:28:52 2024 +0100

    ARM/cache: Drop legacy __read_mostly/__ro_after_init definitions
    
    These are no longer needed.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/include/asm/cache.h | 3 ---
 xen/include/xen/cache.h          | 5 -----
 2 files changed, 8 deletions(-)

diff --git a/xen/arch/arm/include/asm/cache.h b/xen/arch/arm/include/asm/cache.h
index 029b2896fb..b75c970b68 100644
--- a/xen/arch/arm/include/asm/cache.h
+++ b/xen/arch/arm/include/asm/cache.h
@@ -6,9 +6,6 @@
 #define L1_CACHE_SHIFT  (CONFIG_ARM_L1_CACHE_SHIFT)
 #define L1_CACHE_BYTES  (1 << L1_CACHE_SHIFT)
 
-/* TODO: Phase out the use of this via cache.h */
-#define __read_mostly __section(".data.read_mostly")
-
 #endif
 /*
  * Local variables:
diff --git a/xen/include/xen/cache.h b/xen/include/xen/cache.h
index 90816ba05b..6ee174efa4 100644
--- a/xen/include/xen/cache.h
+++ b/xen/include/xen/cache.h
@@ -15,9 +15,4 @@
 #define __cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES)))
 #endif
 
-#if defined(CONFIG_ARM)
-/* TODO: Phase out the use of this via cache.h */
-#define __ro_after_init __section(".data.ro_after_init")
-#endif
-
 #endif /* __LINUX_CACHE_H */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 13 18:44:53 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Sep 2024 18:44:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.798421.1208653 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1spBHp-0004wD-Fw; Fri, 13 Sep 2024 18:44:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 798421.1208653; Fri, 13 Sep 2024 18:44:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1spBHp-0004w5-CV; Fri, 13 Sep 2024 18:44:53 +0000
Received: by outflank-mailman (input) for mailman id 798421;
 Fri, 13 Sep 2024 18:44:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1spBHo-0004vs-8I
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 18:44:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1spBHo-0004jZ-7b
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 18:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1spBHo-0007x1-6j
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 18:44:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DsACEtu/X+PGwQyE/oPwsIyq/6OV4e0bzPo8N3WmGZc=; b=ugkawMeFlAvOn500aPkdzKC58E
	lJHl+AmS77cOxHT3gpiFssOFeh23/ubPPYmtmV/vaYIJS1lUxyXj0p/JpF+9w0gsJmawg7djNos+L
	IMid2rLKPTBtzLiAwrQ1JoloREiGhvLWpVsNynG0AfbdXgjoHXZZDP2WJ7QFyYsuZdio=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hvm: Simplify stdvga_mem_accept() further
Message-Id: <E1spBHo-0007x1-6j@xenbits.xenproject.org>
Date: Fri, 13 Sep 2024 18:44:52 +0000

commit 08ffd8705d36c7c445df3ecee8ad9b8f8d65fbe0
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Sep 12 12:04:17 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Sep 12 17:28:52 2024 +0100

    x86/hvm: Simplify stdvga_mem_accept() further
    
    stdvga_mem_accept() is called on almost all IO emulations, and the
    overwhelming likely answer is to reject the ioreq.  Simply rearranging the
    expression yields an improvement:
    
      add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-57 (-57)
      Function                                     old     new   delta
      stdvga_mem_accept                            109      52     -57
    
    which is best explained looking at the disassembly:
    
      Before:                                                    After:
      f3 0f 1e fa           endbr64                              f3 0f 1e fa           endbr64
      0f b6 4e 1e           movzbl 0x1e(%rsi),%ecx            |  0f b6 46 1e           movzbl 0x1e(%rsi),%eax
      48 8b 16              mov    (%rsi),%rdx                |  31 d2                 xor    %edx,%edx
      f6 c1 40              test   $0x40,%cl                  |  a8 30                 test   $0x30,%al
      75 38                 jne    <stdvga_mem_accept+0x48>   |  75 23                 jne    <stdvga_mem_accept+0x31>
      31 c0                 xor    %eax,%eax                  <
      48 81 fa ff ff 09 00  cmp    $0x9ffff,%rdx              <
      76 26                 jbe    <stdvga_mem_accept+0x41>   <
      8b 46 14              mov    0x14(%rsi),%eax            <
      8b 7e 10              mov    0x10(%rsi),%edi            <
      48 0f af c7           imul   %rdi,%rax                  <
      48 8d 54 02 ff        lea    -0x1(%rdx,%rax,1),%rdx     <
      31 c0                 xor    %eax,%eax                  <
      48 81 fa ff ff 0b 00  cmp    $0xbffff,%rdx              <
      77 0c                 ja     <stdvga_mem_accept+0x41>   <
      83 e1 30              and    $0x30,%ecx                 <
      75 07                 jne    <stdvga_mem_accept+0x41>   <
      83 7e 10 01           cmpl   $0x1,0x10(%rsi)               83 7e 10 01           cmpl   $0x1,0x10(%rsi)
      0f 94 c0              sete   %al                        |  75 1d                 jne    <stdvga_mem_accept+0x31>
      c3                    ret                               |  48 8b 0e              mov    (%rsi),%rcx
      66 0f 1f 44 00 00     nopw   0x0(%rax,%rax,1)           |  48 81 f9 ff ff 09 00  cmp    $0x9ffff,%rcx
      8b 46 10              mov    0x10(%rsi),%eax            |  76 11                 jbe    <stdvga_mem_accept+0x31>
      8b 7e 14              mov    0x14(%rsi),%edi            |  8b 46 14              mov    0x14(%rsi),%eax
      49 89 d0              mov    %rdx,%r8                   |  48 8d 44 01 ff        lea    -0x1(%rcx,%rax,1),%rax
      48 83 e8 01           sub    $0x1,%rax                  |  48 3d ff ff 0b 00     cmp    $0xbffff,%rax
      48 8d 54 3a ff        lea    -0x1(%rdx,%rdi,1),%rdx     |  0f 96 c2              setbe  %dl
      48 0f af c7           imul   %rdi,%rax                  |  89 d0                 mov    %edx,%eax
      49 29 c0              sub    %rax,%r8                   <
      31 c0                 xor    %eax,%eax                  <
      49 81 f8 ff ff 09 00  cmp    $0x9ffff,%r8               <
      77 be                 ja     <stdvga_mem_accept+0x2a>   <
      c3                    ret                                  c3                    ret
    
    By moving the "p->count != 1" check ahead of the
    ioreq_mmio_{first,last}_byte() calls, both multiplies disappear along with a
    lot of surrounding logic.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/stdvga.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index d38d30affb..c3c43f59ee 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -69,18 +69,14 @@ static int cf_check stdvga_mem_write(
 static bool cf_check stdvga_mem_accept(
     const struct hvm_io_handler *handler, const ioreq_t *p)
 {
-    if ( (ioreq_mmio_first_byte(p) < VGA_MEM_BASE) ||
+    /*
+     * Only accept single direct writes, as that's the only thing we can
+     * accelerate using buffered ioreq handling.
+     */
+    if ( p->dir != IOREQ_WRITE || p->data_is_ptr || p->count != 1 ||
+         (ioreq_mmio_first_byte(p) < VGA_MEM_BASE) ||
          (ioreq_mmio_last_byte(p) >= (VGA_MEM_BASE + VGA_MEM_SIZE)) )
-        return 0;
-
-    if ( p->dir != IOREQ_WRITE || p->data_is_ptr || p->count != 1 )
-    {
-        /*
-         * Only accept single direct writes, as that's the only thing we can
-         * accelerate using buffered ioreq handling.
-         */
         return false;
-    }
 
     return true;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 13 18:45:03 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Sep 2024 18:45:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.798422.1208655 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1spBHz-0004yi-Gl; Fri, 13 Sep 2024 18:45:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 798422.1208655; Fri, 13 Sep 2024 18:45:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1spBHz-0004ya-E1; Fri, 13 Sep 2024 18:45:03 +0000
Received: by outflank-mailman (input) for mailman id 798422;
 Fri, 13 Sep 2024 18:45:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1spBHy-0004yN-BD
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 18:45:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1spBHy-0004kE-AW
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 18:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1spBHy-00088X-9j
 for xen-changelog@lists.xenproject.org; Fri, 13 Sep 2024 18:45:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hsTx8Z17qxaEqWRcNtZgb5xTiKfV1PrBAb4n3hmREm4=; b=T+LsEMEYCxoAAPw8pZiDExx8sQ
	px55QSfDtidiDbmiJ+TtV4zb7CLa1tQhq6H0r2EfCmcgKm9ljxoPAU9DWLAWTbinaFp9aTwKH5qh3
	XFLqrkkOlCFs7rudtcD0X60VcuJ+yITsyrD4RjlglxKqyQzKWSTB+O8W2LHknCwnG8+g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/keyhandler: Move key_table[] into __ro_after_init
Message-Id: <E1spBHy-00088X-9j@xenbits.xenproject.org>
Date: Fri, 13 Sep 2024 18:45:02 +0000

commit 4e23c86bd809d64468407165b40f9976d7186a59
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Sep 12 11:30:44 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Sep 12 17:28:52 2024 +0100

    xen/keyhandler: Move key_table[] into __ro_after_init
    
    All registration is done at boot.  Almost...
    
    iommu_dump_page_tables() is registered in iommu_hwdom_init(), which is called
    twice when LATE_HWDOM is in use.
    
    register_irq_keyhandler() has an ASSERT() guarding againt multiple
    registration attempts, and the absence of bug reports hints at how many
    configurations use LATE_HWDOM in practice.
    
    Move the registration into iommu_setup() just after printing the overall
    status of the IOMMU.  For starters, the hardware domain is specifically
    excluded by iommu_dump_page_tables().
    
    ept_dump_p2m_table is registered in setup_ept_dump() which is non-__init, but
    whose sole caller, start_vmx(), is __init.  Move setup_ept_dump() to match.
    
    With these two tweeks, all keyhandler reigstration is from __init functions,
    so register_{,irq_}keyhandler() can move, and key_table[] can become
    __ro_after_init.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m-ept.c       |  2 +-
 xen/common/keyhandler.c         | 10 +++++-----
 xen/drivers/passthrough/iommu.c |  5 +++--
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 2ea574ca6a..21728397f9 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -1497,7 +1497,7 @@ static void cf_check ept_dump_p2m_table(unsigned char key)
     rcu_read_unlock(&domlist_read_lock);
 }
 
-void setup_ept_dump(void)
+void __init setup_ept_dump(void)
 {
     register_keyhandler('D', ept_dump_p2m_table, "dump VT-x EPT tables", 0);
 }
diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c
index 674e7be39e..6da291b34e 100644
--- a/xen/common/keyhandler.c
+++ b/xen/common/keyhandler.c
@@ -40,7 +40,7 @@ static struct keyhandler {
     const char *desc;    /* Description for help message.                 */
     bool irq_callback,   /* Call in irq context? if not, tasklet context. */
         diagnostic;      /* Include in 'dump all' handler.                */
-} key_table[128] __read_mostly =
+} key_table[128] __ro_after_init =
 {
 #define KEYHANDLER(k, f, desc, diag)            \
     [k] = { { .fn = (f) }, desc, 0, diag }
@@ -99,8 +99,8 @@ void handle_keypress(unsigned char key, bool need_context)
     }
 }
 
-void register_keyhandler(unsigned char key, keyhandler_fn_t *fn,
-                         const char *desc, bool diagnostic)
+void __init register_keyhandler(unsigned char key, keyhandler_fn_t *fn,
+                                const char *desc, bool diagnostic)
 {
     BUG_ON(key >= ARRAY_SIZE(key_table)); /* Key in range? */
     ASSERT(!key_table[key].fn);           /* Clobbering something else? */
@@ -111,8 +111,8 @@ void register_keyhandler(unsigned char key, keyhandler_fn_t *fn,
     key_table[key].diagnostic = diagnostic;
 }
 
-void register_irq_keyhandler(unsigned char key, irq_keyhandler_fn_t *fn,
-                             const char *desc, bool diagnostic)
+void __init register_irq_keyhandler(unsigned char key, irq_keyhandler_fn_t *fn,
+                                    const char *desc, bool diagnostic)
 {
     BUG_ON(key >= ARRAY_SIZE(key_table)); /* Key in range? */
     ASSERT(!key_table[key].irq_fn);       /* Clobbering something else? */
diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index 50bfd62553..9e74a1fc72 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -271,8 +271,6 @@ void __hwdom_init iommu_hwdom_init(struct domain *d)
     if ( !is_iommu_enabled(d) )
         return;
 
-    register_keyhandler('o', &iommu_dump_page_tables, "dump iommu page tables", 0);
-
     iommu_vcall(hd->platform_ops, hwdom_init, d);
 }
 
@@ -605,6 +603,9 @@ int __init iommu_setup(void)
 #ifndef iommu_intremap
         printk("Interrupt remapping %sabled\n", iommu_intremap ? "en" : "dis");
 #endif
+
+        register_keyhandler('o', &iommu_dump_page_tables,
+                            "dump iommu page tables", 0);
     }
 
     return rc;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Sep 14 10:11:08 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 14 Sep 2024 10:11:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.798618.1208818 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1spPk7-0002W3-Fl; Sat, 14 Sep 2024 10:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 798618.1208818; Sat, 14 Sep 2024 10:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1spPk7-0002Vw-DM; Sat, 14 Sep 2024 10:11:03 +0000
Received: by outflank-mailman (input) for mailman id 798618;
 Sat, 14 Sep 2024 10:11:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1spPk5-0002Vq-Dt
 for xen-changelog@lists.xenproject.org; Sat, 14 Sep 2024 10:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1spPk5-00051w-Ad
 for xen-changelog@lists.xenproject.org; Sat, 14 Sep 2024 10:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1spPk5-0000gT-9R
 for xen-changelog@lists.xenproject.org; Sat, 14 Sep 2024 10:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZMJliW2iZsIUHYnHrjwFzQ9/LlC4pyHGzBvsPGJyid8=; b=TihXBVqPNy0NH/GVwRZ/GBAKDh
	KUumCXIkkMDuI9jXdp8EPhRWk16dlN7fnSXeBcWRdPv6+Gygxv/Ek78F9p51XEi6WvqxvW+kmXIWk
	/zMH8GOf7VZ4PZAuEFAqXkocAF9/E5/h37ebdZHzrlF9/7FYBYPsSEPwg7unAWTVA8Lg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/ucode: Fix buffer under-run when parsing AMD containers
Message-Id: <E1spPk5-0000gT-9R@xenbits.xenproject.org>
Date: Sat, 14 Sep 2024 10:11:01 +0000

commit a8bf14f6f331d4f428010b4277b67c33f561ed19
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Fri Sep 13 11:29:32 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Sep 13 15:23:30 2024 +0100

    xen/ucode: Fix buffer under-run when parsing AMD containers
    
    The AMD container format has no formal spec.  It is, at best, precision
    guesswork based on AMD's prior contributions to open source projects.  The
    Equivalence Table has both an explicit length, and an expectation of having a
    NULL entry at the end.
    
    Xen was sanity checking the NULL entry, but without confirming that an entry
    was present, resulting in a read off the front of the buffer.  With some
    manual debugging/annotations this manifests as:
    
      (XEN) *** Buf ffff83204c00b19c, eq ffff83204c00b194
      (XEN) *** eq: 0c 00 00 00 44 4d 41 00 00 00 00 00 00 00 00 00 aa aa aa aa
                                ^-Actual buffer-------------------^
      (XEN) *** installed_cpu: 000c
      (XEN) microcode: Bad equivalent cpu table
      (XEN) Parsing microcode blob error -22
    
    When loaded by hypercall, the 4 bytes interpreted as installed_cpu happen to
    be the containing struct ucode_buf's len field, and luckily will be nonzero.
    
    When loaded at boot, it's possible for the access to #PF if the module happens
    to have been placed on a 2M boundary by the bootloader.  Under Linux, it will
    commonly be the end of the CPIO header.
    
    Drop the probe of the NULL entry; Nothing else cares.  A container without one
    is well formed, insofar that we can still parse it correctly.  With this
    dropped, the same container results in:
    
      (XEN) microcode: couldn't find any matching ucode in the provided blob!
    
    Fixes: 4de936a38aa9 ("x86/ucode/amd: Rework parsing logic in cpu_request_microcode()")
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/microcode/amd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index d2a26967c6..32490c8b7d 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -338,8 +338,7 @@ static struct microcode_patch *cf_check cpu_request_microcode(
         if ( size < sizeof(*et) ||
              (et = buf)->type != UCODE_EQUIV_CPU_TABLE_TYPE ||
              size - sizeof(*et) < et->len ||
-             et->len % sizeof(et->eq[0]) ||
-             et->eq[(et->len / sizeof(et->eq[0])) - 1].installed_cpu )
+             et->len % sizeof(et->eq[0]) )
         {
             printk(XENLOG_ERR "microcode: Bad equivalent cpu table\n");
             error = -EINVAL;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Sep 16 21:00:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Sep 2024 21:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.799705.1209679 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sqIpJ-00038f-9R; Mon, 16 Sep 2024 21:00:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 799705.1209679; Mon, 16 Sep 2024 21:00:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sqIpJ-00038F-6b; Mon, 16 Sep 2024 21:00:05 +0000
Received: by outflank-mailman (input) for mailman id 799705;
 Mon, 16 Sep 2024 21:00:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sqIpH-0002lv-DM
 for xen-changelog@lists.xenproject.org; Mon, 16 Sep 2024 21:00:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sqIpH-0004Ua-CW
 for xen-changelog@lists.xenproject.org; Mon, 16 Sep 2024 21:00:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sqIpH-0004gn-Be
 for xen-changelog@lists.xenproject.org; Mon, 16 Sep 2024 21:00:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ajt7z37Kpv2UjWWKpEIraat1hNyZi3U8OsccQsmkmkw=; b=5lagGY5mbg4aUMJWOHh++AUpDC
	vPBq9MUCjWPCFEY10wxnaAFg2RzRp+Z/UkKbzMyWhiNEtaR7O37QlSBnCwUlXpZaEzUKHXyNCE3IA
	Bvf15Mijsl+iIe7feh0m0CsOTjSatl5wEuSj3Zphxom61gS36Mcpg/dbXwu6v+9dPcX0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arm: Drop deprecated early printk platform options
Message-Id: <E1sqIpH-0004gn-Be@xenbits.xenproject.org>
Date: Mon, 16 Sep 2024 21:00:03 +0000

commit 4e1a3337455ea82f05b46fa467106ce6ec71c102
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Fri Sep 13 08:15:29 2024 +0200
Commit:     Julien Grall <julien@xen.org>
CommitDate: Mon Sep 16 21:54:27 2024 +0100

    arm: Drop deprecated early printk platform options
    
    The predefined configurations for early printk have been deprecated for
    a sufficient amount of time. Let's finally remove them.
    
    Note:
    In order not to lose these predefined configurations, I wrote a wiki
    page: https://wiki.xenproject.org/wiki/Xen_on_ARM_Early_Printk
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 docs/misc/arm/early-printk.txt |   4 --
 xen/arch/arm/Kconfig.debug     | 155 +++--------------------------------------
 2 files changed, 9 insertions(+), 150 deletions(-)

diff --git a/docs/misc/arm/early-printk.txt b/docs/misc/arm/early-printk.txt
index bc2d65aa2e..e6b9124a38 100644
--- a/docs/misc/arm/early-printk.txt
+++ b/docs/misc/arm/early-printk.txt
@@ -35,8 +35,4 @@ Other options depends on the driver selected:
 
   - For all other uarts there are no additional options.
 
-As a convenience it is also possible to select from a list of
-predefined configurations available in the list of choice for "Early
-printk" for specific platform.
-
 By default early printk is disabled.
diff --git a/xen/arch/arm/Kconfig.debug b/xen/arch/arm/Kconfig.debug
index eec860e88e..2fa0acd2a3 100644
--- a/xen/arch/arm/Kconfig.debug
+++ b/xen/arch/arm/Kconfig.debug
@@ -13,177 +13,67 @@ choice
 		Choose one of the UART drivers for early printk, then you'll
 		have to specify the parameters, like the base address.
 
-		Deprecated: Alternatively, there are platform specific options
-		which will have default values for the various parameters. But
-		such option will soon be removed.
-
 	config EARLY_UART_CHOICE_8250
 		select EARLY_UART_8250
 		bool "Early printk via 8250 UART"
 		help
 			Say Y here if you wish the early printk to direct their
-			output to a 8250 UART. You can use this option to
-			provide the parameters for the 8250 UART rather than
-			selecting one of the platform specific options below if
-			you know the parameters for the port.
+			output to a 8250 UART.
 
-			This option is preferred over the platform specific
-			options; the platform specific options are deprecated
-			and will soon be removed.
 	config EARLY_UART_CHOICE_CADENCE
 		select EARLY_UART_CADENCE
 		depends on ARM_64
 		bool "Early printk via Cadence UART"
 		help
 			Say Y here if you wish the early printk to direct their
-			output to a Cadence UART. You can use this option to
-			provide the parameters for the Cadence UART rather than
-			selecting one of the platform specific options below if
-			you know the parameters for the port.
+			output to a Cadence UART.
 
-			This option is preferred over the platform specific
-			options; the platform specific options are deprecated
-			and will soon be removed.
 	config EARLY_UART_CHOICE_EXYNOS4210
 		select EARLY_UART_EXYNOS4210
 		depends on ARM_32
 		bool "Early printk via Exynos4210 UART"
 		help
 			Say Y here if you wish the early printk to direct their
-			output to a Exynos 4210 UART. You can use this option to
-			provide the parameters for the Exynos 4210 UART rather than
-			selecting one of the platform specific options below if
-			you know the parameters for the port.
+			output to a Exynos 4210 UART.
 
-			This option is preferred over the platform specific
-			options; the platform specific options are deprecated
-			and will soon be removed.
 	config EARLY_UART_CHOICE_IMX_LPUART
 		select EARLY_UART_IMX_LPUART
 		depends on ARM_64
 		bool "Early printk via i.MX LPUART"
 		help
 			Say Y here if you wish the early printk to direct their
-			output to a i.MX LPUART. You can use this option to
-			provide the parameters for the i.MX LPUART rather than
-			selecting one of the platform specific options below if
-			you know the parameters for the port.
+			output to a i.MX LPUART.
+
 	config EARLY_UART_CHOICE_MESON
 		select EARLY_UART_MESON
 		depends on ARM_64
 		bool "Early printk via MESON UART"
 		help
 			Say Y here if you wish the early printk to direct their
-			output to a MESON UART. You can use this option to
-			provide the parameters for the MESON UART rather than
-			selecting one of the platform specific options below if
-			you know the parameters for the port.
+			output to a MESON UART.
 
-			This option is preferred over the platform specific
-			options; the platform specific options are deprecated
-			and will soon be removed.
 	config EARLY_UART_CHOICE_MVEBU
 		select EARLY_UART_MVEBU
 		depends on ARM_64
 		bool "Early printk via MVEBU UART"
 		help
 			Say Y here if you wish the early printk to direct their
-			output to a MVEBU UART. You can use this option to
-			provide the parameters for the MVEBU UART rather than
-			selecting one of the platform specific options below if
-			you know the parameters for the port.
+			output to a MVEBU UART.
 
-			This option is preferred over the platform specific
-			options; the platform specific options are deprecated
-			and will soon be removed.
 	config EARLY_UART_CHOICE_PL011
 		select EARLY_UART_PL011
 		bool "Early printk via PL011 UART"
 		help
 			Say Y here if you wish the early printk to direct their
-			output to a PL011 UART. You can use this option to
-			provide the parameters for the PL011 UART rather than
-			selecting one of the platform specific options below if
-			you know the parameters for the port.
+			output to a PL011 UART.
 
-			This option is preferred over the platform specific
-			options; the platform specific options are deprecated
-			and will soon be removed.
 	config EARLY_UART_CHOICE_SCIF
 		select EARLY_UART_SCIF
 		bool "Early printk via SCIF UART"
 		help
 			Say Y here if you wish the early printk to direct their
-			output to a SCIF UART. You can use this option to
-			provide the parameters for the SCIF UART rather than
-			selecting one of the platform specific options below if
-			you know the parameters for the port.
+			output to a SCIF UART.
 
-			This option is preferred over the platform specific
-			options; the platform specific options are deprecated
-			and will soon be removed.
-
-	config EARLY_PRINTK_BRCM
-		bool "Early printk with 8250 on Broadcom 7445D0 boards with A15 processors"
-		select EARLY_UART_8250
-	config EARLY_PRINTK_DRA7
-		bool "Early printk with 8250 on DRA7 platform"
-		select EARLY_UART_8250
-	config EARLY_PRINTK_EXYNOS5250
-		bool "Early printk with the second UART on Exynos5250"
-		select EARLY_UART_EXYNOS4210
-		depends on ARM_32
-	config EARLY_PRINTK_FASTMODEL
-		bool "Early printk with pl011 on ARM Fastmodel software emulators"
-		select EARLY_UART_PL011
-	config EARLY_PRINTK_HIKEY960
-		bool "Early printk with pl011 with Hikey 960"
-		select EARLY_UART_PL011
-	config EARLY_PRINTK_JUNO
-		bool "Early printk with pl011 on Juno platform"
-		select EARLY_UART_PL011
-	config EARLY_PRINTK_LAGER
-		bool "Early printk with SCIF0 on Renesas Lager board (R-Car H2 processor)"
-		select EARLY_UART_SCIF
-	config EARLY_PRINTK_MIDWAY
-		bool "Early printk with pl011 on Calxeda Midway processors"
-		select EARLY_UART_PL011
-	config EARLY_PRINTK_MVEBU
-		bool "Early printk with MVEBU for Marvell Armada 3700 SoCs"
-		select EARLY_UART_MVEBU
-		depends on ARM_64
-	config EARLY_PRINTK_OMAP5432
-		bool "Early printk with UART3 on TI OMAP5432 processors"
-		select EARLY_UART_8250
-	config EARLY_PRINTK_RCAR3
-		bool "Early printk with SCIF2 on Renesas R-Car Gen3 processors"
-		select EARLY_UART_SCIF
-	config EARLY_PRINTK_SEATTLE
-		bool "Early printk with pl011 for AMD Seattle processor"
-		select EARLY_UART_PL011
-	config EARLY_PRINTK_SUN6I
-		bool "Early printk with 8250 on Allwinner A31 processors"
-		select EARLY_UART_8250
-	config EARLY_PRINTK_SUN7I
-		bool "Early printk with 8250 on Allwinner A20 processors"
-		select EARLY_UART_8250
-	config EARLY_PRINTK_THUNDERX
-		bool "Early printk with pl011 for Cavium ThunderX processor"
-		select EARLY_UART_PL011
-		depends on ARM_64
-	config EARLY_PRINTK_VEXPRESS
-		bool "Early printk with pl011 for versatile express"
-		select EARLY_UART_PL011
-	config EARLY_PRINTK_XGENE_MCDIVITT
-		bool "Early printk with 820 on Xgene mcdivitt platform"
-		select EARLY_UART_8250
-	config EARLY_PRINTK_XGENE_STORM
-		bool "Early printk with 820 on Xgene storm platform"
-		select EARLY_UART_8250
-	config EARLY_PRINTK_ZYNQMP
-		bool "Early printk with Cadence UART for Xilinx ZynqMP SoCs"
-		select EARLY_UART_CADENCE
-		depends on ARM_64
 endchoice
 
 
@@ -219,25 +109,6 @@ config EARLY_UART_BASE_ADDRESS
 	depends on EARLY_PRINTK
 	hex "Early printk, physical base address of debug UART"
 	range 0x0 0xffffffff if ARM_32
-	default 0xF040AB00 if EARLY_PRINTK_BRCM
-	default 0x4806A000 if EARLY_PRINTK_DRA7
-	default 0x1c090000 if EARLY_PRINTK_FASTMODEL
-	default 0x12c20000 if EARLY_PRINTK_EXYNOS5250
-	default 0xfff32000 if EARLY_PRINTK_HIKEY960
-	default 0x7ff80000 if EARLY_PRINTK_JUNO
-	default 0xe6e60000 if EARLY_PRINTK_LAGER
-	default 0xfff36000 if EARLY_PRINTK_MIDWAY
-	default 0xd0012000 if EARLY_PRINTK_MVEBU
-	default 0x48020000 if EARLY_PRINTK_OMAP5432
-	default 0xe6e88000 if EARLY_PRINTK_RCAR3
-	default 0xe1010000 if EARLY_PRINTK_SEATTLE
-	default 0x01c28000 if EARLY_PRINTK_SUN6I
-	default 0x01c28000 if EARLY_PRINTK_SUN7I
-	default 0x87e024000000 if EARLY_PRINTK_THUNDERX
-	default 0x1c090000 if EARLY_PRINTK_VEXPRESS
-	default 0x1c021000 if EARLY_PRINTK_XGENE_MCDIVITT
-	default 0x1c020000 if EARLY_PRINTK_XGENE_STORM
-	default 0xff000000 if EARLY_PRINTK_ZYNQMP
 
 config EARLY_UART_PL011_BAUD_RATE
 	depends on EARLY_UART_PL011
@@ -250,7 +121,6 @@ config EARLY_UART_PL011_BAUD_RATE
 		not try to initialize the UART, so that bootloader or firmware
 		settings can be used for maximum compatibility.
 
-	default 115200 if EARLY_PRINTK_FASTMODEL
 	default 0
 
 config EARLY_UART_PL011_MMIO32
@@ -274,13 +144,6 @@ config EARLY_UART_8250_REG_SHIFT
 
 		Default to 0.
 
-	default 2 if EARLY_PRINTK_BRCM
-	default 2 if EARLY_PRINTK_DRA7
-	default 2 if EARLY_PRINTK_OMAP5432
-	default 2 if EARLY_PRINTK_SUN6I
-	default 2 if EARLY_PRINTK_SUN7I
-	default 2 if EARLY_PRINTK_XGENE_MCDIVITT
-	default 2 if EARLY_PRINTK_XGENE_STORM
 	default 0
 
 choice EARLY_UART_SCIF_VERSION
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 16 21:11:06 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Sep 2024 21:11:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.799715.1209704 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sqIzw-0005hf-Fk; Mon, 16 Sep 2024 21:11:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 799715.1209704; Mon, 16 Sep 2024 21:11:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sqIzw-0005hV-Cs; Mon, 16 Sep 2024 21:11:04 +0000
Received: by outflank-mailman (input) for mailman id 799715;
 Mon, 16 Sep 2024 21:11:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sqIzw-0005hP-0s
 for xen-changelog@lists.xenproject.org; Mon, 16 Sep 2024 21:11:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sqIzv-0004ft-Uf
 for xen-changelog@lists.xenproject.org; Mon, 16 Sep 2024 21:11:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sqIzv-00062L-T8
 for xen-changelog@lists.xenproject.org; Mon, 16 Sep 2024 21:11:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5adgtscXsx/O2/SIWW7m/FHn77giy68E1JqDLLxKZJY=; b=uRn+i1yFNgTvd1zh8PaVCUvDns
	N8WkiadANZMFBr6y644FmIhqawnxtynTdb9ejg7Xws52uayd69FXZmhW2MEWXSZik9mBLdgNx0Zmm
	VZDujgQXW5WfUSmSC/TP55tudEctKSffHp2+mk6FYCEw14TPT4zksj30L8k7YQyUbqHc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Enable workaround for Cortex-A53 erratum #1530924
Message-Id: <E1sqIzv-00062L-T8@xenbits.xenproject.org>
Date: Mon, 16 Sep 2024 21:11:03 +0000

commit 6279b9a3be35f3f2aa8322d58018bd94150415f1
Author:     Andrei Cherechesu <andrei.cherechesu@nxp.com>
AuthorDate: Tue Sep 10 17:34:11 2024 +0300
Commit:     Julien Grall <julien@xen.org>
CommitDate: Mon Sep 16 22:00:45 2024 +0100

    xen/arm: Enable workaround for Cortex-A53 erratum #1530924
    
    All versions of Cortex-A53 cores are affected by the speculative
    AT instruction erratum, as mentioned in the Cortex-A53 Revision r0
    SDEN v21 documentation.
    
    Enabled ARM64_WORKAROUND_AT_SPECULATE for all versions of Cortex-A53
    cores, to avoid corrupting the TLB if performing a speculative AT
    instruction during a guest context switch.
    
    Signed-off-by: Andrei Cherechesu <andrei.cherechesu@nxp.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 docs/misc/arm/silicon-errata.txt | 1 +
 xen/arch/arm/cpuerrata.c         | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/docs/misc/arm/silicon-errata.txt b/docs/misc/arm/silicon-errata.txt
index fffca09656..853e06aec1 100644
--- a/docs/misc/arm/silicon-errata.txt
+++ b/docs/misc/arm/silicon-errata.txt
@@ -46,6 +46,7 @@ stable hypervisors.
 | ARM            | Cortex-A53      | #824069         | ARM64_ERRATUM_824069    |
 | ARM            | Cortex-A53      | #819472         | ARM64_ERRATUM_819472    |
 | ARM            | Cortex-A53      | #843419         | ARM64_ERRATUM_843419    |
+| ARM            | Cortex-A53      | #1530924        | N/A                     |
 | ARM            | Cortex-A55      | #1530923        | N/A                     |
 | ARM            | Cortex-A57      | #852523         | N/A                     |
 | ARM            | Cortex-A57      | #832075         | ARM64_ERRATUM_832075    |
diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c
index 2b7101ea25..afd0605922 100644
--- a/xen/arch/arm/cpuerrata.c
+++ b/xen/arch/arm/cpuerrata.c
@@ -683,6 +683,12 @@ static const struct arm_cpu_capabilities arm_errata[] = {
         .capability = ARM64_WORKAROUND_AT_SPECULATE,
         MIDR_ALL_VERSIONS(MIDR_CORTEX_A55),
     },
+    {
+        /* Cortex-A53 (All versions) */
+        .desc = "ARM erratum 1530924",
+        .capability = ARM64_WORKAROUND_AT_SPECULATE,
+        MIDR_ALL_VERSIONS(MIDR_CORTEX_A53),
+    },
     {},
 };
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 17 11:55:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Sep 2024 11:55:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.799938.1209886 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sqWnP-0004Nz-NK; Tue, 17 Sep 2024 11:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 799938.1209886; Tue, 17 Sep 2024 11:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sqWnP-0004Nr-Kf; Tue, 17 Sep 2024 11:55:03 +0000
Received: by outflank-mailman (input) for mailman id 799938;
 Tue, 17 Sep 2024 11:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sqWnN-0004Nl-Sm
 for xen-changelog@lists.xenproject.org; Tue, 17 Sep 2024 11:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sqWnN-00057y-QP
 for xen-changelog@lists.xenproject.org; Tue, 17 Sep 2024 11:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sqWnN-0003O7-OC
 for xen-changelog@lists.xenproject.org; Tue, 17 Sep 2024 11:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OwYBUxE3Hl3zBpj0dsO+HUHmzmKhWz6lGEJshVOjH+s=; b=1qst3wGkN/lwfd2oRdLFvZkh6f
	ORS/pINvFXcHvdnUTojO8BSB+ENAzOvjZsePeylKk5Do0kafMpU2dkOcAL4JBkhnRG7J6tYhwCh6W
	ZAa+T+4VO7rBUp/e16lYmQMMar0eGZ/gcdNEo2iV0CgCvwDJAWbsShEi9gvh2os23HJg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arm: Drop deprecated early printk platform options
Message-Id: <E1sqWnN-0003O7-OC@xenbits.xenproject.org>
Date: Tue, 17 Sep 2024 11:55:01 +0000

commit 4e1a3337455ea82f05b46fa467106ce6ec71c102
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Fri Sep 13 08:15:29 2024 +0200
Commit:     Julien Grall <julien@xen.org>
CommitDate: Mon Sep 16 21:54:27 2024 +0100

    arm: Drop deprecated early printk platform options
    
    The predefined configurations for early printk have been deprecated for
    a sufficient amount of time. Let's finally remove them.
    
    Note:
    In order not to lose these predefined configurations, I wrote a wiki
    page: https://wiki.xenproject.org/wiki/Xen_on_ARM_Early_Printk
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 docs/misc/arm/early-printk.txt |   4 --
 xen/arch/arm/Kconfig.debug     | 155 +++--------------------------------------
 2 files changed, 9 insertions(+), 150 deletions(-)

diff --git a/docs/misc/arm/early-printk.txt b/docs/misc/arm/early-printk.txt
index bc2d65aa2e..e6b9124a38 100644
--- a/docs/misc/arm/early-printk.txt
+++ b/docs/misc/arm/early-printk.txt
@@ -35,8 +35,4 @@ Other options depends on the driver selected:
 
   - For all other uarts there are no additional options.
 
-As a convenience it is also possible to select from a list of
-predefined configurations available in the list of choice for "Early
-printk" for specific platform.
-
 By default early printk is disabled.
diff --git a/xen/arch/arm/Kconfig.debug b/xen/arch/arm/Kconfig.debug
index eec860e88e..2fa0acd2a3 100644
--- a/xen/arch/arm/Kconfig.debug
+++ b/xen/arch/arm/Kconfig.debug
@@ -13,177 +13,67 @@ choice
 		Choose one of the UART drivers for early printk, then you'll
 		have to specify the parameters, like the base address.
 
-		Deprecated: Alternatively, there are platform specific options
-		which will have default values for the various parameters. But
-		such option will soon be removed.
-
 	config EARLY_UART_CHOICE_8250
 		select EARLY_UART_8250
 		bool "Early printk via 8250 UART"
 		help
 			Say Y here if you wish the early printk to direct their
-			output to a 8250 UART. You can use this option to
-			provide the parameters for the 8250 UART rather than
-			selecting one of the platform specific options below if
-			you know the parameters for the port.
+			output to a 8250 UART.
 
-			This option is preferred over the platform specific
-			options; the platform specific options are deprecated
-			and will soon be removed.
 	config EARLY_UART_CHOICE_CADENCE
 		select EARLY_UART_CADENCE
 		depends on ARM_64
 		bool "Early printk via Cadence UART"
 		help
 			Say Y here if you wish the early printk to direct their
-			output to a Cadence UART. You can use this option to
-			provide the parameters for the Cadence UART rather than
-			selecting one of the platform specific options below if
-			you know the parameters for the port.
+			output to a Cadence UART.
 
-			This option is preferred over the platform specific
-			options; the platform specific options are deprecated
-			and will soon be removed.
 	config EARLY_UART_CHOICE_EXYNOS4210
 		select EARLY_UART_EXYNOS4210
 		depends on ARM_32
 		bool "Early printk via Exynos4210 UART"
 		help
 			Say Y here if you wish the early printk to direct their
-			output to a Exynos 4210 UART. You can use this option to
-			provide the parameters for the Exynos 4210 UART rather than
-			selecting one of the platform specific options below if
-			you know the parameters for the port.
+			output to a Exynos 4210 UART.
 
-			This option is preferred over the platform specific
-			options; the platform specific options are deprecated
-			and will soon be removed.
 	config EARLY_UART_CHOICE_IMX_LPUART
 		select EARLY_UART_IMX_LPUART
 		depends on ARM_64
 		bool "Early printk via i.MX LPUART"
 		help
 			Say Y here if you wish the early printk to direct their
-			output to a i.MX LPUART. You can use this option to
-			provide the parameters for the i.MX LPUART rather than
-			selecting one of the platform specific options below if
-			you know the parameters for the port.
+			output to a i.MX LPUART.
+
 	config EARLY_UART_CHOICE_MESON
 		select EARLY_UART_MESON
 		depends on ARM_64
 		bool "Early printk via MESON UART"
 		help
 			Say Y here if you wish the early printk to direct their
-			output to a MESON UART. You can use this option to
-			provide the parameters for the MESON UART rather than
-			selecting one of the platform specific options below if
-			you know the parameters for the port.
+			output to a MESON UART.
 
-			This option is preferred over the platform specific
-			options; the platform specific options are deprecated
-			and will soon be removed.
 	config EARLY_UART_CHOICE_MVEBU
 		select EARLY_UART_MVEBU
 		depends on ARM_64
 		bool "Early printk via MVEBU UART"
 		help
 			Say Y here if you wish the early printk to direct their
-			output to a MVEBU UART. You can use this option to
-			provide the parameters for the MVEBU UART rather than
-			selecting one of the platform specific options below if
-			you know the parameters for the port.
+			output to a MVEBU UART.
 
-			This option is preferred over the platform specific
-			options; the platform specific options are deprecated
-			and will soon be removed.
 	config EARLY_UART_CHOICE_PL011
 		select EARLY_UART_PL011
 		bool "Early printk via PL011 UART"
 		help
 			Say Y here if you wish the early printk to direct their
-			output to a PL011 UART. You can use this option to
-			provide the parameters for the PL011 UART rather than
-			selecting one of the platform specific options below if
-			you know the parameters for the port.
+			output to a PL011 UART.
 
-			This option is preferred over the platform specific
-			options; the platform specific options are deprecated
-			and will soon be removed.
 	config EARLY_UART_CHOICE_SCIF
 		select EARLY_UART_SCIF
 		bool "Early printk via SCIF UART"
 		help
 			Say Y here if you wish the early printk to direct their
-			output to a SCIF UART. You can use this option to
-			provide the parameters for the SCIF UART rather than
-			selecting one of the platform specific options below if
-			you know the parameters for the port.
+			output to a SCIF UART.
 
-			This option is preferred over the platform specific
-			options; the platform specific options are deprecated
-			and will soon be removed.
-
-	config EARLY_PRINTK_BRCM
-		bool "Early printk with 8250 on Broadcom 7445D0 boards with A15 processors"
-		select EARLY_UART_8250
-	config EARLY_PRINTK_DRA7
-		bool "Early printk with 8250 on DRA7 platform"
-		select EARLY_UART_8250
-	config EARLY_PRINTK_EXYNOS5250
-		bool "Early printk with the second UART on Exynos5250"
-		select EARLY_UART_EXYNOS4210
-		depends on ARM_32
-	config EARLY_PRINTK_FASTMODEL
-		bool "Early printk with pl011 on ARM Fastmodel software emulators"
-		select EARLY_UART_PL011
-	config EARLY_PRINTK_HIKEY960
-		bool "Early printk with pl011 with Hikey 960"
-		select EARLY_UART_PL011
-	config EARLY_PRINTK_JUNO
-		bool "Early printk with pl011 on Juno platform"
-		select EARLY_UART_PL011
-	config EARLY_PRINTK_LAGER
-		bool "Early printk with SCIF0 on Renesas Lager board (R-Car H2 processor)"
-		select EARLY_UART_SCIF
-	config EARLY_PRINTK_MIDWAY
-		bool "Early printk with pl011 on Calxeda Midway processors"
-		select EARLY_UART_PL011
-	config EARLY_PRINTK_MVEBU
-		bool "Early printk with MVEBU for Marvell Armada 3700 SoCs"
-		select EARLY_UART_MVEBU
-		depends on ARM_64
-	config EARLY_PRINTK_OMAP5432
-		bool "Early printk with UART3 on TI OMAP5432 processors"
-		select EARLY_UART_8250
-	config EARLY_PRINTK_RCAR3
-		bool "Early printk with SCIF2 on Renesas R-Car Gen3 processors"
-		select EARLY_UART_SCIF
-	config EARLY_PRINTK_SEATTLE
-		bool "Early printk with pl011 for AMD Seattle processor"
-		select EARLY_UART_PL011
-	config EARLY_PRINTK_SUN6I
-		bool "Early printk with 8250 on Allwinner A31 processors"
-		select EARLY_UART_8250
-	config EARLY_PRINTK_SUN7I
-		bool "Early printk with 8250 on Allwinner A20 processors"
-		select EARLY_UART_8250
-	config EARLY_PRINTK_THUNDERX
-		bool "Early printk with pl011 for Cavium ThunderX processor"
-		select EARLY_UART_PL011
-		depends on ARM_64
-	config EARLY_PRINTK_VEXPRESS
-		bool "Early printk with pl011 for versatile express"
-		select EARLY_UART_PL011
-	config EARLY_PRINTK_XGENE_MCDIVITT
-		bool "Early printk with 820 on Xgene mcdivitt platform"
-		select EARLY_UART_8250
-	config EARLY_PRINTK_XGENE_STORM
-		bool "Early printk with 820 on Xgene storm platform"
-		select EARLY_UART_8250
-	config EARLY_PRINTK_ZYNQMP
-		bool "Early printk with Cadence UART for Xilinx ZynqMP SoCs"
-		select EARLY_UART_CADENCE
-		depends on ARM_64
 endchoice
 
 
@@ -219,25 +109,6 @@ config EARLY_UART_BASE_ADDRESS
 	depends on EARLY_PRINTK
 	hex "Early printk, physical base address of debug UART"
 	range 0x0 0xffffffff if ARM_32
-	default 0xF040AB00 if EARLY_PRINTK_BRCM
-	default 0x4806A000 if EARLY_PRINTK_DRA7
-	default 0x1c090000 if EARLY_PRINTK_FASTMODEL
-	default 0x12c20000 if EARLY_PRINTK_EXYNOS5250
-	default 0xfff32000 if EARLY_PRINTK_HIKEY960
-	default 0x7ff80000 if EARLY_PRINTK_JUNO
-	default 0xe6e60000 if EARLY_PRINTK_LAGER
-	default 0xfff36000 if EARLY_PRINTK_MIDWAY
-	default 0xd0012000 if EARLY_PRINTK_MVEBU
-	default 0x48020000 if EARLY_PRINTK_OMAP5432
-	default 0xe6e88000 if EARLY_PRINTK_RCAR3
-	default 0xe1010000 if EARLY_PRINTK_SEATTLE
-	default 0x01c28000 if EARLY_PRINTK_SUN6I
-	default 0x01c28000 if EARLY_PRINTK_SUN7I
-	default 0x87e024000000 if EARLY_PRINTK_THUNDERX
-	default 0x1c090000 if EARLY_PRINTK_VEXPRESS
-	default 0x1c021000 if EARLY_PRINTK_XGENE_MCDIVITT
-	default 0x1c020000 if EARLY_PRINTK_XGENE_STORM
-	default 0xff000000 if EARLY_PRINTK_ZYNQMP
 
 config EARLY_UART_PL011_BAUD_RATE
 	depends on EARLY_UART_PL011
@@ -250,7 +121,6 @@ config EARLY_UART_PL011_BAUD_RATE
 		not try to initialize the UART, so that bootloader or firmware
 		settings can be used for maximum compatibility.
 
-	default 115200 if EARLY_PRINTK_FASTMODEL
 	default 0
 
 config EARLY_UART_PL011_MMIO32
@@ -274,13 +144,6 @@ config EARLY_UART_8250_REG_SHIFT
 
 		Default to 0.
 
-	default 2 if EARLY_PRINTK_BRCM
-	default 2 if EARLY_PRINTK_DRA7
-	default 2 if EARLY_PRINTK_OMAP5432
-	default 2 if EARLY_PRINTK_SUN6I
-	default 2 if EARLY_PRINTK_SUN7I
-	default 2 if EARLY_PRINTK_XGENE_MCDIVITT
-	default 2 if EARLY_PRINTK_XGENE_STORM
 	default 0
 
 choice EARLY_UART_SCIF_VERSION
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 17 21:11:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Sep 2024 21:11:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.800110.1210037 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sqfTT-0005P6-B6; Tue, 17 Sep 2024 21:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 800110.1210037; Tue, 17 Sep 2024 21:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sqfTT-0005Ov-8D; Tue, 17 Sep 2024 21:11:03 +0000
Received: by outflank-mailman (input) for mailman id 800110;
 Tue, 17 Sep 2024 21:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sqfTS-0005OP-6H
 for xen-changelog@lists.xenproject.org; Tue, 17 Sep 2024 21:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sqfTS-0000IA-4m
 for xen-changelog@lists.xenproject.org; Tue, 17 Sep 2024 21:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sqfTS-0006Sq-1o
 for xen-changelog@lists.xenproject.org; Tue, 17 Sep 2024 21:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=R174x52XPMeL6JQRFkn47SIvtBRo6fGbhTtQ2VPM6xc=; b=KBqbBQrLgKQq9QUFAZDe0q2DAI
	3LsTTM11AikI8V0F+RsDmaV4qVJ+vtMNcBOnA5JM4u3Gnn5j3DkvknE6JxbUMu/07iIhNVzMG2V58
	EBW1nk1Wupt0+XkVz+hZKvulw6ql1TomngiIG/Wgm7lgYlVjG2dIZok5rmyl2XdWinz8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Enable workaround for Cortex-A53 erratum #1530924
Message-Id: <E1sqfTS-0006Sq-1o@xenbits.xenproject.org>
Date: Tue, 17 Sep 2024 21:11:02 +0000

commit 6279b9a3be35f3f2aa8322d58018bd94150415f1
Author:     Andrei Cherechesu <andrei.cherechesu@nxp.com>
AuthorDate: Tue Sep 10 17:34:11 2024 +0300
Commit:     Julien Grall <julien@xen.org>
CommitDate: Mon Sep 16 22:00:45 2024 +0100

    xen/arm: Enable workaround for Cortex-A53 erratum #1530924
    
    All versions of Cortex-A53 cores are affected by the speculative
    AT instruction erratum, as mentioned in the Cortex-A53 Revision r0
    SDEN v21 documentation.
    
    Enabled ARM64_WORKAROUND_AT_SPECULATE for all versions of Cortex-A53
    cores, to avoid corrupting the TLB if performing a speculative AT
    instruction during a guest context switch.
    
    Signed-off-by: Andrei Cherechesu <andrei.cherechesu@nxp.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 docs/misc/arm/silicon-errata.txt | 1 +
 xen/arch/arm/cpuerrata.c         | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/docs/misc/arm/silicon-errata.txt b/docs/misc/arm/silicon-errata.txt
index fffca09656..853e06aec1 100644
--- a/docs/misc/arm/silicon-errata.txt
+++ b/docs/misc/arm/silicon-errata.txt
@@ -46,6 +46,7 @@ stable hypervisors.
 | ARM            | Cortex-A53      | #824069         | ARM64_ERRATUM_824069    |
 | ARM            | Cortex-A53      | #819472         | ARM64_ERRATUM_819472    |
 | ARM            | Cortex-A53      | #843419         | ARM64_ERRATUM_843419    |
+| ARM            | Cortex-A53      | #1530924        | N/A                     |
 | ARM            | Cortex-A55      | #1530923        | N/A                     |
 | ARM            | Cortex-A57      | #852523         | N/A                     |
 | ARM            | Cortex-A57      | #832075         | ARM64_ERRATUM_832075    |
diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c
index 2b7101ea25..afd0605922 100644
--- a/xen/arch/arm/cpuerrata.c
+++ b/xen/arch/arm/cpuerrata.c
@@ -683,6 +683,12 @@ static const struct arm_cpu_capabilities arm_errata[] = {
         .capability = ARM64_WORKAROUND_AT_SPECULATE,
         MIDR_ALL_VERSIONS(MIDR_CORTEX_A55),
     },
+    {
+        /* Cortex-A53 (All versions) */
+        .desc = "ARM erratum 1530924",
+        .capability = ARM64_WORKAROUND_AT_SPECULATE,
+        MIDR_ALL_VERSIONS(MIDR_CORTEX_A53),
+    },
     {},
 };
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Sep 18 11:33:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Sep 2024 11:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.800270.1210204 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sqsvg-0005E0-La; Wed, 18 Sep 2024 11:33:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 800270.1210204; Wed, 18 Sep 2024 11:33:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sqsvg-0005Ds-IY; Wed, 18 Sep 2024 11:33:04 +0000
Received: by outflank-mailman (input) for mailman id 800270;
 Wed, 18 Sep 2024 11:33:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sqsvf-0005Dk-GD
 for xen-changelog@lists.xenproject.org; Wed, 18 Sep 2024 11:33:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sqsvf-0001dl-EW
 for xen-changelog@lists.xenproject.org; Wed, 18 Sep 2024 11:33:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sqsvf-0003uu-Bm
 for xen-changelog@lists.xenproject.org; Wed, 18 Sep 2024 11:33:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1RGXgloxrO0st4zCnTwrZ35wzBp9Of0AYKDQ+WaDfKY=; b=Vc/FcmevNkH1knT3fJBRk0mEEx
	d26nIrzPX1tawZ3HeV550dWpMOfYCZ/yNSOW0QM5V4whuPrlwABp6shU9BF1RhexToWL+b2y0KKQ2
	oav9Lo4kXHPEqBL0yux3WJ9KX+wDi+rVmasXku/XNB2d4cRtBVIKXDG0H0GWkbivv+E8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arm/smmu: Complete SMR masking support
Message-Id: <E1sqsvf-0003uu-Bm@xenbits.xenproject.org>
Date: Wed, 18 Sep 2024 11:33:03 +0000

commit ef3b4768b347622065747eb272fd9849a7d85035
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Wed Sep 4 14:43:49 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Sep 18 12:31:30 2024 +0100

    arm/smmu: Complete SMR masking support
    
    SMR masking support allows deriving a mask either using a 2-cell iommu
    specifier (per master) or stream-match-mask SMMU dt property (global
    config). Even though the mask is stored in the fwid when adding a
    device (in arm_smmu_dt_xlate_generic()), we still set it to 0 when
    allocating SMEs (in arm_smmu_master_alloc_smes()). So at the end, we
    always ignore the mask when programming SMRn registers. This leads to
    SMMU failures. Fix it by completing the support.
    
    A bit of history:
    Linux support for SMR allocation was mainly done with:
    588888a7399d ("iommu/arm-smmu: Intelligent SMR allocation")
    021bb8420d44 ("iommu/arm-smmu: Wire up generic configuration support")
    
    Taking the mask into account in arm_smmu_master_alloc_smes() was added
    as part of the second commit, although quite hidden in the thicket of
    other changes. We backported only the first patch with: 0435784cc75d
    ("xen/arm: smmuv1: Intelligent SMR allocation") but the changes to take
    the mask into account were missed.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Rahul Singh <rahul.singh@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/smmu.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index c9e28a8509..03d22bce1e 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -1620,19 +1620,21 @@ static int arm_smmu_master_alloc_smes(struct device *dev)
 	spin_lock(&smmu->stream_map_lock);
 	/* Figure out a viable stream map entry allocation */
 	for_each_cfg_sme(cfg, i, idx, fwspec->num_ids) {
+		uint16_t mask = (fwspec->ids[i] >> SMR_MASK_SHIFT) & SMR_MASK_MASK;
+
 		if (idx != INVALID_SMENDX) {
 			ret = -EEXIST;
 			goto out_err;
 		}
 
-		ret = arm_smmu_find_sme(smmu, fwspec->ids[i], 0);
+		ret = arm_smmu_find_sme(smmu, fwspec->ids[i], mask);
 		if (ret < 0)
 			goto out_err;
 
 		idx = ret;
 		if (smrs && smmu->s2crs[idx].count == 0) {
 			smrs[idx].id = fwspec->ids[i];
-			smrs[idx].mask = 0; /* We don't currently share SMRs */
+			smrs[idx].mask = mask;
 			smrs[idx].valid = true;
 		}
 		smmu->s2crs[idx].count++;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 18 20:33:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Sep 2024 20:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.800435.1210364 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sr1MH-0005Aj-5a; Wed, 18 Sep 2024 20:33:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 800435.1210364; Wed, 18 Sep 2024 20:33:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sr1MH-0005Ab-2j; Wed, 18 Sep 2024 20:33:05 +0000
Received: by outflank-mailman (input) for mailman id 800435;
 Wed, 18 Sep 2024 20:33:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sr1MF-0005AV-T9
 for xen-changelog@lists.xenproject.org; Wed, 18 Sep 2024 20:33:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sr1MF-0004VI-Pc
 for xen-changelog@lists.xenproject.org; Wed, 18 Sep 2024 20:33:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sr1MF-0003kY-Mu
 for xen-changelog@lists.xenproject.org; Wed, 18 Sep 2024 20:33:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=14SCaNYf+10sq4vZj/Z2W6lNNEhRx8NoN/9PkooINOs=; b=bh26UKdT+VRJK4AMa3Q2hese2X
	dOf10Gl33y0krzjvtv6AkY6R76wkOBy1uNRxKnyvMcEKMzfJCjyggrl7vjaQgsrP+6QFrvmUwSsiG
	WC+86aAKjjU1hfmZHyea3HngnMtvgn//e53PjRuqdseOtn5Zm1biqZeIYXuIvTCtJKBo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation/eclair: add deviation for MISRA C 2012 Dir 4.10
Message-Id: <E1sr1MF-0003kY-Mu@xenbits.xenproject.org>
Date: Wed, 18 Sep 2024 20:33:03 +0000

commit 03400a2a2699476373d252ec6fcf9f3af92aed99
Author:     Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
AuthorDate: Tue Sep 10 16:15:36 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Sep 18 13:26:46 2024 -0700

    automation/eclair: add deviation for MISRA C 2012 Dir 4.10
    
    Add deviation to address violations of MISRA C:2012 Directive 4.10
    ("Precautions shall be taken in order to prevent the contents of a
    header file being included more than once").
    
    This deviation suppresses the violation arising from autogenerated file
    xen/include/generated/autoconf.h
    
    No functional change.
    
    Signed-off-by: Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/deviations.ecl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
index 2bb118248b..2f58f29203 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -76,6 +76,7 @@ they are not instances of commented-out code."
 conform to the directive."
 -config=MC3R1.D4.10,reports+={safe, "first_area(text(^/\\* This file is legitimately included multiple times\\. \\*/$, begin-4))"}
 -config=MC3R1.D4.10,reports+={safe, "first_area(text(^/\\* Generated file, do not edit! \\*/$, begin-3))"}
+-config=MC3R1.D4.10,reports+={safe, "all_area(all_loc(file(^xen/include/generated/autoconf.h$)))"}
 -doc_end
 
 -doc_begin="Including multiple times a .c file is safe because every function or data item
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 18 20:33:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Sep 2024 20:33:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.800436.1210368 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sr1MR-0005CY-6p; Wed, 18 Sep 2024 20:33:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 800436.1210368; Wed, 18 Sep 2024 20:33:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sr1MR-0005CQ-4G; Wed, 18 Sep 2024 20:33:15 +0000
Received: by outflank-mailman (input) for mailman id 800436;
 Wed, 18 Sep 2024 20:33:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sr1MP-0005CE-Td
 for xen-changelog@lists.xenproject.org; Wed, 18 Sep 2024 20:33:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sr1MP-0004VT-Sg
 for xen-changelog@lists.xenproject.org; Wed, 18 Sep 2024 20:33:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sr1MP-0003my-Rm
 for xen-changelog@lists.xenproject.org; Wed, 18 Sep 2024 20:33:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aGgA8rgV1MGztiv5wuRRBqUdMxH3bSf9tkEfgCvjL2s=; b=PKKFwKFAxQSFCcTm9rzr1n4Eo6
	fbfI6vphbNmNelzmBjoqySgBSh8u2xwugEZhy9Rq2z6vGn/ogNf01rIQchM9h07cqbD7y3uQs8pCJ
	Jj70sPPP523z86gwYhG9aD5QPtoGE2mqASZ+0Rc3Q8iFydh19nyga3dm4BXOdXITbcvI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs: fusa: Add requirements for emulated uart
Message-Id: <E1sr1MP-0003my-Rm@xenbits.xenproject.org>
Date: Wed, 18 Sep 2024 20:33:13 +0000

commit 0843b40c470915617d0ae9a84085630c01d5fe3c
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Sep 17 14:13:36 2024 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Sep 18 13:27:10 2024 -0700

    docs: fusa: Add requirements for emulated uart
    
    Add the requirements for emulated SBSA UART.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 docs/fusa/reqs/design-reqs/arm64/sbsa-uart.rst | 224 +++++++++++++++++++++++++
 docs/fusa/reqs/market-reqs/reqs.rst            |  15 ++
 docs/fusa/reqs/product-reqs/arm64/reqs.rst     |  19 +++
 3 files changed, 258 insertions(+)

diff --git a/docs/fusa/reqs/design-reqs/arm64/sbsa-uart.rst b/docs/fusa/reqs/design-reqs/arm64/sbsa-uart.rst
new file mode 100644
index 0000000000..89598fa8a5
--- /dev/null
+++ b/docs/fusa/reqs/design-reqs/arm64/sbsa-uart.rst
@@ -0,0 +1,224 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+SBSA UART
+=========
+
+The following are the requirements related to SBSA UART [1] emulated and
+exposed by Xen to Arm64 domains.
+
+Probe the UART device tree node from a domain
+---------------------------------------------
+
+`XenSwdgn~arm64_uart_probe_dt~1`
+
+Description:
+Xen shall generate a device tree node for the SBSA UART (in accordance to Arm
+SBSA UART device tree binding [2]) in the domain device tree.
+
+Rationale:
+
+Comments:
+Domains can detect the presence of the SBSA UART device tree node.
+
+Covers:
+ - `XenProd~emulated_uart~1`
+
+Transmit data in software polling mode
+--------------------------------------
+
+`XenSwdgn~arm64_uart_transmit_data_poll_mode~1`
+
+Description:
+Xen shall support transmission of data in polling mode.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_uart~1`
+
+Transmit data in interrupt driven mode
+--------------------------------------
+
+`XenSwdgn~arm64_uart_transmit_data_interrupt_mode~1`
+
+Description:
+Xen shall support transmission of data in interrupt driven mode.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_uart~1`
+
+Receive data in software polling mode
+-------------------------------------
+
+`XenSwdgn~arm64_uart_receive_data_polling_mode~1`
+
+Description:
+Xen shall support reception of data in polling mode.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_uart~1`
+
+Receive data in interrupt driven mode
+-------------------------------------
+
+`XenSwdgn~arm64_uart_receive_data_interrupt_mode~1`
+
+Description:
+Xen shall support reception of data in interrupt driven mode.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_uart~1`
+
+Access UART data register
+-------------------------
+
+`XenSwdgn~arm64_uart_access_data_register~1`
+
+Description:
+Xen shall emulate the UARTDR register.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_uart~1`
+
+Access UART receive status register
+-----------------------------------
+
+`XenSwdgn~arm64_uart_access_receive_status_register~1`
+
+Description:
+Xen shall emulate the UARTRSR register.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_uart~1`
+
+Access UART flag register
+-------------------------
+
+`XenSwdgn~arm64_uart_access_flag_register~1`
+
+Description:
+Xen shall emulate the UARTFR register.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_uart~1`
+
+Access UART mask set/clear register
+-----------------------------------
+
+`XenSwdgn~arm64_uart_access_mask_register~1`
+
+Description:
+Xen shall emulate the UARTIMSC register.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_uart~1`
+
+Access UART raw interrupt status register
+-----------------------------------------
+
+`XenSwdgn~arm64_uart_access_raw_interrupt_status_register~1`
+
+Description:
+Xen shall emulate the UARTRIS register.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_uart~1`
+
+Access UART masked interrupt status register
+--------------------------------------------
+
+`XenSwdgn~arm64_uart_access_mask_irq_status_register~1`
+
+Description:
+Xen shall emulate the UARTMIS register.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_uart~1`
+
+Access UART interrupt clear register
+------------------------------------
+
+`XenSwdgn~arm64_uart_access_irq_clear_register~1`
+
+Description:
+Xen shall emulate the UARTICR register.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_uart~1`
+
+Receive UART TX interrupt
+-------------------------
+
+`XenSwdgn~arm64_uart_receive_tx_irq~1`
+
+Description:
+Xen shall generate UART interrupt when the UART transmit interrupt condition is
+met.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_uart~1`
+
+Receive UART RX interrupt reception
+-----------------------------------
+
+`XenSwdgn~arm64_uart_receive_rx_irq~1`
+
+Description:
+Xen shall generate UART interrupt when the UART receive interrupt condition is
+met.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_uart~1`
+
+[1] Arm Base System Architecture, chapter B
+[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/serial/arm_sbsa_uart.txt
\ No newline at end of file
diff --git a/docs/fusa/reqs/market-reqs/reqs.rst b/docs/fusa/reqs/market-reqs/reqs.rst
index 9c98c84a9a..e98f348cf4 100644
--- a/docs/fusa/reqs/market-reqs/reqs.rst
+++ b/docs/fusa/reqs/market-reqs/reqs.rst
@@ -32,3 +32,18 @@ Comments:
 
 Needs:
  - XenProd
+
+Provide console to the VMs
+--------------------------
+
+`XenMkt~provide_console_vms~1`
+
+Description:
+Xen shall provide a console to a VM.
+
+Rationale:
+
+Comments:
+
+Needs:
+ - XenProd
\ No newline at end of file
diff --git a/docs/fusa/reqs/product-reqs/arm64/reqs.rst b/docs/fusa/reqs/product-reqs/arm64/reqs.rst
index 7aa3eeab6a..97e90813ec 100644
--- a/docs/fusa/reqs/product-reqs/arm64/reqs.rst
+++ b/docs/fusa/reqs/product-reqs/arm64/reqs.rst
@@ -21,3 +21,22 @@ Covers:
 
 Needs:
  - XenSwdgn
+
+Emulated UART
+-------------
+
+`XenProd~emulated_uart~1`
+
+Description:
+Xen shall provide an "Arm SBSA UART" compliant device to the domains.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenMkt~run_arm64_vms~1`
+ - `XenMkt~provide_console_vms~1`
+
+Needs:
+ - XenSwdgn
\ No newline at end of file
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 19 04:33:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Sep 2024 04:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.800497.1210422 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sr8ql-0008K6-5a; Thu, 19 Sep 2024 04:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 800497.1210422; Thu, 19 Sep 2024 04:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sr8ql-0008Jy-2o; Thu, 19 Sep 2024 04:33:03 +0000
Received: by outflank-mailman (input) for mailman id 800497;
 Thu, 19 Sep 2024 04:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sr8qk-0008Js-1m
 for xen-changelog@lists.xenproject.org; Thu, 19 Sep 2024 04:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sr8qk-0004bw-0j
 for xen-changelog@lists.xenproject.org; Thu, 19 Sep 2024 04:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sr8qj-0000DG-U0
 for xen-changelog@lists.xenproject.org; Thu, 19 Sep 2024 04:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gA4by8g/9sL8xnE8kF5uJJTb9FQft0AlZiDyuzKYFr8=; b=7CpotU5YC59U5es+UJqjOd7E/9
	rfEHMrQR8DA729cQFFrryjdnZf3QAhoGlDaaZ1RhCrJVp028poxw8CbOhkB38nhAPWHO2legCGsGl
	lMggSLSO1jPWE6ZT9eGOS4xoR8ljGOH7SwZQKWx5UYkDKL75Jjv2P6fk93qaEpPAt9wc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arm/smmu: Complete SMR masking support
Message-Id: <E1sr8qj-0000DG-U0@xenbits.xenproject.org>
Date: Thu, 19 Sep 2024 04:33:01 +0000

commit ef3b4768b347622065747eb272fd9849a7d85035
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Wed Sep 4 14:43:49 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Sep 18 12:31:30 2024 +0100

    arm/smmu: Complete SMR masking support
    
    SMR masking support allows deriving a mask either using a 2-cell iommu
    specifier (per master) or stream-match-mask SMMU dt property (global
    config). Even though the mask is stored in the fwid when adding a
    device (in arm_smmu_dt_xlate_generic()), we still set it to 0 when
    allocating SMEs (in arm_smmu_master_alloc_smes()). So at the end, we
    always ignore the mask when programming SMRn registers. This leads to
    SMMU failures. Fix it by completing the support.
    
    A bit of history:
    Linux support for SMR allocation was mainly done with:
    588888a7399d ("iommu/arm-smmu: Intelligent SMR allocation")
    021bb8420d44 ("iommu/arm-smmu: Wire up generic configuration support")
    
    Taking the mask into account in arm_smmu_master_alloc_smes() was added
    as part of the second commit, although quite hidden in the thicket of
    other changes. We backported only the first patch with: 0435784cc75d
    ("xen/arm: smmuv1: Intelligent SMR allocation") but the changes to take
    the mask into account were missed.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Rahul Singh <rahul.singh@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/smmu.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index c9e28a8509..03d22bce1e 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -1620,19 +1620,21 @@ static int arm_smmu_master_alloc_smes(struct device *dev)
 	spin_lock(&smmu->stream_map_lock);
 	/* Figure out a viable stream map entry allocation */
 	for_each_cfg_sme(cfg, i, idx, fwspec->num_ids) {
+		uint16_t mask = (fwspec->ids[i] >> SMR_MASK_SHIFT) & SMR_MASK_MASK;
+
 		if (idx != INVALID_SMENDX) {
 			ret = -EEXIST;
 			goto out_err;
 		}
 
-		ret = arm_smmu_find_sme(smmu, fwspec->ids[i], 0);
+		ret = arm_smmu_find_sme(smmu, fwspec->ids[i], mask);
 		if (ret < 0)
 			goto out_err;
 
 		idx = ret;
 		if (smrs && smmu->s2crs[idx].count == 0) {
 			smrs[idx].id = fwspec->ids[i];
-			smrs[idx].mask = 0; /* We don't currently share SMRs */
+			smrs[idx].mask = mask;
 			smrs[idx].valid = true;
 		}
 		smmu->s2crs[idx].count++;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 19 22:11:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Sep 2024 22:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.800953.1210951 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1srPMd-0005X9-Ir; Thu, 19 Sep 2024 22:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 800953.1210951; Thu, 19 Sep 2024 22:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1srPMd-0005X1-GG; Thu, 19 Sep 2024 22:11:03 +0000
Received: by outflank-mailman (input) for mailman id 800953;
 Thu, 19 Sep 2024 22:11:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1srPMb-0005Wv-Pz
 for xen-changelog@lists.xenproject.org; Thu, 19 Sep 2024 22:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1srPMb-0008L3-MX
 for xen-changelog@lists.xenproject.org; Thu, 19 Sep 2024 22:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1srPMb-0001MG-Kc
 for xen-changelog@lists.xenproject.org; Thu, 19 Sep 2024 22:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xvLHAec7lhYX4VThuGXRgEnfsSDFjgUU0hFCLhvbQe0=; b=blKyoP8PxW3y9DJPGyAuiMnn1m
	QujLsEgHv5vemJnzLfPWb+pSJ3SfADZbfF5+3tz8IZb3I8OIJOy+DvR4fBJTI1udNdFADYNy0tXF2
	/A5ymWVbVyrQUmoMoJDPrYP+PRjbdWJdt3e/TUGyuzRxZePS+/VMQAHALcH+Y0Y1QSvk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation/eclair: add deviation for MISRA C 2012 Dir 4.10
Message-Id: <E1srPMb-0001MG-Kc@xenbits.xenproject.org>
Date: Thu, 19 Sep 2024 22:11:01 +0000

commit 03400a2a2699476373d252ec6fcf9f3af92aed99
Author:     Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
AuthorDate: Tue Sep 10 16:15:36 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Sep 18 13:26:46 2024 -0700

    automation/eclair: add deviation for MISRA C 2012 Dir 4.10
    
    Add deviation to address violations of MISRA C:2012 Directive 4.10
    ("Precautions shall be taken in order to prevent the contents of a
    header file being included more than once").
    
    This deviation suppresses the violation arising from autogenerated file
    xen/include/generated/autoconf.h
    
    No functional change.
    
    Signed-off-by: Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/deviations.ecl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
index 2bb118248b..2f58f29203 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -76,6 +76,7 @@ they are not instances of commented-out code."
 conform to the directive."
 -config=MC3R1.D4.10,reports+={safe, "first_area(text(^/\\* This file is legitimately included multiple times\\. \\*/$, begin-4))"}
 -config=MC3R1.D4.10,reports+={safe, "first_area(text(^/\\* Generated file, do not edit! \\*/$, begin-3))"}
+-config=MC3R1.D4.10,reports+={safe, "all_area(all_loc(file(^xen/include/generated/autoconf.h$)))"}
 -doc_end
 
 -doc_begin="Including multiple times a .c file is safe because every function or data item
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 19 22:11:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Sep 2024 22:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.800954.1210955 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1srPMm-0005Z1-KO; Thu, 19 Sep 2024 22:11:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 800954.1210955; Thu, 19 Sep 2024 22:11:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1srPMm-0005Yt-Hd; Thu, 19 Sep 2024 22:11:12 +0000
Received: by outflank-mailman (input) for mailman id 800954;
 Thu, 19 Sep 2024 22:11:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1srPMl-0005Yd-RD
 for xen-changelog@lists.xenproject.org; Thu, 19 Sep 2024 22:11:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1srPMl-0008LQ-Pl
 for xen-changelog@lists.xenproject.org; Thu, 19 Sep 2024 22:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1srPMl-0001NN-Oi
 for xen-changelog@lists.xenproject.org; Thu, 19 Sep 2024 22:11:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vtpc5L4TIF7BtyF2pqFiB9M4zzZgvS7bWZqAwf2tz8M=; b=pH/7G0az/UfvmoOCtJiJqXqYKW
	dnEK+gYzascPwzak7XM4dvrBkFzc11/9fgR3EFj2xLyIc2ziGt+ewfXJMuB8QRM0Hxwv96oyfRVQs
	5kEnPdItlMpBO3+nKtCdjGY5KOq7X8vfx7g1H076p7hMapXk+KZgZp1pO/bp6Vnz2hPI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs: fusa: Add requirements for emulated uart
Message-Id: <E1srPMl-0001NN-Oi@xenbits.xenproject.org>
Date: Thu, 19 Sep 2024 22:11:11 +0000

commit 0843b40c470915617d0ae9a84085630c01d5fe3c
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Sep 17 14:13:36 2024 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Sep 18 13:27:10 2024 -0700

    docs: fusa: Add requirements for emulated uart
    
    Add the requirements for emulated SBSA UART.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 docs/fusa/reqs/design-reqs/arm64/sbsa-uart.rst | 224 +++++++++++++++++++++++++
 docs/fusa/reqs/market-reqs/reqs.rst            |  15 ++
 docs/fusa/reqs/product-reqs/arm64/reqs.rst     |  19 +++
 3 files changed, 258 insertions(+)

diff --git a/docs/fusa/reqs/design-reqs/arm64/sbsa-uart.rst b/docs/fusa/reqs/design-reqs/arm64/sbsa-uart.rst
new file mode 100644
index 0000000000..89598fa8a5
--- /dev/null
+++ b/docs/fusa/reqs/design-reqs/arm64/sbsa-uart.rst
@@ -0,0 +1,224 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+SBSA UART
+=========
+
+The following are the requirements related to SBSA UART [1] emulated and
+exposed by Xen to Arm64 domains.
+
+Probe the UART device tree node from a domain
+---------------------------------------------
+
+`XenSwdgn~arm64_uart_probe_dt~1`
+
+Description:
+Xen shall generate a device tree node for the SBSA UART (in accordance to Arm
+SBSA UART device tree binding [2]) in the domain device tree.
+
+Rationale:
+
+Comments:
+Domains can detect the presence of the SBSA UART device tree node.
+
+Covers:
+ - `XenProd~emulated_uart~1`
+
+Transmit data in software polling mode
+--------------------------------------
+
+`XenSwdgn~arm64_uart_transmit_data_poll_mode~1`
+
+Description:
+Xen shall support transmission of data in polling mode.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_uart~1`
+
+Transmit data in interrupt driven mode
+--------------------------------------
+
+`XenSwdgn~arm64_uart_transmit_data_interrupt_mode~1`
+
+Description:
+Xen shall support transmission of data in interrupt driven mode.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_uart~1`
+
+Receive data in software polling mode
+-------------------------------------
+
+`XenSwdgn~arm64_uart_receive_data_polling_mode~1`
+
+Description:
+Xen shall support reception of data in polling mode.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_uart~1`
+
+Receive data in interrupt driven mode
+-------------------------------------
+
+`XenSwdgn~arm64_uart_receive_data_interrupt_mode~1`
+
+Description:
+Xen shall support reception of data in interrupt driven mode.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_uart~1`
+
+Access UART data register
+-------------------------
+
+`XenSwdgn~arm64_uart_access_data_register~1`
+
+Description:
+Xen shall emulate the UARTDR register.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_uart~1`
+
+Access UART receive status register
+-----------------------------------
+
+`XenSwdgn~arm64_uart_access_receive_status_register~1`
+
+Description:
+Xen shall emulate the UARTRSR register.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_uart~1`
+
+Access UART flag register
+-------------------------
+
+`XenSwdgn~arm64_uart_access_flag_register~1`
+
+Description:
+Xen shall emulate the UARTFR register.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_uart~1`
+
+Access UART mask set/clear register
+-----------------------------------
+
+`XenSwdgn~arm64_uart_access_mask_register~1`
+
+Description:
+Xen shall emulate the UARTIMSC register.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_uart~1`
+
+Access UART raw interrupt status register
+-----------------------------------------
+
+`XenSwdgn~arm64_uart_access_raw_interrupt_status_register~1`
+
+Description:
+Xen shall emulate the UARTRIS register.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_uart~1`
+
+Access UART masked interrupt status register
+--------------------------------------------
+
+`XenSwdgn~arm64_uart_access_mask_irq_status_register~1`
+
+Description:
+Xen shall emulate the UARTMIS register.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_uart~1`
+
+Access UART interrupt clear register
+------------------------------------
+
+`XenSwdgn~arm64_uart_access_irq_clear_register~1`
+
+Description:
+Xen shall emulate the UARTICR register.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_uart~1`
+
+Receive UART TX interrupt
+-------------------------
+
+`XenSwdgn~arm64_uart_receive_tx_irq~1`
+
+Description:
+Xen shall generate UART interrupt when the UART transmit interrupt condition is
+met.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_uart~1`
+
+Receive UART RX interrupt reception
+-----------------------------------
+
+`XenSwdgn~arm64_uart_receive_rx_irq~1`
+
+Description:
+Xen shall generate UART interrupt when the UART receive interrupt condition is
+met.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenProd~emulated_uart~1`
+
+[1] Arm Base System Architecture, chapter B
+[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/serial/arm_sbsa_uart.txt
\ No newline at end of file
diff --git a/docs/fusa/reqs/market-reqs/reqs.rst b/docs/fusa/reqs/market-reqs/reqs.rst
index 9c98c84a9a..e98f348cf4 100644
--- a/docs/fusa/reqs/market-reqs/reqs.rst
+++ b/docs/fusa/reqs/market-reqs/reqs.rst
@@ -32,3 +32,18 @@ Comments:
 
 Needs:
  - XenProd
+
+Provide console to the VMs
+--------------------------
+
+`XenMkt~provide_console_vms~1`
+
+Description:
+Xen shall provide a console to a VM.
+
+Rationale:
+
+Comments:
+
+Needs:
+ - XenProd
\ No newline at end of file
diff --git a/docs/fusa/reqs/product-reqs/arm64/reqs.rst b/docs/fusa/reqs/product-reqs/arm64/reqs.rst
index 7aa3eeab6a..97e90813ec 100644
--- a/docs/fusa/reqs/product-reqs/arm64/reqs.rst
+++ b/docs/fusa/reqs/product-reqs/arm64/reqs.rst
@@ -21,3 +21,22 @@ Covers:
 
 Needs:
  - XenSwdgn
+
+Emulated UART
+-------------
+
+`XenProd~emulated_uart~1`
+
+Description:
+Xen shall provide an "Arm SBSA UART" compliant device to the domains.
+
+Rationale:
+
+Comments:
+
+Covers:
+ - `XenMkt~run_arm64_vms~1`
+ - `XenMkt~provide_console_vms~1`
+
+Needs:
+ - XenSwdgn
\ No newline at end of file
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 20 22:55:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Sep 2024 22:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.801255.1211291 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1srmWn-00026L-0d; Fri, 20 Sep 2024 22:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 801255.1211291; Fri, 20 Sep 2024 22:55:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1srmWm-00026B-Tw; Fri, 20 Sep 2024 22:55:04 +0000
Received: by outflank-mailman (input) for mailman id 801255;
 Fri, 20 Sep 2024 22:55:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1srmWl-000265-Ho
 for xen-changelog@lists.xenproject.org; Fri, 20 Sep 2024 22:55:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1srmWl-000319-Gw
 for xen-changelog@lists.xenproject.org; Fri, 20 Sep 2024 22:55:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1srmWl-0007GV-Dw
 for xen-changelog@lists.xenproject.org; Fri, 20 Sep 2024 22:55:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=H0ws4s1m50yO5LzGNNfguFRq0mMkv2BPNLyqJVTsHNM=; b=FRB+SNnQeF0WmD83LrlICqB4dL
	BBf9mhq8igJ77E7NofKA6tQNhFL2f8sIM1R97aE9o2k8ls+QFayyUfKUoLJ3ZpRRb07ge39LdkpsL
	9aRBB3fER6TwOfG5moJfkLoulw9LveBQiIYcQyKthh0dDHau4SPb/sQcyJXCuHE4lXCo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs/misra: add R17.2 and R18.2
Message-Id: <E1srmWl-0007GV-Dw@xenbits.xenproject.org>
Date: Fri, 20 Sep 2024 22:55:03 +0000

commit 7298e635193f1f3a64f2df506b7a251295d92251
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Wed Sep 18 13:23:19 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Sep 20 15:47:48 2024 -0700

    docs/misra: add R17.2 and R18.2
    
    The Xen community is already informally following both rules. Let's make
    it explicit. Both rules have zero violations, only cautions. While we
    want to go down to zero cautions in time, adding both rules to rules.rst
    enables us to immediately make both rules gating in the ECLAIR job part
    of gitlab-ci.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Acked-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 docs/misra/rules.rst | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
index e99cb81089..4a144da8d6 100644
--- a/docs/misra/rules.rst
+++ b/docs/misra/rules.rst
@@ -561,6 +561,13 @@ maintainers if you want to suggest a change.
      - The features of <stdarg.h> shall not be used
      -
 
+   * - `Rule 17.2 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_17_02.c>`_
+     - Required
+     - Functions shall not call themselves, either directly or indirectly
+     - Limited forms of recursion are allowed if the recursion is bound
+       (there is an upper limit and the upper limit is enforced.) The
+       bounding should be explained in a comment or in a deviation.
+
    * - `Rule 17.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_17_03.c>`_
      - Mandatory
      - A function shall not be declared implicitly
@@ -593,6 +600,12 @@ maintainers if you want to suggest a change.
        submitting new patches please try to decrease the number of
        violations when possible.
 
+   * - `Rule 18.1 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_18_01.c>`_
+     - Required
+     - A pointer resulting from arithmetic on a pointer operand shall
+       address an element of the same array as that pointer operand
+     -
+
    * - `Rule 18.2 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_18_02.c>`_
      - Required
      - Subtraction between pointers shall only be applied to pointers
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Sep 21 21:22:08 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Sep 2024 21:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.801438.1211408 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ss7YI-0002Uu-9E; Sat, 21 Sep 2024 21:22:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 801438.1211408; Sat, 21 Sep 2024 21:22:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ss7YI-0002Uk-6E; Sat, 21 Sep 2024 21:22:02 +0000
Received: by outflank-mailman (input) for mailman id 801438;
 Sat, 21 Sep 2024 21:22:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ss7YH-0002Ue-Ks
 for xen-changelog@lists.xenproject.org; Sat, 21 Sep 2024 21:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ss7YH-0002wG-JI
 for xen-changelog@lists.xenproject.org; Sat, 21 Sep 2024 21:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ss7YH-0000hW-Ev
 for xen-changelog@lists.xenproject.org; Sat, 21 Sep 2024 21:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=h7x7iL7V1H+bmwfPqtw2DFZLO4B9drkGlXJczhlW9Sw=; b=h89kWJsU1htXyn8A58S8XFELU4
	/25aIigyRroSncfe/mvJQxMA0jOlENkVZvPhvBjVOYexcWhP2pkfd2XOwdgSEPME3ZwFn3pdqYoil
	qBEjVWPgWRVBsyyZplN5DHoQATFbDM89aP1GBOco+MePSM78ywrlLeyeDVhfZilyEZNE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs/misra: add R17.2 and R18.2
Message-Id: <E1ss7YH-0000hW-Ev@xenbits.xenproject.org>
Date: Sat, 21 Sep 2024 21:22:01 +0000

commit 7298e635193f1f3a64f2df506b7a251295d92251
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Wed Sep 18 13:23:19 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Sep 20 15:47:48 2024 -0700

    docs/misra: add R17.2 and R18.2
    
    The Xen community is already informally following both rules. Let's make
    it explicit. Both rules have zero violations, only cautions. While we
    want to go down to zero cautions in time, adding both rules to rules.rst
    enables us to immediately make both rules gating in the ECLAIR job part
    of gitlab-ci.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Acked-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 docs/misra/rules.rst | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
index e99cb81089..4a144da8d6 100644
--- a/docs/misra/rules.rst
+++ b/docs/misra/rules.rst
@@ -561,6 +561,13 @@ maintainers if you want to suggest a change.
      - The features of <stdarg.h> shall not be used
      -
 
+   * - `Rule 17.2 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_17_02.c>`_
+     - Required
+     - Functions shall not call themselves, either directly or indirectly
+     - Limited forms of recursion are allowed if the recursion is bound
+       (there is an upper limit and the upper limit is enforced.) The
+       bounding should be explained in a comment or in a deviation.
+
    * - `Rule 17.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_17_03.c>`_
      - Mandatory
      - A function shall not be declared implicitly
@@ -593,6 +600,12 @@ maintainers if you want to suggest a change.
        submitting new patches please try to decrease the number of
        violations when possible.
 
+   * - `Rule 18.1 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_18_01.c>`_
+     - Required
+     - A pointer resulting from arithmetic on a pointer operand shall
+       address an element of the same array as that pointer operand
+     -
+
    * - `Rule 18.2 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_18_02.c>`_
      - Required
      - Subtraction between pointers shall only be applied to pointers
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Sep 23 14:44:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Sep 2024 14:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802097.1212217 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sskIH-0005Mj-6o; Mon, 23 Sep 2024 14:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802097.1212217; Mon, 23 Sep 2024 14:44:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sskIH-0005Mb-4A; Mon, 23 Sep 2024 14:44:05 +0000
Received: by outflank-mailman (input) for mailman id 802097;
 Mon, 23 Sep 2024 14:44:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sskIF-0005MR-Ls
 for xen-changelog@lists.xenproject.org; Mon, 23 Sep 2024 14:44:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sskIF-0000DR-IP
 for xen-changelog@lists.xenproject.org; Mon, 23 Sep 2024 14:44:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sskIF-0006L9-FV
 for xen-changelog@lists.xenproject.org; Mon, 23 Sep 2024 14:44:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4LzuASHq9xgKSHqsADXfrGS46ef/DzwsUAsWam8XzHA=; b=oUL1PGARuZ7W9RowCR7+HJ2caa
	MUAay1okuD9ezckA387+pj7us6dqDAHmhLlp0s0KKCiG2naBwsJagMmQirs2asucnG8Pgz/U+R1bg
	RUIeUPXQmOcbqjJQxRfo/7iul/BohOpVyonsCI7cr+OjpAFnrq2odWEIZEH1ux9lEk5o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] ubsan: use linux-compat.h
Message-Id: <E1sskIF-0006L9-FV@xenbits.xenproject.org>
Date: Mon, 23 Sep 2024 14:44:03 +0000

commit b64f62fcbde3cf050056cffa81c7e7b9ed053f94
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Sep 23 16:31:49 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 23 16:31:49 2024 +0200

    ubsan: use linux-compat.h
    
    Instead of replacing the s64 (and later also u64) uses, keep the file as
    little modified as possible from its Linux origin. (Sadly the two cast
    adjustments are needed to avoid compiler warnings.)
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/ubsan/ubsan.c | 7 +++----
 xen/common/ubsan/ubsan.h | 2 ++
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/xen/common/ubsan/ubsan.c b/xen/common/ubsan/ubsan.c
index 5d50c10742..7f73f94759 100644
--- a/xen/common/ubsan/ubsan.c
+++ b/xen/common/ubsan/ubsan.c
@@ -20,8 +20,6 @@ static DEFINE_PER_CPU(struct xen_ubsan[1], in_ubsan);
 #undef current
 #define current this_cpu(in_ubsan)
 #define dump_stack dump_execution_state
-#define u64 long long unsigned int
-#define s64 long long int
 
 #include "ubsan.h"
 
@@ -141,10 +139,11 @@ static void val_to_string(char *str, size_t size, struct type_descriptor *type,
 #endif
 		} else if (type_is_signed(type)) {
 			scnprintf(str, size, "%lld",
-				(s64)get_signed_val(type, value));
+				  (long long)get_signed_val(type, value));
 		} else {
 			scnprintf(str, size, "%llu",
-				(u64)get_unsigned_val(type, value));
+				  (unsigned long long)get_unsigned_val(type,
+								       value));
 		}
 	}
 }
diff --git a/xen/common/ubsan/ubsan.h b/xen/common/ubsan/ubsan.h
index 3db42e75b1..9c7f3b9b6c 100644
--- a/xen/common/ubsan/ubsan.h
+++ b/xen/common/ubsan/ubsan.h
@@ -1,6 +1,8 @@
 #ifndef _LIB_UBSAN_H
 #define _LIB_UBSAN_H
 
+#include <xen/linux-compat.h>
+
 enum {
 	type_kind_int = 0,
 	type_kind_float = 1,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 23 14:44:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Sep 2024 14:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802098.1212221 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sskIR-0005P7-87; Mon, 23 Sep 2024 14:44:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802098.1212221; Mon, 23 Sep 2024 14:44:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sskIR-0005P0-5Y; Mon, 23 Sep 2024 14:44:15 +0000
Received: by outflank-mailman (input) for mailman id 802098;
 Mon, 23 Sep 2024 14:44:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sskIP-0005Ok-My
 for xen-changelog@lists.xenproject.org; Mon, 23 Sep 2024 14:44:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sskIP-0000Dx-MD
 for xen-changelog@lists.xenproject.org; Mon, 23 Sep 2024 14:44:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sskIP-0006NQ-KW
 for xen-changelog@lists.xenproject.org; Mon, 23 Sep 2024 14:44:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=u4Gg70FXn+tRwMmWcO8LCUgHhDEG1fh2/9buVuO82rQ=; b=5iBauCqLwPtjAKPSOUispyGk+l
	Rt/jqVpGzjMVyhvNGUWjIHnVgYIUwNayTt5o+jvVrXnMZcrdX92wwfAdzWtpyItiJBV6/ijsLUENt
	7NPTaAKIiqzTYHVXBe1pODgdPDom5NFosYnikmm9Li+kfxoP6W4TiBs/LjXjJMgFEnU8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: use {read,write}{b,w,l,q}_cpu() to define {read,write}_atomic()
Message-Id: <E1sskIP-0006NQ-KW@xenbits.xenproject.org>
Date: Mon, 23 Sep 2024 14:44:13 +0000

commit f4c7663d196d44e1c676b028046c4d6b4f540b93
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Mon Sep 23 16:32:17 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 23 16:32:17 2024 +0200

    xen/riscv: use {read,write}{b,w,l,q}_cpu() to define {read,write}_atomic()
    
    The functions {read,write}{b,w,l,q}_cpu() do not need to be memory-ordered
    atomic operations in Xen, based on their definitions for other architectures.
    
    Therefore, {read,write}{b,w,l,q}_cpu() can be used instead of
    {read,write}{b,w,l,q}(), allowing the caller to decide if additional
    fences should be applied before or after {read,write}_atomic().
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/atomic.h | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/xen/arch/riscv/include/asm/atomic.h b/xen/arch/riscv/include/asm/atomic.h
index 41f03b2e0c..95910ebfeb 100644
--- a/xen/arch/riscv/include/asm/atomic.h
+++ b/xen/arch/riscv/include/asm/atomic.h
@@ -31,21 +31,17 @@
 
 void __bad_atomic_size(void);
 
-/*
- * Legacy from Linux kernel. For some reason they wanted to have ordered
- * read/write access. Thereby read* is used instead of read*_cpu()
- */
 static always_inline void read_atomic_size(const volatile void *p,
                                            void *res,
                                            unsigned int size)
 {
     switch ( size )
     {
-    case 1: *(uint8_t *)res = readb(p); break;
-    case 2: *(uint16_t *)res = readw(p); break;
-    case 4: *(uint32_t *)res = readl(p); break;
+    case 1: *(uint8_t *)res = readb_cpu(p); break;
+    case 2: *(uint16_t *)res = readw_cpu(p); break;
+    case 4: *(uint32_t *)res = readl_cpu(p); break;
 #ifndef CONFIG_RISCV_32
-    case 8: *(uint64_t *)res = readq(p); break;
+    case 8: *(uint64_t *)res = readq_cpu(p); break;
 #endif
     default: __bad_atomic_size(); break;
     }
@@ -58,15 +54,16 @@ static always_inline void read_atomic_size(const volatile void *p,
 })
 
 static always_inline void _write_atomic(volatile void *p,
-                                       unsigned long x, unsigned int size)
+                                        unsigned long x,
+                                        unsigned int size)
 {
     switch ( size )
     {
-    case 1: writeb(x, p); break;
-    case 2: writew(x, p); break;
-    case 4: writel(x, p); break;
+    case 1: writeb_cpu(x, p); break;
+    case 2: writew_cpu(x, p); break;
+    case 4: writel_cpu(x, p); break;
 #ifndef CONFIG_RISCV_32
-    case 8: writeq(x, p); break;
+    case 8: writeq_cpu(x, p); break;
 #endif
     default: __bad_atomic_size(); break;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 23 14:55:06 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Sep 2024 14:55:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802111.1212244 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sskSu-0007ru-Fi; Mon, 23 Sep 2024 14:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802111.1212244; Mon, 23 Sep 2024 14:55:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sskSu-0007rm-DD; Mon, 23 Sep 2024 14:55:04 +0000
Received: by outflank-mailman (input) for mailman id 802111;
 Mon, 23 Sep 2024 14:55:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sskSt-0007rg-A7
 for xen-changelog@lists.xenproject.org; Mon, 23 Sep 2024 14:55:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sskSt-0000Q2-7r
 for xen-changelog@lists.xenproject.org; Mon, 23 Sep 2024 14:55:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sskSt-0007VX-6m
 for xen-changelog@lists.xenproject.org; Mon, 23 Sep 2024 14:55:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8p3wpxKJxQRSvd6zLyQdLBINJ9a0YzPVFbkyVA65P7E=; b=4f6cZzr0vOX5FKiYEjKqc7izbF
	yndBI06jMpFmT90K0e9CcgFHuL0qJHwKBufQYbx9iP/b5AS7K5dheQ+tgfpFZqTnxy/0H96CyWDYh
	iWEZn8Nx3CBNUJIUilmLsKYyPElp8yBFJh6aOFOWM0Ay8KeOvXyzyeKlSnzME4j8Y+0U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Drop stale comment about zeroing the stack
Message-Id: <E1sskSt-0007VX-6m@xenbits.xenproject.org>
Date: Mon, 23 Sep 2024 14:55:03 +0000

commit e1c8a3dc8aeee26e7d483669ca34fceb8e80d933
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Sep 16 12:56:06 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 23 15:46:58 2024 +0100

    x86/boot: Drop stale comment about zeroing the stack
    
    This used to be true, but was altered by commit 37786b23b027 ("x86/cet: Remove
    writeable mapping of the BSPs shadow stack") which moved cpu0_stack into
    .init.bss.stack_aligned.
    
    Fixes: 37786b23b027 ("x86/cet: Remove writeable mapping of the BSPs shadow stack")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/boot/head.S | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index 12bbb97f33..cfc5a7b47d 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -652,11 +652,7 @@ trampoline_setup:
         cmpb    $0, sym_esi(efi_platform)
         jnz     1f
 
-        /*
-         * Initialise the BSS.
-         *
-         * !!! WARNING - also zeroes the current stack !!!
-         */
+        /* Initialise the BSS. */
         lea     sym_esi(__bss_start), %edi
         lea     sym_esi(__bss_end), %ecx
         sub     %edi,%ecx
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 07:22:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 07:22:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802405.1212620 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sszs3-00067s-AJ; Tue, 24 Sep 2024 07:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802405.1212620; Tue, 24 Sep 2024 07:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sszs3-00067k-7Y; Tue, 24 Sep 2024 07:22:03 +0000
Received: by outflank-mailman (input) for mailman id 802405;
 Tue, 24 Sep 2024 07:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sszs2-00067e-5q
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 07:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sszs2-00010L-4e
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 07:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sszs2-0001EQ-3Z
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 07:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VLtr1SnYX9BF9dFLKp3JJRXlRN5xNAWHd4VwEdTp37g=; b=YcJ+NxR16zAx2Ro3WNWYnErw/u
	JfPdjBq7vqF3jNLdvkAFX8duAz/G05F/08yIRCAPEg4SRMcRed45NfrcfXUHiCFqDMoT/0jOIgixJ
	9tq0r6EPlgna7KiGB8H3SrPpzdgFkyFYh0aap5gZ/lVVRWyaq0fma6NIJpqSbu38eyFo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ubsan: use linux-compat.h
Message-Id: <E1sszs2-0001EQ-3Z@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 07:22:02 +0000

commit b64f62fcbde3cf050056cffa81c7e7b9ed053f94
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Sep 23 16:31:49 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 23 16:31:49 2024 +0200

    ubsan: use linux-compat.h
    
    Instead of replacing the s64 (and later also u64) uses, keep the file as
    little modified as possible from its Linux origin. (Sadly the two cast
    adjustments are needed to avoid compiler warnings.)
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/ubsan/ubsan.c | 7 +++----
 xen/common/ubsan/ubsan.h | 2 ++
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/xen/common/ubsan/ubsan.c b/xen/common/ubsan/ubsan.c
index 5d50c10742..7f73f94759 100644
--- a/xen/common/ubsan/ubsan.c
+++ b/xen/common/ubsan/ubsan.c
@@ -20,8 +20,6 @@ static DEFINE_PER_CPU(struct xen_ubsan[1], in_ubsan);
 #undef current
 #define current this_cpu(in_ubsan)
 #define dump_stack dump_execution_state
-#define u64 long long unsigned int
-#define s64 long long int
 
 #include "ubsan.h"
 
@@ -141,10 +139,11 @@ static void val_to_string(char *str, size_t size, struct type_descriptor *type,
 #endif
 		} else if (type_is_signed(type)) {
 			scnprintf(str, size, "%lld",
-				(s64)get_signed_val(type, value));
+				  (long long)get_signed_val(type, value));
 		} else {
 			scnprintf(str, size, "%llu",
-				(u64)get_unsigned_val(type, value));
+				  (unsigned long long)get_unsigned_val(type,
+								       value));
 		}
 	}
 }
diff --git a/xen/common/ubsan/ubsan.h b/xen/common/ubsan/ubsan.h
index 3db42e75b1..9c7f3b9b6c 100644
--- a/xen/common/ubsan/ubsan.h
+++ b/xen/common/ubsan/ubsan.h
@@ -1,6 +1,8 @@
 #ifndef _LIB_UBSAN_H
 #define _LIB_UBSAN_H
 
+#include <xen/linux-compat.h>
+
 enum {
 	type_kind_int = 0,
 	type_kind_float = 1,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 07:22:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 07:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802406.1212623 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sszsD-0006A5-BP; Tue, 24 Sep 2024 07:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802406.1212623; Tue, 24 Sep 2024 07:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sszsD-00069x-8v; Tue, 24 Sep 2024 07:22:13 +0000
Received: by outflank-mailman (input) for mailman id 802406;
 Tue, 24 Sep 2024 07:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sszsC-00069W-Cs
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 07:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sszsC-00010R-9Z
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 07:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sszsC-0001FQ-6w
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 07:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Jxg+IPS5dJHtVf6rvDKsex2yMs8LDx7hFvTyb3uphKU=; b=CeQ4YAMToSNuQJovKp5C/wMZsd
	fCcpVPK5ofwjPDNosbvelSUZOR3ccI8hNbcN34nb3WEoU0+B/nJ2uvA7Hx4K511B9Ees07ZrDG6k6
	cmewGs6Uuis61bxiPYnLaLS1kkuDaQZXzMcthJfiFTDb0bK8gE5sc5GZzs2KvhdILr1M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: use {read,write}{b,w,l,q}_cpu() to define {read,write}_atomic()
Message-Id: <E1sszsC-0001FQ-6w@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 07:22:12 +0000

commit f4c7663d196d44e1c676b028046c4d6b4f540b93
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Mon Sep 23 16:32:17 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 23 16:32:17 2024 +0200

    xen/riscv: use {read,write}{b,w,l,q}_cpu() to define {read,write}_atomic()
    
    The functions {read,write}{b,w,l,q}_cpu() do not need to be memory-ordered
    atomic operations in Xen, based on their definitions for other architectures.
    
    Therefore, {read,write}{b,w,l,q}_cpu() can be used instead of
    {read,write}{b,w,l,q}(), allowing the caller to decide if additional
    fences should be applied before or after {read,write}_atomic().
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/atomic.h | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/xen/arch/riscv/include/asm/atomic.h b/xen/arch/riscv/include/asm/atomic.h
index 41f03b2e0c..95910ebfeb 100644
--- a/xen/arch/riscv/include/asm/atomic.h
+++ b/xen/arch/riscv/include/asm/atomic.h
@@ -31,21 +31,17 @@
 
 void __bad_atomic_size(void);
 
-/*
- * Legacy from Linux kernel. For some reason they wanted to have ordered
- * read/write access. Thereby read* is used instead of read*_cpu()
- */
 static always_inline void read_atomic_size(const volatile void *p,
                                            void *res,
                                            unsigned int size)
 {
     switch ( size )
     {
-    case 1: *(uint8_t *)res = readb(p); break;
-    case 2: *(uint16_t *)res = readw(p); break;
-    case 4: *(uint32_t *)res = readl(p); break;
+    case 1: *(uint8_t *)res = readb_cpu(p); break;
+    case 2: *(uint16_t *)res = readw_cpu(p); break;
+    case 4: *(uint32_t *)res = readl_cpu(p); break;
 #ifndef CONFIG_RISCV_32
-    case 8: *(uint64_t *)res = readq(p); break;
+    case 8: *(uint64_t *)res = readq_cpu(p); break;
 #endif
     default: __bad_atomic_size(); break;
     }
@@ -58,15 +54,16 @@ static always_inline void read_atomic_size(const volatile void *p,
 })
 
 static always_inline void _write_atomic(volatile void *p,
-                                       unsigned long x, unsigned int size)
+                                        unsigned long x,
+                                        unsigned int size)
 {
     switch ( size )
     {
-    case 1: writeb(x, p); break;
-    case 2: writew(x, p); break;
-    case 4: writel(x, p); break;
+    case 1: writeb_cpu(x, p); break;
+    case 2: writew_cpu(x, p); break;
+    case 4: writel_cpu(x, p); break;
 #ifndef CONFIG_RISCV_32
-    case 8: writeq(x, p); break;
+    case 8: writeq_cpu(x, p); break;
 #endif
     default: __bad_atomic_size(); break;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 07:22:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 07:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802407.1212627 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sszsN-0006EE-DB; Tue, 24 Sep 2024 07:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802407.1212627; Tue, 24 Sep 2024 07:22:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sszsN-0006E7-AS; Tue, 24 Sep 2024 07:22:23 +0000
Received: by outflank-mailman (input) for mailman id 802407;
 Tue, 24 Sep 2024 07:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sszsM-0006Dl-Dy
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 07:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sszsM-00011O-CS
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 07:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sszsM-0001GG-Be
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 07:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zYzW29qxW9IKtvK9ZrgBMOwBCQwZDRzHZfDrH50eO7M=; b=YNpvbyWbYm4xYDHecms9HufH70
	ch9LmkqQdlZLPbeyOlDYYQIHeEKstPcZpwCgm37HiebDxnNrE3PKknzllwZ/WHloY0tGC+3F8cz52
	DpoVFM4clRj2CkcroMx5HGEwZqRMAbCX9gfoyd3vrYzcr7R1BOst7Cbw6+o4z7qyP9hs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Drop stale comment about zeroing the stack
Message-Id: <E1sszsM-0001GG-Be@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 07:22:22 +0000

commit e1c8a3dc8aeee26e7d483669ca34fceb8e80d933
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Sep 16 12:56:06 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 23 15:46:58 2024 +0100

    x86/boot: Drop stale comment about zeroing the stack
    
    This used to be true, but was altered by commit 37786b23b027 ("x86/cet: Remove
    writeable mapping of the BSPs shadow stack") which moved cpu0_stack into
    .init.bss.stack_aligned.
    
    Fixes: 37786b23b027 ("x86/cet: Remove writeable mapping of the BSPs shadow stack")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/boot/head.S | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index 12bbb97f33..cfc5a7b47d 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -652,11 +652,7 @@ trampoline_setup:
         cmpb    $0, sym_esi(efi_platform)
         jnz     1f
 
-        /*
-         * Initialise the BSS.
-         *
-         * !!! WARNING - also zeroes the current stack !!!
-         */
+        /* Initialise the BSS. */
         lea     sym_esi(__bss_start), %edi
         lea     sym_esi(__bss_end), %ecx
         sub     %edi,%ecx
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 08:44:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 08:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802503.1212751 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st19R-00064g-5L; Tue, 24 Sep 2024 08:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802503.1212751; Tue, 24 Sep 2024 08:44:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st19R-00064Z-2z; Tue, 24 Sep 2024 08:44:05 +0000
Received: by outflank-mailman (input) for mailman id 802503;
 Tue, 24 Sep 2024 08:44:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st19P-00064L-Qn
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 08:44:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st19P-0002x2-OS
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 08:44:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st19P-0001ks-M5
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 08:44:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kIQViQlmGd+6YzYJA7pVhxM0ADarPXZTBEP7Xg05KDE=; b=Z4hWXK/ioQXxH2P8V64SXw5kAj
	9eZe+mqoC1XvThGAFxNSs2xcjnVrfKsXc3Ex7r41HDT6vBJz/aBkMiTyw9oGiA1GYHq8wVLv2HOBK
	AXklR6BoQu/pB7vxRSrJtJ7KXsmadvq1WK5SOowl2R6ztYfknh1lubqKlRtmErT6hFsI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/mwait-idle: add dependency on general Intel CPU support
Message-Id: <E1st19P-0001ks-M5@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 08:44:03 +0000

commit c4344ecc5a4a9789a75c21a2c9da3d4d76f092dc
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Tue Sep 24 10:33:38 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 10:33:38 2024 +0200

    x86/mwait-idle: add dependency on general Intel CPU support
    
    Currently mwait_idle driver in Xen only implements support for Intel CPUs.
    Thus in order to reduce dead code in non-Intel build configurations it can
    be made explicitly dependant on CONFIG_INTEL option.
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/Makefile          | 2 +-
 xen/arch/x86/include/asm/cpuidle.h | 7 +++++++
 xen/arch/x86/include/asm/mwait.h   | 7 +++++++
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpu/Makefile b/xen/arch/x86/cpu/Makefile
index eafce5f204..7cfe28b7ec 100644
--- a/xen/arch/x86/cpu/Makefile
+++ b/xen/arch/x86/cpu/Makefile
@@ -8,7 +8,7 @@ obj-y += common.o
 obj-y += hygon.o
 obj-y += intel.o
 obj-y += intel_cacheinfo.o
-obj-y += mwait-idle.o
+obj-$(CONFIG_INTEL) += mwait-idle.o
 obj-y += shanghai.o
 obj-y += vpmu.o
 obj-$(CONFIG_AMD) += vpmu_amd.o
diff --git a/xen/arch/x86/include/asm/cpuidle.h b/xen/arch/x86/include/asm/cpuidle.h
index 707b3e948d..3a6b73142b 100644
--- a/xen/arch/x86/include/asm/cpuidle.h
+++ b/xen/arch/x86/include/asm/cpuidle.h
@@ -15,7 +15,14 @@ extern void (*lapic_timer_on)(void);
 
 extern uint64_t (*cpuidle_get_tick)(void);
 
+#ifdef CONFIG_INTEL
 int mwait_idle_init(struct notifier_block *nfb);
+#else
+static inline int mwait_idle_init(struct notifier_block *nfb)
+{
+    return -ENODEV;
+}
+#endif
 int cpuidle_init_cpu(unsigned int cpu);
 void cf_check default_dead_idle(void);
 void cf_check acpi_dead_idle(void);
diff --git a/xen/arch/x86/include/asm/mwait.h b/xen/arch/x86/include/asm/mwait.h
index 9298f987c4..000a692f6d 100644
--- a/xen/arch/x86/include/asm/mwait.h
+++ b/xen/arch/x86/include/asm/mwait.h
@@ -14,6 +14,13 @@
 #define MWAIT_ECX_INTERRUPT_BREAK	0x1
 
 void mwait_idle_with_hints(unsigned int eax, unsigned int ecx);
+#ifdef CONFIG_INTEL
 bool mwait_pc10_supported(void);
+#else
+static inline bool mwait_pc10_supported(void)
+{
+    return false;
+}
+#endif
 
 #endif /* __ASM_X86_MWAIT_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 08:44:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 08:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802504.1212756 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st19a-00067P-7P; Tue, 24 Sep 2024 08:44:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802504.1212756; Tue, 24 Sep 2024 08:44:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st19a-00067H-4P; Tue, 24 Sep 2024 08:44:14 +0000
Received: by outflank-mailman (input) for mailman id 802504;
 Tue, 24 Sep 2024 08:44:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st19Z-000679-Sc
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 08:44:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st19Z-0002xC-Rl
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 08:44:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st19Z-0001lj-Qc
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 08:44:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TxKDLlL3fB8RUHSf14Ks/qefvfpt4hLGKBabPesCpsw=; b=fvPS4NJdZ1COMdQh0Lk9T3TxEW
	SFF6Hnwc65ppF3bK+sQsx0DaR9CRBzYyKRWqsBSw2mVlTyBf61XjsEFn1pcqwpkM30AMajplDikEA
	BwSkSOc32c3TxM8/Tc0y6scUyJwcVQ+sf/Hkp1/FYPYnr49+TBVAJZSsylHw3VDHmGrI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: enable long section names for xen.efi
Message-Id: <E1st19Z-0001lj-Qc@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 08:44:13 +0000

commit b1642aaea277b0aa8f2962e1842609c4050c400a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 10:34:35 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 10:34:35 2024 +0200

    x86: enable long section names for xen.efi
    
    While for our present .data.read_mostly it may be deemed tolerable that
    the name is truncated to .data.re, for the planned .init.trampoline an
    abbreviation to .init.tr would end up pretty meaningless. Engage the
    long section names extension that GNU ld has had support for already in
    2.22 (which we consider the baseline release for xen.efi building).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Frediano Ziglio <frediano.ziglio@cloud.com>
---
 xen/arch/x86/arch.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index 4f6c086988..1460ecf30b 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -91,7 +91,7 @@ XEN_BUILD_EFI := $(call if-success,$(CC) $(filter-out -include %/include/xen/con
                                          -c $(srctree)/$(efi-check).c -o $(efi-check).o,y)
 
 # Check if the linker supports PE.
-EFI_LDFLAGS := $(patsubst -m%,-mi386pep,$(LDFLAGS)) --subsystem=10
+EFI_LDFLAGS := $(patsubst -m%,-mi386pep,$(LDFLAGS)) --subsystem=10 --enable-long-section-names
 LD_PE_check_cmd = $(call ld-option,$(EFI_LDFLAGS) --image-base=0x100000000 -o $(efi-check).efi $(efi-check).o)
 XEN_BUILD_PE := $(LD_PE_check_cmd)
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 10:22:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 10:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802557.1212828 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st2gH-00067q-IJ; Tue, 24 Sep 2024 10:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802557.1212828; Tue, 24 Sep 2024 10:22:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st2gH-00067j-Fe; Tue, 24 Sep 2024 10:22:05 +0000
Received: by outflank-mailman (input) for mailman id 802557;
 Tue, 24 Sep 2024 10:22:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st2gG-00067X-7M
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 10:22:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st2gG-0004fX-26
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 10:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st2gG-0003Dj-0E
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 10:22:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kWZlJYMZi72Opgq3A3R3kbkLCOAJAK9IQYLUsmALOmU=; b=RBCK8SA4Hm/gORXjYF2m9rLNNS
	UW5UU/yXAQXIPqImau4SC/OgEK524qRnlbUOCrV2gD3PnFrAfx4dBkZEbxaFM0AJbZ53qmC5QGtNE
	1yym2w/9btq7t6gVXEhcjjYq/7dqwpYFA4XXEGB5YlVxHtEd+nE/gRHC2malA1TG3HVk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libxs: Style consistency improvements
Message-Id: <E1st2gG-0003Dj-0E@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 10:22:04 +0000

commit 95c3ae591c5a764fdcae14b054bb92bc43f3e904
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 28 13:05:47 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 24 10:47:14 2024 +0100

    tools/libxs: Style consistency improvements
    
    This is mostly Linux style.  Make the file self-consistent.  Drop trailing
    whitespace, and use tabs consistently.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 tools/libs/store/xs.c | 74 ++++++++++++++++++++++++++++-----------------------
 1 file changed, 41 insertions(+), 33 deletions(-)

diff --git a/tools/libs/store/xs.c b/tools/libs/store/xs.c
index 5d9c7151e8..e22f99b59f 100644
--- a/tools/libs/store/xs.c
+++ b/tools/libs/store/xs.c
@@ -1,4 +1,4 @@
-/* 
+/*
     Xen Store Daemon interface providing simple tree-like database.
     Copyright (C) 2005 Rusty Russell IBM Corporation
 
@@ -164,8 +164,10 @@ static void *read_thread(void *arg);
 
 static int read_message(struct xs_handle *h, int nonblocking);
 
-static bool setnonblock(int fd, int nonblock) {
+static bool setnonblock(int fd, int nonblock)
+{
 	int flags = fcntl(fd, F_GETFL);
+
 	if (flags == -1)
 		return false;
 
@@ -236,7 +238,7 @@ static int get_socket(const char *connect_to)
 		goto error;
 
 	addr.sun_family = AF_UNIX;
-	if(strlen(connect_to) >= sizeof(addr.sun_path)) {
+	if (strlen(connect_to) >= sizeof(addr.sun_path)) {
 		errno = EINVAL;
 		goto error;
 	}
@@ -276,9 +278,11 @@ error:
 	return -1;
 }
 
-static int all_restrict_cb(Xentoolcore__Active_Handle *ah, domid_t domid) {
-    struct xs_handle *h = CONTAINER_OF(ah, *h, tc_ah);
-    return xentoolcore__restrict_by_dup2_null(h->fd);
+static int all_restrict_cb(Xentoolcore__Active_Handle *ah, domid_t domid)
+{
+	struct xs_handle *h = CONTAINER_OF(ah, *h, tc_ah);
+
+	return xentoolcore__restrict_by_dup2_null(h->fd);
 }
 
 static struct xs_handle *get_handle(const char *connect_to)
@@ -362,8 +366,10 @@ struct xs_handle *xs_domain_open(void)
 static const char *xs_domain_dev(void)
 {
 	char *s = getenv("XENSTORED_PATH");
+
 	if (s)
 		return s;
+
 #if defined(__RUMPUSER_XEN__) || defined(__RUMPRUN__)
 	return "/dev/xen/xenbus";
 #elif defined(__linux__)
@@ -394,7 +400,8 @@ struct xs_handle *xs_open(unsigned long flags)
 	return xsh;
 }
 
-static void close_free_msgs(struct xs_handle *h) {
+static void close_free_msgs(struct xs_handle *h)
+{
 	struct xs_stored_msg *msg, *tmsg;
 
 	XEN_TAILQ_FOREACH_SAFE(msg, &h->reply_list, list, tmsg) {
@@ -408,7 +415,8 @@ static void close_free_msgs(struct xs_handle *h) {
 	}
 }
 
-static void close_fds_free(struct xs_handle *h) {
+static void close_fds_free(struct xs_handle *h)
+{
 	if (h->watch_pipe[0] != -1) {
 		close(h->watch_pipe[0]);
 		close(h->watch_pipe[1]);
@@ -416,7 +424,7 @@ static void close_fds_free(struct xs_handle *h) {
 
 	xentoolcore__deregister_active_handle(&h->tc_ah);
         close(h->fd);
-        
+
 	free(h);
 }
 
@@ -448,7 +456,7 @@ void xs_daemon_close(struct xs_handle *h)
         close_fds_free(h);
 }
 
-void xs_close(struct xs_handle* xsh)
+void xs_close(struct xs_handle *xsh)
 {
 	if (xsh)
 		xs_daemon_close(xsh);
@@ -995,7 +1003,7 @@ bool xs_watch(struct xs_handle *h, const char *path, const char *token)
 
 #define READ_THREAD_STACKSIZE 					\
 	((DEFAULT_THREAD_STACKSIZE < PTHREAD_STACK_MIN) ? 	\
-	PTHREAD_STACK_MIN : DEFAULT_THREAD_STACKSIZE)
+	 PTHREAD_STACK_MIN : DEFAULT_THREAD_STACKSIZE)
 
 	/* We dynamically create a reader thread on demand. */
 	mutex_lock(&h->request_mutex);
@@ -1258,7 +1266,7 @@ bool xs_transaction_end(struct xs_handle *h, xs_transaction_t t,
 		strcpy(abortstr, "F");
 	else
 		strcpy(abortstr, "T");
-	
+
 	return xs_bool(xs_single(h, t, XS_TRANSACTION_END, abortstr, NULL));
 }
 
@@ -1293,7 +1301,7 @@ bool xs_introduce_domain(struct xs_handle *h,
 }
 
 bool xs_set_target(struct xs_handle *h,
-			 unsigned int domid, unsigned int target)
+		   unsigned int domid, unsigned int target)
 {
 	struct xsd_sockmsg msg = { .type = XS_SET_TARGET };
 	char domid_str[MAX_STRLEN(domid)];
@@ -1377,30 +1385,30 @@ bool xs_is_domain_introduced(struct xs_handle *h, unsigned int domid)
 
 int xs_suspend_evtchn_port(int domid)
 {
-    char path[128];
-    char *portstr;
-    int port;
-    unsigned int plen;
-    struct xs_handle *xs;
-
-    xs = xs_daemon_open();
-    if (!xs)
-        return -1;
+	char path[128];
+	char *portstr;
+	int port;
+	unsigned int plen;
+	struct xs_handle *xs;
+
+	xs = xs_daemon_open();
+	if (!xs)
+		return -1;
 
-    sprintf(path, "/local/domain/%d/device/suspend/event-channel", domid);
-    portstr = xs_read(xs, XBT_NULL, path, &plen);
-    xs_daemon_close(xs);
+	sprintf(path, "/local/domain/%d/device/suspend/event-channel", domid);
+	portstr = xs_read(xs, XBT_NULL, path, &plen);
+	xs_daemon_close(xs);
 
-    if (!portstr || !plen) {
-        port = -1;
-        goto out;
-    }
+	if (!portstr || !plen) {
+		port = -1;
+		goto out;
+	}
 
-    port = atoi(portstr);
+	port = atoi(portstr);
 
 out:
-    free(portstr);
-    return port;
+	free(portstr);
+	return port;
 }
 
 char *xs_control_command(struct xs_handle *h, const char *cmd,
@@ -1436,7 +1444,7 @@ static int read_message(struct xs_handle *h, int nonblocking)
 	 * whole amount requested.  Ie as soon as we have the start of
 	 * the message we block until we get all of it.
 	 */
-         
+
 	struct xs_stored_msg *msg = NULL;
 	char *body = NULL;
 	int saved_errno = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 10:22:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 10:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802558.1212833 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st2gR-00069y-Jg; Tue, 24 Sep 2024 10:22:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802558.1212833; Tue, 24 Sep 2024 10:22:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st2gR-00069q-H6; Tue, 24 Sep 2024 10:22:15 +0000
Received: by outflank-mailman (input) for mailman id 802558;
 Tue, 24 Sep 2024 10:22:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st2gQ-00069L-6v
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 10:22:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st2gQ-0004fd-65
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 10:22:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st2gQ-0003Ev-4G
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 10:22:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=moG5vY0Gc0r53sZrhZweGlk4xLBaN3Eegm5inn5+6yE=; b=ISwi5xmQ7PEjmkL2OBYgugcDtm
	OjpYKCZKyFaHyB20twkm8SximevupwGbJPbw8OpGCtZIPVUCWa9RZHB3CMqyzAwMqzHx5Vf2LDvyu
	ZM5QaySszDg29FQF7Cp7R+/5Ao+B9pAJpYyUk4PYE1YZijwG/nNbbc6KCDbO24ArDcB0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/cpufeature: Reposition cpu_has_{lfence_dispatch,nscb}
Message-Id: <E1st2gQ-0003Ev-4G@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 10:22:14 +0000

commit 6a039b050071eba644ab414d76ac5d5fc9e067a5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 10 20:59:37 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 24 10:49:59 2024 +0100

    x86/cpufeature: Reposition cpu_has_{lfence_dispatch,nscb}
    
    LFENCE_DISPATCH used to be a synthetic feature, but was given a real CPUID bit
    by AMD.  The define wasn't moved when this was changed.
    
    NSCB has always been a real CPUID bit, and was misplaced when introduced in
    the synthetic block alongside LFENCE_DISPATCH.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/cpufeature.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/cpufeature.h b/xen/arch/x86/include/asm/cpufeature.h
index 3baf9fcdbe..3a06b6f297 100644
--- a/xen/arch/x86/include/asm/cpufeature.h
+++ b/xen/arch/x86/include/asm/cpufeature.h
@@ -192,6 +192,10 @@ static inline bool boot_cpu_has(unsigned int feat)
 #define cpu_has_cmpccxadd       boot_cpu_has(X86_FEATURE_CMPCCXADD)
 #define cpu_has_avx_ifma        boot_cpu_has(X86_FEATURE_AVX_IFMA)
 
+/* CPUID level 0x80000021.eax */
+#define cpu_has_lfence_dispatch boot_cpu_has(X86_FEATURE_LFENCE_DISPATCH)
+#define cpu_has_nscb            boot_cpu_has(X86_FEATURE_NSCB)
+
 /* CPUID level 0x00000007:1.edx */
 #define cpu_has_avx_vnni_int8   boot_cpu_has(X86_FEATURE_AVX_VNNI_INT8)
 #define cpu_has_avx_ne_convert  boot_cpu_has(X86_FEATURE_AVX_NE_CONVERT)
@@ -219,8 +223,6 @@ static inline bool boot_cpu_has(unsigned int feat)
 #define cpu_has_arch_perfmon    boot_cpu_has(X86_FEATURE_ARCH_PERFMON)
 #define cpu_has_cpuid_faulting  boot_cpu_has(X86_FEATURE_CPUID_FAULTING)
 #define cpu_has_aperfmperf      boot_cpu_has(X86_FEATURE_APERFMPERF)
-#define cpu_has_lfence_dispatch boot_cpu_has(X86_FEATURE_LFENCE_DISPATCH)
-#define cpu_has_nscb            boot_cpu_has(X86_FEATURE_NSCB)
 #define cpu_has_xen_lbr         boot_cpu_has(X86_FEATURE_XEN_LBR)
 #define cpu_has_xen_shstk       (IS_ENABLED(CONFIG_XEN_SHSTK) && \
                                  boot_cpu_has(X86_FEATURE_XEN_SHSTK))
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 10:22:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 10:22:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802559.1212837 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st2gb-0006ET-LF; Tue, 24 Sep 2024 10:22:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802559.1212837; Tue, 24 Sep 2024 10:22:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st2gb-0006EK-Id; Tue, 24 Sep 2024 10:22:25 +0000
Received: by outflank-mailman (input) for mailman id 802559;
 Tue, 24 Sep 2024 10:22:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st2ga-0006Dv-9k
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 10:22:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st2ga-0004hM-8z
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 10:22:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st2ga-0003Fa-89
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 10:22:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gnJ6W4TVtiWWmAjPJ+4TaiC3BksisjblH1dkHxNXdx4=; b=Vq/us1XXPL+xWQJ4R7ODja6NVs
	07m6rApeIbuk4inLiLjaoA/IhHCR57EAPlFW3TlHm/2Gez4CP/JVN9MUug8UfdGpTBK7WB6W9MS9X
	A+gOhccwoMAeIfO35dAJ8wwA5ZGl6s2FnBgxm3SRwaDh6If1LN+g4qNSkxqjb7+fa598=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/efi: Use generic PE/COFF structures
Message-Id: <E1st2ga-0003Fa-89@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 10:22:24 +0000

commit f7f42accbbbb87945d46333b5fe3dbe58c413c92
Author:     Nikola Jelic <nikola.jelic@rt-rk.com>
AuthorDate: Mon Sep 23 19:50:08 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 24 11:12:23 2024 +0100

    x86/efi: Use generic PE/COFF structures
    
    Adapted x86 efi parser and mkreloc utility to use generic PE header
    (efi/pe.h), instead of locally defined structures for each component.
    
    Signed-off-by: Nikola Jelic <nikola.jelic@rt-rk.com>
    Signed-off-by: Milan Djokic <milan.djokic@rt-rk.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/Makefile      |   2 +
 xen/arch/x86/efi/mkreloc.c | 137 ++++++++++++++-------------------------------
 xen/common/efi/pe.c        |  90 ++++++-----------------------
 3 files changed, 63 insertions(+), 166 deletions(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 286c003ec3..00ab091634 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -88,6 +88,8 @@ extra-y += xen.lds
 hostprogs-y += boot/mkelf32
 hostprogs-y += efi/mkreloc
 
+$(obj)/efi/mkreloc: HOSTCFLAGS += -I$(srctree)/include
+
 # Allows usercopy.c to include itself
 $(obj)/usercopy.o: CFLAGS-y += -iquote .
 
diff --git a/xen/arch/x86/efi/mkreloc.c b/xen/arch/x86/efi/mkreloc.c
index 083740ab8a..375cb79d69 100644
--- a/xen/arch/x86/efi/mkreloc.c
+++ b/xen/arch/x86/efi/mkreloc.c
@@ -9,45 +9,7 @@
 #include <sys/mman.h>
 #include <unistd.h>
 
-struct mz_hdr {
-    uint16_t signature;
-#define MZ_SIGNATURE 0x5a4d
-    uint16_t last_page_size;
-    uint16_t page_count;
-    uint16_t relocation_count;
-    uint16_t header_paras;
-    uint16_t min_paras;
-    uint16_t max_paras;
-    uint16_t entry_ss;
-    uint16_t entry_sp;
-    uint16_t checksum;
-    uint16_t entry_ip;
-    uint16_t entry_cs;
-    uint16_t relocations;
-    uint16_t overlay;
-    uint8_t reserved[32];
-    uint32_t extended_header_base;
-};
-
-struct pe_hdr {
-    uint32_t signature;
-#define PE_SIGNATURE 0x00004550
-    uint16_t cpu;
-    uint16_t section_count;
-    int32_t timestamp;
-    uint32_t symbols_file_offset;
-    uint32_t symbol_count;
-    uint16_t opt_hdr_size;
-    uint16_t flags;
-    struct {
-        uint16_t magic;
-#define PE_MAGIC_EXE32     0x010b
-#define PE_MAGIC_EXE32PLUS 0x020b
-        uint8_t linker_major, linker_minor;
-        uint32_t code_size, data_size, bss_size;
-        uint32_t entry_rva, code_rva, data_rva;
-    } opt_hdr;
-};
+#include <efi/pe.h>
 
 #define PE_PAGE_SIZE 0x1000
 
@@ -55,22 +17,6 @@ struct pe_hdr {
 #define PE_BASE_RELOC_HIGHLOW  3
 #define PE_BASE_RELOC_DIR64   10
 
-struct coff_section {
-    char name[8];
-    uint32_t size;
-    uint32_t rva;
-    uint32_t file_size;
-    uint32_t file_offset;
-    uint32_t relocation_file_offset;
-    uint32_t line_number_file_offset;
-    uint16_t relocation_count;
-    uint16_t line_number_count;
-    uint32_t flags;
-#define COFF_SECTION_BSS         0x00000080U
-#define COFF_SECTION_DISCARDABLE 0x02000000U
-#define COFF_SECTION_WRITEABLE   0x80000000U
-};
-
 static void usage(const char *cmd, int rc)
 {
     fprintf(rc ? stderr : stdout,
@@ -80,7 +26,7 @@ static void usage(const char *cmd, int rc)
 }
 
 static unsigned int load(const char *name, int *handle,
-                         struct coff_section **sections,
+                         struct section_header **sections,
                          uint_fast64_t *image_base,
                          uint32_t *image_size,
                          unsigned int *width)
@@ -88,6 +34,7 @@ static unsigned int load(const char *name, int *handle,
     int in = open(name, O_RDONLY);
     struct mz_hdr mz_hdr;
     struct pe_hdr pe_hdr;
+    struct pe32_opt_hdr pe32_opt_hdr;
     uint32_t base;
 
     if ( in < 0 ||
@@ -96,16 +43,18 @@ static unsigned int load(const char *name, int *handle,
         perror(name);
         exit(2);
     }
-    if ( mz_hdr.signature != MZ_SIGNATURE ||
-         mz_hdr.relocations < sizeof(mz_hdr) ||
-         !mz_hdr.extended_header_base )
+
+    if ( mz_hdr.magic != MZ_MAGIC ||
+         mz_hdr.reloc_table_offset < sizeof(mz_hdr) ||
+         !mz_hdr.peaddr )
     {
         fprintf(stderr, "%s: Wrong DOS file format\n", name);
         exit(2);
     }
 
-    if ( lseek(in, mz_hdr.extended_header_base, SEEK_SET) < 0 ||
+    if ( lseek(in, mz_hdr.peaddr, SEEK_SET) < 0 ||
          read(in, &pe_hdr, sizeof(pe_hdr)) != sizeof(pe_hdr) ||
+         read(in, &pe32_opt_hdr, sizeof(pe32_opt_hdr)) != sizeof(pe32_opt_hdr) ||
          read(in, &base, sizeof(base)) != sizeof(base) ||
          /*
           * Luckily the image size field lives at the
@@ -117,35 +66,35 @@ static unsigned int load(const char *name, int *handle,
         perror(name);
         exit(3);
     }
-    switch ( (pe_hdr.signature == PE_SIGNATURE &&
-              pe_hdr.opt_hdr_size > sizeof(pe_hdr.opt_hdr)) *
-             pe_hdr.opt_hdr.magic )
+
+    switch ( (pe_hdr.magic == PE_MAGIC &&
+              pe_hdr.opt_hdr_size > sizeof(pe32_opt_hdr)) *
+              pe32_opt_hdr.magic )
     {
-    case PE_MAGIC_EXE32:
+    case PE_OPT_MAGIC_PE32:
         *width = 32;
         *image_base = base;
         break;
-    case PE_MAGIC_EXE32PLUS:
+    case PE_OPT_MAGIC_PE32PLUS:
         *width = 64;
-        *image_base = ((uint64_t)base << 32) | pe_hdr.opt_hdr.data_rva;
+        *image_base = ((uint64_t)base << 32) | pe32_opt_hdr.data_base;
         break;
     default:
         fprintf(stderr, "%s: Wrong PE file format\n", name);
         exit(3);
     }
 
-    *sections = malloc(pe_hdr.section_count * sizeof(**sections));
+    *sections = malloc(pe_hdr.sections * sizeof(**sections));
     if ( !*sections )
     {
         perror(NULL);
         exit(4);
     }
-    if ( lseek(in,
-               mz_hdr.extended_header_base + offsetof(struct pe_hdr, opt_hdr) +
-                  pe_hdr.opt_hdr_size,
+
+    if ( lseek(in, mz_hdr.peaddr + sizeof(pe_hdr) + pe_hdr.opt_hdr_size,
                SEEK_SET) < 0 ||
-         read(in, *sections, pe_hdr.section_count * sizeof(**sections)) !=
-             pe_hdr.section_count * sizeof(**sections) )
+         read(in, *sections, pe_hdr.sections * sizeof(**sections)) !=
+             pe_hdr.sections * sizeof(**sections) )
     {
         perror(name);
         exit(4);
@@ -153,12 +102,12 @@ static unsigned int load(const char *name, int *handle,
 
     *handle = in;
 
-    return pe_hdr.section_count;
+    return pe_hdr.sections;
 }
 
 static long page_size;
 
-static const void *map_section(const struct coff_section *sec, int in,
+static const void *map_section(const struct section_header *sec, int in,
                                const char *name)
 {
     const char *ptr;
@@ -166,10 +115,10 @@ static const void *map_section(const struct coff_section *sec, int in,
 
     if ( !page_size )
         page_size = sysconf(_SC_PAGESIZE);
-    offs = sec->file_offset & (page_size - 1);
+    offs = sec->data_addr & (page_size - 1);
 
-    ptr = mmap(0, offs + sec->file_size, PROT_READ, MAP_PRIVATE, in,
-               sec->file_offset - offs);
+    ptr = mmap(0, offs + sec->raw_data_size, PROT_READ, MAP_PRIVATE, in,
+               sec->data_addr - offs);
     if ( ptr == MAP_FAILED )
     {
         perror(name);
@@ -179,15 +128,15 @@ static const void *map_section(const struct coff_section *sec, int in,
     return ptr + offs;
 }
 
-static void unmap_section(const void *ptr, const struct coff_section *sec)
+static void unmap_section(const void *ptr, const struct section_header *sec)
 {
-    unsigned long offs = sec->file_offset & (page_size - 1);
+    unsigned long offs = sec->data_addr & (page_size - 1);
 
-    munmap((char *)ptr - offs, offs + sec->file_size);
+    munmap((char *)ptr - offs, offs + sec->raw_data_size);
 }
 
 static void diff_sections(const unsigned char *ptr1, const unsigned char *ptr2,
-                          const struct coff_section *sec,
+                          const struct section_header *sec,
                           int_fast64_t diff, unsigned int width,
                           uint_fast64_t base, uint_fast64_t end)
 {
@@ -208,7 +157,7 @@ static void diff_sections(const unsigned char *ptr1, const unsigned char *ptr2,
     while ( !(diff & (((int_fast64_t)1 << ((disp + 1) * CHAR_BIT)) - 1)) )
         ++disp;
 
-    for ( i = 0; i < sec->file_size; ++i )
+    for ( i = 0; i < sec->raw_data_size; ++i )
     {
         uint_fast32_t rva;
         union {
@@ -222,7 +171,7 @@ static void diff_sections(const unsigned char *ptr1, const unsigned char *ptr2,
         if ( ptr1[i] == ptr2[i] )
             continue;
 
-        if ( i < disp || i + width - disp > sec->file_size )
+        if ( i < disp || i + width - disp > sec->raw_data_size )
         {
             fprintf(stderr,
                     "Bogus difference at %.8s:%08" PRIxFAST32 "\n",
@@ -250,11 +199,11 @@ static void diff_sections(const unsigned char *ptr1, const unsigned char *ptr2,
             reloc_size += reloc_size & 2;
             if ( reloc_size )
                 printf("\t.equ rva_%08" PRIxFAST32 "_relocs,"
-                             " %#08" PRIxFAST32 "\n",
+                       " %#08" PRIxFAST32 "\n",
                        cur_rva, reloc_size);
             printf("\t.balign 4\n"
                    "\t.long %#08" PRIxFAST32 ","
-                          " rva_%08" PRIxFAST32 "_relocs\n",
+                   " rva_%08" PRIxFAST32 "_relocs\n",
                    rva, rva);
             cur_rva = rva;
             reloc_size = 8;
@@ -267,7 +216,7 @@ static void diff_sections(const unsigned char *ptr1, const unsigned char *ptr2,
             exit(3);
         }
 
-        if ( !(sec->flags & COFF_SECTION_WRITEABLE) )
+        if ( !(sec->flags & IMAGE_SCN_MEM_WRITE) )
             fprintf(stderr,
                     "Warning: relocation to r/o section %.8s:%08" PRIxFAST32 "\n",
                     sec->name, i - disp);
@@ -285,7 +234,7 @@ int main(int argc, char *argv[])
     unsigned int i, nsec, width1, width2;
     uint_fast64_t base1, base2;
     uint32_t size1, size2;
-    struct coff_section *sec1, *sec2;
+    struct section_header *sec1, *sec2;
 
     if ( argc == 1 ||
          !strcmp(argv[1], "-?") ||
@@ -328,16 +277,16 @@ int main(int argc, char *argv[])
 
         if ( memcmp(sec1[i].name, sec2[i].name, sizeof(sec1[i].name)) ||
              sec1[i].rva != sec2[i].rva ||
-             sec1[i].size != sec2[i].size ||
-             sec1[i].file_size != sec2[i].file_size ||
+             sec1[i].virtual_size != sec2[i].virtual_size ||
+             sec1[i].raw_data_size != sec2[i].raw_data_size ||
              sec1[i].flags != sec2[i].flags )
         {
             fprintf(stderr, "Mismatched section %u parameters\n", i);
             return 5;
         }
 
-        if ( !sec1[i].size ||
-             (sec1[i].flags & (COFF_SECTION_DISCARDABLE|COFF_SECTION_BSS)) )
+        if ( !sec1[i].virtual_size ||
+             (sec1[i].flags & (IMAGE_SCN_MEM_DISCARDABLE | IMAGE_SCN_CNT_UNINITIALIZED_DATA)) )
             continue;
 
         /*
@@ -354,10 +303,10 @@ int main(int argc, char *argv[])
             return 3;
         }
 
-        if ( sec1[i].file_size > sec1[i].size )
+        if ( sec1[i].raw_data_size > sec1[i].virtual_size )
         {
-            sec1[i].file_size = sec1[i].size;
-            sec2[i].file_size = sec2[i].size;
+            sec1[i].raw_data_size = sec1[i].virtual_size;
+            sec2[i].raw_data_size = sec2[i].virtual_size;
         }
         ptr1 = map_section(sec1 + i, in1, argv[1]);
         ptr2 = map_section(sec2 + i, in2, argv[2]);
diff --git a/xen/common/efi/pe.c b/xen/common/efi/pe.c
index ef8a2543e0..12f2af39d0 100644
--- a/xen/common/efi/pe.c
+++ b/xen/common/efi/pe.c
@@ -20,30 +20,8 @@
  * Lesser General Public License for more details.
  */
 
-
 #include "efi.h"
-
-struct DosFileHeader {
-    UINT8   Magic[2];
-    UINT16  LastSize;
-    UINT16  nBlocks;
-    UINT16  nReloc;
-    UINT16  HdrSize;
-    UINT16  MinAlloc;
-    UINT16  MaxAlloc;
-    UINT16  ss;
-    UINT16  sp;
-    UINT16  Checksum;
-    UINT16  ip;
-    UINT16  cs;
-    UINT16  RelocPos;
-    UINT16  nOverlay;
-    UINT16  reserved[4];
-    UINT16  OEMId;
-    UINT16  OEMInfo;
-    UINT16  reserved2[10];
-    UINT32  ExeHeader;
-};
+#include "efi/pe.h"
 
 #if defined(__arm__) || defined (__aarch64__)
 #define PE_HEADER_MACHINE 0xaa64
@@ -53,45 +31,17 @@ struct DosFileHeader {
 #error "Unknown architecture"
 #endif
 
-struct PeFileHeader {
-    UINT16  Machine;
-    UINT16  NumberOfSections;
-    UINT32  TimeDateStamp;
-    UINT32  PointerToSymbolTable;
-    UINT32  NumberOfSymbols;
-    UINT16  SizeOfOptionalHeader;
-    UINT16  Characteristics;
-};
-
-struct PeHeader {
-    UINT8   Magic[4];
-    struct PeFileHeader FileHeader;
-};
-
-struct PeSectionHeader {
-    CHAR8   Name[8];
-    UINT32  VirtualSize;
-    UINT32  VirtualAddress;
-    UINT32  SizeOfRawData;
-    UINT32  PointerToRawData;
-    UINT32  PointerToRelocations;
-    UINT32  PointerToLinenumbers;
-    UINT16  NumberOfRelocations;
-    UINT16  NumberOfLinenumbers;
-    UINT32  Characteristics;
-};
-
-static bool __init pe_name_compare(const struct PeSectionHeader *sect,
+static bool __init pe_name_compare(const struct section_header *sect,
                                    const CHAR16 *name)
 {
     size_t i;
 
-    if ( sect->Name[0] != '.' )
+    if ( sect->name[0] != '.' )
         return false;
 
-    for ( i = 1; i < sizeof(sect->Name); i++ )
+    for ( i = 1; i < sizeof(sect->name); i++ )
     {
-        const char c = sect->Name[i];
+        const char c = sect->name[i];
 
         if ( c != name[i - 1] )
             return false;
@@ -105,33 +55,29 @@ static bool __init pe_name_compare(const struct PeSectionHeader *sect,
 const void *__init pe_find_section(const void *image, const UINTN image_size,
                                    const CHAR16 *section_name, UINTN *size_out)
 {
-    const struct DosFileHeader *dos = image;
-    const struct PeHeader *pe;
-    const struct PeSectionHeader *sect;
+    const struct mz_hdr *mz = image;
+    const struct pe_hdr *pe;
+    const struct section_header *sect;
     UINTN offset, i;
 
-    if ( image_size < sizeof(*dos) ||
-         dos->Magic[0] != 'M' ||
-         dos->Magic[1] != 'Z' )
+    if ( image_size < sizeof(*mz) ||
+         mz->magic != MZ_MAGIC )
         return NULL;
 
-    offset = dos->ExeHeader;
+    offset = mz->peaddr;
     pe = image + offset;
 
     offset += sizeof(*pe);
     if ( image_size < offset ||
-         pe->Magic[0] != 'P' ||
-         pe->Magic[1] != 'E' ||
-         pe->Magic[2] != '\0' ||
-         pe->Magic[3] != '\0' )
+         pe->magic != PE_MAGIC )
         return NULL;
 
-    if ( pe->FileHeader.Machine != PE_HEADER_MACHINE )
+    if ( pe->machine != PE_HEADER_MACHINE )
         return NULL;
 
-    offset += pe->FileHeader.SizeOfOptionalHeader;
+    offset += pe->opt_hdr_size;
 
-    for ( i = 0; i < pe->FileHeader.NumberOfSections; i++ )
+    for ( i = 0; i < pe->sections; i++ )
     {
         sect = image + offset;
         if ( image_size < offset + sizeof(*sect) )
@@ -143,13 +89,13 @@ const void *__init pe_find_section(const void *image, const UINTN image_size,
             continue;
         }
 
-        if ( image_size < sect->VirtualSize + sect->VirtualAddress )
+        if ( image_size < sect->virtual_size + sect->rva )
             blexit(L"PE invalid section size + address");
 
         if ( size_out )
-            *size_out = sect->VirtualSize;
+            *size_out = sect->virtual_size;
 
-        return image + sect->VirtualAddress;
+        return image + sect->rva;
     }
 
     return NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 12:33:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 12:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802771.1213061 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st4j3-0004Il-6O; Tue, 24 Sep 2024 12:33:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802771.1213061; Tue, 24 Sep 2024 12:33:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st4j3-0004Ie-3x; Tue, 24 Sep 2024 12:33:05 +0000
Received: by outflank-mailman (input) for mailman id 802771;
 Tue, 24 Sep 2024 12:33:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st4j1-0004IY-Mr
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:33:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st4j1-0006p5-K4
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:33:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st4j1-0007NK-Ih
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:33:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cU9dkFCrkI3QBip2SpO33pGgRawCOIQ7Pw77b2pXZBM=; b=u1M1NRVx2QPAGrxeHdL5CWrJCn
	ddHnmbIrMYn/RSEXnObD7kp8dRnsNyv05upn0tET58EBznySY3+svHosSEoxK540RHodawEwzQTY8
	tXDsQiT9QgodAXqqLR0rNDUVoLH9uaGRsWPh6K/HuWhQRB4s5p3UMXb3kjiY0U5USlvI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vLAPIC: prevent undue recursion of vlapic_error()
Message-Id: <E1st4j1-0007NK-Ih@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 12:33:03 +0000

commit c42d9ec61f6d11e25fa77bd44dd11dad1edda268
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:23:29 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:23:29 2024 +0200

    x86/vLAPIC: prevent undue recursion of vlapic_error()
    
    With the error vector set to an illegal value, the function invoking
    vlapic_set_irq() would bring execution back here, with the non-recursive
    lock already held. Avoid the call in this case, merely further updating
    ESR (if necessary).
    
    This is XSA-462 / CVE-2024-45817.
    
    Fixes: 5f32d186a8b1 ("x86/vlapic: don't silently accept bad vectors")
    Reported-by: Federico Serafini <federico.serafini@bugseng.com>
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/vlapic.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 4a3e21a65f..992355e511 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -112,9 +112,24 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
     if ( (esr & errmask) != errmask )
     {
         uint32_t lvterr = vlapic_get_reg(vlapic, APIC_LVTERR);
+        bool inj = false;
 
-        vlapic_set_reg(vlapic, APIC_ESR, esr | errmask);
         if ( !(lvterr & APIC_LVT_MASKED) )
+        {
+            /*
+             * If LVTERR is unmasked and has an illegal vector, vlapic_set_irq()
+             * will end up back here.  Break the cycle by only injecting LVTERR
+             * if it will succeed, and folding in RECVILL otherwise.
+             */
+            if ( (lvterr & APIC_VECTOR_MASK) >= 16 )
+                 inj = true;
+            else
+                 errmask |= APIC_ESR_RECVILL;
+        }
+
+        vlapic_set_reg(vlapic, APIC_ESR, esr | errmask);
+
+        if ( inj )
             vlapic_set_irq(vlapic, lvterr & APIC_VECTOR_MASK, 0);
     }
     spin_unlock_irqrestore(&vlapic->esr_lock, flags);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 12:55:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 12:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802819.1213085 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st54K-0000R8-64; Tue, 24 Sep 2024 12:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802819.1213085; Tue, 24 Sep 2024 12:55:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st54K-0000R0-3d; Tue, 24 Sep 2024 12:55:04 +0000
Received: by outflank-mailman (input) for mailman id 802819;
 Tue, 24 Sep 2024 12:55:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st54J-0000Qu-HI
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:55:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st54J-0007Fo-Ey
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:55:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st54J-0001Y9-DP
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:55:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=e+wwLTmXzFPiRyCauwa8eA82NsE5p66JLhiC1OenFIY=; b=0EzgfvCcjmCL/z6apRUxSWPgNQ
	18u4RHvjiXesv5GdslEwZ3zLPLxDCUpiwnDxqM2g5t3BSA2FTKisW1zUxcSGY73W0/xVFL3uU30S1
	KTYiBvQRlyOU9CC1EcYu0Ok+fRX8kpPFPXUebxsXZSmSmqq5kKahRMzXERVI70S8VTRw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/vLAPIC: prevent undue recursion of vlapic_error()
Message-Id: <E1st54J-0001Y9-DP@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 12:55:03 +0000

commit 9358a7fad7f0427e7d1666da0c78cef341ee9072
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:27:03 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:27:03 2024 +0200

    x86/vLAPIC: prevent undue recursion of vlapic_error()
    
    With the error vector set to an illegal value, the function invoking
    vlapic_set_irq() would bring execution back here, with the non-recursive
    lock already held. Avoid the call in this case, merely further updating
    ESR (if necessary).
    
    This is XSA-462 / CVE-2024-45817.
    
    Fixes: 5f32d186a8b1 ("x86/vlapic: don't silently accept bad vectors")
    Reported-by: Federico Serafini <federico.serafini@bugseng.com>
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: c42d9ec61f6d11e25fa77bd44dd11dad1edda268
    master date: 2024-09-24 14:23:29 +0200
---
 xen/arch/x86/hvm/vlapic.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 9cfc82666a..46ff758904 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -112,9 +112,24 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
     if ( (esr & errmask) != errmask )
     {
         uint32_t lvterr = vlapic_get_reg(vlapic, APIC_LVTERR);
+        bool inj = false;
 
-        vlapic_set_reg(vlapic, APIC_ESR, esr | errmask);
         if ( !(lvterr & APIC_LVT_MASKED) )
+        {
+            /*
+             * If LVTERR is unmasked and has an illegal vector, vlapic_set_irq()
+             * will end up back here.  Break the cycle by only injecting LVTERR
+             * if it will succeed, and folding in RECVILL otherwise.
+             */
+            if ( (lvterr & APIC_VECTOR_MASK) >= 16 )
+                 inj = true;
+            else
+                 errmask |= APIC_ESR_RECVILL;
+        }
+
+        vlapic_set_reg(vlapic, APIC_ESR, esr | errmask);
+
+        if ( inj )
             vlapic_set_irq(vlapic, lvterr & APIC_VECTOR_MASK, 0);
     }
     spin_unlock_irqrestore(&vlapic->esr_lock, flags);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 12:55:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 12:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802820.1213090 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st54U-0000Sq-7c; Tue, 24 Sep 2024 12:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802820.1213090; Tue, 24 Sep 2024 12:55:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st54U-0000Si-52; Tue, 24 Sep 2024 12:55:14 +0000
Received: by outflank-mailman (input) for mailman id 802820;
 Tue, 24 Sep 2024 12:55:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st54T-0000SS-LK
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:55:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st54T-0007G0-Ka
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:55:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st54T-0001ZM-H9
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:55:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2V6+SLL+VFrQClNadTYHdBLD/18OD16IlSTcAAkkH7s=; b=X4fRotrzw6OvyANz2yprNYcVbg
	+dAvIUHkrTNUPuOBtA1xMetg4+fbxd7iQRItLfh0ae/+c9jdERa21J4aUqfKxfbcQLWaja9OodPhm
	oReEvF88riE0M/o+N5jnAgTnM5BShx3QdOsD6nCLlQCYzc5oRUiCMZVnOCWqrL0Ibf/A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] Arm: correct FIXADDR_TOP
Message-Id: <E1st54T-0001ZM-H9@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 12:55:13 +0000

commit 46a2ce35212c9b35c4818ca9eec918aa4a45cb48
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:28:22 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:28:22 2024 +0200

    Arm: correct FIXADDR_TOP
    
    While reviewing a RISC-V patch cloning the Arm code, I noticed an
    off-by-1 here: FIX_PMAP_{BEGIN,END} being an inclusive range and
    FIX_LAST being the same as FIX_PMAP_END, FIXADDR_TOP cannot derive from
    FIX_LAST alone, or else the BUG_ON() in virt_to_fix() would trigger if
    FIX_PMAP_END ended up being used.
    
    While touching this area also add a check for fixmap and boot FDT area
    to not only not overlap, but to have at least one (unmapped) page in
    between.
    
    Fixes: 4f17357b52f6 ("xen/arm: add Persistent Map (PMAP) infrastructure")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    master commit: fe3412ab83cc53c2bf2c497be3794bc09751efa5
    master date: 2024-08-13 21:50:55 +0100
---
 xen/arch/arm/include/asm/fixmap.h | 2 +-
 xen/arch/arm/mmu/setup.c          | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/include/asm/fixmap.h b/xen/arch/arm/include/asm/fixmap.h
index a823456ecb..0cb5d54d1c 100644
--- a/xen/arch/arm/include/asm/fixmap.h
+++ b/xen/arch/arm/include/asm/fixmap.h
@@ -18,7 +18,7 @@
 #define FIX_LAST FIX_PMAP_END
 
 #define FIXADDR_START FIXMAP_ADDR(0)
-#define FIXADDR_TOP FIXMAP_ADDR(FIX_LAST)
+#define FIXADDR_TOP FIXMAP_ADDR(FIX_LAST + 1)
 
 #ifndef __ASSEMBLY__
 
diff --git a/xen/arch/arm/mmu/setup.c b/xen/arch/arm/mmu/setup.c
index f4bb424c3c..57042ed57b 100644
--- a/xen/arch/arm/mmu/setup.c
+++ b/xen/arch/arm/mmu/setup.c
@@ -128,6 +128,12 @@ static void __init __maybe_unused build_assertions(void)
 
 #undef CHECK_SAME_SLOT
 #undef CHECK_DIFFERENT_SLOT
+
+    /*
+     * Fixmaps must not overlap with boot FDT mapping area. Make sure there's
+     * at least one guard page in between.
+     */
+    BUILD_BUG_ON(FIXADDR_TOP >= BOOT_FDT_VIRT_START);
 }
 
 lpae_t __init pte_of_xenaddr(vaddr_t va)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 12:55:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 12:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802821.1213093 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st54e-0000Vy-9N; Tue, 24 Sep 2024 12:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802821.1213093; Tue, 24 Sep 2024 12:55:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st54e-0000Vq-6U; Tue, 24 Sep 2024 12:55:24 +0000
Received: by outflank-mailman (input) for mailman id 802821;
 Tue, 24 Sep 2024 12:55:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st54d-0000VX-OL
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:55:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st54d-0007GG-NW
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:55:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st54d-0001aD-Mi
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:55:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WvyEDPS1FGTANQQiyu763/g2M4e+1cPb2dXW/hPGPf4=; b=CSwVi1u5osnoz8bVELqyaNxTVI
	k8l3ssi+0REdeE8ofwmJeYKNhxBQy8lRsD3z17MvMSiYCG5Ky525hoV77HeYwwip+foDqSnB/weNe
	zoLaOFTMyMmdJGimX16HRH37KKJezX7LEOFAelsG6y5EfR8Vagi0fUtfPo73JZgRcSyU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] xl: fix incorrect output in "help" command
Message-Id: <E1st54d-0001aD-Mi@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 12:55:23 +0000

commit e12998a9db8d0ac14477557d09b437783a999ea4
Author:     John E. Krokes <mag@netherworld.org>
AuthorDate: Tue Sep 24 14:29:26 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:29:26 2024 +0200

    xl: fix incorrect output in "help" command
    
    In "xl help", the output includes this line:
    
     vsnd-list           List virtual display devices for a domain
    
    This should obviously say "sound devices" instead of "display devices".
    
    Signed-off-by: John E. Krokes <mag@netherworld.org>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: 09226d165b57d919150458044c5b594d3d1dc23a
    master date: 2024-08-14 08:49:44 +0200
---
 tools/xl/xl_cmdtable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c
index 42751228c1..53fc22d344 100644
--- a/tools/xl/xl_cmdtable.c
+++ b/tools/xl/xl_cmdtable.c
@@ -433,7 +433,7 @@ const struct cmd_spec cmd_table[] = {
     },
     { "vsnd-list",
       &main_vsndlist, 0, 0,
-      "List virtual display devices for a domain",
+      "List virtual sound devices for a domain",
       "<Domain(s)>",
     },
     { "vsnd-detach",
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 12:55:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 12:55:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802825.1213097 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st54p-0000Z0-AW; Tue, 24 Sep 2024 12:55:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802825.1213097; Tue, 24 Sep 2024 12:55:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st54p-0000Yt-84; Tue, 24 Sep 2024 12:55:35 +0000
Received: by outflank-mailman (input) for mailman id 802825;
 Tue, 24 Sep 2024 12:55:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st54n-0000Yg-Ra
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:55:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st54n-0007Gm-Qk
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:55:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st54n-0001az-Pw
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:55:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mZETZq8/LEd2nZQbCrt+4aNkHCSrdoHuEbRom8zPueQ=; b=HLByzMcSHJwlcToWYSxbi1l5OJ
	2oNAaaocMx2qTlur/peaR4bKDKTuJRunpAv/cnQ9l9LejydrJW6BetQ85lb1BkmX8QZKwp34KKlGn
	bfBkzOfjAmeegkzMSfVB02w++gIN+cUEtj49l5oJKFspLXydp6jhKTwYwds9Lo9mNlyI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86emul: correct #UD check for AVX512-FP16 complex multiplications
Message-Id: <E1st54n-0001az-Pw@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 12:55:33 +0000

commit e2f29f7bad59c4be53363c8c0d2933982a22d0de
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:30:04 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:30:04 2024 +0200

    x86emul: correct #UD check for AVX512-FP16 complex multiplications
    
    avx512_vlen_check()'s argument was inverted, while the surrounding
    conditional wrongly forced the EVEX.L'L check for the scalar forms when
    embedded rounding was in effect.
    
    Fixes: d14c52cba0f5 ("x86emul: handle AVX512-FP16 complex multiplication insns")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: a30d438ce58b70c5955f5d37f776086ab8f88623
    master date: 2024-08-19 15:32:31 +0200
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 2d5c1de8ec..16557385bf 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -7984,8 +7984,8 @@ x86_emulate(
         generate_exception_if(modrm_reg == src1 ||
                               (ea.type != OP_MEM && modrm_reg == modrm_rm),
                               X86_EXC_UD);
-        if ( ea.type != OP_REG || (b & 1) || !evex.brs )
-            avx512_vlen_check(!(b & 1));
+        if ( ea.type != OP_REG || !evex.brs )
+            avx512_vlen_check(b & 1);
         goto simd_zmm;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 12:55:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 12:55:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802826.1213101 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st54z-0000bU-C1; Tue, 24 Sep 2024 12:55:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802826.1213101; Tue, 24 Sep 2024 12:55:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st54z-0000bN-9X; Tue, 24 Sep 2024 12:55:45 +0000
Received: by outflank-mailman (input) for mailman id 802826;
 Tue, 24 Sep 2024 12:55:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st54x-0000bD-V8
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:55:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st54x-0007Gv-UM
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:55:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st54x-0001cV-T2
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:55:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+vt7E4tqqE8RMdD0oKVBK70F5SKri9SftH6gXbOBeP4=; b=mn25IY9+CnKXBYV8uYzxobesWb
	4wp5GTuEQTOx+N4gsk6PAHVBHpl8IRd6j77hv9dLz8NdP3Z8bVoepME0M3CNWMSojVZ3T1XmLohAo
	vWU8sy58Boo5LMzR2Yw3mb6pqAt+3MEjY4Mt2FESeckDy3qCJZUGm3zIQSvZtISN7/WU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/pv: Introduce x86_merge_dr6() and fix do_debug()
Message-Id: <E1st54x-0001cV-T2@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 12:55:43 +0000

commit de924e4dbac80ac7d94a2e86c37eecccaa1bc677
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 24 14:30:49 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:30:49 2024 +0200

    x86/pv: Introduce x86_merge_dr6() and fix do_debug()
    
    Pretty much everywhere in Xen the logic to update %dr6 when injecting #DB is
    buggy.  Introduce a new x86_merge_dr6() helper, and start fixing the mess by
    adjusting the dr6 merge in do_debug().  Also correct the comment.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 54ef601a66e8d812a6a6a308f02524e81201825e
    master date: 2024-08-21 23:59:19 +0100
---
 xen/arch/x86/debug.c                 | 40 ++++++++++++++++++++++++++++++++++++
 xen/arch/x86/include/asm/debugreg.h  |  7 +++++++
 xen/arch/x86/include/asm/x86-defns.h |  7 +++++++
 xen/arch/x86/traps.c                 | 11 +++++++---
 4 files changed, 62 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/debug.c b/xen/arch/x86/debug.c
index 127fe83021..b10f1f12b6 100644
--- a/xen/arch/x86/debug.c
+++ b/xen/arch/x86/debug.c
@@ -2,12 +2,52 @@
 /*
  * Copyright (C) 2023 XenServer.
  */
+#include <xen/bug.h>
 #include <xen/kernel.h>
 
 #include <xen/lib/x86/cpu-policy.h>
 
 #include <asm/debugreg.h>
 
+/*
+ * Merge new bits into dr6.  'new' is always given in positive polarity,
+ * matching the Intel VMCS PENDING_DBG semantics.
+ *
+ * At the time of writing (August 2024), on the subject of %dr6 updates the
+ * manuals are either vague (Intel "certain exceptions may clear bits 0-3"),
+ * or disputed (AMD makes statements which don't match observed behaviour).
+ *
+ * The only debug exception I can find which doesn't clear the breakpoint bits
+ * is ICEBP(/INT1) on AMD systems.  This is also the one source of #DB that
+ * doesn't have an explicit status bit, meaning we can't easily identify this
+ * case either (AMD systems don't virtualise PENDING_DBG and only provide a
+ * post-merge %dr6 value).
+ *
+ * Treat %dr6 merging as unconditionally writing the breakpoint bits.
+ *
+ * We can't really manage any better, and guest kernels handling #DB as
+ * instructed by the SDM/APM (i.e. reading %dr6 then resetting it back to
+ * default) wont notice.
+ */
+unsigned int x86_merge_dr6(const struct cpu_policy *p, unsigned int dr6,
+                           unsigned int new)
+{
+    /* Flip dr6 to have positive polarity. */
+    dr6 ^= X86_DR6_DEFAULT;
+
+    /* Sanity check that only known values are passed in. */
+    ASSERT(!(dr6 & ~X86_DR6_KNOWN_MASK));
+    ASSERT(!(new & ~X86_DR6_KNOWN_MASK));
+
+    /* Breakpoint bits overridden.  All others accumulate. */
+    dr6 = (dr6 & ~X86_DR6_BP_MASK) | new;
+
+    /* Flip dr6 back to having default polarity. */
+    dr6 ^= X86_DR6_DEFAULT;
+
+    return x86_adj_dr6_rsvd(p, dr6);
+}
+
 unsigned int x86_adj_dr6_rsvd(const struct cpu_policy *p, unsigned int dr6)
 {
     unsigned int ones = X86_DR6_DEFAULT;
diff --git a/xen/arch/x86/include/asm/debugreg.h b/xen/arch/x86/include/asm/debugreg.h
index 96c406ad53..6baa725441 100644
--- a/xen/arch/x86/include/asm/debugreg.h
+++ b/xen/arch/x86/include/asm/debugreg.h
@@ -108,4 +108,11 @@ struct cpu_policy;
 unsigned int x86_adj_dr6_rsvd(const struct cpu_policy *p, unsigned int dr6);
 unsigned int x86_adj_dr7_rsvd(const struct cpu_policy *p, unsigned int dr7);
 
+/*
+ * Merge new bits into dr6.  'new' is always given in positive polarity,
+ * matching the Intel VMCS PENDING_DBG semantics.
+ */
+unsigned int x86_merge_dr6(const struct cpu_policy *p, unsigned int dr6,
+                           unsigned int new);
+
 #endif /* _X86_DEBUGREG_H */
diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index 3bcdbaccd3..caa92829ea 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -132,6 +132,13 @@
 #define X86_DR6_ZEROS           _AC(0x00001000, UL)  /* %dr6 bits forced to 0       */
 #define X86_DR6_DEFAULT         _AC(0xffff0ff0, UL)  /* Default %dr6 value          */
 
+#define X86_DR6_BP_MASK                                 \
+    (X86_DR6_B0 | X86_DR6_B1 | X86_DR6_B2 | X86_DR6_B3)
+
+#define X86_DR6_KNOWN_MASK                                              \
+    (X86_DR6_BP_MASK | X86_DR6_BLD | X86_DR6_BD | X86_DR6_BS |          \
+     X86_DR6_BT | X86_DR6_RTM)
+
 /*
  * Debug control flags in DR7.
  */
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index ee91fc56b1..78e83f6fc1 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2017,9 +2017,14 @@ void asmlinkage do_debug(struct cpu_user_regs *regs)
         return;
     }
 
-    /* Save debug status register where guest OS can peek at it */
-    v->arch.dr6 |= (dr6 & ~X86_DR6_DEFAULT);
-    v->arch.dr6 &= (dr6 | ~X86_DR6_DEFAULT);
+    /*
+     * Update the guest's dr6 so the debugger can peek at it.
+     *
+     * TODO: This should be passed out-of-band, so guest state is not modified
+     * by debugging actions completed behind it's back.
+     */
+    v->arch.dr6 = x86_merge_dr6(v->domain->arch.cpu_policy,
+                                v->arch.dr6, dr6 ^ X86_DR6_DEFAULT);
 
     if ( guest_kernel_mode(v, regs) && v->domain->debugger_attached )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 12:55:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 12:55:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802827.1213105 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st559-0000dn-Dm; Tue, 24 Sep 2024 12:55:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802827.1213105; Tue, 24 Sep 2024 12:55:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st559-0000dd-B3; Tue, 24 Sep 2024 12:55:55 +0000
Received: by outflank-mailman (input) for mailman id 802827;
 Tue, 24 Sep 2024 12:55:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st558-0000dT-2K
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:55:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st558-0007HA-1a
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:55:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st558-0001dZ-0i
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:55:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4Sq3iBwNwnRezzZadEgKJ7T3FiNAzwixx0DzLqJkW8g=; b=zvZcq94x9Q2Rrh0kKa51GVtsA5
	ZrwarJ+i13v3wQQdrJ4RJfzsU++3wK2/SdexbDhBJWvBNn7GZN7thLjv6NvKL7q95GRzcguljX4T6
	K/C9MMhi1gEZHR8Z+aVlrWqgyOsulYsUeeWo9a0FfAo3JkLoUXwowFnCMogTJkUSlOns=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/pv: Fix merging of new status bits into %dr6
Message-Id: <E1st558-0001dZ-0i@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 12:55:54 +0000

commit b74a5ea8399d1a0466c55332f557863acdae21b6
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 24 14:34:30 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:34:30 2024 +0200

    x86/pv: Fix merging of new status bits into %dr6
    
    All #DB exceptions result in an update of %dr6, but this isn't captured in
    Xen's handling, and is buggy just about everywhere.
    
    To begin resolving this issue, add a new pending_dbg field to x86_event
    (unioned with cr2 to avoid taking any extra space, adjusting users to avoid
    old-GCC bugs with anonymous unions), and introduce pv_inject_DB() to replace
    the current callers using pv_inject_hw_exception().
    
    Push the adjustment of v->arch.dr6 into pv_inject_event(), and use the new
    x86_merge_dr6() rather than the current incorrect logic.
    
    A key property is that pending_dbg is taken with positive polarity to deal
    with RTM/BLD sensibly.  Most callers pass in a constant, but callers passing
    in a hardware %dr6 value need to XOR the value with X86_DR6_DEFAULT to flip to
    positive polarity.
    
    This fixes the behaviour of the breakpoint status bits; that any left pending
    are generally discarded when a new #DB is raised.  In principle it would fix
    RTM/BLD too, except PV guests can't turn these capabilities on to start with.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: db39fa4b27ea470902d4625567cb6fa24030ddfa
    master date: 2024-08-21 23:59:19 +0100
---
 xen/arch/x86/include/asm/domain.h      | 18 ++++++++++++++++--
 xen/arch/x86/include/asm/hvm/hvm.h     |  3 ++-
 xen/arch/x86/pv/emul-priv-op.c         |  5 +----
 xen/arch/x86/pv/emulate.c              |  9 +++++++--
 xen/arch/x86/pv/ro-page-fault.c        |  2 +-
 xen/arch/x86/pv/traps.c                | 16 ++++++++++++----
 xen/arch/x86/traps.c                   |  2 +-
 xen/arch/x86/x86_emulate/x86_emulate.h |  5 ++++-
 8 files changed, 44 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index f5daeb182b..5d92891e6f 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -731,15 +731,29 @@ static inline void pv_inject_hw_exception(unsigned int vector, int errcode)
     pv_inject_event(&event);
 }
 
+static inline void pv_inject_DB(unsigned long pending_dbg)
+{
+    struct x86_event event = {
+        .vector      = X86_EXC_DB,
+        .type        = X86_EVENTTYPE_HW_EXCEPTION,
+        .error_code  = X86_EVENT_NO_EC,
+    };
+
+    event.pending_dbg = pending_dbg;
+
+    pv_inject_event(&event);
+}
+
 static inline void pv_inject_page_fault(int errcode, unsigned long cr2)
 {
-    const struct x86_event event = {
+    struct x86_event event = {
         .vector = X86_EXC_PF,
         .type = X86_EVENTTYPE_HW_EXCEPTION,
         .error_code = errcode,
-        .cr2 = cr2,
     };
 
+    event.cr2 = cr2;
+
     pv_inject_event(&event);
 }
 
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 1c01e22c8e..238eece0cf 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -525,9 +525,10 @@ static inline void hvm_inject_page_fault(int errcode, unsigned long cr2)
         .vector = X86_EXC_PF,
         .type = X86_EVENTTYPE_HW_EXCEPTION,
         .error_code = errcode,
-        .cr2 = cr2,
     };
 
+    event.cr2 = cr2;
+
     hvm_inject_event(&event);
 }
 
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index aa11ecadaa..15c83b9d23 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -1366,10 +1366,7 @@ int pv_emulate_privileged_op(struct cpu_user_regs *regs)
             ctxt.bpmatch |= DR_STEP;
 
         if ( ctxt.bpmatch )
-        {
-            curr->arch.dr6 |= ctxt.bpmatch | DR_STATUS_RESERVED_ONE;
-            pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
-        }
+            pv_inject_DB(ctxt.bpmatch);
 
         /* fall through */
     case X86EMUL_RETRY:
diff --git a/xen/arch/x86/pv/emulate.c b/xen/arch/x86/pv/emulate.c
index e7a1c0a2cc..8c44dea123 100644
--- a/xen/arch/x86/pv/emulate.c
+++ b/xen/arch/x86/pv/emulate.c
@@ -71,10 +71,15 @@ void pv_emul_instruction_done(struct cpu_user_regs *regs, unsigned long rip)
 {
     regs->rip = rip;
     regs->eflags &= ~X86_EFLAGS_RF;
+
     if ( regs->eflags & X86_EFLAGS_TF )
     {
-        current->arch.dr6 |= DR_STEP | DR_STATUS_RESERVED_ONE;
-        pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
+        /*
+         * TODO: this should generally use TF from the start of the
+         * instruction.  It's only a latent bug for now, as this path isn't
+         * used for any instruction which modifies eflags.
+         */
+        pv_inject_DB(X86_DR6_BS);
     }
 }
 
diff --git a/xen/arch/x86/pv/ro-page-fault.c b/xen/arch/x86/pv/ro-page-fault.c
index cad28ef928..d0fe07e3a1 100644
--- a/xen/arch/x86/pv/ro-page-fault.c
+++ b/xen/arch/x86/pv/ro-page-fault.c
@@ -390,7 +390,7 @@ int pv_ro_page_fault(unsigned long addr, struct cpu_user_regs *regs)
         /* Fallthrough */
     case X86EMUL_OKAY:
         if ( ctxt.retire.singlestep )
-            pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
+            pv_inject_DB(X86_DR6_BS);
 
         /* Fallthrough */
     case X86EMUL_RETRY:
diff --git a/xen/arch/x86/pv/traps.c b/xen/arch/x86/pv/traps.c
index 83e84e2762..5a7341abf0 100644
--- a/xen/arch/x86/pv/traps.c
+++ b/xen/arch/x86/pv/traps.c
@@ -12,6 +12,7 @@
 #include <xen/lib.h>
 #include <xen/softirq.h>
 
+#include <asm/debugreg.h>
 #include <asm/pv/trace.h>
 #include <asm/shared.h>
 #include <asm/traps.h>
@@ -50,9 +51,9 @@ void pv_inject_event(const struct x86_event *event)
     tb->cs    = ti->cs;
     tb->eip   = ti->address;
 
-    if ( event->type == X86_EVENTTYPE_HW_EXCEPTION &&
-         vector == X86_EXC_PF )
+    switch ( vector | -(event->type == X86_EVENTTYPE_SW_INTERRUPT) )
     {
+    case X86_EXC_PF:
         curr->arch.pv.ctrlreg[2] = event->cr2;
         arch_set_cr2(curr, event->cr2);
 
@@ -62,9 +63,16 @@ void pv_inject_event(const struct x86_event *event)
             error_code |= PFEC_user_mode;
 
         trace_pv_page_fault(event->cr2, error_code);
-    }
-    else
+        break;
+
+    case X86_EXC_DB:
+        curr->arch.dr6 = x86_merge_dr6(curr->domain->arch.cpu_policy,
+                                       curr->arch.dr6, event->pending_dbg);
+        fallthrough;
+    default:
         trace_pv_trap(vector, regs->rip, use_error_code, error_code);
+        break;
+    }
 
     if ( use_error_code )
     {
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 78e83f6fc1..8e2df3e719 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2032,7 +2032,7 @@ void asmlinkage do_debug(struct cpu_user_regs *regs)
         return;
     }
 
-    pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
+    pv_inject_DB(0 /* N/A, already merged */);
 }
 
 void asmlinkage do_entry_CP(struct cpu_user_regs *regs)
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.h b/xen/arch/x86/x86_emulate/x86_emulate.h
index d92be69d84..e8a0e57228 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.h
+++ b/xen/arch/x86/x86_emulate/x86_emulate.h
@@ -78,7 +78,10 @@ struct x86_event {
     uint8_t       type;         /* X86_EVENTTYPE_* */
     uint8_t       insn_len;     /* Instruction length */
     int32_t       error_code;   /* X86_EVENT_NO_EC if n/a */
-    unsigned long cr2;          /* Only for X86_EXC_PF h/w exception */
+    union {
+        unsigned long cr2;         /* #PF */
+        unsigned long pending_dbg; /* #DB (new DR6 bits, positive polarity) */
+    };
 };
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 12:56:05 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 12:56:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802828.1213111 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st55J-0000gh-HW; Tue, 24 Sep 2024 12:56:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802828.1213111; Tue, 24 Sep 2024 12:56:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st55J-0000gZ-Du; Tue, 24 Sep 2024 12:56:05 +0000
Received: by outflank-mailman (input) for mailman id 802828;
 Tue, 24 Sep 2024 12:56:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st55I-0000gO-5b
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:56:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st55I-0007HY-4m
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:56:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st55I-0001f4-3t
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:56:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pO8uunXCtnAszujPUkrI/IY/pn8lRJYFLRoggXws8eY=; b=SZhtkuFaIoeCAzrwbZbUS/27Dy
	yU5mUpwW6mageHpT1PxRsiNGKXDa4G864Vz0ypav6fqu9QLdywRTKNMAmNqsIYDdc/6v7dWSHzFZ0
	ZJZTIexmvkhgjceYwi7OKNFf/c0rZh9JpQU8tq54e1gEZMh1vsK81TksnJz/s1vCUnz4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/pv: Address Coverity complaint in check_guest_io_breakpoint()
Message-Id: <E1st55I-0001f4-3t@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 12:56:04 +0000

commit cb6c3cfc5f8aa8bd8aae1abffea0574b02a04840
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 24 14:36:25 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:36:25 2024 +0200

    x86/pv: Address Coverity complaint in check_guest_io_breakpoint()
    
    Commit 08aacc392d86 ("x86/emul: Fix misaligned IO breakpoint behaviour in PV
    guests") caused a Coverity INTEGER_OVERFLOW complaint based on the reasoning
    that width could be 0.
    
    It can't, but digging into the code generation, GCC 8 and later (bisected on
    godbolt) choose to emit a CSWITCH lookup table, and because the range (bottom
    2 bits clear), it's a 16-entry lookup table.
    
    So Coverity is understandable, given that GCC did emit a (dead) logic path
    where width stayed 0.
    
    Rewrite the logic.  Introduce x86_bp_width() which compiles to a single basic
    block, which replaces the switch() statement.  Take the opportunity to also
    make start and width be loop-scope variables.
    
    No practical change, but it should compile better and placate Coverity.
    
    Fixes: 08aacc392d86 ("x86/emul: Fix misaligned IO breakpoint behaviour in PV guests")
    Coverity-ID: 1616152
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 6d41a9d8a12ff89adabdc286e63e9391a0481699
    master date: 2024-08-21 23:59:19 +0100
---
 xen/arch/x86/include/asm/debugreg.h | 25 +++++++++++++++++++++++++
 xen/arch/x86/pv/emul-priv-op.c      | 21 ++++++---------------
 2 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/include/asm/debugreg.h b/xen/arch/x86/include/asm/debugreg.h
index 6baa725441..23aa592e40 100644
--- a/xen/arch/x86/include/asm/debugreg.h
+++ b/xen/arch/x86/include/asm/debugreg.h
@@ -115,4 +115,29 @@ unsigned int x86_adj_dr7_rsvd(const struct cpu_policy *p, unsigned int dr7);
 unsigned int x86_merge_dr6(const struct cpu_policy *p, unsigned int dr6,
                            unsigned int new);
 
+/*
+ * Calculate the width of a breakpoint from its dr7 encoding.
+ *
+ * The LEN encoding in dr7 is 2 bits wide per breakpoint and encoded as a X-1
+ * (0, 1 and 3) for widths of 1, 2 and 4 respectively in the 32bit days.
+ *
+ * In 64bit, the unused value (2) was given a meaning of width 8, which is
+ * great for efficiency but less great for nicely calculating the width.
+ */
+static inline unsigned int x86_bp_width(unsigned int dr7, unsigned int bp)
+{
+    unsigned int raw = (dr7 >> (DR_CONTROL_SHIFT +
+                                DR_CONTROL_SIZE * bp + 2)) & 3;
+
+    /*
+     * If the top bit is set (i.e. we've got an 4 or 8 byte wide breakpoint),
+     * flip the bottom to reverse their order, making them sorted properly.
+     * Then it's a simple shift to calculate the width.
+     */
+    if ( raw & 2 )
+        raw ^= 1;
+
+    return 1U << raw;
+}
+
 #endif /* _X86_DEBUGREG_H */
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 15c83b9d23..b90f745c75 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -323,30 +323,21 @@ static unsigned int check_guest_io_breakpoint(struct vcpu *v,
                                               unsigned int port,
                                               unsigned int len)
 {
-    unsigned int width, i, match = 0;
-    unsigned long start;
+    unsigned int i, match = 0;
 
     if ( !v->arch.pv.dr7_emul || !(v->arch.pv.ctrlreg[4] & X86_CR4_DE) )
         return 0;
 
     for ( i = 0; i < 4; i++ )
     {
+        unsigned long start;
+        unsigned int width;
+
         if ( !(v->arch.pv.dr7_emul & (3 << (i * DR_ENABLE_SIZE))) )
             continue;
 
-        start = v->arch.dr[i];
-        width = 0;
-
-        switch ( (v->arch.dr7 >>
-                  (DR_CONTROL_SHIFT + i * DR_CONTROL_SIZE)) & 0xc )
-        {
-        case DR_LEN_1: width = 1; break;
-        case DR_LEN_2: width = 2; break;
-        case DR_LEN_4: width = 4; break;
-        case DR_LEN_8: width = 8; break;
-        }
-
-        start &= ~(width - 1UL);
+        width = x86_bp_width(v->arch.dr7, i);
+        start = v->arch.dr[i] & ~(width - 1UL);
 
         if ( (start < (port + len)) && ((start + width) > port) )
             match |= 1u << i;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 12:56:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 12:56:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802829.1213113 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st55T-0000jO-I5; Tue, 24 Sep 2024 12:56:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802829.1213113; Tue, 24 Sep 2024 12:56:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st55T-0000jF-FV; Tue, 24 Sep 2024 12:56:15 +0000
Received: by outflank-mailman (input) for mailman id 802829;
 Tue, 24 Sep 2024 12:56:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st55S-0000ix-8r
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:56:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st55S-0007Ho-83
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:56:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st55S-0001hV-7G
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:56:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AY+JuVjVveO8FPjNjpa5QHV/UhoQYCrxF5Za09VTq6c=; b=HWUyBpZkagCUwA73tWrjVbRnkW
	XKV4Q/pm/j7BfaZkRG9dQkutouHUBZ4bX0oRs6q+MBhz/fn2LCgJ+wms3488DeHAM1NvAwt9a5t53
	/phzh1uqIOmKD88tW1WoMH+zcrEWzUTjgK8dVDEviF06Ks1qm5xoIi3/ArnqOWzMWXpY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86emul: always set operand size for AVX-VNNI-INT8 insns
Message-Id: <E1st55S-0001hV-7G@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 12:56:14 +0000

commit 1e68200487e662e9f8720d508a1d6b3d3e2c72b9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:37:08 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:37:08 2024 +0200

    x86emul: always set operand size for AVX-VNNI-INT8 insns
    
    Unlike for AVX-VNNI-INT16 I failed to notice that op_bytes may still be
    zero when reaching the respective case block: With the ext0f38_table[]
    entries having simd_packed_int, the defaulting at the bottom of
    x86emul_decode() won't set the field to non-zero for F3- or F2-prefixed
    insns.
    
    Fixes: 842acaa743a5 ("x86emul: support AVX-VNNI-INT8")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: d45687cca2450bfebe1dfbddb22f4f03c6fbc9cb
    master date: 2024-08-23 09:11:15 +0200
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 16557385bf..4d9649a2af 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -6075,6 +6075,7 @@ x86_emulate(
     case X86EMUL_OPC_VEX_F2(0x0f38, 0x51): /* vpdpbssds [xy]mm/mem,[xy]mm,[xy]mm */
         host_and_vcpu_must_have(avx_vnni_int8);
         generate_exception_if(vex.w, X86_EXC_UD);
+        op_bytes = 16 << vex.l;
         goto simd_0f_ymm;
 
     case X86EMUL_OPC_VEX_66(0x0f38, 0x50): /* vpdpbusd [xy]mm/mem,[xy]mm,[xy]mm */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 12:56:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 12:56:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802830.1213118 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st55d-0000mO-Jk; Tue, 24 Sep 2024 12:56:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802830.1213118; Tue, 24 Sep 2024 12:56:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st55d-0000mG-H6; Tue, 24 Sep 2024 12:56:25 +0000
Received: by outflank-mailman (input) for mailman id 802830;
 Tue, 24 Sep 2024 12:56:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st55c-0000m0-Bw
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:56:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st55c-0007Hy-BD
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:56:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st55c-0001iB-Aa
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:56:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=f8WpiHV0s2GGa53Hg36LpvC822I8mDLcu2E5NcYyZfg=; b=PuqMRGm6wjX+vh6OGijYvS+M0v
	sUf1D8i/qSIdyxXArBL99XiB5xZNNT9YOPp3PnuI4lldD7pb+oQPVqXsAByb1ShC4/3Z1gO9Ovzic
	cvZ2El7DLfTSMrfm/lvXYLqOSfj4w3qBuOGqUdxVF16SHw6XHJKPVsErs+h4GcFsiRTw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86emul: set (fake) operand size for AVX512CD broadcast insns
Message-Id: <E1st55c-0001iB-Aa@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 12:56:24 +0000

commit a0d6b75b832d2f7c54429de1a550fe122bcd6881
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:37:52 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:37:52 2024 +0200

    x86emul: set (fake) operand size for AVX512CD broadcast insns
    
    Back at the time I failed to pay attention to op_bytes still being zero
    when reaching the respective case block: With the ext0f38_table[]
    entries having simd_packed_int, the defaulting at the bottom of
    x86emul_decode() won't set the field to non-zero for F3-prefixed insns.
    
    Fixes: 37ccca740c26 ("x86emul: support AVX512CD insns")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 6fa6b7feaafd622db3a2f3436750cf07782f4c12
    master date: 2024-08-23 09:12:24 +0200
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 4d9649a2af..305f4286bf 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -5928,6 +5928,7 @@ x86_emulate(
                                evex.w == ((b >> 4) & 1)),
                               X86_EXC_UD);
         d |= TwoOp;
+        op_bytes = 1; /* fake */
         /* fall through */
     case X86EMUL_OPC_EVEX_66(0x0f38, 0xc4): /* vpconflict{d,q} [xyz]mm/mem,[xyz]mm{k} */
         fault_suppression = false;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 12:56:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 12:56:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802831.1213122 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st55n-0000sD-LP; Tue, 24 Sep 2024 12:56:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802831.1213122; Tue, 24 Sep 2024 12:56:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st55n-0000s6-IW; Tue, 24 Sep 2024 12:56:35 +0000
Received: by outflank-mailman (input) for mailman id 802831;
 Tue, 24 Sep 2024 12:56:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st55m-0000qY-En
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:56:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st55m-0007IS-E4
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:56:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st55m-0001jH-DN
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:56:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7VJi6KSD06uydXyrY5D+8otrjKut344OHAORRT0y1xI=; b=5ZH6o3RqNbCBAexuljy1v7ZxX6
	XUaYcpXZ3aqcKiHqm02YPD5j6QAfZspfhvwQVNskGSoBX2sV4PuC6K8TLgue2YDEIMZ17E0DXUm8V
	UVM7OAFUXIrWU7rzmTVpntmYmAMh1vKuxTgU08vr5Xm2fHSdTpSLYk6hQ0qtSQb93xz4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/x2APIC: correct cluster tracking upon CPUs going down for S3
Message-Id: <E1st55m-0001jH-DN@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 12:56:34 +0000

commit 404fb9b745dd3f1ca17c3e957e43e3f95ab2613a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:38:27 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:38:27 2024 +0200

    x86/x2APIC: correct cluster tracking upon CPUs going down for S3
    
    Downing CPUs for S3 is somewhat special: Since we can expect the system
    to come back up in exactly the same hardware configuration, per-CPU data
    for the secondary CPUs isn't de-allocated (and then cleared upon re-
    allocation when the CPUs are being brought back up). Therefore the
    cluster_cpus per-CPU pointer will retain its value for all CPUs other
    than the final one in a cluster (i.e. in particular for all CPUs in the
    same cluster as CPU0). That, however, is in conflict with the assertion
    early in init_apic_ldr_x2apic_cluster().
    
    Note that the issue is avoided on Intel hardware, where we park CPUs
    instead of bringing them down.
    
    Extend the bypassing of the freeing to the suspend case, thus making
    suspend/resume also a tiny bit faster.
    
    Fixes: 2e6c8f182c9c ("x86: distinguish CPU offlining from CPU removal")
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: ad3ff7b4279d16c91c23cda6e8be5bc670b25c9a
    master date: 2024-08-26 10:30:40 +0200
---
 xen/arch/x86/genapic/x2apic.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/genapic/x2apic.c b/xen/arch/x86/genapic/x2apic.c
index 371dd100c7..d531035fa4 100644
--- a/xen/arch/x86/genapic/x2apic.c
+++ b/xen/arch/x86/genapic/x2apic.c
@@ -228,7 +228,8 @@ static int cf_check update_clusterinfo(
     case CPU_UP_CANCELED:
     case CPU_DEAD:
     case CPU_REMOVE:
-        if ( park_offline_cpus == (action != CPU_REMOVE) )
+        if ( park_offline_cpus == (action != CPU_REMOVE) ||
+             system_state == SYS_STATE_suspend )
             break;
         if ( per_cpu(cluster_cpus, cpu) )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 12:56:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 12:56:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802832.1213125 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st55x-00011i-MY; Tue, 24 Sep 2024 12:56:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802832.1213125; Tue, 24 Sep 2024 12:56:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st55x-00011b-K1; Tue, 24 Sep 2024 12:56:45 +0000
Received: by outflank-mailman (input) for mailman id 802832;
 Tue, 24 Sep 2024 12:56:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st55w-00010K-I6
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:56:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st55w-0007Ib-HE
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:56:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st55w-0001kN-GR
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:56:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vInjokv/WNl0OmEpc4NYBtk5HGKQcdTU6s5QwaRYo0c=; b=VGA40qHEVktbJhxlDdaSgj/+Hm
	NWK/KOiLoBNunQADlhWufZvasT3Olu0VABjjtb1fJupb5fCo1gADriMsIt99gHaJPf57eMlv9DSnJ
	/sSmCaLauERubhPRMI+MaHD7A6/Nsp8NzK8LTwpNi9I4BJWh/kraPb+G40D/zYC+cRB8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/dom0: disable SMAP for PV domain building only
Message-Id: <E1st55w-0001kN-GR@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 12:56:44 +0000

commit 743af916723eb4f1197719fc0aebd4460bafb5bf
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 24 14:39:23 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:39:23 2024 +0200

    x86/dom0: disable SMAP for PV domain building only
    
    Move the logic that disables SMAP so it's only performed when building a PV
    dom0, PVH dom0 builder doesn't require disabling SMAP.
    
    The fixes tag is to account for the wrong usage of cpu_has_smap in
    create_dom0(), it should instead have used
    boot_cpu_has(X86_FEATURE_XEN_SMAP).  Fix while moving the logic to apply to PV
    only.
    
    While there also make cr4_pv32_mask __ro_after_init.
    
    Fixes: 493ab190e5b1 ('xen/sm{e, a}p: allow disabling sm{e, a}p for Xen itself')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: fb1658221a31ec1db33253a80001191391e73b17
    master date: 2024-08-28 19:59:07 +0100
---
 xen/arch/x86/include/asm/setup.h |  2 ++
 xen/arch/x86/pv/dom0_build.c     | 40 +++++++++++++++++++++++++++++++++++-----
 xen/arch/x86/setup.c             | 20 +-------------------
 3 files changed, 38 insertions(+), 24 deletions(-)

diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h
index d75589178b..8f7dfefb4d 100644
--- a/xen/arch/x86/include/asm/setup.h
+++ b/xen/arch/x86/include/asm/setup.h
@@ -64,6 +64,8 @@ extern bool opt_dom0_verbose;
 extern bool opt_dom0_cpuid_faulting;
 extern bool opt_dom0_msr_relaxed;
 
+extern unsigned long cr4_pv32_mask;
+
 #define max_init_domid (0)
 
 #endif
diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index 57e58a02e7..07e9594493 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -354,11 +354,11 @@ static struct page_info * __init alloc_chunk(struct domain *d,
     return page;
 }
 
-int __init dom0_construct_pv(struct domain *d,
-                             const module_t *image,
-                             unsigned long image_headroom,
-                             module_t *initrd,
-                             const char *cmdline)
+static int __init dom0_construct(struct domain *d,
+                                 const module_t *image,
+                                 unsigned long image_headroom,
+                                 module_t *initrd,
+                                 const char *cmdline)
 {
     int i, rc, order, machine;
     bool compatible, compat;
@@ -1051,6 +1051,36 @@ out:
     return rc;
 }
 
+int __init dom0_construct_pv(struct domain *d,
+                             const module_t *image,
+                             unsigned long image_headroom,
+                             module_t *initrd,
+                             const char *cmdline)
+{
+    int rc;
+
+    /*
+     * Clear SMAP in CR4 to allow user-accesses in construct_dom0().  This
+     * prevents us needing to rewrite construct_dom0() in terms of
+     * copy_{to,from}_user().
+     */
+    if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
+    {
+        cr4_pv32_mask &= ~X86_CR4_SMAP;
+        write_cr4(read_cr4() & ~X86_CR4_SMAP);
+    }
+
+    rc = dom0_construct(d, image, image_headroom, initrd, cmdline);
+
+    if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
+    {
+        write_cr4(read_cr4() | X86_CR4_SMAP);
+        cr4_pv32_mask |= X86_CR4_SMAP;
+    }
+
+    return rc;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index eee20bb175..f1076c7203 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -79,8 +79,7 @@ bool __read_mostly use_invpcid;
 int8_t __initdata opt_probe_port_aliases = -1;
 boolean_param("probe-port-aliases", opt_probe_port_aliases);
 
-/* Only used in asm code and within this source file */
-unsigned long asmlinkage __read_mostly cr4_pv32_mask;
+unsigned long __ro_after_init cr4_pv32_mask;
 
 /* **** Linux config option: propagated to domain0. */
 /* "acpi=off":    Sisables both ACPI table parsing and interpreter. */
@@ -955,26 +954,9 @@ static struct domain *__init create_dom0(const module_t *image,
         }
     }
 
-    /*
-     * Temporarily clear SMAP in CR4 to allow user-accesses in construct_dom0().
-     * This saves a large number of corner cases interactions with
-     * copy_from_user().
-     */
-    if ( cpu_has_smap )
-    {
-        cr4_pv32_mask &= ~X86_CR4_SMAP;
-        write_cr4(read_cr4() & ~X86_CR4_SMAP);
-    }
-
     if ( construct_dom0(d, image, headroom, initrd, cmdline) != 0 )
         panic("Could not construct domain 0\n");
 
-    if ( cpu_has_smap )
-    {
-        write_cr4(read_cr4() | X86_CR4_SMAP);
-        cr4_pv32_mask |= X86_CR4_SMAP;
-    }
-
     return d;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 12:56:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 12:56:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802833.1213129 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st567-0001BA-Ny; Tue, 24 Sep 2024 12:56:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802833.1213129; Tue, 24 Sep 2024 12:56:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st567-0001B3-LW; Tue, 24 Sep 2024 12:56:55 +0000
Received: by outflank-mailman (input) for mailman id 802833;
 Tue, 24 Sep 2024 12:56:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st566-00019e-MQ
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:56:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st566-0007Io-Lm
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:56:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st566-0001lF-JM
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:56:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=f4VMNOgSaV1xbBZatV6YVtJFnlAWfLIfKhoNBp1KVDE=; b=V1FZcnuscNFkNwBWLxh9F87+TO
	e2m4nUZDXzP/r6jP/2A3kdptwtngdaKlvQPKFdcHKcH67jLwQteCSfmftJdwyVhY3hzCK9fAY78Bn
	9v9y5WUNNjHqquLeL0x1csYlTVC5xcAcahxxvx5sHdgWATTYZQ0Rsib+d+EPIIsHHs3Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/HVM: correct partial HPET_STATUS write emulation
Message-Id: <E1st566-0001lF-JM@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 12:56:54 +0000

commit 6e96dee93c60af4ee446f5e0fddf3b424824de18
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:40:03 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:40:03 2024 +0200

    x86/HVM: correct partial HPET_STATUS write emulation
    
    For partial writes the non-written parts of registers are folded into
    the full 64-bit value from what they're presently set to. That's wrong
    to do though when the behavior is write-1-to-clear: Writes not
    including to low 3 bits would unconditionally clear all ISR bits which
    are presently set. Re-calculate the value to use.
    
    Fixes: be07023be115 ("x86/vhpet: add support for level triggered interrupts")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 41d358d2f9607ba37c216effa39b9f1bc58de69d
    master date: 2024-08-29 10:02:20 +0200
---
 xen/arch/x86/hvm/hpet.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/hpet.c b/xen/arch/x86/hvm/hpet.c
index 87642575f9..f0e5f877f4 100644
--- a/xen/arch/x86/hvm/hpet.c
+++ b/xen/arch/x86/hvm/hpet.c
@@ -404,7 +404,8 @@ static int cf_check hpet_write(
         break;
 
     case HPET_STATUS:
-        /* write 1 to clear. */
+        /* Write 1 to clear. Therefore don't use new_val directly here. */
+        new_val = val << ((addr & 7) * 8);
         while ( new_val )
         {
             bool active;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 12:57:05 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 12:57:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802834.1213134 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st56H-0001JE-PW; Tue, 24 Sep 2024 12:57:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802834.1213134; Tue, 24 Sep 2024 12:57:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st56H-0001J6-My; Tue, 24 Sep 2024 12:57:05 +0000
Received: by outflank-mailman (input) for mailman id 802834;
 Tue, 24 Sep 2024 12:57:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st56G-0001Iw-PH
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:57:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st56G-0007JA-Oe
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:57:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st56G-0001mP-Nv
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:57:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uUVedJQbhD2HwyM+K0hffh5mGgSLYFE+BwBBnKbXi0o=; b=UlVRZZzy+A0wqhK/lOwv3dEczK
	0UTzgASvhuZA+DyL0deL8U5384B0ATXmqIHfblxn2GWKXmExoRlBqpBzRQ+1JBkelzupR7TXyLeVH
	o440wfdtds8UmPd8CRZB47dBWbGPRJaY7Imgfn74BG5R0JfBNFSTM5hAVMYZiiJV5ro4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] Arm64: adjust __irq_to_desc() to fix build with gcc14
Message-Id: <E1st56G-0001mP-Nv@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 12:57:04 +0000

commit ee826bc490d6036ed9b637ada014a2d59d151f79
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:40:34 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:40:34 2024 +0200

    Arm64: adjust __irq_to_desc() to fix build with gcc14
    
    With the original code I observe
    
    In function ‘__irq_to_desc’,
        inlined from ‘route_irq_to_guest’ at arch/arm/irq.c:465:12:
    arch/arm/irq.c:54:16: error: array subscript -2 is below array bounds of ‘irq_desc_t[32]’ {aka ‘struct irq_desc[32]’} [-Werror=array-bounds=]
       54 |         return &this_cpu(local_irq_desc)[irq];
          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    which looks pretty bogus: How in the world does the compiler arrive at
    -2 when compiling route_irq_to_guest()? Yet independent of that the
    function's parameter wants to be of unsigned type anyway, as shown by
    a vast majority of callers (others use plain int when they really mean
    non-negative quantities). With that adjustment the code compiles fine
    again.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
    master commit: 99f942f3d410059dc223ee0a908827e928ef3592
    master date: 2024-08-29 10:03:53 +0200
---
 xen/arch/arm/include/asm/irq.h | 2 +-
 xen/arch/arm/irq.c             | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/include/asm/irq.h b/xen/arch/arm/include/asm/irq.h
index ec437add09..88e060bf29 100644
--- a/xen/arch/arm/include/asm/irq.h
+++ b/xen/arch/arm/include/asm/irq.h
@@ -56,7 +56,7 @@ extern const unsigned int nr_irqs;
 struct irq_desc;
 struct irqaction;
 
-struct irq_desc *__irq_to_desc(int irq);
+struct irq_desc *__irq_to_desc(unsigned int irq);
 
 #define irq_to_desc(irq)    __irq_to_desc(irq)
 
diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 6b89f64fd1..b9757d7ad3 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -48,7 +48,7 @@ void irq_end_none(struct irq_desc *irq)
 static irq_desc_t irq_desc[NR_IRQS];
 static DEFINE_PER_CPU(irq_desc_t[NR_LOCAL_IRQS], local_irq_desc);
 
-struct irq_desc *__irq_to_desc(int irq)
+struct irq_desc *__irq_to_desc(unsigned int irq)
 {
     if ( irq < NR_LOCAL_IRQS )
         return &this_cpu(local_irq_desc)[irq];
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 12:57:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 12:57:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802835.1213138 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st56R-0001Nl-SZ; Tue, 24 Sep 2024 12:57:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802835.1213138; Tue, 24 Sep 2024 12:57:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st56R-0001Nd-Ph; Tue, 24 Sep 2024 12:57:15 +0000
Received: by outflank-mailman (input) for mailman id 802835;
 Tue, 24 Sep 2024 12:57:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st56Q-0001NV-SY
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:57:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st56Q-0007JR-Ri
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:57:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st56Q-0001nL-R0
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:57:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LH8/0C7MdyEUnqutyYJ2++8pXFXsgEHM1Dtts9tMQtI=; b=dPDxSWR4NUFPKTXfcm8nCfxJX1
	RYk2JavIgpk4iUqanRw1Z1AZ33RsfR/XJGNQNKWAXEV2VycDb+n+HGkVkpOcLAU0C4dnz3V754K06
	TpA26vjR8N1ZDjevcWiqD0RTNanABa+ek+vffrROiZaEoqBHa/TiQaaciuDSIB8FJ48c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] libxl: Fix nul-termination of the return value of libxl_xen_console_read_line()
Message-Id: <E1st56Q-0001nL-R0@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 12:57:14 +0000

commit c18635fd69fc2da238f00a26ab707f1b2a50bf64
Author:     Javi Merino <javi.merino@cloud.com>
AuthorDate: Tue Sep 24 14:41:06 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:41:06 2024 +0200

    libxl: Fix nul-termination of the return value of libxl_xen_console_read_line()
    
    When built with ASAN, "xl dmesg" crashes in the "printf("%s", line)"
    call in main_dmesg().  ASAN reports a heap buffer overflow: an
    off-by-one access to cr->buffer.
    
    The readconsole sysctl copies up to count characters into the buffer,
    but it does not add a null character at the end.  Despite the
    documentation of libxl_xen_console_read_line(), line_r is not
    nul-terminated if 16384 characters were copied to the buffer.
    
    Fix this by asking xc_readconsolering() to fill the buffer up to size
    - 1.  As the number of characters in the buffer is only needed in
    libxl_xen_console_read_line(), make it a local variable there instead
    of part of the libxl__xen_console_reader struct.
    
    Fixes: 4024bae739cc ("xl: Add subcommand 'xl dmesg'")
    Reported-by: Edwin Török <edwin.torok@cloud.com>
    Signed-off-by: Javi Merino <javi.merino@cloud.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: bb03169bcb6ecccf372de1f6b9285cd519a26bb8
    master date: 2024-09-03 10:53:44 +0100
---
 tools/libs/light/libxl_console.c  | 19 +++++++++++++++----
 tools/libs/light/libxl_internal.h |  1 -
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/tools/libs/light/libxl_console.c b/tools/libs/light/libxl_console.c
index a563c9d3c7..9f736b8913 100644
--- a/tools/libs/light/libxl_console.c
+++ b/tools/libs/light/libxl_console.c
@@ -774,12 +774,17 @@ libxl_xen_console_reader *
 {
     GC_INIT(ctx);
     libxl_xen_console_reader *cr;
-    unsigned int size = 16384;
+    /*
+     * We want xen to fill the buffer in as few hypercalls as
+     * possible, but xen will not nul-terminate it.  The default size
+     * of Xen's console buffer is 16384.  Leave one byte at the end
+     * for the null character.
+     */
+    unsigned int size = 16384 + 1;
 
     cr = libxl__zalloc(NOGC, sizeof(libxl_xen_console_reader));
     cr->buffer = libxl__zalloc(NOGC, size);
     cr->size = size;
-    cr->count = size;
     cr->clear = clear;
     cr->incremental = 1;
 
@@ -800,10 +805,16 @@ int libxl_xen_console_read_line(libxl_ctx *ctx,
                                 char **line_r)
 {
     int ret;
+    /*
+     * Number of chars to copy into the buffer.  xc_readconsolering()
+     * does not add a null character at the end, so leave a space for
+     * us to add it.
+     */
+    unsigned int nr_chars = cr->size - 1;
     GC_INIT(ctx);
 
     memset(cr->buffer, 0, cr->size);
-    ret = xc_readconsolering(ctx->xch, cr->buffer, &cr->count,
+    ret = xc_readconsolering(ctx->xch, cr->buffer, &nr_chars,
                              cr->clear, cr->incremental, &cr->index);
     if (ret < 0) {
         LOGE(ERROR, "reading console ring buffer");
@@ -811,7 +822,7 @@ int libxl_xen_console_read_line(libxl_ctx *ctx,
         return ERROR_FAIL;
     }
     if (!ret) {
-        if (cr->count) {
+        if (nr_chars) {
             *line_r = cr->buffer;
             ret = 1;
         } else {
diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h
index 3b58bb2d7f..96d14f5746 100644
--- a/tools/libs/light/libxl_internal.h
+++ b/tools/libs/light/libxl_internal.h
@@ -2077,7 +2077,6 @@ _hidden char *libxl__uuid2string(libxl__gc *gc, const libxl_uuid uuid);
 struct libxl__xen_console_reader {
     char *buffer;
     unsigned int size;
-    unsigned int count;
     unsigned int clear;
     unsigned int incremental;
     unsigned int index;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 12:57:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 12:57:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802836.1213142 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st56b-0001Qe-Tm; Tue, 24 Sep 2024 12:57:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802836.1213142; Tue, 24 Sep 2024 12:57:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st56b-0001QW-RB; Tue, 24 Sep 2024 12:57:25 +0000
Received: by outflank-mailman (input) for mailman id 802836;
 Tue, 24 Sep 2024 12:57:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st56a-0001QJ-VN
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:57:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st56a-0007L7-Uk
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:57:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st56a-0001oU-Tx
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:57:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/FyAPkGRBXsoBxXcE9JuizpspXInMmAql6AWVaGMlto=; b=eCYNtJoHwcdJ4odCnu64mcags8
	OgkjOq1CnCAeBi1vvuEDYUmADhlkp0lqGvH4C76YAT/tVfgJtZbGbXPKVGDkeHSfVRNg+n+h/2chl
	0OAqXKjdUeAB5pFrw60keFanyblK2G16dV6OmNSqNbJ09QTjVbI5YYbCuP1qNGZK1uX4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] SUPPORT.md: split XSM from Flask
Message-Id: <E1st56a-0001oU-Tx@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 12:57:24 +0000

commit 3ceb79ceabab58305a0f35aed0117537f7a6b922
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:41:51 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:41:51 2024 +0200

    SUPPORT.md: split XSM from Flask
    
    XSM is a generic framework, which in particular is also used by SILO.
    With this it can't really be experimental: Arm mandates SILO for having
    a security supported configuration.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    master commit: d7c18b8720824d7efc39ffa7296751e1812865a9
    master date: 2024-09-04 16:05:03 +0200
---
 SUPPORT.md | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 1d8b38cbd0..ba6052477b 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -768,13 +768,21 @@ Compile time disabled for ARM by default.
 
     Status, x86: Supported, not security supported
 
-### XSM & FLASK
+### XSM (Xen Security Module) Framework
+
+XSM is a security policy framework.  The dummy implementation is covered by this
+statement, and implements a policy whereby dom0 is all powerful.  See below for
+alternative modules (FLASK, SILO).
+
+    Status: Supported
+
+### FLASK XSM Module
 
     Status: Experimental
 
 Compile time disabled by default.
 
-Also note that using XSM
+Also note that using FLASK
 to delegate various domain control hypercalls
 to particular other domains, rather than only permitting use by dom0,
 is also specifically excluded from security support for many hypercalls.
@@ -787,6 +795,13 @@ Please see XSA-77 for more details.
 The default policy includes FLASK labels and roles for a "typical" Xen-based system
 with dom0, driver domains, stub domains, domUs, and so on.
 
+### SILO XSM Module
+
+SILO extends the dummy policy by enforcing that DomU-s can only communicate
+with Dom0, yet not with each other.
+
+    Status: Supported
+
 ## Virtual Hardware, Hypervisor
 
 ### x86/Nested PV
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 12:57:37 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 12:57:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802837.1213145 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st56m-0001Ug-VA; Tue, 24 Sep 2024 12:57:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802837.1213145; Tue, 24 Sep 2024 12:57:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st56m-0001UY-Sc; Tue, 24 Sep 2024 12:57:36 +0000
Received: by outflank-mailman (input) for mailman id 802837;
 Tue, 24 Sep 2024 12:57:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st56l-0001UQ-25
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:57:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st56l-0007Lc-1K
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:57:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st56l-0001pU-0d
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:57:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9a4lU0g4BING8HaWQH+gjE3zS30DAmMmK/04vHUS99w=; b=R1Wu+OFTohEVqvai3C+zBbnC8X
	K4r2aW+MZXbyGbrYGnfL8rJ6Fl5WVN0LkoetloH6BjggANcGTS/5rAMOwFHS4cuTTFCYI7p+7Xtag
	TMibUHByIigGxIKambDAoc3/HCFfTQnsF1CYaoIDLJ0kqtDyklGVbtbH1MJ6YcxErQCw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86: fix UP build with gcc14
Message-Id: <E1st56l-0001pU-0d@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 12:57:35 +0000

commit d625c4e9fb46ef1b81a5b32d8fe1774c432cddd6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:41:59 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:41:59 2024 +0200

    x86: fix UP build with gcc14
    
    The complaint is:
    
    In file included from ././include/xen/config.h:17,
                     from <command-line>:
    arch/x86/smpboot.c: In function ‘link_thread_siblings.constprop’:
    ./include/asm-generic/percpu.h:16:51: error: array subscript [0, 0] is outside array bounds of ‘long unsigned int[1]’ [-Werror=array-bounds=]
       16 |     (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
    ./include/xen/compiler.h:140:29: note: in definition of macro ‘RELOC_HIDE’
      140 |     (typeof(ptr)) (__ptr + (off)); })
          |                             ^~~
    arch/x86/smpboot.c:238:27: note: in expansion of macro ‘per_cpu’
      238 |     cpumask_set_cpu(cpu2, per_cpu(cpu_sibling_mask, cpu1));
          |                           ^~~~~~~
    In file included from ./arch/x86/include/generated/asm/percpu.h:1,
                     from ./include/xen/percpu.h:30,
                     from ./arch/x86/include/asm/cpuid.h:9,
                     from ./arch/x86/include/asm/cpufeature.h:11,
                     from ./arch/x86/include/asm/system.h:6,
                     from ./include/xen/list.h:11,
                     from ./include/xen/mm.h:68,
                     from arch/x86/smpboot.c:12:
    ./include/asm-generic/percpu.h:12:22: note: while referencing ‘__per_cpu_offset’
       12 | extern unsigned long __per_cpu_offset[NR_CPUS];
          |                      ^~~~~~~~~~~~~~~~
    
    Which I consider bogus in the first place ("array subscript [0, 0]" vs a
    1-element array). Yet taking the experience from 99f942f3d410 ("Arm64:
    adjust __irq_to_desc() to fix build with gcc14") I guessed that
    switching function parameters to unsigned int (which they should have
    been anyway) might help. And voilà ...
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: a2de7dc4d845738e734b10fce6550c89c6b1092c
    master date: 2024-09-04 16:09:28 +0200
---
 xen/arch/x86/smpboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 8aa621533f..0a89f22a39 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -226,7 +226,7 @@ static int booting_cpu;
 /* CPUs for which sibling maps can be computed. */
 static cpumask_t cpu_sibling_setup_map;
 
-static void link_thread_siblings(int cpu1, int cpu2)
+static void link_thread_siblings(unsigned int cpu1, unsigned int cpu2)
 {
     cpumask_set_cpu(cpu1, per_cpu(cpu_sibling_mask, cpu2));
     cpumask_set_cpu(cpu2, per_cpu(cpu_sibling_mask, cpu1));
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 12:57:47 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 12:57:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802838.1213149 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st56x-0001XP-0O; Tue, 24 Sep 2024 12:57:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802838.1213149; Tue, 24 Sep 2024 12:57:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st56w-0001XL-U2; Tue, 24 Sep 2024 12:57:46 +0000
Received: by outflank-mailman (input) for mailman id 802838;
 Tue, 24 Sep 2024 12:57:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st56v-0001X4-52
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:57:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st56v-0007Ln-4H
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:57:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st56v-0001qU-3X
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:57:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PFfBYhC0A4XCg7P4B8KpNw8cdO0e3hj8Mq1wegMBjZg=; b=C8OcY8DN5BpdT9IMe0+7MtTaCv
	xgQAzfzi6E4mzKekxv130lIcWcoYd0HAfLqlIvdr83gM0zQ7MwW3foer+bjcybIYBxOOuOhGPZTnq
	W2NQP2DtzZtHBhNxhqTp8vCGWPXZZfmqeUsjHrmLe4LW30kH/r9trHnD3GvgJttvyZnA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86emul/test: fix build with gas 2.43
Message-Id: <E1st56v-0001qU-3X@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 12:57:45 +0000

commit 78d412f8bc3d78458cd868ba375ad30175194d91
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:42:39 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:42:39 2024 +0200

    x86emul/test: fix build with gas 2.43
    
    Drop explicit {evex} pseudo-prefixes. New gas (validly) complains when
    they're used on things other than instructions. Our use was potentially
    ahead of macro invocations - see simd.h's "override" macro.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 3c09288298af881ea1bb568740deb2d2a06bcd41
    master date: 2024-09-06 08:41:18 +0200
---
 tools/tests/x86_emulator/simd.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/tests/x86_emulator/simd.c b/tools/tests/x86_emulator/simd.c
index 263cea662d..d68a7364c2 100644
--- a/tools/tests/x86_emulator/simd.c
+++ b/tools/tests/x86_emulator/simd.c
@@ -333,7 +333,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # if FLOAT_SIZE == 4
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vbroadcastss %1, %0" \
+    asm ( "vbroadcastss %1, %0" \
           : "=v" (t_) : "m" (*(float[1]){ x }) ); \
     t_; \
 })
@@ -401,14 +401,14 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 #  if VEC_SIZE >= 32
 #   define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vbroadcastsd %1, %0" : "=v" (t_) \
+    asm ( "vbroadcastsd %1, %0" : "=v" (t_) \
           : "m" (*(double[1]){ x }) ); \
     t_; \
 })
 #  else
 #   define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastq %1, %0" \
+    asm ( "vpbroadcastq %1, %0" \
           : "=v" (t_) : "m" (*(double[1]){ x }) ); \
     t_; \
 })
@@ -601,7 +601,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # if INT_SIZE == 4 || UINT_SIZE == 4
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastd %1, %0" \
+    asm ( "vpbroadcastd %1, %0" \
           : "=v" (t_) : "m" (*(int[1]){ x }) ); \
     t_; \
 })
@@ -649,7 +649,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # elif INT_SIZE == 8 || UINT_SIZE == 8
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastq %1, %0" \
+    asm ( "vpbroadcastq %1, %0" \
           : "=v" (t_) : "m" (*(long long[1]){ x }) ); \
     t_; \
 })
@@ -716,7 +716,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # if INT_SIZE == 1 || UINT_SIZE == 1
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastb %1, %0" \
+    asm ( "vpbroadcastb %1, %0" \
           : "=v" (t_) : "m" (*(char[1]){ x }) ); \
     t_; \
 })
@@ -745,7 +745,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # elif INT_SIZE == 2 || UINT_SIZE == 2
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastw %1, %0" \
+    asm ( "vpbroadcastw %1, %0" \
           : "=v" (t_) : "m" (*(short[1]){ x }) ); \
     t_; \
 })
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 12:57:57 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 12:57:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802839.1213154 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st577-0001Zr-26; Tue, 24 Sep 2024 12:57:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802839.1213154; Tue, 24 Sep 2024 12:57:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st576-0001Zj-Vj; Tue, 24 Sep 2024 12:57:56 +0000
Received: by outflank-mailman (input) for mailman id 802839;
 Tue, 24 Sep 2024 12:57:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st575-0001Za-7q
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:57:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st575-0007M0-73
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:57:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st575-0001rM-6P
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:57:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eTL23EWIKh9z7T2t8xZhMPKVolbFET85I+HnuzrSegU=; b=i6PHyvr3dedzq5S12iWYSt37J0
	uVoGIVhNk0A7fW3bckQNpFtglf0HfmHE7Y3rS0kwdXm0s18QiGsCqdLpGJS5W5xwoJN1nq95nNAAL
	uBtLc8Kfc8LTlo3mmt0xHtz2ArobvAXgt/UzaYMvsJ6zA83V3sd2DNujPZ+oMF4KKugg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/HVM: properly reject "indirect" VRAM writes
Message-Id: <E1st575-0001rM-6P@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 12:57:55 +0000

commit ec3999e205ccadbeb8ab1f8420dea02fee2b5a5d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:43:02 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:43:02 2024 +0200

    x86/HVM: properly reject "indirect" VRAM writes
    
    While ->count will only be different from 1 for "indirect" (data in
    guest memory) accesses, it being 1 does not exclude the request being an
    "indirect" one. Check both to be on the safe side, and bring the ->count
    part also in line with what ioreq_send_buffered() actually refuses to
    handle.
    
    Fixes: 3bbaaec09b1b ("x86/hvm: unify stdvga mmio intercept with standard mmio intercept")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: eb7cd0593d88c4b967a24bca8bd30591966676cd
    master date: 2024-09-12 09:13:04 +0200
---
 xen/arch/x86/hvm/stdvga.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index b16c59f772..5f02d88615 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -530,14 +530,14 @@ static bool cf_check stdvga_mem_accept(
 
     spin_lock(&s->lock);
 
-    if ( p->dir == IOREQ_WRITE && p->count > 1 )
+    if ( p->dir == IOREQ_WRITE && (p->data_is_ptr || p->count != 1) )
     {
         /*
          * We cannot return X86EMUL_UNHANDLEABLE on anything other then the
          * first cycle of an I/O. So, since we cannot guarantee to always be
          * able to send buffered writes, we have to reject any multi-cycle
-         * I/O and, since we are rejecting an I/O, we must invalidate the
-         * cache.
+         * or "indirect" I/O and, since we are rejecting an I/O, we must
+         * invalidate the cache.
          * Single-cycle write transactions are accepted even if the cache is
          * not active since we can assert, when in stdvga mode, that writes
          * to VRAM have no side effect and thus we can try to buffer them.
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 12:58:07 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 12:58:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802840.1213157 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st57H-0001c6-3T; Tue, 24 Sep 2024 12:58:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802840.1213157; Tue, 24 Sep 2024 12:58:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st57H-0001by-0r; Tue, 24 Sep 2024 12:58:07 +0000
Received: by outflank-mailman (input) for mailman id 802840;
 Tue, 24 Sep 2024 12:58:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st57F-0001bq-Ag
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:58:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st57F-0007MP-9r
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:58:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st57F-0001tP-99
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:58:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Y2HrWy0bbY9nLiynVzq+/gYjT1tpxd4UD/jBYUcUQtc=; b=LChGjLf+G2CaKYRxCnJp8s6r/l
	+lYJ6c5HY8QCaNq5VXuXWe1BAas2PrgJ5i0zvM6F8CFNaYcVMts0D6KQAoIPVRaRo2OHYn6EZyb+D
	FzwjeW8X/PL6cBACpbk87Xowx1i8xKUNgbMAp65HWrYlmOiiwGlnRtlbRfwCpDmvNiQA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] xen/x86/pvh: handle ACPI RSDT table in PVH Dom0 build
Message-Id: <E1st57F-0001tP-99@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 12:58:05 +0000

commit d0ea9b319d4ca04e29ef533db0c3655a78dec315
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Tue Sep 24 14:43:24 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:43:24 2024 +0200

    xen/x86/pvh: handle ACPI RSDT table in PVH Dom0 build
    
    Xen always generates an XSDT table even if the firmware only provided an
    RSDT table.  Copy the RSDT header from the firmware table, adjusting the
    signature, for the XSDT table when not provided by the firmware.
    
    This is necessary to run Xen on QEMU.
    
    Fixes: 1d74282c455f ('x86: setup PVHv2 Dom0 ACPI tables')
    Suggested-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 6e7f7a0c16c4d406bda6d4a900252ff63a7c5fad
    master date: 2024-09-12 09:18:25 +0200
---
 xen/arch/x86/hvm/dom0_build.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index f3eddb6846..3dd913bdb0 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -1078,7 +1078,16 @@ static int __init pvh_setup_acpi_xsdt(struct domain *d, paddr_t madt_addr,
         rc = -EINVAL;
         goto out;
     }
-    xsdt_paddr = rsdp->xsdt_physical_address;
+    /*
+     * Note the header is the same for both RSDT and XSDT, so it's fine to
+     * copy the native RSDT header to the Xen crafted XSDT if no native
+     * XSDT is available.
+     */
+    if ( rsdp->revision > 1 && rsdp->xsdt_physical_address )
+        xsdt_paddr = rsdp->xsdt_physical_address;
+    else
+        xsdt_paddr = rsdp->rsdt_physical_address;
+
     acpi_os_unmap_memory(rsdp, sizeof(*rsdp));
     table = acpi_os_map_memory(xsdt_paddr, sizeof(*table));
     if ( !table )
@@ -1090,6 +1099,12 @@ static int __init pvh_setup_acpi_xsdt(struct domain *d, paddr_t madt_addr,
     xsdt->header = *table;
     acpi_os_unmap_memory(table, sizeof(*table));
 
+    /*
+     * In case the header is an RSDT copy, unconditionally ensure it has
+     * an XSDT sig.
+     */
+    xsdt->header.signature[0] = 'X';
+
     /* Add the custom MADT. */
     xsdt->table_offset_entry[0] = madt_addr;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 12:58:17 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 12:58:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802841.1213162 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st57R-0001ep-4z; Tue, 24 Sep 2024 12:58:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802841.1213162; Tue, 24 Sep 2024 12:58:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st57R-0001ei-2G; Tue, 24 Sep 2024 12:58:17 +0000
Received: by outflank-mailman (input) for mailman id 802841;
 Tue, 24 Sep 2024 12:58:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st57P-0001eC-DA
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:58:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st57P-0007Md-CU
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:58:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st57P-0001uX-Bu
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:58:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/cQIIyT9idgmGpQfm39Aynw8QEf8D++gH+Zy8PsCrfo=; b=yN4aqiptoGhmrUW7uWu/IsVK+7
	up9XKUKu3msR2EQasqGFXO8vGTZpE9uN7TMAwL4FcMl5fHH5YYd7D+PLC9Vi7DheOQTG4CmXRIgwz
	Qwh1+3ayuhh71/cwaMWLe8/7iIlbEV0wLnSS1Vhz5tz+0FmN7PNJVynkrNAc0Rddcaus=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] blkif: reconcile protocol specification with in-use implementations
Message-Id: <E1st57P-0001uX-Bu@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 12:58:15 +0000

commit 933416b13966a3fa2a37b1f645c23afbd8fb6d09
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 24 14:43:50 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:43:50 2024 +0200

    blkif: reconcile protocol specification with in-use implementations
    
    Current blkif implementations (both backends and frontends) have all slight
    differences about how they handle the 'sector-size' xenstore node, and how
    other fields are derived from this value or hardcoded to be expressed in units
    of 512 bytes.
    
    To give some context, this is an excerpt of how different implementations use
    the value in 'sector-size' as the base unit for to other fields rather than
    just to set the logical sector size of the block device:
    
                            │ sectors xenbus node │ requests sector_number │ requests {first,last}_sect
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    FreeBSD blk{front,back} │     sector-size     │      sector-size       │           512
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    Linux blk{front,back}   │         512         │          512           │           512
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    QEMU blkback            │     sector-size     │      sector-size       │       sector-size
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    Windows blkfront        │     sector-size     │      sector-size       │       sector-size
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    MiniOS                  │     sector-size     │          512           │           512
    
    An attempt was made by 67e1c050e36b in order to change the base units of the
    request fields and the xenstore 'sectors' node.  That however only lead to more
    confusion, as the specification now clearly diverged from the reference
    implementation in Linux.  Such change was only implemented for QEMU Qdisk
    and Windows PV blkfront.
    
    Partially revert to the state before 67e1c050e36b while adjusting the
    documentation for 'sectors' to match what it used to be previous to
    2fa701e5346d:
    
     * Declare 'feature-large-sector-size' deprecated.  Frontends should not expose
       the node, backends should not make decisions based on its presence.
    
     * Clarify that 'sectors' xenstore node and the requests fields are always in
       512-byte units, like it was previous to 2fa701e5346d and 67e1c050e36b.
    
    All base units for the fields used in the protocol are 512-byte based, the
    xenbus 'sector-size' field is only used to signal the logic block size.  When
    'sector-size' is greater than 512, blkfront implementations must make sure that
    the offsets and sizes (despite being expressed in 512-byte units) are aligned
    to the logical block size specified in 'sector-size', otherwise the backend
    will fail to process the requests.
    
    This will require changes to some of the frontends and backends in order to
    properly support 'sector-size' nodes greater than 512.
    
    Fixes: 2fa701e5346d ('blkif.h: Provide more complete documentation of the blkif interface')
    Fixes: 67e1c050e36b ('public/io/blkif.h: try to fix the semantics of sector based quantities')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: 221f2748e8dabe8361b8cdfcffbeab9102c4c899
    master date: 2024-09-12 14:04:56 +0200
---
 xen/include/public/io/blkif.h | 52 ++++++++++++++++++++++++++++++++-----------
 1 file changed, 39 insertions(+), 13 deletions(-)

diff --git a/xen/include/public/io/blkif.h b/xen/include/public/io/blkif.h
index 22f1eef0c0..9b00d633d3 100644
--- a/xen/include/public/io/blkif.h
+++ b/xen/include/public/io/blkif.h
@@ -237,12 +237,16 @@
  * sector-size
  *      Values:         <uint32_t>
  *
- *      The logical block size, in bytes, of the underlying storage. This
- *      must be a power of two with a minimum value of 512.
+ *      The logical block size, in bytes, of the underlying storage. This must
+ *      be a power of two with a minimum value of 512.  The sector size should
+ *      only be used for request segment length and alignment.
  *
- *      NOTE: Because of implementation bugs in some frontends this must be
- *            set to 512, unless the frontend advertizes a non-zero value
- *            in its "feature-large-sector-size" xenbus node. (See below).
+ *      When exposing a device that uses a logical sector size of 4096, the
+ *      only difference xenstore wise will be that 'sector-size' (and possibly
+ *      'physical-sector-size' if supported by the backend) will be 4096, but
+ *      the 'sectors' node will still be calculated using 512 byte units.  The
+ *      sector base units in the ring requests fields will all be 512 byte
+ *      based despite the logical sector size exposed in 'sector-size'.
  *
  * physical-sector-size
  *      Values:         <uint32_t>
@@ -254,9 +258,9 @@
  * sectors
  *      Values:         <uint64_t>
  *
- *      The size of the backend device, expressed in units of "sector-size".
- *      The product of "sector-size" and "sectors" must also be an integer
- *      multiple of "physical-sector-size", if that node is present.
+ *      The size of the backend device, expressed in units of 512b.  The
+ *      product of "sectors" * 512 must also be an integer multiple of
+ *      "physical-sector-size", if that node is present.
  *
  *****************************************************************************
  *                            Frontend XenBus Nodes
@@ -338,6 +342,7 @@
  * feature-large-sector-size
  *      Values:         0/1 (boolean)
  *      Default Value:  0
+ *      Notes:          DEPRECATED, 12
  *
  *      A value of "1" indicates that the frontend will correctly supply and
  *      interpret all sector-based quantities in terms of the "sector-size"
@@ -411,6 +416,11 @@
  *(10) The discard-secure property may be present and will be set to 1 if the
  *     backing device supports secure discard.
  *(11) Only used by Linux and NetBSD.
+ *(12) Possibly only ever implemented by the QEMU Qdisk backend and the Windows
+ *     PV block frontend.  Other backends and frontends supported 'sector-size'
+ *     values greater than 512 before such feature was added.  Frontends should
+ *     not expose this node, neither should backends make any decisions based
+ *     on it being exposed by the frontend.
  */
 
 /*
@@ -619,11 +629,14 @@
 #define BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST 8
 
 /*
- * NB. 'first_sect' and 'last_sect' in blkif_request_segment, as well as
- * 'sector_number' in blkif_request, blkif_request_discard and
- * blkif_request_indirect are sector-based quantities. See the description
- * of the "feature-large-sector-size" frontend xenbus node above for
- * more information.
+ * NB. 'first_sect' and 'last_sect' in blkif_request_segment are all in units
+ * of 512 bytes, despite the 'sector-size' xenstore node possibly having a
+ * value greater than 512.
+ *
+ * The value in 'first_sect' and 'last_sect' fields must be setup so that the
+ * resulting segment offset and size is aligned to the logical sector size
+ * reported by the 'sector-size' xenstore node, see 'Backend Device Properties'
+ * section.
  */
 struct blkif_request_segment {
     grant_ref_t gref;        /* reference to I/O buffer frame        */
@@ -634,6 +647,10 @@ struct blkif_request_segment {
 
 /*
  * Starting ring element for any I/O request.
+ *
+ * The 'sector_number' field is in units of 512b, despite the value of the
+ * 'sector-size' xenstore node.  Note however that the offset in
+ * 'sector_number' must be aligned to 'sector-size'.
  */
 struct blkif_request {
     uint8_t        operation;    /* BLKIF_OP_???                         */
@@ -648,6 +665,10 @@ typedef struct blkif_request blkif_request_t;
 /*
  * Cast to this structure when blkif_request.operation == BLKIF_OP_DISCARD
  * sizeof(struct blkif_request_discard) <= sizeof(struct blkif_request)
+ *
+ * The 'sector_number' field is in units of 512b, despite the value of the
+ * 'sector-size' xenstore node.  Note however that the offset in
+ * 'sector_number' must be aligned to 'sector-size'.
  */
 struct blkif_request_discard {
     uint8_t        operation;    /* BLKIF_OP_DISCARD                     */
@@ -660,6 +681,11 @@ struct blkif_request_discard {
 };
 typedef struct blkif_request_discard blkif_request_discard_t;
 
+/*
+ * The 'sector_number' field is in units of 512b, despite the value of the
+ * 'sector-size' xenstore node.  Note however that the offset in
+ * 'sector_number' must be aligned to 'sector-size'.
+ */
 struct blkif_request_indirect {
     uint8_t        operation;    /* BLKIF_OP_INDIRECT                    */
     uint8_t        indirect_op;  /* BLKIF_OP_{READ/WRITE}                */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 12:58:27 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 12:58:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802842.1213166 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st57b-0001hs-7p; Tue, 24 Sep 2024 12:58:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802842.1213166; Tue, 24 Sep 2024 12:58:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st57b-0001hk-4w; Tue, 24 Sep 2024 12:58:27 +0000
Received: by outflank-mailman (input) for mailman id 802842;
 Tue, 24 Sep 2024 12:58:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st57Z-0001hT-Fv
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:58:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st57Z-0007Mp-FG
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:58:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st57Z-0001vL-Eb
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 12:58:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=I0dbLObMau3eh2JyDnzk5jYQ1BUDuX2wO6B6KCHwOSY=; b=4nF/hyz6LU10lhOKDvCMDzumFM
	FMBpnYCcWMTpRiZ5A5djRKcf6+bCAoTTkmkGOF97Wm33M0O+ERQgrONnmMRMbdQpjKJ0l0YdBE5h3
	EfMUveR2zhZqNyLWXweUtEHE2h8I5MzKI+urxaT7FZRki2KaLksqOQgrcTZoMlAM7jHg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] xen/ucode: Fix buffer under-run when parsing AMD containers
Message-Id: <E1st57Z-0001vL-Eb@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 12:58:25 +0000

commit 2c61ab407172682e1382204a8305107f19e2951b
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Tue Sep 24 14:44:10 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:44:10 2024 +0200

    xen/ucode: Fix buffer under-run when parsing AMD containers
    
    The AMD container format has no formal spec.  It is, at best, precision
    guesswork based on AMD's prior contributions to open source projects.  The
    Equivalence Table has both an explicit length, and an expectation of having a
    NULL entry at the end.
    
    Xen was sanity checking the NULL entry, but without confirming that an entry
    was present, resulting in a read off the front of the buffer.  With some
    manual debugging/annotations this manifests as:
    
      (XEN) *** Buf ffff83204c00b19c, eq ffff83204c00b194
      (XEN) *** eq: 0c 00 00 00 44 4d 41 00 00 00 00 00 00 00 00 00 aa aa aa aa
                                ^-Actual buffer-------------------^
      (XEN) *** installed_cpu: 000c
      (XEN) microcode: Bad equivalent cpu table
      (XEN) Parsing microcode blob error -22
    
    When loaded by hypercall, the 4 bytes interpreted as installed_cpu happen to
    be the containing struct ucode_buf's len field, and luckily will be nonzero.
    
    When loaded at boot, it's possible for the access to #PF if the module happens
    to have been placed on a 2M boundary by the bootloader.  Under Linux, it will
    commonly be the end of the CPIO header.
    
    Drop the probe of the NULL entry; Nothing else cares.  A container without one
    is well formed, insofar that we can still parse it correctly.  With this
    dropped, the same container results in:
    
      (XEN) microcode: couldn't find any matching ucode in the provided blob!
    
    Fixes: 4de936a38aa9 ("x86/ucode/amd: Rework parsing logic in cpu_request_microcode()")
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a8bf14f6f331d4f428010b4277b67c33f561ed19
    master date: 2024-09-13 15:23:30 +0100
---
 xen/arch/x86/cpu/microcode/amd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index f76a563c8b..9fe6e29751 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -336,8 +336,7 @@ static struct microcode_patch *cf_check cpu_request_microcode(
         if ( size < sizeof(*et) ||
              (et = buf)->type != UCODE_EQUIV_CPU_TABLE_TYPE ||
              size - sizeof(*et) < et->len ||
-             et->len % sizeof(et->eq[0]) ||
-             et->eq[(et->len / sizeof(et->eq[0])) - 1].installed_cpu )
+             et->len % sizeof(et->eq[0]) )
         {
             printk(XENLOG_ERR "microcode: Bad equivalent cpu table\n");
             error = -EINVAL;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 13:11:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 13:11:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802845.1213171 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5Jp-0004P5-4B; Tue, 24 Sep 2024 13:11:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802845.1213171; Tue, 24 Sep 2024 13:11:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5Jp-0004Ox-1G; Tue, 24 Sep 2024 13:11:05 +0000
Received: by outflank-mailman (input) for mailman id 802845;
 Tue, 24 Sep 2024 13:11:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5Jn-0004Or-H9
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:11:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5Jn-0007eE-EP
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:11:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5Jn-0003iG-DV
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:11:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=je9+ZB+c73aNz15w0wKeUOdpPxi2D2J11vaFRyP7Lis=; b=zhGqGoqiHiR2ey0wt3LPur2CzR
	HqHAOmcG1AiN117uNOFTJnt38jWiDtqLkj+e3h1y/xHtschLKEXpmEF1xetagrvPkGgOx+NiBY3lS
	zFedbZ7ltp9kIC87TPkrnXYIm9qUYylPXaJcCjVJo+VsGt4UaLQzqzGsqiiB4CpyG+gc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/vLAPIC: prevent undue recursion of vlapic_error()
Message-Id: <E1st5Jn-0003iG-DV@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 13:11:03 +0000

commit 641b8f2a924b86ab086878b5baaf2d50ba3658f1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:49:18 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:49:18 2024 +0200

    x86/vLAPIC: prevent undue recursion of vlapic_error()
    
    With the error vector set to an illegal value, the function invoking
    vlapic_set_irq() would bring execution back here, with the non-recursive
    lock already held. Avoid the call in this case, merely further updating
    ESR (if necessary).
    
    This is XSA-462 / CVE-2024-45817.
    
    Fixes: 5f32d186a8b1 ("x86/vlapic: don't silently accept bad vectors")
    Reported-by: Federico Serafini <federico.serafini@bugseng.com>
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: c42d9ec61f6d11e25fa77bd44dd11dad1edda268
    master date: 2024-09-24 14:23:29 +0200
---
 xen/arch/x86/hvm/vlapic.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index ba569043ea..70431ba438 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -113,9 +113,24 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
     if ( (esr & errmask) != errmask )
     {
         uint32_t lvterr = vlapic_get_reg(vlapic, APIC_LVTERR);
+        bool inj = false;
 
-        vlapic_set_reg(vlapic, APIC_ESR, esr | errmask);
         if ( !(lvterr & APIC_LVT_MASKED) )
+        {
+            /*
+             * If LVTERR is unmasked and has an illegal vector, vlapic_set_irq()
+             * will end up back here.  Break the cycle by only injecting LVTERR
+             * if it will succeed, and folding in RECVILL otherwise.
+             */
+            if ( (lvterr & APIC_VECTOR_MASK) >= 16 )
+                 inj = true;
+            else
+                 errmask |= APIC_ESR_RECVILL;
+        }
+
+        vlapic_set_reg(vlapic, APIC_ESR, esr | errmask);
+
+        if ( inj )
             vlapic_set_irq(vlapic, lvterr & APIC_VECTOR_MASK, 0);
     }
     spin_unlock_irqrestore(&vlapic->esr_lock, flags);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 13:11:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 13:11:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802846.1213173 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5Jz-0004Qs-5M; Tue, 24 Sep 2024 13:11:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802846.1213173; Tue, 24 Sep 2024 13:11:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5Jz-0004Qk-2i; Tue, 24 Sep 2024 13:11:15 +0000
Received: by outflank-mailman (input) for mailman id 802846;
 Tue, 24 Sep 2024 13:11:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5Jx-0004QV-IF
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:11:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5Jx-0007eL-HQ
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:11:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5Jx-0003jF-GV
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:11:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CQRjsfuyxjWW6m2d0SjM1eT0f4eeKitPPbgnYpcLYig=; b=PZ0PCvfnqwiLR0qjagq3LnR13h
	+vrjth7fyRNnenBDN4epYRvNUxlhnH+/kxHSkAqJe7/kNY8nrI2XnGsejppOPhhBnrp8tP+B6V2lo
	hjybR7+K+7Ahkhc/ul0eEqtGKo9X3G51sPEoIDYrBMcvuGcQcSSmSxNW+ujXs8XhfnTc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] update Xen version to 4.18.4-pre
Message-Id: <E1st5Jx-0003jF-GV@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 13:11:13 +0000

commit 5210dc1c303dcd36ee59ad43325f615cc1e78231
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:50:34 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:50:34 2024 +0200

    update Xen version to 4.18.4-pre
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index 56000ae82c..68b14fb356 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -6,7 +6,7 @@ this-makefile := $(call lastword,$(MAKEFILE_LIST))
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 18
-export XEN_EXTRAVERSION ?= .3$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .4-pre$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 13:11:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 13:11:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802847.1213178 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5K9-0004TX-6j; Tue, 24 Sep 2024 13:11:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802847.1213178; Tue, 24 Sep 2024 13:11:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5K9-0004TQ-46; Tue, 24 Sep 2024 13:11:25 +0000
Received: by outflank-mailman (input) for mailman id 802847;
 Tue, 24 Sep 2024 13:11:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5K7-0004TC-LK
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:11:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5K7-0007eW-KR
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:11:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5K7-0003kL-JY
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:11:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XEXkmuiAi+uyYdy4jb+ZNEIoBp9Oc7BuHM08S92ns/Y=; b=IqRwbEOG2BdpdQlNTbKOLFL+UN
	qaJKjoqp/jHST3RycuFI6xmptWYdoSScpEJvUJBcO9VX/hZlEkUFRbiglqiUkCjfeniayRJxmlD6D
	OCksKUcmy2wZ8MS39aBBt2uC/3IjaIhfestkn6u6F2UV1JJNEYdHOxxqCqjCsNukOIyY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/hvm: Fix Misra Rule 19.1 regression
Message-Id: <E1st5K7-0003kL-JY@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 13:11:23 +0000

commit 6c2827e1330ecf37756391f2e080494e9b0076d4
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 24 14:51:24 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:51:24 2024 +0200

    x86/hvm: Fix Misra Rule 19.1 regression
    
    Despite noticing an impending Rule 19.1 violation, the adjustment made (the
    uint32_t cast) wasn't sufficient to avoid it.  Try again.
    
    Subsequently noticed by Coverity too.
    
    Fixes: 6a98383b0877 ("x86/HVM: clear upper halves of GPRs upon entry from 32-bit code")
    Coverity-IDs: 1596289 thru 1596298
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    master commit: d0a718a45f14b86471d8eb3083acd72760963470
    master date: 2024-04-11 13:23:08 +0100
---
 xen/arch/x86/include/asm/hvm/hvm.h | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index e5fa682f85..fd390cefe1 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -585,16 +585,16 @@ static inline void hvm_sanitize_regs_fields(struct cpu_user_regs *regs,
     if ( compat )
     {
         /* Clear GPR upper halves, to counteract guests playing games. */
-        regs->rbp = (uint32_t)regs->ebp;
-        regs->rbx = (uint32_t)regs->ebx;
-        regs->rax = (uint32_t)regs->eax;
-        regs->rcx = (uint32_t)regs->ecx;
-        regs->rdx = (uint32_t)regs->edx;
-        regs->rsi = (uint32_t)regs->esi;
-        regs->rdi = (uint32_t)regs->edi;
-        regs->rip = (uint32_t)regs->eip;
-        regs->rflags = (uint32_t)regs->eflags;
-        regs->rsp = (uint32_t)regs->esp;
+        regs->rbp = (uint32_t)regs->rbp;
+        regs->rbx = (uint32_t)regs->rbx;
+        regs->rax = (uint32_t)regs->rax;
+        regs->rcx = (uint32_t)regs->rcx;
+        regs->rdx = (uint32_t)regs->rdx;
+        regs->rsi = (uint32_t)regs->rsi;
+        regs->rdi = (uint32_t)regs->rdi;
+        regs->rip = (uint32_t)regs->rip;
+        regs->rflags = (uint32_t)regs->rflags;
+        regs->rsp = (uint32_t)regs->rsp;
     }
 
 #ifndef NDEBUG
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 13:11:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 13:11:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802848.1213181 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5KJ-0004WO-8S; Tue, 24 Sep 2024 13:11:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802848.1213181; Tue, 24 Sep 2024 13:11:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5KJ-0004WG-5h; Tue, 24 Sep 2024 13:11:35 +0000
Received: by outflank-mailman (input) for mailman id 802848;
 Tue, 24 Sep 2024 13:11:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5KH-0004Vv-OG
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:11:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5KH-0007f1-NR
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:11:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5KH-0003lO-Mf
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:11:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CLXtA76OeOFNG7XIqKv6X37LBerPOSW0L6hSvmk53yI=; b=BSZimy5cIfASd1J5bAMl3PUsk1
	f9Txi5G/uhAwOuytdVFhVWQFsM4M3YsLCgdS8u8VOQ8wKxeDNl/jHlL+9mIdpC2J7CFFK6R0FAYob
	xMDzb3iU3RI0CXj4/h4erpSp1Zsg7Kozgrkdj5lXjQ+BuHcCUbvXO+d68iv8llv/vtfk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] Arm: correct FIXADDR_TOP
Message-Id: <E1st5KH-0003lO-Mf@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 13:11:33 +0000

commit 87d2cdd51327ab001d3cb68a714260f54bafba41
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:52:15 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:52:15 2024 +0200

    Arm: correct FIXADDR_TOP
    
    While reviewing a RISC-V patch cloning the Arm code, I noticed an
    off-by-1 here: FIX_PMAP_{BEGIN,END} being an inclusive range and
    FIX_LAST being the same as FIX_PMAP_END, FIXADDR_TOP cannot derive from
    FIX_LAST alone, or else the BUG_ON() in virt_to_fix() would trigger if
    FIX_PMAP_END ended up being used.
    
    While touching this area also add a check for fixmap and boot FDT area
    to not only not overlap, but to have at least one (unmapped) page in
    between.
    
    Fixes: 4f17357b52f6 ("xen/arm: add Persistent Map (PMAP) infrastructure")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    master commit: fe3412ab83cc53c2bf2c497be3794bc09751efa5
    master date: 2024-08-13 21:50:55 +0100
---
 xen/arch/arm/include/asm/fixmap.h | 2 +-
 xen/arch/arm/mm.c                 | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/include/asm/fixmap.h b/xen/arch/arm/include/asm/fixmap.h
index 734eb9b1d4..c92594c438 100644
--- a/xen/arch/arm/include/asm/fixmap.h
+++ b/xen/arch/arm/include/asm/fixmap.h
@@ -18,7 +18,7 @@
 #define FIXMAP_LAST FIXMAP_PMAP_END
 
 #define FIXADDR_START FIXMAP_ADDR(0)
-#define FIXADDR_TOP FIXMAP_ADDR(FIXMAP_LAST)
+#define FIXADDR_TOP FIXMAP_ADDR(FIXMAP_LAST + 1)
 
 #ifndef __ASSEMBLY__
 
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index c34cc94c90..1ff67ff2b5 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -198,6 +198,12 @@ static void __init __maybe_unused build_assertions(void)
 
 #undef CHECK_SAME_SLOT
 #undef CHECK_DIFFERENT_SLOT
+
+    /*
+     * Fixmaps must not overlap with boot FDT mapping area. Make sure there's
+     * at least one guard page in between.
+     */
+    BUILD_BUG_ON(FIXADDR_TOP >= BOOT_FDT_VIRT_START);
 }
 
 static lpae_t *xen_map_table(mfn_t mfn)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 13:11:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 13:11:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802849.1213185 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5KT-0004Z9-9m; Tue, 24 Sep 2024 13:11:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802849.1213185; Tue, 24 Sep 2024 13:11:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5KT-0004Z1-7A; Tue, 24 Sep 2024 13:11:45 +0000
Received: by outflank-mailman (input) for mailman id 802849;
 Tue, 24 Sep 2024 13:11:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5KR-0004Yq-RJ
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:11:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5KR-0007fK-QX
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:11:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5KR-0003mA-Pa
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:11:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/S0jdCiS2Fi1ZFKI3G/nAW2AoHsTrWCrpAW5JnxwN14=; b=TgibPZyYCC2tLJ80UypudxpyD3
	EKvC/Tu3uwrnLSsbGIJtLeMDicEMZzIb17UwJyKdDxdQn6KtHGiQccOpAY5ahDTTT0KQ7DeimB6CF
	xVrkARMsr4JXo4vnr83oQUX+KK3HseDJkRguk6vbvUvvhDl/TlTI5K9IBez4YxMj8tjg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] xl: fix incorrect output in "help" command
Message-Id: <E1st5KR-0003mA-Pa@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 13:11:43 +0000

commit 0d5f15e6face071c628bd569957d11ced887b42f
Author:     John E. Krokes <mag@netherworld.org>
AuthorDate: Tue Sep 24 14:52:42 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:52:42 2024 +0200

    xl: fix incorrect output in "help" command
    
    In "xl help", the output includes this line:
    
     vsnd-list           List virtual display devices for a domain
    
    This should obviously say "sound devices" instead of "display devices".
    
    Signed-off-by: John E. Krokes <mag@netherworld.org>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: 09226d165b57d919150458044c5b594d3d1dc23a
    master date: 2024-08-14 08:49:44 +0200
---
 tools/xl/xl_cmdtable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c
index 62bdb2aeaa..5843590794 100644
--- a/tools/xl/xl_cmdtable.c
+++ b/tools/xl/xl_cmdtable.c
@@ -433,7 +433,7 @@ const struct cmd_spec cmd_table[] = {
     },
     { "vsnd-list",
       &main_vsndlist, 0, 0,
-      "List virtual display devices for a domain",
+      "List virtual sound devices for a domain",
       "<Domain(s)>",
     },
     { "vsnd-detach",
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 13:11:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 13:11:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802850.1213189 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5Kd-0004bY-BZ; Tue, 24 Sep 2024 13:11:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802850.1213189; Tue, 24 Sep 2024 13:11:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5Kd-0004bQ-8z; Tue, 24 Sep 2024 13:11:55 +0000
Received: by outflank-mailman (input) for mailman id 802850;
 Tue, 24 Sep 2024 13:11:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5Kb-0004bH-UP
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:11:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5Kb-0007fW-Tk
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:11:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5Kb-0003mu-Ss
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:11:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=INYIWRbaQJKtCvxNcHGUEvHpB7d1JdZYKDkJOmGKV1g=; b=zpK8zi7Hygrjp0+mjSyAc1SzAr
	gEnVcg3CprKnlILl65psRfVm/anGuOhkB9EkUPyCsVL/hXTHtevYa7NmtOu/YKvd7TkohXmA7e/xR
	gvz33OGdG1pKdCQdJLx2aTqChqx0XwW9vOqNxzRNLhe40DUoow4GjRPjQdTagWNh5uSI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/pv: Introduce x86_merge_dr6() and fix do_debug()
Message-Id: <E1st5Kb-0003mu-Ss@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 13:11:53 +0000

commit d32c77f471fb8400b6512c171a14cdd58f04f0a3
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 24 14:53:22 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:53:22 2024 +0200

    x86/pv: Introduce x86_merge_dr6() and fix do_debug()
    
    Pretty much everywhere in Xen the logic to update %dr6 when injecting #DB is
    buggy.  Introduce a new x86_merge_dr6() helper, and start fixing the mess by
    adjusting the dr6 merge in do_debug().  Also correct the comment.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 54ef601a66e8d812a6a6a308f02524e81201825e
    master date: 2024-08-21 23:59:19 +0100
---
 xen/arch/x86/debug.c                 | 40 ++++++++++++++++++++++++++++++++++++
 xen/arch/x86/include/asm/debugreg.h  |  7 +++++++
 xen/arch/x86/include/asm/x86-defns.h |  7 +++++++
 xen/arch/x86/traps.c                 | 11 +++++++---
 4 files changed, 62 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/debug.c b/xen/arch/x86/debug.c
index 127fe83021..b10f1f12b6 100644
--- a/xen/arch/x86/debug.c
+++ b/xen/arch/x86/debug.c
@@ -2,12 +2,52 @@
 /*
  * Copyright (C) 2023 XenServer.
  */
+#include <xen/bug.h>
 #include <xen/kernel.h>
 
 #include <xen/lib/x86/cpu-policy.h>
 
 #include <asm/debugreg.h>
 
+/*
+ * Merge new bits into dr6.  'new' is always given in positive polarity,
+ * matching the Intel VMCS PENDING_DBG semantics.
+ *
+ * At the time of writing (August 2024), on the subject of %dr6 updates the
+ * manuals are either vague (Intel "certain exceptions may clear bits 0-3"),
+ * or disputed (AMD makes statements which don't match observed behaviour).
+ *
+ * The only debug exception I can find which doesn't clear the breakpoint bits
+ * is ICEBP(/INT1) on AMD systems.  This is also the one source of #DB that
+ * doesn't have an explicit status bit, meaning we can't easily identify this
+ * case either (AMD systems don't virtualise PENDING_DBG and only provide a
+ * post-merge %dr6 value).
+ *
+ * Treat %dr6 merging as unconditionally writing the breakpoint bits.
+ *
+ * We can't really manage any better, and guest kernels handling #DB as
+ * instructed by the SDM/APM (i.e. reading %dr6 then resetting it back to
+ * default) wont notice.
+ */
+unsigned int x86_merge_dr6(const struct cpu_policy *p, unsigned int dr6,
+                           unsigned int new)
+{
+    /* Flip dr6 to have positive polarity. */
+    dr6 ^= X86_DR6_DEFAULT;
+
+    /* Sanity check that only known values are passed in. */
+    ASSERT(!(dr6 & ~X86_DR6_KNOWN_MASK));
+    ASSERT(!(new & ~X86_DR6_KNOWN_MASK));
+
+    /* Breakpoint bits overridden.  All others accumulate. */
+    dr6 = (dr6 & ~X86_DR6_BP_MASK) | new;
+
+    /* Flip dr6 back to having default polarity. */
+    dr6 ^= X86_DR6_DEFAULT;
+
+    return x86_adj_dr6_rsvd(p, dr6);
+}
+
 unsigned int x86_adj_dr6_rsvd(const struct cpu_policy *p, unsigned int dr6)
 {
     unsigned int ones = X86_DR6_DEFAULT;
diff --git a/xen/arch/x86/include/asm/debugreg.h b/xen/arch/x86/include/asm/debugreg.h
index b6454cc04e..c1945e542e 100644
--- a/xen/arch/x86/include/asm/debugreg.h
+++ b/xen/arch/x86/include/asm/debugreg.h
@@ -108,4 +108,11 @@ struct cpu_policy;
 unsigned int x86_adj_dr6_rsvd(const struct cpu_policy *p, unsigned int dr6);
 unsigned int x86_adj_dr7_rsvd(const struct cpu_policy *p, unsigned int dr7);
 
+/*
+ * Merge new bits into dr6.  'new' is always given in positive polarity,
+ * matching the Intel VMCS PENDING_DBG semantics.
+ */
+unsigned int x86_merge_dr6(const struct cpu_policy *p, unsigned int dr6,
+                           unsigned int new);
+
 #endif /* _X86_DEBUGREG_H */
diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index 5838631ef6..4e4737d56c 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -119,6 +119,13 @@
 #define X86_DR6_ZEROS           _AC(0x00001000, UL)  /* %dr6 bits forced to 0       */
 #define X86_DR6_DEFAULT         _AC(0xffff0ff0, UL)  /* Default %dr6 value          */
 
+#define X86_DR6_BP_MASK                                 \
+    (X86_DR6_B0 | X86_DR6_B1 | X86_DR6_B2 | X86_DR6_B3)
+
+#define X86_DR6_KNOWN_MASK                                              \
+    (X86_DR6_BP_MASK | X86_DR6_BLD | X86_DR6_BD | X86_DR6_BS |          \
+     X86_DR6_BT | X86_DR6_RTM)
+
 /*
  * Debug control flags in DR7.
  */
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 45e1b277ea..9d72ebce55 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2049,9 +2049,14 @@ void do_debug(struct cpu_user_regs *regs)
         return;
     }
 
-    /* Save debug status register where guest OS can peek at it */
-    v->arch.dr6 |= (dr6 & ~X86_DR6_DEFAULT);
-    v->arch.dr6 &= (dr6 | ~X86_DR6_DEFAULT);
+    /*
+     * Update the guest's dr6 so the debugger can peek at it.
+     *
+     * TODO: This should be passed out-of-band, so guest state is not modified
+     * by debugging actions completed behind it's back.
+     */
+    v->arch.dr6 = x86_merge_dr6(v->domain->arch.cpu_policy,
+                                v->arch.dr6, dr6 ^ X86_DR6_DEFAULT);
 
     if ( guest_kernel_mode(v, regs) && v->domain->debugger_attached )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 13:12:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 13:12:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802851.1213194 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5Km-0004es-FK; Tue, 24 Sep 2024 13:12:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802851.1213194; Tue, 24 Sep 2024 13:12:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5Km-0004el-CI; Tue, 24 Sep 2024 13:12:04 +0000
Received: by outflank-mailman (input) for mailman id 802851;
 Tue, 24 Sep 2024 13:12:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5Km-0004eb-2i
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:12:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5Km-0007fq-1E
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:12:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5Km-0003oZ-0H
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:12:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cppwuYLvZGpkHcgktsASa5c4DLhSbqsya5fLEER0guc=; b=D67s7c2sBWqLwRL/JD/5RTUyPF
	9Ws2Aq7svkloWH4nOY6fjN3JjEypfAwDFDQ5kpdQp/M9J59VmzESpzDwpBMNycEKUherc9LFmRm3v
	D3bwMqMzdhqSV1aC87OzQgyaI4+62YVAmYruwVnnckkp/TcGuObReSwEtI38sn3R+9zE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/pv: Fix merging of new status bits into %dr6
Message-Id: <E1st5Km-0003oZ-0H@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 13:12:04 +0000

commit cecee35dd426bb49daf0b58dcf6966024fdc0f0c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 24 14:53:59 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:53:59 2024 +0200

    x86/pv: Fix merging of new status bits into %dr6
    
    All #DB exceptions result in an update of %dr6, but this isn't captured in
    Xen's handling, and is buggy just about everywhere.
    
    To begin resolving this issue, add a new pending_dbg field to x86_event
    (unioned with cr2 to avoid taking any extra space, adjusting users to avoid
    old-GCC bugs with anonymous unions), and introduce pv_inject_DB() to replace
    the current callers using pv_inject_hw_exception().
    
    Push the adjustment of v->arch.dr6 into pv_inject_event(), and use the new
    x86_merge_dr6() rather than the current incorrect logic.
    
    A key property is that pending_dbg is taken with positive polarity to deal
    with RTM/BLD sensibly.  Most callers pass in a constant, but callers passing
    in a hardware %dr6 value need to XOR the value with X86_DR6_DEFAULT to flip to
    positive polarity.
    
    This fixes the behaviour of the breakpoint status bits; that any left pending
    are generally discarded when a new #DB is raised.  In principle it would fix
    RTM/BLD too, except PV guests can't turn these capabilities on to start with.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: db39fa4b27ea470902d4625567cb6fa24030ddfa
    master date: 2024-08-21 23:59:19 +0100
---
 xen/arch/x86/include/asm/domain.h      | 18 ++++++++++++++++--
 xen/arch/x86/include/asm/hvm/hvm.h     |  3 ++-
 xen/arch/x86/pv/emul-priv-op.c         |  5 +----
 xen/arch/x86/pv/emulate.c              |  9 +++++++--
 xen/arch/x86/pv/ro-page-fault.c        |  2 +-
 xen/arch/x86/pv/traps.c                | 16 ++++++++++++----
 xen/arch/x86/traps.c                   |  2 +-
 xen/arch/x86/x86_emulate/x86_emulate.h |  5 ++++-
 8 files changed, 44 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index 237510fed3..53876472fe 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -732,15 +732,29 @@ static inline void pv_inject_hw_exception(unsigned int vector, int errcode)
     pv_inject_event(&event);
 }
 
+static inline void pv_inject_DB(unsigned long pending_dbg)
+{
+    struct x86_event event = {
+        .vector      = X86_EXC_DB,
+        .type        = X86_EVENTTYPE_HW_EXCEPTION,
+        .error_code  = X86_EVENT_NO_EC,
+    };
+
+    event.pending_dbg = pending_dbg;
+
+    pv_inject_event(&event);
+}
+
 static inline void pv_inject_page_fault(int errcode, unsigned long cr2)
 {
-    const struct x86_event event = {
+    struct x86_event event = {
         .vector = X86_EXC_PF,
         .type = X86_EVENTTYPE_HW_EXCEPTION,
         .error_code = errcode,
-        .cr2 = cr2,
     };
 
+    event.cr2 = cr2;
+
     pv_inject_event(&event);
 }
 
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index fd390cefe1..f15d38e8bf 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -532,9 +532,10 @@ static inline void hvm_inject_page_fault(int errcode, unsigned long cr2)
         .vector = X86_EXC_PF,
         .type = X86_EVENTTYPE_HW_EXCEPTION,
         .error_code = errcode,
-        .cr2 = cr2,
     };
 
+    event.cr2 = cr2;
+
     hvm_inject_event(&event);
 }
 
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index aa11ecadaa..15c83b9d23 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -1366,10 +1366,7 @@ int pv_emulate_privileged_op(struct cpu_user_regs *regs)
             ctxt.bpmatch |= DR_STEP;
 
         if ( ctxt.bpmatch )
-        {
-            curr->arch.dr6 |= ctxt.bpmatch | DR_STATUS_RESERVED_ONE;
-            pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
-        }
+            pv_inject_DB(ctxt.bpmatch);
 
         /* fall through */
     case X86EMUL_RETRY:
diff --git a/xen/arch/x86/pv/emulate.c b/xen/arch/x86/pv/emulate.c
index e7a1c0a2cc..8c44dea123 100644
--- a/xen/arch/x86/pv/emulate.c
+++ b/xen/arch/x86/pv/emulate.c
@@ -71,10 +71,15 @@ void pv_emul_instruction_done(struct cpu_user_regs *regs, unsigned long rip)
 {
     regs->rip = rip;
     regs->eflags &= ~X86_EFLAGS_RF;
+
     if ( regs->eflags & X86_EFLAGS_TF )
     {
-        current->arch.dr6 |= DR_STEP | DR_STATUS_RESERVED_ONE;
-        pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
+        /*
+         * TODO: this should generally use TF from the start of the
+         * instruction.  It's only a latent bug for now, as this path isn't
+         * used for any instruction which modifies eflags.
+         */
+        pv_inject_DB(X86_DR6_BS);
     }
 }
 
diff --git a/xen/arch/x86/pv/ro-page-fault.c b/xen/arch/x86/pv/ro-page-fault.c
index cad28ef928..d0fe07e3a1 100644
--- a/xen/arch/x86/pv/ro-page-fault.c
+++ b/xen/arch/x86/pv/ro-page-fault.c
@@ -390,7 +390,7 @@ int pv_ro_page_fault(unsigned long addr, struct cpu_user_regs *regs)
         /* Fallthrough */
     case X86EMUL_OKAY:
         if ( ctxt.retire.singlestep )
-            pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
+            pv_inject_DB(X86_DR6_BS);
 
         /* Fallthrough */
     case X86EMUL_RETRY:
diff --git a/xen/arch/x86/pv/traps.c b/xen/arch/x86/pv/traps.c
index 240d1a2db7..3d499eb3b0 100644
--- a/xen/arch/x86/pv/traps.c
+++ b/xen/arch/x86/pv/traps.c
@@ -12,6 +12,7 @@
 #include <xen/lib.h>
 #include <xen/softirq.h>
 
+#include <asm/debugreg.h>
 #include <asm/pv/trace.h>
 #include <asm/shared.h>
 #include <asm/traps.h>
@@ -50,9 +51,9 @@ void pv_inject_event(const struct x86_event *event)
     tb->cs    = ti->cs;
     tb->eip   = ti->address;
 
-    if ( event->type == X86_EVENTTYPE_HW_EXCEPTION &&
-         vector == X86_EXC_PF )
+    switch ( vector | -(event->type == X86_EVENTTYPE_SW_INTERRUPT) )
     {
+    case X86_EXC_PF:
         curr->arch.pv.ctrlreg[2] = event->cr2;
         arch_set_cr2(curr, event->cr2);
 
@@ -62,9 +63,16 @@ void pv_inject_event(const struct x86_event *event)
             error_code |= PFEC_user_mode;
 
         trace_pv_page_fault(event->cr2, error_code);
-    }
-    else
+        break;
+
+    case X86_EXC_DB:
+        curr->arch.dr6 = x86_merge_dr6(curr->domain->arch.cpu_policy,
+                                       curr->arch.dr6, event->pending_dbg);
+        fallthrough;
+    default:
         trace_pv_trap(vector, regs->rip, use_error_code, error_code);
+        break;
+    }
 
     if ( use_error_code )
     {
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 9d72ebce55..abd3019976 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2064,7 +2064,7 @@ void do_debug(struct cpu_user_regs *regs)
         return;
     }
 
-    pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
+    pv_inject_DB(0 /* N/A, already merged */);
 }
 
 /* SAF-1-safe */
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.h b/xen/arch/x86/x86_emulate/x86_emulate.h
index 698750267a..e348e3c1d3 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.h
+++ b/xen/arch/x86/x86_emulate/x86_emulate.h
@@ -78,7 +78,10 @@ struct x86_event {
     uint8_t       type;         /* X86_EVENTTYPE_* */
     uint8_t       insn_len;     /* Instruction length */
     int32_t       error_code;   /* X86_EVENT_NO_EC if n/a */
-    unsigned long cr2;          /* Only for X86_EXC_PF h/w exception */
+    union {
+        unsigned long cr2;         /* #PF */
+        unsigned long pending_dbg; /* #DB (new DR6 bits, positive polarity) */
+    };
 };
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 13:12:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 13:12:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802852.1213198 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5Kx-0004hR-Gb; Tue, 24 Sep 2024 13:12:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802852.1213198; Tue, 24 Sep 2024 13:12:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5Kx-0004hJ-Dt; Tue, 24 Sep 2024 13:12:15 +0000
Received: by outflank-mailman (input) for mailman id 802852;
 Tue, 24 Sep 2024 13:12:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5Kw-0004hB-62
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:12:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5Kw-0007fz-4Q
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:12:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5Kw-0003pP-3a
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:12:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=X3DG46N+a9ypH3UGqHFiaG2iypL4nhQrCeOJVR1nQko=; b=PpHCKDq5EbjaZpr5QP0nKKmUfj
	QfBtv2OWg5xIs2tn56HNcgAldjICmnCSHfIYCdg+hNoTHVMlJ45Ub0HjPedMb4oua6mDBJzbdEbUQ
	ijxIENn+CYOok4HZ9S1V2NS3kobE5MdWsSh1QslcHHDqASloScYmswfyBSKefYLHcuKo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/pv: Address Coverity complaint in check_guest_io_breakpoint()
Message-Id: <E1st5Kw-0003pP-3a@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 13:12:14 +0000

commit 774d27c807dc5464a945a3242c5d1e8c6f723ab1
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 24 14:54:35 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:54:35 2024 +0200

    x86/pv: Address Coverity complaint in check_guest_io_breakpoint()
    
    Commit 08aacc392d86 ("x86/emul: Fix misaligned IO breakpoint behaviour in PV
    guests") caused a Coverity INTEGER_OVERFLOW complaint based on the reasoning
    that width could be 0.
    
    It can't, but digging into the code generation, GCC 8 and later (bisected on
    godbolt) choose to emit a CSWITCH lookup table, and because the range (bottom
    2 bits clear), it's a 16-entry lookup table.
    
    So Coverity is understandable, given that GCC did emit a (dead) logic path
    where width stayed 0.
    
    Rewrite the logic.  Introduce x86_bp_width() which compiles to a single basic
    block, which replaces the switch() statement.  Take the opportunity to also
    make start and width be loop-scope variables.
    
    No practical change, but it should compile better and placate Coverity.
    
    Fixes: 08aacc392d86 ("x86/emul: Fix misaligned IO breakpoint behaviour in PV guests")
    Coverity-ID: 1616152
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 6d41a9d8a12ff89adabdc286e63e9391a0481699
    master date: 2024-08-21 23:59:19 +0100
---
 xen/arch/x86/include/asm/debugreg.h | 25 +++++++++++++++++++++++++
 xen/arch/x86/pv/emul-priv-op.c      | 21 ++++++---------------
 2 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/include/asm/debugreg.h b/xen/arch/x86/include/asm/debugreg.h
index c1945e542e..ed32f42a38 100644
--- a/xen/arch/x86/include/asm/debugreg.h
+++ b/xen/arch/x86/include/asm/debugreg.h
@@ -115,4 +115,29 @@ unsigned int x86_adj_dr7_rsvd(const struct cpu_policy *p, unsigned int dr7);
 unsigned int x86_merge_dr6(const struct cpu_policy *p, unsigned int dr6,
                            unsigned int new);
 
+/*
+ * Calculate the width of a breakpoint from its dr7 encoding.
+ *
+ * The LEN encoding in dr7 is 2 bits wide per breakpoint and encoded as a X-1
+ * (0, 1 and 3) for widths of 1, 2 and 4 respectively in the 32bit days.
+ *
+ * In 64bit, the unused value (2) was given a meaning of width 8, which is
+ * great for efficiency but less great for nicely calculating the width.
+ */
+static inline unsigned int x86_bp_width(unsigned int dr7, unsigned int bp)
+{
+    unsigned int raw = (dr7 >> (DR_CONTROL_SHIFT +
+                                DR_CONTROL_SIZE * bp + 2)) & 3;
+
+    /*
+     * If the top bit is set (i.e. we've got an 4 or 8 byte wide breakpoint),
+     * flip the bottom to reverse their order, making them sorted properly.
+     * Then it's a simple shift to calculate the width.
+     */
+    if ( raw & 2 )
+        raw ^= 1;
+
+    return 1U << raw;
+}
+
 #endif /* _X86_DEBUGREG_H */
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 15c83b9d23..b90f745c75 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -323,30 +323,21 @@ static unsigned int check_guest_io_breakpoint(struct vcpu *v,
                                               unsigned int port,
                                               unsigned int len)
 {
-    unsigned int width, i, match = 0;
-    unsigned long start;
+    unsigned int i, match = 0;
 
     if ( !v->arch.pv.dr7_emul || !(v->arch.pv.ctrlreg[4] & X86_CR4_DE) )
         return 0;
 
     for ( i = 0; i < 4; i++ )
     {
+        unsigned long start;
+        unsigned int width;
+
         if ( !(v->arch.pv.dr7_emul & (3 << (i * DR_ENABLE_SIZE))) )
             continue;
 
-        start = v->arch.dr[i];
-        width = 0;
-
-        switch ( (v->arch.dr7 >>
-                  (DR_CONTROL_SHIFT + i * DR_CONTROL_SIZE)) & 0xc )
-        {
-        case DR_LEN_1: width = 1; break;
-        case DR_LEN_2: width = 2; break;
-        case DR_LEN_4: width = 4; break;
-        case DR_LEN_8: width = 8; break;
-        }
-
-        start &= ~(width - 1UL);
+        width = x86_bp_width(v->arch.dr7, i);
+        start = v->arch.dr[i] & ~(width - 1UL);
 
         if ( (start < (port + len)) && ((start + width) > port) )
             match |= 1u << i;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 13:12:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 13:12:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802853.1213202 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5L7-0004l8-ID; Tue, 24 Sep 2024 13:12:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802853.1213202; Tue, 24 Sep 2024 13:12:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5L7-0004l0-Fh; Tue, 24 Sep 2024 13:12:25 +0000
Received: by outflank-mailman (input) for mailman id 802853;
 Tue, 24 Sep 2024 13:12:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5L6-0004kp-8W
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:12:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5L6-0007hq-7o
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:12:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5L6-0003q9-6y
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:12:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZyuQ92INe+DyQLsqdnniVQdcdgJCpFpt+kLl+NuWmj8=; b=XIqeKpfLcEDqzvSkJv4IzAqPob
	JdKJmWtyOusF1lgnhy2tXJSs7ulA6Gqu6aegir39zO8Ws/Y8j4/Uh/1msAgEfgt6PWgqwZHtqYgT4
	bkAMq9d1RR3AAEHaCzh9EDPywYFETWz/L0DPdsHpc3D15OF+2fei1TGXuQe6TIS6jxUo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86emul: always set operand size for AVX-VNNI-INT8 insns
Message-Id: <E1st5L6-0003q9-6y@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 13:12:24 +0000

commit 1024fc729398131d62bec368553f6d69432c31cb
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:55:11 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:55:11 2024 +0200

    x86emul: always set operand size for AVX-VNNI-INT8 insns
    
    Unlike for AVX-VNNI-INT16 I failed to notice that op_bytes may still be
    zero when reaching the respective case block: With the ext0f38_table[]
    entries having simd_packed_int, the defaulting at the bottom of
    x86emul_decode() won't set the field to non-zero for F3- or F2-prefixed
    insns.
    
    Fixes: 842acaa743a5 ("x86emul: support AVX-VNNI-INT8")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: d45687cca2450bfebe1dfbddb22f4f03c6fbc9cb
    master date: 2024-08-23 09:11:15 +0200
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index d6b60f0539..941941ef15 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -6075,6 +6075,7 @@ x86_emulate(
     case X86EMUL_OPC_VEX_F2(0x0f38, 0x51): /* vpdpbssds [xy]mm/mem,[xy]mm,[xy]mm */
         host_and_vcpu_must_have(avx_vnni_int8);
         generate_exception_if(vex.w, X86_EXC_UD);
+        op_bytes = 16 << vex.l;
         goto simd_0f_ymm;
 
     case X86EMUL_OPC_VEX_66(0x0f38, 0x50): /* vpdpbusd [xy]mm/mem,[xy]mm,[xy]mm */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 13:12:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 13:12:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802854.1213206 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5LH-0004p9-Jf; Tue, 24 Sep 2024 13:12:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802854.1213206; Tue, 24 Sep 2024 13:12:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5LH-0004p2-H5; Tue, 24 Sep 2024 13:12:35 +0000
Received: by outflank-mailman (input) for mailman id 802854;
 Tue, 24 Sep 2024 13:12:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5LG-0004ou-Bs
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:12:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5LG-0007iK-BD
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:12:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5LG-0003qo-AP
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:12:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tAesyrs45jC6g14RMfAX2rjP7dysk8YirHD99I4MpeY=; b=FBcZRO7OiKH4KrO+2OkovP5bHI
	AjbfRm9n5RVaOz7PNrOpFq90mVwJRLPZoUGPZLYxhbTFZnUmJ+dhXoOQ/5glld95t3fGP1ccBHh8M
	Vj/SFTVWgk6WQgcsE/zIIMav8n/bpffSyemM4ElXivN7cR0cPpRUnPXGMjmobEE4Ph4M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86emul: set (fake) operand size for AVX512CD broadcast insns
Message-Id: <E1st5LG-0003qo-AP@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 13:12:34 +0000

commit 092d673dcba9262ae3da0459d5e6aa4ddd68f966
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:55:48 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:55:48 2024 +0200

    x86emul: set (fake) operand size for AVX512CD broadcast insns
    
    Back at the time I failed to pay attention to op_bytes still being zero
    when reaching the respective case block: With the ext0f38_table[]
    entries having simd_packed_int, the defaulting at the bottom of
    x86emul_decode() won't set the field to non-zero for F3-prefixed insns.
    
    Fixes: 37ccca740c26 ("x86emul: support AVX512CD insns")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 6fa6b7feaafd622db3a2f3436750cf07782f4c12
    master date: 2024-08-23 09:12:24 +0200
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 941941ef15..9d70de1eb4 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -5928,6 +5928,7 @@ x86_emulate(
                                evex.w == ((b >> 4) & 1)),
                               X86_EXC_UD);
         d |= TwoOp;
+        op_bytes = 1; /* fake */
         /* fall through */
     case X86EMUL_OPC_EVEX_66(0x0f38, 0xc4): /* vpconflict{d,q} [xyz]mm/mem,[xyz]mm{k} */
         fault_suppression = false;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 13:12:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 13:12:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802855.1213210 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5LR-0004rl-L2; Tue, 24 Sep 2024 13:12:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802855.1213210; Tue, 24 Sep 2024 13:12:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5LR-0004rd-IX; Tue, 24 Sep 2024 13:12:45 +0000
Received: by outflank-mailman (input) for mailman id 802855;
 Tue, 24 Sep 2024 13:12:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5LQ-0004rT-Ew
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:12:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5LQ-0007iZ-E6
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:12:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5LQ-0003s3-DK
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:12:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=d98Zen2XZ3rGcQNSUBL0dJi31z1Bag9mFqn+wZ9NL6w=; b=o/lSES7666t2CZW19Ana40iIoJ
	h3GIhVTyVQ+SDTLu1Cz4BujErLHaWvjlBvn+0ooKwNkAMQ2U1s51zB+oh6MWH0w2QrT69KIz4BiCG
	zMgcmcOqDrBMZCeX99SNExjrQOT11DzrG3rjoLOpm5ztN9WjJbki7ePHY0oxToSxtmhw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/x2APIC: correct cluster tracking upon CPUs going down for S3
Message-Id: <E1st5LQ-0003s3-DK@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 13:12:44 +0000

commit f29c2fb064ef15b6a2530f1b2dd99c4be76a39af
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:56:16 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:56:16 2024 +0200

    x86/x2APIC: correct cluster tracking upon CPUs going down for S3
    
    Downing CPUs for S3 is somewhat special: Since we can expect the system
    to come back up in exactly the same hardware configuration, per-CPU data
    for the secondary CPUs isn't de-allocated (and then cleared upon re-
    allocation when the CPUs are being brought back up). Therefore the
    cluster_cpus per-CPU pointer will retain its value for all CPUs other
    than the final one in a cluster (i.e. in particular for all CPUs in the
    same cluster as CPU0). That, however, is in conflict with the assertion
    early in init_apic_ldr_x2apic_cluster().
    
    Note that the issue is avoided on Intel hardware, where we park CPUs
    instead of bringing them down.
    
    Extend the bypassing of the freeing to the suspend case, thus making
    suspend/resume also a tiny bit faster.
    
    Fixes: 2e6c8f182c9c ("x86: distinguish CPU offlining from CPU removal")
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: ad3ff7b4279d16c91c23cda6e8be5bc670b25c9a
    master date: 2024-08-26 10:30:40 +0200
---
 xen/arch/x86/genapic/x2apic.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/genapic/x2apic.c b/xen/arch/x86/genapic/x2apic.c
index 371dd100c7..d531035fa4 100644
--- a/xen/arch/x86/genapic/x2apic.c
+++ b/xen/arch/x86/genapic/x2apic.c
@@ -228,7 +228,8 @@ static int cf_check update_clusterinfo(
     case CPU_UP_CANCELED:
     case CPU_DEAD:
     case CPU_REMOVE:
-        if ( park_offline_cpus == (action != CPU_REMOVE) )
+        if ( park_offline_cpus == (action != CPU_REMOVE) ||
+             system_state == SYS_STATE_suspend )
             break;
         if ( per_cpu(cluster_cpus, cpu) )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 13:12:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 13:12:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802856.1213214 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5Lb-0004uH-Mr; Tue, 24 Sep 2024 13:12:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802856.1213214; Tue, 24 Sep 2024 13:12:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5Lb-0004u9-K1; Tue, 24 Sep 2024 13:12:55 +0000
Received: by outflank-mailman (input) for mailman id 802856;
 Tue, 24 Sep 2024 13:12:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5La-0004u1-Hv
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:12:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5La-0007io-HE
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:12:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5La-0003ua-GP
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:12:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZkAecm2p5YvJPSQU11qdUl8IQTRGCQCc40fQoxlh8rM=; b=mdGCoFW0kZSH4mec15QeDyKQNv
	vD3z7c7Q2hRZdjAabv54fBRja4ywKyRMTp1vxHWwoS/dlxIzV/FjqvdNkJduXHpVoNIf6+nXlmtjW
	iAyqPiLAcg59b4qsqSnxwabd+TgJJcqxVXfWTJXaLNBh6XLcgG375df9gJ6kyGIDbVxQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/dom0: disable SMAP for PV domain building only
Message-Id: <E1st5La-0003ua-GP@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 13:12:54 +0000

commit 4cb8c289873aafdba7086d1933665aaea83292ec
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 24 14:56:45 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:56:45 2024 +0200

    x86/dom0: disable SMAP for PV domain building only
    
    Move the logic that disables SMAP so it's only performed when building a PV
    dom0, PVH dom0 builder doesn't require disabling SMAP.
    
    The fixes tag is to account for the wrong usage of cpu_has_smap in
    create_dom0(), it should instead have used
    boot_cpu_has(X86_FEATURE_XEN_SMAP).  Fix while moving the logic to apply to PV
    only.
    
    While there also make cr4_pv32_mask __ro_after_init.
    
    Fixes: 493ab190e5b1 ('xen/sm{e, a}p: allow disabling sm{e, a}p for Xen itself')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: fb1658221a31ec1db33253a80001191391e73b17
    master date: 2024-08-28 19:59:07 +0100
---
 xen/arch/x86/include/asm/setup.h |  2 ++
 xen/arch/x86/pv/dom0_build.c     | 40 +++++++++++++++++++++++++++++++++++-----
 xen/arch/x86/setup.c             | 19 +------------------
 3 files changed, 38 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h
index 14d15048eb..e62eaeaa94 100644
--- a/xen/arch/x86/include/asm/setup.h
+++ b/xen/arch/x86/include/asm/setup.h
@@ -60,6 +60,8 @@ extern bool opt_dom0_verbose;
 extern bool opt_dom0_cpuid_faulting;
 extern bool opt_dom0_msr_relaxed;
 
+extern unsigned long cr4_pv32_mask;
+
 #define max_init_domid (0)
 
 #endif
diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index 64a0b9f598..3b28ae45d1 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -354,11 +354,11 @@ static struct page_info * __init alloc_chunk(struct domain *d,
     return page;
 }
 
-int __init dom0_construct_pv(struct domain *d,
-                             const module_t *image,
-                             unsigned long image_headroom,
-                             module_t *initrd,
-                             const char *cmdline)
+static int __init dom0_construct(struct domain *d,
+                                 const module_t *image,
+                                 unsigned long image_headroom,
+                                 module_t *initrd,
+                                 const char *cmdline)
 {
     int i, rc, order, machine;
     bool compatible, compat;
@@ -1049,6 +1049,36 @@ out:
     return rc;
 }
 
+int __init dom0_construct_pv(struct domain *d,
+                             const module_t *image,
+                             unsigned long image_headroom,
+                             module_t *initrd,
+                             const char *cmdline)
+{
+    int rc;
+
+    /*
+     * Clear SMAP in CR4 to allow user-accesses in construct_dom0().  This
+     * prevents us needing to rewrite construct_dom0() in terms of
+     * copy_{to,from}_user().
+     */
+    if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
+    {
+        cr4_pv32_mask &= ~X86_CR4_SMAP;
+        write_cr4(read_cr4() & ~X86_CR4_SMAP);
+    }
+
+    rc = dom0_construct(d, image, image_headroom, initrd, cmdline);
+
+    if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
+    {
+        write_cr4(read_cr4() | X86_CR4_SMAP);
+        cr4_pv32_mask |= X86_CR4_SMAP;
+    }
+
+    return rc;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index f2592c3dc9..18503300e7 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -75,7 +75,7 @@ static bool __initdata opt_invpcid = true;
 boolean_param("invpcid", opt_invpcid);
 bool __read_mostly use_invpcid;
 
-unsigned long __read_mostly cr4_pv32_mask;
+unsigned long __ro_after_init cr4_pv32_mask;
 
 /* **** Linux config option: propagated to domain0. */
 /* "acpi=off":    Sisables both ACPI table parsing and interpreter. */
@@ -946,26 +946,9 @@ static struct domain *__init create_dom0(const module_t *image,
         cmdline = dom0_cmdline;
     }
 
-    /*
-     * Temporarily clear SMAP in CR4 to allow user-accesses in construct_dom0().
-     * This saves a large number of corner cases interactions with
-     * copy_from_user().
-     */
-    if ( cpu_has_smap )
-    {
-        cr4_pv32_mask &= ~X86_CR4_SMAP;
-        write_cr4(read_cr4() & ~X86_CR4_SMAP);
-    }
-
     if ( construct_dom0(d, image, headroom, initrd, cmdline) != 0 )
         panic("Could not construct domain 0\n");
 
-    if ( cpu_has_smap )
-    {
-        write_cr4(read_cr4() | X86_CR4_SMAP);
-        cr4_pv32_mask |= X86_CR4_SMAP;
-    }
-
     return d;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 13:13:05 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 13:13:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802857.1213218 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5Ll-0004xb-Q4; Tue, 24 Sep 2024 13:13:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802857.1213218; Tue, 24 Sep 2024 13:13:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5Ll-0004xU-Nj; Tue, 24 Sep 2024 13:13:05 +0000
Received: by outflank-mailman (input) for mailman id 802857;
 Tue, 24 Sep 2024 13:13:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5Lk-0004xD-Kj
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:13:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5Lk-0007j8-K0
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:13:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5Lk-0003vX-JN
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:13:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+2xT2pA5antvhZaU7z5cy9VwNVC/pCGhhoVIcLTzgPM=; b=mtR0TputusZssA/Cdfy4n22k7E
	YHQuoggWlOhqfhNqRg/VaTjsLC0/hi4m5d3cYU6oxOTgKU1Rjxgp3bGH+fFUadLtHTXy5oT/vJBZ/
	YZFCLSqrfnPPwC2v5QF0iQ/TaOkUJ46UFuq6pVt3dWJfnf0AVAjapDvNINWfzFkwMVh8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/HVM: correct partial HPET_STATUS write emulation
Message-Id: <E1st5Lk-0003vX-JN@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 13:13:04 +0000

commit 582a83da12bf0d8c6186aaf0aa11aa0b9850d0ad
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:57:21 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:57:21 2024 +0200

    x86/HVM: correct partial HPET_STATUS write emulation
    
    For partial writes the non-written parts of registers are folded into
    the full 64-bit value from what they're presently set to. That's wrong
    to do though when the behavior is write-1-to-clear: Writes not
    including to low 3 bits would unconditionally clear all ISR bits which
    are presently set. Re-calculate the value to use.
    
    Fixes: be07023be115 ("x86/vhpet: add support for level triggered interrupts")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 41d358d2f9607ba37c216effa39b9f1bc58de69d
    master date: 2024-08-29 10:02:20 +0200
---
 xen/arch/x86/hvm/hpet.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/hpet.c b/xen/arch/x86/hvm/hpet.c
index 80f323316c..21b30d2900 100644
--- a/xen/arch/x86/hvm/hpet.c
+++ b/xen/arch/x86/hvm/hpet.c
@@ -405,7 +405,8 @@ static int cf_check hpet_write(
         break;
 
     case HPET_STATUS:
-        /* write 1 to clear. */
+        /* Write 1 to clear. Therefore don't use new_val directly here. */
+        new_val = val << ((addr & 7) * 8);
         while ( new_val )
         {
             bool active;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 13:13:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 13:13:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802859.1213222 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5Lv-00052f-Rh; Tue, 24 Sep 2024 13:13:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802859.1213222; Tue, 24 Sep 2024 13:13:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5Lv-00052X-P8; Tue, 24 Sep 2024 13:13:15 +0000
Received: by outflank-mailman (input) for mailman id 802859;
 Tue, 24 Sep 2024 13:13:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5Lu-000515-OG
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:13:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5Lu-0007jL-Mm
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:13:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5Lu-0003wD-M8
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:13:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5BbrVMnKjW1hW/OHnmGUCgA29WkMOxCwM/clRrrPtxU=; b=rfHO6YaRncYb8icV66L+6LbPi9
	PEKrWOSEAUkzyv+VAvfEVGqwL+Cn2wheF3QOD+Yf8e4aJspL5BZKcr9hag2RwUnWxtjIL2syoQHzT
	Ch7+1x9VwvOD3y03YEGXjIfgWEnhJ5xJDH3+JdrhKNojKICjURjOfa7L3zgVjgCrKn/Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] Arm64: adjust __irq_to_desc() to fix build with gcc14
Message-Id: <E1st5Lu-0003wD-M8@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 13:13:14 +0000

commit 133b92bf78c21f40c6a316fc000422a188c01a7a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:57:43 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:57:43 2024 +0200

    Arm64: adjust __irq_to_desc() to fix build with gcc14
    
    With the original code I observe
    
    In function ‘__irq_to_desc’,
        inlined from ‘route_irq_to_guest’ at arch/arm/irq.c:465:12:
    arch/arm/irq.c:54:16: error: array subscript -2 is below array bounds of ‘irq_desc_t[32]’ {aka ‘struct irq_desc[32]’} [-Werror=array-bounds=]
       54 |         return &this_cpu(local_irq_desc)[irq];
          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    which looks pretty bogus: How in the world does the compiler arrive at
    -2 when compiling route_irq_to_guest()? Yet independent of that the
    function's parameter wants to be of unsigned type anyway, as shown by
    a vast majority of callers (others use plain int when they really mean
    non-negative quantities). With that adjustment the code compiles fine
    again.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
    master commit: 99f942f3d410059dc223ee0a908827e928ef3592
    master date: 2024-08-29 10:03:53 +0200
---
 xen/arch/arm/include/asm/irq.h | 2 +-
 xen/arch/arm/irq.c             | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/include/asm/irq.h b/xen/arch/arm/include/asm/irq.h
index c8044b0371..59348a0dd4 100644
--- a/xen/arch/arm/include/asm/irq.h
+++ b/xen/arch/arm/include/asm/irq.h
@@ -57,7 +57,7 @@ extern const unsigned int nr_irqs;
 struct irq_desc;
 struct irqaction;
 
-struct irq_desc *__irq_to_desc(int irq);
+struct irq_desc *__irq_to_desc(unsigned int irq);
 
 #define irq_to_desc(irq)    __irq_to_desc(irq)
 
diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index ae69fb4aeb..014b2d7982 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -58,7 +58,7 @@ hw_irq_controller no_irq_type = {
 static irq_desc_t irq_desc[NR_IRQS];
 static DEFINE_PER_CPU(irq_desc_t[NR_LOCAL_IRQS], local_irq_desc);
 
-struct irq_desc *__irq_to_desc(int irq)
+struct irq_desc *__irq_to_desc(unsigned int irq)
 {
     if ( irq < NR_LOCAL_IRQS )
         return &this_cpu(local_irq_desc)[irq];
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 13:13:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 13:13:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802860.1213226 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5M5-000582-TG; Tue, 24 Sep 2024 13:13:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802860.1213226; Tue, 24 Sep 2024 13:13:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5M5-00057v-Qe; Tue, 24 Sep 2024 13:13:25 +0000
Received: by outflank-mailman (input) for mailman id 802860;
 Tue, 24 Sep 2024 13:13:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5M4-00057i-QY
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:13:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5M4-0007jT-Pv
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:13:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5M4-0003xv-P9
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:13:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7Mg3F2pVL8uk8mLQh5bcuJjpruiKyBj3kBKmRJEo5OY=; b=bPBvPCjlhcZ5QFlyyLHHwGva2o
	6d6qc50qOlo5n/aO9vBUbcLpXNI0eLFPYuntrGCjXMkB1QgoHRV/YD+tui4VkFCPswxDxI8Gh6OHR
	WNSuCG81WTSPEdXZl6uYQZG6fIWBpHHzSw4UuVz2y7QW+gzoOZT2LsN9yY52hbdLAXv0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] libxl: Fix nul-termination of the return value of libxl_xen_console_read_line()
Message-Id: <E1st5M4-0003xv-P9@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 13:13:24 +0000

commit e077d26621a31fb707c64d8251f5022991c979a9
Author:     Javi Merino <javi.merino@cloud.com>
AuthorDate: Tue Sep 24 14:58:13 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:58:13 2024 +0200

    libxl: Fix nul-termination of the return value of libxl_xen_console_read_line()
    
    When built with ASAN, "xl dmesg" crashes in the "printf("%s", line)"
    call in main_dmesg().  ASAN reports a heap buffer overflow: an
    off-by-one access to cr->buffer.
    
    The readconsole sysctl copies up to count characters into the buffer,
    but it does not add a null character at the end.  Despite the
    documentation of libxl_xen_console_read_line(), line_r is not
    nul-terminated if 16384 characters were copied to the buffer.
    
    Fix this by asking xc_readconsolering() to fill the buffer up to size
    - 1.  As the number of characters in the buffer is only needed in
    libxl_xen_console_read_line(), make it a local variable there instead
    of part of the libxl__xen_console_reader struct.
    
    Fixes: 4024bae739cc ("xl: Add subcommand 'xl dmesg'")
    Reported-by: Edwin Török <edwin.torok@cloud.com>
    Signed-off-by: Javi Merino <javi.merino@cloud.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: bb03169bcb6ecccf372de1f6b9285cd519a26bb8
    master date: 2024-09-03 10:53:44 +0100
---
 tools/libs/light/libxl_console.c  | 19 +++++++++++++++----
 tools/libs/light/libxl_internal.h |  1 -
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/tools/libs/light/libxl_console.c b/tools/libs/light/libxl_console.c
index a563c9d3c7..9f736b8913 100644
--- a/tools/libs/light/libxl_console.c
+++ b/tools/libs/light/libxl_console.c
@@ -774,12 +774,17 @@ libxl_xen_console_reader *
 {
     GC_INIT(ctx);
     libxl_xen_console_reader *cr;
-    unsigned int size = 16384;
+    /*
+     * We want xen to fill the buffer in as few hypercalls as
+     * possible, but xen will not nul-terminate it.  The default size
+     * of Xen's console buffer is 16384.  Leave one byte at the end
+     * for the null character.
+     */
+    unsigned int size = 16384 + 1;
 
     cr = libxl__zalloc(NOGC, sizeof(libxl_xen_console_reader));
     cr->buffer = libxl__zalloc(NOGC, size);
     cr->size = size;
-    cr->count = size;
     cr->clear = clear;
     cr->incremental = 1;
 
@@ -800,10 +805,16 @@ int libxl_xen_console_read_line(libxl_ctx *ctx,
                                 char **line_r)
 {
     int ret;
+    /*
+     * Number of chars to copy into the buffer.  xc_readconsolering()
+     * does not add a null character at the end, so leave a space for
+     * us to add it.
+     */
+    unsigned int nr_chars = cr->size - 1;
     GC_INIT(ctx);
 
     memset(cr->buffer, 0, cr->size);
-    ret = xc_readconsolering(ctx->xch, cr->buffer, &cr->count,
+    ret = xc_readconsolering(ctx->xch, cr->buffer, &nr_chars,
                              cr->clear, cr->incremental, &cr->index);
     if (ret < 0) {
         LOGE(ERROR, "reading console ring buffer");
@@ -811,7 +822,7 @@ int libxl_xen_console_read_line(libxl_ctx *ctx,
         return ERROR_FAIL;
     }
     if (!ret) {
-        if (cr->count) {
+        if (nr_chars) {
             *line_r = cr->buffer;
             ret = 1;
         } else {
diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h
index d5732d1c37..e5477c7668 100644
--- a/tools/libs/light/libxl_internal.h
+++ b/tools/libs/light/libxl_internal.h
@@ -2080,7 +2080,6 @@ _hidden char *libxl__uuid2string(libxl__gc *gc, const libxl_uuid uuid);
 struct libxl__xen_console_reader {
     char *buffer;
     unsigned int size;
-    unsigned int count;
     unsigned int clear;
     unsigned int incremental;
     unsigned int index;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 13:13:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 13:13:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802861.1213230 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5MF-0005Bi-V8; Tue, 24 Sep 2024 13:13:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802861.1213230; Tue, 24 Sep 2024 13:13:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5MF-0005BW-SR; Tue, 24 Sep 2024 13:13:35 +0000
Received: by outflank-mailman (input) for mailman id 802861;
 Tue, 24 Sep 2024 13:13:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5ME-0005BK-U1
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:13:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5ME-0007k8-TE
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:13:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5ME-00040h-SJ
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:13:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zK1vBvlp9w6v6SovQGulrKUeQNpJTQKyqNSxDuCebko=; b=FKy0wTYwcWDZDCHtqxCAgdXz03
	bpQ7WboXzGFq504bC1t1i4m6Sz1k4vA2SvdAfBXnblpnV34AhU7bwcak3u4tK8SuBg3O5ysI7MCWs
	uKH6FoPKPW9Q7piuS2Ze29F7eoI7Huhl7fiwYxTWocot5MmCa/31DftVQ7DVPnhDWus0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] SUPPORT.md: split XSM from Flask
Message-Id: <E1st5ME-00040h-SJ@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 13:13:34 +0000

commit 37fcb4c206a47e6923f49207dabcde9829d1eb2e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:58:45 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:58:45 2024 +0200

    SUPPORT.md: split XSM from Flask
    
    XSM is a generic framework, which in particular is also used by SILO.
    With this it can't really be experimental: Arm mandates SILO for having
    a security supported configuration.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    master commit: d7c18b8720824d7efc39ffa7296751e1812865a9
    master date: 2024-09-04 16:05:03 +0200
---
 SUPPORT.md | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index b4715a65b5..24157088d2 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -731,13 +731,21 @@ Compile time disabled for ARM by default.
 
     Status, x86: Supported, not security supported
 
-### XSM & FLASK
+### XSM (Xen Security Module) Framework
+
+XSM is a security policy framework.  The dummy implementation is covered by this
+statement, and implements a policy whereby dom0 is all powerful.  See below for
+alternative modules (FLASK, SILO).
+
+    Status: Supported
+
+### FLASK XSM Module
 
     Status: Experimental
 
 Compile time disabled by default.
 
-Also note that using XSM
+Also note that using FLASK
 to delegate various domain control hypercalls
 to particular other domains, rather than only permitting use by dom0,
 is also specifically excluded from security support for many hypercalls.
@@ -750,6 +758,13 @@ Please see XSA-77 for more details.
 The default policy includes FLASK labels and roles for a "typical" Xen-based system
 with dom0, driver domains, stub domains, domUs, and so on.
 
+### SILO XSM Module
+
+SILO extends the dummy policy by enforcing that DomU-s can only communicate
+with Dom0, yet not with each other.
+
+    Status: Supported
+
 ## Virtual Hardware, Hypervisor
 
 ### x86/Nested PV
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 13:13:46 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 13:13:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802862.1213233 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5MQ-0005EU-08; Tue, 24 Sep 2024 13:13:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802862.1213233; Tue, 24 Sep 2024 13:13:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5MP-0005EM-Tq; Tue, 24 Sep 2024 13:13:45 +0000
Received: by outflank-mailman (input) for mailman id 802862;
 Tue, 24 Sep 2024 13:13:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5MP-0005EA-0p
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:13:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5MP-0007kH-04
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:13:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5MO-00043g-VS
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:13:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XlWW+ZxUbKc9z6CyKv6SWIlQ2XkzzLRnyp8nL0x7T8A=; b=pDrpN7+Kf2qwTSemAPJqGBQ9Zp
	NEaHb8ALjDQjk/RKHdSnYs5VsUEKTwNlvx1O1ol+E+dKHhdLIOuodHKwHT1M1T8wcCjkFv75UH+Jl
	wg2Mtet2k6OXptgb2bwZ4Px2FmchaIOM89E77b6ToJUM7FgIt0k1TOuCXdxidg04Q7Oo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86: fix UP build with gcc14
Message-Id: <E1st5MO-00043g-VS@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 13:13:44 +0000

commit f562deb29bbccd6606b684105aa718ef263f274e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:58:58 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:58:58 2024 +0200

    x86: fix UP build with gcc14
    
    The complaint is:
    
    In file included from ././include/xen/config.h:17,
                     from <command-line>:
    arch/x86/smpboot.c: In function ‘link_thread_siblings.constprop’:
    ./include/asm-generic/percpu.h:16:51: error: array subscript [0, 0] is outside array bounds of ‘long unsigned int[1]’ [-Werror=array-bounds=]
       16 |     (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
    ./include/xen/compiler.h:140:29: note: in definition of macro ‘RELOC_HIDE’
      140 |     (typeof(ptr)) (__ptr + (off)); })
          |                             ^~~
    arch/x86/smpboot.c:238:27: note: in expansion of macro ‘per_cpu’
      238 |     cpumask_set_cpu(cpu2, per_cpu(cpu_sibling_mask, cpu1));
          |                           ^~~~~~~
    In file included from ./arch/x86/include/generated/asm/percpu.h:1,
                     from ./include/xen/percpu.h:30,
                     from ./arch/x86/include/asm/cpuid.h:9,
                     from ./arch/x86/include/asm/cpufeature.h:11,
                     from ./arch/x86/include/asm/system.h:6,
                     from ./include/xen/list.h:11,
                     from ./include/xen/mm.h:68,
                     from arch/x86/smpboot.c:12:
    ./include/asm-generic/percpu.h:12:22: note: while referencing ‘__per_cpu_offset’
       12 | extern unsigned long __per_cpu_offset[NR_CPUS];
          |                      ^~~~~~~~~~~~~~~~
    
    Which I consider bogus in the first place ("array subscript [0, 0]" vs a
    1-element array). Yet taking the experience from 99f942f3d410 ("Arm64:
    adjust __irq_to_desc() to fix build with gcc14") I guessed that
    switching function parameters to unsigned int (which they should have
    been anyway) might help. And voilà ...
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: a2de7dc4d845738e734b10fce6550c89c6b1092c
    master date: 2024-09-04 16:09:28 +0200
---
 xen/arch/x86/smpboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 4c54ecbc91..f7078130cd 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -226,7 +226,7 @@ static int booting_cpu;
 /* CPUs for which sibling maps can be computed. */
 static cpumask_t cpu_sibling_setup_map;
 
-static void link_thread_siblings(int cpu1, int cpu2)
+static void link_thread_siblings(unsigned int cpu1, unsigned int cpu2)
 {
     cpumask_set_cpu(cpu1, per_cpu(cpu_sibling_mask, cpu2));
     cpumask_set_cpu(cpu2, per_cpu(cpu_sibling_mask, cpu1));
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 13:13:56 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 13:13:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802863.1213239 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5Ma-0005HF-1s; Tue, 24 Sep 2024 13:13:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802863.1213239; Tue, 24 Sep 2024 13:13:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5MZ-0005H3-VG; Tue, 24 Sep 2024 13:13:55 +0000
Received: by outflank-mailman (input) for mailman id 802863;
 Tue, 24 Sep 2024 13:13:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5MZ-0005Gs-4U
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:13:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5MZ-0007kR-2y
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:13:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5MZ-00044X-2O
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:13:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ut7ToFoOyRqMyPUQszaYWIAVRtuWEc4SpchrcrdpKQ4=; b=PbwqSCg6WJ8RtbBS+gkd7ok58n
	Qn6dFZVi54K+2ugAOgQ4Nt+AiBOqMKmpkXFnKkcCD7+9hRJPSF+Rb1PoJA1LcdTZdUi8QbkPGsmBm
	iTtFtMkpHAKtacn5r3SSZ+MhLEwzdTX2G7/o3dozr2hd0whszq19maqq7D6RD9BnARpk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86emul/test: fix build with gas 2.43
Message-Id: <E1st5MZ-00044X-2O@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 13:13:55 +0000

commit acab1a90f931debe3e13dc9dbe6eb11ec2bdf818
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:59:22 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:59:22 2024 +0200

    x86emul/test: fix build with gas 2.43
    
    Drop explicit {evex} pseudo-prefixes. New gas (validly) complains when
    they're used on things other than instructions. Our use was potentially
    ahead of macro invocations - see simd.h's "override" macro.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 3c09288298af881ea1bb568740deb2d2a06bcd41
    master date: 2024-09-06 08:41:18 +0200
---
 tools/tests/x86_emulator/simd.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/tests/x86_emulator/simd.c b/tools/tests/x86_emulator/simd.c
index 263cea662d..d68a7364c2 100644
--- a/tools/tests/x86_emulator/simd.c
+++ b/tools/tests/x86_emulator/simd.c
@@ -333,7 +333,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # if FLOAT_SIZE == 4
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vbroadcastss %1, %0" \
+    asm ( "vbroadcastss %1, %0" \
           : "=v" (t_) : "m" (*(float[1]){ x }) ); \
     t_; \
 })
@@ -401,14 +401,14 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 #  if VEC_SIZE >= 32
 #   define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vbroadcastsd %1, %0" : "=v" (t_) \
+    asm ( "vbroadcastsd %1, %0" : "=v" (t_) \
           : "m" (*(double[1]){ x }) ); \
     t_; \
 })
 #  else
 #   define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastq %1, %0" \
+    asm ( "vpbroadcastq %1, %0" \
           : "=v" (t_) : "m" (*(double[1]){ x }) ); \
     t_; \
 })
@@ -601,7 +601,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # if INT_SIZE == 4 || UINT_SIZE == 4
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastd %1, %0" \
+    asm ( "vpbroadcastd %1, %0" \
           : "=v" (t_) : "m" (*(int[1]){ x }) ); \
     t_; \
 })
@@ -649,7 +649,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # elif INT_SIZE == 8 || UINT_SIZE == 8
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastq %1, %0" \
+    asm ( "vpbroadcastq %1, %0" \
           : "=v" (t_) : "m" (*(long long[1]){ x }) ); \
     t_; \
 })
@@ -716,7 +716,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # if INT_SIZE == 1 || UINT_SIZE == 1
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastb %1, %0" \
+    asm ( "vpbroadcastb %1, %0" \
           : "=v" (t_) : "m" (*(char[1]){ x }) ); \
     t_; \
 })
@@ -745,7 +745,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # elif INT_SIZE == 2 || UINT_SIZE == 2
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastw %1, %0" \
+    asm ( "vpbroadcastw %1, %0" \
           : "=v" (t_) : "m" (*(short[1]){ x }) ); \
     t_; \
 })
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 13:14:06 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 13:14:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802864.1213242 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5Mk-0005Je-3G; Tue, 24 Sep 2024 13:14:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802864.1213242; Tue, 24 Sep 2024 13:14:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5Mk-0005JW-0Q; Tue, 24 Sep 2024 13:14:06 +0000
Received: by outflank-mailman (input) for mailman id 802864;
 Tue, 24 Sep 2024 13:14:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5Mj-0005JQ-6O
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:14:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5Mj-0007kq-5d
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:14:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5Mj-000467-4z
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:14:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0k08WlixBBjU/FmIjN2x7DSK9OG235rWV5r6bkPq2hg=; b=1RYBqH2N7wwq4l1djBRLyLIViy
	J9N26wZxHL9WHMOk7nATFxUwndRAmgY8TDIo0WAsb8D4LxcrpEjJWUc210RGCUkzozBMj1oKEdk2Z
	IW5ZB1MDHOTEaxqNYtv3ufVWxqskq5eqStquYD/7fudIP+qYLVfPVB9Ft8zLHN0RHCgc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/HVM: properly reject "indirect" VRAM writes
Message-Id: <E1st5Mj-000467-4z@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 13:14:05 +0000

commit b7f66ed124985563c73dadeec84189c48870cd1a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 15:00:07 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 15:00:07 2024 +0200

    x86/HVM: properly reject "indirect" VRAM writes
    
    While ->count will only be different from 1 for "indirect" (data in
    guest memory) accesses, it being 1 does not exclude the request being an
    "indirect" one. Check both to be on the safe side, and bring the ->count
    part also in line with what ioreq_send_buffered() actually refuses to
    handle.
    
    Fixes: 3bbaaec09b1b ("x86/hvm: unify stdvga mmio intercept with standard mmio intercept")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: eb7cd0593d88c4b967a24bca8bd30591966676cd
    master date: 2024-09-12 09:13:04 +0200
---
 xen/arch/x86/hvm/stdvga.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index 2586891863..6419211266 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -530,14 +530,14 @@ static bool cf_check stdvga_mem_accept(
 
     spin_lock(&s->lock);
 
-    if ( p->dir == IOREQ_WRITE && p->count > 1 )
+    if ( p->dir == IOREQ_WRITE && (p->data_is_ptr || p->count != 1) )
     {
         /*
          * We cannot return X86EMUL_UNHANDLEABLE on anything other then the
          * first cycle of an I/O. So, since we cannot guarantee to always be
          * able to send buffered writes, we have to reject any multi-cycle
-         * I/O and, since we are rejecting an I/O, we must invalidate the
-         * cache.
+         * or "indirect" I/O and, since we are rejecting an I/O, we must
+         * invalidate the cache.
          * Single-cycle write transactions are accepted even if the cache is
          * not active since we can assert, when in stdvga mode, that writes
          * to VRAM have no side effect and thus we can try to buffer them.
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 13:14:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 13:14:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802865.1213245 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5Mu-0005N5-5k; Tue, 24 Sep 2024 13:14:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802865.1213245; Tue, 24 Sep 2024 13:14:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5Mu-0005My-3M; Tue, 24 Sep 2024 13:14:16 +0000
Received: by outflank-mailman (input) for mailman id 802865;
 Tue, 24 Sep 2024 13:14:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5Mt-0005Mn-95
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:14:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5Mt-0007kw-8O
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:14:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5Mt-00046u-7k
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:14:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=s6dflQbgJ2Kp7pOL9fHv4/Ta0thZjlU2VKuXuB4/xnw=; b=ExlSUHPw/gM54lhfepMrz+Wnxz
	gXyCT2EvLW+FkgDCorWAKet5eyN4RQU6HRhquqYwr0gr8oBQ6KZZ/MyBziTbbBkEv6af/4K8ADs3A
	GlGOHD2BrbrKrwNVxbfJT1/GSfsCC+xR1w9Z3QToVbPm8yjWf9DECwEJO4oq3FpFa6Pc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] xen/x86/pvh: handle ACPI RSDT table in PVH Dom0 build
Message-Id: <E1st5Mt-00046u-7k@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 13:14:15 +0000

commit b7e54ae8389dad2f0582d32edb667f6bdbf9df37
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Tue Sep 24 15:00:29 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 15:00:29 2024 +0200

    xen/x86/pvh: handle ACPI RSDT table in PVH Dom0 build
    
    Xen always generates an XSDT table even if the firmware only provided an
    RSDT table.  Copy the RSDT header from the firmware table, adjusting the
    signature, for the XSDT table when not provided by the firmware.
    
    This is necessary to run Xen on QEMU.
    
    Fixes: 1d74282c455f ('x86: setup PVHv2 Dom0 ACPI tables')
    Suggested-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 6e7f7a0c16c4d406bda6d4a900252ff63a7c5fad
    master date: 2024-09-12 09:18:25 +0200
---
 xen/arch/x86/hvm/dom0_build.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index c7d47d0d4c..411beb3f06 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -960,7 +960,16 @@ static int __init pvh_setup_acpi_xsdt(struct domain *d, paddr_t madt_addr,
         rc = -EINVAL;
         goto out;
     }
-    xsdt_paddr = rsdp->xsdt_physical_address;
+    /*
+     * Note the header is the same for both RSDT and XSDT, so it's fine to
+     * copy the native RSDT header to the Xen crafted XSDT if no native
+     * XSDT is available.
+     */
+    if ( rsdp->revision > 1 && rsdp->xsdt_physical_address )
+        xsdt_paddr = rsdp->xsdt_physical_address;
+    else
+        xsdt_paddr = rsdp->rsdt_physical_address;
+
     acpi_os_unmap_memory(rsdp, sizeof(*rsdp));
     table = acpi_os_map_memory(xsdt_paddr, sizeof(*table));
     if ( !table )
@@ -972,6 +981,12 @@ static int __init pvh_setup_acpi_xsdt(struct domain *d, paddr_t madt_addr,
     xsdt->header = *table;
     acpi_os_unmap_memory(table, sizeof(*table));
 
+    /*
+     * In case the header is an RSDT copy, unconditionally ensure it has
+     * an XSDT sig.
+     */
+    xsdt->header.signature[0] = 'X';
+
     /* Add the custom MADT. */
     xsdt->table_offset_entry[0] = madt_addr;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 13:14:26 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 13:14:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802866.1213250 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5N4-0005Pn-7X; Tue, 24 Sep 2024 13:14:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802866.1213250; Tue, 24 Sep 2024 13:14:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5N4-0005Pg-4o; Tue, 24 Sep 2024 13:14:26 +0000
Received: by outflank-mailman (input) for mailman id 802866;
 Tue, 24 Sep 2024 13:14:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5N3-0005PY-Bq
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:14:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5N3-0007l5-B9
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:14:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5N3-00047g-AV
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:14:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5p7oNNBXZOO8yxWiE9K7RvqYyM2NH4K5O3zqeP/k7Zg=; b=S2Ij1XGWrXAwkbr1NTVGRCwUm1
	CvipGY8+uGGGKZvo3NTqtWFGoEknzVOwPm5i7wRrgpgTxQxHQmxlFlWwlmSi2a+OWs69Fh80X8RFc
	KMh983UxslwNC0v58VsxgIjQ97qpcf8MbufXK84LoNZGPahrwnFtSxFfxAJG+YuphZXs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] blkif: reconcile protocol specification with in-use implementations
Message-Id: <E1st5N3-00047g-AV@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 13:14:25 +0000

commit 834518a8d055149f250d191a3c50f96013756c01
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 24 15:00:55 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 15:00:55 2024 +0200

    blkif: reconcile protocol specification with in-use implementations
    
    Current blkif implementations (both backends and frontends) have all slight
    differences about how they handle the 'sector-size' xenstore node, and how
    other fields are derived from this value or hardcoded to be expressed in units
    of 512 bytes.
    
    To give some context, this is an excerpt of how different implementations use
    the value in 'sector-size' as the base unit for to other fields rather than
    just to set the logical sector size of the block device:
    
                            │ sectors xenbus node │ requests sector_number │ requests {first,last}_sect
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    FreeBSD blk{front,back} │     sector-size     │      sector-size       │           512
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    Linux blk{front,back}   │         512         │          512           │           512
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    QEMU blkback            │     sector-size     │      sector-size       │       sector-size
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    Windows blkfront        │     sector-size     │      sector-size       │       sector-size
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    MiniOS                  │     sector-size     │          512           │           512
    
    An attempt was made by 67e1c050e36b in order to change the base units of the
    request fields and the xenstore 'sectors' node.  That however only lead to more
    confusion, as the specification now clearly diverged from the reference
    implementation in Linux.  Such change was only implemented for QEMU Qdisk
    and Windows PV blkfront.
    
    Partially revert to the state before 67e1c050e36b while adjusting the
    documentation for 'sectors' to match what it used to be previous to
    2fa701e5346d:
    
     * Declare 'feature-large-sector-size' deprecated.  Frontends should not expose
       the node, backends should not make decisions based on its presence.
    
     * Clarify that 'sectors' xenstore node and the requests fields are always in
       512-byte units, like it was previous to 2fa701e5346d and 67e1c050e36b.
    
    All base units for the fields used in the protocol are 512-byte based, the
    xenbus 'sector-size' field is only used to signal the logic block size.  When
    'sector-size' is greater than 512, blkfront implementations must make sure that
    the offsets and sizes (despite being expressed in 512-byte units) are aligned
    to the logical block size specified in 'sector-size', otherwise the backend
    will fail to process the requests.
    
    This will require changes to some of the frontends and backends in order to
    properly support 'sector-size' nodes greater than 512.
    
    Fixes: 2fa701e5346d ('blkif.h: Provide more complete documentation of the blkif interface')
    Fixes: 67e1c050e36b ('public/io/blkif.h: try to fix the semantics of sector based quantities')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: 221f2748e8dabe8361b8cdfcffbeab9102c4c899
    master date: 2024-09-12 14:04:56 +0200
---
 xen/include/public/io/blkif.h | 52 ++++++++++++++++++++++++++++++++-----------
 1 file changed, 39 insertions(+), 13 deletions(-)

diff --git a/xen/include/public/io/blkif.h b/xen/include/public/io/blkif.h
index 22f1eef0c0..9b00d633d3 100644
--- a/xen/include/public/io/blkif.h
+++ b/xen/include/public/io/blkif.h
@@ -237,12 +237,16 @@
  * sector-size
  *      Values:         <uint32_t>
  *
- *      The logical block size, in bytes, of the underlying storage. This
- *      must be a power of two with a minimum value of 512.
+ *      The logical block size, in bytes, of the underlying storage. This must
+ *      be a power of two with a minimum value of 512.  The sector size should
+ *      only be used for request segment length and alignment.
  *
- *      NOTE: Because of implementation bugs in some frontends this must be
- *            set to 512, unless the frontend advertizes a non-zero value
- *            in its "feature-large-sector-size" xenbus node. (See below).
+ *      When exposing a device that uses a logical sector size of 4096, the
+ *      only difference xenstore wise will be that 'sector-size' (and possibly
+ *      'physical-sector-size' if supported by the backend) will be 4096, but
+ *      the 'sectors' node will still be calculated using 512 byte units.  The
+ *      sector base units in the ring requests fields will all be 512 byte
+ *      based despite the logical sector size exposed in 'sector-size'.
  *
  * physical-sector-size
  *      Values:         <uint32_t>
@@ -254,9 +258,9 @@
  * sectors
  *      Values:         <uint64_t>
  *
- *      The size of the backend device, expressed in units of "sector-size".
- *      The product of "sector-size" and "sectors" must also be an integer
- *      multiple of "physical-sector-size", if that node is present.
+ *      The size of the backend device, expressed in units of 512b.  The
+ *      product of "sectors" * 512 must also be an integer multiple of
+ *      "physical-sector-size", if that node is present.
  *
  *****************************************************************************
  *                            Frontend XenBus Nodes
@@ -338,6 +342,7 @@
  * feature-large-sector-size
  *      Values:         0/1 (boolean)
  *      Default Value:  0
+ *      Notes:          DEPRECATED, 12
  *
  *      A value of "1" indicates that the frontend will correctly supply and
  *      interpret all sector-based quantities in terms of the "sector-size"
@@ -411,6 +416,11 @@
  *(10) The discard-secure property may be present and will be set to 1 if the
  *     backing device supports secure discard.
  *(11) Only used by Linux and NetBSD.
+ *(12) Possibly only ever implemented by the QEMU Qdisk backend and the Windows
+ *     PV block frontend.  Other backends and frontends supported 'sector-size'
+ *     values greater than 512 before such feature was added.  Frontends should
+ *     not expose this node, neither should backends make any decisions based
+ *     on it being exposed by the frontend.
  */
 
 /*
@@ -619,11 +629,14 @@
 #define BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST 8
 
 /*
- * NB. 'first_sect' and 'last_sect' in blkif_request_segment, as well as
- * 'sector_number' in blkif_request, blkif_request_discard and
- * blkif_request_indirect are sector-based quantities. See the description
- * of the "feature-large-sector-size" frontend xenbus node above for
- * more information.
+ * NB. 'first_sect' and 'last_sect' in blkif_request_segment are all in units
+ * of 512 bytes, despite the 'sector-size' xenstore node possibly having a
+ * value greater than 512.
+ *
+ * The value in 'first_sect' and 'last_sect' fields must be setup so that the
+ * resulting segment offset and size is aligned to the logical sector size
+ * reported by the 'sector-size' xenstore node, see 'Backend Device Properties'
+ * section.
  */
 struct blkif_request_segment {
     grant_ref_t gref;        /* reference to I/O buffer frame        */
@@ -634,6 +647,10 @@ struct blkif_request_segment {
 
 /*
  * Starting ring element for any I/O request.
+ *
+ * The 'sector_number' field is in units of 512b, despite the value of the
+ * 'sector-size' xenstore node.  Note however that the offset in
+ * 'sector_number' must be aligned to 'sector-size'.
  */
 struct blkif_request {
     uint8_t        operation;    /* BLKIF_OP_???                         */
@@ -648,6 +665,10 @@ typedef struct blkif_request blkif_request_t;
 /*
  * Cast to this structure when blkif_request.operation == BLKIF_OP_DISCARD
  * sizeof(struct blkif_request_discard) <= sizeof(struct blkif_request)
+ *
+ * The 'sector_number' field is in units of 512b, despite the value of the
+ * 'sector-size' xenstore node.  Note however that the offset in
+ * 'sector_number' must be aligned to 'sector-size'.
  */
 struct blkif_request_discard {
     uint8_t        operation;    /* BLKIF_OP_DISCARD                     */
@@ -660,6 +681,11 @@ struct blkif_request_discard {
 };
 typedef struct blkif_request_discard blkif_request_discard_t;
 
+/*
+ * The 'sector_number' field is in units of 512b, despite the value of the
+ * 'sector-size' xenstore node.  Note however that the offset in
+ * 'sector_number' must be aligned to 'sector-size'.
+ */
 struct blkif_request_indirect {
     uint8_t        operation;    /* BLKIF_OP_INDIRECT                    */
     uint8_t        indirect_op;  /* BLKIF_OP_{READ/WRITE}                */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 13:14:36 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 13:14:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802867.1213253 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5NE-0005SH-9J; Tue, 24 Sep 2024 13:14:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802867.1213253; Tue, 24 Sep 2024 13:14:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5NE-0005SA-6a; Tue, 24 Sep 2024 13:14:36 +0000
Received: by outflank-mailman (input) for mailman id 802867;
 Tue, 24 Sep 2024 13:14:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5ND-0005S2-Ei
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:14:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5ND-0007lU-Dx
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:14:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5ND-00048k-DM
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:14:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UA3coW9k5eOPxideWv25Q62ZatRrOqFGGRCXA4VJRbA=; b=kRnmlwWHOVqQ+1g/8Gk3saPcGK
	joaTeDti9vTRLmC12xnLlUaVbpdPMRbIrCL8IX/fg7dD5H4pQ/SBG4dTyWlK6OEx6E0KbsvdnjM02
	UWAUncNIrBRa6ZDIyLn0WX/85VuChQ0c3ea486NRPwxedpIImM+bFzze81VXpApDEcvA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] xen/ucode: Fix buffer under-run when parsing AMD containers
Message-Id: <E1st5ND-00048k-DM@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 13:14:35 +0000

commit 2c5f888204d988110fee9823b102f433c6212d9d
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Tue Sep 24 15:01:15 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 15:01:15 2024 +0200

    xen/ucode: Fix buffer under-run when parsing AMD containers
    
    The AMD container format has no formal spec.  It is, at best, precision
    guesswork based on AMD's prior contributions to open source projects.  The
    Equivalence Table has both an explicit length, and an expectation of having a
    NULL entry at the end.
    
    Xen was sanity checking the NULL entry, but without confirming that an entry
    was present, resulting in a read off the front of the buffer.  With some
    manual debugging/annotations this manifests as:
    
      (XEN) *** Buf ffff83204c00b19c, eq ffff83204c00b194
      (XEN) *** eq: 0c 00 00 00 44 4d 41 00 00 00 00 00 00 00 00 00 aa aa aa aa
                                ^-Actual buffer-------------------^
      (XEN) *** installed_cpu: 000c
      (XEN) microcode: Bad equivalent cpu table
      (XEN) Parsing microcode blob error -22
    
    When loaded by hypercall, the 4 bytes interpreted as installed_cpu happen to
    be the containing struct ucode_buf's len field, and luckily will be nonzero.
    
    When loaded at boot, it's possible for the access to #PF if the module happens
    to have been placed on a 2M boundary by the bootloader.  Under Linux, it will
    commonly be the end of the CPIO header.
    
    Drop the probe of the NULL entry; Nothing else cares.  A container without one
    is well formed, insofar that we can still parse it correctly.  With this
    dropped, the same container results in:
    
      (XEN) microcode: couldn't find any matching ucode in the provided blob!
    
    Fixes: 4de936a38aa9 ("x86/ucode/amd: Rework parsing logic in cpu_request_microcode()")
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a8bf14f6f331d4f428010b4277b67c33f561ed19
    master date: 2024-09-13 15:23:30 +0100
---
 xen/arch/x86/cpu/microcode/amd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index d8f7646e88..dc735ee480 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -336,8 +336,7 @@ static struct microcode_patch *cf_check cpu_request_microcode(
         if ( size < sizeof(*et) ||
              (et = buf)->type != UCODE_EQUIV_CPU_TABLE_TYPE ||
              size - sizeof(*et) < et->len ||
-             et->len % sizeof(et->eq[0]) ||
-             et->eq[(et->len / sizeof(et->eq[0])) - 1].installed_cpu )
+             et->len % sizeof(et->eq[0]) )
         {
             printk(XENLOG_ERR "microcode: Bad equivalent cpu table\n");
             error = -EINVAL;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 13:14:47 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 13:14:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802868.1213257 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5NP-0005Ue-B1; Tue, 24 Sep 2024 13:14:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802868.1213257; Tue, 24 Sep 2024 13:14:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5NP-0005UW-8E; Tue, 24 Sep 2024 13:14:47 +0000
Received: by outflank-mailman (input) for mailman id 802868;
 Tue, 24 Sep 2024 13:14:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5NN-0005UM-MX
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:14:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5NN-0007lg-Lp
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:14:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5NN-0004AM-L7
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:14:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BNqJ7cN0xQPLyFdU1Eam8kSD1O8hEDuTyQZjrq5//0U=; b=x1gHJcN4ZSs0KedSoGKF17S3ON
	duRXQpmIJ7r43ms5JaUhkGkLNm3oXIamgJiKXlAWSt3EjiZZe9Y19mi1tbGnfFBJikZJTl8dQFobI
	AXxl2TS2tShFy4/vFN/tEOAZ2ipPw+KLut37302VXCuSko2Q5c9x9cgRhXj34z90bpcQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.17] x86/vLAPIC: prevent undue recursion of vlapic_error()
Message-Id: <E1st5NN-0004AM-L7@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 13:14:45 +0000

commit 3ef9196234bd3b0da239db8f10467d9fff257377
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 15:07:47 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 15:07:47 2024 +0200

    x86/vLAPIC: prevent undue recursion of vlapic_error()
    
    With the error vector set to an illegal value, the function invoking
    vlapic_set_irq() would bring execution back here, with the non-recursive
    lock already held. Avoid the call in this case, merely further updating
    ESR (if necessary).
    
    This is XSA-462 / CVE-2024-45817.
    
    Fixes: 5f32d186a8b1 ("x86/vlapic: don't silently accept bad vectors")
    Reported-by: Federico Serafini <federico.serafini@bugseng.com>
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: c42d9ec61f6d11e25fa77bd44dd11dad1edda268
    master date: 2024-09-24 14:23:29 +0200
---
 xen/arch/x86/hvm/vlapic.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index c10d313215..3c094903a1 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -124,9 +124,24 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
     if ( (esr & errmask) != errmask )
     {
         uint32_t lvterr = vlapic_get_reg(vlapic, APIC_LVTERR);
+        bool inj = false;
 
-        vlapic_set_reg(vlapic, APIC_ESR, esr | errmask);
         if ( !(lvterr & APIC_LVT_MASKED) )
+        {
+            /*
+             * If LVTERR is unmasked and has an illegal vector, vlapic_set_irq()
+             * will end up back here.  Break the cycle by only injecting LVTERR
+             * if it will succeed, and folding in RECVILL otherwise.
+             */
+            if ( (lvterr & APIC_VECTOR_MASK) >= 16 )
+                 inj = true;
+            else
+                 errmask |= APIC_ESR_RECVILL;
+        }
+
+        vlapic_set_reg(vlapic, APIC_ESR, esr | errmask);
+
+        if ( inj )
             vlapic_set_irq(vlapic, lvterr & APIC_VECTOR_MASK, 0);
     }
     spin_unlock_irqrestore(&vlapic->esr_lock, flags);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 13:14:57 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 13:14:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.802869.1213263 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5NZ-0005XP-Do; Tue, 24 Sep 2024 13:14:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 802869.1213263; Tue, 24 Sep 2024 13:14:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1st5NZ-0005XH-9k; Tue, 24 Sep 2024 13:14:57 +0000
Received: by outflank-mailman (input) for mailman id 802869;
 Tue, 24 Sep 2024 13:14:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5NX-0005X9-UA
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:14:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5NX-0007lm-TU
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:14:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1st5NX-0004BT-Su
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 13:14:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TkBrSFEfTF8FjHFI4G1/0+Qgam2Pjp/zBZl8jFaXwLM=; b=QApPFSJNzCdinUus4RT3RmEss3
	FqWYZB4zIswv2QyBmoUhwbV7m7+1dgXn63kwhcGh57fVbP2JvBJhxUJe15TDwPSwplIO0h2OYQEe5
	T642AQo9gPonc6X3o7MjQglAAutASj9uZg42o+qoRVwj+WDcB3W8cpbYD9zRQzZumeXU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] x86/vLAPIC: prevent undue recursion of vlapic_error()
Message-Id: <E1st5NX-0004BT-Su@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 13:14:55 +0000

commit 1765a3e0d178e9faf16cb3e19dd39cf22f29eae3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 15:09:45 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 15:09:45 2024 +0200

    x86/vLAPIC: prevent undue recursion of vlapic_error()
    
    With the error vector set to an illegal value, the function invoking
    vlapic_set_irq() would bring execution back here, with the non-recursive
    lock already held. Avoid the call in this case, merely further updating
    ESR (if necessary).
    
    This is XSA-462 / CVE-2024-45817.
    
    Fixes: 5f32d186a8b1 ("x86/vlapic: don't silently accept bad vectors")
    Reported-by: Federico Serafini <federico.serafini@bugseng.com>
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: c42d9ec61f6d11e25fa77bd44dd11dad1edda268
    master date: 2024-09-24 14:23:29 +0200
---
 xen/arch/x86/hvm/vlapic.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 3d25aaff55..3e4a2726d4 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -124,9 +124,24 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
     if ( (esr & errmask) != errmask )
     {
         uint32_t lvterr = vlapic_get_reg(vlapic, APIC_LVTERR);
+        bool inj = false;
 
-        vlapic_set_reg(vlapic, APIC_ESR, esr | errmask);
         if ( !(lvterr & APIC_LVT_MASKED) )
+        {
+            /*
+             * If LVTERR is unmasked and has an illegal vector, vlapic_set_irq()
+             * will end up back here.  Break the cycle by only injecting LVTERR
+             * if it will succeed, and folding in RECVILL otherwise.
+             */
+            if ( (lvterr & APIC_VECTOR_MASK) >= 16 )
+                 inj = true;
+            else
+                 errmask |= APIC_ESR_RECVILL;
+        }
+
+        vlapic_set_reg(vlapic, APIC_ESR, esr | errmask);
+
+        if ( inj )
             vlapic_set_irq(vlapic, lvterr & APIC_VECTOR_MASK, 0);
     }
     spin_unlock_irqrestore(&vlapic->esr_lock, flags);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 18:11:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 18:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803293.1213798 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stA09-0006Km-B7; Tue, 24 Sep 2024 18:11:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803293.1213798; Tue, 24 Sep 2024 18:11:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stA09-0006Ke-8b; Tue, 24 Sep 2024 18:11:05 +0000
Received: by outflank-mailman (input) for mailman id 803293;
 Tue, 24 Sep 2024 18:11:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stA08-0006KY-6M
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 18:11:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stA08-00064T-4K
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 18:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stA08-0004M1-2b
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 18:11:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4lKlEU5AksPHifnUOsvQzH95dfM3fSnRbxoLl5BkY3A=; b=7CHbvPmfHRYzWD9WHihIh/e5zC
	iqumAZcuuti5lMPK3xvDhNk8tSv3KqV8CCgJyOo3StJQ/U7zw3g0pcPKrm89shdyeT4AgpxEOwFCe
	WiJq1Ltq/w3r0jR2fptZyPEfiuSLboheurCJtOYD617MCZJ6a1Ay8x+7GZzP0ghOb7U0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/APIC: Remove x2APIC pure cluster mode
Message-Id: <E1stA08-0004M1-2b@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 18:11:04 +0000

commit 9b0d2465c87b69f203ab11ed4da74479b4ac84f1
Author:     Matthew Barnes <matthew.barnes@cloud.com>
AuthorDate: Mon Sep 23 15:35:59 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 24 18:57:38 2024 +0100

    x86/APIC: Remove x2APIC pure cluster mode
    
    With the introduction of mixed x2APIC mode (using cluster addressing for
    IPIs and physical for external interrupts) the use of pure cluster mode
    doesn't have any benefit.
    
    Remove the mode itself, leaving only the code required for logical
    addressing when sending IPIs.
    
    Resolves: https://gitlab.com/xen-project/xen/-/issues/189
    Signed-off-by: Matthew Barnes <matthew.barnes@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 CHANGELOG.md                      |  2 ++
 docs/misc/xen-command-line.pandoc |  4 ++--
 xen/arch/x86/Kconfig              | 12 ----------
 xen/arch/x86/genapic/x2apic.c     | 50 ++++-----------------------------------
 4 files changed, 8 insertions(+), 60 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 26e7d8dd2a..46c7d38963 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - On x86:
    - Support for running on Xeon Phi processors.
    - Removed the `ucode=allow-same` command line option.
+   - Removed x2APIC Cluster Mode for external interrupts.  x2APIC Physical and
+     Mixed Modes are still available.
 
 ## [4.19.0](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.19.0) - 2024-07-29
 
diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 959cf45b55..5ce63044ad 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2842,10 +2842,10 @@ the watchdog.
 Permit use of x2apic setup for SMP environments.
 
 ### x2apic-mode (x86)
-> `= physical | cluster | mixed`
+> `= physical | mixed`
 
 > Default: `physical` if **FADT** mandates physical mode, otherwise set at
->          build time by CONFIG_X2APIC_{PHYSICAL,LOGICAL,MIXED}.
+>          build time by CONFIG_X2APIC_{PHYSICAL,MIXED}.
 
 In the case that x2apic is in use, this option switches between modes to
 address APICs in the system as interrupt destinations.
diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 62f0b5e0f4..ab862b083f 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -275,18 +275,6 @@ config X2APIC_PHYSICAL
 	  destination inter processor interrupts (IPIs) slightly slower than
 	  Logical Destination mode.
 
-config X2APIC_CLUSTER
-	bool "Cluster Destination mode"
-	help
-	  When using this mode APICs are addressed using the Cluster Logical
-	  Destination mode.
-
-	  Cluster Destination has the benefit of sending IPIs faster since
-	  multiple APICs can be targeted as destinations of a single IPI.
-	  However the vector space is shared between all CPUs on the cluster,
-	  and hence using this mode reduces the number of available vectors
-	  when compared to Physical mode.
-
 config X2APIC_MIXED
 	bool "Mixed Destination mode"
 	help
diff --git a/xen/arch/x86/genapic/x2apic.c b/xen/arch/x86/genapic/x2apic.c
index d531035fa4..c277f4f79b 100644
--- a/xen/arch/x86/genapic/x2apic.c
+++ b/xen/arch/x86/genapic/x2apic.c
@@ -63,26 +63,6 @@ static void cf_check init_apic_ldr_x2apic_cluster(void)
     cpumask_set_cpu(this_cpu, per_cpu(cluster_cpus, this_cpu));
 }
 
-static const cpumask_t *cf_check vector_allocation_cpumask_x2apic_cluster(
-    int cpu)
-{
-    return per_cpu(cluster_cpus, cpu);
-}
-
-static unsigned int cf_check cpu_mask_to_apicid_x2apic_cluster(
-    const cpumask_t *cpumask)
-{
-    unsigned int cpu = cpumask_any(cpumask);
-    unsigned int dest = per_cpu(cpu_2_logical_apicid, cpu);
-    const cpumask_t *cluster_cpus = per_cpu(cluster_cpus, cpu);
-
-    for_each_cpu ( cpu, cluster_cpus )
-        if ( cpumask_test_cpu(cpu, cpumask) )
-            dest |= per_cpu(cpu_2_logical_apicid, cpu);
-
-    return dest;
-}
-
 static void cf_check send_IPI_self_x2apic(uint8_t vector)
 {
     apic_wrmsr(APIC_SELF_IPI, vector);
@@ -169,17 +149,6 @@ static const struct genapic __initconst_cf_clobber apic_x2apic_phys = {
     .send_IPI_self = send_IPI_self_x2apic
 };
 
-static const struct genapic __initconst_cf_clobber apic_x2apic_cluster = {
-    APIC_INIT("x2apic_cluster", NULL),
-    .int_delivery_mode = dest_LowestPrio,
-    .int_dest_mode = 1 /* logical delivery */,
-    .init_apic_ldr = init_apic_ldr_x2apic_cluster,
-    .vector_allocation_cpumask = vector_allocation_cpumask_x2apic_cluster,
-    .cpu_mask_to_apicid = cpu_mask_to_apicid_x2apic_cluster,
-    .send_IPI_mask = send_IPI_mask_x2apic_cluster,
-    .send_IPI_self = send_IPI_self_x2apic
-};
-
 /*
  * Mixed x2APIC mode: use physical for external (device) interrupts, and
  * cluster for inter processor interrupts.  Such mode has the benefits of not
@@ -252,15 +221,13 @@ static int8_t __initdata x2apic_phys = -1;
 boolean_param("x2apic_phys", x2apic_phys);
 
 enum {
-   unset, physical, cluster, mixed
+   unset, physical, mixed
 } static __initdata x2apic_mode = unset;
 
 static int __init cf_check parse_x2apic_mode(const char *s)
 {
     if ( !cmdline_strcmp(s, "physical") )
         x2apic_mode = physical;
-    else if ( !cmdline_strcmp(s, "cluster") )
-        x2apic_mode = cluster;
     else if ( !cmdline_strcmp(s, "mixed") )
         x2apic_mode = mixed;
     else
@@ -274,7 +241,7 @@ const struct genapic *__init apic_x2apic_probe(void)
 {
     /* Honour the legacy cmdline setting if it's the only one provided. */
     if ( x2apic_mode == unset && x2apic_phys >= 0 )
-        x2apic_mode = x2apic_phys ? physical : cluster;
+        x2apic_mode = x2apic_phys ? physical : mixed;
 
     if ( x2apic_mode == unset )
     {
@@ -286,21 +253,12 @@ const struct genapic *__init apic_x2apic_probe(void)
         else
             x2apic_mode = IS_ENABLED(CONFIG_X2APIC_MIXED) ? mixed
                           : (IS_ENABLED(CONFIG_X2APIC_PHYSICAL) ? physical
-                                                                : cluster);
+                                                                : mixed);
     }
 
     if ( x2apic_mode == physical )
         return &apic_x2apic_phys;
 
-    if ( x2apic_mode == cluster && iommu_intremap != iommu_intremap_full )
-    {
-        printk("WARNING: x2APIC cluster mode is not supported %s interrupt remapping -"
-               " forcing mixed mode\n",
-               iommu_intremap == iommu_intremap_off ? "without"
-                                                    : "with restricted");
-        x2apic_mode = mixed;
-    }
-
     if ( !this_cpu(cluster_cpus) )
     {
         update_clusterinfo(NULL, CPU_UP_PREPARE,
@@ -309,7 +267,7 @@ const struct genapic *__init apic_x2apic_probe(void)
         register_cpu_notifier(&x2apic_cpu_nfb);
     }
 
-    return x2apic_mode == cluster ? &apic_x2apic_cluster : &apic_x2apic_mixed;
+    return &apic_x2apic_mixed;
 }
 
 void __init check_x2apic_preenabled(void)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 18:11:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 18:11:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803294.1213803 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stA0J-0006MT-Cf; Tue, 24 Sep 2024 18:11:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803294.1213803; Tue, 24 Sep 2024 18:11:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stA0J-0006MK-A1; Tue, 24 Sep 2024 18:11:15 +0000
Received: by outflank-mailman (input) for mailman id 803294;
 Tue, 24 Sep 2024 18:11:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stA0I-0006ME-8x
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 18:11:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stA0I-00064a-8A
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 18:11:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stA0I-0004Mo-6R
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 18:11:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cx3e2OvZcrtuCCdjQIwWmx8xJduUA5LU0aHRY+rUCXs=; b=arqM2d04y+JXOyy3hn4H4wQ76v
	Jtoohd7kVeBQSOwUlmDPALTuhmZW2VHBzRqUShD3uBrHFX0a6msabU3WpMtDkfTZAjWTEwnFsT+Io
	vaY9hHM4D7ekhhFwDJaRmn0ShZ1BFa0Bn0mChmZxhRslLrUqcYZiwTLdTkPsysG3d+BM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/ucode: Improve commentary for parsing AMD containers
Message-Id: <E1stA0I-0004Mo-6R@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 18:11:14 +0000

commit 0416f1f66a1e28adc53c69ca166ba2d122660c6d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Sep 13 12:20:37 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 24 18:57:38 2024 +0100

    xen/ucode: Improve commentary for parsing AMD containers
    
    Despite writing this code, it's not the easiest logic to follow.
    
    Shorten the UCODE_EQUIV_TYPE name, and provide more of an explanation of
    what's going on.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/microcode/amd.c | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index 32490c8b7d..0fe869eff1 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -52,11 +52,11 @@ struct microcode_patch {
 };
 
 #define UCODE_MAGIC                0x00414d44
-#define UCODE_EQUIV_CPU_TABLE_TYPE 0x00000000
+#define UCODE_EQUIV_TYPE           0x00000000
 #define UCODE_UCODE_TYPE           0x00000001
 
 struct container_equiv_table {
-    uint32_t type; /* UCODE_EQUIV_CPU_TABLE_TYPE */
+    uint32_t type; /* UCODE_EQUIV_TYPE */
     uint32_t len;
     struct equiv_cpu_entry eq[];
 };
@@ -335,10 +335,10 @@ static struct microcode_patch *cf_check cpu_request_microcode(
         buf  += 4;
         size -= 4;
 
-        if ( size < sizeof(*et) ||
-             (et = buf)->type != UCODE_EQUIV_CPU_TABLE_TYPE ||
-             size - sizeof(*et) < et->len ||
-             et->len % sizeof(et->eq[0]) )
+        if ( size < sizeof(*et) ||                   /* No space for header? */
+             (et = buf)->type != UCODE_EQUIV_TYPE || /* Not an Equivalence Table? */
+             size - sizeof(*et) < et->len ||         /* No space for table? */
+             et->len % sizeof(et->eq[0]) )           /* Not multiple of equiv_cpu_entry? */
         {
             printk(XENLOG_ERR "microcode: Bad equivalent cpu table\n");
             error = -EINVAL;
@@ -351,7 +351,12 @@ static struct microcode_patch *cf_check cpu_request_microcode(
 
         error = scan_equiv_cpu_table(et);
 
-        /* -ESRCH means no applicable microcode in this container. */
+        /*
+         * -ESRCH means no applicable microcode in this container.  But, there
+         * might be subsequent containers in the blob.  Skipping to the end of
+         * this container still requires us to follow the UCODE_UCODE_TYPE/len
+         * metadata because there's no overall container length given.
+         */
         if ( error && error != -ESRCH )
             break;
         skip_ucode = error;
@@ -361,10 +366,10 @@ static struct microcode_patch *cf_check cpu_request_microcode(
         {
             const struct container_microcode *mc;
 
-            if ( size < sizeof(*mc) ||
-                 (mc = buf)->type != UCODE_UCODE_TYPE ||
-                 size - sizeof(*mc) < mc->len ||
-                 mc->len < sizeof(struct microcode_patch) )
+            if ( size < sizeof(*mc) ||                      /* No space for container header? */
+                 (mc = buf)->type != UCODE_UCODE_TYPE ||    /* Not a ucode blob? */
+                 size - sizeof(*mc) < mc->len ||            /* No space for blob? */
+                 mc->len < sizeof(struct microcode_patch) ) /* No space for patch header? */
             {
                 printk(XENLOG_ERR "microcode: Bad microcode data\n");
                 error = -EINVAL;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Sep 24 18:11:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 24 Sep 2024 18:11:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803295.1213807 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stA0T-0006PW-EG; Tue, 24 Sep 2024 18:11:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803295.1213807; Tue, 24 Sep 2024 18:11:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stA0T-0006PM-BY; Tue, 24 Sep 2024 18:11:25 +0000
Received: by outflank-mailman (input) for mailman id 803295;
 Tue, 24 Sep 2024 18:11:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stA0S-0006Oz-C7
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 18:11:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stA0S-00064p-BP
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 18:11:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stA0S-0004PI-AM
 for xen-changelog@lists.xenproject.org; Tue, 24 Sep 2024 18:11:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XBD/8iCFNJNpq2Hx7joiCZZInvFtLdH4ISjiEzutbio=; b=dsYuii2ruuWXoXUK8GRWH/2pCZ
	/VXlZcN4eGdQFIwqHl6srd83jjFLfBy7Vb2l0v7EFWvlE1KwgvN6W/g5+mJxGsloa+HYAsd4Ogxhp
	6eSgtrNTqW03s8EWJIrqs2I6M6K2RTaO+BgBwWXT6WDLu33jDyfrPSz8Loe6H80gF3FU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/ucode: Make Intel's microcode_sanity_check() stricter
Message-Id: <E1stA0S-0004PI-AM@xenbits.xenproject.org>
Date: Tue, 24 Sep 2024 18:11:24 +0000

commit 8752ad83e79754f8109457cff796e5f86f644348
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Fri Sep 13 14:19:30 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 24 18:57:38 2024 +0100

    xen/ucode: Make Intel's microcode_sanity_check() stricter
    
    The SDM states that data size must be a multiple of 4, but Xen doesn't check
    this propery.
    
    This is liable to cause a later failures, but should be checked explicitly.
    
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/microcode/intel.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/intel.c b/xen/arch/x86/cpu/microcode/intel.c
index 6f69570586..bad51f6472 100644
--- a/xen/arch/x86/cpu/microcode/intel.c
+++ b/xen/arch/x86/cpu/microcode/intel.c
@@ -155,10 +155,13 @@ static int microcode_sanity_check(const struct microcode_patch *patch)
     uint32_t sum;
 
     /*
-     * Total size must be a multiple of 1024 bytes.  Data size and the header
-     * must fit within it.
+     * The SDM states:
+     * - Data size must be a multiple of 4.
+     * - Total size must be a multiple of 1024 bytes.  Data size and the
+     *   header must fit within it.
      */
     if ( (total_size & 1023) ||
+         (data_size & 3) ||
          data_size > (total_size - MC_HEADER_SIZE) )
     {
         printk(XENLOG_WARNING "microcode: Bad size\n");
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 08:00:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 08:00:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803520.1214110 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMwN-0005dr-SZ; Wed, 25 Sep 2024 08:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803520.1214110; Wed, 25 Sep 2024 08:00:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMwN-0005dh-OY; Wed, 25 Sep 2024 08:00:03 +0000
Received: by outflank-mailman (input) for mailman id 803520;
 Wed, 25 Sep 2024 08:00:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMwM-00059S-4F
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:00:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMwM-0004R6-3Q
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMwM-0003DV-2L
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:00:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ew7Ud8TjFcgCFfdCyHrfsL7fIPkZh4touNQe2ptLLzU=; b=kdyflY6EpTuFyoQB5HgLS+go28
	XNV8eCB2an419Suv9HwE7afzpxNJ5L0dzoI+BPRZkqVjQknb0sSC7xbYBpm09Vd3pN5iU3/wvKhPn
	1h0PeMrGWD0amNqVILF9GbsSBzKDnvsh7r57WIWVSfA8Jw1QFJXvnc1zS79qVqh+L7ug=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/vLAPIC: prevent undue recursion of vlapic_error()
Message-Id: <E1stMwM-0003DV-2L@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 08:00:02 +0000

commit 641b8f2a924b86ab086878b5baaf2d50ba3658f1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:49:18 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:49:18 2024 +0200

    x86/vLAPIC: prevent undue recursion of vlapic_error()
    
    With the error vector set to an illegal value, the function invoking
    vlapic_set_irq() would bring execution back here, with the non-recursive
    lock already held. Avoid the call in this case, merely further updating
    ESR (if necessary).
    
    This is XSA-462 / CVE-2024-45817.
    
    Fixes: 5f32d186a8b1 ("x86/vlapic: don't silently accept bad vectors")
    Reported-by: Federico Serafini <federico.serafini@bugseng.com>
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: c42d9ec61f6d11e25fa77bd44dd11dad1edda268
    master date: 2024-09-24 14:23:29 +0200
---
 xen/arch/x86/hvm/vlapic.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index ba569043ea..70431ba438 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -113,9 +113,24 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
     if ( (esr & errmask) != errmask )
     {
         uint32_t lvterr = vlapic_get_reg(vlapic, APIC_LVTERR);
+        bool inj = false;
 
-        vlapic_set_reg(vlapic, APIC_ESR, esr | errmask);
         if ( !(lvterr & APIC_LVT_MASKED) )
+        {
+            /*
+             * If LVTERR is unmasked and has an illegal vector, vlapic_set_irq()
+             * will end up back here.  Break the cycle by only injecting LVTERR
+             * if it will succeed, and folding in RECVILL otherwise.
+             */
+            if ( (lvterr & APIC_VECTOR_MASK) >= 16 )
+                 inj = true;
+            else
+                 errmask |= APIC_ESR_RECVILL;
+        }
+
+        vlapic_set_reg(vlapic, APIC_ESR, esr | errmask);
+
+        if ( inj )
             vlapic_set_irq(vlapic, lvterr & APIC_VECTOR_MASK, 0);
     }
     spin_unlock_irqrestore(&vlapic->esr_lock, flags);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 08:00:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 08:00:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803524.1214116 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMwX-0006NF-VV; Wed, 25 Sep 2024 08:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803524.1214116; Wed, 25 Sep 2024 08:00:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMwX-0006N7-RQ; Wed, 25 Sep 2024 08:00:13 +0000
Received: by outflank-mailman (input) for mailman id 803524;
 Wed, 25 Sep 2024 08:00:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMwW-0006Ma-7X
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:00:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMwW-0004d9-6l
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMwW-0003G3-5i
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:00:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dn/q3JGtU6XzMuieemwmAGbq3s+MxrmV1e0WmhWgpec=; b=3V8XKdUFtn/pTHYSFAz1lr5Pka
	LFtujFJrWNe/YNq20NqYanOzUcBJPt9bwCNJPrTdXtA18nfJaqx/96Xg+47Ylq4sv16QyT2M2XPoK
	1Y+DfXkRf7jdrBfbwvNeMQ6WArvx64CFxUA1VmjLpBnRQx96Ad4zEo9oG9uCUcOw34fs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] update Xen version to 4.18.4-pre
Message-Id: <E1stMwW-0003G3-5i@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 08:00:12 +0000

commit 5210dc1c303dcd36ee59ad43325f615cc1e78231
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:50:34 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:50:34 2024 +0200

    update Xen version to 4.18.4-pre
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index 56000ae82c..68b14fb356 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -6,7 +6,7 @@ this-makefile := $(call lastword,$(MAKEFILE_LIST))
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 18
-export XEN_EXTRAVERSION ?= .3$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .4-pre$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 08:00:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 08:00:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803527.1214119 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMwh-0006ay-Vo; Wed, 25 Sep 2024 08:00:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803527.1214119; Wed, 25 Sep 2024 08:00:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMwh-0006aq-Sr; Wed, 25 Sep 2024 08:00:23 +0000
Received: by outflank-mailman (input) for mailman id 803527;
 Wed, 25 Sep 2024 08:00:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMwg-0006ZF-Ad
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:00:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMwg-0004dS-9r
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMwg-0003Hb-8v
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:00:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kPycPUJlQqVKYJdg7D9zF6F9utfd4FBluUTWaVfLJkk=; b=YuXuda7qPtsMp7B5WIgt3aIGSV
	ysp6W2OJfkxbmiFozpt8repR0UfD9tZFliERrwqHR1+AjpIpA2eXRf8PI6nF9fiqJJw6NWx2l/TVB
	qzVVrVF9tRClzOu7YBQyoemlEsxTXb1r4XcSrXZnzUdwTBS5GRoPjObhLvlS3UsykOUk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/hvm: Fix Misra Rule 19.1 regression
Message-Id: <E1stMwg-0003Hb-8v@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 08:00:22 +0000

commit 6c2827e1330ecf37756391f2e080494e9b0076d4
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 24 14:51:24 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:51:24 2024 +0200

    x86/hvm: Fix Misra Rule 19.1 regression
    
    Despite noticing an impending Rule 19.1 violation, the adjustment made (the
    uint32_t cast) wasn't sufficient to avoid it.  Try again.
    
    Subsequently noticed by Coverity too.
    
    Fixes: 6a98383b0877 ("x86/HVM: clear upper halves of GPRs upon entry from 32-bit code")
    Coverity-IDs: 1596289 thru 1596298
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    master commit: d0a718a45f14b86471d8eb3083acd72760963470
    master date: 2024-04-11 13:23:08 +0100
---
 xen/arch/x86/include/asm/hvm/hvm.h | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index e5fa682f85..fd390cefe1 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -585,16 +585,16 @@ static inline void hvm_sanitize_regs_fields(struct cpu_user_regs *regs,
     if ( compat )
     {
         /* Clear GPR upper halves, to counteract guests playing games. */
-        regs->rbp = (uint32_t)regs->ebp;
-        regs->rbx = (uint32_t)regs->ebx;
-        regs->rax = (uint32_t)regs->eax;
-        regs->rcx = (uint32_t)regs->ecx;
-        regs->rdx = (uint32_t)regs->edx;
-        regs->rsi = (uint32_t)regs->esi;
-        regs->rdi = (uint32_t)regs->edi;
-        regs->rip = (uint32_t)regs->eip;
-        regs->rflags = (uint32_t)regs->eflags;
-        regs->rsp = (uint32_t)regs->esp;
+        regs->rbp = (uint32_t)regs->rbp;
+        regs->rbx = (uint32_t)regs->rbx;
+        regs->rax = (uint32_t)regs->rax;
+        regs->rcx = (uint32_t)regs->rcx;
+        regs->rdx = (uint32_t)regs->rdx;
+        regs->rsi = (uint32_t)regs->rsi;
+        regs->rdi = (uint32_t)regs->rdi;
+        regs->rip = (uint32_t)regs->rip;
+        regs->rflags = (uint32_t)regs->rflags;
+        regs->rsp = (uint32_t)regs->rsp;
     }
 
 #ifndef NDEBUG
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 08:00:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 08:00:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803528.1214123 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMws-0006f2-2F; Wed, 25 Sep 2024 08:00:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803528.1214123; Wed, 25 Sep 2024 08:00:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMwr-0006eu-Vq; Wed, 25 Sep 2024 08:00:33 +0000
Received: by outflank-mailman (input) for mailman id 803528;
 Wed, 25 Sep 2024 08:00:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMwq-0006eZ-Dx
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:00:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMwq-0004dZ-Cr
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMwq-0003KX-C1
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:00:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5CiALMxXb22XCS32zO0Q84skQ8OPQjI+mf6WmJ3S/bs=; b=DHqleQEWhFTIKZljG6legWxecF
	bCg8xaapA8GP4AqY0S/bkYQG46T8lIFgeT8BfE+JCBqv2WFFKWPMb4BiGeFlYcJDbhlC+3ZdrkDph
	llFjzNT5uriAJMIL3X4tuZ35jcN64e9wshfGHeWCJVG/scilOSkQwijo1mX8hhR4kQgQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] Arm: correct FIXADDR_TOP
Message-Id: <E1stMwq-0003KX-C1@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 08:00:32 +0000

commit 87d2cdd51327ab001d3cb68a714260f54bafba41
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:52:15 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:52:15 2024 +0200

    Arm: correct FIXADDR_TOP
    
    While reviewing a RISC-V patch cloning the Arm code, I noticed an
    off-by-1 here: FIX_PMAP_{BEGIN,END} being an inclusive range and
    FIX_LAST being the same as FIX_PMAP_END, FIXADDR_TOP cannot derive from
    FIX_LAST alone, or else the BUG_ON() in virt_to_fix() would trigger if
    FIX_PMAP_END ended up being used.
    
    While touching this area also add a check for fixmap and boot FDT area
    to not only not overlap, but to have at least one (unmapped) page in
    between.
    
    Fixes: 4f17357b52f6 ("xen/arm: add Persistent Map (PMAP) infrastructure")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    master commit: fe3412ab83cc53c2bf2c497be3794bc09751efa5
    master date: 2024-08-13 21:50:55 +0100
---
 xen/arch/arm/include/asm/fixmap.h | 2 +-
 xen/arch/arm/mm.c                 | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/include/asm/fixmap.h b/xen/arch/arm/include/asm/fixmap.h
index 734eb9b1d4..c92594c438 100644
--- a/xen/arch/arm/include/asm/fixmap.h
+++ b/xen/arch/arm/include/asm/fixmap.h
@@ -18,7 +18,7 @@
 #define FIXMAP_LAST FIXMAP_PMAP_END
 
 #define FIXADDR_START FIXMAP_ADDR(0)
-#define FIXADDR_TOP FIXMAP_ADDR(FIXMAP_LAST)
+#define FIXADDR_TOP FIXMAP_ADDR(FIXMAP_LAST + 1)
 
 #ifndef __ASSEMBLY__
 
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index c34cc94c90..1ff67ff2b5 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -198,6 +198,12 @@ static void __init __maybe_unused build_assertions(void)
 
 #undef CHECK_SAME_SLOT
 #undef CHECK_DIFFERENT_SLOT
+
+    /*
+     * Fixmaps must not overlap with boot FDT mapping area. Make sure there's
+     * at least one guard page in between.
+     */
+    BUILD_BUG_ON(FIXADDR_TOP >= BOOT_FDT_VIRT_START);
 }
 
 static lpae_t *xen_map_table(mfn_t mfn)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 08:00:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 08:00:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803530.1214126 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMx2-0006jb-3p; Wed, 25 Sep 2024 08:00:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803530.1214126; Wed, 25 Sep 2024 08:00:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMx2-0006jT-11; Wed, 25 Sep 2024 08:00:44 +0000
Received: by outflank-mailman (input) for mailman id 803530;
 Wed, 25 Sep 2024 08:00:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMx0-0006jB-GX
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:00:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMx0-0004dw-Fn
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMx0-0003Lr-Eu
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:00:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BXnm4vBpJ2ytF04SnUkeV/McutX6FEgZjQZ3gqp+pWk=; b=pWtmB/oOiAs2r40QlDUIsTLjI2
	PX4MPJIrlHDMDE1KkN+UmIM1lIagUeD32e4baLd4M+kcTYOw1/PoP0SAEoXyIeDJ4uCj1C6tafCYN
	rLdS0wDwWU9P+oGT7S1YmrdPhbIPLZrV1wA+GOJv5ry/uGSeh7flEX2flY5fqEQQNYj0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] xl: fix incorrect output in "help" command
Message-Id: <E1stMx0-0003Lr-Eu@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 08:00:42 +0000

commit 0d5f15e6face071c628bd569957d11ced887b42f
Author:     John E. Krokes <mag@netherworld.org>
AuthorDate: Tue Sep 24 14:52:42 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:52:42 2024 +0200

    xl: fix incorrect output in "help" command
    
    In "xl help", the output includes this line:
    
     vsnd-list           List virtual display devices for a domain
    
    This should obviously say "sound devices" instead of "display devices".
    
    Signed-off-by: John E. Krokes <mag@netherworld.org>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: 09226d165b57d919150458044c5b594d3d1dc23a
    master date: 2024-08-14 08:49:44 +0200
---
 tools/xl/xl_cmdtable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c
index 62bdb2aeaa..5843590794 100644
--- a/tools/xl/xl_cmdtable.c
+++ b/tools/xl/xl_cmdtable.c
@@ -433,7 +433,7 @@ const struct cmd_spec cmd_table[] = {
     },
     { "vsnd-list",
       &main_vsndlist, 0, 0,
-      "List virtual display devices for a domain",
+      "List virtual sound devices for a domain",
       "<Domain(s)>",
     },
     { "vsnd-detach",
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 08:00:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 08:00:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803531.1214131 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMxC-0006nB-5j; Wed, 25 Sep 2024 08:00:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803531.1214131; Wed, 25 Sep 2024 08:00:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMxC-0006my-2e; Wed, 25 Sep 2024 08:00:54 +0000
Received: by outflank-mailman (input) for mailman id 803531;
 Wed, 25 Sep 2024 08:00:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMxA-0006mh-Jr
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:00:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMxA-0004e8-J5
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:00:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMxA-0003Mw-I2
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:00:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uUQTToIH5QVzqf2YmH/1o7EaQx7J32fPZfwWuwfIgyI=; b=zETVxUY+zkMcq1QYjxeXUwzIdO
	o6tm22O4F8kUXYQ0VYA4PomvWA3146hTgPSDIOgY6XeQXeO/STUCB4Z2/giJ3tcc2Bn/ZkqnrgeNv
	XP2KZSQYPwDD1pPpH2nUiMT/PNxi4sNsddkXHe57Q3lQqwljUu3yLT8Ba7CcfYYJd/jk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/pv: Introduce x86_merge_dr6() and fix do_debug()
Message-Id: <E1stMxA-0003Mw-I2@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 08:00:52 +0000

commit d32c77f471fb8400b6512c171a14cdd58f04f0a3
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 24 14:53:22 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:53:22 2024 +0200

    x86/pv: Introduce x86_merge_dr6() and fix do_debug()
    
    Pretty much everywhere in Xen the logic to update %dr6 when injecting #DB is
    buggy.  Introduce a new x86_merge_dr6() helper, and start fixing the mess by
    adjusting the dr6 merge in do_debug().  Also correct the comment.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 54ef601a66e8d812a6a6a308f02524e81201825e
    master date: 2024-08-21 23:59:19 +0100
---
 xen/arch/x86/debug.c                 | 40 ++++++++++++++++++++++++++++++++++++
 xen/arch/x86/include/asm/debugreg.h  |  7 +++++++
 xen/arch/x86/include/asm/x86-defns.h |  7 +++++++
 xen/arch/x86/traps.c                 | 11 +++++++---
 4 files changed, 62 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/debug.c b/xen/arch/x86/debug.c
index 127fe83021..b10f1f12b6 100644
--- a/xen/arch/x86/debug.c
+++ b/xen/arch/x86/debug.c
@@ -2,12 +2,52 @@
 /*
  * Copyright (C) 2023 XenServer.
  */
+#include <xen/bug.h>
 #include <xen/kernel.h>
 
 #include <xen/lib/x86/cpu-policy.h>
 
 #include <asm/debugreg.h>
 
+/*
+ * Merge new bits into dr6.  'new' is always given in positive polarity,
+ * matching the Intel VMCS PENDING_DBG semantics.
+ *
+ * At the time of writing (August 2024), on the subject of %dr6 updates the
+ * manuals are either vague (Intel "certain exceptions may clear bits 0-3"),
+ * or disputed (AMD makes statements which don't match observed behaviour).
+ *
+ * The only debug exception I can find which doesn't clear the breakpoint bits
+ * is ICEBP(/INT1) on AMD systems.  This is also the one source of #DB that
+ * doesn't have an explicit status bit, meaning we can't easily identify this
+ * case either (AMD systems don't virtualise PENDING_DBG and only provide a
+ * post-merge %dr6 value).
+ *
+ * Treat %dr6 merging as unconditionally writing the breakpoint bits.
+ *
+ * We can't really manage any better, and guest kernels handling #DB as
+ * instructed by the SDM/APM (i.e. reading %dr6 then resetting it back to
+ * default) wont notice.
+ */
+unsigned int x86_merge_dr6(const struct cpu_policy *p, unsigned int dr6,
+                           unsigned int new)
+{
+    /* Flip dr6 to have positive polarity. */
+    dr6 ^= X86_DR6_DEFAULT;
+
+    /* Sanity check that only known values are passed in. */
+    ASSERT(!(dr6 & ~X86_DR6_KNOWN_MASK));
+    ASSERT(!(new & ~X86_DR6_KNOWN_MASK));
+
+    /* Breakpoint bits overridden.  All others accumulate. */
+    dr6 = (dr6 & ~X86_DR6_BP_MASK) | new;
+
+    /* Flip dr6 back to having default polarity. */
+    dr6 ^= X86_DR6_DEFAULT;
+
+    return x86_adj_dr6_rsvd(p, dr6);
+}
+
 unsigned int x86_adj_dr6_rsvd(const struct cpu_policy *p, unsigned int dr6)
 {
     unsigned int ones = X86_DR6_DEFAULT;
diff --git a/xen/arch/x86/include/asm/debugreg.h b/xen/arch/x86/include/asm/debugreg.h
index b6454cc04e..c1945e542e 100644
--- a/xen/arch/x86/include/asm/debugreg.h
+++ b/xen/arch/x86/include/asm/debugreg.h
@@ -108,4 +108,11 @@ struct cpu_policy;
 unsigned int x86_adj_dr6_rsvd(const struct cpu_policy *p, unsigned int dr6);
 unsigned int x86_adj_dr7_rsvd(const struct cpu_policy *p, unsigned int dr7);
 
+/*
+ * Merge new bits into dr6.  'new' is always given in positive polarity,
+ * matching the Intel VMCS PENDING_DBG semantics.
+ */
+unsigned int x86_merge_dr6(const struct cpu_policy *p, unsigned int dr6,
+                           unsigned int new);
+
 #endif /* _X86_DEBUGREG_H */
diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index 5838631ef6..4e4737d56c 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -119,6 +119,13 @@
 #define X86_DR6_ZEROS           _AC(0x00001000, UL)  /* %dr6 bits forced to 0       */
 #define X86_DR6_DEFAULT         _AC(0xffff0ff0, UL)  /* Default %dr6 value          */
 
+#define X86_DR6_BP_MASK                                 \
+    (X86_DR6_B0 | X86_DR6_B1 | X86_DR6_B2 | X86_DR6_B3)
+
+#define X86_DR6_KNOWN_MASK                                              \
+    (X86_DR6_BP_MASK | X86_DR6_BLD | X86_DR6_BD | X86_DR6_BS |          \
+     X86_DR6_BT | X86_DR6_RTM)
+
 /*
  * Debug control flags in DR7.
  */
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 45e1b277ea..9d72ebce55 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2049,9 +2049,14 @@ void do_debug(struct cpu_user_regs *regs)
         return;
     }
 
-    /* Save debug status register where guest OS can peek at it */
-    v->arch.dr6 |= (dr6 & ~X86_DR6_DEFAULT);
-    v->arch.dr6 &= (dr6 | ~X86_DR6_DEFAULT);
+    /*
+     * Update the guest's dr6 so the debugger can peek at it.
+     *
+     * TODO: This should be passed out-of-band, so guest state is not modified
+     * by debugging actions completed behind it's back.
+     */
+    v->arch.dr6 = x86_merge_dr6(v->domain->arch.cpu_policy,
+                                v->arch.dr6, dr6 ^ X86_DR6_DEFAULT);
 
     if ( guest_kernel_mode(v, regs) && v->domain->debugger_attached )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 08:01:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 08:01:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803532.1214135 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMxM-0006qG-6w; Wed, 25 Sep 2024 08:01:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803532.1214135; Wed, 25 Sep 2024 08:01:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMxM-0006q8-4D; Wed, 25 Sep 2024 08:01:04 +0000
Received: by outflank-mailman (input) for mailman id 803532;
 Wed, 25 Sep 2024 08:01:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMxK-0006pt-N3
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:01:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMxK-0004eY-MK
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:01:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMxK-0003OL-LW
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:01:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=i8nry3ypXFh2/Alb+gI+IIor+h4Wlq5nFSdpmJJtAVM=; b=hOOSE2E0lZVkbkV4Lrn9qi/Uka
	s2YJb6QAyIG4kA+hiTeDmcZui62HVs1tjyD3JbFG4+nTBe4S9qISe0Yq+84oTr3cox+QcATDSqOfh
	o6gFOnIQDY6vI52klm2lc0DrQ+XApK+bj5PYq1zzsq/7VM3D+iJEH7ac9WLunSXj2oA0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/pv: Fix merging of new status bits into %dr6
Message-Id: <E1stMxK-0003OL-LW@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 08:01:02 +0000

commit cecee35dd426bb49daf0b58dcf6966024fdc0f0c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 24 14:53:59 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:53:59 2024 +0200

    x86/pv: Fix merging of new status bits into %dr6
    
    All #DB exceptions result in an update of %dr6, but this isn't captured in
    Xen's handling, and is buggy just about everywhere.
    
    To begin resolving this issue, add a new pending_dbg field to x86_event
    (unioned with cr2 to avoid taking any extra space, adjusting users to avoid
    old-GCC bugs with anonymous unions), and introduce pv_inject_DB() to replace
    the current callers using pv_inject_hw_exception().
    
    Push the adjustment of v->arch.dr6 into pv_inject_event(), and use the new
    x86_merge_dr6() rather than the current incorrect logic.
    
    A key property is that pending_dbg is taken with positive polarity to deal
    with RTM/BLD sensibly.  Most callers pass in a constant, but callers passing
    in a hardware %dr6 value need to XOR the value with X86_DR6_DEFAULT to flip to
    positive polarity.
    
    This fixes the behaviour of the breakpoint status bits; that any left pending
    are generally discarded when a new #DB is raised.  In principle it would fix
    RTM/BLD too, except PV guests can't turn these capabilities on to start with.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: db39fa4b27ea470902d4625567cb6fa24030ddfa
    master date: 2024-08-21 23:59:19 +0100
---
 xen/arch/x86/include/asm/domain.h      | 18 ++++++++++++++++--
 xen/arch/x86/include/asm/hvm/hvm.h     |  3 ++-
 xen/arch/x86/pv/emul-priv-op.c         |  5 +----
 xen/arch/x86/pv/emulate.c              |  9 +++++++--
 xen/arch/x86/pv/ro-page-fault.c        |  2 +-
 xen/arch/x86/pv/traps.c                | 16 ++++++++++++----
 xen/arch/x86/traps.c                   |  2 +-
 xen/arch/x86/x86_emulate/x86_emulate.h |  5 ++++-
 8 files changed, 44 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index 237510fed3..53876472fe 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -732,15 +732,29 @@ static inline void pv_inject_hw_exception(unsigned int vector, int errcode)
     pv_inject_event(&event);
 }
 
+static inline void pv_inject_DB(unsigned long pending_dbg)
+{
+    struct x86_event event = {
+        .vector      = X86_EXC_DB,
+        .type        = X86_EVENTTYPE_HW_EXCEPTION,
+        .error_code  = X86_EVENT_NO_EC,
+    };
+
+    event.pending_dbg = pending_dbg;
+
+    pv_inject_event(&event);
+}
+
 static inline void pv_inject_page_fault(int errcode, unsigned long cr2)
 {
-    const struct x86_event event = {
+    struct x86_event event = {
         .vector = X86_EXC_PF,
         .type = X86_EVENTTYPE_HW_EXCEPTION,
         .error_code = errcode,
-        .cr2 = cr2,
     };
 
+    event.cr2 = cr2;
+
     pv_inject_event(&event);
 }
 
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index fd390cefe1..f15d38e8bf 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -532,9 +532,10 @@ static inline void hvm_inject_page_fault(int errcode, unsigned long cr2)
         .vector = X86_EXC_PF,
         .type = X86_EVENTTYPE_HW_EXCEPTION,
         .error_code = errcode,
-        .cr2 = cr2,
     };
 
+    event.cr2 = cr2;
+
     hvm_inject_event(&event);
 }
 
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index aa11ecadaa..15c83b9d23 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -1366,10 +1366,7 @@ int pv_emulate_privileged_op(struct cpu_user_regs *regs)
             ctxt.bpmatch |= DR_STEP;
 
         if ( ctxt.bpmatch )
-        {
-            curr->arch.dr6 |= ctxt.bpmatch | DR_STATUS_RESERVED_ONE;
-            pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
-        }
+            pv_inject_DB(ctxt.bpmatch);
 
         /* fall through */
     case X86EMUL_RETRY:
diff --git a/xen/arch/x86/pv/emulate.c b/xen/arch/x86/pv/emulate.c
index e7a1c0a2cc..8c44dea123 100644
--- a/xen/arch/x86/pv/emulate.c
+++ b/xen/arch/x86/pv/emulate.c
@@ -71,10 +71,15 @@ void pv_emul_instruction_done(struct cpu_user_regs *regs, unsigned long rip)
 {
     regs->rip = rip;
     regs->eflags &= ~X86_EFLAGS_RF;
+
     if ( regs->eflags & X86_EFLAGS_TF )
     {
-        current->arch.dr6 |= DR_STEP | DR_STATUS_RESERVED_ONE;
-        pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
+        /*
+         * TODO: this should generally use TF from the start of the
+         * instruction.  It's only a latent bug for now, as this path isn't
+         * used for any instruction which modifies eflags.
+         */
+        pv_inject_DB(X86_DR6_BS);
     }
 }
 
diff --git a/xen/arch/x86/pv/ro-page-fault.c b/xen/arch/x86/pv/ro-page-fault.c
index cad28ef928..d0fe07e3a1 100644
--- a/xen/arch/x86/pv/ro-page-fault.c
+++ b/xen/arch/x86/pv/ro-page-fault.c
@@ -390,7 +390,7 @@ int pv_ro_page_fault(unsigned long addr, struct cpu_user_regs *regs)
         /* Fallthrough */
     case X86EMUL_OKAY:
         if ( ctxt.retire.singlestep )
-            pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
+            pv_inject_DB(X86_DR6_BS);
 
         /* Fallthrough */
     case X86EMUL_RETRY:
diff --git a/xen/arch/x86/pv/traps.c b/xen/arch/x86/pv/traps.c
index 240d1a2db7..3d499eb3b0 100644
--- a/xen/arch/x86/pv/traps.c
+++ b/xen/arch/x86/pv/traps.c
@@ -12,6 +12,7 @@
 #include <xen/lib.h>
 #include <xen/softirq.h>
 
+#include <asm/debugreg.h>
 #include <asm/pv/trace.h>
 #include <asm/shared.h>
 #include <asm/traps.h>
@@ -50,9 +51,9 @@ void pv_inject_event(const struct x86_event *event)
     tb->cs    = ti->cs;
     tb->eip   = ti->address;
 
-    if ( event->type == X86_EVENTTYPE_HW_EXCEPTION &&
-         vector == X86_EXC_PF )
+    switch ( vector | -(event->type == X86_EVENTTYPE_SW_INTERRUPT) )
     {
+    case X86_EXC_PF:
         curr->arch.pv.ctrlreg[2] = event->cr2;
         arch_set_cr2(curr, event->cr2);
 
@@ -62,9 +63,16 @@ void pv_inject_event(const struct x86_event *event)
             error_code |= PFEC_user_mode;
 
         trace_pv_page_fault(event->cr2, error_code);
-    }
-    else
+        break;
+
+    case X86_EXC_DB:
+        curr->arch.dr6 = x86_merge_dr6(curr->domain->arch.cpu_policy,
+                                       curr->arch.dr6, event->pending_dbg);
+        fallthrough;
+    default:
         trace_pv_trap(vector, regs->rip, use_error_code, error_code);
+        break;
+    }
 
     if ( use_error_code )
     {
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 9d72ebce55..abd3019976 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2064,7 +2064,7 @@ void do_debug(struct cpu_user_regs *regs)
         return;
     }
 
-    pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
+    pv_inject_DB(0 /* N/A, already merged */);
 }
 
 /* SAF-1-safe */
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.h b/xen/arch/x86/x86_emulate/x86_emulate.h
index 698750267a..e348e3c1d3 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.h
+++ b/xen/arch/x86/x86_emulate/x86_emulate.h
@@ -78,7 +78,10 @@ struct x86_event {
     uint8_t       type;         /* X86_EVENTTYPE_* */
     uint8_t       insn_len;     /* Instruction length */
     int32_t       error_code;   /* X86_EVENT_NO_EC if n/a */
-    unsigned long cr2;          /* Only for X86_EXC_PF h/w exception */
+    union {
+        unsigned long cr2;         /* #PF */
+        unsigned long pending_dbg; /* #DB (new DR6 bits, positive polarity) */
+    };
 };
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 08:01:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 08:01:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803533.1214138 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMxW-0006t6-8F; Wed, 25 Sep 2024 08:01:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803533.1214138; Wed, 25 Sep 2024 08:01:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMxW-0006sy-5c; Wed, 25 Sep 2024 08:01:14 +0000
Received: by outflank-mailman (input) for mailman id 803533;
 Wed, 25 Sep 2024 08:01:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMxU-0006sm-Pv
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:01:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMxU-0004ej-PE
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:01:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMxU-0003PK-OV
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:01:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6fEZrTZuNF9zoW/SwJcIZJlNs28/rc0HvIoADi5DIaQ=; b=ob0iyxnpZN1D/gagLOJ5iaNzhO
	ZPvDGp6UyxCLTKx7iaWRmfYaDz+mzgbLL4FMjnmZgyuMrmK+z0hKNZIiGXto1ofipZFvVvU78GjFH
	CF0RWFnru3qihxqDMGRRcB0isreRdD88rQJ3fiQdJELrUqrUa8IhfiIX7cX9RRiC7aBU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/pv: Address Coverity complaint in check_guest_io_breakpoint()
Message-Id: <E1stMxU-0003PK-OV@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 08:01:12 +0000

commit 774d27c807dc5464a945a3242c5d1e8c6f723ab1
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 24 14:54:35 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:54:35 2024 +0200

    x86/pv: Address Coverity complaint in check_guest_io_breakpoint()
    
    Commit 08aacc392d86 ("x86/emul: Fix misaligned IO breakpoint behaviour in PV
    guests") caused a Coverity INTEGER_OVERFLOW complaint based on the reasoning
    that width could be 0.
    
    It can't, but digging into the code generation, GCC 8 and later (bisected on
    godbolt) choose to emit a CSWITCH lookup table, and because the range (bottom
    2 bits clear), it's a 16-entry lookup table.
    
    So Coverity is understandable, given that GCC did emit a (dead) logic path
    where width stayed 0.
    
    Rewrite the logic.  Introduce x86_bp_width() which compiles to a single basic
    block, which replaces the switch() statement.  Take the opportunity to also
    make start and width be loop-scope variables.
    
    No practical change, but it should compile better and placate Coverity.
    
    Fixes: 08aacc392d86 ("x86/emul: Fix misaligned IO breakpoint behaviour in PV guests")
    Coverity-ID: 1616152
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 6d41a9d8a12ff89adabdc286e63e9391a0481699
    master date: 2024-08-21 23:59:19 +0100
---
 xen/arch/x86/include/asm/debugreg.h | 25 +++++++++++++++++++++++++
 xen/arch/x86/pv/emul-priv-op.c      | 21 ++++++---------------
 2 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/include/asm/debugreg.h b/xen/arch/x86/include/asm/debugreg.h
index c1945e542e..ed32f42a38 100644
--- a/xen/arch/x86/include/asm/debugreg.h
+++ b/xen/arch/x86/include/asm/debugreg.h
@@ -115,4 +115,29 @@ unsigned int x86_adj_dr7_rsvd(const struct cpu_policy *p, unsigned int dr7);
 unsigned int x86_merge_dr6(const struct cpu_policy *p, unsigned int dr6,
                            unsigned int new);
 
+/*
+ * Calculate the width of a breakpoint from its dr7 encoding.
+ *
+ * The LEN encoding in dr7 is 2 bits wide per breakpoint and encoded as a X-1
+ * (0, 1 and 3) for widths of 1, 2 and 4 respectively in the 32bit days.
+ *
+ * In 64bit, the unused value (2) was given a meaning of width 8, which is
+ * great for efficiency but less great for nicely calculating the width.
+ */
+static inline unsigned int x86_bp_width(unsigned int dr7, unsigned int bp)
+{
+    unsigned int raw = (dr7 >> (DR_CONTROL_SHIFT +
+                                DR_CONTROL_SIZE * bp + 2)) & 3;
+
+    /*
+     * If the top bit is set (i.e. we've got an 4 or 8 byte wide breakpoint),
+     * flip the bottom to reverse their order, making them sorted properly.
+     * Then it's a simple shift to calculate the width.
+     */
+    if ( raw & 2 )
+        raw ^= 1;
+
+    return 1U << raw;
+}
+
 #endif /* _X86_DEBUGREG_H */
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 15c83b9d23..b90f745c75 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -323,30 +323,21 @@ static unsigned int check_guest_io_breakpoint(struct vcpu *v,
                                               unsigned int port,
                                               unsigned int len)
 {
-    unsigned int width, i, match = 0;
-    unsigned long start;
+    unsigned int i, match = 0;
 
     if ( !v->arch.pv.dr7_emul || !(v->arch.pv.ctrlreg[4] & X86_CR4_DE) )
         return 0;
 
     for ( i = 0; i < 4; i++ )
     {
+        unsigned long start;
+        unsigned int width;
+
         if ( !(v->arch.pv.dr7_emul & (3 << (i * DR_ENABLE_SIZE))) )
             continue;
 
-        start = v->arch.dr[i];
-        width = 0;
-
-        switch ( (v->arch.dr7 >>
-                  (DR_CONTROL_SHIFT + i * DR_CONTROL_SIZE)) & 0xc )
-        {
-        case DR_LEN_1: width = 1; break;
-        case DR_LEN_2: width = 2; break;
-        case DR_LEN_4: width = 4; break;
-        case DR_LEN_8: width = 8; break;
-        }
-
-        start &= ~(width - 1UL);
+        width = x86_bp_width(v->arch.dr7, i);
+        start = v->arch.dr[i] & ~(width - 1UL);
 
         if ( (start < (port + len)) && ((start + width) > port) )
             match |= 1u << i;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 08:01:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 08:01:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803534.1214143 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMxg-0006wx-Bu; Wed, 25 Sep 2024 08:01:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803534.1214143; Wed, 25 Sep 2024 08:01:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMxg-0006wp-9A; Wed, 25 Sep 2024 08:01:24 +0000
Received: by outflank-mailman (input) for mailman id 803534;
 Wed, 25 Sep 2024 08:01:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMxe-0006wd-T8
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:01:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMxe-0004en-ST
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:01:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMxe-0003QP-Ri
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:01:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2BCMVjMdA+b/QgDBLYrr9JkJLSTIeFvrRIPsD053ROI=; b=qntKyMU6sS3p8ezV7aKEYJIJ3z
	3aUyynoAuMqTvzvomeRzkKH2lcurdu1GgAwqjvyJ7lWMRtbohXQE6le7LxmbhQ5mNkuwB894b0Y+S
	tOlPP1OX1f0rQ6HZuIwglSjX5reZnN4Fg1EairXF8tmRYlTagPeBwdi9k7ylsTJYMMKs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86emul: always set operand size for AVX-VNNI-INT8 insns
Message-Id: <E1stMxe-0003QP-Ri@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 08:01:22 +0000

commit 1024fc729398131d62bec368553f6d69432c31cb
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:55:11 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:55:11 2024 +0200

    x86emul: always set operand size for AVX-VNNI-INT8 insns
    
    Unlike for AVX-VNNI-INT16 I failed to notice that op_bytes may still be
    zero when reaching the respective case block: With the ext0f38_table[]
    entries having simd_packed_int, the defaulting at the bottom of
    x86emul_decode() won't set the field to non-zero for F3- or F2-prefixed
    insns.
    
    Fixes: 842acaa743a5 ("x86emul: support AVX-VNNI-INT8")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: d45687cca2450bfebe1dfbddb22f4f03c6fbc9cb
    master date: 2024-08-23 09:11:15 +0200
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index d6b60f0539..941941ef15 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -6075,6 +6075,7 @@ x86_emulate(
     case X86EMUL_OPC_VEX_F2(0x0f38, 0x51): /* vpdpbssds [xy]mm/mem,[xy]mm,[xy]mm */
         host_and_vcpu_must_have(avx_vnni_int8);
         generate_exception_if(vex.w, X86_EXC_UD);
+        op_bytes = 16 << vex.l;
         goto simd_0f_ymm;
 
     case X86EMUL_OPC_VEX_66(0x0f38, 0x50): /* vpdpbusd [xy]mm/mem,[xy]mm,[xy]mm */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 08:01:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 08:01:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803535.1214147 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMxq-000703-DJ; Wed, 25 Sep 2024 08:01:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803535.1214147; Wed, 25 Sep 2024 08:01:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMxq-0006zv-AX; Wed, 25 Sep 2024 08:01:34 +0000
Received: by outflank-mailman (input) for mailman id 803535;
 Wed, 25 Sep 2024 08:01:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMxo-0006ze-WF
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:01:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMxo-0004eu-Vc
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:01:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMxo-0003RQ-Us
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:01:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cN3nznO4WVN+cklDExWCiPWTk9RrTlYJVZ4mOZIorjc=; b=OQa3/OIiqI7Ac9n4A0dUqmXiF5
	iDgTQpqDWobif3tvdkqXEjCmCTzJSyfLMnSq/xpdcuV5QVnl+N4HRRk1NU/cnMBUxg0S/R3r+/YJV
	9H0rv7lLVk/HjaEoUgYfJ4sdmzg2nYBEOqxA1pxe/9IZVUYGxhPIbhQF3o0dZY7D5YVY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86emul: set (fake) operand size for AVX512CD broadcast insns
Message-Id: <E1stMxo-0003RQ-Us@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 08:01:32 +0000

commit 092d673dcba9262ae3da0459d5e6aa4ddd68f966
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:55:48 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:55:48 2024 +0200

    x86emul: set (fake) operand size for AVX512CD broadcast insns
    
    Back at the time I failed to pay attention to op_bytes still being zero
    when reaching the respective case block: With the ext0f38_table[]
    entries having simd_packed_int, the defaulting at the bottom of
    x86emul_decode() won't set the field to non-zero for F3-prefixed insns.
    
    Fixes: 37ccca740c26 ("x86emul: support AVX512CD insns")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 6fa6b7feaafd622db3a2f3436750cf07782f4c12
    master date: 2024-08-23 09:12:24 +0200
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 941941ef15..9d70de1eb4 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -5928,6 +5928,7 @@ x86_emulate(
                                evex.w == ((b >> 4) & 1)),
                               X86_EXC_UD);
         d |= TwoOp;
+        op_bytes = 1; /* fake */
         /* fall through */
     case X86EMUL_OPC_EVEX_66(0x0f38, 0xc4): /* vpconflict{d,q} [xyz]mm/mem,[xyz]mm{k} */
         fault_suppression = false;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 08:01:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 08:01:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803536.1214150 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMy0-00072a-EQ; Wed, 25 Sep 2024 08:01:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803536.1214150; Wed, 25 Sep 2024 08:01:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMy0-00072T-C1; Wed, 25 Sep 2024 08:01:44 +0000
Received: by outflank-mailman (input) for mailman id 803536;
 Wed, 25 Sep 2024 08:01:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMxz-00072L-2w
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:01:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMxz-0004fH-2F
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:01:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMxz-0003SB-1Q
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:01:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=isXQmE6IEmudbRRr9IyXapFme8fK4i7cJh0t6XIZP44=; b=jMUVzrOplPt3cE69yc4g508nLV
	60QVak0+1t2QGoLsjlxSkf7qAMrqByXx0ruvEvtRHgtt4M9sHesujsu9D5Urw5pQxn++5IAQuFnGE
	ogEcMee1xMZAnzYT7UZaBojaNU8SNjBNr1woRI/cBfAZ8/QpzFud6+5iv9ZJsP42vvhw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/x2APIC: correct cluster tracking upon CPUs going down for S3
Message-Id: <E1stMxz-0003SB-1Q@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 08:01:43 +0000

commit f29c2fb064ef15b6a2530f1b2dd99c4be76a39af
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:56:16 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:56:16 2024 +0200

    x86/x2APIC: correct cluster tracking upon CPUs going down for S3
    
    Downing CPUs for S3 is somewhat special: Since we can expect the system
    to come back up in exactly the same hardware configuration, per-CPU data
    for the secondary CPUs isn't de-allocated (and then cleared upon re-
    allocation when the CPUs are being brought back up). Therefore the
    cluster_cpus per-CPU pointer will retain its value for all CPUs other
    than the final one in a cluster (i.e. in particular for all CPUs in the
    same cluster as CPU0). That, however, is in conflict with the assertion
    early in init_apic_ldr_x2apic_cluster().
    
    Note that the issue is avoided on Intel hardware, where we park CPUs
    instead of bringing them down.
    
    Extend the bypassing of the freeing to the suspend case, thus making
    suspend/resume also a tiny bit faster.
    
    Fixes: 2e6c8f182c9c ("x86: distinguish CPU offlining from CPU removal")
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: ad3ff7b4279d16c91c23cda6e8be5bc670b25c9a
    master date: 2024-08-26 10:30:40 +0200
---
 xen/arch/x86/genapic/x2apic.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/genapic/x2apic.c b/xen/arch/x86/genapic/x2apic.c
index 371dd100c7..d531035fa4 100644
--- a/xen/arch/x86/genapic/x2apic.c
+++ b/xen/arch/x86/genapic/x2apic.c
@@ -228,7 +228,8 @@ static int cf_check update_clusterinfo(
     case CPU_UP_CANCELED:
     case CPU_DEAD:
     case CPU_REMOVE:
-        if ( park_offline_cpus == (action != CPU_REMOVE) )
+        if ( park_offline_cpus == (action != CPU_REMOVE) ||
+             system_state == SYS_STATE_suspend )
             break;
         if ( per_cpu(cluster_cpus, cpu) )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 08:01:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 08:01:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803537.1214154 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMyA-00075T-Fo; Wed, 25 Sep 2024 08:01:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803537.1214154; Wed, 25 Sep 2024 08:01:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMyA-00075M-DP; Wed, 25 Sep 2024 08:01:54 +0000
Received: by outflank-mailman (input) for mailman id 803537;
 Wed, 25 Sep 2024 08:01:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMy9-000759-64
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:01:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMy9-0004fO-5M
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:01:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMy9-0003Sj-4S
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:01:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ndH6OHhScL2Hu1tWRKM5Gsd+tpwVI2vzdMY0hP9JPJs=; b=EIiCtTgZmcKp8ymcy4vwlkYYMA
	QkY8xO5m0uTPmZpZJzLwBqGuEHyVOI77T8Ec3ywvo2nBXXpdr0knX/01fkZZicIztKHPoouVgnsFe
	gklYQlwfDYKXziNxmjnGAWRRvkzZU982Bv+eNLOfw7+g4ftGD5ckokm9Dajx53WPpwrw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/dom0: disable SMAP for PV domain building only
Message-Id: <E1stMy9-0003Sj-4S@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 08:01:53 +0000

commit 4cb8c289873aafdba7086d1933665aaea83292ec
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 24 14:56:45 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:56:45 2024 +0200

    x86/dom0: disable SMAP for PV domain building only
    
    Move the logic that disables SMAP so it's only performed when building a PV
    dom0, PVH dom0 builder doesn't require disabling SMAP.
    
    The fixes tag is to account for the wrong usage of cpu_has_smap in
    create_dom0(), it should instead have used
    boot_cpu_has(X86_FEATURE_XEN_SMAP).  Fix while moving the logic to apply to PV
    only.
    
    While there also make cr4_pv32_mask __ro_after_init.
    
    Fixes: 493ab190e5b1 ('xen/sm{e, a}p: allow disabling sm{e, a}p for Xen itself')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: fb1658221a31ec1db33253a80001191391e73b17
    master date: 2024-08-28 19:59:07 +0100
---
 xen/arch/x86/include/asm/setup.h |  2 ++
 xen/arch/x86/pv/dom0_build.c     | 40 +++++++++++++++++++++++++++++++++++-----
 xen/arch/x86/setup.c             | 19 +------------------
 3 files changed, 38 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h
index 14d15048eb..e62eaeaa94 100644
--- a/xen/arch/x86/include/asm/setup.h
+++ b/xen/arch/x86/include/asm/setup.h
@@ -60,6 +60,8 @@ extern bool opt_dom0_verbose;
 extern bool opt_dom0_cpuid_faulting;
 extern bool opt_dom0_msr_relaxed;
 
+extern unsigned long cr4_pv32_mask;
+
 #define max_init_domid (0)
 
 #endif
diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index 64a0b9f598..3b28ae45d1 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -354,11 +354,11 @@ static struct page_info * __init alloc_chunk(struct domain *d,
     return page;
 }
 
-int __init dom0_construct_pv(struct domain *d,
-                             const module_t *image,
-                             unsigned long image_headroom,
-                             module_t *initrd,
-                             const char *cmdline)
+static int __init dom0_construct(struct domain *d,
+                                 const module_t *image,
+                                 unsigned long image_headroom,
+                                 module_t *initrd,
+                                 const char *cmdline)
 {
     int i, rc, order, machine;
     bool compatible, compat;
@@ -1049,6 +1049,36 @@ out:
     return rc;
 }
 
+int __init dom0_construct_pv(struct domain *d,
+                             const module_t *image,
+                             unsigned long image_headroom,
+                             module_t *initrd,
+                             const char *cmdline)
+{
+    int rc;
+
+    /*
+     * Clear SMAP in CR4 to allow user-accesses in construct_dom0().  This
+     * prevents us needing to rewrite construct_dom0() in terms of
+     * copy_{to,from}_user().
+     */
+    if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
+    {
+        cr4_pv32_mask &= ~X86_CR4_SMAP;
+        write_cr4(read_cr4() & ~X86_CR4_SMAP);
+    }
+
+    rc = dom0_construct(d, image, image_headroom, initrd, cmdline);
+
+    if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
+    {
+        write_cr4(read_cr4() | X86_CR4_SMAP);
+        cr4_pv32_mask |= X86_CR4_SMAP;
+    }
+
+    return rc;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index f2592c3dc9..18503300e7 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -75,7 +75,7 @@ static bool __initdata opt_invpcid = true;
 boolean_param("invpcid", opt_invpcid);
 bool __read_mostly use_invpcid;
 
-unsigned long __read_mostly cr4_pv32_mask;
+unsigned long __ro_after_init cr4_pv32_mask;
 
 /* **** Linux config option: propagated to domain0. */
 /* "acpi=off":    Sisables both ACPI table parsing and interpreter. */
@@ -946,26 +946,9 @@ static struct domain *__init create_dom0(const module_t *image,
         cmdline = dom0_cmdline;
     }
 
-    /*
-     * Temporarily clear SMAP in CR4 to allow user-accesses in construct_dom0().
-     * This saves a large number of corner cases interactions with
-     * copy_from_user().
-     */
-    if ( cpu_has_smap )
-    {
-        cr4_pv32_mask &= ~X86_CR4_SMAP;
-        write_cr4(read_cr4() & ~X86_CR4_SMAP);
-    }
-
     if ( construct_dom0(d, image, headroom, initrd, cmdline) != 0 )
         panic("Could not construct domain 0\n");
 
-    if ( cpu_has_smap )
-    {
-        write_cr4(read_cr4() | X86_CR4_SMAP);
-        cr4_pv32_mask |= X86_CR4_SMAP;
-    }
-
     return d;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 08:02:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 08:02:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803538.1214158 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMyK-000785-HE; Wed, 25 Sep 2024 08:02:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803538.1214158; Wed, 25 Sep 2024 08:02:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMyK-00077y-Eq; Wed, 25 Sep 2024 08:02:04 +0000
Received: by outflank-mailman (input) for mailman id 803538;
 Wed, 25 Sep 2024 08:02:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMyJ-00077l-8v
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:02:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMyJ-0004fh-8B
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:02:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMyJ-0003U0-7Q
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:02:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=72Uzx8p33SELmUns51f0rD5/dKB8MZb8gcqHymY933E=; b=vDjygbH19OMGT78+gOd9cm/KlU
	xvDMj5y5lpZ0NMIa9/f/sR+XNnW04NblFhtRvbt3YLi90ihzrq08Uf5dOOS9N100BsCWcfKxaMgkE
	2/i7Aq9QyqMA/jvmqYu7QSb84wUItwpF6sT56r5Dub20QnwTTlnKOP0KayqxUPs8cJLg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/HVM: correct partial HPET_STATUS write emulation
Message-Id: <E1stMyJ-0003U0-7Q@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 08:02:03 +0000

commit 582a83da12bf0d8c6186aaf0aa11aa0b9850d0ad
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:57:21 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:57:21 2024 +0200

    x86/HVM: correct partial HPET_STATUS write emulation
    
    For partial writes the non-written parts of registers are folded into
    the full 64-bit value from what they're presently set to. That's wrong
    to do though when the behavior is write-1-to-clear: Writes not
    including to low 3 bits would unconditionally clear all ISR bits which
    are presently set. Re-calculate the value to use.
    
    Fixes: be07023be115 ("x86/vhpet: add support for level triggered interrupts")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 41d358d2f9607ba37c216effa39b9f1bc58de69d
    master date: 2024-08-29 10:02:20 +0200
---
 xen/arch/x86/hvm/hpet.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/hpet.c b/xen/arch/x86/hvm/hpet.c
index 80f323316c..21b30d2900 100644
--- a/xen/arch/x86/hvm/hpet.c
+++ b/xen/arch/x86/hvm/hpet.c
@@ -405,7 +405,8 @@ static int cf_check hpet_write(
         break;
 
     case HPET_STATUS:
-        /* write 1 to clear. */
+        /* Write 1 to clear. Therefore don't use new_val directly here. */
+        new_val = val << ((addr & 7) * 8);
         while ( new_val )
         {
             bool active;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 08:02:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 08:02:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803539.1214163 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMyU-0007B5-Iu; Wed, 25 Sep 2024 08:02:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803539.1214163; Wed, 25 Sep 2024 08:02:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMyU-0007Ax-GJ; Wed, 25 Sep 2024 08:02:14 +0000
Received: by outflank-mailman (input) for mailman id 803539;
 Wed, 25 Sep 2024 08:02:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMyT-0007Ak-Bg
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:02:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMyT-0004fn-B4
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:02:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMyT-0003UY-AH
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:02:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yKRBVUnbi6PXYsw7TthlMx8IYF1N8gymlkjirIuDBiw=; b=ZWy/oPKfbggHnnv1uaCTNE/9IJ
	GVq6iH1DvSea08PkxWvm7RIL59fFQdHLudyAiRKLTDAbLyQNuJ3D+iI31LjFnqFPH2hqNR6q/bHM8
	FjLsJwUGanFgM3Uzaja+MmT8bFkHZEqz5+smysFakdkCZTU2RF3mZFYP6HBWqrc0cV6I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] Arm64: adjust __irq_to_desc() to fix build with gcc14
Message-Id: <E1stMyT-0003UY-AH@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 08:02:13 +0000

commit 133b92bf78c21f40c6a316fc000422a188c01a7a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:57:43 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:57:43 2024 +0200

    Arm64: adjust __irq_to_desc() to fix build with gcc14
    
    With the original code I observe
    
    In function ‘__irq_to_desc’,
        inlined from ‘route_irq_to_guest’ at arch/arm/irq.c:465:12:
    arch/arm/irq.c:54:16: error: array subscript -2 is below array bounds of ‘irq_desc_t[32]’ {aka ‘struct irq_desc[32]’} [-Werror=array-bounds=]
       54 |         return &this_cpu(local_irq_desc)[irq];
          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    which looks pretty bogus: How in the world does the compiler arrive at
    -2 when compiling route_irq_to_guest()? Yet independent of that the
    function's parameter wants to be of unsigned type anyway, as shown by
    a vast majority of callers (others use plain int when they really mean
    non-negative quantities). With that adjustment the code compiles fine
    again.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
    master commit: 99f942f3d410059dc223ee0a908827e928ef3592
    master date: 2024-08-29 10:03:53 +0200
---
 xen/arch/arm/include/asm/irq.h | 2 +-
 xen/arch/arm/irq.c             | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/include/asm/irq.h b/xen/arch/arm/include/asm/irq.h
index c8044b0371..59348a0dd4 100644
--- a/xen/arch/arm/include/asm/irq.h
+++ b/xen/arch/arm/include/asm/irq.h
@@ -57,7 +57,7 @@ extern const unsigned int nr_irqs;
 struct irq_desc;
 struct irqaction;
 
-struct irq_desc *__irq_to_desc(int irq);
+struct irq_desc *__irq_to_desc(unsigned int irq);
 
 #define irq_to_desc(irq)    __irq_to_desc(irq)
 
diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index ae69fb4aeb..014b2d7982 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -58,7 +58,7 @@ hw_irq_controller no_irq_type = {
 static irq_desc_t irq_desc[NR_IRQS];
 static DEFINE_PER_CPU(irq_desc_t[NR_LOCAL_IRQS], local_irq_desc);
 
-struct irq_desc *__irq_to_desc(int irq)
+struct irq_desc *__irq_to_desc(unsigned int irq)
 {
     if ( irq < NR_LOCAL_IRQS )
         return &this_cpu(local_irq_desc)[irq];
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 08:02:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 08:02:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803540.1214167 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMyf-0007Dm-Kn; Wed, 25 Sep 2024 08:02:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803540.1214167; Wed, 25 Sep 2024 08:02:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMyf-0007De-Hm; Wed, 25 Sep 2024 08:02:25 +0000
Received: by outflank-mailman (input) for mailman id 803540;
 Wed, 25 Sep 2024 08:02:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMyd-0007DP-Ef
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:02:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMyd-0004hR-E0
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:02:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMyd-0003VA-DL
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:02:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qUj4MRJ9k17+GE0ZzCkPs86WqrReJxCPb8ExCN+VCv0=; b=YhtKVOswoUwk92IUtnk0E2qcvM
	vb2BORLykpBJonxMHCz+adkKtumfczrUV33kUpNgg3EKPdqkAH+WnqeBv2/gUZlHxWM4oTcOcw+rm
	a1/WWVcWuHRJGOlB+MKe5owf2jGVS/TNVFZN4txRXTxh+5jBV1AP4BOqeWy/i1dJ075g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] libxl: Fix nul-termination of the return value of libxl_xen_console_read_line()
Message-Id: <E1stMyd-0003VA-DL@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 08:02:23 +0000

commit e077d26621a31fb707c64d8251f5022991c979a9
Author:     Javi Merino <javi.merino@cloud.com>
AuthorDate: Tue Sep 24 14:58:13 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:58:13 2024 +0200

    libxl: Fix nul-termination of the return value of libxl_xen_console_read_line()
    
    When built with ASAN, "xl dmesg" crashes in the "printf("%s", line)"
    call in main_dmesg().  ASAN reports a heap buffer overflow: an
    off-by-one access to cr->buffer.
    
    The readconsole sysctl copies up to count characters into the buffer,
    but it does not add a null character at the end.  Despite the
    documentation of libxl_xen_console_read_line(), line_r is not
    nul-terminated if 16384 characters were copied to the buffer.
    
    Fix this by asking xc_readconsolering() to fill the buffer up to size
    - 1.  As the number of characters in the buffer is only needed in
    libxl_xen_console_read_line(), make it a local variable there instead
    of part of the libxl__xen_console_reader struct.
    
    Fixes: 4024bae739cc ("xl: Add subcommand 'xl dmesg'")
    Reported-by: Edwin Török <edwin.torok@cloud.com>
    Signed-off-by: Javi Merino <javi.merino@cloud.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: bb03169bcb6ecccf372de1f6b9285cd519a26bb8
    master date: 2024-09-03 10:53:44 +0100
---
 tools/libs/light/libxl_console.c  | 19 +++++++++++++++----
 tools/libs/light/libxl_internal.h |  1 -
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/tools/libs/light/libxl_console.c b/tools/libs/light/libxl_console.c
index a563c9d3c7..9f736b8913 100644
--- a/tools/libs/light/libxl_console.c
+++ b/tools/libs/light/libxl_console.c
@@ -774,12 +774,17 @@ libxl_xen_console_reader *
 {
     GC_INIT(ctx);
     libxl_xen_console_reader *cr;
-    unsigned int size = 16384;
+    /*
+     * We want xen to fill the buffer in as few hypercalls as
+     * possible, but xen will not nul-terminate it.  The default size
+     * of Xen's console buffer is 16384.  Leave one byte at the end
+     * for the null character.
+     */
+    unsigned int size = 16384 + 1;
 
     cr = libxl__zalloc(NOGC, sizeof(libxl_xen_console_reader));
     cr->buffer = libxl__zalloc(NOGC, size);
     cr->size = size;
-    cr->count = size;
     cr->clear = clear;
     cr->incremental = 1;
 
@@ -800,10 +805,16 @@ int libxl_xen_console_read_line(libxl_ctx *ctx,
                                 char **line_r)
 {
     int ret;
+    /*
+     * Number of chars to copy into the buffer.  xc_readconsolering()
+     * does not add a null character at the end, so leave a space for
+     * us to add it.
+     */
+    unsigned int nr_chars = cr->size - 1;
     GC_INIT(ctx);
 
     memset(cr->buffer, 0, cr->size);
-    ret = xc_readconsolering(ctx->xch, cr->buffer, &cr->count,
+    ret = xc_readconsolering(ctx->xch, cr->buffer, &nr_chars,
                              cr->clear, cr->incremental, &cr->index);
     if (ret < 0) {
         LOGE(ERROR, "reading console ring buffer");
@@ -811,7 +822,7 @@ int libxl_xen_console_read_line(libxl_ctx *ctx,
         return ERROR_FAIL;
     }
     if (!ret) {
-        if (cr->count) {
+        if (nr_chars) {
             *line_r = cr->buffer;
             ret = 1;
         } else {
diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h
index d5732d1c37..e5477c7668 100644
--- a/tools/libs/light/libxl_internal.h
+++ b/tools/libs/light/libxl_internal.h
@@ -2080,7 +2080,6 @@ _hidden char *libxl__uuid2string(libxl__gc *gc, const libxl_uuid uuid);
 struct libxl__xen_console_reader {
     char *buffer;
     unsigned int size;
-    unsigned int count;
     unsigned int clear;
     unsigned int incremental;
     unsigned int index;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 08:02:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 08:02:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803541.1214171 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMyo-0007H2-Nv; Wed, 25 Sep 2024 08:02:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803541.1214171; Wed, 25 Sep 2024 08:02:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMyo-0007Gu-LL; Wed, 25 Sep 2024 08:02:34 +0000
Received: by outflank-mailman (input) for mailman id 803541;
 Wed, 25 Sep 2024 08:02:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMyn-0007Gn-HN
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:02:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMyn-0004hV-Gm
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:02:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMyn-0003Vm-G3
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:02:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=j9MsdoYtdyJWZcN9Eo19t7bFlOWx51o7/MFp7HKcuvQ=; b=uVOiSBalH9KFJ33mzNPlLD5SiV
	joK3Xr/OuCFLyANWgl/TVdrkAPIuUsP0qH6TEcDoZR+5Hboq50iLqiTokW/kjPjun1CPDyWCCUl1Y
	oj9lYbKytKGACsO03Stce54iR/njlF2dWRi9977FSpoJsLHhpjk6sT58krzEq2q0yHZY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] SUPPORT.md: split XSM from Flask
Message-Id: <E1stMyn-0003Vm-G3@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 08:02:33 +0000

commit 37fcb4c206a47e6923f49207dabcde9829d1eb2e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:58:45 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:58:45 2024 +0200

    SUPPORT.md: split XSM from Flask
    
    XSM is a generic framework, which in particular is also used by SILO.
    With this it can't really be experimental: Arm mandates SILO for having
    a security supported configuration.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    master commit: d7c18b8720824d7efc39ffa7296751e1812865a9
    master date: 2024-09-04 16:05:03 +0200
---
 SUPPORT.md | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index b4715a65b5..24157088d2 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -731,13 +731,21 @@ Compile time disabled for ARM by default.
 
     Status, x86: Supported, not security supported
 
-### XSM & FLASK
+### XSM (Xen Security Module) Framework
+
+XSM is a security policy framework.  The dummy implementation is covered by this
+statement, and implements a policy whereby dom0 is all powerful.  See below for
+alternative modules (FLASK, SILO).
+
+    Status: Supported
+
+### FLASK XSM Module
 
     Status: Experimental
 
 Compile time disabled by default.
 
-Also note that using XSM
+Also note that using FLASK
 to delegate various domain control hypercalls
 to particular other domains, rather than only permitting use by dom0,
 is also specifically excluded from security support for many hypercalls.
@@ -750,6 +758,13 @@ Please see XSA-77 for more details.
 The default policy includes FLASK labels and roles for a "typical" Xen-based system
 with dom0, driver domains, stub domains, domUs, and so on.
 
+### SILO XSM Module
+
+SILO extends the dummy policy by enforcing that DomU-s can only communicate
+with Dom0, yet not with each other.
+
+    Status: Supported
+
 ## Virtual Hardware, Hypervisor
 
 ### x86/Nested PV
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 08:02:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 08:02:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803542.1214175 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMyy-0007JP-PU; Wed, 25 Sep 2024 08:02:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803542.1214175; Wed, 25 Sep 2024 08:02:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMyy-0007JF-Ml; Wed, 25 Sep 2024 08:02:44 +0000
Received: by outflank-mailman (input) for mailman id 803542;
 Wed, 25 Sep 2024 08:02:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMyx-0007J3-KM
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:02:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMyx-0004hp-Jd
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:02:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMyx-0003WI-Iu
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:02:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HnK5WsAscNLRKWSg96H4NkYsZbQjpvwFZza7A4FqId0=; b=rMQnjDZJIkH2W1BQCZHXEjpDzG
	09WcxguC9LOcAA+OkMuD5VehdVKmsdi03ADJGMIUWlwlOYgbCw1nR/j6j8uaSaU0ugjz51gZxrQrW
	yotNT9+a0axvIrnhV+q8gEaWwOlxEVzQaJ1cSB01fu8lbMjWwB2UzQgAmE4hYhWmhNyM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86: fix UP build with gcc14
Message-Id: <E1stMyx-0003WI-Iu@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 08:02:43 +0000

commit f562deb29bbccd6606b684105aa718ef263f274e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:58:58 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:58:58 2024 +0200

    x86: fix UP build with gcc14
    
    The complaint is:
    
    In file included from ././include/xen/config.h:17,
                     from <command-line>:
    arch/x86/smpboot.c: In function ‘link_thread_siblings.constprop’:
    ./include/asm-generic/percpu.h:16:51: error: array subscript [0, 0] is outside array bounds of ‘long unsigned int[1]’ [-Werror=array-bounds=]
       16 |     (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
    ./include/xen/compiler.h:140:29: note: in definition of macro ‘RELOC_HIDE’
      140 |     (typeof(ptr)) (__ptr + (off)); })
          |                             ^~~
    arch/x86/smpboot.c:238:27: note: in expansion of macro ‘per_cpu’
      238 |     cpumask_set_cpu(cpu2, per_cpu(cpu_sibling_mask, cpu1));
          |                           ^~~~~~~
    In file included from ./arch/x86/include/generated/asm/percpu.h:1,
                     from ./include/xen/percpu.h:30,
                     from ./arch/x86/include/asm/cpuid.h:9,
                     from ./arch/x86/include/asm/cpufeature.h:11,
                     from ./arch/x86/include/asm/system.h:6,
                     from ./include/xen/list.h:11,
                     from ./include/xen/mm.h:68,
                     from arch/x86/smpboot.c:12:
    ./include/asm-generic/percpu.h:12:22: note: while referencing ‘__per_cpu_offset’
       12 | extern unsigned long __per_cpu_offset[NR_CPUS];
          |                      ^~~~~~~~~~~~~~~~
    
    Which I consider bogus in the first place ("array subscript [0, 0]" vs a
    1-element array). Yet taking the experience from 99f942f3d410 ("Arm64:
    adjust __irq_to_desc() to fix build with gcc14") I guessed that
    switching function parameters to unsigned int (which they should have
    been anyway) might help. And voilà ...
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: a2de7dc4d845738e734b10fce6550c89c6b1092c
    master date: 2024-09-04 16:09:28 +0200
---
 xen/arch/x86/smpboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 4c54ecbc91..f7078130cd 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -226,7 +226,7 @@ static int booting_cpu;
 /* CPUs for which sibling maps can be computed. */
 static cpumask_t cpu_sibling_setup_map;
 
-static void link_thread_siblings(int cpu1, int cpu2)
+static void link_thread_siblings(unsigned int cpu1, unsigned int cpu2)
 {
     cpumask_set_cpu(cpu1, per_cpu(cpu_sibling_mask, cpu2));
     cpumask_set_cpu(cpu2, per_cpu(cpu_sibling_mask, cpu1));
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 08:02:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 08:02:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803543.1214179 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMz8-0007Lf-R6; Wed, 25 Sep 2024 08:02:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803543.1214179; Wed, 25 Sep 2024 08:02:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMz8-0007LX-OC; Wed, 25 Sep 2024 08:02:54 +0000
Received: by outflank-mailman (input) for mailman id 803543;
 Wed, 25 Sep 2024 08:02:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMz7-0007LO-Nr
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:02:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMz7-0004hx-N8
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:02:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMz7-0003X7-MH
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:02:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=alLEIFxH+EYfNBMrihc3MIXoKwceQHKDDPc1RSyfN6Y=; b=TscuNMjgb18S0wE0N+s583Or+9
	aTkEfvi4NQKfMohWRfbd+bnda/IcFDA830NE+qFgLapDPXzH+bG49jXKyCvdkHH9g+/mQ9fQNkUuW
	Sry4CNoK0yJbpL1lg7S56jwUnXk+Rnrt2PKAER+yD8po6FEPkOD1WgaLJLNSpjWZZANI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86emul/test: fix build with gas 2.43
Message-Id: <E1stMz7-0003X7-MH@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 08:02:53 +0000

commit acab1a90f931debe3e13dc9dbe6eb11ec2bdf818
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:59:22 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:59:22 2024 +0200

    x86emul/test: fix build with gas 2.43
    
    Drop explicit {evex} pseudo-prefixes. New gas (validly) complains when
    they're used on things other than instructions. Our use was potentially
    ahead of macro invocations - see simd.h's "override" macro.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 3c09288298af881ea1bb568740deb2d2a06bcd41
    master date: 2024-09-06 08:41:18 +0200
---
 tools/tests/x86_emulator/simd.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/tests/x86_emulator/simd.c b/tools/tests/x86_emulator/simd.c
index 263cea662d..d68a7364c2 100644
--- a/tools/tests/x86_emulator/simd.c
+++ b/tools/tests/x86_emulator/simd.c
@@ -333,7 +333,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # if FLOAT_SIZE == 4
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vbroadcastss %1, %0" \
+    asm ( "vbroadcastss %1, %0" \
           : "=v" (t_) : "m" (*(float[1]){ x }) ); \
     t_; \
 })
@@ -401,14 +401,14 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 #  if VEC_SIZE >= 32
 #   define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vbroadcastsd %1, %0" : "=v" (t_) \
+    asm ( "vbroadcastsd %1, %0" : "=v" (t_) \
           : "m" (*(double[1]){ x }) ); \
     t_; \
 })
 #  else
 #   define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastq %1, %0" \
+    asm ( "vpbroadcastq %1, %0" \
           : "=v" (t_) : "m" (*(double[1]){ x }) ); \
     t_; \
 })
@@ -601,7 +601,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # if INT_SIZE == 4 || UINT_SIZE == 4
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastd %1, %0" \
+    asm ( "vpbroadcastd %1, %0" \
           : "=v" (t_) : "m" (*(int[1]){ x }) ); \
     t_; \
 })
@@ -649,7 +649,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # elif INT_SIZE == 8 || UINT_SIZE == 8
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastq %1, %0" \
+    asm ( "vpbroadcastq %1, %0" \
           : "=v" (t_) : "m" (*(long long[1]){ x }) ); \
     t_; \
 })
@@ -716,7 +716,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # if INT_SIZE == 1 || UINT_SIZE == 1
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastb %1, %0" \
+    asm ( "vpbroadcastb %1, %0" \
           : "=v" (t_) : "m" (*(char[1]){ x }) ); \
     t_; \
 })
@@ -745,7 +745,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # elif INT_SIZE == 2 || UINT_SIZE == 2
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastw %1, %0" \
+    asm ( "vpbroadcastw %1, %0" \
           : "=v" (t_) : "m" (*(short[1]){ x }) ); \
     t_; \
 })
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 08:03:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 08:03:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803544.1214182 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMzI-0007OD-S3; Wed, 25 Sep 2024 08:03:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803544.1214182; Wed, 25 Sep 2024 08:03:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMzI-0007O6-Pe; Wed, 25 Sep 2024 08:03:04 +0000
Received: by outflank-mailman (input) for mailman id 803544;
 Wed, 25 Sep 2024 08:03:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMzH-0007Nw-Qy
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:03:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMzH-0004iH-QF
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:03:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMzH-0003Y0-PW
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:03:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wEktlxAh+3vhhNuJZKZdouBco9B98Rm86LJVMT3QsCw=; b=Jl2ETjvlyEopazRpACfKV41Ijs
	P8qhpohbqB8meaDmsesu20W3/Rw/Lpzrepn5dtdrDcHS0KwDPHOVHJ+Km5Uokrj6lSVCC4BIzrYAX
	hthASoKcdpmu37HLoQlwNyOiKWMCjXdrkPolvXf4r8hjPFNwyoP0Yd3H/J8ZFb3E788o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/HVM: properly reject "indirect" VRAM writes
Message-Id: <E1stMzH-0003Y0-PW@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 08:03:03 +0000

commit b7f66ed124985563c73dadeec84189c48870cd1a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 15:00:07 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 15:00:07 2024 +0200

    x86/HVM: properly reject "indirect" VRAM writes
    
    While ->count will only be different from 1 for "indirect" (data in
    guest memory) accesses, it being 1 does not exclude the request being an
    "indirect" one. Check both to be on the safe side, and bring the ->count
    part also in line with what ioreq_send_buffered() actually refuses to
    handle.
    
    Fixes: 3bbaaec09b1b ("x86/hvm: unify stdvga mmio intercept with standard mmio intercept")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: eb7cd0593d88c4b967a24bca8bd30591966676cd
    master date: 2024-09-12 09:13:04 +0200
---
 xen/arch/x86/hvm/stdvga.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index 2586891863..6419211266 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -530,14 +530,14 @@ static bool cf_check stdvga_mem_accept(
 
     spin_lock(&s->lock);
 
-    if ( p->dir == IOREQ_WRITE && p->count > 1 )
+    if ( p->dir == IOREQ_WRITE && (p->data_is_ptr || p->count != 1) )
     {
         /*
          * We cannot return X86EMUL_UNHANDLEABLE on anything other then the
          * first cycle of an I/O. So, since we cannot guarantee to always be
          * able to send buffered writes, we have to reject any multi-cycle
-         * I/O and, since we are rejecting an I/O, we must invalidate the
-         * cache.
+         * or "indirect" I/O and, since we are rejecting an I/O, we must
+         * invalidate the cache.
          * Single-cycle write transactions are accepted even if the cache is
          * not active since we can assert, when in stdvga mode, that writes
          * to VRAM have no side effect and thus we can try to buffer them.
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 08:03:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 08:03:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803545.1214186 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMzS-0007SU-Tc; Wed, 25 Sep 2024 08:03:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803545.1214186; Wed, 25 Sep 2024 08:03:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMzS-0007SN-R5; Wed, 25 Sep 2024 08:03:14 +0000
Received: by outflank-mailman (input) for mailman id 803545;
 Wed, 25 Sep 2024 08:03:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMzR-0007SE-Ti
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:03:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMzR-0004iO-T3
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:03:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMzR-0003ZO-SL
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:03:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2HxgxFtiBRjeAKiC2hTzxj4JdukY7pOY2SpESYOK++0=; b=zUL5W0EFJjvcvRXym7T1sqW+5q
	WfZFMgfyDhby3RoWW4EBf9Z/KdM7cBj+yGzC+AxoFq82DDGxyoFIkNt+p/C1jYsGXYqjCP7ntApO3
	ZOJGPejzd49cqKgWs+zr1HdMtEEX0NVhE6pJG6Y22UZfDF1DR7rC0R1doNTAP5HYCZWY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] xen/x86/pvh: handle ACPI RSDT table in PVH Dom0 build
Message-Id: <E1stMzR-0003ZO-SL@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 08:03:13 +0000

commit b7e54ae8389dad2f0582d32edb667f6bdbf9df37
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Tue Sep 24 15:00:29 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 15:00:29 2024 +0200

    xen/x86/pvh: handle ACPI RSDT table in PVH Dom0 build
    
    Xen always generates an XSDT table even if the firmware only provided an
    RSDT table.  Copy the RSDT header from the firmware table, adjusting the
    signature, for the XSDT table when not provided by the firmware.
    
    This is necessary to run Xen on QEMU.
    
    Fixes: 1d74282c455f ('x86: setup PVHv2 Dom0 ACPI tables')
    Suggested-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 6e7f7a0c16c4d406bda6d4a900252ff63a7c5fad
    master date: 2024-09-12 09:18:25 +0200
---
 xen/arch/x86/hvm/dom0_build.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index c7d47d0d4c..411beb3f06 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -960,7 +960,16 @@ static int __init pvh_setup_acpi_xsdt(struct domain *d, paddr_t madt_addr,
         rc = -EINVAL;
         goto out;
     }
-    xsdt_paddr = rsdp->xsdt_physical_address;
+    /*
+     * Note the header is the same for both RSDT and XSDT, so it's fine to
+     * copy the native RSDT header to the Xen crafted XSDT if no native
+     * XSDT is available.
+     */
+    if ( rsdp->revision > 1 && rsdp->xsdt_physical_address )
+        xsdt_paddr = rsdp->xsdt_physical_address;
+    else
+        xsdt_paddr = rsdp->rsdt_physical_address;
+
     acpi_os_unmap_memory(rsdp, sizeof(*rsdp));
     table = acpi_os_map_memory(xsdt_paddr, sizeof(*table));
     if ( !table )
@@ -972,6 +981,12 @@ static int __init pvh_setup_acpi_xsdt(struct domain *d, paddr_t madt_addr,
     xsdt->header = *table;
     acpi_os_unmap_memory(table, sizeof(*table));
 
+    /*
+     * In case the header is an RSDT copy, unconditionally ensure it has
+     * an XSDT sig.
+     */
+    xsdt->header.signature[0] = 'X';
+
     /* Add the custom MADT. */
     xsdt->table_offset_entry[0] = madt_addr;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 08:03:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 08:03:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803546.1214190 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMzc-0007Ur-W5; Wed, 25 Sep 2024 08:03:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803546.1214190; Wed, 25 Sep 2024 08:03:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMzc-0007Uj-T4; Wed, 25 Sep 2024 08:03:24 +0000
Received: by outflank-mailman (input) for mailman id 803546;
 Wed, 25 Sep 2024 08:03:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMzc-0007Ud-0G
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:03:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMzb-0004iX-Vp
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:03:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMzb-0003Zw-V9
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:03:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gWhAnaVH4X/nQGMaVu0CnH5douYWnGgLZvvncA4kg+0=; b=m/6mtu4e97ALIQofhRUFhANidA
	pczblGJff5aezYIbQ0LLN1knCllKYIPrl115QTmUbaO0SGH5KmXw8wgf9ltpoQsrcIwcj0oe/6hsS
	5WoCpiPeJJXNbJbu5zc2zi+Stqj/M8jHmB4rYFYbJ0VlbVWVUdHapaOlXzxaF9YQI30E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] blkif: reconcile protocol specification with in-use implementations
Message-Id: <E1stMzb-0003Zw-V9@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 08:03:23 +0000

commit 834518a8d055149f250d191a3c50f96013756c01
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 24 15:00:55 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 15:00:55 2024 +0200

    blkif: reconcile protocol specification with in-use implementations
    
    Current blkif implementations (both backends and frontends) have all slight
    differences about how they handle the 'sector-size' xenstore node, and how
    other fields are derived from this value or hardcoded to be expressed in units
    of 512 bytes.
    
    To give some context, this is an excerpt of how different implementations use
    the value in 'sector-size' as the base unit for to other fields rather than
    just to set the logical sector size of the block device:
    
                            │ sectors xenbus node │ requests sector_number │ requests {first,last}_sect
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    FreeBSD blk{front,back} │     sector-size     │      sector-size       │           512
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    Linux blk{front,back}   │         512         │          512           │           512
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    QEMU blkback            │     sector-size     │      sector-size       │       sector-size
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    Windows blkfront        │     sector-size     │      sector-size       │       sector-size
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    MiniOS                  │     sector-size     │          512           │           512
    
    An attempt was made by 67e1c050e36b in order to change the base units of the
    request fields and the xenstore 'sectors' node.  That however only lead to more
    confusion, as the specification now clearly diverged from the reference
    implementation in Linux.  Such change was only implemented for QEMU Qdisk
    and Windows PV blkfront.
    
    Partially revert to the state before 67e1c050e36b while adjusting the
    documentation for 'sectors' to match what it used to be previous to
    2fa701e5346d:
    
     * Declare 'feature-large-sector-size' deprecated.  Frontends should not expose
       the node, backends should not make decisions based on its presence.
    
     * Clarify that 'sectors' xenstore node and the requests fields are always in
       512-byte units, like it was previous to 2fa701e5346d and 67e1c050e36b.
    
    All base units for the fields used in the protocol are 512-byte based, the
    xenbus 'sector-size' field is only used to signal the logic block size.  When
    'sector-size' is greater than 512, blkfront implementations must make sure that
    the offsets and sizes (despite being expressed in 512-byte units) are aligned
    to the logical block size specified in 'sector-size', otherwise the backend
    will fail to process the requests.
    
    This will require changes to some of the frontends and backends in order to
    properly support 'sector-size' nodes greater than 512.
    
    Fixes: 2fa701e5346d ('blkif.h: Provide more complete documentation of the blkif interface')
    Fixes: 67e1c050e36b ('public/io/blkif.h: try to fix the semantics of sector based quantities')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: 221f2748e8dabe8361b8cdfcffbeab9102c4c899
    master date: 2024-09-12 14:04:56 +0200
---
 xen/include/public/io/blkif.h | 52 ++++++++++++++++++++++++++++++++-----------
 1 file changed, 39 insertions(+), 13 deletions(-)

diff --git a/xen/include/public/io/blkif.h b/xen/include/public/io/blkif.h
index 22f1eef0c0..9b00d633d3 100644
--- a/xen/include/public/io/blkif.h
+++ b/xen/include/public/io/blkif.h
@@ -237,12 +237,16 @@
  * sector-size
  *      Values:         <uint32_t>
  *
- *      The logical block size, in bytes, of the underlying storage. This
- *      must be a power of two with a minimum value of 512.
+ *      The logical block size, in bytes, of the underlying storage. This must
+ *      be a power of two with a minimum value of 512.  The sector size should
+ *      only be used for request segment length and alignment.
  *
- *      NOTE: Because of implementation bugs in some frontends this must be
- *            set to 512, unless the frontend advertizes a non-zero value
- *            in its "feature-large-sector-size" xenbus node. (See below).
+ *      When exposing a device that uses a logical sector size of 4096, the
+ *      only difference xenstore wise will be that 'sector-size' (and possibly
+ *      'physical-sector-size' if supported by the backend) will be 4096, but
+ *      the 'sectors' node will still be calculated using 512 byte units.  The
+ *      sector base units in the ring requests fields will all be 512 byte
+ *      based despite the logical sector size exposed in 'sector-size'.
  *
  * physical-sector-size
  *      Values:         <uint32_t>
@@ -254,9 +258,9 @@
  * sectors
  *      Values:         <uint64_t>
  *
- *      The size of the backend device, expressed in units of "sector-size".
- *      The product of "sector-size" and "sectors" must also be an integer
- *      multiple of "physical-sector-size", if that node is present.
+ *      The size of the backend device, expressed in units of 512b.  The
+ *      product of "sectors" * 512 must also be an integer multiple of
+ *      "physical-sector-size", if that node is present.
  *
  *****************************************************************************
  *                            Frontend XenBus Nodes
@@ -338,6 +342,7 @@
  * feature-large-sector-size
  *      Values:         0/1 (boolean)
  *      Default Value:  0
+ *      Notes:          DEPRECATED, 12
  *
  *      A value of "1" indicates that the frontend will correctly supply and
  *      interpret all sector-based quantities in terms of the "sector-size"
@@ -411,6 +416,11 @@
  *(10) The discard-secure property may be present and will be set to 1 if the
  *     backing device supports secure discard.
  *(11) Only used by Linux and NetBSD.
+ *(12) Possibly only ever implemented by the QEMU Qdisk backend and the Windows
+ *     PV block frontend.  Other backends and frontends supported 'sector-size'
+ *     values greater than 512 before such feature was added.  Frontends should
+ *     not expose this node, neither should backends make any decisions based
+ *     on it being exposed by the frontend.
  */
 
 /*
@@ -619,11 +629,14 @@
 #define BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST 8
 
 /*
- * NB. 'first_sect' and 'last_sect' in blkif_request_segment, as well as
- * 'sector_number' in blkif_request, blkif_request_discard and
- * blkif_request_indirect are sector-based quantities. See the description
- * of the "feature-large-sector-size" frontend xenbus node above for
- * more information.
+ * NB. 'first_sect' and 'last_sect' in blkif_request_segment are all in units
+ * of 512 bytes, despite the 'sector-size' xenstore node possibly having a
+ * value greater than 512.
+ *
+ * The value in 'first_sect' and 'last_sect' fields must be setup so that the
+ * resulting segment offset and size is aligned to the logical sector size
+ * reported by the 'sector-size' xenstore node, see 'Backend Device Properties'
+ * section.
  */
 struct blkif_request_segment {
     grant_ref_t gref;        /* reference to I/O buffer frame        */
@@ -634,6 +647,10 @@ struct blkif_request_segment {
 
 /*
  * Starting ring element for any I/O request.
+ *
+ * The 'sector_number' field is in units of 512b, despite the value of the
+ * 'sector-size' xenstore node.  Note however that the offset in
+ * 'sector_number' must be aligned to 'sector-size'.
  */
 struct blkif_request {
     uint8_t        operation;    /* BLKIF_OP_???                         */
@@ -648,6 +665,10 @@ typedef struct blkif_request blkif_request_t;
 /*
  * Cast to this structure when blkif_request.operation == BLKIF_OP_DISCARD
  * sizeof(struct blkif_request_discard) <= sizeof(struct blkif_request)
+ *
+ * The 'sector_number' field is in units of 512b, despite the value of the
+ * 'sector-size' xenstore node.  Note however that the offset in
+ * 'sector_number' must be aligned to 'sector-size'.
  */
 struct blkif_request_discard {
     uint8_t        operation;    /* BLKIF_OP_DISCARD                     */
@@ -660,6 +681,11 @@ struct blkif_request_discard {
 };
 typedef struct blkif_request_discard blkif_request_discard_t;
 
+/*
+ * The 'sector_number' field is in units of 512b, despite the value of the
+ * 'sector-size' xenstore node.  Note however that the offset in
+ * 'sector_number' must be aligned to 'sector-size'.
+ */
 struct blkif_request_indirect {
     uint8_t        operation;    /* BLKIF_OP_INDIRECT                    */
     uint8_t        indirect_op;  /* BLKIF_OP_{READ/WRITE}                */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 08:03:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 08:03:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803547.1214196 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMzn-0007YR-3Z; Wed, 25 Sep 2024 08:03:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803547.1214196; Wed, 25 Sep 2024 08:03:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stMzn-0007YH-0R; Wed, 25 Sep 2024 08:03:35 +0000
Received: by outflank-mailman (input) for mailman id 803547;
 Wed, 25 Sep 2024 08:03:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMzm-0007Y7-32
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:03:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMzm-0004if-2P
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:03:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stMzm-0003bx-1g
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 08:03:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Do+cCGAN4r+7LMyV9sV68vi6MMg04shbhoeH/Qo5Gmc=; b=VZGj0RXzH3Gvi9Em3+K39WkOvL
	WwD8ULdmUCUamANi70Tl/mfK3aNuICWTaLMLfd61rTxsdf2qrZhUGnfm3g8euiEMB11hab1irFtZI
	sC6nyWMYPOTUMWbN9tZSjw+gpTLs5zQyvL0bzQqkMCyZan1lwrJNopCEj7Oia1Sj16LI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] xen/ucode: Fix buffer under-run when parsing AMD containers
Message-Id: <E1stMzm-0003bx-1g@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 08:03:34 +0000

commit 2c5f888204d988110fee9823b102f433c6212d9d
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Tue Sep 24 15:01:15 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 15:01:15 2024 +0200

    xen/ucode: Fix buffer under-run when parsing AMD containers
    
    The AMD container format has no formal spec.  It is, at best, precision
    guesswork based on AMD's prior contributions to open source projects.  The
    Equivalence Table has both an explicit length, and an expectation of having a
    NULL entry at the end.
    
    Xen was sanity checking the NULL entry, but without confirming that an entry
    was present, resulting in a read off the front of the buffer.  With some
    manual debugging/annotations this manifests as:
    
      (XEN) *** Buf ffff83204c00b19c, eq ffff83204c00b194
      (XEN) *** eq: 0c 00 00 00 44 4d 41 00 00 00 00 00 00 00 00 00 aa aa aa aa
                                ^-Actual buffer-------------------^
      (XEN) *** installed_cpu: 000c
      (XEN) microcode: Bad equivalent cpu table
      (XEN) Parsing microcode blob error -22
    
    When loaded by hypercall, the 4 bytes interpreted as installed_cpu happen to
    be the containing struct ucode_buf's len field, and luckily will be nonzero.
    
    When loaded at boot, it's possible for the access to #PF if the module happens
    to have been placed on a 2M boundary by the bootloader.  Under Linux, it will
    commonly be the end of the CPIO header.
    
    Drop the probe of the NULL entry; Nothing else cares.  A container without one
    is well formed, insofar that we can still parse it correctly.  With this
    dropped, the same container results in:
    
      (XEN) microcode: couldn't find any matching ucode in the provided blob!
    
    Fixes: 4de936a38aa9 ("x86/ucode/amd: Rework parsing logic in cpu_request_microcode()")
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a8bf14f6f331d4f428010b4277b67c33f561ed19
    master date: 2024-09-13 15:23:30 +0100
---
 xen/arch/x86/cpu/microcode/amd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index d8f7646e88..dc735ee480 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -336,8 +336,7 @@ static struct microcode_patch *cf_check cpu_request_microcode(
         if ( size < sizeof(*et) ||
              (et = buf)->type != UCODE_EQUIV_CPU_TABLE_TYPE ||
              size - sizeof(*et) < et->len ||
-             et->len % sizeof(et->eq[0]) ||
-             et->eq[(et->len / sizeof(et->eq[0])) - 1].installed_cpu )
+             et->len % sizeof(et->eq[0]) )
         {
             printk(XENLOG_ERR "microcode: Bad equivalent cpu table\n");
             error = -EINVAL;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 09:55:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 09:55:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803721.1214448 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOje-00042z-SR; Wed, 25 Sep 2024 09:55:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803721.1214448; Wed, 25 Sep 2024 09:55:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOje-00042r-Po; Wed, 25 Sep 2024 09:55:02 +0000
Received: by outflank-mailman (input) for mailman id 803721;
 Wed, 25 Sep 2024 09:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOjd-00042l-O5
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOjd-0006XY-MN
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOjd-000748-Jf
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/xGIFGodKpF83CM0J/ExI+yl+GArEZ/sQv1T92KxjdQ=; b=I9d7lJfL7wCX9c3MgIXN6X0Lev
	R56VAqwf8H/4ycUG6QTYGkBUGpbpMUStEMSNEcaU6JjJe4vdaAmE0pYDk9mOMnkOTy3kb+ajAF0DU
	7aOUodmpAcpdZ5alb1PtEQPhINwJdmy5qnufolAlU24C2e3TBzP8WJDtuElSUCaqziIo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/vLAPIC: prevent undue recursion of vlapic_error()
Message-Id: <E1stOjd-000748-Jf@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 09:55:01 +0000

commit 9358a7fad7f0427e7d1666da0c78cef341ee9072
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:27:03 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:27:03 2024 +0200

    x86/vLAPIC: prevent undue recursion of vlapic_error()
    
    With the error vector set to an illegal value, the function invoking
    vlapic_set_irq() would bring execution back here, with the non-recursive
    lock already held. Avoid the call in this case, merely further updating
    ESR (if necessary).
    
    This is XSA-462 / CVE-2024-45817.
    
    Fixes: 5f32d186a8b1 ("x86/vlapic: don't silently accept bad vectors")
    Reported-by: Federico Serafini <federico.serafini@bugseng.com>
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: c42d9ec61f6d11e25fa77bd44dd11dad1edda268
    master date: 2024-09-24 14:23:29 +0200
---
 xen/arch/x86/hvm/vlapic.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 9cfc82666a..46ff758904 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -112,9 +112,24 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
     if ( (esr & errmask) != errmask )
     {
         uint32_t lvterr = vlapic_get_reg(vlapic, APIC_LVTERR);
+        bool inj = false;
 
-        vlapic_set_reg(vlapic, APIC_ESR, esr | errmask);
         if ( !(lvterr & APIC_LVT_MASKED) )
+        {
+            /*
+             * If LVTERR is unmasked and has an illegal vector, vlapic_set_irq()
+             * will end up back here.  Break the cycle by only injecting LVTERR
+             * if it will succeed, and folding in RECVILL otherwise.
+             */
+            if ( (lvterr & APIC_VECTOR_MASK) >= 16 )
+                 inj = true;
+            else
+                 errmask |= APIC_ESR_RECVILL;
+        }
+
+        vlapic_set_reg(vlapic, APIC_ESR, esr | errmask);
+
+        if ( inj )
             vlapic_set_irq(vlapic, lvterr & APIC_VECTOR_MASK, 0);
     }
     spin_unlock_irqrestore(&vlapic->esr_lock, flags);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 09:55:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 09:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803722.1214453 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOjo-00044U-U5; Wed, 25 Sep 2024 09:55:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803722.1214453; Wed, 25 Sep 2024 09:55:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOjo-00044N-RZ; Wed, 25 Sep 2024 09:55:12 +0000
Received: by outflank-mailman (input) for mailman id 803722;
 Wed, 25 Sep 2024 09:55:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOjn-000447-SL
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:55:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOjn-0006Xu-Qo
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOjn-00074y-Oa
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uHLgeV3I1snYLRGtSfE9HlGDub9aiA9QZW+S1PE+ycU=; b=ptF6LNWsPo78gq6CEoH8p6wmfg
	m5aWCHm9NMki+yIQ1i/+frOehoQFS/fOjz6nDtclhahRH8Ue/IJo7TmYGpEeoLn0fXNO0wahqrEnE
	xesqHaZJrkTyHlqH4G2fap6Tp8Y85Dgz0CfhCHyDpPgy290rEAeklmPZdGYBhJ7RvQQ0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] Arm: correct FIXADDR_TOP
Message-Id: <E1stOjn-00074y-Oa@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 09:55:11 +0000

commit 46a2ce35212c9b35c4818ca9eec918aa4a45cb48
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:28:22 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:28:22 2024 +0200

    Arm: correct FIXADDR_TOP
    
    While reviewing a RISC-V patch cloning the Arm code, I noticed an
    off-by-1 here: FIX_PMAP_{BEGIN,END} being an inclusive range and
    FIX_LAST being the same as FIX_PMAP_END, FIXADDR_TOP cannot derive from
    FIX_LAST alone, or else the BUG_ON() in virt_to_fix() would trigger if
    FIX_PMAP_END ended up being used.
    
    While touching this area also add a check for fixmap and boot FDT area
    to not only not overlap, but to have at least one (unmapped) page in
    between.
    
    Fixes: 4f17357b52f6 ("xen/arm: add Persistent Map (PMAP) infrastructure")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    master commit: fe3412ab83cc53c2bf2c497be3794bc09751efa5
    master date: 2024-08-13 21:50:55 +0100
---
 xen/arch/arm/include/asm/fixmap.h | 2 +-
 xen/arch/arm/mmu/setup.c          | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/include/asm/fixmap.h b/xen/arch/arm/include/asm/fixmap.h
index a823456ecb..0cb5d54d1c 100644
--- a/xen/arch/arm/include/asm/fixmap.h
+++ b/xen/arch/arm/include/asm/fixmap.h
@@ -18,7 +18,7 @@
 #define FIX_LAST FIX_PMAP_END
 
 #define FIXADDR_START FIXMAP_ADDR(0)
-#define FIXADDR_TOP FIXMAP_ADDR(FIX_LAST)
+#define FIXADDR_TOP FIXMAP_ADDR(FIX_LAST + 1)
 
 #ifndef __ASSEMBLY__
 
diff --git a/xen/arch/arm/mmu/setup.c b/xen/arch/arm/mmu/setup.c
index f4bb424c3c..57042ed57b 100644
--- a/xen/arch/arm/mmu/setup.c
+++ b/xen/arch/arm/mmu/setup.c
@@ -128,6 +128,12 @@ static void __init __maybe_unused build_assertions(void)
 
 #undef CHECK_SAME_SLOT
 #undef CHECK_DIFFERENT_SLOT
+
+    /*
+     * Fixmaps must not overlap with boot FDT mapping area. Make sure there's
+     * at least one guard page in between.
+     */
+    BUILD_BUG_ON(FIXADDR_TOP >= BOOT_FDT_VIRT_START);
 }
 
 lpae_t __init pte_of_xenaddr(vaddr_t va)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 09:55:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 09:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803723.1214456 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOjz-00046v-Vp; Wed, 25 Sep 2024 09:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803723.1214456; Wed, 25 Sep 2024 09:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOjz-00046n-TI; Wed, 25 Sep 2024 09:55:23 +0000
Received: by outflank-mailman (input) for mailman id 803723;
 Wed, 25 Sep 2024 09:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOjx-00046b-Vv
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:55:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOjx-0006Y6-Uf
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:55:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOjx-00075j-Sx
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:55:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eBGJihzElopNEpbD/3sZfI65LS5Pr/l3AA4ewK8jlWQ=; b=pkprMKvaGH3kkozTulYzxqeg48
	58pS81WTpCf5gjF88HbtCzeQNJJ2VTOoTWTmHHxJoZ/LtVW4rAxDXzs73SJxPUc9C58lSArYZ78J1
	ooUO9F5pDCazbXrlMTR6wEFQgLhcb8sjC56P14bJ1Mhr8QdAfsKzvjUvcVPDX0oGAKW0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] xl: fix incorrect output in "help" command
Message-Id: <E1stOjx-00075j-Sx@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 09:55:21 +0000

commit e12998a9db8d0ac14477557d09b437783a999ea4
Author:     John E. Krokes <mag@netherworld.org>
AuthorDate: Tue Sep 24 14:29:26 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:29:26 2024 +0200

    xl: fix incorrect output in "help" command
    
    In "xl help", the output includes this line:
    
     vsnd-list           List virtual display devices for a domain
    
    This should obviously say "sound devices" instead of "display devices".
    
    Signed-off-by: John E. Krokes <mag@netherworld.org>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: 09226d165b57d919150458044c5b594d3d1dc23a
    master date: 2024-08-14 08:49:44 +0200
---
 tools/xl/xl_cmdtable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c
index 42751228c1..53fc22d344 100644
--- a/tools/xl/xl_cmdtable.c
+++ b/tools/xl/xl_cmdtable.c
@@ -433,7 +433,7 @@ const struct cmd_spec cmd_table[] = {
     },
     { "vsnd-list",
       &main_vsndlist, 0, 0,
-      "List virtual display devices for a domain",
+      "List virtual sound devices for a domain",
       "<Domain(s)>",
     },
     { "vsnd-detach",
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 09:55:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 09:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803724.1214461 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOkA-00049X-11; Wed, 25 Sep 2024 09:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803724.1214461; Wed, 25 Sep 2024 09:55:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOk9-00049P-Um; Wed, 25 Sep 2024 09:55:33 +0000
Received: by outflank-mailman (input) for mailman id 803724;
 Wed, 25 Sep 2024 09:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOk8-000494-2v
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOk8-0006YG-1m
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOk8-00076T-0r
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eZoOKcShe7HXV0IT/mLX/nHFmm+rQxPsfouv9W9C+u8=; b=Vjzbom0gF1DoCSNKNNHlHMQHmq
	A2yMHMgjJDyfGGlAVSNx0Hd2aS7nb6bm2LG0ZmW6gOLEtPUcGe1Kpmbn5IlTm7TF7oaK1RRTvuKAd
	yWOTxvYXE2UALOAScwcZfbLo9Kz9keyjAdgaR+ghpgSmZGRJTCKDOfYMDkysFfUENFco=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86emul: correct #UD check for AVX512-FP16 complex multiplications
Message-Id: <E1stOk8-00076T-0r@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 09:55:32 +0000

commit e2f29f7bad59c4be53363c8c0d2933982a22d0de
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:30:04 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:30:04 2024 +0200

    x86emul: correct #UD check for AVX512-FP16 complex multiplications
    
    avx512_vlen_check()'s argument was inverted, while the surrounding
    conditional wrongly forced the EVEX.L'L check for the scalar forms when
    embedded rounding was in effect.
    
    Fixes: d14c52cba0f5 ("x86emul: handle AVX512-FP16 complex multiplication insns")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: a30d438ce58b70c5955f5d37f776086ab8f88623
    master date: 2024-08-19 15:32:31 +0200
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 2d5c1de8ec..16557385bf 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -7984,8 +7984,8 @@ x86_emulate(
         generate_exception_if(modrm_reg == src1 ||
                               (ea.type != OP_MEM && modrm_reg == modrm_rm),
                               X86_EXC_UD);
-        if ( ea.type != OP_REG || (b & 1) || !evex.brs )
-            avx512_vlen_check(!(b & 1));
+        if ( ea.type != OP_REG || !evex.brs )
+            avx512_vlen_check(b & 1);
         goto simd_zmm;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 09:55:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 09:55:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803728.1214464 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOkK-0004Cc-2Y; Wed, 25 Sep 2024 09:55:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803728.1214464; Wed, 25 Sep 2024 09:55:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOkJ-0004CU-WF; Wed, 25 Sep 2024 09:55:44 +0000
Received: by outflank-mailman (input) for mailman id 803728;
 Wed, 25 Sep 2024 09:55:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOkI-0004C9-6S
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOkI-0006Yg-5f
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOkI-000788-3z
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=f4gdOQQROSGWZsHrB99v8GwqsBHflAIBGibpVKIzU1U=; b=zCvD5i7CvOtC5uKcw+8zatGwdZ
	SsRJmHO44OiirsKQR2/tm5+LKRcJCsItOME9LWvErvmnfE81BeuJi5CAB+v320hfjenWB6z1wKemo
	yb8hpKtLjLVt4dzCRfJ+CqEOqt19KLBugiJUw7jNtCp7BBbLwdibyIDf3FJ6SaTEIs+8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/pv: Introduce x86_merge_dr6() and fix do_debug()
Message-Id: <E1stOkI-000788-3z@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 09:55:42 +0000

commit de924e4dbac80ac7d94a2e86c37eecccaa1bc677
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 24 14:30:49 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:30:49 2024 +0200

    x86/pv: Introduce x86_merge_dr6() and fix do_debug()
    
    Pretty much everywhere in Xen the logic to update %dr6 when injecting #DB is
    buggy.  Introduce a new x86_merge_dr6() helper, and start fixing the mess by
    adjusting the dr6 merge in do_debug().  Also correct the comment.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 54ef601a66e8d812a6a6a308f02524e81201825e
    master date: 2024-08-21 23:59:19 +0100
---
 xen/arch/x86/debug.c                 | 40 ++++++++++++++++++++++++++++++++++++
 xen/arch/x86/include/asm/debugreg.h  |  7 +++++++
 xen/arch/x86/include/asm/x86-defns.h |  7 +++++++
 xen/arch/x86/traps.c                 | 11 +++++++---
 4 files changed, 62 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/debug.c b/xen/arch/x86/debug.c
index 127fe83021..b10f1f12b6 100644
--- a/xen/arch/x86/debug.c
+++ b/xen/arch/x86/debug.c
@@ -2,12 +2,52 @@
 /*
  * Copyright (C) 2023 XenServer.
  */
+#include <xen/bug.h>
 #include <xen/kernel.h>
 
 #include <xen/lib/x86/cpu-policy.h>
 
 #include <asm/debugreg.h>
 
+/*
+ * Merge new bits into dr6.  'new' is always given in positive polarity,
+ * matching the Intel VMCS PENDING_DBG semantics.
+ *
+ * At the time of writing (August 2024), on the subject of %dr6 updates the
+ * manuals are either vague (Intel "certain exceptions may clear bits 0-3"),
+ * or disputed (AMD makes statements which don't match observed behaviour).
+ *
+ * The only debug exception I can find which doesn't clear the breakpoint bits
+ * is ICEBP(/INT1) on AMD systems.  This is also the one source of #DB that
+ * doesn't have an explicit status bit, meaning we can't easily identify this
+ * case either (AMD systems don't virtualise PENDING_DBG and only provide a
+ * post-merge %dr6 value).
+ *
+ * Treat %dr6 merging as unconditionally writing the breakpoint bits.
+ *
+ * We can't really manage any better, and guest kernels handling #DB as
+ * instructed by the SDM/APM (i.e. reading %dr6 then resetting it back to
+ * default) wont notice.
+ */
+unsigned int x86_merge_dr6(const struct cpu_policy *p, unsigned int dr6,
+                           unsigned int new)
+{
+    /* Flip dr6 to have positive polarity. */
+    dr6 ^= X86_DR6_DEFAULT;
+
+    /* Sanity check that only known values are passed in. */
+    ASSERT(!(dr6 & ~X86_DR6_KNOWN_MASK));
+    ASSERT(!(new & ~X86_DR6_KNOWN_MASK));
+
+    /* Breakpoint bits overridden.  All others accumulate. */
+    dr6 = (dr6 & ~X86_DR6_BP_MASK) | new;
+
+    /* Flip dr6 back to having default polarity. */
+    dr6 ^= X86_DR6_DEFAULT;
+
+    return x86_adj_dr6_rsvd(p, dr6);
+}
+
 unsigned int x86_adj_dr6_rsvd(const struct cpu_policy *p, unsigned int dr6)
 {
     unsigned int ones = X86_DR6_DEFAULT;
diff --git a/xen/arch/x86/include/asm/debugreg.h b/xen/arch/x86/include/asm/debugreg.h
index 96c406ad53..6baa725441 100644
--- a/xen/arch/x86/include/asm/debugreg.h
+++ b/xen/arch/x86/include/asm/debugreg.h
@@ -108,4 +108,11 @@ struct cpu_policy;
 unsigned int x86_adj_dr6_rsvd(const struct cpu_policy *p, unsigned int dr6);
 unsigned int x86_adj_dr7_rsvd(const struct cpu_policy *p, unsigned int dr7);
 
+/*
+ * Merge new bits into dr6.  'new' is always given in positive polarity,
+ * matching the Intel VMCS PENDING_DBG semantics.
+ */
+unsigned int x86_merge_dr6(const struct cpu_policy *p, unsigned int dr6,
+                           unsigned int new);
+
 #endif /* _X86_DEBUGREG_H */
diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index 3bcdbaccd3..caa92829ea 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -132,6 +132,13 @@
 #define X86_DR6_ZEROS           _AC(0x00001000, UL)  /* %dr6 bits forced to 0       */
 #define X86_DR6_DEFAULT         _AC(0xffff0ff0, UL)  /* Default %dr6 value          */
 
+#define X86_DR6_BP_MASK                                 \
+    (X86_DR6_B0 | X86_DR6_B1 | X86_DR6_B2 | X86_DR6_B3)
+
+#define X86_DR6_KNOWN_MASK                                              \
+    (X86_DR6_BP_MASK | X86_DR6_BLD | X86_DR6_BD | X86_DR6_BS |          \
+     X86_DR6_BT | X86_DR6_RTM)
+
 /*
  * Debug control flags in DR7.
  */
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index ee91fc56b1..78e83f6fc1 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2017,9 +2017,14 @@ void asmlinkage do_debug(struct cpu_user_regs *regs)
         return;
     }
 
-    /* Save debug status register where guest OS can peek at it */
-    v->arch.dr6 |= (dr6 & ~X86_DR6_DEFAULT);
-    v->arch.dr6 &= (dr6 | ~X86_DR6_DEFAULT);
+    /*
+     * Update the guest's dr6 so the debugger can peek at it.
+     *
+     * TODO: This should be passed out-of-band, so guest state is not modified
+     * by debugging actions completed behind it's back.
+     */
+    v->arch.dr6 = x86_merge_dr6(v->domain->arch.cpu_policy,
+                                v->arch.dr6, dr6 ^ X86_DR6_DEFAULT);
 
     if ( guest_kernel_mode(v, regs) && v->domain->debugger_attached )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 09:55:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 09:55:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803729.1214468 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOkU-0004FS-4P; Wed, 25 Sep 2024 09:55:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803729.1214468; Wed, 25 Sep 2024 09:55:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOkU-0004FL-1S; Wed, 25 Sep 2024 09:55:54 +0000
Received: by outflank-mailman (input) for mailman id 803729;
 Wed, 25 Sep 2024 09:55:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOkS-0004F8-9j
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:55:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOkS-0006Yn-8v
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOkS-00078t-88
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:55:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=m8SxSOsTmFzSwKOn8WPk5jwv8czanKVmTOpqGyJM0Bg=; b=SNvZOhVoioSBy9QmLlc8Fqg8tn
	VV/5XYmLF8F8D23FAt9txrVLjo4A0fWhZFG5pO+UREPrv3ffOCLyh4SCIyoGUw/HASLaKs72yhize
	WiLRraZ6HTc1Bhu+a6KOR9F5S9oG6rZb+kFYF8K2NIDaTI/Vb1g0dZ19zv/in7YQuTl8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/pv: Fix merging of new status bits into %dr6
Message-Id: <E1stOkS-00078t-88@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 09:55:52 +0000

commit b74a5ea8399d1a0466c55332f557863acdae21b6
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 24 14:34:30 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:34:30 2024 +0200

    x86/pv: Fix merging of new status bits into %dr6
    
    All #DB exceptions result in an update of %dr6, but this isn't captured in
    Xen's handling, and is buggy just about everywhere.
    
    To begin resolving this issue, add a new pending_dbg field to x86_event
    (unioned with cr2 to avoid taking any extra space, adjusting users to avoid
    old-GCC bugs with anonymous unions), and introduce pv_inject_DB() to replace
    the current callers using pv_inject_hw_exception().
    
    Push the adjustment of v->arch.dr6 into pv_inject_event(), and use the new
    x86_merge_dr6() rather than the current incorrect logic.
    
    A key property is that pending_dbg is taken with positive polarity to deal
    with RTM/BLD sensibly.  Most callers pass in a constant, but callers passing
    in a hardware %dr6 value need to XOR the value with X86_DR6_DEFAULT to flip to
    positive polarity.
    
    This fixes the behaviour of the breakpoint status bits; that any left pending
    are generally discarded when a new #DB is raised.  In principle it would fix
    RTM/BLD too, except PV guests can't turn these capabilities on to start with.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: db39fa4b27ea470902d4625567cb6fa24030ddfa
    master date: 2024-08-21 23:59:19 +0100
---
 xen/arch/x86/include/asm/domain.h      | 18 ++++++++++++++++--
 xen/arch/x86/include/asm/hvm/hvm.h     |  3 ++-
 xen/arch/x86/pv/emul-priv-op.c         |  5 +----
 xen/arch/x86/pv/emulate.c              |  9 +++++++--
 xen/arch/x86/pv/ro-page-fault.c        |  2 +-
 xen/arch/x86/pv/traps.c                | 16 ++++++++++++----
 xen/arch/x86/traps.c                   |  2 +-
 xen/arch/x86/x86_emulate/x86_emulate.h |  5 ++++-
 8 files changed, 44 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index f5daeb182b..5d92891e6f 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -731,15 +731,29 @@ static inline void pv_inject_hw_exception(unsigned int vector, int errcode)
     pv_inject_event(&event);
 }
 
+static inline void pv_inject_DB(unsigned long pending_dbg)
+{
+    struct x86_event event = {
+        .vector      = X86_EXC_DB,
+        .type        = X86_EVENTTYPE_HW_EXCEPTION,
+        .error_code  = X86_EVENT_NO_EC,
+    };
+
+    event.pending_dbg = pending_dbg;
+
+    pv_inject_event(&event);
+}
+
 static inline void pv_inject_page_fault(int errcode, unsigned long cr2)
 {
-    const struct x86_event event = {
+    struct x86_event event = {
         .vector = X86_EXC_PF,
         .type = X86_EVENTTYPE_HW_EXCEPTION,
         .error_code = errcode,
-        .cr2 = cr2,
     };
 
+    event.cr2 = cr2;
+
     pv_inject_event(&event);
 }
 
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 1c01e22c8e..238eece0cf 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -525,9 +525,10 @@ static inline void hvm_inject_page_fault(int errcode, unsigned long cr2)
         .vector = X86_EXC_PF,
         .type = X86_EVENTTYPE_HW_EXCEPTION,
         .error_code = errcode,
-        .cr2 = cr2,
     };
 
+    event.cr2 = cr2;
+
     hvm_inject_event(&event);
 }
 
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index aa11ecadaa..15c83b9d23 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -1366,10 +1366,7 @@ int pv_emulate_privileged_op(struct cpu_user_regs *regs)
             ctxt.bpmatch |= DR_STEP;
 
         if ( ctxt.bpmatch )
-        {
-            curr->arch.dr6 |= ctxt.bpmatch | DR_STATUS_RESERVED_ONE;
-            pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
-        }
+            pv_inject_DB(ctxt.bpmatch);
 
         /* fall through */
     case X86EMUL_RETRY:
diff --git a/xen/arch/x86/pv/emulate.c b/xen/arch/x86/pv/emulate.c
index e7a1c0a2cc..8c44dea123 100644
--- a/xen/arch/x86/pv/emulate.c
+++ b/xen/arch/x86/pv/emulate.c
@@ -71,10 +71,15 @@ void pv_emul_instruction_done(struct cpu_user_regs *regs, unsigned long rip)
 {
     regs->rip = rip;
     regs->eflags &= ~X86_EFLAGS_RF;
+
     if ( regs->eflags & X86_EFLAGS_TF )
     {
-        current->arch.dr6 |= DR_STEP | DR_STATUS_RESERVED_ONE;
-        pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
+        /*
+         * TODO: this should generally use TF from the start of the
+         * instruction.  It's only a latent bug for now, as this path isn't
+         * used for any instruction which modifies eflags.
+         */
+        pv_inject_DB(X86_DR6_BS);
     }
 }
 
diff --git a/xen/arch/x86/pv/ro-page-fault.c b/xen/arch/x86/pv/ro-page-fault.c
index cad28ef928..d0fe07e3a1 100644
--- a/xen/arch/x86/pv/ro-page-fault.c
+++ b/xen/arch/x86/pv/ro-page-fault.c
@@ -390,7 +390,7 @@ int pv_ro_page_fault(unsigned long addr, struct cpu_user_regs *regs)
         /* Fallthrough */
     case X86EMUL_OKAY:
         if ( ctxt.retire.singlestep )
-            pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
+            pv_inject_DB(X86_DR6_BS);
 
         /* Fallthrough */
     case X86EMUL_RETRY:
diff --git a/xen/arch/x86/pv/traps.c b/xen/arch/x86/pv/traps.c
index 83e84e2762..5a7341abf0 100644
--- a/xen/arch/x86/pv/traps.c
+++ b/xen/arch/x86/pv/traps.c
@@ -12,6 +12,7 @@
 #include <xen/lib.h>
 #include <xen/softirq.h>
 
+#include <asm/debugreg.h>
 #include <asm/pv/trace.h>
 #include <asm/shared.h>
 #include <asm/traps.h>
@@ -50,9 +51,9 @@ void pv_inject_event(const struct x86_event *event)
     tb->cs    = ti->cs;
     tb->eip   = ti->address;
 
-    if ( event->type == X86_EVENTTYPE_HW_EXCEPTION &&
-         vector == X86_EXC_PF )
+    switch ( vector | -(event->type == X86_EVENTTYPE_SW_INTERRUPT) )
     {
+    case X86_EXC_PF:
         curr->arch.pv.ctrlreg[2] = event->cr2;
         arch_set_cr2(curr, event->cr2);
 
@@ -62,9 +63,16 @@ void pv_inject_event(const struct x86_event *event)
             error_code |= PFEC_user_mode;
 
         trace_pv_page_fault(event->cr2, error_code);
-    }
-    else
+        break;
+
+    case X86_EXC_DB:
+        curr->arch.dr6 = x86_merge_dr6(curr->domain->arch.cpu_policy,
+                                       curr->arch.dr6, event->pending_dbg);
+        fallthrough;
+    default:
         trace_pv_trap(vector, regs->rip, use_error_code, error_code);
+        break;
+    }
 
     if ( use_error_code )
     {
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 78e83f6fc1..8e2df3e719 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2032,7 +2032,7 @@ void asmlinkage do_debug(struct cpu_user_regs *regs)
         return;
     }
 
-    pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
+    pv_inject_DB(0 /* N/A, already merged */);
 }
 
 void asmlinkage do_entry_CP(struct cpu_user_regs *regs)
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.h b/xen/arch/x86/x86_emulate/x86_emulate.h
index d92be69d84..e8a0e57228 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.h
+++ b/xen/arch/x86/x86_emulate/x86_emulate.h
@@ -78,7 +78,10 @@ struct x86_event {
     uint8_t       type;         /* X86_EVENTTYPE_* */
     uint8_t       insn_len;     /* Instruction length */
     int32_t       error_code;   /* X86_EVENT_NO_EC if n/a */
-    unsigned long cr2;          /* Only for X86_EXC_PF h/w exception */
+    union {
+        unsigned long cr2;         /* #PF */
+        unsigned long pending_dbg; /* #DB (new DR6 bits, positive polarity) */
+    };
 };
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 09:56:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 09:56:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803730.1214472 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOke-0004IO-7f; Wed, 25 Sep 2024 09:56:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803730.1214472; Wed, 25 Sep 2024 09:56:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOke-0004IH-58; Wed, 25 Sep 2024 09:56:04 +0000
Received: by outflank-mailman (input) for mailman id 803730;
 Wed, 25 Sep 2024 09:56:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOkc-0004I7-Cc
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:56:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOkc-0006Z9-Bv
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:56:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOkc-0007AV-B5
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:56:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KrhZGfaz7VXDZxmhbreCRASvzbnVp/Q7I9usPaCAyu4=; b=zCbxJH3SovQI/pmEjys+uV0ha4
	RJfAwKlt3zvYFrQemJSiH4iwn297QlB1/GdMx2E4lA385bLbIZxowOSoXZbZhJ3qIJMBMZokJyWCZ
	UADGIV8QMQ6AwmBXyekPOlbCSfYETNgqI2RqgYmdq+C+c3gyNuD20R5WLpcdg3mXtUIY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/pv: Address Coverity complaint in check_guest_io_breakpoint()
Message-Id: <E1stOkc-0007AV-B5@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 09:56:02 +0000

commit cb6c3cfc5f8aa8bd8aae1abffea0574b02a04840
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 24 14:36:25 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:36:25 2024 +0200

    x86/pv: Address Coverity complaint in check_guest_io_breakpoint()
    
    Commit 08aacc392d86 ("x86/emul: Fix misaligned IO breakpoint behaviour in PV
    guests") caused a Coverity INTEGER_OVERFLOW complaint based on the reasoning
    that width could be 0.
    
    It can't, but digging into the code generation, GCC 8 and later (bisected on
    godbolt) choose to emit a CSWITCH lookup table, and because the range (bottom
    2 bits clear), it's a 16-entry lookup table.
    
    So Coverity is understandable, given that GCC did emit a (dead) logic path
    where width stayed 0.
    
    Rewrite the logic.  Introduce x86_bp_width() which compiles to a single basic
    block, which replaces the switch() statement.  Take the opportunity to also
    make start and width be loop-scope variables.
    
    No practical change, but it should compile better and placate Coverity.
    
    Fixes: 08aacc392d86 ("x86/emul: Fix misaligned IO breakpoint behaviour in PV guests")
    Coverity-ID: 1616152
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 6d41a9d8a12ff89adabdc286e63e9391a0481699
    master date: 2024-08-21 23:59:19 +0100
---
 xen/arch/x86/include/asm/debugreg.h | 25 +++++++++++++++++++++++++
 xen/arch/x86/pv/emul-priv-op.c      | 21 ++++++---------------
 2 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/include/asm/debugreg.h b/xen/arch/x86/include/asm/debugreg.h
index 6baa725441..23aa592e40 100644
--- a/xen/arch/x86/include/asm/debugreg.h
+++ b/xen/arch/x86/include/asm/debugreg.h
@@ -115,4 +115,29 @@ unsigned int x86_adj_dr7_rsvd(const struct cpu_policy *p, unsigned int dr7);
 unsigned int x86_merge_dr6(const struct cpu_policy *p, unsigned int dr6,
                            unsigned int new);
 
+/*
+ * Calculate the width of a breakpoint from its dr7 encoding.
+ *
+ * The LEN encoding in dr7 is 2 bits wide per breakpoint and encoded as a X-1
+ * (0, 1 and 3) for widths of 1, 2 and 4 respectively in the 32bit days.
+ *
+ * In 64bit, the unused value (2) was given a meaning of width 8, which is
+ * great for efficiency but less great for nicely calculating the width.
+ */
+static inline unsigned int x86_bp_width(unsigned int dr7, unsigned int bp)
+{
+    unsigned int raw = (dr7 >> (DR_CONTROL_SHIFT +
+                                DR_CONTROL_SIZE * bp + 2)) & 3;
+
+    /*
+     * If the top bit is set (i.e. we've got an 4 or 8 byte wide breakpoint),
+     * flip the bottom to reverse their order, making them sorted properly.
+     * Then it's a simple shift to calculate the width.
+     */
+    if ( raw & 2 )
+        raw ^= 1;
+
+    return 1U << raw;
+}
+
 #endif /* _X86_DEBUGREG_H */
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 15c83b9d23..b90f745c75 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -323,30 +323,21 @@ static unsigned int check_guest_io_breakpoint(struct vcpu *v,
                                               unsigned int port,
                                               unsigned int len)
 {
-    unsigned int width, i, match = 0;
-    unsigned long start;
+    unsigned int i, match = 0;
 
     if ( !v->arch.pv.dr7_emul || !(v->arch.pv.ctrlreg[4] & X86_CR4_DE) )
         return 0;
 
     for ( i = 0; i < 4; i++ )
     {
+        unsigned long start;
+        unsigned int width;
+
         if ( !(v->arch.pv.dr7_emul & (3 << (i * DR_ENABLE_SIZE))) )
             continue;
 
-        start = v->arch.dr[i];
-        width = 0;
-
-        switch ( (v->arch.dr7 >>
-                  (DR_CONTROL_SHIFT + i * DR_CONTROL_SIZE)) & 0xc )
-        {
-        case DR_LEN_1: width = 1; break;
-        case DR_LEN_2: width = 2; break;
-        case DR_LEN_4: width = 4; break;
-        case DR_LEN_8: width = 8; break;
-        }
-
-        start &= ~(width - 1UL);
+        width = x86_bp_width(v->arch.dr7, i);
+        start = v->arch.dr[i] & ~(width - 1UL);
 
         if ( (start < (port + len)) && ((start + width) > port) )
             match |= 1u << i;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 09:56:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 09:56:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803731.1214477 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOkn-0004Kt-9J; Wed, 25 Sep 2024 09:56:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803731.1214477; Wed, 25 Sep 2024 09:56:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOkn-0004Kl-6c; Wed, 25 Sep 2024 09:56:13 +0000
Received: by outflank-mailman (input) for mailman id 803731;
 Wed, 25 Sep 2024 09:56:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOkm-0004Kd-Fu
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:56:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOkm-0006ZJ-FB
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:56:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOkm-0007BM-EQ
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:56:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cIvEHDhgubNV11ahRfGvcwXyRM/6GH8ca8a+oWHuylw=; b=oUODljUF8PPsDwM2RfKCJvRn6S
	e7IUW1FVLKxYNXv/MwWZxog6njw4x8SsUpr/FUArr7DQcqGnP9L7VuZCVBDLblgU0VV/sSuBSdhYN
	4hxRsWthJmkZsifzV3tK9gZD7bHDq8MuVKZJruaBp9iKxLrZD/QU3LggNI6jZsfZttKg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86emul: always set operand size for AVX-VNNI-INT8 insns
Message-Id: <E1stOkm-0007BM-EQ@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 09:56:12 +0000

commit 1e68200487e662e9f8720d508a1d6b3d3e2c72b9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:37:08 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:37:08 2024 +0200

    x86emul: always set operand size for AVX-VNNI-INT8 insns
    
    Unlike for AVX-VNNI-INT16 I failed to notice that op_bytes may still be
    zero when reaching the respective case block: With the ext0f38_table[]
    entries having simd_packed_int, the defaulting at the bottom of
    x86emul_decode() won't set the field to non-zero for F3- or F2-prefixed
    insns.
    
    Fixes: 842acaa743a5 ("x86emul: support AVX-VNNI-INT8")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: d45687cca2450bfebe1dfbddb22f4f03c6fbc9cb
    master date: 2024-08-23 09:11:15 +0200
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 16557385bf..4d9649a2af 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -6075,6 +6075,7 @@ x86_emulate(
     case X86EMUL_OPC_VEX_F2(0x0f38, 0x51): /* vpdpbssds [xy]mm/mem,[xy]mm,[xy]mm */
         host_and_vcpu_must_have(avx_vnni_int8);
         generate_exception_if(vex.w, X86_EXC_UD);
+        op_bytes = 16 << vex.l;
         goto simd_0f_ymm;
 
     case X86EMUL_OPC_VEX_66(0x0f38, 0x50): /* vpdpbusd [xy]mm/mem,[xy]mm,[xy]mm */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 09:56:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 09:56:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803732.1214481 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOkx-0004Nk-Ah; Wed, 25 Sep 2024 09:56:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803732.1214481; Wed, 25 Sep 2024 09:56:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOkx-0004Nc-84; Wed, 25 Sep 2024 09:56:23 +0000
Received: by outflank-mailman (input) for mailman id 803732;
 Wed, 25 Sep 2024 09:56:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOkw-0004NU-JF
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:56:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOkw-0006ZQ-IW
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:56:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOkw-0007CB-Hf
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:56:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NTa79aXOWWCS4Tm7J48O1CbGN4gT3p9emD9jJTSrAhs=; b=Uq+ox0FyOaSl204nHHprW8K2uT
	gUoogkiLYARwMOQsJt3lEN5Eufw79g5hIE6lKTqC1ZoD5jfmbKJAD18qF1Iy9MbqSVPVJeTWSW/QJ
	fo2M/9RCLTAPWxASA0pS31uA88wPZO7/VO/1+IhI3ai10rmPHQ4rev4JaZhwF+E0Kqtk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86emul: set (fake) operand size for AVX512CD broadcast insns
Message-Id: <E1stOkw-0007CB-Hf@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 09:56:22 +0000

commit a0d6b75b832d2f7c54429de1a550fe122bcd6881
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:37:52 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:37:52 2024 +0200

    x86emul: set (fake) operand size for AVX512CD broadcast insns
    
    Back at the time I failed to pay attention to op_bytes still being zero
    when reaching the respective case block: With the ext0f38_table[]
    entries having simd_packed_int, the defaulting at the bottom of
    x86emul_decode() won't set the field to non-zero for F3-prefixed insns.
    
    Fixes: 37ccca740c26 ("x86emul: support AVX512CD insns")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 6fa6b7feaafd622db3a2f3436750cf07782f4c12
    master date: 2024-08-23 09:12:24 +0200
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 4d9649a2af..305f4286bf 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -5928,6 +5928,7 @@ x86_emulate(
                                evex.w == ((b >> 4) & 1)),
                               X86_EXC_UD);
         d |= TwoOp;
+        op_bytes = 1; /* fake */
         /* fall through */
     case X86EMUL_OPC_EVEX_66(0x0f38, 0xc4): /* vpconflict{d,q} [xyz]mm/mem,[xyz]mm{k} */
         fault_suppression = false;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 09:56:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 09:56:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803733.1214484 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOl7-0004Rp-C3; Wed, 25 Sep 2024 09:56:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803733.1214484; Wed, 25 Sep 2024 09:56:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOl7-0004Rh-9S; Wed, 25 Sep 2024 09:56:33 +0000
Received: by outflank-mailman (input) for mailman id 803733;
 Wed, 25 Sep 2024 09:56:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOl6-0004Rb-MD
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:56:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOl6-0006ZX-LU
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:56:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOl6-0007Ct-Kc
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:56:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NMkpFsUtdTJdJB0I3bIrEVKDaDeeKnzS4yKn+yHbzKE=; b=BP7YFikME3B4r3B9+oeF6hyOvA
	N/skmmMJKE/fHLlVbLKpnx06lpWMP6fIBu1nWExKgDpCTfmoCPm2OnPnXh0hWPNYMe/wmPyWe0QWr
	aZieKmvBm2c9MBFPRzjnjGH/UxtvwczwEu7Q4huhh5bH4qmFnwag2HTNBFvjuagJQy/Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/x2APIC: correct cluster tracking upon CPUs going down for S3
Message-Id: <E1stOl6-0007Ct-Kc@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 09:56:32 +0000

commit 404fb9b745dd3f1ca17c3e957e43e3f95ab2613a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:38:27 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:38:27 2024 +0200

    x86/x2APIC: correct cluster tracking upon CPUs going down for S3
    
    Downing CPUs for S3 is somewhat special: Since we can expect the system
    to come back up in exactly the same hardware configuration, per-CPU data
    for the secondary CPUs isn't de-allocated (and then cleared upon re-
    allocation when the CPUs are being brought back up). Therefore the
    cluster_cpus per-CPU pointer will retain its value for all CPUs other
    than the final one in a cluster (i.e. in particular for all CPUs in the
    same cluster as CPU0). That, however, is in conflict with the assertion
    early in init_apic_ldr_x2apic_cluster().
    
    Note that the issue is avoided on Intel hardware, where we park CPUs
    instead of bringing them down.
    
    Extend the bypassing of the freeing to the suspend case, thus making
    suspend/resume also a tiny bit faster.
    
    Fixes: 2e6c8f182c9c ("x86: distinguish CPU offlining from CPU removal")
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: ad3ff7b4279d16c91c23cda6e8be5bc670b25c9a
    master date: 2024-08-26 10:30:40 +0200
---
 xen/arch/x86/genapic/x2apic.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/genapic/x2apic.c b/xen/arch/x86/genapic/x2apic.c
index 371dd100c7..d531035fa4 100644
--- a/xen/arch/x86/genapic/x2apic.c
+++ b/xen/arch/x86/genapic/x2apic.c
@@ -228,7 +228,8 @@ static int cf_check update_clusterinfo(
     case CPU_UP_CANCELED:
     case CPU_DEAD:
     case CPU_REMOVE:
-        if ( park_offline_cpus == (action != CPU_REMOVE) )
+        if ( park_offline_cpus == (action != CPU_REMOVE) ||
+             system_state == SYS_STATE_suspend )
             break;
         if ( per_cpu(cluster_cpus, cpu) )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 09:56:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 09:56:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803737.1214500 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOlH-0004m3-N8; Wed, 25 Sep 2024 09:56:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803737.1214500; Wed, 25 Sep 2024 09:56:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOlH-0004lq-JJ; Wed, 25 Sep 2024 09:56:43 +0000
Received: by outflank-mailman (input) for mailman id 803737;
 Wed, 25 Sep 2024 09:56:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOlG-0004lQ-PE
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:56:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOlG-0006Zz-Ob
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:56:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOlG-0007Dh-Nl
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:56:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CC6SH9JGTK+Rvb8uPLJV/g8U3dludrheCvTQCpf4ZjQ=; b=qfByRsEdaq22LZU7qT28cIIqLp
	qflFdJG2CKMxXf2Sk1NbBmv4xagv/x0RWWWD7caniWy9uCTKAUip6jnaag8I6t9FSblSKIgeNkVg2
	e6bV4mIEpneZZ20WBz5wMNXOmfP8rvBGeYxxwqwMtoFMOFJV9yqXSV0HxJ/I2jEVpRYE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/dom0: disable SMAP for PV domain building only
Message-Id: <E1stOlG-0007Dh-Nl@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 09:56:42 +0000

commit 743af916723eb4f1197719fc0aebd4460bafb5bf
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 24 14:39:23 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:39:23 2024 +0200

    x86/dom0: disable SMAP for PV domain building only
    
    Move the logic that disables SMAP so it's only performed when building a PV
    dom0, PVH dom0 builder doesn't require disabling SMAP.
    
    The fixes tag is to account for the wrong usage of cpu_has_smap in
    create_dom0(), it should instead have used
    boot_cpu_has(X86_FEATURE_XEN_SMAP).  Fix while moving the logic to apply to PV
    only.
    
    While there also make cr4_pv32_mask __ro_after_init.
    
    Fixes: 493ab190e5b1 ('xen/sm{e, a}p: allow disabling sm{e, a}p for Xen itself')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: fb1658221a31ec1db33253a80001191391e73b17
    master date: 2024-08-28 19:59:07 +0100
---
 xen/arch/x86/include/asm/setup.h |  2 ++
 xen/arch/x86/pv/dom0_build.c     | 40 +++++++++++++++++++++++++++++++++++-----
 xen/arch/x86/setup.c             | 20 +-------------------
 3 files changed, 38 insertions(+), 24 deletions(-)

diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h
index d75589178b..8f7dfefb4d 100644
--- a/xen/arch/x86/include/asm/setup.h
+++ b/xen/arch/x86/include/asm/setup.h
@@ -64,6 +64,8 @@ extern bool opt_dom0_verbose;
 extern bool opt_dom0_cpuid_faulting;
 extern bool opt_dom0_msr_relaxed;
 
+extern unsigned long cr4_pv32_mask;
+
 #define max_init_domid (0)
 
 #endif
diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index 57e58a02e7..07e9594493 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -354,11 +354,11 @@ static struct page_info * __init alloc_chunk(struct domain *d,
     return page;
 }
 
-int __init dom0_construct_pv(struct domain *d,
-                             const module_t *image,
-                             unsigned long image_headroom,
-                             module_t *initrd,
-                             const char *cmdline)
+static int __init dom0_construct(struct domain *d,
+                                 const module_t *image,
+                                 unsigned long image_headroom,
+                                 module_t *initrd,
+                                 const char *cmdline)
 {
     int i, rc, order, machine;
     bool compatible, compat;
@@ -1051,6 +1051,36 @@ out:
     return rc;
 }
 
+int __init dom0_construct_pv(struct domain *d,
+                             const module_t *image,
+                             unsigned long image_headroom,
+                             module_t *initrd,
+                             const char *cmdline)
+{
+    int rc;
+
+    /*
+     * Clear SMAP in CR4 to allow user-accesses in construct_dom0().  This
+     * prevents us needing to rewrite construct_dom0() in terms of
+     * copy_{to,from}_user().
+     */
+    if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
+    {
+        cr4_pv32_mask &= ~X86_CR4_SMAP;
+        write_cr4(read_cr4() & ~X86_CR4_SMAP);
+    }
+
+    rc = dom0_construct(d, image, image_headroom, initrd, cmdline);
+
+    if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
+    {
+        write_cr4(read_cr4() | X86_CR4_SMAP);
+        cr4_pv32_mask |= X86_CR4_SMAP;
+    }
+
+    return rc;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index eee20bb175..f1076c7203 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -79,8 +79,7 @@ bool __read_mostly use_invpcid;
 int8_t __initdata opt_probe_port_aliases = -1;
 boolean_param("probe-port-aliases", opt_probe_port_aliases);
 
-/* Only used in asm code and within this source file */
-unsigned long asmlinkage __read_mostly cr4_pv32_mask;
+unsigned long __ro_after_init cr4_pv32_mask;
 
 /* **** Linux config option: propagated to domain0. */
 /* "acpi=off":    Sisables both ACPI table parsing and interpreter. */
@@ -955,26 +954,9 @@ static struct domain *__init create_dom0(const module_t *image,
         }
     }
 
-    /*
-     * Temporarily clear SMAP in CR4 to allow user-accesses in construct_dom0().
-     * This saves a large number of corner cases interactions with
-     * copy_from_user().
-     */
-    if ( cpu_has_smap )
-    {
-        cr4_pv32_mask &= ~X86_CR4_SMAP;
-        write_cr4(read_cr4() & ~X86_CR4_SMAP);
-    }
-
     if ( construct_dom0(d, image, headroom, initrd, cmdline) != 0 )
         panic("Could not construct domain 0\n");
 
-    if ( cpu_has_smap )
-    {
-        write_cr4(read_cr4() | X86_CR4_SMAP);
-        cr4_pv32_mask |= X86_CR4_SMAP;
-    }
-
     return d;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 09:56:53 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 09:56:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803739.1214513 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOlR-00059s-UJ; Wed, 25 Sep 2024 09:56:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803739.1214513; Wed, 25 Sep 2024 09:56:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOlR-00059g-RR; Wed, 25 Sep 2024 09:56:53 +0000
Received: by outflank-mailman (input) for mailman id 803739;
 Wed, 25 Sep 2024 09:56:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOlQ-00058t-SJ
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:56:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOlQ-0006aE-RW
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:56:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOlQ-0007Ep-Ql
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:56:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MaapHdYWXbY7ITNbYax7uwyRFO6tP1Hbv/3XraWN2A4=; b=1SVaZOwbXkCzWTQ4Xw8GHbtdoW
	UQpN0fV3zJw8V+b0B37kfmZ6FFMRTpmAqt8N/LjU594yzl7A5U3NYw+o/1F8y5dIxqkiee5sfzIKr
	RxbsTn14K0Xlpf+V9N3L8M/E9Aq7jJQRfLpgJtHuSX0osuG9A/tsOD78jvBRKy0yGwFQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/HVM: correct partial HPET_STATUS write emulation
Message-Id: <E1stOlQ-0007Ep-Ql@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 09:56:52 +0000

commit 6e96dee93c60af4ee446f5e0fddf3b424824de18
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:40:03 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:40:03 2024 +0200

    x86/HVM: correct partial HPET_STATUS write emulation
    
    For partial writes the non-written parts of registers are folded into
    the full 64-bit value from what they're presently set to. That's wrong
    to do though when the behavior is write-1-to-clear: Writes not
    including to low 3 bits would unconditionally clear all ISR bits which
    are presently set. Re-calculate the value to use.
    
    Fixes: be07023be115 ("x86/vhpet: add support for level triggered interrupts")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 41d358d2f9607ba37c216effa39b9f1bc58de69d
    master date: 2024-08-29 10:02:20 +0200
---
 xen/arch/x86/hvm/hpet.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/hpet.c b/xen/arch/x86/hvm/hpet.c
index 87642575f9..f0e5f877f4 100644
--- a/xen/arch/x86/hvm/hpet.c
+++ b/xen/arch/x86/hvm/hpet.c
@@ -404,7 +404,8 @@ static int cf_check hpet_write(
         break;
 
     case HPET_STATUS:
-        /* write 1 to clear. */
+        /* Write 1 to clear. Therefore don't use new_val directly here. */
+        new_val = val << ((addr & 7) * 8);
         while ( new_val )
         {
             bool active;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 09:57:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 09:57:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803740.1214519 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOlc-0005Sy-0u; Wed, 25 Sep 2024 09:57:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803740.1214519; Wed, 25 Sep 2024 09:57:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOlb-0005Sp-Sv; Wed, 25 Sep 2024 09:57:03 +0000
Received: by outflank-mailman (input) for mailman id 803740;
 Wed, 25 Sep 2024 09:57:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOla-0005Py-VL
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:57:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOla-0006aY-UX
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:57:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOla-0007Fh-Td
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:57:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=N/r5tHklEl/GAdu4z5rGUCktlJMwKyjCoVis29wRm2Y=; b=6oTq8oD/6j/ixqAYzlGVJtSHe/
	ETWw846TwBISB/lEt1MXA9hN6EkkWl9Q9Lm5EmEpkkqXiev3ns0vVN5dvVddV+ZG2KxbsaVUuWtC7
	u7Wm1YELj41tLKNihCyv7tMrLzixdFqsFvpHbK1uG0Udxp/27ylyOHsfS2v6HiwZ2YrM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] Arm64: adjust __irq_to_desc() to fix build with gcc14
Message-Id: <E1stOla-0007Fh-Td@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 09:57:02 +0000

commit ee826bc490d6036ed9b637ada014a2d59d151f79
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:40:34 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:40:34 2024 +0200

    Arm64: adjust __irq_to_desc() to fix build with gcc14
    
    With the original code I observe
    
    In function ‘__irq_to_desc’,
        inlined from ‘route_irq_to_guest’ at arch/arm/irq.c:465:12:
    arch/arm/irq.c:54:16: error: array subscript -2 is below array bounds of ‘irq_desc_t[32]’ {aka ‘struct irq_desc[32]’} [-Werror=array-bounds=]
       54 |         return &this_cpu(local_irq_desc)[irq];
          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    which looks pretty bogus: How in the world does the compiler arrive at
    -2 when compiling route_irq_to_guest()? Yet independent of that the
    function's parameter wants to be of unsigned type anyway, as shown by
    a vast majority of callers (others use plain int when they really mean
    non-negative quantities). With that adjustment the code compiles fine
    again.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
    master commit: 99f942f3d410059dc223ee0a908827e928ef3592
    master date: 2024-08-29 10:03:53 +0200
---
 xen/arch/arm/include/asm/irq.h | 2 +-
 xen/arch/arm/irq.c             | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/include/asm/irq.h b/xen/arch/arm/include/asm/irq.h
index ec437add09..88e060bf29 100644
--- a/xen/arch/arm/include/asm/irq.h
+++ b/xen/arch/arm/include/asm/irq.h
@@ -56,7 +56,7 @@ extern const unsigned int nr_irqs;
 struct irq_desc;
 struct irqaction;
 
-struct irq_desc *__irq_to_desc(int irq);
+struct irq_desc *__irq_to_desc(unsigned int irq);
 
 #define irq_to_desc(irq)    __irq_to_desc(irq)
 
diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 6b89f64fd1..b9757d7ad3 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -48,7 +48,7 @@ void irq_end_none(struct irq_desc *irq)
 static irq_desc_t irq_desc[NR_IRQS];
 static DEFINE_PER_CPU(irq_desc_t[NR_LOCAL_IRQS], local_irq_desc);
 
-struct irq_desc *__irq_to_desc(int irq)
+struct irq_desc *__irq_to_desc(unsigned int irq)
 {
     if ( irq < NR_LOCAL_IRQS )
         return &this_cpu(local_irq_desc)[irq];
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 09:57:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 09:57:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803744.1214521 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOlm-0005ia-2W; Wed, 25 Sep 2024 09:57:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803744.1214521; Wed, 25 Sep 2024 09:57:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOll-0005iQ-W9; Wed, 25 Sep 2024 09:57:13 +0000
Received: by outflank-mailman (input) for mailman id 803744;
 Wed, 25 Sep 2024 09:57:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOll-0005i2-26
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:57:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOll-0006ah-1I
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:57:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOll-0007Gi-0d
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:57:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=okl/CXLb2KkHA0iJMehwm3R8YOgevURaGZqcOfB+4HU=; b=YA/lLdmuBKQ4+X6lgtZODHyc6m
	0UIE3XzRIHRrjavESxlSOKg3JJbowoQbrcivHj5vt4BMCucA3sywGdZ27EYNJOxoNIwFOsYFcyr7U
	p6TkEchBufPIOQmCrDH5YkzKKXhhkOpQ61a9uADVHD4CPPcwi2zTc75MQiIPE/tOE5yQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] libxl: Fix nul-termination of the return value of libxl_xen_console_read_line()
Message-Id: <E1stOll-0007Gi-0d@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 09:57:13 +0000

commit c18635fd69fc2da238f00a26ab707f1b2a50bf64
Author:     Javi Merino <javi.merino@cloud.com>
AuthorDate: Tue Sep 24 14:41:06 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:41:06 2024 +0200

    libxl: Fix nul-termination of the return value of libxl_xen_console_read_line()
    
    When built with ASAN, "xl dmesg" crashes in the "printf("%s", line)"
    call in main_dmesg().  ASAN reports a heap buffer overflow: an
    off-by-one access to cr->buffer.
    
    The readconsole sysctl copies up to count characters into the buffer,
    but it does not add a null character at the end.  Despite the
    documentation of libxl_xen_console_read_line(), line_r is not
    nul-terminated if 16384 characters were copied to the buffer.
    
    Fix this by asking xc_readconsolering() to fill the buffer up to size
    - 1.  As the number of characters in the buffer is only needed in
    libxl_xen_console_read_line(), make it a local variable there instead
    of part of the libxl__xen_console_reader struct.
    
    Fixes: 4024bae739cc ("xl: Add subcommand 'xl dmesg'")
    Reported-by: Edwin Török <edwin.torok@cloud.com>
    Signed-off-by: Javi Merino <javi.merino@cloud.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: bb03169bcb6ecccf372de1f6b9285cd519a26bb8
    master date: 2024-09-03 10:53:44 +0100
---
 tools/libs/light/libxl_console.c  | 19 +++++++++++++++----
 tools/libs/light/libxl_internal.h |  1 -
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/tools/libs/light/libxl_console.c b/tools/libs/light/libxl_console.c
index a563c9d3c7..9f736b8913 100644
--- a/tools/libs/light/libxl_console.c
+++ b/tools/libs/light/libxl_console.c
@@ -774,12 +774,17 @@ libxl_xen_console_reader *
 {
     GC_INIT(ctx);
     libxl_xen_console_reader *cr;
-    unsigned int size = 16384;
+    /*
+     * We want xen to fill the buffer in as few hypercalls as
+     * possible, but xen will not nul-terminate it.  The default size
+     * of Xen's console buffer is 16384.  Leave one byte at the end
+     * for the null character.
+     */
+    unsigned int size = 16384 + 1;
 
     cr = libxl__zalloc(NOGC, sizeof(libxl_xen_console_reader));
     cr->buffer = libxl__zalloc(NOGC, size);
     cr->size = size;
-    cr->count = size;
     cr->clear = clear;
     cr->incremental = 1;
 
@@ -800,10 +805,16 @@ int libxl_xen_console_read_line(libxl_ctx *ctx,
                                 char **line_r)
 {
     int ret;
+    /*
+     * Number of chars to copy into the buffer.  xc_readconsolering()
+     * does not add a null character at the end, so leave a space for
+     * us to add it.
+     */
+    unsigned int nr_chars = cr->size - 1;
     GC_INIT(ctx);
 
     memset(cr->buffer, 0, cr->size);
-    ret = xc_readconsolering(ctx->xch, cr->buffer, &cr->count,
+    ret = xc_readconsolering(ctx->xch, cr->buffer, &nr_chars,
                              cr->clear, cr->incremental, &cr->index);
     if (ret < 0) {
         LOGE(ERROR, "reading console ring buffer");
@@ -811,7 +822,7 @@ int libxl_xen_console_read_line(libxl_ctx *ctx,
         return ERROR_FAIL;
     }
     if (!ret) {
-        if (cr->count) {
+        if (nr_chars) {
             *line_r = cr->buffer;
             ret = 1;
         } else {
diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h
index 3b58bb2d7f..96d14f5746 100644
--- a/tools/libs/light/libxl_internal.h
+++ b/tools/libs/light/libxl_internal.h
@@ -2077,7 +2077,6 @@ _hidden char *libxl__uuid2string(libxl__gc *gc, const libxl_uuid uuid);
 struct libxl__xen_console_reader {
     char *buffer;
     unsigned int size;
-    unsigned int count;
     unsigned int clear;
     unsigned int incremental;
     unsigned int index;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 09:57:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 09:57:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803750.1214525 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOlw-0005pt-4L; Wed, 25 Sep 2024 09:57:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803750.1214525; Wed, 25 Sep 2024 09:57:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOlw-0005pm-1S; Wed, 25 Sep 2024 09:57:24 +0000
Received: by outflank-mailman (input) for mailman id 803750;
 Wed, 25 Sep 2024 09:57:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOlv-0005pW-4t
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:57:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOlv-0006c7-4D
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:57:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOlv-0007Hb-3N
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:57:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lRiP+vCqVA0WAgtYuXY/2Pk1VQGPrGmpSVTkjWe6xtM=; b=uT+0jBR/aObPTI+3SPIOPeS+B/
	+R1Wo5YIkwWDpLPI8QA0Gjz2hS1nEv+W+rGgAcYqKsmZMP94irvKaX0PVWj3PwoBNdwpLOIFtXhNf
	1yzcG68pl4IxC0g9ulcDKk1hqjxIkimJECLN4ZXpKlZy+tNRvQNQTiEUfgDJj1LRa4eU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] SUPPORT.md: split XSM from Flask
Message-Id: <E1stOlv-0007Hb-3N@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 09:57:23 +0000

commit 3ceb79ceabab58305a0f35aed0117537f7a6b922
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:41:51 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:41:51 2024 +0200

    SUPPORT.md: split XSM from Flask
    
    XSM is a generic framework, which in particular is also used by SILO.
    With this it can't really be experimental: Arm mandates SILO for having
    a security supported configuration.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    master commit: d7c18b8720824d7efc39ffa7296751e1812865a9
    master date: 2024-09-04 16:05:03 +0200
---
 SUPPORT.md | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 1d8b38cbd0..ba6052477b 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -768,13 +768,21 @@ Compile time disabled for ARM by default.
 
     Status, x86: Supported, not security supported
 
-### XSM & FLASK
+### XSM (Xen Security Module) Framework
+
+XSM is a security policy framework.  The dummy implementation is covered by this
+statement, and implements a policy whereby dom0 is all powerful.  See below for
+alternative modules (FLASK, SILO).
+
+    Status: Supported
+
+### FLASK XSM Module
 
     Status: Experimental
 
 Compile time disabled by default.
 
-Also note that using XSM
+Also note that using FLASK
 to delegate various domain control hypercalls
 to particular other domains, rather than only permitting use by dom0,
 is also specifically excluded from security support for many hypercalls.
@@ -787,6 +795,13 @@ Please see XSA-77 for more details.
 The default policy includes FLASK labels and roles for a "typical" Xen-based system
 with dom0, driver domains, stub domains, domUs, and so on.
 
+### SILO XSM Module
+
+SILO extends the dummy policy by enforcing that DomU-s can only communicate
+with Dom0, yet not with each other.
+
+    Status: Supported
+
 ## Virtual Hardware, Hypervisor
 
 ### x86/Nested PV
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 09:57:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 09:57:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803751.1214529 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOm6-0005uO-5l; Wed, 25 Sep 2024 09:57:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803751.1214529; Wed, 25 Sep 2024 09:57:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOm6-0005uG-2z; Wed, 25 Sep 2024 09:57:34 +0000
Received: by outflank-mailman (input) for mailman id 803751;
 Wed, 25 Sep 2024 09:57:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOm5-0005u2-7l
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:57:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOm5-0006cU-6y
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:57:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOm5-0007IV-6J
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:57:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=U6MTyK1oLpdfvp6nwRU23geP7SkKjy+QOe27a6o/Q4Y=; b=xd7LYWhXLEQnvB4skLViT6bLMD
	5FnOLhd3PgUKCztt9rFU3XP+F+1i5MbB0H3SK8n6cuulExYV0BV8yCpauQyrtnMjw3pUL52KywmQ2
	Jw7Z8dFGJisDDIAPR6L9qMQMk+MnQbMY9B4yGFqRsV6GkVVAz7F8JF9qlrBXAnxKnY+s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86: fix UP build with gcc14
Message-Id: <E1stOm5-0007IV-6J@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 09:57:33 +0000

commit d625c4e9fb46ef1b81a5b32d8fe1774c432cddd6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:41:59 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:41:59 2024 +0200

    x86: fix UP build with gcc14
    
    The complaint is:
    
    In file included from ././include/xen/config.h:17,
                     from <command-line>:
    arch/x86/smpboot.c: In function ‘link_thread_siblings.constprop’:
    ./include/asm-generic/percpu.h:16:51: error: array subscript [0, 0] is outside array bounds of ‘long unsigned int[1]’ [-Werror=array-bounds=]
       16 |     (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
    ./include/xen/compiler.h:140:29: note: in definition of macro ‘RELOC_HIDE’
      140 |     (typeof(ptr)) (__ptr + (off)); })
          |                             ^~~
    arch/x86/smpboot.c:238:27: note: in expansion of macro ‘per_cpu’
      238 |     cpumask_set_cpu(cpu2, per_cpu(cpu_sibling_mask, cpu1));
          |                           ^~~~~~~
    In file included from ./arch/x86/include/generated/asm/percpu.h:1,
                     from ./include/xen/percpu.h:30,
                     from ./arch/x86/include/asm/cpuid.h:9,
                     from ./arch/x86/include/asm/cpufeature.h:11,
                     from ./arch/x86/include/asm/system.h:6,
                     from ./include/xen/list.h:11,
                     from ./include/xen/mm.h:68,
                     from arch/x86/smpboot.c:12:
    ./include/asm-generic/percpu.h:12:22: note: while referencing ‘__per_cpu_offset’
       12 | extern unsigned long __per_cpu_offset[NR_CPUS];
          |                      ^~~~~~~~~~~~~~~~
    
    Which I consider bogus in the first place ("array subscript [0, 0]" vs a
    1-element array). Yet taking the experience from 99f942f3d410 ("Arm64:
    adjust __irq_to_desc() to fix build with gcc14") I guessed that
    switching function parameters to unsigned int (which they should have
    been anyway) might help. And voilà ...
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: a2de7dc4d845738e734b10fce6550c89c6b1092c
    master date: 2024-09-04 16:09:28 +0200
---
 xen/arch/x86/smpboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 8aa621533f..0a89f22a39 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -226,7 +226,7 @@ static int booting_cpu;
 /* CPUs for which sibling maps can be computed. */
 static cpumask_t cpu_sibling_setup_map;
 
-static void link_thread_siblings(int cpu1, int cpu2)
+static void link_thread_siblings(unsigned int cpu1, unsigned int cpu2)
 {
     cpumask_set_cpu(cpu1, per_cpu(cpu_sibling_mask, cpu2));
     cpumask_set_cpu(cpu2, per_cpu(cpu_sibling_mask, cpu1));
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 09:57:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 09:57:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803752.1214532 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOmG-0005xu-6v; Wed, 25 Sep 2024 09:57:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803752.1214532; Wed, 25 Sep 2024 09:57:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOmG-0005xm-4O; Wed, 25 Sep 2024 09:57:44 +0000
Received: by outflank-mailman (input) for mailman id 803752;
 Wed, 25 Sep 2024 09:57:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOmF-0005xb-AP
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:57:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOmF-0006cu-9k
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:57:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOmF-0007JF-96
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:57:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Cwjjt9NeJh6Ua8oe1chYleJUF74AZpI9/YS9h3XJ3r8=; b=sznyJjGuqIjFL7EAyKQ2j7I7Y4
	M23oAfX4E5jhQJFFVSv4ZP32hvG5M4yjw327LDyEF4UzgxV31RqR/pnJyo/v7bIeTtm3rA3sdR3Ws
	tec+8650Euvoxn89GHpwNtzIE6whVAFgbfMuOqjYXJkgRT8CSM2HbobshDvEIcylydOo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86emul/test: fix build with gas 2.43
Message-Id: <E1stOmF-0007JF-96@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 09:57:43 +0000

commit 78d412f8bc3d78458cd868ba375ad30175194d91
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:42:39 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:42:39 2024 +0200

    x86emul/test: fix build with gas 2.43
    
    Drop explicit {evex} pseudo-prefixes. New gas (validly) complains when
    they're used on things other than instructions. Our use was potentially
    ahead of macro invocations - see simd.h's "override" macro.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 3c09288298af881ea1bb568740deb2d2a06bcd41
    master date: 2024-09-06 08:41:18 +0200
---
 tools/tests/x86_emulator/simd.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/tests/x86_emulator/simd.c b/tools/tests/x86_emulator/simd.c
index 263cea662d..d68a7364c2 100644
--- a/tools/tests/x86_emulator/simd.c
+++ b/tools/tests/x86_emulator/simd.c
@@ -333,7 +333,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # if FLOAT_SIZE == 4
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vbroadcastss %1, %0" \
+    asm ( "vbroadcastss %1, %0" \
           : "=v" (t_) : "m" (*(float[1]){ x }) ); \
     t_; \
 })
@@ -401,14 +401,14 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 #  if VEC_SIZE >= 32
 #   define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vbroadcastsd %1, %0" : "=v" (t_) \
+    asm ( "vbroadcastsd %1, %0" : "=v" (t_) \
           : "m" (*(double[1]){ x }) ); \
     t_; \
 })
 #  else
 #   define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastq %1, %0" \
+    asm ( "vpbroadcastq %1, %0" \
           : "=v" (t_) : "m" (*(double[1]){ x }) ); \
     t_; \
 })
@@ -601,7 +601,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # if INT_SIZE == 4 || UINT_SIZE == 4
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastd %1, %0" \
+    asm ( "vpbroadcastd %1, %0" \
           : "=v" (t_) : "m" (*(int[1]){ x }) ); \
     t_; \
 })
@@ -649,7 +649,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # elif INT_SIZE == 8 || UINT_SIZE == 8
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastq %1, %0" \
+    asm ( "vpbroadcastq %1, %0" \
           : "=v" (t_) : "m" (*(long long[1]){ x }) ); \
     t_; \
 })
@@ -716,7 +716,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # if INT_SIZE == 1 || UINT_SIZE == 1
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastb %1, %0" \
+    asm ( "vpbroadcastb %1, %0" \
           : "=v" (t_) : "m" (*(char[1]){ x }) ); \
     t_; \
 })
@@ -745,7 +745,7 @@ static inline vec_t movlhps(vec_t x, vec_t y) {
 # elif INT_SIZE == 2 || UINT_SIZE == 2
 #  define broadcast(x) ({ \
     vec_t t_; \
-    asm ( "%{evex%} vpbroadcastw %1, %0" \
+    asm ( "vpbroadcastw %1, %0" \
           : "=v" (t_) : "m" (*(short[1]){ x }) ); \
     t_; \
 })
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 09:57:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 09:57:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803753.1214536 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOmR-00061p-8E; Wed, 25 Sep 2024 09:57:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803753.1214536; Wed, 25 Sep 2024 09:57:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOmR-00061i-5p; Wed, 25 Sep 2024 09:57:55 +0000
Received: by outflank-mailman (input) for mailman id 803753;
 Wed, 25 Sep 2024 09:57:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOmP-00061S-DA
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:57:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOmP-0006d1-CV
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:57:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOmP-0007K5-Bn
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:57:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZHqok7nncXrKTD8/sLIRImgRHsi5S2O4ejZ0MP58CLc=; b=QwtUkEbb4UZKVuYsK7QtM3asdq
	shM4mJpA6H2DcpQW88UHhX0OnWQalD7BxCmqdHs5WVDW0HTZ8QrkM8bdgnpfxXHJwWzeDDDm022BY
	Ovb/HnonztmWD8mspiRumBAMQ6MBCheXsKtKyIJI5KRp+ODCqnzLVMnA4yVkySoB+p6g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/HVM: properly reject "indirect" VRAM writes
Message-Id: <E1stOmP-0007K5-Bn@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 09:57:53 +0000

commit ec3999e205ccadbeb8ab1f8420dea02fee2b5a5d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:43:02 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:43:02 2024 +0200

    x86/HVM: properly reject "indirect" VRAM writes
    
    While ->count will only be different from 1 for "indirect" (data in
    guest memory) accesses, it being 1 does not exclude the request being an
    "indirect" one. Check both to be on the safe side, and bring the ->count
    part also in line with what ioreq_send_buffered() actually refuses to
    handle.
    
    Fixes: 3bbaaec09b1b ("x86/hvm: unify stdvga mmio intercept with standard mmio intercept")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: eb7cd0593d88c4b967a24bca8bd30591966676cd
    master date: 2024-09-12 09:13:04 +0200
---
 xen/arch/x86/hvm/stdvga.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index b16c59f772..5f02d88615 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -530,14 +530,14 @@ static bool cf_check stdvga_mem_accept(
 
     spin_lock(&s->lock);
 
-    if ( p->dir == IOREQ_WRITE && p->count > 1 )
+    if ( p->dir == IOREQ_WRITE && (p->data_is_ptr || p->count != 1) )
     {
         /*
          * We cannot return X86EMUL_UNHANDLEABLE on anything other then the
          * first cycle of an I/O. So, since we cannot guarantee to always be
          * able to send buffered writes, we have to reject any multi-cycle
-         * I/O and, since we are rejecting an I/O, we must invalidate the
-         * cache.
+         * or "indirect" I/O and, since we are rejecting an I/O, we must
+         * invalidate the cache.
          * Single-cycle write transactions are accepted even if the cache is
          * not active since we can assert, when in stdvga mode, that writes
          * to VRAM have no side effect and thus we can try to buffer them.
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 09:58:05 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 09:58:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803754.1214541 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOmb-00066B-9x; Wed, 25 Sep 2024 09:58:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803754.1214541; Wed, 25 Sep 2024 09:58:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOmb-000663-7F; Wed, 25 Sep 2024 09:58:05 +0000
Received: by outflank-mailman (input) for mailman id 803754;
 Wed, 25 Sep 2024 09:58:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOmZ-00065p-Fx
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:58:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOmZ-0006dI-FK
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:58:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOmZ-0007Lb-Ed
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:58:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Wqxeo/LgWefC53oxseGSgnE8snBxf/WnuBCkd5dCqjc=; b=ZrZfwPsTHigIXkT3Le29qQxKXs
	UvAEYz+2mTholb8WenZLV2alaqT6DMFPvgQ08TXBclR8GUO1o2R2VgYTy83P2DsdJ1IiL2pAlJGQ3
	3xTCxUAZSwi1rFLj/E6p5k6Een6ccI7hneeNsuyvEngnyzPicHzBv7IrWIfzRg8GkRyc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] xen/x86/pvh: handle ACPI RSDT table in PVH Dom0 build
Message-Id: <E1stOmZ-0007Lb-Ed@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 09:58:03 +0000

commit d0ea9b319d4ca04e29ef533db0c3655a78dec315
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Tue Sep 24 14:43:24 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:43:24 2024 +0200

    xen/x86/pvh: handle ACPI RSDT table in PVH Dom0 build
    
    Xen always generates an XSDT table even if the firmware only provided an
    RSDT table.  Copy the RSDT header from the firmware table, adjusting the
    signature, for the XSDT table when not provided by the firmware.
    
    This is necessary to run Xen on QEMU.
    
    Fixes: 1d74282c455f ('x86: setup PVHv2 Dom0 ACPI tables')
    Suggested-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 6e7f7a0c16c4d406bda6d4a900252ff63a7c5fad
    master date: 2024-09-12 09:18:25 +0200
---
 xen/arch/x86/hvm/dom0_build.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index f3eddb6846..3dd913bdb0 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -1078,7 +1078,16 @@ static int __init pvh_setup_acpi_xsdt(struct domain *d, paddr_t madt_addr,
         rc = -EINVAL;
         goto out;
     }
-    xsdt_paddr = rsdp->xsdt_physical_address;
+    /*
+     * Note the header is the same for both RSDT and XSDT, so it's fine to
+     * copy the native RSDT header to the Xen crafted XSDT if no native
+     * XSDT is available.
+     */
+    if ( rsdp->revision > 1 && rsdp->xsdt_physical_address )
+        xsdt_paddr = rsdp->xsdt_physical_address;
+    else
+        xsdt_paddr = rsdp->rsdt_physical_address;
+
     acpi_os_unmap_memory(rsdp, sizeof(*rsdp));
     table = acpi_os_map_memory(xsdt_paddr, sizeof(*table));
     if ( !table )
@@ -1090,6 +1099,12 @@ static int __init pvh_setup_acpi_xsdt(struct domain *d, paddr_t madt_addr,
     xsdt->header = *table;
     acpi_os_unmap_memory(table, sizeof(*table));
 
+    /*
+     * In case the header is an RSDT copy, unconditionally ensure it has
+     * an XSDT sig.
+     */
+    xsdt->header.signature[0] = 'X';
+
     /* Add the custom MADT. */
     xsdt->table_offset_entry[0] = madt_addr;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 09:58:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 09:58:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803755.1214546 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOml-0006Di-Cb; Wed, 25 Sep 2024 09:58:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803755.1214546; Wed, 25 Sep 2024 09:58:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOml-0006DE-8k; Wed, 25 Sep 2024 09:58:15 +0000
Received: by outflank-mailman (input) for mailman id 803755;
 Wed, 25 Sep 2024 09:58:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOmj-0006D1-Ir
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:58:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOmj-0006dV-I7
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:58:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOmj-0007MK-HQ
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:58:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UIXeDfM7ZKq8FhKz1KoKivGIXiTez1ED9RwWaHkE7XI=; b=dXImj0gZJcw0ohpQyvX0Vro8dx
	gU9HA7U2C9rpMmYl81YOPiwx7kIvBZzwIFYYxcYPBAmFITObFtLfW0xyW0lXx/ExpWS8IxOQRebIT
	Rf+J2yOaRDlLoykNAYD5nTGCI/OMzfqYTNnN7PHBvJOAhLbBNTxbVIY6yiIa4SMJIRiY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] blkif: reconcile protocol specification with in-use implementations
Message-Id: <E1stOmj-0007MK-HQ@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 09:58:13 +0000

commit 933416b13966a3fa2a37b1f645c23afbd8fb6d09
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Sep 24 14:43:50 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:43:50 2024 +0200

    blkif: reconcile protocol specification with in-use implementations
    
    Current blkif implementations (both backends and frontends) have all slight
    differences about how they handle the 'sector-size' xenstore node, and how
    other fields are derived from this value or hardcoded to be expressed in units
    of 512 bytes.
    
    To give some context, this is an excerpt of how different implementations use
    the value in 'sector-size' as the base unit for to other fields rather than
    just to set the logical sector size of the block device:
    
                            │ sectors xenbus node │ requests sector_number │ requests {first,last}_sect
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    FreeBSD blk{front,back} │     sector-size     │      sector-size       │           512
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    Linux blk{front,back}   │         512         │          512           │           512
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    QEMU blkback            │     sector-size     │      sector-size       │       sector-size
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    Windows blkfront        │     sector-size     │      sector-size       │       sector-size
    ────────────────────────┼─────────────────────┼────────────────────────┼───────────────────────────
    MiniOS                  │     sector-size     │          512           │           512
    
    An attempt was made by 67e1c050e36b in order to change the base units of the
    request fields and the xenstore 'sectors' node.  That however only lead to more
    confusion, as the specification now clearly diverged from the reference
    implementation in Linux.  Such change was only implemented for QEMU Qdisk
    and Windows PV blkfront.
    
    Partially revert to the state before 67e1c050e36b while adjusting the
    documentation for 'sectors' to match what it used to be previous to
    2fa701e5346d:
    
     * Declare 'feature-large-sector-size' deprecated.  Frontends should not expose
       the node, backends should not make decisions based on its presence.
    
     * Clarify that 'sectors' xenstore node and the requests fields are always in
       512-byte units, like it was previous to 2fa701e5346d and 67e1c050e36b.
    
    All base units for the fields used in the protocol are 512-byte based, the
    xenbus 'sector-size' field is only used to signal the logic block size.  When
    'sector-size' is greater than 512, blkfront implementations must make sure that
    the offsets and sizes (despite being expressed in 512-byte units) are aligned
    to the logical block size specified in 'sector-size', otherwise the backend
    will fail to process the requests.
    
    This will require changes to some of the frontends and backends in order to
    properly support 'sector-size' nodes greater than 512.
    
    Fixes: 2fa701e5346d ('blkif.h: Provide more complete documentation of the blkif interface')
    Fixes: 67e1c050e36b ('public/io/blkif.h: try to fix the semantics of sector based quantities')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: 221f2748e8dabe8361b8cdfcffbeab9102c4c899
    master date: 2024-09-12 14:04:56 +0200
---
 xen/include/public/io/blkif.h | 52 ++++++++++++++++++++++++++++++++-----------
 1 file changed, 39 insertions(+), 13 deletions(-)

diff --git a/xen/include/public/io/blkif.h b/xen/include/public/io/blkif.h
index 22f1eef0c0..9b00d633d3 100644
--- a/xen/include/public/io/blkif.h
+++ b/xen/include/public/io/blkif.h
@@ -237,12 +237,16 @@
  * sector-size
  *      Values:         <uint32_t>
  *
- *      The logical block size, in bytes, of the underlying storage. This
- *      must be a power of two with a minimum value of 512.
+ *      The logical block size, in bytes, of the underlying storage. This must
+ *      be a power of two with a minimum value of 512.  The sector size should
+ *      only be used for request segment length and alignment.
  *
- *      NOTE: Because of implementation bugs in some frontends this must be
- *            set to 512, unless the frontend advertizes a non-zero value
- *            in its "feature-large-sector-size" xenbus node. (See below).
+ *      When exposing a device that uses a logical sector size of 4096, the
+ *      only difference xenstore wise will be that 'sector-size' (and possibly
+ *      'physical-sector-size' if supported by the backend) will be 4096, but
+ *      the 'sectors' node will still be calculated using 512 byte units.  The
+ *      sector base units in the ring requests fields will all be 512 byte
+ *      based despite the logical sector size exposed in 'sector-size'.
  *
  * physical-sector-size
  *      Values:         <uint32_t>
@@ -254,9 +258,9 @@
  * sectors
  *      Values:         <uint64_t>
  *
- *      The size of the backend device, expressed in units of "sector-size".
- *      The product of "sector-size" and "sectors" must also be an integer
- *      multiple of "physical-sector-size", if that node is present.
+ *      The size of the backend device, expressed in units of 512b.  The
+ *      product of "sectors" * 512 must also be an integer multiple of
+ *      "physical-sector-size", if that node is present.
  *
  *****************************************************************************
  *                            Frontend XenBus Nodes
@@ -338,6 +342,7 @@
  * feature-large-sector-size
  *      Values:         0/1 (boolean)
  *      Default Value:  0
+ *      Notes:          DEPRECATED, 12
  *
  *      A value of "1" indicates that the frontend will correctly supply and
  *      interpret all sector-based quantities in terms of the "sector-size"
@@ -411,6 +416,11 @@
  *(10) The discard-secure property may be present and will be set to 1 if the
  *     backing device supports secure discard.
  *(11) Only used by Linux and NetBSD.
+ *(12) Possibly only ever implemented by the QEMU Qdisk backend and the Windows
+ *     PV block frontend.  Other backends and frontends supported 'sector-size'
+ *     values greater than 512 before such feature was added.  Frontends should
+ *     not expose this node, neither should backends make any decisions based
+ *     on it being exposed by the frontend.
  */
 
 /*
@@ -619,11 +629,14 @@
 #define BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST 8
 
 /*
- * NB. 'first_sect' and 'last_sect' in blkif_request_segment, as well as
- * 'sector_number' in blkif_request, blkif_request_discard and
- * blkif_request_indirect are sector-based quantities. See the description
- * of the "feature-large-sector-size" frontend xenbus node above for
- * more information.
+ * NB. 'first_sect' and 'last_sect' in blkif_request_segment are all in units
+ * of 512 bytes, despite the 'sector-size' xenstore node possibly having a
+ * value greater than 512.
+ *
+ * The value in 'first_sect' and 'last_sect' fields must be setup so that the
+ * resulting segment offset and size is aligned to the logical sector size
+ * reported by the 'sector-size' xenstore node, see 'Backend Device Properties'
+ * section.
  */
 struct blkif_request_segment {
     grant_ref_t gref;        /* reference to I/O buffer frame        */
@@ -634,6 +647,10 @@ struct blkif_request_segment {
 
 /*
  * Starting ring element for any I/O request.
+ *
+ * The 'sector_number' field is in units of 512b, despite the value of the
+ * 'sector-size' xenstore node.  Note however that the offset in
+ * 'sector_number' must be aligned to 'sector-size'.
  */
 struct blkif_request {
     uint8_t        operation;    /* BLKIF_OP_???                         */
@@ -648,6 +665,10 @@ typedef struct blkif_request blkif_request_t;
 /*
  * Cast to this structure when blkif_request.operation == BLKIF_OP_DISCARD
  * sizeof(struct blkif_request_discard) <= sizeof(struct blkif_request)
+ *
+ * The 'sector_number' field is in units of 512b, despite the value of the
+ * 'sector-size' xenstore node.  Note however that the offset in
+ * 'sector_number' must be aligned to 'sector-size'.
  */
 struct blkif_request_discard {
     uint8_t        operation;    /* BLKIF_OP_DISCARD                     */
@@ -660,6 +681,11 @@ struct blkif_request_discard {
 };
 typedef struct blkif_request_discard blkif_request_discard_t;
 
+/*
+ * The 'sector_number' field is in units of 512b, despite the value of the
+ * 'sector-size' xenstore node.  Note however that the offset in
+ * 'sector_number' must be aligned to 'sector-size'.
+ */
 struct blkif_request_indirect {
     uint8_t        operation;    /* BLKIF_OP_INDIRECT                    */
     uint8_t        indirect_op;  /* BLKIF_OP_{READ/WRITE}                */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 09:58:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 09:58:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803756.1214549 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOmv-0006Jt-Ee; Wed, 25 Sep 2024 09:58:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803756.1214549; Wed, 25 Sep 2024 09:58:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stOmv-0006Ji-Bo; Wed, 25 Sep 2024 09:58:25 +0000
Received: by outflank-mailman (input) for mailman id 803756;
 Wed, 25 Sep 2024 09:58:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOmt-0006JN-Lb
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:58:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOmt-0006de-Kr
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:58:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stOmt-0007NE-KD
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 09:58:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lQuBrR+p1avBtbzjIF2TlAhfELcWa+yBOo/hg3h6R4g=; b=ga/n1YHEY9Pl7FXQ/yI0jvGagA
	oRcsyWeUw6OkpI60ViCRd4pj5zWerMu9lvDkhrZZ0VPGYhKkxHLJTcaWKoZAMIU8QrWMQ9M4vwJHC
	IRdXrky9UpyCbC4AHDjxWD9/tc0CSGYP92NoN3L6e+SNUmrthjdTHM25TZrZpGcCP4bg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] xen/ucode: Fix buffer under-run when parsing AMD containers
Message-Id: <E1stOmt-0007NE-KD@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 09:58:23 +0000

commit 2c61ab407172682e1382204a8305107f19e2951b
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Tue Sep 24 14:44:10 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:44:10 2024 +0200

    xen/ucode: Fix buffer under-run when parsing AMD containers
    
    The AMD container format has no formal spec.  It is, at best, precision
    guesswork based on AMD's prior contributions to open source projects.  The
    Equivalence Table has both an explicit length, and an expectation of having a
    NULL entry at the end.
    
    Xen was sanity checking the NULL entry, but without confirming that an entry
    was present, resulting in a read off the front of the buffer.  With some
    manual debugging/annotations this manifests as:
    
      (XEN) *** Buf ffff83204c00b19c, eq ffff83204c00b194
      (XEN) *** eq: 0c 00 00 00 44 4d 41 00 00 00 00 00 00 00 00 00 aa aa aa aa
                                ^-Actual buffer-------------------^
      (XEN) *** installed_cpu: 000c
      (XEN) microcode: Bad equivalent cpu table
      (XEN) Parsing microcode blob error -22
    
    When loaded by hypercall, the 4 bytes interpreted as installed_cpu happen to
    be the containing struct ucode_buf's len field, and luckily will be nonzero.
    
    When loaded at boot, it's possible for the access to #PF if the module happens
    to have been placed on a 2M boundary by the bootloader.  Under Linux, it will
    commonly be the end of the CPIO header.
    
    Drop the probe of the NULL entry; Nothing else cares.  A container without one
    is well formed, insofar that we can still parse it correctly.  With this
    dropped, the same container results in:
    
      (XEN) microcode: couldn't find any matching ucode in the provided blob!
    
    Fixes: 4de936a38aa9 ("x86/ucode/amd: Rework parsing logic in cpu_request_microcode()")
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a8bf14f6f331d4f428010b4277b67c33f561ed19
    master date: 2024-09-13 15:23:30 +0100
---
 xen/arch/x86/cpu/microcode/amd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index f76a563c8b..9fe6e29751 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -336,8 +336,7 @@ static struct microcode_patch *cf_check cpu_request_microcode(
         if ( size < sizeof(*et) ||
              (et = buf)->type != UCODE_EQUIV_CPU_TABLE_TYPE ||
              size - sizeof(*et) < et->len ||
-             et->len % sizeof(et->eq[0]) ||
-             et->eq[(et->len / sizeof(et->eq[0])) - 1].installed_cpu )
+             et->len % sizeof(et->eq[0]) )
         {
             printk(XENLOG_ERR "microcode: Bad equivalent cpu table\n");
             error = -EINVAL;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 11:22:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 11:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803883.1214733 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stQ5t-0004Pi-7K; Wed, 25 Sep 2024 11:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803883.1214733; Wed, 25 Sep 2024 11:22:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stQ5t-0004Pa-4o; Wed, 25 Sep 2024 11:22:05 +0000
Received: by outflank-mailman (input) for mailman id 803883;
 Wed, 25 Sep 2024 11:22:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stQ5r-0004PO-T3
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 11:22:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stQ5r-00087Q-Qa
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 11:22:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stQ5r-0007wX-PG
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 11:22:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=twpvUq4WQl2xir3lfUEbY0xgbJ2xTp4xHGprovN/afU=; b=DSRspABbCb3x6KCq06FWWB0ROK
	H+neq7ZKz5Izme13wEALd542dAURc8K+40Mi5s1sYwvOhmoNQbdcattIlR/MH6BzMPAYBMHKPf6+R
	YcmgzkbRw/I1ysXdEkpIBzNnKOyCAVSoZGnkIJVGE1zFvnkqeIUSNoLcaEyXpxx9GwRg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/efi: efibind: Fix typo in comment
Message-Id: <E1stQ5r-0007wX-PG@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 11:22:03 +0000

commit 512ac41aa6550268d82fd0d63ef6f6042e9da419
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Mon Sep 16 10:35:57 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Sep 25 12:12:31 2024 +0100

    xen/efi: efibind: Fix typo in comment
    
    expresion -> expression
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/x86_64/efibind.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/include/asm/x86_64/efibind.h b/xen/arch/x86/include/asm/x86_64/efibind.h
index 28bc18c24b..b29342c61c 100644
--- a/xen/arch/x86/include/asm/x86_64/efibind.h
+++ b/xen/arch/x86/include/asm/x86_64/efibind.h
@@ -176,7 +176,7 @@ typedef uint64_t   UINTN;
     #elif __clang__ || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
         #define EFIAPI __attribute__((__ms_abi__))  // Force Microsoft ABI
     #else
-        #define EFIAPI          // Substitute expresion to force C calling convention
+        #define EFIAPI          // Substitute expression to force C calling convention
     #endif
 #endif
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 11:22:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 11:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803884.1214737 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stQ63-0004RW-90; Wed, 25 Sep 2024 11:22:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803884.1214737; Wed, 25 Sep 2024 11:22:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stQ63-0004RM-6F; Wed, 25 Sep 2024 11:22:15 +0000
Received: by outflank-mailman (input) for mailman id 803884;
 Wed, 25 Sep 2024 11:22:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stQ61-0004RC-W2
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 11:22:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stQ61-00087W-UW
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 11:22:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stQ61-0007xF-Sj
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 11:22:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fYVOW8XD+hB4rNPess5W75IWennQjAr1qKMDY8yz1T0=; b=JcQkHFoOB/VCybM+fsR9s/KqUG
	6ePLIZbtanMxG9KoPW3axhnbzw/fDUM82BzRhofsEO0w9p3Y0SHGLJrsN5Q3UFcVEfEQl9mqqXbEj
	m9lqXYIj51uKkFplqQ1/70zuFf/V6r8mUQdQkEsOThYgmijuo7x/kHBmvnl3B6imU3kU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: introduce common macros for per-CPU sections defintion
Message-Id: <E1stQ61-0007xF-Sj@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 11:22:13 +0000

commit 11eb4e2969c15be701f4485b5770834439682b47
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Sep 24 18:42:27 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Sep 25 12:12:35 2024 +0100

    xen: introduce common macros for per-CPU sections defintion
    
    Introduce PERCPU_BSS macro which manages:
     * Alignment of the section start
     * Insertion of per-CPU data sections
     * Alignment and start/end markers for per-CPU data
    This change simplifies the linker script maintenance and ensures a unified
    approach for per-CPU sections across different architectures.
    
    Refactor the linker scripts for Arm, PPC, and x86 architectures by using
    the common macro PERCPU_BSS defined in xen/xen.lds.h to handle per-CPU
    data sections.
    
    No functional changes.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/arm/xen.lds.S    |  9 +--------
 xen/arch/ppc/xen.lds.S    |  9 +--------
 xen/arch/riscv/xen.lds.S  |  9 +--------
 xen/arch/x86/xen.lds.S    |  9 +--------
 xen/include/xen/xen.lds.h | 10 ++++++++++
 5 files changed, 14 insertions(+), 32 deletions(-)

diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
index bd884664ad..0987052f1a 100644
--- a/xen/arch/arm/xen.lds.S
+++ b/xen/arch/arm/xen.lds.S
@@ -198,14 +198,7 @@ SECTIONS
        __bss_start = .;
        *(.bss.stack_aligned)
        *(.bss.page_aligned)
-       . = ALIGN(PAGE_SIZE);
-       __per_cpu_start = .;
-       *(.bss.percpu.page_aligned)
-       *(.bss.percpu)
-       . = ALIGN(SMP_CACHE_BYTES);
-       *(.bss.percpu.read_mostly)
-       . = ALIGN(SMP_CACHE_BYTES);
-       __per_cpu_data_end = .;
+       PERCPU_BSS
        *(.bss .bss.*)
        . = ALIGN(POINTER_ALIGN);
        __bss_end = .;
diff --git a/xen/arch/ppc/xen.lds.S b/xen/arch/ppc/xen.lds.S
index 38cd857187..0c4b94814b 100644
--- a/xen/arch/ppc/xen.lds.S
+++ b/xen/arch/ppc/xen.lds.S
@@ -148,14 +148,7 @@ SECTIONS
         __bss_start = .;
         *(.bss.stack_aligned)
         *(.bss.page_aligned)
-        . = ALIGN(PAGE_SIZE);
-        __per_cpu_start = .;
-        *(.bss.percpu.page_aligned)
-        *(.bss.percpu)
-        . = ALIGN(SMP_CACHE_BYTES);
-        *(.bss.percpu.read_mostly)
-        . = ALIGN(SMP_CACHE_BYTES);
-        __per_cpu_data_end = .;
+        PERCPU_BSS
         *(.bss .bss.*)
         . = ALIGN(POINTER_ALIGN);
         __bss_end = .;
diff --git a/xen/arch/riscv/xen.lds.S b/xen/arch/riscv/xen.lds.S
index 070b19d915..871b47a235 100644
--- a/xen/arch/riscv/xen.lds.S
+++ b/xen/arch/riscv/xen.lds.S
@@ -145,14 +145,7 @@ SECTIONS
         __bss_start = .;
         *(.bss.stack_aligned)
         *(.bss.page_aligned)
-        . = ALIGN(PAGE_SIZE);
-        __per_cpu_start = .;
-        *(.bss.percpu.page_aligned)
-        *(.bss.percpu)
-        . = ALIGN(SMP_CACHE_BYTES);
-        *(.bss.percpu.read_mostly)
-        . = ALIGN(SMP_CACHE_BYTES);
-        __per_cpu_data_end = .;
+        PERCPU_BSS
         *(.sbss .sbss.* .bss .bss.*)
         . = ALIGN(POINTER_ALIGN);
         __bss_end = .;
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index d48de67cfd..b60d2f0d82 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -321,14 +321,7 @@ SECTIONS
   DECL_SECTION(.bss) {
        __bss_start = .;
        *(.bss.page_aligned*)
-       . = ALIGN(PAGE_SIZE);
-       __per_cpu_start = .;
-       *(.bss.percpu.page_aligned)
-       *(.bss.percpu)
-       . = ALIGN(SMP_CACHE_BYTES);
-       *(.bss.percpu.read_mostly)
-       . = ALIGN(SMP_CACHE_BYTES);
-       __per_cpu_data_end = .;
+       PERCPU_BSS
        *(.bss .bss.*)
        . = ALIGN(POINTER_ALIGN);
        __bss_end = .;
diff --git a/xen/include/xen/xen.lds.h b/xen/include/xen/xen.lds.h
index a17810bb28..24b8900ffe 100644
--- a/xen/include/xen/xen.lds.h
+++ b/xen/include/xen/xen.lds.h
@@ -151,6 +151,16 @@
 #define LOCK_PROFILE_DATA
 #endif
 
+#define PERCPU_BSS                 \
+       . = ALIGN(PAGE_SIZE);       \
+       __per_cpu_start = .;        \
+       *(.bss.percpu.page_aligned) \
+       *(.bss.percpu)              \
+       . = ALIGN(SMP_CACHE_BYTES); \
+       *(.bss.percpu.read_mostly)  \
+       . = ALIGN(SMP_CACHE_BYTES); \
+       __per_cpu_data_end = .;     \
+
 #ifdef CONFIG_HAS_VPCI
 #define VPCI_ARRAY               \
        . = ALIGN(POINTER_ALIGN); \
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 11:22:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 11:22:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.803885.1214742 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stQ6D-0004UL-At; Wed, 25 Sep 2024 11:22:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 803885.1214742; Wed, 25 Sep 2024 11:22:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stQ6D-0004UD-7f; Wed, 25 Sep 2024 11:22:25 +0000
Received: by outflank-mailman (input) for mailman id 803885;
 Wed, 25 Sep 2024 11:22:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stQ6C-0004Tw-20
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 11:22:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stQ6C-00089F-1E
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 11:22:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stQ6C-0007zi-0I
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 11:22:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ruok1A0Gl8znsSHDz2YMACw2CrWaR2MOv/oajJ8jymA=; b=br5m/FqdMhTcZIhJH5VLspZaj8
	rr1e8qjsYbFxWAdTCePkaQZfcIQYebxqkuX4LbC1SuOcQeoYgZQ1S0QT0SsdcOABNDAtLL2wMlPvW
	z/wEtMH633XPabYJ4II6FyTo2fCLDp4LS4Su48GAibv64UMyvAuCbv7RtF5MeW2iwsUI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/defns: Fix typo in comment "Porection" -> "Protection"
Message-Id: <E1stQ6C-0007zi-0I@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 11:22:24 +0000

commit b81ea162efd4b66b78ee358aefbc225fd1dfd2e4
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Wed Sep 25 12:09:46 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Sep 25 12:12:35 2024 +0100

    x86/defns: Fix typo in comment "Porection" -> "Protection"
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/x86-defns.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index caa92829ea..7abc5bcd42 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -171,7 +171,7 @@
 #define X86_EXC_TS            10 /* Invalid TSS */
 #define X86_EXC_NP            11 /* Segment Not Present */
 #define X86_EXC_SS            12 /* Stack-Segment Fault */
-#define X86_EXC_GP            13 /* General Porection Fault */
+#define X86_EXC_GP            13 /* General Protection Fault */
 #define X86_EXC_PF            14 /* Page Fault */
 #define X86_EXC_SPV           15 /* PIC Spurious Interrupt Vector */
 #define X86_EXC_MF            16 /* Maths fault (x87 FPU) */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 14:11:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 14:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.804016.1214884 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stSjP-0000fh-Ei; Wed, 25 Sep 2024 14:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 804016.1214884; Wed, 25 Sep 2024 14:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stSjP-0000fZ-C6; Wed, 25 Sep 2024 14:11:03 +0000
Received: by outflank-mailman (input) for mailman id 804016;
 Wed, 25 Sep 2024 14:11:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stSjN-0000fT-Ck
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 14:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stSjN-0002n7-Bm
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 14:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stSjN-0007OV-AM
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 14:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Zum1bSjgb1BXsPLajo2Ywfe48LD6FIVgUYtE7UQU+gs=; b=xQTNHacyOZW1es1O8XmnzXC0Ns
	6OrlcEQvnFIMpSVWRX8bwm5YtLP7gSyXhB82/oNoY8Nr5ti14zRnH4Do8EICx0KW8451CBHFpE7Sw
	YiGLSxiCL+N1iMs1nzF5Y7IA9naViENCrxgoiZ+lrrN2OwTKH+4V2g8G6iiJ4jwEGQaQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/vLAPIC: prevent undue recursion of vlapic_error()
Message-Id: <E1stSjN-0007OV-AM@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 14:11:01 +0000

commit 1765a3e0d178e9faf16cb3e19dd39cf22f29eae3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 15:09:45 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 15:09:45 2024 +0200

    x86/vLAPIC: prevent undue recursion of vlapic_error()
    
    With the error vector set to an illegal value, the function invoking
    vlapic_set_irq() would bring execution back here, with the non-recursive
    lock already held. Avoid the call in this case, merely further updating
    ESR (if necessary).
    
    This is XSA-462 / CVE-2024-45817.
    
    Fixes: 5f32d186a8b1 ("x86/vlapic: don't silently accept bad vectors")
    Reported-by: Federico Serafini <federico.serafini@bugseng.com>
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: c42d9ec61f6d11e25fa77bd44dd11dad1edda268
    master date: 2024-09-24 14:23:29 +0200
---
 xen/arch/x86/hvm/vlapic.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 3d25aaff55..3e4a2726d4 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -124,9 +124,24 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
     if ( (esr & errmask) != errmask )
     {
         uint32_t lvterr = vlapic_get_reg(vlapic, APIC_LVTERR);
+        bool inj = false;
 
-        vlapic_set_reg(vlapic, APIC_ESR, esr | errmask);
         if ( !(lvterr & APIC_LVT_MASKED) )
+        {
+            /*
+             * If LVTERR is unmasked and has an illegal vector, vlapic_set_irq()
+             * will end up back here.  Break the cycle by only injecting LVTERR
+             * if it will succeed, and folding in RECVILL otherwise.
+             */
+            if ( (lvterr & APIC_VECTOR_MASK) >= 16 )
+                 inj = true;
+            else
+                 errmask |= APIC_ESR_RECVILL;
+        }
+
+        vlapic_set_reg(vlapic, APIC_ESR, esr | errmask);
+
+        if ( inj )
             vlapic_set_irq(vlapic, lvterr & APIC_VECTOR_MASK, 0);
     }
     spin_unlock_irqrestore(&vlapic->esr_lock, flags);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 14:55:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 14:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.804045.1214918 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stTQ1-0007ct-0l; Wed, 25 Sep 2024 14:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 804045.1214918; Wed, 25 Sep 2024 14:55:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stTQ0-0007cm-UQ; Wed, 25 Sep 2024 14:55:04 +0000
Received: by outflank-mailman (input) for mailman id 804045;
 Wed, 25 Sep 2024 14:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stTQ0-0007cg-8Q
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 14:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stTQ0-0003Yt-6S
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 14:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stTQ0-0002zZ-40
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 14:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YsBzLYRudtrnYz6uPkn7vESdPdK/7ZqgNr/Gq/7b2ug=; b=TO+mTxJETKoxLMFIAKKdZqhtyA
	TmWD+FMB5+DA/dP/DvwpD2YNuNSRze82sAxE38rWQX2PqTw2hfgTEnp4JrQTMOaRnz8kFUC+G8Oua
	uN7vz01+CjUpxOEf8eDQ8Oy6uc649A11tw1u7OcwpcI1qfaaKaizBrDdyEY7aQNOnh0o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] changelog: add note about blkif protocol fixes
Message-Id: <E1stTQ0-0002zZ-40@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 14:55:04 +0000

commit 1aec9a4ba7bffaed15cb1300576bbfc4121bc4fd
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Sep 25 16:47:35 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 25 16:47:35 2024 +0200

    changelog: add note about blkif protocol fixes
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 46c7d38963..c499d12dc4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ## [4.20.0 UNRELEASED](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD
 
 ### Changed
+ - Fixed blkif protocol specification for sector sizes different than 512b.
  - On x86:
    - Prefer ACPI reboot over UEFI ResetSystem() run time service call.
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 14:55:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 14:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.804046.1214922 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stTQC-0007eo-2J; Wed, 25 Sep 2024 14:55:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 804046.1214922; Wed, 25 Sep 2024 14:55:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stTQB-0007eg-W1; Wed, 25 Sep 2024 14:55:15 +0000
Received: by outflank-mailman (input) for mailman id 804046;
 Wed, 25 Sep 2024 14:55:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stTQA-0007eW-CD
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 14:55:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stTQA-0003Z5-Ae
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 14:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stTQA-00030E-8W
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 14:55:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+JZRQ7xg73ZvtNuNMfrtHPvUm9vXtobJz0Bcfm1/gRc=; b=f4dUt1W6G2/8GWZCRQXqXs1i1C
	4c6lTBvjRuy8ZYipmy9ey4r9Za8JIzv9KjtvHHwOiHQVtVJFDVB1Npsi5ix8akqQ61tgIf1yKNsWK
	IMGrS/5Oo25rijEm52BEzinDrOjHKjeJjkhZBXEGnsy51J0S5t3affJXlZuBGMBOcCb0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Initialise BSS sooner
Message-Id: <E1stTQA-00030E-8W@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 14:55:14 +0000

commit b083121c9439f2f00b546090bbc83872d725625f
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Wed Sep 25 16:47:51 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 25 16:47:51 2024 +0200

    x86/boot: Initialise BSS sooner
    
    Allows to call C code earlier.
    In order to safely call C code we need to setup stack, selectors and BSS.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/boot/head.S | 77 ++++++++++++++++++++++++------------------------
 1 file changed, 39 insertions(+), 38 deletions(-)

diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index cfc5a7b47d..267207e5a2 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -231,6 +231,27 @@ __efi64_mb2_start:
         /* VGA is not available on EFI platforms. */
         movl   $0,vga_text_buffer(%rip)
 
+        /*
+         * Align the stack as UEFI spec requires. Keep it aligned
+         * before efi_multiboot2() call by pushing/popping even
+         * numbers of items on it.
+         */
+        and     $~15, %rsp
+
+        /*
+         * Initialize BSS (no nasty surprises!).
+         * It must be done earlier than in BIOS case
+         * because efi_multiboot2() touches it.
+         */
+        mov     %eax, %edx
+        lea     __bss_start(%rip), %edi
+        lea     __bss_end(%rip), %ecx
+        sub     %edi, %ecx
+        shr     $3, %ecx
+        xor     %eax, %eax
+        rep stosq
+        mov     %edx, %eax
+
         /* Check for Multiboot2 bootloader. */
         cmp     $MULTIBOOT2_BOOTLOADER_MAGIC,%eax
         je      .Lefi_multiboot2_proto
@@ -321,34 +342,12 @@ __efi64_mb2_start:
         lea     .Lmb2_no_ih(%rip),%r15
         jz      x86_32_switch
 
-        /*
-         * Align the stack as UEFI spec requires. Keep it aligned
-         * before efi_multiboot2() call by pushing/popping even
-         * numbers of items on it.
-         */
-        and     $~15,%rsp
-
         /* Save Multiboot2 magic on the stack. */
         push    %rax
 
         /* Save EFI ImageHandle on the stack. */
         push    %rdi
 
-        /*
-         * Initialize BSS (no nasty surprises!).
-         * It must be done earlier than in BIOS case
-         * because efi_multiboot2() touches it.
-         */
-        lea     __bss_start(%rip),%edi
-        lea     __bss_end(%rip),%ecx
-        sub     %edi,%ecx
-        shr     $3,%ecx
-        xor     %eax,%eax
-        rep stosq
-
-        /* Keep the stack aligned. Do not pop a single item off it. */
-        mov     (%rsp),%rdi
-
         /*
          * efi_multiboot2() is called according to System V AMD64 ABI:
          *   - IN:  %rdi - EFI ImageHandle, %rsi - EFI SystemTable,
@@ -434,6 +433,8 @@ __pvh_start:
         /* Set up stack. */
         lea     STACK_SIZE - CPUINFO_sizeof + sym_esi(cpu0_stack), %esp
 
+        call    .Linitialise_bss
+
         mov     %ebx, sym_esi(pvh_start_info_pa)
 
         /* Force xen console.  Will revert to user choice in init code. */
@@ -459,6 +460,20 @@ __pvh_start:
 
 #endif /* CONFIG_PVH_GUEST */
 
+.Linitialise_bss:
+        /* Initialise the BSS.  Preserve %eax (BOOTLOADER_MAGIC). */
+        mov     %eax, %ebp
+
+        lea     sym_esi(__bss_start), %edi
+        lea     sym_esi(__bss_end), %ecx
+        sub     %edi, %ecx
+        xor     %eax, %eax
+        shr     $2, %ecx
+        rep stosl
+
+        mov     %ebp, %eax
+        ret
+
 __start:
         cld
         cli
@@ -489,6 +504,8 @@ __start:
         /* Set up stack. */
         lea     STACK_SIZE - CPUINFO_sizeof + sym_esi(cpu0_stack), %esp
 
+        call    .Linitialise_bss
+
         /* Bootloaders may set multiboot{1,2}.mem_lower to a nonzero value. */
         xor     %edx,%edx
 
@@ -645,22 +662,6 @@ trampoline_setup:
          * reserved for trampoline code and data.
          */
 
-        /*
-         * Do not zero BSS on EFI platform here.
-         * It was initialized earlier.
-         */
-        cmpb    $0, sym_esi(efi_platform)
-        jnz     1f
-
-        /* Initialise the BSS. */
-        lea     sym_esi(__bss_start), %edi
-        lea     sym_esi(__bss_end), %ecx
-        sub     %edi,%ecx
-        xor     %eax,%eax
-        shr     $2,%ecx
-        rep stosl
-
-1:
         /* Interrogate CPU extended features via CPUID. */
         mov     $1, %eax
         cpuid
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Sep 25 14:55:26 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 25 Sep 2024 14:55:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.804047.1214926 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stTQM-0007h6-3h; Wed, 25 Sep 2024 14:55:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 804047.1214926; Wed, 25 Sep 2024 14:55:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stTQM-0007gz-1C; Wed, 25 Sep 2024 14:55:26 +0000
Received: by outflank-mailman (input) for mailman id 804047;
 Wed, 25 Sep 2024 14:55:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stTQK-0007ge-F5
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 14:55:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stTQK-0003ZG-Df
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 14:55:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stTQK-000318-Cp
 for xen-changelog@lists.xenproject.org; Wed, 25 Sep 2024 14:55:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DQxrqpbEKJRTT3AiUY5wD4c49OuoQxb8t8j52/LYNx0=; b=42pNXM8k6rW7wpdHtqeUB8vbTY
	JIPv6gZuGB+2Qw/8Q7NWmv0gYed2vcKeJMdO7DDQIWT1CUMX32bgzua8K5gISN+jhEYH2JBKdHSog
	0zHCGv/FFzDhRoK2aoamw/KI0NpFdZ/C1lAb8rfoCIR1u/B5S80d5zc4rKyF5xx1fko8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/livepatch: remove useless check for duplicated sections
Message-Id: <E1stTQK-000318-Cp@xenbits.xenproject.org>
Date: Wed, 25 Sep 2024 14:55:24 +0000

commit 3a28da8f4dafa906ec13b8d0533046584d897bca
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Sep 25 16:48:33 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 25 16:48:33 2024 +0200

    xen/livepatch: remove useless check for duplicated sections
    
    The current check for duplicated sections in a payload is not effective.  Such
    check is done inside a loop that iterates over the sections names, it's
    logically impossible for the bitmap to be set more than once.
    
    The usage of a bitmap in check_patching_sections() has been replaced with a
    boolean, since the function just cares that at least one of the special
    sections is present.
    
    No functional change intended, as the check was useless.
    
    Fixes: 29f4ab0b0a4f ('xsplice: Implement support for applying/reverting/replacing patches.')
    Fixes: 76b3d4098a92 ('livepatch: Do not enforce ELF_LIVEPATCH_FUNC section presence')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/livepatch.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
index d93a556bcd..df41dcce97 100644
--- a/xen/common/livepatch.c
+++ b/xen/common/livepatch.c
@@ -473,7 +473,6 @@ static int check_special_sections(const struct livepatch_elf *elf)
     static const char *const names[] = { ELF_LIVEPATCH_DEPENDS,
                                          ELF_LIVEPATCH_XEN_DEPENDS,
                                          ELF_BUILD_ID_NOTE};
-    DECLARE_BITMAP(found, ARRAY_SIZE(names)) = { 0 };
 
     for ( i = 0; i < ARRAY_SIZE(names); i++ )
     {
@@ -493,13 +492,6 @@ static int check_special_sections(const struct livepatch_elf *elf)
                    elf->name, names[i]);
             return -EINVAL;
         }
-
-        if ( test_and_set_bit(i, found) )
-        {
-            printk(XENLOG_ERR LIVEPATCH "%s: %s was seen more than once\n",
-                   elf->name, names[i]);
-            return -EINVAL;
-        }
     }
 
     return 0;
@@ -517,7 +509,7 @@ static int check_patching_sections(const struct livepatch_elf *elf)
                                          ELF_LIVEPATCH_PREREVERT_HOOK,
                                          ELF_LIVEPATCH_REVERT_HOOK,
                                          ELF_LIVEPATCH_POSTREVERT_HOOK};
-    DECLARE_BITMAP(found, ARRAY_SIZE(names)) = { 0 };
+    bool found = false;
 
     /*
      * The patching sections are optional, but at least one
@@ -544,16 +536,11 @@ static int check_patching_sections(const struct livepatch_elf *elf)
             return -EINVAL;
         }
 
-        if ( test_and_set_bit(i, found) )
-        {
-            printk(XENLOG_ERR LIVEPATCH "%s: %s was seen more than once\n",
-                   elf->name, names[i]);
-            return -EINVAL;
-        }
+        found = true;
     }
 
     /* Checking if at least one section is present. */
-    if ( bitmap_empty(found, ARRAY_SIZE(names)) )
+    if ( !found )
     {
         printk(XENLOG_ERR LIVEPATCH "%s: Nothing to patch. Aborting...\n",
                elf->name);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 26 02:22:08 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Sep 2024 02:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.804806.1215792 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ste8p-0007mZ-9U; Thu, 26 Sep 2024 02:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 804806.1215792; Thu, 26 Sep 2024 02:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ste8p-0007mR-6g; Thu, 26 Sep 2024 02:22:03 +0000
Received: by outflank-mailman (input) for mailman id 804806;
 Thu, 26 Sep 2024 02:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ste8o-0007mK-4N
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 02:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ste8o-0000MP-1x
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 02:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ste8o-00054D-0i
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 02:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZAO3dhbg6yjMT/mjgcnffcYLFpCWJOBV4TKZ2tn6+5c=; b=0fUFxnm4i4JPM0agB58BiIXuFs
	pR2JWcl2q3Ma1arPDQVoYHdN/oSfFX6eS3HyFVFT/paX/u8sujoBK0QdObid+sh05BeEnuTA9iH9M
	tlULArq9TBMhd1aEB3q06xNGIHV1dfxEKznqiYS2yYCA8t9JAcfGQVDXKFcrkdih8dQ4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/vLAPIC: prevent undue recursion of vlapic_error()
Message-Id: <E1ste8o-00054D-0i@xenbits.xenproject.org>
Date: Thu, 26 Sep 2024 02:22:02 +0000

commit 3ef9196234bd3b0da239db8f10467d9fff257377
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 15:07:47 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 15:07:47 2024 +0200

    x86/vLAPIC: prevent undue recursion of vlapic_error()
    
    With the error vector set to an illegal value, the function invoking
    vlapic_set_irq() would bring execution back here, with the non-recursive
    lock already held. Avoid the call in this case, merely further updating
    ESR (if necessary).
    
    This is XSA-462 / CVE-2024-45817.
    
    Fixes: 5f32d186a8b1 ("x86/vlapic: don't silently accept bad vectors")
    Reported-by: Federico Serafini <federico.serafini@bugseng.com>
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: c42d9ec61f6d11e25fa77bd44dd11dad1edda268
    master date: 2024-09-24 14:23:29 +0200
---
 xen/arch/x86/hvm/vlapic.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index c10d313215..3c094903a1 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -124,9 +124,24 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
     if ( (esr & errmask) != errmask )
     {
         uint32_t lvterr = vlapic_get_reg(vlapic, APIC_LVTERR);
+        bool inj = false;
 
-        vlapic_set_reg(vlapic, APIC_ESR, esr | errmask);
         if ( !(lvterr & APIC_LVT_MASKED) )
+        {
+            /*
+             * If LVTERR is unmasked and has an illegal vector, vlapic_set_irq()
+             * will end up back here.  Break the cycle by only injecting LVTERR
+             * if it will succeed, and folding in RECVILL otherwise.
+             */
+            if ( (lvterr & APIC_VECTOR_MASK) >= 16 )
+                 inj = true;
+            else
+                 errmask |= APIC_ESR_RECVILL;
+        }
+
+        vlapic_set_reg(vlapic, APIC_ESR, esr | errmask);
+
+        if ( inj )
             vlapic_set_irq(vlapic, lvterr & APIC_VECTOR_MASK, 0);
     }
     spin_unlock_irqrestore(&vlapic->esr_lock, flags);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Sep 26 07:44:08 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Sep 2024 07:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.805002.1215997 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stjAR-0000M2-BQ; Thu, 26 Sep 2024 07:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 805002.1215997; Thu, 26 Sep 2024 07:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stjAR-0000Lu-8t; Thu, 26 Sep 2024 07:44:03 +0000
Received: by outflank-mailman (input) for mailman id 805002;
 Thu, 26 Sep 2024 07:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stjAQ-0000Lo-A0
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 07:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stjAQ-0007xf-7r
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 07:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stjAQ-0003Fq-58
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 07:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1qkPK0elGmWmyjbex+inpTRcdLcX3EtT+baUE116NnI=; b=Tu+TZXQ/+puhoeZlyEphHfUiyQ
	3wtaSx2ti8OPdtekI5676bTp12lysgyJlPIgsAFNjJOuYm4kV2AZKveXJ+N+JnWLcpBhSTduCgoIw
	nkZ3TbezErtHdq9vqW2Tv+CfBo1rTyyjjuXNRyU25YpDCRZr+UKS6TJWlQ8/nf5MkIgI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mwait-idle: add dependency on general Intel CPU support
Message-Id: <E1stjAQ-0003Fq-58@xenbits.xenproject.org>
Date: Thu, 26 Sep 2024 07:44:02 +0000

commit c4344ecc5a4a9789a75c21a2c9da3d4d76f092dc
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Tue Sep 24 10:33:38 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 10:33:38 2024 +0200

    x86/mwait-idle: add dependency on general Intel CPU support
    
    Currently mwait_idle driver in Xen only implements support for Intel CPUs.
    Thus in order to reduce dead code in non-Intel build configurations it can
    be made explicitly dependant on CONFIG_INTEL option.
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/Makefile          | 2 +-
 xen/arch/x86/include/asm/cpuidle.h | 7 +++++++
 xen/arch/x86/include/asm/mwait.h   | 7 +++++++
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpu/Makefile b/xen/arch/x86/cpu/Makefile
index eafce5f204..7cfe28b7ec 100644
--- a/xen/arch/x86/cpu/Makefile
+++ b/xen/arch/x86/cpu/Makefile
@@ -8,7 +8,7 @@ obj-y += common.o
 obj-y += hygon.o
 obj-y += intel.o
 obj-y += intel_cacheinfo.o
-obj-y += mwait-idle.o
+obj-$(CONFIG_INTEL) += mwait-idle.o
 obj-y += shanghai.o
 obj-y += vpmu.o
 obj-$(CONFIG_AMD) += vpmu_amd.o
diff --git a/xen/arch/x86/include/asm/cpuidle.h b/xen/arch/x86/include/asm/cpuidle.h
index 707b3e948d..3a6b73142b 100644
--- a/xen/arch/x86/include/asm/cpuidle.h
+++ b/xen/arch/x86/include/asm/cpuidle.h
@@ -15,7 +15,14 @@ extern void (*lapic_timer_on)(void);
 
 extern uint64_t (*cpuidle_get_tick)(void);
 
+#ifdef CONFIG_INTEL
 int mwait_idle_init(struct notifier_block *nfb);
+#else
+static inline int mwait_idle_init(struct notifier_block *nfb)
+{
+    return -ENODEV;
+}
+#endif
 int cpuidle_init_cpu(unsigned int cpu);
 void cf_check default_dead_idle(void);
 void cf_check acpi_dead_idle(void);
diff --git a/xen/arch/x86/include/asm/mwait.h b/xen/arch/x86/include/asm/mwait.h
index 9298f987c4..000a692f6d 100644
--- a/xen/arch/x86/include/asm/mwait.h
+++ b/xen/arch/x86/include/asm/mwait.h
@@ -14,6 +14,13 @@
 #define MWAIT_ECX_INTERRUPT_BREAK	0x1
 
 void mwait_idle_with_hints(unsigned int eax, unsigned int ecx);
+#ifdef CONFIG_INTEL
 bool mwait_pc10_supported(void);
+#else
+static inline bool mwait_pc10_supported(void)
+{
+    return false;
+}
+#endif
 
 #endif /* __ASM_X86_MWAIT_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 26 07:44:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Sep 2024 07:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.805003.1216001 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stjAb-0000Ny-Dh; Thu, 26 Sep 2024 07:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 805003.1216001; Thu, 26 Sep 2024 07:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stjAb-0000Nq-AG; Thu, 26 Sep 2024 07:44:13 +0000
Received: by outflank-mailman (input) for mailman id 805003;
 Thu, 26 Sep 2024 07:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stjAa-0000Ng-E3
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 07:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stjAa-0007xq-DI
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 07:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stjAa-0003Gj-9z
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 07:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=z+dIFWe942XOOQYiFBurahyaRD+yKBXmmZ1JlUrI7mI=; b=yQA78InwoUeRBccuy5SBsDKZ+F
	1agCA7cV6ZCLvigP6FKZRcpDx7DnaFrrHLZlsLY4oWOo1K3tu5bvP8JsVPHc8IRJBKnjwx2D62PmD
	Z71w/1FoALbWma/XmWx01OmIQuCRMBPlHSNvQ88TABiYC4sOjrAuvNDgn4j0wvJ2dO3c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: enable long section names for xen.efi
Message-Id: <E1stjAa-0003Gj-9z@xenbits.xenproject.org>
Date: Thu, 26 Sep 2024 07:44:12 +0000

commit b1642aaea277b0aa8f2962e1842609c4050c400a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 10:34:35 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 10:34:35 2024 +0200

    x86: enable long section names for xen.efi
    
    While for our present .data.read_mostly it may be deemed tolerable that
    the name is truncated to .data.re, for the planned .init.trampoline an
    abbreviation to .init.tr would end up pretty meaningless. Engage the
    long section names extension that GNU ld has had support for already in
    2.22 (which we consider the baseline release for xen.efi building).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Frediano Ziglio <frediano.ziglio@cloud.com>
---
 xen/arch/x86/arch.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index 4f6c086988..1460ecf30b 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -91,7 +91,7 @@ XEN_BUILD_EFI := $(call if-success,$(CC) $(filter-out -include %/include/xen/con
                                          -c $(srctree)/$(efi-check).c -o $(efi-check).o,y)
 
 # Check if the linker supports PE.
-EFI_LDFLAGS := $(patsubst -m%,-mi386pep,$(LDFLAGS)) --subsystem=10
+EFI_LDFLAGS := $(patsubst -m%,-mi386pep,$(LDFLAGS)) --subsystem=10 --enable-long-section-names
 LD_PE_check_cmd = $(call ld-option,$(EFI_LDFLAGS) --image-base=0x100000000 -o $(efi-check).efi $(efi-check).o)
 XEN_BUILD_PE := $(LD_PE_check_cmd)
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 26 07:44:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Sep 2024 07:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.805004.1216005 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stjAl-0000RJ-G2; Thu, 26 Sep 2024 07:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 805004.1216005; Thu, 26 Sep 2024 07:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stjAl-0000RB-DR; Thu, 26 Sep 2024 07:44:23 +0000
Received: by outflank-mailman (input) for mailman id 805004;
 Thu, 26 Sep 2024 07:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stjAk-0000Qt-IY
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 07:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stjAk-0007xy-HJ
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 07:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stjAk-0003HL-FR
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 07:44:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uQVkZ7fmw0XmHChtbMFj200+W+gqa+p6ctYn/jODFpU=; b=f4dqZfiGv0x3qnkPD4XfQlOaNo
	7HhODiS/um1yFF2FfDcS0GvcT5LmOnEjtbKG2VPUAJRFbVNTCHfGh1kJsL/IxwzBY/LSEkNAs/DlM
	goZM/bnB2Aacbeq2L95x/BkcLHyY2BbJkZr3aS4cBskm/gKRqL928kJ98ZSK/pnUSKzs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libxs: Style consistency improvements
Message-Id: <E1stjAk-0003HL-FR@xenbits.xenproject.org>
Date: Thu, 26 Sep 2024 07:44:22 +0000

commit 95c3ae591c5a764fdcae14b054bb92bc43f3e904
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 28 13:05:47 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 24 10:47:14 2024 +0100

    tools/libxs: Style consistency improvements
    
    This is mostly Linux style.  Make the file self-consistent.  Drop trailing
    whitespace, and use tabs consistently.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 tools/libs/store/xs.c | 74 ++++++++++++++++++++++++++++-----------------------
 1 file changed, 41 insertions(+), 33 deletions(-)

diff --git a/tools/libs/store/xs.c b/tools/libs/store/xs.c
index 5d9c7151e8..e22f99b59f 100644
--- a/tools/libs/store/xs.c
+++ b/tools/libs/store/xs.c
@@ -1,4 +1,4 @@
-/* 
+/*
     Xen Store Daemon interface providing simple tree-like database.
     Copyright (C) 2005 Rusty Russell IBM Corporation
 
@@ -164,8 +164,10 @@ static void *read_thread(void *arg);
 
 static int read_message(struct xs_handle *h, int nonblocking);
 
-static bool setnonblock(int fd, int nonblock) {
+static bool setnonblock(int fd, int nonblock)
+{
 	int flags = fcntl(fd, F_GETFL);
+
 	if (flags == -1)
 		return false;
 
@@ -236,7 +238,7 @@ static int get_socket(const char *connect_to)
 		goto error;
 
 	addr.sun_family = AF_UNIX;
-	if(strlen(connect_to) >= sizeof(addr.sun_path)) {
+	if (strlen(connect_to) >= sizeof(addr.sun_path)) {
 		errno = EINVAL;
 		goto error;
 	}
@@ -276,9 +278,11 @@ error:
 	return -1;
 }
 
-static int all_restrict_cb(Xentoolcore__Active_Handle *ah, domid_t domid) {
-    struct xs_handle *h = CONTAINER_OF(ah, *h, tc_ah);
-    return xentoolcore__restrict_by_dup2_null(h->fd);
+static int all_restrict_cb(Xentoolcore__Active_Handle *ah, domid_t domid)
+{
+	struct xs_handle *h = CONTAINER_OF(ah, *h, tc_ah);
+
+	return xentoolcore__restrict_by_dup2_null(h->fd);
 }
 
 static struct xs_handle *get_handle(const char *connect_to)
@@ -362,8 +366,10 @@ struct xs_handle *xs_domain_open(void)
 static const char *xs_domain_dev(void)
 {
 	char *s = getenv("XENSTORED_PATH");
+
 	if (s)
 		return s;
+
 #if defined(__RUMPUSER_XEN__) || defined(__RUMPRUN__)
 	return "/dev/xen/xenbus";
 #elif defined(__linux__)
@@ -394,7 +400,8 @@ struct xs_handle *xs_open(unsigned long flags)
 	return xsh;
 }
 
-static void close_free_msgs(struct xs_handle *h) {
+static void close_free_msgs(struct xs_handle *h)
+{
 	struct xs_stored_msg *msg, *tmsg;
 
 	XEN_TAILQ_FOREACH_SAFE(msg, &h->reply_list, list, tmsg) {
@@ -408,7 +415,8 @@ static void close_free_msgs(struct xs_handle *h) {
 	}
 }
 
-static void close_fds_free(struct xs_handle *h) {
+static void close_fds_free(struct xs_handle *h)
+{
 	if (h->watch_pipe[0] != -1) {
 		close(h->watch_pipe[0]);
 		close(h->watch_pipe[1]);
@@ -416,7 +424,7 @@ static void close_fds_free(struct xs_handle *h) {
 
 	xentoolcore__deregister_active_handle(&h->tc_ah);
         close(h->fd);
-        
+
 	free(h);
 }
 
@@ -448,7 +456,7 @@ void xs_daemon_close(struct xs_handle *h)
         close_fds_free(h);
 }
 
-void xs_close(struct xs_handle* xsh)
+void xs_close(struct xs_handle *xsh)
 {
 	if (xsh)
 		xs_daemon_close(xsh);
@@ -995,7 +1003,7 @@ bool xs_watch(struct xs_handle *h, const char *path, const char *token)
 
 #define READ_THREAD_STACKSIZE 					\
 	((DEFAULT_THREAD_STACKSIZE < PTHREAD_STACK_MIN) ? 	\
-	PTHREAD_STACK_MIN : DEFAULT_THREAD_STACKSIZE)
+	 PTHREAD_STACK_MIN : DEFAULT_THREAD_STACKSIZE)
 
 	/* We dynamically create a reader thread on demand. */
 	mutex_lock(&h->request_mutex);
@@ -1258,7 +1266,7 @@ bool xs_transaction_end(struct xs_handle *h, xs_transaction_t t,
 		strcpy(abortstr, "F");
 	else
 		strcpy(abortstr, "T");
-	
+
 	return xs_bool(xs_single(h, t, XS_TRANSACTION_END, abortstr, NULL));
 }
 
@@ -1293,7 +1301,7 @@ bool xs_introduce_domain(struct xs_handle *h,
 }
 
 bool xs_set_target(struct xs_handle *h,
-			 unsigned int domid, unsigned int target)
+		   unsigned int domid, unsigned int target)
 {
 	struct xsd_sockmsg msg = { .type = XS_SET_TARGET };
 	char domid_str[MAX_STRLEN(domid)];
@@ -1377,30 +1385,30 @@ bool xs_is_domain_introduced(struct xs_handle *h, unsigned int domid)
 
 int xs_suspend_evtchn_port(int domid)
 {
-    char path[128];
-    char *portstr;
-    int port;
-    unsigned int plen;
-    struct xs_handle *xs;
-
-    xs = xs_daemon_open();
-    if (!xs)
-        return -1;
+	char path[128];
+	char *portstr;
+	int port;
+	unsigned int plen;
+	struct xs_handle *xs;
+
+	xs = xs_daemon_open();
+	if (!xs)
+		return -1;
 
-    sprintf(path, "/local/domain/%d/device/suspend/event-channel", domid);
-    portstr = xs_read(xs, XBT_NULL, path, &plen);
-    xs_daemon_close(xs);
+	sprintf(path, "/local/domain/%d/device/suspend/event-channel", domid);
+	portstr = xs_read(xs, XBT_NULL, path, &plen);
+	xs_daemon_close(xs);
 
-    if (!portstr || !plen) {
-        port = -1;
-        goto out;
-    }
+	if (!portstr || !plen) {
+		port = -1;
+		goto out;
+	}
 
-    port = atoi(portstr);
+	port = atoi(portstr);
 
 out:
-    free(portstr);
-    return port;
+	free(portstr);
+	return port;
 }
 
 char *xs_control_command(struct xs_handle *h, const char *cmd,
@@ -1436,7 +1444,7 @@ static int read_message(struct xs_handle *h, int nonblocking)
 	 * whole amount requested.  Ie as soon as we have the start of
 	 * the message we block until we get all of it.
 	 */
-         
+
 	struct xs_stored_msg *msg = NULL;
 	char *body = NULL;
 	int saved_errno = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 26 07:44:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Sep 2024 07:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.805005.1216009 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stjAv-0000Tn-Hk; Thu, 26 Sep 2024 07:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 805005.1216009; Thu, 26 Sep 2024 07:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stjAv-0000Tf-Er; Thu, 26 Sep 2024 07:44:33 +0000
Received: by outflank-mailman (input) for mailman id 805005;
 Thu, 26 Sep 2024 07:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stjAu-0000TZ-Mm
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 07:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stjAu-0007yF-M6
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 07:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stjAu-0003I6-JL
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 07:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8Ak19ioj7G4Md1LYM4ixKBfpv6V6yrpq8CTL8PMAvpE=; b=b/B/5z0OfcUB6oIpyVTntlbZNS
	QF5K0EK7P2cM22OSJCFfqeM/B1hB10iD/buq+fCs2ciDuUcVanfxRcFibmCNmD1IeUi5jnsxmnpbO
	vpEfWpDszbUj2da214Fsm4cId1ruV5NpV8yPEpqpdY3W3yHRx1cUvpiM4MGlaBCe2KE0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/cpufeature: Reposition cpu_has_{lfence_dispatch,nscb}
Message-Id: <E1stjAu-0003I6-JL@xenbits.xenproject.org>
Date: Thu, 26 Sep 2024 07:44:32 +0000

commit 6a039b050071eba644ab414d76ac5d5fc9e067a5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 10 20:59:37 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 24 10:49:59 2024 +0100

    x86/cpufeature: Reposition cpu_has_{lfence_dispatch,nscb}
    
    LFENCE_DISPATCH used to be a synthetic feature, but was given a real CPUID bit
    by AMD.  The define wasn't moved when this was changed.
    
    NSCB has always been a real CPUID bit, and was misplaced when introduced in
    the synthetic block alongside LFENCE_DISPATCH.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/cpufeature.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/cpufeature.h b/xen/arch/x86/include/asm/cpufeature.h
index 3baf9fcdbe..3a06b6f297 100644
--- a/xen/arch/x86/include/asm/cpufeature.h
+++ b/xen/arch/x86/include/asm/cpufeature.h
@@ -192,6 +192,10 @@ static inline bool boot_cpu_has(unsigned int feat)
 #define cpu_has_cmpccxadd       boot_cpu_has(X86_FEATURE_CMPCCXADD)
 #define cpu_has_avx_ifma        boot_cpu_has(X86_FEATURE_AVX_IFMA)
 
+/* CPUID level 0x80000021.eax */
+#define cpu_has_lfence_dispatch boot_cpu_has(X86_FEATURE_LFENCE_DISPATCH)
+#define cpu_has_nscb            boot_cpu_has(X86_FEATURE_NSCB)
+
 /* CPUID level 0x00000007:1.edx */
 #define cpu_has_avx_vnni_int8   boot_cpu_has(X86_FEATURE_AVX_VNNI_INT8)
 #define cpu_has_avx_ne_convert  boot_cpu_has(X86_FEATURE_AVX_NE_CONVERT)
@@ -219,8 +223,6 @@ static inline bool boot_cpu_has(unsigned int feat)
 #define cpu_has_arch_perfmon    boot_cpu_has(X86_FEATURE_ARCH_PERFMON)
 #define cpu_has_cpuid_faulting  boot_cpu_has(X86_FEATURE_CPUID_FAULTING)
 #define cpu_has_aperfmperf      boot_cpu_has(X86_FEATURE_APERFMPERF)
-#define cpu_has_lfence_dispatch boot_cpu_has(X86_FEATURE_LFENCE_DISPATCH)
-#define cpu_has_nscb            boot_cpu_has(X86_FEATURE_NSCB)
 #define cpu_has_xen_lbr         boot_cpu_has(X86_FEATURE_XEN_LBR)
 #define cpu_has_xen_shstk       (IS_ENABLED(CONFIG_XEN_SHSTK) && \
                                  boot_cpu_has(X86_FEATURE_XEN_SHSTK))
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 26 07:44:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Sep 2024 07:44:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.805006.1216013 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stjB6-0000Wr-In; Thu, 26 Sep 2024 07:44:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 805006.1216013; Thu, 26 Sep 2024 07:44:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stjB6-0000Wk-GL; Thu, 26 Sep 2024 07:44:44 +0000
Received: by outflank-mailman (input) for mailman id 805006;
 Thu, 26 Sep 2024 07:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stjB4-0000WC-RP
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 07:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stjB4-0007yT-Ph
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 07:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stjB4-0003KE-OD
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 07:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iGwoTGk/6dxvoSN+rgPry9GBW1UEMM2x6oJp3OHhmjc=; b=qXJlM43VHSaFkIlRW88T/NB82X
	Hiy5uGu0rqtBW2VZWk3PYDVYrJbteGDKxy2sFviPr8cOk0JGVodLtOhvN7cbS7kAx+nRAdGLZgee4
	YwfYI4/xK0vejoOqyuOl6hq+Mq1CDiTRTzJxq5cScEBi+O4LZBI9H5eHZRnRUcdck7rY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/efi: Use generic PE/COFF structures
Message-Id: <E1stjB4-0003KE-OD@xenbits.xenproject.org>
Date: Thu, 26 Sep 2024 07:44:42 +0000

commit f7f42accbbbb87945d46333b5fe3dbe58c413c92
Author:     Nikola Jelic <nikola.jelic@rt-rk.com>
AuthorDate: Mon Sep 23 19:50:08 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 24 11:12:23 2024 +0100

    x86/efi: Use generic PE/COFF structures
    
    Adapted x86 efi parser and mkreloc utility to use generic PE header
    (efi/pe.h), instead of locally defined structures for each component.
    
    Signed-off-by: Nikola Jelic <nikola.jelic@rt-rk.com>
    Signed-off-by: Milan Djokic <milan.djokic@rt-rk.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/Makefile      |   2 +
 xen/arch/x86/efi/mkreloc.c | 137 ++++++++++++++-------------------------------
 xen/common/efi/pe.c        |  90 ++++++-----------------------
 3 files changed, 63 insertions(+), 166 deletions(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 286c003ec3..00ab091634 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -88,6 +88,8 @@ extra-y += xen.lds
 hostprogs-y += boot/mkelf32
 hostprogs-y += efi/mkreloc
 
+$(obj)/efi/mkreloc: HOSTCFLAGS += -I$(srctree)/include
+
 # Allows usercopy.c to include itself
 $(obj)/usercopy.o: CFLAGS-y += -iquote .
 
diff --git a/xen/arch/x86/efi/mkreloc.c b/xen/arch/x86/efi/mkreloc.c
index 083740ab8a..375cb79d69 100644
--- a/xen/arch/x86/efi/mkreloc.c
+++ b/xen/arch/x86/efi/mkreloc.c
@@ -9,45 +9,7 @@
 #include <sys/mman.h>
 #include <unistd.h>
 
-struct mz_hdr {
-    uint16_t signature;
-#define MZ_SIGNATURE 0x5a4d
-    uint16_t last_page_size;
-    uint16_t page_count;
-    uint16_t relocation_count;
-    uint16_t header_paras;
-    uint16_t min_paras;
-    uint16_t max_paras;
-    uint16_t entry_ss;
-    uint16_t entry_sp;
-    uint16_t checksum;
-    uint16_t entry_ip;
-    uint16_t entry_cs;
-    uint16_t relocations;
-    uint16_t overlay;
-    uint8_t reserved[32];
-    uint32_t extended_header_base;
-};
-
-struct pe_hdr {
-    uint32_t signature;
-#define PE_SIGNATURE 0x00004550
-    uint16_t cpu;
-    uint16_t section_count;
-    int32_t timestamp;
-    uint32_t symbols_file_offset;
-    uint32_t symbol_count;
-    uint16_t opt_hdr_size;
-    uint16_t flags;
-    struct {
-        uint16_t magic;
-#define PE_MAGIC_EXE32     0x010b
-#define PE_MAGIC_EXE32PLUS 0x020b
-        uint8_t linker_major, linker_minor;
-        uint32_t code_size, data_size, bss_size;
-        uint32_t entry_rva, code_rva, data_rva;
-    } opt_hdr;
-};
+#include <efi/pe.h>
 
 #define PE_PAGE_SIZE 0x1000
 
@@ -55,22 +17,6 @@ struct pe_hdr {
 #define PE_BASE_RELOC_HIGHLOW  3
 #define PE_BASE_RELOC_DIR64   10
 
-struct coff_section {
-    char name[8];
-    uint32_t size;
-    uint32_t rva;
-    uint32_t file_size;
-    uint32_t file_offset;
-    uint32_t relocation_file_offset;
-    uint32_t line_number_file_offset;
-    uint16_t relocation_count;
-    uint16_t line_number_count;
-    uint32_t flags;
-#define COFF_SECTION_BSS         0x00000080U
-#define COFF_SECTION_DISCARDABLE 0x02000000U
-#define COFF_SECTION_WRITEABLE   0x80000000U
-};
-
 static void usage(const char *cmd, int rc)
 {
     fprintf(rc ? stderr : stdout,
@@ -80,7 +26,7 @@ static void usage(const char *cmd, int rc)
 }
 
 static unsigned int load(const char *name, int *handle,
-                         struct coff_section **sections,
+                         struct section_header **sections,
                          uint_fast64_t *image_base,
                          uint32_t *image_size,
                          unsigned int *width)
@@ -88,6 +34,7 @@ static unsigned int load(const char *name, int *handle,
     int in = open(name, O_RDONLY);
     struct mz_hdr mz_hdr;
     struct pe_hdr pe_hdr;
+    struct pe32_opt_hdr pe32_opt_hdr;
     uint32_t base;
 
     if ( in < 0 ||
@@ -96,16 +43,18 @@ static unsigned int load(const char *name, int *handle,
         perror(name);
         exit(2);
     }
-    if ( mz_hdr.signature != MZ_SIGNATURE ||
-         mz_hdr.relocations < sizeof(mz_hdr) ||
-         !mz_hdr.extended_header_base )
+
+    if ( mz_hdr.magic != MZ_MAGIC ||
+         mz_hdr.reloc_table_offset < sizeof(mz_hdr) ||
+         !mz_hdr.peaddr )
     {
         fprintf(stderr, "%s: Wrong DOS file format\n", name);
         exit(2);
     }
 
-    if ( lseek(in, mz_hdr.extended_header_base, SEEK_SET) < 0 ||
+    if ( lseek(in, mz_hdr.peaddr, SEEK_SET) < 0 ||
          read(in, &pe_hdr, sizeof(pe_hdr)) != sizeof(pe_hdr) ||
+         read(in, &pe32_opt_hdr, sizeof(pe32_opt_hdr)) != sizeof(pe32_opt_hdr) ||
          read(in, &base, sizeof(base)) != sizeof(base) ||
          /*
           * Luckily the image size field lives at the
@@ -117,35 +66,35 @@ static unsigned int load(const char *name, int *handle,
         perror(name);
         exit(3);
     }
-    switch ( (pe_hdr.signature == PE_SIGNATURE &&
-              pe_hdr.opt_hdr_size > sizeof(pe_hdr.opt_hdr)) *
-             pe_hdr.opt_hdr.magic )
+
+    switch ( (pe_hdr.magic == PE_MAGIC &&
+              pe_hdr.opt_hdr_size > sizeof(pe32_opt_hdr)) *
+              pe32_opt_hdr.magic )
     {
-    case PE_MAGIC_EXE32:
+    case PE_OPT_MAGIC_PE32:
         *width = 32;
         *image_base = base;
         break;
-    case PE_MAGIC_EXE32PLUS:
+    case PE_OPT_MAGIC_PE32PLUS:
         *width = 64;
-        *image_base = ((uint64_t)base << 32) | pe_hdr.opt_hdr.data_rva;
+        *image_base = ((uint64_t)base << 32) | pe32_opt_hdr.data_base;
         break;
     default:
         fprintf(stderr, "%s: Wrong PE file format\n", name);
         exit(3);
     }
 
-    *sections = malloc(pe_hdr.section_count * sizeof(**sections));
+    *sections = malloc(pe_hdr.sections * sizeof(**sections));
     if ( !*sections )
     {
         perror(NULL);
         exit(4);
     }
-    if ( lseek(in,
-               mz_hdr.extended_header_base + offsetof(struct pe_hdr, opt_hdr) +
-                  pe_hdr.opt_hdr_size,
+
+    if ( lseek(in, mz_hdr.peaddr + sizeof(pe_hdr) + pe_hdr.opt_hdr_size,
                SEEK_SET) < 0 ||
-         read(in, *sections, pe_hdr.section_count * sizeof(**sections)) !=
-             pe_hdr.section_count * sizeof(**sections) )
+         read(in, *sections, pe_hdr.sections * sizeof(**sections)) !=
+             pe_hdr.sections * sizeof(**sections) )
     {
         perror(name);
         exit(4);
@@ -153,12 +102,12 @@ static unsigned int load(const char *name, int *handle,
 
     *handle = in;
 
-    return pe_hdr.section_count;
+    return pe_hdr.sections;
 }
 
 static long page_size;
 
-static const void *map_section(const struct coff_section *sec, int in,
+static const void *map_section(const struct section_header *sec, int in,
                                const char *name)
 {
     const char *ptr;
@@ -166,10 +115,10 @@ static const void *map_section(const struct coff_section *sec, int in,
 
     if ( !page_size )
         page_size = sysconf(_SC_PAGESIZE);
-    offs = sec->file_offset & (page_size - 1);
+    offs = sec->data_addr & (page_size - 1);
 
-    ptr = mmap(0, offs + sec->file_size, PROT_READ, MAP_PRIVATE, in,
-               sec->file_offset - offs);
+    ptr = mmap(0, offs + sec->raw_data_size, PROT_READ, MAP_PRIVATE, in,
+               sec->data_addr - offs);
     if ( ptr == MAP_FAILED )
     {
         perror(name);
@@ -179,15 +128,15 @@ static const void *map_section(const struct coff_section *sec, int in,
     return ptr + offs;
 }
 
-static void unmap_section(const void *ptr, const struct coff_section *sec)
+static void unmap_section(const void *ptr, const struct section_header *sec)
 {
-    unsigned long offs = sec->file_offset & (page_size - 1);
+    unsigned long offs = sec->data_addr & (page_size - 1);
 
-    munmap((char *)ptr - offs, offs + sec->file_size);
+    munmap((char *)ptr - offs, offs + sec->raw_data_size);
 }
 
 static void diff_sections(const unsigned char *ptr1, const unsigned char *ptr2,
-                          const struct coff_section *sec,
+                          const struct section_header *sec,
                           int_fast64_t diff, unsigned int width,
                           uint_fast64_t base, uint_fast64_t end)
 {
@@ -208,7 +157,7 @@ static void diff_sections(const unsigned char *ptr1, const unsigned char *ptr2,
     while ( !(diff & (((int_fast64_t)1 << ((disp + 1) * CHAR_BIT)) - 1)) )
         ++disp;
 
-    for ( i = 0; i < sec->file_size; ++i )
+    for ( i = 0; i < sec->raw_data_size; ++i )
     {
         uint_fast32_t rva;
         union {
@@ -222,7 +171,7 @@ static void diff_sections(const unsigned char *ptr1, const unsigned char *ptr2,
         if ( ptr1[i] == ptr2[i] )
             continue;
 
-        if ( i < disp || i + width - disp > sec->file_size )
+        if ( i < disp || i + width - disp > sec->raw_data_size )
         {
             fprintf(stderr,
                     "Bogus difference at %.8s:%08" PRIxFAST32 "\n",
@@ -250,11 +199,11 @@ static void diff_sections(const unsigned char *ptr1, const unsigned char *ptr2,
             reloc_size += reloc_size & 2;
             if ( reloc_size )
                 printf("\t.equ rva_%08" PRIxFAST32 "_relocs,"
-                             " %#08" PRIxFAST32 "\n",
+                       " %#08" PRIxFAST32 "\n",
                        cur_rva, reloc_size);
             printf("\t.balign 4\n"
                    "\t.long %#08" PRIxFAST32 ","
-                          " rva_%08" PRIxFAST32 "_relocs\n",
+                   " rva_%08" PRIxFAST32 "_relocs\n",
                    rva, rva);
             cur_rva = rva;
             reloc_size = 8;
@@ -267,7 +216,7 @@ static void diff_sections(const unsigned char *ptr1, const unsigned char *ptr2,
             exit(3);
         }
 
-        if ( !(sec->flags & COFF_SECTION_WRITEABLE) )
+        if ( !(sec->flags & IMAGE_SCN_MEM_WRITE) )
             fprintf(stderr,
                     "Warning: relocation to r/o section %.8s:%08" PRIxFAST32 "\n",
                     sec->name, i - disp);
@@ -285,7 +234,7 @@ int main(int argc, char *argv[])
     unsigned int i, nsec, width1, width2;
     uint_fast64_t base1, base2;
     uint32_t size1, size2;
-    struct coff_section *sec1, *sec2;
+    struct section_header *sec1, *sec2;
 
     if ( argc == 1 ||
          !strcmp(argv[1], "-?") ||
@@ -328,16 +277,16 @@ int main(int argc, char *argv[])
 
         if ( memcmp(sec1[i].name, sec2[i].name, sizeof(sec1[i].name)) ||
              sec1[i].rva != sec2[i].rva ||
-             sec1[i].size != sec2[i].size ||
-             sec1[i].file_size != sec2[i].file_size ||
+             sec1[i].virtual_size != sec2[i].virtual_size ||
+             sec1[i].raw_data_size != sec2[i].raw_data_size ||
              sec1[i].flags != sec2[i].flags )
         {
             fprintf(stderr, "Mismatched section %u parameters\n", i);
             return 5;
         }
 
-        if ( !sec1[i].size ||
-             (sec1[i].flags & (COFF_SECTION_DISCARDABLE|COFF_SECTION_BSS)) )
+        if ( !sec1[i].virtual_size ||
+             (sec1[i].flags & (IMAGE_SCN_MEM_DISCARDABLE | IMAGE_SCN_CNT_UNINITIALIZED_DATA)) )
             continue;
 
         /*
@@ -354,10 +303,10 @@ int main(int argc, char *argv[])
             return 3;
         }
 
-        if ( sec1[i].file_size > sec1[i].size )
+        if ( sec1[i].raw_data_size > sec1[i].virtual_size )
         {
-            sec1[i].file_size = sec1[i].size;
-            sec2[i].file_size = sec2[i].size;
+            sec1[i].raw_data_size = sec1[i].virtual_size;
+            sec2[i].raw_data_size = sec2[i].virtual_size;
         }
         ptr1 = map_section(sec1 + i, in1, argv[1]);
         ptr2 = map_section(sec2 + i, in2, argv[2]);
diff --git a/xen/common/efi/pe.c b/xen/common/efi/pe.c
index ef8a2543e0..12f2af39d0 100644
--- a/xen/common/efi/pe.c
+++ b/xen/common/efi/pe.c
@@ -20,30 +20,8 @@
  * Lesser General Public License for more details.
  */
 
-
 #include "efi.h"
-
-struct DosFileHeader {
-    UINT8   Magic[2];
-    UINT16  LastSize;
-    UINT16  nBlocks;
-    UINT16  nReloc;
-    UINT16  HdrSize;
-    UINT16  MinAlloc;
-    UINT16  MaxAlloc;
-    UINT16  ss;
-    UINT16  sp;
-    UINT16  Checksum;
-    UINT16  ip;
-    UINT16  cs;
-    UINT16  RelocPos;
-    UINT16  nOverlay;
-    UINT16  reserved[4];
-    UINT16  OEMId;
-    UINT16  OEMInfo;
-    UINT16  reserved2[10];
-    UINT32  ExeHeader;
-};
+#include "efi/pe.h"
 
 #if defined(__arm__) || defined (__aarch64__)
 #define PE_HEADER_MACHINE 0xaa64
@@ -53,45 +31,17 @@ struct DosFileHeader {
 #error "Unknown architecture"
 #endif
 
-struct PeFileHeader {
-    UINT16  Machine;
-    UINT16  NumberOfSections;
-    UINT32  TimeDateStamp;
-    UINT32  PointerToSymbolTable;
-    UINT32  NumberOfSymbols;
-    UINT16  SizeOfOptionalHeader;
-    UINT16  Characteristics;
-};
-
-struct PeHeader {
-    UINT8   Magic[4];
-    struct PeFileHeader FileHeader;
-};
-
-struct PeSectionHeader {
-    CHAR8   Name[8];
-    UINT32  VirtualSize;
-    UINT32  VirtualAddress;
-    UINT32  SizeOfRawData;
-    UINT32  PointerToRawData;
-    UINT32  PointerToRelocations;
-    UINT32  PointerToLinenumbers;
-    UINT16  NumberOfRelocations;
-    UINT16  NumberOfLinenumbers;
-    UINT32  Characteristics;
-};
-
-static bool __init pe_name_compare(const struct PeSectionHeader *sect,
+static bool __init pe_name_compare(const struct section_header *sect,
                                    const CHAR16 *name)
 {
     size_t i;
 
-    if ( sect->Name[0] != '.' )
+    if ( sect->name[0] != '.' )
         return false;
 
-    for ( i = 1; i < sizeof(sect->Name); i++ )
+    for ( i = 1; i < sizeof(sect->name); i++ )
     {
-        const char c = sect->Name[i];
+        const char c = sect->name[i];
 
         if ( c != name[i - 1] )
             return false;
@@ -105,33 +55,29 @@ static bool __init pe_name_compare(const struct PeSectionHeader *sect,
 const void *__init pe_find_section(const void *image, const UINTN image_size,
                                    const CHAR16 *section_name, UINTN *size_out)
 {
-    const struct DosFileHeader *dos = image;
-    const struct PeHeader *pe;
-    const struct PeSectionHeader *sect;
+    const struct mz_hdr *mz = image;
+    const struct pe_hdr *pe;
+    const struct section_header *sect;
     UINTN offset, i;
 
-    if ( image_size < sizeof(*dos) ||
-         dos->Magic[0] != 'M' ||
-         dos->Magic[1] != 'Z' )
+    if ( image_size < sizeof(*mz) ||
+         mz->magic != MZ_MAGIC )
         return NULL;
 
-    offset = dos->ExeHeader;
+    offset = mz->peaddr;
     pe = image + offset;
 
     offset += sizeof(*pe);
     if ( image_size < offset ||
-         pe->Magic[0] != 'P' ||
-         pe->Magic[1] != 'E' ||
-         pe->Magic[2] != '\0' ||
-         pe->Magic[3] != '\0' )
+         pe->magic != PE_MAGIC )
         return NULL;
 
-    if ( pe->FileHeader.Machine != PE_HEADER_MACHINE )
+    if ( pe->machine != PE_HEADER_MACHINE )
         return NULL;
 
-    offset += pe->FileHeader.SizeOfOptionalHeader;
+    offset += pe->opt_hdr_size;
 
-    for ( i = 0; i < pe->FileHeader.NumberOfSections; i++ )
+    for ( i = 0; i < pe->sections; i++ )
     {
         sect = image + offset;
         if ( image_size < offset + sizeof(*sect) )
@@ -143,13 +89,13 @@ const void *__init pe_find_section(const void *image, const UINTN image_size,
             continue;
         }
 
-        if ( image_size < sect->VirtualSize + sect->VirtualAddress )
+        if ( image_size < sect->virtual_size + sect->rva )
             blexit(L"PE invalid section size + address");
 
         if ( size_out )
-            *size_out = sect->VirtualSize;
+            *size_out = sect->virtual_size;
 
-        return image + sect->VirtualAddress;
+        return image + sect->rva;
     }
 
     return NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 26 07:44:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Sep 2024 07:44:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.805007.1216017 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stjBG-0000ZD-Ke; Thu, 26 Sep 2024 07:44:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 805007.1216017; Thu, 26 Sep 2024 07:44:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stjBG-0000Z5-Hr; Thu, 26 Sep 2024 07:44:54 +0000
Received: by outflank-mailman (input) for mailman id 805007;
 Thu, 26 Sep 2024 07:44:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stjBE-0000Yt-Td
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 07:44:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stjBE-0007yc-Sr
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 07:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stjBE-0003Kt-Rq
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 07:44:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Xev7FMhXqzEk+F22NnzzN4y156erwQQP4RdnhrvDyxM=; b=acvrNd1dm6Iu2wNUsrFth9TZFE
	kjsbY6SUGIXBFGNj5NIl/2esWhfGQlaUpp0W+T9Koxk1Kr8pUFKk0K1oHnkFVfxf+8q9VbeRvGO92
	xHg4MtGob75YQ9E0kGTuEVoCLCTw2VuOSFFmEouHwo2NSPElBjgLzU1ytnv/wU8+hvfc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vLAPIC: prevent undue recursion of vlapic_error()
Message-Id: <E1stjBE-0003Kt-Rq@xenbits.xenproject.org>
Date: Thu, 26 Sep 2024 07:44:52 +0000

commit c42d9ec61f6d11e25fa77bd44dd11dad1edda268
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Sep 24 14:23:29 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Sep 24 14:23:29 2024 +0200

    x86/vLAPIC: prevent undue recursion of vlapic_error()
    
    With the error vector set to an illegal value, the function invoking
    vlapic_set_irq() would bring execution back here, with the non-recursive
    lock already held. Avoid the call in this case, merely further updating
    ESR (if necessary).
    
    This is XSA-462 / CVE-2024-45817.
    
    Fixes: 5f32d186a8b1 ("x86/vlapic: don't silently accept bad vectors")
    Reported-by: Federico Serafini <federico.serafini@bugseng.com>
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/vlapic.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 4a3e21a65f..992355e511 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -112,9 +112,24 @@ static void vlapic_error(struct vlapic *vlapic, unsigned int errmask)
     if ( (esr & errmask) != errmask )
     {
         uint32_t lvterr = vlapic_get_reg(vlapic, APIC_LVTERR);
+        bool inj = false;
 
-        vlapic_set_reg(vlapic, APIC_ESR, esr | errmask);
         if ( !(lvterr & APIC_LVT_MASKED) )
+        {
+            /*
+             * If LVTERR is unmasked and has an illegal vector, vlapic_set_irq()
+             * will end up back here.  Break the cycle by only injecting LVTERR
+             * if it will succeed, and folding in RECVILL otherwise.
+             */
+            if ( (lvterr & APIC_VECTOR_MASK) >= 16 )
+                 inj = true;
+            else
+                 errmask |= APIC_ESR_RECVILL;
+        }
+
+        vlapic_set_reg(vlapic, APIC_ESR, esr | errmask);
+
+        if ( inj )
             vlapic_set_irq(vlapic, lvterr & APIC_VECTOR_MASK, 0);
     }
     spin_unlock_irqrestore(&vlapic->esr_lock, flags);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Sep 26 13:22:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Sep 2024 13:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.805469.1216572 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stoRZ-0000Ci-7Q; Thu, 26 Sep 2024 13:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 805469.1216572; Thu, 26 Sep 2024 13:22:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stoRZ-0000Ca-4k; Thu, 26 Sep 2024 13:22:05 +0000
Received: by outflank-mailman (input) for mailman id 805469;
 Thu, 26 Sep 2024 13:22:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stoRY-0000CN-0F
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 13:22:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stoRX-0006fL-UG
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 13:22:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stoRX-0002Oq-Rg
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 13:22:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NU1blO7Qb80C+404Q7WthKTJ8ad1yB+dO6cBbZCh+64=; b=S5jGASnO+4c3yisKyISR3Neb+F
	4p4JMQhucqTykyqt+rWJggpbov+FuUF1t4S5qsB/+lXZIcPqypIl8mmV1uU40ZpdlX3hDzQyPGCqH
	/edlrDzNkLUjMg3823xty4Ghc0I9vnWdFTOBTSdqTx+0Ywf5rWd2/IfE9Ky74x21zSBs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/livepatch: drop load_addr Elf section field
Message-Id: <E1stoRX-0002Oq-Rg@xenbits.xenproject.org>
Date: Thu, 26 Sep 2024 13:22:03 +0000

commit 8c81423038f17f6cbc853dd35d69d50a4458f764
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Sep 26 12:14:27 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Sep 26 14:18:03 2024 +0100

    xen/livepatch: drop load_addr Elf section field
    
    The Elf loading logic will initially use the `data` section field to stash a
    pointer to the temporary loaded data (from the buffer allocated in
    livepatch_upload(), which is later relocated and the new pointer stashed in
    `load_addr`.
    
    Remove this dual field usage and use an `addr` uniformly.  Initially data will
    point to the temporary buffer, until relocation happens, at which point the
    pointer will be updated to the relocated address.
    
    This avoids leaving a dangling pointer in the `data` field once the temporary
    buffer is freed by livepatch_upload().
    
    Note the `addr` field cannot retain the const attribute from the previous
    `data`field, as there's logic that performs manipulations against the loaded
    sections, like applying relocations or sorting the exception table.
    
    No functional change intended.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/arm32/livepatch.c  |  8 ++++----
 xen/arch/arm/arm64/livepatch.c  |  4 ++--
 xen/arch/x86/livepatch.c        |  4 ++--
 xen/common/livepatch.c          | 43 ++++++++++++++++++++++-------------------
 xen/common/livepatch_elf.c      | 20 +++++++++----------
 xen/include/xen/livepatch_elf.h | 11 ++++++-----
 6 files changed, 47 insertions(+), 43 deletions(-)

diff --git a/xen/arch/arm/arm32/livepatch.c b/xen/arch/arm/arm32/livepatch.c
index d500665646..134d07a175 100644
--- a/xen/arch/arm/arm32/livepatch.c
+++ b/xen/arch/arm/arm32/livepatch.c
@@ -239,20 +239,20 @@ int arch_livepatch_perform(struct livepatch_elf *elf,
 
         if ( use_rela )
         {
-            const Elf_RelA *r_a = rela->data + i * rela->sec->sh_entsize;
+            const Elf_RelA *r_a = rela->addr + i * rela->sec->sh_entsize;
 
             symndx = ELF32_R_SYM(r_a->r_info);
             type = ELF32_R_TYPE(r_a->r_info);
-            dest = base->load_addr + r_a->r_offset; /* P */
+            dest = base->addr + r_a->r_offset; /* P */
             addend = r_a->r_addend;
         }
         else
         {
-            const Elf_Rel *r = rela->data + i * rela->sec->sh_entsize;
+            const Elf_Rel *r = rela->addr + i * rela->sec->sh_entsize;
 
             symndx = ELF32_R_SYM(r->r_info);
             type = ELF32_R_TYPE(r->r_info);
-            dest = base->load_addr + r->r_offset; /* P */
+            dest = base->addr + r->r_offset; /* P */
             addend = get_addend(type, dest);
         }
 
diff --git a/xen/arch/arm/arm64/livepatch.c b/xen/arch/arm/arm64/livepatch.c
index dfb72be44f..d80051f9dc 100644
--- a/xen/arch/arm/arm64/livepatch.c
+++ b/xen/arch/arm/arm64/livepatch.c
@@ -246,9 +246,9 @@ int arch_livepatch_perform_rela(struct livepatch_elf *elf,
 
     for ( i = 0; i < (rela->sec->sh_size / rela->sec->sh_entsize); i++ )
     {
-        const Elf_RelA *r = rela->data + i * rela->sec->sh_entsize;
+        const Elf_RelA *r = rela->addr + i * rela->sec->sh_entsize;
         unsigned int symndx = ELF64_R_SYM(r->r_info);
-        void *dest = base->load_addr + r->r_offset; /* P */
+        void *dest = base->addr + r->r_offset; /* P */
         bool overflow_check = true;
         int ovf = 0;
         uint64_t val;
diff --git a/xen/arch/x86/livepatch.c b/xen/arch/x86/livepatch.c
index 4f76127e1f..be40f625d2 100644
--- a/xen/arch/x86/livepatch.c
+++ b/xen/arch/x86/livepatch.c
@@ -258,9 +258,9 @@ int arch_livepatch_perform_rela(struct livepatch_elf *elf,
 
     for ( i = 0; i < (rela->sec->sh_size / rela->sec->sh_entsize); i++ )
     {
-        const Elf_RelA *r = rela->data + i * rela->sec->sh_entsize;
+        const Elf_RelA *r = rela->addr + i * rela->sec->sh_entsize;
         unsigned int symndx = ELF64_R_SYM(r->r_info);
-        uint8_t *dest = base->load_addr + r->r_offset;
+        uint8_t *dest = base->addr + r->r_offset;
         uint64_t val;
 
         if ( symndx == STN_UNDEF )
diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
index df41dcce97..259b09f4a1 100644
--- a/xen/common/livepatch.c
+++ b/xen/common/livepatch.c
@@ -371,18 +371,21 @@ static int move_payload(struct payload *payload, struct livepatch_elf *elf)
 
             ASSERT(offset[i] != UINT_MAX);
 
-            elf->sec[i].load_addr = buf + offset[i];
+            buf += offset[i];
 
             /* Don't copy NOBITS - such as BSS. */
             if ( elf->sec[i].sec->sh_type != SHT_NOBITS )
             {
-                memcpy(elf->sec[i].load_addr, elf->sec[i].data,
+                memcpy(buf, elf->sec[i].addr,
                        elf->sec[i].sec->sh_size);
                 dprintk(XENLOG_DEBUG, LIVEPATCH "%s: Loaded %s at %p\n",
-                        elf->name, elf->sec[i].name, elf->sec[i].load_addr);
+                        elf->name, elf->sec[i].name, buf);
             }
             else
-                memset(elf->sec[i].load_addr, 0, elf->sec[i].sec->sh_size);
+                memset(buf, 0, elf->sec[i].sec->sh_size);
+
+            /* Update sec[] to refer to its final location. */
+            elf->sec[i].addr = buf;
         }
     }
 
@@ -616,7 +619,7 @@ static inline int livepatch_check_expectations(const struct payload *payload)
         break;                                                                            \
     if ( !section_ok(elf, __sec, sizeof(*hook)) || __sec->sec->sh_size != sizeof(*hook) ) \
         return -EINVAL;                                                                   \
-    hook = __sec->load_addr;                                                              \
+    hook = __sec->addr;                                                                   \
 } while (0)
 
 /*
@@ -630,7 +633,7 @@ static inline int livepatch_check_expectations(const struct payload *payload)
         break;                                                                            \
     if ( !section_ok(elf, __sec, sizeof(*hook)) )                                         \
         return -EINVAL;                                                                   \
-    hook = __sec->load_addr;                                                              \
+    hook = __sec->addr;                                                                   \
     nhooks = __sec->sec->sh_size / sizeof(*hook);                                         \
 } while (0)
 
@@ -650,7 +653,7 @@ static int prepare_payload(struct payload *payload,
         if ( !section_ok(elf, sec, sizeof(*payload->funcs)) )
             return -EINVAL;
 
-        payload->funcs = funcs = sec->load_addr;
+        payload->funcs = funcs = sec->addr;
         payload->nfuncs = sec->sec->sh_size / sizeof(*payload->funcs);
 
         payload->fstate = xzalloc_array(typeof(*payload->fstate),
@@ -709,7 +712,7 @@ static int prepare_payload(struct payload *payload,
     {
         const struct payload *data;
 
-        n = sec->load_addr;
+        n = sec->addr;
 
         if ( sec->sec->sh_size <= sizeof(*n) )
             return -EINVAL;
@@ -739,7 +742,7 @@ static int prepare_payload(struct payload *payload,
     sec = livepatch_elf_sec_by_name(elf, ELF_LIVEPATCH_DEPENDS);
     if ( sec )
     {
-        n = sec->load_addr;
+        n = sec->addr;
 
         if ( sec->sec->sh_size <= sizeof(*n) )
             return -EINVAL;
@@ -755,7 +758,7 @@ static int prepare_payload(struct payload *payload,
     sec = livepatch_elf_sec_by_name(elf, ELF_LIVEPATCH_XEN_DEPENDS);
     if ( sec )
     {
-        n = sec->load_addr;
+        n = sec->addr;
 
         if ( sec->sec->sh_size <= sizeof(*n) )
             return -EINVAL;
@@ -794,8 +797,8 @@ static int prepare_payload(struct payload *payload,
         if ( !section_ok(elf, sec, sizeof(*region->frame[i].start)) )
             return -EINVAL;
 
-        region->frame[i].start = sec->load_addr;
-        region->frame[i].stop  = sec->load_addr + sec->sec->sh_size;
+        region->frame[i].start = sec->addr;
+        region->frame[i].stop  = sec->addr + sec->sec->sh_size;
     }
 
     sec = livepatch_elf_sec_by_name(elf, ".altinstructions");
@@ -843,8 +846,8 @@ static int prepare_payload(struct payload *payload,
             return -EINVAL;
         }
 
-        start = sec->load_addr;
-        end = sec->load_addr + sec->sec->sh_size;
+        start = sec->addr;
+        end = sec->addr + sec->sec->sh_size;
 
         for ( a = start; a < end; a++ )
         {
@@ -867,14 +870,14 @@ static int prepare_payload(struct payload *payload,
              * repl must be fully within .altinstr_replacement, even if the
              * replacement and the section happen to both have zero length.
              */
-            if ( repl               < repl_sec->load_addr ||
+            if ( repl               < repl_sec->addr ||
                  a->repl_len        > repl_sec->sec->sh_size ||
-                 repl + a->repl_len > repl_sec->load_addr + repl_sec->sec->sh_size )
+                 repl + a->repl_len > repl_sec->addr + repl_sec->sec->sh_size )
             {
                 printk(XENLOG_ERR LIVEPATCH
                        "%s Alternative repl %p+%#x outside .altinstr_replacement %p+%#"PRIxElfWord"\n",
                        elf->name, repl, a->repl_len,
-                       repl_sec->load_addr, repl_sec->sec->sh_size);
+                       repl_sec->addr, repl_sec->sec->sh_size);
                 return -EINVAL;
             }
         }
@@ -896,8 +899,8 @@ static int prepare_payload(struct payload *payload,
         if ( !section_ok(elf, sec, sizeof(*region->ex)) )
             return -EINVAL;
 
-        s = sec->load_addr;
-        e = sec->load_addr + sec->sec->sh_size;
+        s = sec->addr;
+        e = sec->addr + sec->sec->sh_size;
 
         sort_exception_table(s ,e);
 
@@ -916,7 +919,7 @@ static int prepare_payload(struct payload *payload,
         if ( !section_ok(elf, sec, sizeof(*payload->metadata.data)) )
             return -EINVAL;
 
-        payload->metadata.data = sec->load_addr;
+        payload->metadata.data = sec->addr;
         payload->metadata.len = sec->sec->sh_size;
 
         /* The metadata is required to consists of null terminated strings. */
diff --git a/xen/common/livepatch_elf.c b/xen/common/livepatch_elf.c
index 45d73912a3..25ce1bd5a0 100644
--- a/xen/common/livepatch_elf.c
+++ b/xen/common/livepatch_elf.c
@@ -36,7 +36,7 @@ static int elf_verify_strtab(const struct livepatch_elf_sec *sec)
     if ( !s->sh_size )
         return -EINVAL;
 
-    contents = sec->data;
+    contents = sec->addr;
 
     if ( contents[0] || contents[s->sh_size - 1] )
         return -EINVAL;
@@ -44,7 +44,7 @@ static int elf_verify_strtab(const struct livepatch_elf_sec *sec)
     return 0;
 }
 
-static int elf_resolve_sections(struct livepatch_elf *elf, const void *data)
+static int elf_resolve_sections(struct livepatch_elf *elf, void *data)
 {
     struct livepatch_elf_sec *sec;
     unsigned int i;
@@ -104,7 +104,7 @@ static int elf_resolve_sections(struct livepatch_elf *elf, const void *data)
                   sec[i].sec->sh_size > LIVEPATCH_MAX_SIZE )
             return -EINVAL;
 
-        sec[i].data = data + delta;
+        sec[i].addr = data + delta;
         /* Name is populated in elf_resolve_section_names. */
         sec[i].name = NULL;
 
@@ -226,14 +226,14 @@ static int elf_get_sym(struct livepatch_elf *elf, const void *data)
     strtab_sec = elf->strtab;
 
     /* Pointers arithmetic to get file offset. */
-    offset = strtab_sec->data - data;
+    offset = strtab_sec->addr - data;
 
     /* Checked already in elf_resolve_sections, but just in case. */
     ASSERT(offset == strtab_sec->sec->sh_offset);
     ASSERT(offset < elf->len && (offset + strtab_sec->sec->sh_size <= elf->len));
 
-    /* symtab_sec->data was computed in elf_resolve_sections. */
-    ASSERT((symtab_sec->sec->sh_offset + data) == symtab_sec->data);
+    /* symtab_sec->addr was computed in elf_resolve_sections. */
+    ASSERT((symtab_sec->sec->sh_offset + data) == symtab_sec->addr);
 
     /* No need to check values as elf_resolve_sections did it. */
     nsym = symtab_sec->sec->sh_size / symtab_sec->sec->sh_entsize;
@@ -251,7 +251,7 @@ static int elf_get_sym(struct livepatch_elf *elf, const void *data)
 
     for ( i = 1; i < nsym; i++ )
     {
-        const Elf_Sym *s = symtab_sec->data + symtab_sec->sec->sh_entsize * i;
+        const Elf_Sym *s = symtab_sec->addr + symtab_sec->sec->sh_entsize * i;
 
         delta = s->st_name;
         /* Boundary check within the .strtab. */
@@ -263,7 +263,7 @@ static int elf_get_sym(struct livepatch_elf *elf, const void *data)
         }
 
         sym[i].sym = s;
-        sym[i].name = strtab_sec->data + delta;
+        sym[i].name = strtab_sec->addr + delta;
         if ( arch_livepatch_symbol_deny(elf, &sym[i]) )
         {
             printk(XENLOG_ERR LIVEPATCH "%s: Symbol '%s' should not be in payload\n",
@@ -342,7 +342,7 @@ int livepatch_elf_resolve_symbols(struct livepatch_elf *elf)
                 break;
             }
 
-            st_value += (unsigned long)elf->sec[idx].load_addr;
+            st_value += (unsigned long)elf->sec[idx].addr;
             if ( elf->sym[i].name )
                 dprintk(XENLOG_DEBUG, LIVEPATCH "%s: Symbol resolved: %s => %#"PRIxElfAddr" (%s)\n",
                        elf->name, elf->sym[i].name,
@@ -503,7 +503,7 @@ static int livepatch_header_check(const struct livepatch_elf *elf)
     return 0;
 }
 
-int livepatch_elf_load(struct livepatch_elf *elf, const void *data)
+int livepatch_elf_load(struct livepatch_elf *elf, void *data)
 {
     int rc;
 
diff --git a/xen/include/xen/livepatch_elf.h b/xen/include/xen/livepatch_elf.h
index 7116deaddc..842111e145 100644
--- a/xen/include/xen/livepatch_elf.h
+++ b/xen/include/xen/livepatch_elf.h
@@ -13,10 +13,11 @@ struct livepatch_elf_sec {
     const Elf_Shdr *sec;                 /* Hooked up in elf_resolve_sections.*/
     const char *name;                    /* Human readable name hooked in
                                             elf_resolve_section_names. */
-    const void *data;                    /* Pointer to the section (done by
-                                            elf_resolve_sections). */
-    void *load_addr;                     /* A pointer to the allocated destination.
-                                            Done by load_payload_data. */
+    void *addr;                          /*
+                                          * Pointer to the section.  This is
+                                          * first a temporary buffer, then
+                                          * later the relocated load address.
+                                          */
 };
 
 struct livepatch_elf_sym {
@@ -41,7 +42,7 @@ struct livepatch_elf {
 const struct livepatch_elf_sec *
 livepatch_elf_sec_by_name(const struct livepatch_elf *elf,
                           const char *name);
-int livepatch_elf_load(struct livepatch_elf *elf, const void *data);
+int livepatch_elf_load(struct livepatch_elf *elf, void *data);
 void livepatch_elf_free(struct livepatch_elf *elf);
 
 int livepatch_elf_resolve_symbols(struct livepatch_elf *elf);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 26 13:22:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Sep 2024 13:22:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.805470.1216577 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stoRk-0000EV-96; Thu, 26 Sep 2024 13:22:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 805470.1216577; Thu, 26 Sep 2024 13:22:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stoRk-0000EM-6G; Thu, 26 Sep 2024 13:22:16 +0000
Received: by outflank-mailman (input) for mailman id 805470;
 Thu, 26 Sep 2024 13:22:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stoRi-0000E8-2l
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 13:22:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stoRi-0006fU-1x
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 13:22:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stoRi-0002QP-0F
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 13:22:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Dh4k8SMg41oMEu7TfsFJA0rIzcC548SAZsvTao+Hjo0=; b=4A8DQjcaHG5spU99HVl1k6tbhX
	cFcqqVCnZLLL1c8cOvArK2LzKhXXFXJYD5/C3xs64BdnAiiMNdfqS91zVRYPc34j2a4+hQ3eNM46a
	Ynr0XjFrJ6AEdGRykxMnDzTb6GiPdDLhGOVolhGeeIOhO3OBBTYr3qv8oSNAzAJGRB2U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/livepatch: simplify and unify logic in prepare_payload()
Message-Id: <E1stoRi-0002QP-0F@xenbits.xenproject.org>
Date: Thu, 26 Sep 2024 13:22:14 +0000

commit 86d09d16dd74298b19a03df492d9503f20cfc17c
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Sep 26 12:14:28 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Sep 26 14:18:03 2024 +0100

    xen/livepatch: simplify and unify logic in prepare_payload()
    
    The following sections: .note.gnu.build-id, .livepatch.xen_depends and
    .livepatch.depends are mandatory and ensured to be present by
    check_special_sections() before prepare_payload() is called.
    
    Simplify the logic in prepare_payload() by introducing a generic function to
    parse the sections that contain a buildid.  Note the function assumes the
    buildid related section to always be present.
    
    No functional change intended.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/livepatch.c | 110 ++++++++++++++++++++++---------------------------
 1 file changed, 50 insertions(+), 60 deletions(-)

diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
index 259b09f4a1..02f862cb76 100644
--- a/xen/common/livepatch.c
+++ b/xen/common/livepatch.c
@@ -470,6 +470,31 @@ static int xen_build_id_dep(const struct payload *payload)
     return 0;
 }
 
+/* Parses build-id sections into the given destination. */
+static int parse_buildid(const struct livepatch_elf_sec *sec,
+                         struct livepatch_build_id *id)
+{
+    const Elf_Note *n;
+    int rc;
+
+    /* Presence of the sections is ensured by check_special_sections(). */
+    ASSERT(sec);
+
+    n = sec->addr;
+
+    if ( sec->sec->sh_size <= sizeof(*n) )
+        return -EINVAL;
+
+    rc = xen_build_id_check(n, sec->sec->sh_size, &id->p, &id->len);
+    if ( rc )
+        return rc;
+
+    if ( !id->len || !id->p )
+        return -EINVAL;
+
+   return 0;
+}
+
 static int check_special_sections(const struct livepatch_elf *elf)
 {
     unsigned int i;
@@ -641,11 +666,12 @@ static int prepare_payload(struct payload *payload,
                            struct livepatch_elf *elf)
 {
     const struct livepatch_elf_sec *sec;
+    const struct payload *data;
     unsigned int i;
     struct livepatch_func *funcs;
     struct livepatch_func *f;
     struct virtual_region *region;
-    const Elf_Note *n;
+    int rc;
 
     sec = livepatch_elf_sec_by_name(elf, ELF_LIVEPATCH_FUNC);
     if ( sec )
@@ -663,8 +689,6 @@ static int prepare_payload(struct payload *payload,
 
         for ( i = 0; i < payload->nfuncs; i++ )
         {
-            int rc;
-
             f = &(funcs[i]);
 
             if ( f->version != LIVEPATCH_PAYLOAD_VERSION )
@@ -707,69 +731,35 @@ static int prepare_payload(struct payload *payload,
     LIVEPATCH_ASSIGN_SINGLE_HOOK(elf, payload->hooks.revert.action, ELF_LIVEPATCH_REVERT_HOOK);
     LIVEPATCH_ASSIGN_SINGLE_HOOK(elf, payload->hooks.revert.post, ELF_LIVEPATCH_POSTREVERT_HOOK);
 
-    sec = livepatch_elf_sec_by_name(elf, ELF_BUILD_ID_NOTE);
-    if ( sec )
-    {
-        const struct payload *data;
-
-        n = sec->addr;
-
-        if ( sec->sec->sh_size <= sizeof(*n) )
-            return -EINVAL;
-
-        if ( xen_build_id_check(n, sec->sec->sh_size,
-                                &payload->id.p, &payload->id.len) )
-            return -EINVAL;
-
-        if ( !payload->id.len || !payload->id.p )
-            return -EINVAL;
+    rc = parse_buildid(livepatch_elf_sec_by_name(elf, ELF_BUILD_ID_NOTE),
+                       &payload->id);
+    if ( rc )
+        return rc;
 
-        /* Make sure it is not a duplicate. */
-        list_for_each_entry ( data, &payload_list, list )
+    /* Make sure it is not a duplicate. */
+    list_for_each_entry ( data, &payload_list, list )
+    {
+        /* No way _this_ payload is on the list. */
+        ASSERT(data != payload);
+        if ( data->id.len == payload->id.len &&
+             !memcmp(data->id.p, payload->id.p, data->id.len) )
         {
-            /* No way _this_ payload is on the list. */
-            ASSERT(data != payload);
-            if ( data->id.len == payload->id.len &&
-                 !memcmp(data->id.p, payload->id.p, data->id.len) )
-            {
-                dprintk(XENLOG_DEBUG, LIVEPATCH "%s: Already loaded as %s!\n",
-                        elf->name, data->name);
-                return -EEXIST;
-            }
+            dprintk(XENLOG_DEBUG, LIVEPATCH "%s: Already loaded as %s!\n",
+                    elf->name, data->name);
+            return -EEXIST;
         }
     }
 
-    sec = livepatch_elf_sec_by_name(elf, ELF_LIVEPATCH_DEPENDS);
-    if ( sec )
-    {
-        n = sec->addr;
-
-        if ( sec->sec->sh_size <= sizeof(*n) )
-            return -EINVAL;
-
-        if ( xen_build_id_check(n, sec->sec->sh_size,
-                                &payload->dep.p, &payload->dep.len) )
-            return -EINVAL;
-
-        if ( !payload->dep.len || !payload->dep.p )
-            return -EINVAL;
-    }
-
-    sec = livepatch_elf_sec_by_name(elf, ELF_LIVEPATCH_XEN_DEPENDS);
-    if ( sec )
-    {
-        n = sec->addr;
-
-        if ( sec->sec->sh_size <= sizeof(*n) )
-            return -EINVAL;
-
-        if ( xen_build_id_check(n, sec->sec->sh_size,
-                                &payload->xen_dep.p, &payload->xen_dep.len) )
-            return -EINVAL;
+    rc = parse_buildid(livepatch_elf_sec_by_name(elf, ELF_LIVEPATCH_DEPENDS),
+                       &payload->dep);
+    if ( rc )
+        return rc;
 
-        if ( !payload->xen_dep.len || !payload->xen_dep.p )
-            return -EINVAL;
-    }
+    rc = parse_buildid(livepatch_elf_sec_by_name(elf,
+                                                 ELF_LIVEPATCH_XEN_DEPENDS),
+                       &payload->xen_dep);
+    if ( rc )
+        return rc;
 
     /* Setup the virtual region with proper data. */
     region = &payload->region;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 26 13:22:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Sep 2024 13:22:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.805471.1216581 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stoRt-0000Gq-AN; Thu, 26 Sep 2024 13:22:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 805471.1216581; Thu, 26 Sep 2024 13:22:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stoRt-0000Gi-7k; Thu, 26 Sep 2024 13:22:25 +0000
Received: by outflank-mailman (input) for mailman id 805471;
 Thu, 26 Sep 2024 13:22:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stoRs-0000Ga-6H
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 13:22:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stoRs-0006hF-56
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 13:22:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stoRs-0002RL-46
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 13:22:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NxOX0XE7qyJOldgHeS4G9OvVsujgBQR5WsjpeWyhMhU=; b=gx+W8rvOPBMa9gdFZDz4kzXGc2
	66Cftv7htqXxLze592rYNZc6CfQrUZKB9NH9k5YqihXrPbjXNkbSs4n0eJjxdJ+yh8MxftyU+e2oo
	W4+uGgBEWGC+t6rtlMpyd+SauWcRcKPy7kFmOwmPVaoMl6Lfkjnhkw/LoFxRsKhbETJ4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/livepatch: do Xen build-id check earlier
Message-Id: <E1stoRs-0002RL-46@xenbits.xenproject.org>
Date: Thu, 26 Sep 2024 13:22:24 +0000

commit fa49f4be413cdabde5b2264fc85d2710b15ea691
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Sep 26 12:14:29 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Sep 26 14:18:03 2024 +0100

    xen/livepatch: do Xen build-id check earlier
    
    The check against the expected Xen build ID should be done ahead of attempting
    to apply the alternatives contained in the livepatch.
    
    If the CPUID in the alternatives patching data is out of the scope of the
    running Xen featureset the BUG() in _apply_alternatives() will trigger thus
    bringing the system down.  Note the layout of struct alt_instr could also
    change between versions.  It's also possible for struct exception_table_entry
    to have changed format, hence leading to other kind of errors if parsing of the
    payload is done ahead of checking if the Xen build-id matches.
    
    Move the Xen build ID check as early as possible.  To do so introduce a new
    check_xen_buildid() function that parses and checks the Xen build-id before
    moving the payload.  Since the expected Xen build-id is used early to
    detect whether the livepatch payload could be loaded, there's no reason to
    store it in the payload struct, as a non-matching Xen build-id won't get the
    payload populated in the first place.
    
    Note printing the expected Xen build ID has part of dumping the payload
    information is no longer done: all loaded payloads would have Xen build IDs
    matching the running Xen, otherwise they would have failed to load.
    
    Fixes: 879615f5db1d ('livepatch: Always check hypervisor build ID upon livepatch upload')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/livepatch.c              | 86 +++++++++++++++++++++----------------
 xen/include/xen/livepatch_payload.h |  1 -
 2 files changed, 50 insertions(+), 37 deletions(-)

diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
index 02f862cb76..952a3b1af7 100644
--- a/xen/common/livepatch.c
+++ b/xen/common/livepatch.c
@@ -448,28 +448,6 @@ static bool section_ok(const struct livepatch_elf *elf,
     return true;
 }
 
-static int xen_build_id_dep(const struct payload *payload)
-{
-    const void *id = NULL;
-    unsigned int len = 0;
-    int rc;
-
-    ASSERT(payload->xen_dep.len);
-    ASSERT(payload->xen_dep.p);
-
-    rc = xen_build_id(&id, &len);
-    if ( rc )
-        return rc;
-
-    if ( payload->xen_dep.len != len || memcmp(id, payload->xen_dep.p, len) ) {
-        printk(XENLOG_ERR LIVEPATCH "%s: check against hypervisor build-id failed\n",
-               payload->name);
-        return -EINVAL;
-    }
-
-    return 0;
-}
-
 /* Parses build-id sections into the given destination. */
 static int parse_buildid(const struct livepatch_elf_sec *sec,
                          struct livepatch_build_id *id)
@@ -495,11 +473,56 @@ static int parse_buildid(const struct livepatch_elf_sec *sec,
    return 0;
 }
 
+static int check_xen_buildid(const struct livepatch_elf *elf)
+{
+    const void *id;
+    unsigned int len;
+    struct livepatch_build_id lp_id;
+    const struct livepatch_elf_sec *sec =
+        livepatch_elf_sec_by_name(elf, ELF_LIVEPATCH_XEN_DEPENDS);
+    int rc;
+
+    if ( !sec )
+    {
+        printk(XENLOG_ERR LIVEPATCH "%s: section %s is missing\n",
+               elf->name, ELF_LIVEPATCH_XEN_DEPENDS);
+        return -EINVAL;
+    }
+
+    rc = parse_buildid(sec, &lp_id);
+    if ( rc )
+    {
+        printk(XENLOG_ERR LIVEPATCH
+               "%s: failed to parse section %s as build-id: %d\n",
+               elf->name, ELF_LIVEPATCH_XEN_DEPENDS, rc);
+        return -EINVAL;
+    }
+
+    rc = xen_build_id(&id, &len);
+    if ( rc )
+    {
+        printk(XENLOG_ERR LIVEPATCH
+               "%s: unable to get running Xen build-id: %d\n",
+               elf->name, rc);
+        return rc;
+    }
+
+    if ( lp_id.len != len || memcmp(id, lp_id.p, len) )
+    {
+        printk(XENLOG_ERR LIVEPATCH "%s: build-id mismatch:\n"
+                                    "  livepatch: %*phN\n"
+                                    "        xen: %*phN\n",
+               elf->name, lp_id.len, lp_id.p, len, id);
+        return -EINVAL;
+    }
+
+    return 0;
+}
+
 static int check_special_sections(const struct livepatch_elf *elf)
 {
     unsigned int i;
     static const char *const names[] = { ELF_LIVEPATCH_DEPENDS,
-                                         ELF_LIVEPATCH_XEN_DEPENDS,
                                          ELF_BUILD_ID_NOTE};
 
     for ( i = 0; i < ARRAY_SIZE(names); i++ )
@@ -755,12 +778,6 @@ static int prepare_payload(struct payload *payload,
     if ( rc )
         return rc;
 
-    rc = parse_buildid(livepatch_elf_sec_by_name(elf,
-                                                 ELF_LIVEPATCH_XEN_DEPENDS),
-                       &payload->xen_dep);
-    if ( rc )
-        return rc;
-
     /* Setup the virtual region with proper data. */
     region = &payload->region;
 
@@ -1069,6 +1086,10 @@ static int load_payload_data(struct payload *payload, void *raw, size_t len)
     if ( rc )
         goto out;
 
+    rc = check_xen_buildid(&elf);
+    if ( rc )
+       goto out;
+
     rc = move_payload(payload, &elf);
     if ( rc )
         goto out;
@@ -1093,10 +1114,6 @@ static int load_payload_data(struct payload *payload, void *raw, size_t len)
     if ( rc )
         goto out;
 
-    rc = xen_build_id_dep(payload);
-    if ( rc )
-        goto out;
-
     rc = build_symbol_table(payload, &elf);
     if ( rc )
         goto out;
@@ -2199,9 +2216,6 @@ static void cf_check livepatch_printall(unsigned char key)
 
         if ( data->dep.len )
             printk("depend-on=%*phN\n", data->dep.len, data->dep.p);
-
-        if ( data->xen_dep.len )
-            printk("depend-on-xen=%*phN\n", data->xen_dep.len, data->xen_dep.p);
     }
 
     spin_unlock(&payload_lock);
diff --git a/xen/include/xen/livepatch_payload.h b/xen/include/xen/livepatch_payload.h
index 472d6a4a63..c6dc7cb5fa 100644
--- a/xen/include/xen/livepatch_payload.h
+++ b/xen/include/xen/livepatch_payload.h
@@ -62,7 +62,6 @@ struct payload {
     unsigned int nsyms;                  /* Nr of entries in .strtab and symbols. */
     struct livepatch_build_id id;        /* ELFNOTE_DESC(.note.gnu.build-id) of the payload. */
     struct livepatch_build_id dep;       /* ELFNOTE_DESC(.livepatch.depends). */
-    struct livepatch_build_id xen_dep;   /* ELFNOTE_DESC(.livepatch.xen_depends). */
     livepatch_loadcall_t *const *load_funcs;   /* The array of funcs to call after */
     livepatch_unloadcall_t *const *unload_funcs;/* load and unload of the payload. */
     struct livepatch_hooks hooks;        /* Pre and post hooks for apply and revert */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 26 13:22:36 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Sep 2024 13:22:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.805472.1216584 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stoS3-0000L2-D6; Thu, 26 Sep 2024 13:22:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 805472.1216584; Thu, 26 Sep 2024 13:22:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stoS3-0000Ku-AW; Thu, 26 Sep 2024 13:22:35 +0000
Received: by outflank-mailman (input) for mailman id 805472;
 Thu, 26 Sep 2024 13:22:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stoS2-0000Kk-91
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 13:22:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stoS2-0006hP-8H
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 13:22:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stoS2-0002Sc-7K
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 13:22:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/imBTzAkvlkeJhFNnaSTq3gIOGOFnbqb/BqcLX0F6jE=; b=3HvanvTnMiGLIBjjk2VttxQlQZ
	R6FwlW+KW7XkANv5GZrXpeN+uDndlAe8P+J3LFDztX5jwCuyYKufK5CmtvncK9QdqK7ikeIznVTz7
	lQRA+bjbUM10lI0SK7FKioq9nT8w/UeM+j6cmyIPOWfNGCfGfeNxu0Eghgz4uf3y+sTQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/alternatives: do not BUG during apply
Message-Id: <E1stoS2-0002Sc-7K@xenbits.xenproject.org>
Date: Thu, 26 Sep 2024 13:22:34 +0000

commit aa5a06d5d6eda291afa3849ab143ffcd69b0d4e6
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Sep 26 12:14:30 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Sep 26 14:18:03 2024 +0100

    x86/alternatives: do not BUG during apply
    
    alternatives is used both at boot time, and when loading livepatch payloads.
    While for the former it makes sense to panic, it's not useful for the later, as
    for livepatches it's possible to fail to load the livepatch if alternatives
    cannot be resolved and continue operating normally.
    
    Relax the BUGs in _apply_alternatives() to instead return an error code.  The
    caller will figure out whether the failures are fatal and panic.
    
    Print an error message to provide some user-readable information about what
    went wrong.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/alternative.c             | 46 ++++++++++++++++++++++++++--------
 xen/arch/x86/include/asm/alternative.h |  2 +-
 xen/common/livepatch.c                 | 10 +++++++-
 3 files changed, 46 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/alternative.c b/xen/arch/x86/alternative.c
index 7824053c9d..1ba35cb9ed 100644
--- a/xen/arch/x86/alternative.c
+++ b/xen/arch/x86/alternative.c
@@ -175,9 +175,9 @@ extern void *const __initdata_cf_clobber_end[];
  * invocation, such that no CALLs/JMPs to NULL pointers will be left
  * around. See also the further comment below.
  */
-static void init_or_livepatch _apply_alternatives(struct alt_instr *start,
-                                                  struct alt_instr *end,
-                                                  bool force)
+static int init_or_livepatch _apply_alternatives(struct alt_instr *start,
+                                                 struct alt_instr *end,
+                                                 bool force)
 {
     struct alt_instr *a, *base;
 
@@ -198,9 +198,29 @@ static void init_or_livepatch _apply_alternatives(struct alt_instr *start,
         uint8_t buf[MAX_PATCH_LEN];
         unsigned int total_len = a->orig_len + a->pad_len;
 
-        BUG_ON(a->repl_len > total_len);
-        BUG_ON(total_len > sizeof(buf));
-        BUG_ON(a->cpuid >= NCAPINTS * 32);
+        if ( a->repl_len > total_len )
+        {
+            printk(XENLOG_ERR
+                   "Alt for %ps, replacement size %#x larger than origin %#x\n",
+                    ALT_ORIG_PTR(a), a->repl_len, total_len);
+            return -ENOSPC;
+        }
+
+        if ( total_len > sizeof(buf) )
+        {
+            printk(XENLOG_ERR
+                   "Alt for %ps, origin size %#x bigger than buffer %#zx\n",
+                   ALT_ORIG_PTR(a), total_len, sizeof(buf));
+            return -ENOSPC;
+        }
+
+        if ( a->cpuid >= NCAPINTS * 32 )
+        {
+             printk(XENLOG_ERR
+                   "Alt for %ps, feature %#x outside of featureset range %#x\n",
+                   ALT_ORIG_PTR(a), a->cpuid, NCAPINTS * 32);
+            return -ERANGE;
+        }
 
         /*
          * Detect sequences of alt_instr's patching the same origin site, and
@@ -356,12 +376,14 @@ static void init_or_livepatch _apply_alternatives(struct alt_instr *start,
 
         printk("altcall: Optimised away %u endbr64 instructions\n", clobbered);
     }
+
+    return 0;
 }
 
 #ifdef CONFIG_LIVEPATCH
-void apply_alternatives(struct alt_instr *start, struct alt_instr *end)
+int apply_alternatives(struct alt_instr *start, struct alt_instr *end)
 {
-    _apply_alternatives(start, end, true);
+    return _apply_alternatives(start, end, true);
 }
 #endif
 
@@ -383,6 +405,8 @@ static int __init cf_check nmi_apply_alternatives(
      */
     if ( !(alt_done & alt_todo) )
     {
+        int rc;
+
         /*
          * Relax perms on .text to be RWX, so we can modify them.
          *
@@ -394,8 +418,10 @@ static int __init cf_check nmi_apply_alternatives(
                                  PAGE_HYPERVISOR_RWX);
         flush_local(FLUSH_TLB_GLOBAL);
 
-        _apply_alternatives(__alt_instructions, __alt_instructions_end,
-                            alt_done);
+        rc = _apply_alternatives(__alt_instructions, __alt_instructions_end,
+                                 alt_done);
+        if ( rc )
+            panic("Unable to apply alternatives: %d\n", rc);
 
         /*
          * Reinstate perms on .text to be RX.  This also cleans out the dirty
diff --git a/xen/arch/x86/include/asm/alternative.h b/xen/arch/x86/include/asm/alternative.h
index a86eadfaec..69555d781e 100644
--- a/xen/arch/x86/include/asm/alternative.h
+++ b/xen/arch/x86/include/asm/alternative.h
@@ -24,7 +24,7 @@ struct __packed alt_instr {
 
 extern void add_nops(void *insns, unsigned int len);
 /* Similar to alternative_instructions except it can be run with IRQs enabled. */
-extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end);
+extern int apply_alternatives(struct alt_instr *start, struct alt_instr *end);
 extern void alternative_instructions(void);
 extern void alternative_branches(void);
 
diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
index 952a3b1af7..6ce77bf021 100644
--- a/xen/common/livepatch.c
+++ b/xen/common/livepatch.c
@@ -888,7 +888,15 @@ static int prepare_payload(struct payload *payload,
                 return -EINVAL;
             }
         }
-        apply_alternatives(start, end);
+
+        rc = apply_alternatives(start, end);
+        if ( rc )
+        {
+            printk(XENLOG_ERR LIVEPATCH "%s applying alternatives failed: %d\n",
+                   elf->name, rc);
+            return rc;
+        }
+
     alt_done:;
 #else
         printk(XENLOG_ERR LIVEPATCH "%s: We don't support alternative patching\n",
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 26 13:22:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Sep 2024 13:22:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.805473.1216590 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stoSD-0000Na-F8; Thu, 26 Sep 2024 13:22:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 805473.1216590; Thu, 26 Sep 2024 13:22:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stoSD-0000NS-Bz; Thu, 26 Sep 2024 13:22:45 +0000
Received: by outflank-mailman (input) for mailman id 805473;
 Thu, 26 Sep 2024 13:22:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stoSC-0000NE-By
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 13:22:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stoSC-0006hY-BD
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 13:22:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stoSC-0002TY-AN
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 13:22:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=j8+Qc4upbZMZaOzV0oqGh3yvDKM5lYTc/qe8vp4woxk=; b=iA5Hepn0CweOqO545i0WhMMOuU
	zhktvTYVuPRI36BkLDDDfIbV1/pVCQqX2V/RPBtONuHW6bgiJIC2s0l6MtvvCF27USuo/i05iP2/h
	VR1MZplHC4Fgye2Ljj87FqF5NG8mOPMUh+jrf8CPq0jjPEHWnIwa88H/enAaM9AAnw+4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/alternatives: build time check feature is in range
Message-Id: <E1stoSC-0002TY-AN@xenbits.xenproject.org>
Date: Thu, 26 Sep 2024 13:22:44 +0000

commit a184ac74f5e0c96fdea7a6f1f66d34133e1c337a
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Sep 26 12:14:31 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Sep 26 14:18:03 2024 +0100

    x86/alternatives: build time check feature is in range
    
    Ensure at build time the feature(s) used for the alternative blocks are in
    range of the featureset.
    
    No functional change intended, as all current usages are correct.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/alternative-asm.h | 3 +++
 xen/arch/x86/include/asm/alternative.h     | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/xen/arch/x86/include/asm/alternative-asm.h b/xen/arch/x86/include/asm/alternative-asm.h
index 4092f5ba70..83e8594f0e 100644
--- a/xen/arch/x86/include/asm/alternative-asm.h
+++ b/xen/arch/x86/include/asm/alternative-asm.h
@@ -12,6 +12,9 @@
  * instruction. See apply_alternatives().
  */
 .macro altinstruction_entry orig, repl, feature, orig_len, repl_len, pad_len
+    .if \feature >= NCAPINTS * 32
+        .error "alternative feature outside of featureset range"
+    .endif
     .long \orig - .
     .long \repl - .
     .word \feature
diff --git a/xen/arch/x86/include/asm/alternative.h b/xen/arch/x86/include/asm/alternative.h
index 69555d781e..38472fb58e 100644
--- a/xen/arch/x86/include/asm/alternative.h
+++ b/xen/arch/x86/include/asm/alternative.h
@@ -7,6 +7,7 @@
 #include <xen/lib.h>
 #include <xen/stringify.h>
 #include <asm/asm-macros.h>
+#include <asm/cpufeatureset.h>
 
 struct __packed alt_instr {
     int32_t  orig_offset;   /* original instruction */
@@ -59,6 +60,9 @@ extern void alternative_branches(void);
                     alt_repl_len(n2)) "-" alt_orig_len)
 
 #define ALTINSTR_ENTRY(feature, num)                                    \
+        " .if " STR(feature) " >= " STR(NCAPINTS * 32) "\n"             \
+        " .error \"alternative feature outside of featureset range\"\n" \
+        " .endif\n"                                                     \
         " .long .LXEN%=_orig_s - .\n"             /* label           */ \
         " .long " alt_repl_s(num)" - .\n"         /* new instruction */ \
         " .word " __stringify(feature) "\n"       /* feature bit     */ \
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 26 13:22:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Sep 2024 13:22:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.805474.1216593 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stoSN-0000QU-G2; Thu, 26 Sep 2024 13:22:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 805474.1216593; Thu, 26 Sep 2024 13:22:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stoSN-0000QM-DR; Thu, 26 Sep 2024 13:22:55 +0000
Received: by outflank-mailman (input) for mailman id 805474;
 Thu, 26 Sep 2024 13:22:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stoSM-0000QC-Es
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 13:22:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stoSM-0006hh-E6
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 13:22:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stoSM-0002Uo-DE
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 13:22:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xfZl/MQEummEf+x/5DBWJgbpyJr4bKmLQ9JosilROVM=; b=1aqp+T/Uuubc8/x9saqNh8SPac
	HaVbL+fgxONW/6KFKbrZcz83b87O6p5sDh6Qifq7ku1vgAeTWxmNeDtpjgj9J0gbYJcTrLgngC2DO
	5Q594sC4moSAO/RSW5pJ1t12XznlT14GuqdG0SA9nNjS7d9P0F2v/HbEPPAaOXBn3L0E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Refactor BIOS/PVH start
Message-Id: <E1stoSM-0002Uo-DE@xenbits.xenproject.org>
Date: Thu, 26 Sep 2024 13:22:54 +0000

commit 0857c75e6f96c48f2c8d8b6c9bf9dfcbe0267fc3
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Thu Sep 26 10:21:07 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Sep 26 14:18:03 2024 +0100

    x86/boot: Refactor BIOS/PVH start
    
    The 2 code paths were sharing quite some common code, reuse it instead
    of having duplications.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/boot/head.S | 104 +++++++++++++++++------------------------------
 1 file changed, 37 insertions(+), 67 deletions(-)

diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index 267207e5a2..e0901ee400 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -25,6 +25,8 @@
 #define MB2_HT(name)      (MULTIBOOT2_HEADER_TAG_##name)
 #define MB2_TT(name)      (MULTIBOOT2_TAG_TYPE_##name)
 
+#define XEN_HVM_START_MAGIC_VALUE 0x336ec578
+
         .macro mb2ht_args arg:req, args:vararg
         .long \arg
         .ifnb \args
@@ -409,13 +411,27 @@ cs32_switch:
 ELFNOTE(Xen, XEN_ELFNOTE_PHYS32_ENTRY, .long sym_offs(__pvh_start))
 
 __pvh_start:
-        cld
+        mov     $XEN_HVM_START_MAGIC_VALUE, %eax
+        /*
+         * Fall through into BIOS code.
+         * We will use %eax to distinguish we came from PVH entry point.
+         */
+#endif /* CONFIG_PVH_GUEST */
+
+__start:
         cli
+        cld
 
         /*
-         * We need one call (i.e. push) to determine the load address.  See
-         * __start for a discussion on how to do this safely using the PVH
-         * info structure.
+         * Multiboot (both 1 and 2) and PVH specify the stack pointer as
+         * undefined.  This is unhelpful for relocatable images, where one
+         * call (i.e. push) is required to calculate the image's load address.
+         *
+         * During BIOS boot, there is one area of memory we know about with
+         * reasonable confidence that it isn't overlapped by Xen, and that's
+         * the Multiboot info structure in %ebx.  Use it as a temporary stack.
+         *
+         * During PVH boot use info structure in %ebx.
          */
 
         /* Preserve the field we're about to clobber. */
@@ -433,14 +449,7 @@ __pvh_start:
         /* Set up stack. */
         lea     STACK_SIZE - CPUINFO_sizeof + sym_esi(cpu0_stack), %esp
 
-        call    .Linitialise_bss
-
-        mov     %ebx, sym_esi(pvh_start_info_pa)
-
-        /* Force xen console.  Will revert to user choice in init code. */
-        movb    $-1, sym_esi(opt_console_xen)
-
-        /* Prepare gdt and segments */
+        /* Initialize GDTR and basic data segments. */
         add     %esi, sym_esi(gdt_boot_base)
         lgdt    sym_esi(gdt_boot_descr)
 
@@ -448,19 +457,9 @@ __pvh_start:
         mov     %ecx, %ds
         mov     %ecx, %es
         mov     %ecx, %ss
+        mov     %ecx, %fs
+        mov     %ecx, %gs
 
-        /* Skip bootloader setup and bios setup, go straight to trampoline */
-        movb    $1, sym_esi(pvh_boot)
-        movb    $1, sym_esi(skip_realmode)
-
-        /* Set trampoline_phys to use mfn 1 to avoid having a mapping at VA 0 */
-        movw    $0x1000, sym_esi(trampoline_phys)
-        mov     (%ebx), %eax /* mov $XEN_HVM_START_MAGIC_VALUE, %eax */
-        jmp     trampoline_setup
-
-#endif /* CONFIG_PVH_GUEST */
-
-.Linitialise_bss:
         /* Initialise the BSS.  Preserve %eax (BOOTLOADER_MAGIC). */
         mov     %eax, %ebp
 
@@ -472,39 +471,25 @@ __pvh_start:
         rep stosl
 
         mov     %ebp, %eax
-        ret
-
-__start:
-        cld
-        cli
-
-        /*
-         * Multiboot (both 1 and 2) specify the stack pointer as undefined
-         * when entering in BIOS circumstances.  This is unhelpful for
-         * relocatable images, where one call (i.e. push) is required to
-         * calculate the image's load address.
-         *
-         * This early in boot, there is one area of memory we know about with
-         * reasonable confidence that it isn't overlapped by Xen, and that's
-         * the Multiboot info structure in %ebx.  Use it as a temporary stack.
-         */
 
-        /* Preserve the field we're about to clobber. */
-        mov     (%ebx), %edx
-        lea     4(%ebx), %esp
+#ifdef CONFIG_PVH_GUEST
+        cmp     $XEN_HVM_START_MAGIC_VALUE, %eax
+        jne     1f
 
-        /* Calculate the load base address. */
-        call    1f
-1:      pop     %esi
-        sub     $sym_offs(1b), %esi
+        mov     %ebx, sym_esi(pvh_start_info_pa)
 
-        /* Restore the clobbered field. */
-        mov     %edx, (%ebx)
+        /* Force xen console.  Will revert to user choice in init code. */
+        movb    $-1, sym_esi(opt_console_xen)
 
-        /* Set up stack. */
-        lea     STACK_SIZE - CPUINFO_sizeof + sym_esi(cpu0_stack), %esp
+        /* Skip bootloader setup and bios setup, go straight to trampoline */
+        movb    $1, sym_esi(pvh_boot)
+        movb    $1, sym_esi(skip_realmode)
 
-        call    .Linitialise_bss
+        /* Set trampoline_phys to use mfn 1 to avoid having a mapping at VA 0 */
+        movl    $PAGE_SIZE, sym_esi(trampoline_phys)
+        jmp     trampoline_setup
+1:
+#endif /* CONFIG_PVH_GUEST */
 
         /* Bootloaders may set multiboot{1,2}.mem_lower to a nonzero value. */
         xor     %edx,%edx
@@ -563,22 +548,7 @@ __start:
 trampoline_bios_setup:
         /*
          * Called on legacy BIOS platforms only.
-         *
-         * Initialize GDTR and basic data segments.
          */
-        add     %esi,sym_esi(gdt_boot_base)
-        lgdt    sym_esi(gdt_boot_descr)
-
-        mov     $BOOT_DS,%ecx
-        mov     %ecx,%ds
-        mov     %ecx,%es
-        mov     %ecx,%ss
-        /* %esp is initialized later. */
-
-        /* Load null descriptor to unused segment registers. */
-        xor     %ecx,%ecx
-        mov     %ecx,%fs
-        mov     %ecx,%gs
 
         /* Set up trampoline segment 64k below EBDA */
         movzwl  0x40e,%ecx          /* EBDA segment */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 26 13:23:05 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Sep 2024 13:23:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.805475.1216597 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stoSX-0000T6-Hc; Thu, 26 Sep 2024 13:23:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 805475.1216597; Thu, 26 Sep 2024 13:23:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stoSX-0000Sy-Ev; Thu, 26 Sep 2024 13:23:05 +0000
Received: by outflank-mailman (input) for mailman id 805475;
 Thu, 26 Sep 2024 13:23:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stoSW-0000Sr-IW
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 13:23:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stoSW-0006iN-Hl
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 13:23:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stoSW-0002Wx-GN
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 13:23:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kPxDmh/6CExHB+SnDm4/nSENBe7ClrEZE+/qCrB0gC8=; b=tG6Bqwa9h9B4dGRB9AXqRyxsXY
	1y8h9XDbySZPQCxZyp4xg5kfs+C1I3ROVf/3wSPxUp+Tgef6/SH6TRevv/adlzjDU0AEdh3uU5Ci6
	F79XeL5iSsZk3N7TvJjwGS46H/qUK6tDq2mNJDktLl4KLx14MIWK+NFOGnfd7wHU3gFs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] blkif: Fix alignment description for discard request
Message-Id: <E1stoSW-0002Wx-GN@xenbits.xenproject.org>
Date: Thu, 26 Sep 2024 13:23:04 +0000

commit e9a0101dde5f56e3dc72799798a82913546545c2
Author:     Anthony PERARD <anthony.perard@vates.tech>
AuthorDate: Thu Sep 26 12:53:50 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Sep 26 14:18:03 2024 +0100

    blkif: Fix alignment description for discard request
    
    The discard feature have an other xenstore node to described the size
    of the blocks than can be discarded, "discard-granularity", which
    default to "sector-size" when absent as noted in the properties and in
    note 4. So discard request should be aligned on this value.
    
    Fixes: 221f2748e8da ("blkif: reconcile protocol specification with in-use implementations")
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/include/public/io/blkif.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/public/io/blkif.h b/xen/include/public/io/blkif.h
index 9b00d633d3..789bab65ab 100644
--- a/xen/include/public/io/blkif.h
+++ b/xen/include/public/io/blkif.h
@@ -668,7 +668,7 @@ typedef struct blkif_request blkif_request_t;
  *
  * The 'sector_number' field is in units of 512b, despite the value of the
  * 'sector-size' xenstore node.  Note however that the offset in
- * 'sector_number' must be aligned to 'sector-size'.
+ * 'sector_number' must be aligned to 'discard-granularity'.
  */
 struct blkif_request_discard {
     uint8_t        operation;    /* BLKIF_OP_DISCARD                     */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Sep 26 13:23:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 26 Sep 2024 13:23:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.805476.1216601 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stoSh-0000VR-JF; Thu, 26 Sep 2024 13:23:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 805476.1216601; Thu, 26 Sep 2024 13:23:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1stoSh-0000VJ-GP; Thu, 26 Sep 2024 13:23:15 +0000
Received: by outflank-mailman (input) for mailman id 805476;
 Thu, 26 Sep 2024 13:23:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stoSg-0000VA-LR
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 13:23:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stoSg-0006iY-Kf
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 13:23:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1stoSg-0002Xk-Jr
 for xen-changelog@lists.xenproject.org; Thu, 26 Sep 2024 13:23:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uQIOvcde7u/axuEeVQYAeVy8DfZwnOpxwe+/tDGPW3U=; b=iE0etBXXc5xVjDpadcx8GWCdTY
	v7zxMKj+MEr8iisnRAcPIeXq8M4QmDB5eICBWchL86HYzkOudxyKGCbAEmWLxk7JIba20ULvF5tQ9
	8YdfhvVdBtKpdsKnC9xXzFhgmgTqsBbBssXRlCqah1gWrl1ZMe+Qur9mDb/mI6M85Ddo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] blkif: Fix a couple of typos
Message-Id: <E1stoSg-0002Xk-Jr@xenbits.xenproject.org>
Date: Thu, 26 Sep 2024 13:23:14 +0000

commit 457052167b4dbcda59e06300039302479cc1debf
Author:     Anthony PERARD <anthony.perard@vates.tech>
AuthorDate: Thu Sep 26 12:53:50 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Sep 26 14:18:03 2024 +0100

    blkif: Fix a couple of typos
    
    Those where fixed in OVMF's copy. (And one of them fixed in QEMU's
    copy but later discarded by an update.)
    
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Reviewed-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/include/public/io/blkif.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/include/public/io/blkif.h b/xen/include/public/io/blkif.h
index 789bab65ab..8407453324 100644
--- a/xen/include/public/io/blkif.h
+++ b/xen/include/public/io/blkif.h
@@ -42,7 +42,7 @@
  * All data in the XenStore is stored as strings.  Nodes specifying numeric
  * values are encoded in decimal.  Integer value ranges listed below are
  * expressed as fixed sized integer types capable of storing the conversion
- * of a properly formated node string, without loss of information.
+ * of a properly formatted node string, without loss of information.
  *
  * Any specified default value is in effect if the corresponding XenBus node
  * is not present in the XenStore.
@@ -328,7 +328,7 @@
  *      access (even when it should be read-only). If the frontend hits the
  *      maximum number of allowed persistently mapped grants, it can fallback
  *      to non persistent mode. This will cause a performance degradation,
- *      since the the backend driver will still try to map those grants
+ *      since the backend driver will still try to map those grants
  *      persistently. Since the persistent grants protocol is compatible with
  *      the previous protocol, a frontend driver can choose to work in
  *      persistent mode even when the backend doesn't support it.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Sep 27 02:11:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Sep 2024 02:11:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.805972.1217237 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1su0Rk-0007Mu-8s; Fri, 27 Sep 2024 02:11:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 805972.1217237; Fri, 27 Sep 2024 02:11:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1su0Rk-0007Mm-5w; Fri, 27 Sep 2024 02:11:04 +0000
Received: by outflank-mailman (input) for mailman id 805972;
 Fri, 27 Sep 2024 02:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1su0Ri-0007Mg-CN
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 02:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1su0Ri-0004P6-7B
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 02:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1su0Ri-0006pS-5r
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 02:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mYkGpUKuUV0ZttAo+u8Zn/zHYxVX+NvzR0J2FlVnY+k=; b=NUQ3upn6SEk2fW6RKumJQyrJtr
	Eva0RpmuXeBtILH7l1uyiDpNaw0B95lgwESK/h+/6IeZrmHK31THzONH4Uf2zdSBv5iPcD1U3BBEI
	jK2a+NHoRB3WigxNGxs29y9h9PtaQ+lbX9VS5/NxMjQDm/iXBlhNuX3Vof2zndgwQ7OU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/APIC: Remove x2APIC pure cluster mode
Message-Id: <E1su0Ri-0006pS-5r@xenbits.xenproject.org>
Date: Fri, 27 Sep 2024 02:11:02 +0000

commit 9b0d2465c87b69f203ab11ed4da74479b4ac84f1
Author:     Matthew Barnes <matthew.barnes@cloud.com>
AuthorDate: Mon Sep 23 15:35:59 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 24 18:57:38 2024 +0100

    x86/APIC: Remove x2APIC pure cluster mode
    
    With the introduction of mixed x2APIC mode (using cluster addressing for
    IPIs and physical for external interrupts) the use of pure cluster mode
    doesn't have any benefit.
    
    Remove the mode itself, leaving only the code required for logical
    addressing when sending IPIs.
    
    Resolves: https://gitlab.com/xen-project/xen/-/issues/189
    Signed-off-by: Matthew Barnes <matthew.barnes@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 CHANGELOG.md                      |  2 ++
 docs/misc/xen-command-line.pandoc |  4 ++--
 xen/arch/x86/Kconfig              | 12 ----------
 xen/arch/x86/genapic/x2apic.c     | 50 ++++-----------------------------------
 4 files changed, 8 insertions(+), 60 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 26e7d8dd2a..46c7d38963 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - On x86:
    - Support for running on Xeon Phi processors.
    - Removed the `ucode=allow-same` command line option.
+   - Removed x2APIC Cluster Mode for external interrupts.  x2APIC Physical and
+     Mixed Modes are still available.
 
 ## [4.19.0](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.19.0) - 2024-07-29
 
diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 959cf45b55..5ce63044ad 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2842,10 +2842,10 @@ the watchdog.
 Permit use of x2apic setup for SMP environments.
 
 ### x2apic-mode (x86)
-> `= physical | cluster | mixed`
+> `= physical | mixed`
 
 > Default: `physical` if **FADT** mandates physical mode, otherwise set at
->          build time by CONFIG_X2APIC_{PHYSICAL,LOGICAL,MIXED}.
+>          build time by CONFIG_X2APIC_{PHYSICAL,MIXED}.
 
 In the case that x2apic is in use, this option switches between modes to
 address APICs in the system as interrupt destinations.
diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 62f0b5e0f4..ab862b083f 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -275,18 +275,6 @@ config X2APIC_PHYSICAL
 	  destination inter processor interrupts (IPIs) slightly slower than
 	  Logical Destination mode.
 
-config X2APIC_CLUSTER
-	bool "Cluster Destination mode"
-	help
-	  When using this mode APICs are addressed using the Cluster Logical
-	  Destination mode.
-
-	  Cluster Destination has the benefit of sending IPIs faster since
-	  multiple APICs can be targeted as destinations of a single IPI.
-	  However the vector space is shared between all CPUs on the cluster,
-	  and hence using this mode reduces the number of available vectors
-	  when compared to Physical mode.
-
 config X2APIC_MIXED
 	bool "Mixed Destination mode"
 	help
diff --git a/xen/arch/x86/genapic/x2apic.c b/xen/arch/x86/genapic/x2apic.c
index d531035fa4..c277f4f79b 100644
--- a/xen/arch/x86/genapic/x2apic.c
+++ b/xen/arch/x86/genapic/x2apic.c
@@ -63,26 +63,6 @@ static void cf_check init_apic_ldr_x2apic_cluster(void)
     cpumask_set_cpu(this_cpu, per_cpu(cluster_cpus, this_cpu));
 }
 
-static const cpumask_t *cf_check vector_allocation_cpumask_x2apic_cluster(
-    int cpu)
-{
-    return per_cpu(cluster_cpus, cpu);
-}
-
-static unsigned int cf_check cpu_mask_to_apicid_x2apic_cluster(
-    const cpumask_t *cpumask)
-{
-    unsigned int cpu = cpumask_any(cpumask);
-    unsigned int dest = per_cpu(cpu_2_logical_apicid, cpu);
-    const cpumask_t *cluster_cpus = per_cpu(cluster_cpus, cpu);
-
-    for_each_cpu ( cpu, cluster_cpus )
-        if ( cpumask_test_cpu(cpu, cpumask) )
-            dest |= per_cpu(cpu_2_logical_apicid, cpu);
-
-    return dest;
-}
-
 static void cf_check send_IPI_self_x2apic(uint8_t vector)
 {
     apic_wrmsr(APIC_SELF_IPI, vector);
@@ -169,17 +149,6 @@ static const struct genapic __initconst_cf_clobber apic_x2apic_phys = {
     .send_IPI_self = send_IPI_self_x2apic
 };
 
-static const struct genapic __initconst_cf_clobber apic_x2apic_cluster = {
-    APIC_INIT("x2apic_cluster", NULL),
-    .int_delivery_mode = dest_LowestPrio,
-    .int_dest_mode = 1 /* logical delivery */,
-    .init_apic_ldr = init_apic_ldr_x2apic_cluster,
-    .vector_allocation_cpumask = vector_allocation_cpumask_x2apic_cluster,
-    .cpu_mask_to_apicid = cpu_mask_to_apicid_x2apic_cluster,
-    .send_IPI_mask = send_IPI_mask_x2apic_cluster,
-    .send_IPI_self = send_IPI_self_x2apic
-};
-
 /*
  * Mixed x2APIC mode: use physical for external (device) interrupts, and
  * cluster for inter processor interrupts.  Such mode has the benefits of not
@@ -252,15 +221,13 @@ static int8_t __initdata x2apic_phys = -1;
 boolean_param("x2apic_phys", x2apic_phys);
 
 enum {
-   unset, physical, cluster, mixed
+   unset, physical, mixed
 } static __initdata x2apic_mode = unset;
 
 static int __init cf_check parse_x2apic_mode(const char *s)
 {
     if ( !cmdline_strcmp(s, "physical") )
         x2apic_mode = physical;
-    else if ( !cmdline_strcmp(s, "cluster") )
-        x2apic_mode = cluster;
     else if ( !cmdline_strcmp(s, "mixed") )
         x2apic_mode = mixed;
     else
@@ -274,7 +241,7 @@ const struct genapic *__init apic_x2apic_probe(void)
 {
     /* Honour the legacy cmdline setting if it's the only one provided. */
     if ( x2apic_mode == unset && x2apic_phys >= 0 )
-        x2apic_mode = x2apic_phys ? physical : cluster;
+        x2apic_mode = x2apic_phys ? physical : mixed;
 
     if ( x2apic_mode == unset )
     {
@@ -286,21 +253,12 @@ const struct genapic *__init apic_x2apic_probe(void)
         else
             x2apic_mode = IS_ENABLED(CONFIG_X2APIC_MIXED) ? mixed
                           : (IS_ENABLED(CONFIG_X2APIC_PHYSICAL) ? physical
-                                                                : cluster);
+                                                                : mixed);
     }
 
     if ( x2apic_mode == physical )
         return &apic_x2apic_phys;
 
-    if ( x2apic_mode == cluster && iommu_intremap != iommu_intremap_full )
-    {
-        printk("WARNING: x2APIC cluster mode is not supported %s interrupt remapping -"
-               " forcing mixed mode\n",
-               iommu_intremap == iommu_intremap_off ? "without"
-                                                    : "with restricted");
-        x2apic_mode = mixed;
-    }
-
     if ( !this_cpu(cluster_cpus) )
     {
         update_clusterinfo(NULL, CPU_UP_PREPARE,
@@ -309,7 +267,7 @@ const struct genapic *__init apic_x2apic_probe(void)
         register_cpu_notifier(&x2apic_cpu_nfb);
     }
 
-    return x2apic_mode == cluster ? &apic_x2apic_cluster : &apic_x2apic_mixed;
+    return &apic_x2apic_mixed;
 }
 
 void __init check_x2apic_preenabled(void)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 27 02:11:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Sep 2024 02:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.805973.1217241 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1su0Ru-0007PF-BO; Fri, 27 Sep 2024 02:11:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 805973.1217241; Fri, 27 Sep 2024 02:11:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1su0Ru-0007P7-8p; Fri, 27 Sep 2024 02:11:14 +0000
Received: by outflank-mailman (input) for mailman id 805973;
 Fri, 27 Sep 2024 02:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1su0Rs-0007Or-Cd
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 02:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1su0Rs-0004PU-B6
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 02:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1su0Rs-0006qb-9N
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 02:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vTaH0ZUqZVoG6q+NGIUIm8c58QZrtRh/qag6k5oedz4=; b=5O11gOfsmC31gDiCs/Rt+5yPLg
	93EeDneleaI2o+TcgOTR2mmzevWt5oqitLYRHTttVtffRDioO4tHvrqrQZGvu+NgqOr+m9ysj+o2g
	lh47waTliKH66CLtRZ95IYuujci8qYIOw5nVBvEUYO3bFDfniClznZfdQkPMOMeHd6tY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/ucode: Improve commentary for parsing AMD containers
Message-Id: <E1su0Rs-0006qb-9N@xenbits.xenproject.org>
Date: Fri, 27 Sep 2024 02:11:12 +0000

commit 0416f1f66a1e28adc53c69ca166ba2d122660c6d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Sep 13 12:20:37 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 24 18:57:38 2024 +0100

    xen/ucode: Improve commentary for parsing AMD containers
    
    Despite writing this code, it's not the easiest logic to follow.
    
    Shorten the UCODE_EQUIV_TYPE name, and provide more of an explanation of
    what's going on.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/microcode/amd.c | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index 32490c8b7d..0fe869eff1 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -52,11 +52,11 @@ struct microcode_patch {
 };
 
 #define UCODE_MAGIC                0x00414d44
-#define UCODE_EQUIV_CPU_TABLE_TYPE 0x00000000
+#define UCODE_EQUIV_TYPE           0x00000000
 #define UCODE_UCODE_TYPE           0x00000001
 
 struct container_equiv_table {
-    uint32_t type; /* UCODE_EQUIV_CPU_TABLE_TYPE */
+    uint32_t type; /* UCODE_EQUIV_TYPE */
     uint32_t len;
     struct equiv_cpu_entry eq[];
 };
@@ -335,10 +335,10 @@ static struct microcode_patch *cf_check cpu_request_microcode(
         buf  += 4;
         size -= 4;
 
-        if ( size < sizeof(*et) ||
-             (et = buf)->type != UCODE_EQUIV_CPU_TABLE_TYPE ||
-             size - sizeof(*et) < et->len ||
-             et->len % sizeof(et->eq[0]) )
+        if ( size < sizeof(*et) ||                   /* No space for header? */
+             (et = buf)->type != UCODE_EQUIV_TYPE || /* Not an Equivalence Table? */
+             size - sizeof(*et) < et->len ||         /* No space for table? */
+             et->len % sizeof(et->eq[0]) )           /* Not multiple of equiv_cpu_entry? */
         {
             printk(XENLOG_ERR "microcode: Bad equivalent cpu table\n");
             error = -EINVAL;
@@ -351,7 +351,12 @@ static struct microcode_patch *cf_check cpu_request_microcode(
 
         error = scan_equiv_cpu_table(et);
 
-        /* -ESRCH means no applicable microcode in this container. */
+        /*
+         * -ESRCH means no applicable microcode in this container.  But, there
+         * might be subsequent containers in the blob.  Skipping to the end of
+         * this container still requires us to follow the UCODE_UCODE_TYPE/len
+         * metadata because there's no overall container length given.
+         */
         if ( error && error != -ESRCH )
             break;
         skip_ucode = error;
@@ -361,10 +366,10 @@ static struct microcode_patch *cf_check cpu_request_microcode(
         {
             const struct container_microcode *mc;
 
-            if ( size < sizeof(*mc) ||
-                 (mc = buf)->type != UCODE_UCODE_TYPE ||
-                 size - sizeof(*mc) < mc->len ||
-                 mc->len < sizeof(struct microcode_patch) )
+            if ( size < sizeof(*mc) ||                      /* No space for container header? */
+                 (mc = buf)->type != UCODE_UCODE_TYPE ||    /* Not a ucode blob? */
+                 size - sizeof(*mc) < mc->len ||            /* No space for blob? */
+                 mc->len < sizeof(struct microcode_patch) ) /* No space for patch header? */
             {
                 printk(XENLOG_ERR "microcode: Bad microcode data\n");
                 error = -EINVAL;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 27 02:11:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Sep 2024 02:11:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.805974.1217245 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1su0S4-0007Rj-Ct; Fri, 27 Sep 2024 02:11:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 805974.1217245; Fri, 27 Sep 2024 02:11:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1su0S4-0007Rb-AB; Fri, 27 Sep 2024 02:11:24 +0000
Received: by outflank-mailman (input) for mailman id 805974;
 Fri, 27 Sep 2024 02:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1su0S2-0007RQ-H4
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 02:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1su0S2-0004Pk-GJ
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 02:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1su0S2-0006rb-DK
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 02:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=q3TOm4XF4AwhEBwEqaFQsusw9a5t3gstV6c9Ih/qpU8=; b=lF/nlVGjD316KjrLNMsNIvBGk5
	n29xkZgdLVo2r+YjKR6BAa8RDEvIyYfAWb2c+QY/DPEVa6dLv51uNfj/m3odet40II6+M8IimV/AJ
	czqm+45+RnoTNBLeVQCdVVE+jk8Pq5bQ/HnOAi5iXEa1/BOyk5SH0GzAFc7lvY03CJaw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/ucode: Make Intel's microcode_sanity_check() stricter
Message-Id: <E1su0S2-0006rb-DK@xenbits.xenproject.org>
Date: Fri, 27 Sep 2024 02:11:22 +0000

commit 8752ad83e79754f8109457cff796e5f86f644348
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Fri Sep 13 14:19:30 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Sep 24 18:57:38 2024 +0100

    xen/ucode: Make Intel's microcode_sanity_check() stricter
    
    The SDM states that data size must be a multiple of 4, but Xen doesn't check
    this propery.
    
    This is liable to cause a later failures, but should be checked explicitly.
    
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/microcode/intel.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/intel.c b/xen/arch/x86/cpu/microcode/intel.c
index 6f69570586..bad51f6472 100644
--- a/xen/arch/x86/cpu/microcode/intel.c
+++ b/xen/arch/x86/cpu/microcode/intel.c
@@ -155,10 +155,13 @@ static int microcode_sanity_check(const struct microcode_patch *patch)
     uint32_t sum;
 
     /*
-     * Total size must be a multiple of 1024 bytes.  Data size and the header
-     * must fit within it.
+     * The SDM states:
+     * - Data size must be a multiple of 4.
+     * - Total size must be a multiple of 1024 bytes.  Data size and the
+     *   header must fit within it.
      */
     if ( (total_size & 1023) ||
+         (data_size & 3) ||
          data_size > (total_size - MC_HEADER_SIZE) )
     {
         printk(XENLOG_WARNING "microcode: Bad size\n");
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 27 02:11:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Sep 2024 02:11:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.805975.1217249 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1su0SE-0007UQ-EE; Fri, 27 Sep 2024 02:11:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 805975.1217249; Fri, 27 Sep 2024 02:11:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1su0SE-0007UI-BZ; Fri, 27 Sep 2024 02:11:34 +0000
Received: by outflank-mailman (input) for mailman id 805975;
 Fri, 27 Sep 2024 02:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1su0SC-0007U7-Kr
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 02:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1su0SC-0004Ps-K6
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 02:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1su0SC-0006sk-IV
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 02:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PPGXPjRv3J9xTSucj21SmKwbBGqlE9FcufZ8PqAoILU=; b=6gWHg8b4cXjfR+RJCxDAJVU7Kf
	cdMEzKcLzHD2yUqavAN0Yj31Zn2Za7y7nyVPtVK4ARHU0Avb/cYJh3lq8rBw3HCcKa834RMuIFHb8
	5e4uRuZ38UmS/WJBiZkMUyiteZCjSWZg+jcfIjAppFJ1peULN03Eo2KPt+Kju3bQIJN0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/efi: efibind: Fix typo in comment
Message-Id: <E1su0SC-0006sk-IV@xenbits.xenproject.org>
Date: Fri, 27 Sep 2024 02:11:32 +0000

commit 512ac41aa6550268d82fd0d63ef6f6042e9da419
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Mon Sep 16 10:35:57 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Sep 25 12:12:31 2024 +0100

    xen/efi: efibind: Fix typo in comment
    
    expresion -> expression
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/x86_64/efibind.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/include/asm/x86_64/efibind.h b/xen/arch/x86/include/asm/x86_64/efibind.h
index 28bc18c24b..b29342c61c 100644
--- a/xen/arch/x86/include/asm/x86_64/efibind.h
+++ b/xen/arch/x86/include/asm/x86_64/efibind.h
@@ -176,7 +176,7 @@ typedef uint64_t   UINTN;
     #elif __clang__ || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
         #define EFIAPI __attribute__((__ms_abi__))  // Force Microsoft ABI
     #else
-        #define EFIAPI          // Substitute expresion to force C calling convention
+        #define EFIAPI          // Substitute expression to force C calling convention
     #endif
 #endif
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 27 02:11:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Sep 2024 02:11:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.805976.1217253 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1su0SO-0007XE-FZ; Fri, 27 Sep 2024 02:11:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 805976.1217253; Fri, 27 Sep 2024 02:11:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1su0SO-0007X6-Cu; Fri, 27 Sep 2024 02:11:44 +0000
Received: by outflank-mailman (input) for mailman id 805976;
 Fri, 27 Sep 2024 02:11:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1su0SM-0007Wt-OW
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 02:11:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1su0SM-0004Q1-Nl
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 02:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1su0SM-0006ts-MJ
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 02:11:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pYbdPx5evZEOtmwznleagAtRxDDOpyXxDbzSrqNHc8s=; b=3+wEMmWAjNIZP+PLXZUvzn3wB2
	DC8WtsSljTEkMvqlj7wTl9DswsnMwJKNkor0nVFObnMAK+1zhk+Y54C7JBYVI0asTQt3LnAplVbgL
	ffl0gGfBI1VWXDTH+HmvTeQL6hU56D65wXngZGnTbIhyTerBGx3WdSjiE4/OkvBixlro=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: introduce common macros for per-CPU sections defintion
Message-Id: <E1su0SM-0006ts-MJ@xenbits.xenproject.org>
Date: Fri, 27 Sep 2024 02:11:42 +0000

commit 11eb4e2969c15be701f4485b5770834439682b47
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Sep 24 18:42:27 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Sep 25 12:12:35 2024 +0100

    xen: introduce common macros for per-CPU sections defintion
    
    Introduce PERCPU_BSS macro which manages:
     * Alignment of the section start
     * Insertion of per-CPU data sections
     * Alignment and start/end markers for per-CPU data
    This change simplifies the linker script maintenance and ensures a unified
    approach for per-CPU sections across different architectures.
    
    Refactor the linker scripts for Arm, PPC, and x86 architectures by using
    the common macro PERCPU_BSS defined in xen/xen.lds.h to handle per-CPU
    data sections.
    
    No functional changes.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/arm/xen.lds.S    |  9 +--------
 xen/arch/ppc/xen.lds.S    |  9 +--------
 xen/arch/riscv/xen.lds.S  |  9 +--------
 xen/arch/x86/xen.lds.S    |  9 +--------
 xen/include/xen/xen.lds.h | 10 ++++++++++
 5 files changed, 14 insertions(+), 32 deletions(-)

diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
index bd884664ad..0987052f1a 100644
--- a/xen/arch/arm/xen.lds.S
+++ b/xen/arch/arm/xen.lds.S
@@ -198,14 +198,7 @@ SECTIONS
        __bss_start = .;
        *(.bss.stack_aligned)
        *(.bss.page_aligned)
-       . = ALIGN(PAGE_SIZE);
-       __per_cpu_start = .;
-       *(.bss.percpu.page_aligned)
-       *(.bss.percpu)
-       . = ALIGN(SMP_CACHE_BYTES);
-       *(.bss.percpu.read_mostly)
-       . = ALIGN(SMP_CACHE_BYTES);
-       __per_cpu_data_end = .;
+       PERCPU_BSS
        *(.bss .bss.*)
        . = ALIGN(POINTER_ALIGN);
        __bss_end = .;
diff --git a/xen/arch/ppc/xen.lds.S b/xen/arch/ppc/xen.lds.S
index 38cd857187..0c4b94814b 100644
--- a/xen/arch/ppc/xen.lds.S
+++ b/xen/arch/ppc/xen.lds.S
@@ -148,14 +148,7 @@ SECTIONS
         __bss_start = .;
         *(.bss.stack_aligned)
         *(.bss.page_aligned)
-        . = ALIGN(PAGE_SIZE);
-        __per_cpu_start = .;
-        *(.bss.percpu.page_aligned)
-        *(.bss.percpu)
-        . = ALIGN(SMP_CACHE_BYTES);
-        *(.bss.percpu.read_mostly)
-        . = ALIGN(SMP_CACHE_BYTES);
-        __per_cpu_data_end = .;
+        PERCPU_BSS
         *(.bss .bss.*)
         . = ALIGN(POINTER_ALIGN);
         __bss_end = .;
diff --git a/xen/arch/riscv/xen.lds.S b/xen/arch/riscv/xen.lds.S
index 070b19d915..871b47a235 100644
--- a/xen/arch/riscv/xen.lds.S
+++ b/xen/arch/riscv/xen.lds.S
@@ -145,14 +145,7 @@ SECTIONS
         __bss_start = .;
         *(.bss.stack_aligned)
         *(.bss.page_aligned)
-        . = ALIGN(PAGE_SIZE);
-        __per_cpu_start = .;
-        *(.bss.percpu.page_aligned)
-        *(.bss.percpu)
-        . = ALIGN(SMP_CACHE_BYTES);
-        *(.bss.percpu.read_mostly)
-        . = ALIGN(SMP_CACHE_BYTES);
-        __per_cpu_data_end = .;
+        PERCPU_BSS
         *(.sbss .sbss.* .bss .bss.*)
         . = ALIGN(POINTER_ALIGN);
         __bss_end = .;
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index d48de67cfd..b60d2f0d82 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -321,14 +321,7 @@ SECTIONS
   DECL_SECTION(.bss) {
        __bss_start = .;
        *(.bss.page_aligned*)
-       . = ALIGN(PAGE_SIZE);
-       __per_cpu_start = .;
-       *(.bss.percpu.page_aligned)
-       *(.bss.percpu)
-       . = ALIGN(SMP_CACHE_BYTES);
-       *(.bss.percpu.read_mostly)
-       . = ALIGN(SMP_CACHE_BYTES);
-       __per_cpu_data_end = .;
+       PERCPU_BSS
        *(.bss .bss.*)
        . = ALIGN(POINTER_ALIGN);
        __bss_end = .;
diff --git a/xen/include/xen/xen.lds.h b/xen/include/xen/xen.lds.h
index a17810bb28..24b8900ffe 100644
--- a/xen/include/xen/xen.lds.h
+++ b/xen/include/xen/xen.lds.h
@@ -151,6 +151,16 @@
 #define LOCK_PROFILE_DATA
 #endif
 
+#define PERCPU_BSS                 \
+       . = ALIGN(PAGE_SIZE);       \
+       __per_cpu_start = .;        \
+       *(.bss.percpu.page_aligned) \
+       *(.bss.percpu)              \
+       . = ALIGN(SMP_CACHE_BYTES); \
+       *(.bss.percpu.read_mostly)  \
+       . = ALIGN(SMP_CACHE_BYTES); \
+       __per_cpu_data_end = .;     \
+
 #ifdef CONFIG_HAS_VPCI
 #define VPCI_ARRAY               \
        . = ALIGN(POINTER_ALIGN); \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 27 02:11:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Sep 2024 02:11:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.805977.1217257 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1su0SY-0007Zn-H0; Fri, 27 Sep 2024 02:11:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 805977.1217257; Fri, 27 Sep 2024 02:11:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1su0SY-0007Zf-EN; Fri, 27 Sep 2024 02:11:54 +0000
Received: by outflank-mailman (input) for mailman id 805977;
 Fri, 27 Sep 2024 02:11:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1su0SW-0007ZS-Re
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 02:11:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1su0SW-0004Q9-Qs
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 02:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1su0SW-0006um-Q0
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 02:11:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WHqEL+H+rFLW7CA5AYbYhdq9dcm3uk+U69FVEs28jb4=; b=Y5b2Y4/tGGCq4mCkcs1NiW8MI0
	GNvKsior5Zndb5QV1yMWutqhoxZO10cLpYMIOnhB1iEyB8q/hfMo/zbzlpOWNa7rGm3zS2UUXAIO2
	hv3Ico6lEBPAVeby/Pki6JWc12OnYGvCFOOuCCb2IBHkwyH60vt3D4krI+JjKasQerbI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/defns: Fix typo in comment "Porection" -> "Protection"
Message-Id: <E1su0SW-0006um-Q0@xenbits.xenproject.org>
Date: Fri, 27 Sep 2024 02:11:52 +0000

commit b81ea162efd4b66b78ee358aefbc225fd1dfd2e4
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Wed Sep 25 12:09:46 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Sep 25 12:12:35 2024 +0100

    x86/defns: Fix typo in comment "Porection" -> "Protection"
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/x86-defns.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index caa92829ea..7abc5bcd42 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -171,7 +171,7 @@
 #define X86_EXC_TS            10 /* Invalid TSS */
 #define X86_EXC_NP            11 /* Segment Not Present */
 #define X86_EXC_SS            12 /* Stack-Segment Fault */
-#define X86_EXC_GP            13 /* General Porection Fault */
+#define X86_EXC_GP            13 /* General Protection Fault */
 #define X86_EXC_PF            14 /* Page Fault */
 #define X86_EXC_SPV           15 /* PIC Spurious Interrupt Vector */
 #define X86_EXC_MF            16 /* Maths fault (x87 FPU) */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 27 02:12:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Sep 2024 02:12:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.805978.1217261 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1su0Si-0007cc-Ig; Fri, 27 Sep 2024 02:12:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 805978.1217261; Fri, 27 Sep 2024 02:12:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1su0Si-0007cU-Fp; Fri, 27 Sep 2024 02:12:04 +0000
Received: by outflank-mailman (input) for mailman id 805978;
 Fri, 27 Sep 2024 02:12:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1su0Sg-0007cK-Ud
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 02:12:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1su0Sg-0004QX-Ts
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 02:12:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1su0Sg-0006wF-Sx
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 02:12:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NmUrE0aa0vUDkHrtW6nej6X36OFa8FzQ+AOJ8B02Giw=; b=JPy7oD5z1tdriWOvGHtn1l9O5f
	/2g98Ps1VRqdoij9lFhVa7iBDVhRi1ZW9eR0rUrbud18/YJ25YDDWHN6EkYXYE8GhZ/5ap9YN0Us7
	ZX8v8U42V2NwhSawg6CuNQmrAe2ddsSQnB7c/du0y0hTVw5/0HharnXvO5d0VT78Zgg0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] changelog: add note about blkif protocol fixes
Message-Id: <E1su0Sg-0006wF-Sx@xenbits.xenproject.org>
Date: Fri, 27 Sep 2024 02:12:02 +0000

commit 1aec9a4ba7bffaed15cb1300576bbfc4121bc4fd
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Sep 25 16:47:35 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 25 16:47:35 2024 +0200

    changelog: add note about blkif protocol fixes
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 46c7d38963..c499d12dc4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ## [4.20.0 UNRELEASED](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD
 
 ### Changed
+ - Fixed blkif protocol specification for sector sizes different than 512b.
  - On x86:
    - Prefer ACPI reboot over UEFI ResetSystem() run time service call.
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 27 02:12:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Sep 2024 02:12:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.805979.1217265 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1su0Ss-0007ff-K0; Fri, 27 Sep 2024 02:12:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 805979.1217265; Fri, 27 Sep 2024 02:12:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1su0Ss-0007fY-HJ; Fri, 27 Sep 2024 02:12:14 +0000
Received: by outflank-mailman (input) for mailman id 805979;
 Fri, 27 Sep 2024 02:12:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1su0Sr-0007fN-1p
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 02:12:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1su0Sr-0004R0-15
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 02:12:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1su0Sq-0006x2-W0
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 02:12:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fo1tWkDciGUWdeLVbp/DdqQXrA+RRrLm+0j3Jkvwazk=; b=P+6UZngir8qaF64AfLhItOYHga
	MzZ07pG6Q1v0hHBD+Cs+69L8DYFbeSaD2G9gd2FdvlxTenYtavhiklj7fgywHdAA93aMPHSyqycm5
	Dl5+EBIiuOuDtQiGJElYI2aS7r07lY3YYzT0kwGZBmG0IEULw2n3X7lYztNhoxW9jp7E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Initialise BSS sooner
Message-Id: <E1su0Sq-0006x2-W0@xenbits.xenproject.org>
Date: Fri, 27 Sep 2024 02:12:12 +0000

commit b083121c9439f2f00b546090bbc83872d725625f
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Wed Sep 25 16:47:51 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 25 16:47:51 2024 +0200

    x86/boot: Initialise BSS sooner
    
    Allows to call C code earlier.
    In order to safely call C code we need to setup stack, selectors and BSS.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/boot/head.S | 77 ++++++++++++++++++++++++------------------------
 1 file changed, 39 insertions(+), 38 deletions(-)

diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index cfc5a7b47d..267207e5a2 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -231,6 +231,27 @@ __efi64_mb2_start:
         /* VGA is not available on EFI platforms. */
         movl   $0,vga_text_buffer(%rip)
 
+        /*
+         * Align the stack as UEFI spec requires. Keep it aligned
+         * before efi_multiboot2() call by pushing/popping even
+         * numbers of items on it.
+         */
+        and     $~15, %rsp
+
+        /*
+         * Initialize BSS (no nasty surprises!).
+         * It must be done earlier than in BIOS case
+         * because efi_multiboot2() touches it.
+         */
+        mov     %eax, %edx
+        lea     __bss_start(%rip), %edi
+        lea     __bss_end(%rip), %ecx
+        sub     %edi, %ecx
+        shr     $3, %ecx
+        xor     %eax, %eax
+        rep stosq
+        mov     %edx, %eax
+
         /* Check for Multiboot2 bootloader. */
         cmp     $MULTIBOOT2_BOOTLOADER_MAGIC,%eax
         je      .Lefi_multiboot2_proto
@@ -321,34 +342,12 @@ __efi64_mb2_start:
         lea     .Lmb2_no_ih(%rip),%r15
         jz      x86_32_switch
 
-        /*
-         * Align the stack as UEFI spec requires. Keep it aligned
-         * before efi_multiboot2() call by pushing/popping even
-         * numbers of items on it.
-         */
-        and     $~15,%rsp
-
         /* Save Multiboot2 magic on the stack. */
         push    %rax
 
         /* Save EFI ImageHandle on the stack. */
         push    %rdi
 
-        /*
-         * Initialize BSS (no nasty surprises!).
-         * It must be done earlier than in BIOS case
-         * because efi_multiboot2() touches it.
-         */
-        lea     __bss_start(%rip),%edi
-        lea     __bss_end(%rip),%ecx
-        sub     %edi,%ecx
-        shr     $3,%ecx
-        xor     %eax,%eax
-        rep stosq
-
-        /* Keep the stack aligned. Do not pop a single item off it. */
-        mov     (%rsp),%rdi
-
         /*
          * efi_multiboot2() is called according to System V AMD64 ABI:
          *   - IN:  %rdi - EFI ImageHandle, %rsi - EFI SystemTable,
@@ -434,6 +433,8 @@ __pvh_start:
         /* Set up stack. */
         lea     STACK_SIZE - CPUINFO_sizeof + sym_esi(cpu0_stack), %esp
 
+        call    .Linitialise_bss
+
         mov     %ebx, sym_esi(pvh_start_info_pa)
 
         /* Force xen console.  Will revert to user choice in init code. */
@@ -459,6 +460,20 @@ __pvh_start:
 
 #endif /* CONFIG_PVH_GUEST */
 
+.Linitialise_bss:
+        /* Initialise the BSS.  Preserve %eax (BOOTLOADER_MAGIC). */
+        mov     %eax, %ebp
+
+        lea     sym_esi(__bss_start), %edi
+        lea     sym_esi(__bss_end), %ecx
+        sub     %edi, %ecx
+        xor     %eax, %eax
+        shr     $2, %ecx
+        rep stosl
+
+        mov     %ebp, %eax
+        ret
+
 __start:
         cld
         cli
@@ -489,6 +504,8 @@ __start:
         /* Set up stack. */
         lea     STACK_SIZE - CPUINFO_sizeof + sym_esi(cpu0_stack), %esp
 
+        call    .Linitialise_bss
+
         /* Bootloaders may set multiboot{1,2}.mem_lower to a nonzero value. */
         xor     %edx,%edx
 
@@ -645,22 +662,6 @@ trampoline_setup:
          * reserved for trampoline code and data.
          */
 
-        /*
-         * Do not zero BSS on EFI platform here.
-         * It was initialized earlier.
-         */
-        cmpb    $0, sym_esi(efi_platform)
-        jnz     1f
-
-        /* Initialise the BSS. */
-        lea     sym_esi(__bss_start), %edi
-        lea     sym_esi(__bss_end), %ecx
-        sub     %edi,%ecx
-        xor     %eax,%eax
-        shr     $2,%ecx
-        rep stosl
-
-1:
         /* Interrogate CPU extended features via CPUID. */
         mov     $1, %eax
         cpuid
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 27 02:12:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Sep 2024 02:12:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.805980.1217268 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1su0T2-0007ii-MW; Fri, 27 Sep 2024 02:12:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 805980.1217268; Fri, 27 Sep 2024 02:12:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1su0T2-0007ib-K4; Fri, 27 Sep 2024 02:12:24 +0000
Received: by outflank-mailman (input) for mailman id 805980;
 Fri, 27 Sep 2024 02:12:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1su0T1-0007iV-4r
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 02:12:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1su0T1-0004SQ-45
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 02:12:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1su0T1-0006xz-3C
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 02:12:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lYbpxekkTeL8sd23EO45zjnfTpo9Du7+fy4qjZlDjzQ=; b=h/WUfUMQSPfx0V/qtnx3H0By5V
	A69g3WmP8NTqXjtM9XBAymcS18NvdgCjgVXBg1a4cDGZ9LCNTz1BiK6uXIx4pDbOkJ5jqhF5QI4Xz
	hep2x7MmVepqQnJuvd3tPlN7Vd3/4qTiZIW2TfOGsVDSntoOgDARREwJJWp0mZHyS+AE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/livepatch: remove useless check for duplicated sections
Message-Id: <E1su0T1-0006xz-3C@xenbits.xenproject.org>
Date: Fri, 27 Sep 2024 02:12:23 +0000

commit 3a28da8f4dafa906ec13b8d0533046584d897bca
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Sep 25 16:48:33 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Sep 25 16:48:33 2024 +0200

    xen/livepatch: remove useless check for duplicated sections
    
    The current check for duplicated sections in a payload is not effective.  Such
    check is done inside a loop that iterates over the sections names, it's
    logically impossible for the bitmap to be set more than once.
    
    The usage of a bitmap in check_patching_sections() has been replaced with a
    boolean, since the function just cares that at least one of the special
    sections is present.
    
    No functional change intended, as the check was useless.
    
    Fixes: 29f4ab0b0a4f ('xsplice: Implement support for applying/reverting/replacing patches.')
    Fixes: 76b3d4098a92 ('livepatch: Do not enforce ELF_LIVEPATCH_FUNC section presence')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/livepatch.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
index d93a556bcd..df41dcce97 100644
--- a/xen/common/livepatch.c
+++ b/xen/common/livepatch.c
@@ -473,7 +473,6 @@ static int check_special_sections(const struct livepatch_elf *elf)
     static const char *const names[] = { ELF_LIVEPATCH_DEPENDS,
                                          ELF_LIVEPATCH_XEN_DEPENDS,
                                          ELF_BUILD_ID_NOTE};
-    DECLARE_BITMAP(found, ARRAY_SIZE(names)) = { 0 };
 
     for ( i = 0; i < ARRAY_SIZE(names); i++ )
     {
@@ -493,13 +492,6 @@ static int check_special_sections(const struct livepatch_elf *elf)
                    elf->name, names[i]);
             return -EINVAL;
         }
-
-        if ( test_and_set_bit(i, found) )
-        {
-            printk(XENLOG_ERR LIVEPATCH "%s: %s was seen more than once\n",
-                   elf->name, names[i]);
-            return -EINVAL;
-        }
     }
 
     return 0;
@@ -517,7 +509,7 @@ static int check_patching_sections(const struct livepatch_elf *elf)
                                          ELF_LIVEPATCH_PREREVERT_HOOK,
                                          ELF_LIVEPATCH_REVERT_HOOK,
                                          ELF_LIVEPATCH_POSTREVERT_HOOK};
-    DECLARE_BITMAP(found, ARRAY_SIZE(names)) = { 0 };
+    bool found = false;
 
     /*
      * The patching sections are optional, but at least one
@@ -544,16 +536,11 @@ static int check_patching_sections(const struct livepatch_elf *elf)
             return -EINVAL;
         }
 
-        if ( test_and_set_bit(i, found) )
-        {
-            printk(XENLOG_ERR LIVEPATCH "%s: %s was seen more than once\n",
-                   elf->name, names[i]);
-            return -EINVAL;
-        }
+        found = true;
     }
 
     /* Checking if at least one section is present. */
-    if ( bitmap_empty(found, ARRAY_SIZE(names)) )
+    if ( !found )
     {
         printk(XENLOG_ERR LIVEPATCH "%s: Nothing to patch. Aborting...\n",
                elf->name);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 27 15:11:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Sep 2024 15:11:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.806372.1217706 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1suCcZ-000422-De; Fri, 27 Sep 2024 15:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 806372.1217706; Fri, 27 Sep 2024 15:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1suCcZ-00041u-AD; Fri, 27 Sep 2024 15:11:03 +0000
Received: by outflank-mailman (input) for mailman id 806372;
 Fri, 27 Sep 2024 15:11:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1suCcX-00041o-Ml
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 15:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1suCcX-0003Ju-GQ
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 15:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1suCcX-0002Rh-EA
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 15:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Kr+Fu2xORDst9uXgit/NgEXXq22Djqf92VR8CKLDqs4=; b=YZ3p4lfsjrFMxFTN4nSa02IZlg
	26UWpUf7ksK8pPu77qTnOu2zf6h1ggSp01fFfWyZzfe2dynhRbHETUwKqXUU7waFqMc4NIe6CdiQe
	ibeh+Hgl5pNtsGgec2DKZVmGL0AZkccfJoyfn9QmlWcP8ITZn95Kc4kocaM10UL/lRTc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/livepatch: drop load_addr Elf section field
Message-Id: <E1suCcX-0002Rh-EA@xenbits.xenproject.org>
Date: Fri, 27 Sep 2024 15:11:01 +0000

commit 8c81423038f17f6cbc853dd35d69d50a4458f764
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Sep 26 12:14:27 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Sep 26 14:18:03 2024 +0100

    xen/livepatch: drop load_addr Elf section field
    
    The Elf loading logic will initially use the `data` section field to stash a
    pointer to the temporary loaded data (from the buffer allocated in
    livepatch_upload(), which is later relocated and the new pointer stashed in
    `load_addr`.
    
    Remove this dual field usage and use an `addr` uniformly.  Initially data will
    point to the temporary buffer, until relocation happens, at which point the
    pointer will be updated to the relocated address.
    
    This avoids leaving a dangling pointer in the `data` field once the temporary
    buffer is freed by livepatch_upload().
    
    Note the `addr` field cannot retain the const attribute from the previous
    `data`field, as there's logic that performs manipulations against the loaded
    sections, like applying relocations or sorting the exception table.
    
    No functional change intended.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/arm32/livepatch.c  |  8 ++++----
 xen/arch/arm/arm64/livepatch.c  |  4 ++--
 xen/arch/x86/livepatch.c        |  4 ++--
 xen/common/livepatch.c          | 43 ++++++++++++++++++++++-------------------
 xen/common/livepatch_elf.c      | 20 +++++++++----------
 xen/include/xen/livepatch_elf.h | 11 ++++++-----
 6 files changed, 47 insertions(+), 43 deletions(-)

diff --git a/xen/arch/arm/arm32/livepatch.c b/xen/arch/arm/arm32/livepatch.c
index d500665646..134d07a175 100644
--- a/xen/arch/arm/arm32/livepatch.c
+++ b/xen/arch/arm/arm32/livepatch.c
@@ -239,20 +239,20 @@ int arch_livepatch_perform(struct livepatch_elf *elf,
 
         if ( use_rela )
         {
-            const Elf_RelA *r_a = rela->data + i * rela->sec->sh_entsize;
+            const Elf_RelA *r_a = rela->addr + i * rela->sec->sh_entsize;
 
             symndx = ELF32_R_SYM(r_a->r_info);
             type = ELF32_R_TYPE(r_a->r_info);
-            dest = base->load_addr + r_a->r_offset; /* P */
+            dest = base->addr + r_a->r_offset; /* P */
             addend = r_a->r_addend;
         }
         else
         {
-            const Elf_Rel *r = rela->data + i * rela->sec->sh_entsize;
+            const Elf_Rel *r = rela->addr + i * rela->sec->sh_entsize;
 
             symndx = ELF32_R_SYM(r->r_info);
             type = ELF32_R_TYPE(r->r_info);
-            dest = base->load_addr + r->r_offset; /* P */
+            dest = base->addr + r->r_offset; /* P */
             addend = get_addend(type, dest);
         }
 
diff --git a/xen/arch/arm/arm64/livepatch.c b/xen/arch/arm/arm64/livepatch.c
index dfb72be44f..d80051f9dc 100644
--- a/xen/arch/arm/arm64/livepatch.c
+++ b/xen/arch/arm/arm64/livepatch.c
@@ -246,9 +246,9 @@ int arch_livepatch_perform_rela(struct livepatch_elf *elf,
 
     for ( i = 0; i < (rela->sec->sh_size / rela->sec->sh_entsize); i++ )
     {
-        const Elf_RelA *r = rela->data + i * rela->sec->sh_entsize;
+        const Elf_RelA *r = rela->addr + i * rela->sec->sh_entsize;
         unsigned int symndx = ELF64_R_SYM(r->r_info);
-        void *dest = base->load_addr + r->r_offset; /* P */
+        void *dest = base->addr + r->r_offset; /* P */
         bool overflow_check = true;
         int ovf = 0;
         uint64_t val;
diff --git a/xen/arch/x86/livepatch.c b/xen/arch/x86/livepatch.c
index 4f76127e1f..be40f625d2 100644
--- a/xen/arch/x86/livepatch.c
+++ b/xen/arch/x86/livepatch.c
@@ -258,9 +258,9 @@ int arch_livepatch_perform_rela(struct livepatch_elf *elf,
 
     for ( i = 0; i < (rela->sec->sh_size / rela->sec->sh_entsize); i++ )
     {
-        const Elf_RelA *r = rela->data + i * rela->sec->sh_entsize;
+        const Elf_RelA *r = rela->addr + i * rela->sec->sh_entsize;
         unsigned int symndx = ELF64_R_SYM(r->r_info);
-        uint8_t *dest = base->load_addr + r->r_offset;
+        uint8_t *dest = base->addr + r->r_offset;
         uint64_t val;
 
         if ( symndx == STN_UNDEF )
diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
index df41dcce97..259b09f4a1 100644
--- a/xen/common/livepatch.c
+++ b/xen/common/livepatch.c
@@ -371,18 +371,21 @@ static int move_payload(struct payload *payload, struct livepatch_elf *elf)
 
             ASSERT(offset[i] != UINT_MAX);
 
-            elf->sec[i].load_addr = buf + offset[i];
+            buf += offset[i];
 
             /* Don't copy NOBITS - such as BSS. */
             if ( elf->sec[i].sec->sh_type != SHT_NOBITS )
             {
-                memcpy(elf->sec[i].load_addr, elf->sec[i].data,
+                memcpy(buf, elf->sec[i].addr,
                        elf->sec[i].sec->sh_size);
                 dprintk(XENLOG_DEBUG, LIVEPATCH "%s: Loaded %s at %p\n",
-                        elf->name, elf->sec[i].name, elf->sec[i].load_addr);
+                        elf->name, elf->sec[i].name, buf);
             }
             else
-                memset(elf->sec[i].load_addr, 0, elf->sec[i].sec->sh_size);
+                memset(buf, 0, elf->sec[i].sec->sh_size);
+
+            /* Update sec[] to refer to its final location. */
+            elf->sec[i].addr = buf;
         }
     }
 
@@ -616,7 +619,7 @@ static inline int livepatch_check_expectations(const struct payload *payload)
         break;                                                                            \
     if ( !section_ok(elf, __sec, sizeof(*hook)) || __sec->sec->sh_size != sizeof(*hook) ) \
         return -EINVAL;                                                                   \
-    hook = __sec->load_addr;                                                              \
+    hook = __sec->addr;                                                                   \
 } while (0)
 
 /*
@@ -630,7 +633,7 @@ static inline int livepatch_check_expectations(const struct payload *payload)
         break;                                                                            \
     if ( !section_ok(elf, __sec, sizeof(*hook)) )                                         \
         return -EINVAL;                                                                   \
-    hook = __sec->load_addr;                                                              \
+    hook = __sec->addr;                                                                   \
     nhooks = __sec->sec->sh_size / sizeof(*hook);                                         \
 } while (0)
 
@@ -650,7 +653,7 @@ static int prepare_payload(struct payload *payload,
         if ( !section_ok(elf, sec, sizeof(*payload->funcs)) )
             return -EINVAL;
 
-        payload->funcs = funcs = sec->load_addr;
+        payload->funcs = funcs = sec->addr;
         payload->nfuncs = sec->sec->sh_size / sizeof(*payload->funcs);
 
         payload->fstate = xzalloc_array(typeof(*payload->fstate),
@@ -709,7 +712,7 @@ static int prepare_payload(struct payload *payload,
     {
         const struct payload *data;
 
-        n = sec->load_addr;
+        n = sec->addr;
 
         if ( sec->sec->sh_size <= sizeof(*n) )
             return -EINVAL;
@@ -739,7 +742,7 @@ static int prepare_payload(struct payload *payload,
     sec = livepatch_elf_sec_by_name(elf, ELF_LIVEPATCH_DEPENDS);
     if ( sec )
     {
-        n = sec->load_addr;
+        n = sec->addr;
 
         if ( sec->sec->sh_size <= sizeof(*n) )
             return -EINVAL;
@@ -755,7 +758,7 @@ static int prepare_payload(struct payload *payload,
     sec = livepatch_elf_sec_by_name(elf, ELF_LIVEPATCH_XEN_DEPENDS);
     if ( sec )
     {
-        n = sec->load_addr;
+        n = sec->addr;
 
         if ( sec->sec->sh_size <= sizeof(*n) )
             return -EINVAL;
@@ -794,8 +797,8 @@ static int prepare_payload(struct payload *payload,
         if ( !section_ok(elf, sec, sizeof(*region->frame[i].start)) )
             return -EINVAL;
 
-        region->frame[i].start = sec->load_addr;
-        region->frame[i].stop  = sec->load_addr + sec->sec->sh_size;
+        region->frame[i].start = sec->addr;
+        region->frame[i].stop  = sec->addr + sec->sec->sh_size;
     }
 
     sec = livepatch_elf_sec_by_name(elf, ".altinstructions");
@@ -843,8 +846,8 @@ static int prepare_payload(struct payload *payload,
             return -EINVAL;
         }
 
-        start = sec->load_addr;
-        end = sec->load_addr + sec->sec->sh_size;
+        start = sec->addr;
+        end = sec->addr + sec->sec->sh_size;
 
         for ( a = start; a < end; a++ )
         {
@@ -867,14 +870,14 @@ static int prepare_payload(struct payload *payload,
              * repl must be fully within .altinstr_replacement, even if the
              * replacement and the section happen to both have zero length.
              */
-            if ( repl               < repl_sec->load_addr ||
+            if ( repl               < repl_sec->addr ||
                  a->repl_len        > repl_sec->sec->sh_size ||
-                 repl + a->repl_len > repl_sec->load_addr + repl_sec->sec->sh_size )
+                 repl + a->repl_len > repl_sec->addr + repl_sec->sec->sh_size )
             {
                 printk(XENLOG_ERR LIVEPATCH
                        "%s Alternative repl %p+%#x outside .altinstr_replacement %p+%#"PRIxElfWord"\n",
                        elf->name, repl, a->repl_len,
-                       repl_sec->load_addr, repl_sec->sec->sh_size);
+                       repl_sec->addr, repl_sec->sec->sh_size);
                 return -EINVAL;
             }
         }
@@ -896,8 +899,8 @@ static int prepare_payload(struct payload *payload,
         if ( !section_ok(elf, sec, sizeof(*region->ex)) )
             return -EINVAL;
 
-        s = sec->load_addr;
-        e = sec->load_addr + sec->sec->sh_size;
+        s = sec->addr;
+        e = sec->addr + sec->sec->sh_size;
 
         sort_exception_table(s ,e);
 
@@ -916,7 +919,7 @@ static int prepare_payload(struct payload *payload,
         if ( !section_ok(elf, sec, sizeof(*payload->metadata.data)) )
             return -EINVAL;
 
-        payload->metadata.data = sec->load_addr;
+        payload->metadata.data = sec->addr;
         payload->metadata.len = sec->sec->sh_size;
 
         /* The metadata is required to consists of null terminated strings. */
diff --git a/xen/common/livepatch_elf.c b/xen/common/livepatch_elf.c
index 45d73912a3..25ce1bd5a0 100644
--- a/xen/common/livepatch_elf.c
+++ b/xen/common/livepatch_elf.c
@@ -36,7 +36,7 @@ static int elf_verify_strtab(const struct livepatch_elf_sec *sec)
     if ( !s->sh_size )
         return -EINVAL;
 
-    contents = sec->data;
+    contents = sec->addr;
 
     if ( contents[0] || contents[s->sh_size - 1] )
         return -EINVAL;
@@ -44,7 +44,7 @@ static int elf_verify_strtab(const struct livepatch_elf_sec *sec)
     return 0;
 }
 
-static int elf_resolve_sections(struct livepatch_elf *elf, const void *data)
+static int elf_resolve_sections(struct livepatch_elf *elf, void *data)
 {
     struct livepatch_elf_sec *sec;
     unsigned int i;
@@ -104,7 +104,7 @@ static int elf_resolve_sections(struct livepatch_elf *elf, const void *data)
                   sec[i].sec->sh_size > LIVEPATCH_MAX_SIZE )
             return -EINVAL;
 
-        sec[i].data = data + delta;
+        sec[i].addr = data + delta;
         /* Name is populated in elf_resolve_section_names. */
         sec[i].name = NULL;
 
@@ -226,14 +226,14 @@ static int elf_get_sym(struct livepatch_elf *elf, const void *data)
     strtab_sec = elf->strtab;
 
     /* Pointers arithmetic to get file offset. */
-    offset = strtab_sec->data - data;
+    offset = strtab_sec->addr - data;
 
     /* Checked already in elf_resolve_sections, but just in case. */
     ASSERT(offset == strtab_sec->sec->sh_offset);
     ASSERT(offset < elf->len && (offset + strtab_sec->sec->sh_size <= elf->len));
 
-    /* symtab_sec->data was computed in elf_resolve_sections. */
-    ASSERT((symtab_sec->sec->sh_offset + data) == symtab_sec->data);
+    /* symtab_sec->addr was computed in elf_resolve_sections. */
+    ASSERT((symtab_sec->sec->sh_offset + data) == symtab_sec->addr);
 
     /* No need to check values as elf_resolve_sections did it. */
     nsym = symtab_sec->sec->sh_size / symtab_sec->sec->sh_entsize;
@@ -251,7 +251,7 @@ static int elf_get_sym(struct livepatch_elf *elf, const void *data)
 
     for ( i = 1; i < nsym; i++ )
     {
-        const Elf_Sym *s = symtab_sec->data + symtab_sec->sec->sh_entsize * i;
+        const Elf_Sym *s = symtab_sec->addr + symtab_sec->sec->sh_entsize * i;
 
         delta = s->st_name;
         /* Boundary check within the .strtab. */
@@ -263,7 +263,7 @@ static int elf_get_sym(struct livepatch_elf *elf, const void *data)
         }
 
         sym[i].sym = s;
-        sym[i].name = strtab_sec->data + delta;
+        sym[i].name = strtab_sec->addr + delta;
         if ( arch_livepatch_symbol_deny(elf, &sym[i]) )
         {
             printk(XENLOG_ERR LIVEPATCH "%s: Symbol '%s' should not be in payload\n",
@@ -342,7 +342,7 @@ int livepatch_elf_resolve_symbols(struct livepatch_elf *elf)
                 break;
             }
 
-            st_value += (unsigned long)elf->sec[idx].load_addr;
+            st_value += (unsigned long)elf->sec[idx].addr;
             if ( elf->sym[i].name )
                 dprintk(XENLOG_DEBUG, LIVEPATCH "%s: Symbol resolved: %s => %#"PRIxElfAddr" (%s)\n",
                        elf->name, elf->sym[i].name,
@@ -503,7 +503,7 @@ static int livepatch_header_check(const struct livepatch_elf *elf)
     return 0;
 }
 
-int livepatch_elf_load(struct livepatch_elf *elf, const void *data)
+int livepatch_elf_load(struct livepatch_elf *elf, void *data)
 {
     int rc;
 
diff --git a/xen/include/xen/livepatch_elf.h b/xen/include/xen/livepatch_elf.h
index 7116deaddc..842111e145 100644
--- a/xen/include/xen/livepatch_elf.h
+++ b/xen/include/xen/livepatch_elf.h
@@ -13,10 +13,11 @@ struct livepatch_elf_sec {
     const Elf_Shdr *sec;                 /* Hooked up in elf_resolve_sections.*/
     const char *name;                    /* Human readable name hooked in
                                             elf_resolve_section_names. */
-    const void *data;                    /* Pointer to the section (done by
-                                            elf_resolve_sections). */
-    void *load_addr;                     /* A pointer to the allocated destination.
-                                            Done by load_payload_data. */
+    void *addr;                          /*
+                                          * Pointer to the section.  This is
+                                          * first a temporary buffer, then
+                                          * later the relocated load address.
+                                          */
 };
 
 struct livepatch_elf_sym {
@@ -41,7 +42,7 @@ struct livepatch_elf {
 const struct livepatch_elf_sec *
 livepatch_elf_sec_by_name(const struct livepatch_elf *elf,
                           const char *name);
-int livepatch_elf_load(struct livepatch_elf *elf, const void *data);
+int livepatch_elf_load(struct livepatch_elf *elf, void *data);
 void livepatch_elf_free(struct livepatch_elf *elf);
 
 int livepatch_elf_resolve_symbols(struct livepatch_elf *elf);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 27 15:11:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Sep 2024 15:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.806373.1217709 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1suCcj-00043v-EW; Fri, 27 Sep 2024 15:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 806373.1217709; Fri, 27 Sep 2024 15:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1suCcj-00043o-Bx; Fri, 27 Sep 2024 15:11:13 +0000
Received: by outflank-mailman (input) for mailman id 806373;
 Fri, 27 Sep 2024 15:11:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1suCch-00043g-KX
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 15:11:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1suCch-0003K1-Jm
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 15:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1suCch-0002So-Ij
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 15:11:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aJX9qZMOzRpI9HK5VOc/dgjOIfPmQI/xvLet4dCp72A=; b=rqoAxNBwS2CMKsLiqse9NpIP2z
	KWWuDn4OxzAzcE6ebLQg5sStG1vDBuZlWw5bI+yofNPD+PFy/HFrACeSX7WQX8/Y0q3iQaZ52u5lI
	YHXMkrxCGZYaS2uzQr5/4RAq4eriU/T7BK8UR+whp3aNgfyx12kLI7xDw9mjUMnRTlsY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/livepatch: simplify and unify logic in prepare_payload()
Message-Id: <E1suCch-0002So-Ij@xenbits.xenproject.org>
Date: Fri, 27 Sep 2024 15:11:11 +0000

commit 86d09d16dd74298b19a03df492d9503f20cfc17c
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Sep 26 12:14:28 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Sep 26 14:18:03 2024 +0100

    xen/livepatch: simplify and unify logic in prepare_payload()
    
    The following sections: .note.gnu.build-id, .livepatch.xen_depends and
    .livepatch.depends are mandatory and ensured to be present by
    check_special_sections() before prepare_payload() is called.
    
    Simplify the logic in prepare_payload() by introducing a generic function to
    parse the sections that contain a buildid.  Note the function assumes the
    buildid related section to always be present.
    
    No functional change intended.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/livepatch.c | 110 ++++++++++++++++++++++---------------------------
 1 file changed, 50 insertions(+), 60 deletions(-)

diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
index 259b09f4a1..02f862cb76 100644
--- a/xen/common/livepatch.c
+++ b/xen/common/livepatch.c
@@ -470,6 +470,31 @@ static int xen_build_id_dep(const struct payload *payload)
     return 0;
 }
 
+/* Parses build-id sections into the given destination. */
+static int parse_buildid(const struct livepatch_elf_sec *sec,
+                         struct livepatch_build_id *id)
+{
+    const Elf_Note *n;
+    int rc;
+
+    /* Presence of the sections is ensured by check_special_sections(). */
+    ASSERT(sec);
+
+    n = sec->addr;
+
+    if ( sec->sec->sh_size <= sizeof(*n) )
+        return -EINVAL;
+
+    rc = xen_build_id_check(n, sec->sec->sh_size, &id->p, &id->len);
+    if ( rc )
+        return rc;
+
+    if ( !id->len || !id->p )
+        return -EINVAL;
+
+   return 0;
+}
+
 static int check_special_sections(const struct livepatch_elf *elf)
 {
     unsigned int i;
@@ -641,11 +666,12 @@ static int prepare_payload(struct payload *payload,
                            struct livepatch_elf *elf)
 {
     const struct livepatch_elf_sec *sec;
+    const struct payload *data;
     unsigned int i;
     struct livepatch_func *funcs;
     struct livepatch_func *f;
     struct virtual_region *region;
-    const Elf_Note *n;
+    int rc;
 
     sec = livepatch_elf_sec_by_name(elf, ELF_LIVEPATCH_FUNC);
     if ( sec )
@@ -663,8 +689,6 @@ static int prepare_payload(struct payload *payload,
 
         for ( i = 0; i < payload->nfuncs; i++ )
         {
-            int rc;
-
             f = &(funcs[i]);
 
             if ( f->version != LIVEPATCH_PAYLOAD_VERSION )
@@ -707,69 +731,35 @@ static int prepare_payload(struct payload *payload,
     LIVEPATCH_ASSIGN_SINGLE_HOOK(elf, payload->hooks.revert.action, ELF_LIVEPATCH_REVERT_HOOK);
     LIVEPATCH_ASSIGN_SINGLE_HOOK(elf, payload->hooks.revert.post, ELF_LIVEPATCH_POSTREVERT_HOOK);
 
-    sec = livepatch_elf_sec_by_name(elf, ELF_BUILD_ID_NOTE);
-    if ( sec )
-    {
-        const struct payload *data;
-
-        n = sec->addr;
-
-        if ( sec->sec->sh_size <= sizeof(*n) )
-            return -EINVAL;
-
-        if ( xen_build_id_check(n, sec->sec->sh_size,
-                                &payload->id.p, &payload->id.len) )
-            return -EINVAL;
-
-        if ( !payload->id.len || !payload->id.p )
-            return -EINVAL;
+    rc = parse_buildid(livepatch_elf_sec_by_name(elf, ELF_BUILD_ID_NOTE),
+                       &payload->id);
+    if ( rc )
+        return rc;
 
-        /* Make sure it is not a duplicate. */
-        list_for_each_entry ( data, &payload_list, list )
+    /* Make sure it is not a duplicate. */
+    list_for_each_entry ( data, &payload_list, list )
+    {
+        /* No way _this_ payload is on the list. */
+        ASSERT(data != payload);
+        if ( data->id.len == payload->id.len &&
+             !memcmp(data->id.p, payload->id.p, data->id.len) )
         {
-            /* No way _this_ payload is on the list. */
-            ASSERT(data != payload);
-            if ( data->id.len == payload->id.len &&
-                 !memcmp(data->id.p, payload->id.p, data->id.len) )
-            {
-                dprintk(XENLOG_DEBUG, LIVEPATCH "%s: Already loaded as %s!\n",
-                        elf->name, data->name);
-                return -EEXIST;
-            }
+            dprintk(XENLOG_DEBUG, LIVEPATCH "%s: Already loaded as %s!\n",
+                    elf->name, data->name);
+            return -EEXIST;
         }
     }
 
-    sec = livepatch_elf_sec_by_name(elf, ELF_LIVEPATCH_DEPENDS);
-    if ( sec )
-    {
-        n = sec->addr;
-
-        if ( sec->sec->sh_size <= sizeof(*n) )
-            return -EINVAL;
-
-        if ( xen_build_id_check(n, sec->sec->sh_size,
-                                &payload->dep.p, &payload->dep.len) )
-            return -EINVAL;
-
-        if ( !payload->dep.len || !payload->dep.p )
-            return -EINVAL;
-    }
-
-    sec = livepatch_elf_sec_by_name(elf, ELF_LIVEPATCH_XEN_DEPENDS);
-    if ( sec )
-    {
-        n = sec->addr;
-
-        if ( sec->sec->sh_size <= sizeof(*n) )
-            return -EINVAL;
-
-        if ( xen_build_id_check(n, sec->sec->sh_size,
-                                &payload->xen_dep.p, &payload->xen_dep.len) )
-            return -EINVAL;
+    rc = parse_buildid(livepatch_elf_sec_by_name(elf, ELF_LIVEPATCH_DEPENDS),
+                       &payload->dep);
+    if ( rc )
+        return rc;
 
-        if ( !payload->xen_dep.len || !payload->xen_dep.p )
-            return -EINVAL;
-    }
+    rc = parse_buildid(livepatch_elf_sec_by_name(elf,
+                                                 ELF_LIVEPATCH_XEN_DEPENDS),
+                       &payload->xen_dep);
+    if ( rc )
+        return rc;
 
     /* Setup the virtual region with proper data. */
     region = &payload->region;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 27 15:11:22 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Sep 2024 15:11:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.806374.1217713 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1suCcs-00046F-GK; Fri, 27 Sep 2024 15:11:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 806374.1217713; Fri, 27 Sep 2024 15:11:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1suCcs-000466-DU; Fri, 27 Sep 2024 15:11:22 +0000
Received: by outflank-mailman (input) for mailman id 806374;
 Fri, 27 Sep 2024 15:11:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1suCcr-000460-NZ
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 15:11:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1suCcr-0003KU-Mn
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 15:11:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1suCcr-0002Td-Ls
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 15:11:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=C3xfySx5aHBOfl5PLuEnY0qAR4i3PwNPz1bvgQK93Qw=; b=xiO0JB1T0yLwboF2hj+cLx88Aa
	HGXUEBpBcHVQ27mOJ4upD5X5cbsp1EZAVKagoQZborsgS2VBLyIle5TD6cETe5f+RT5ofJwayrFk4
	gQNPjRmzwqR1EqQFog+q7xfKGn9y452yfKUEkOva1e+sScjJNjJaG4FQw60CVallCOyk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/livepatch: do Xen build-id check earlier
Message-Id: <E1suCcr-0002Td-Ls@xenbits.xenproject.org>
Date: Fri, 27 Sep 2024 15:11:21 +0000

commit fa49f4be413cdabde5b2264fc85d2710b15ea691
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Sep 26 12:14:29 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Sep 26 14:18:03 2024 +0100

    xen/livepatch: do Xen build-id check earlier
    
    The check against the expected Xen build ID should be done ahead of attempting
    to apply the alternatives contained in the livepatch.
    
    If the CPUID in the alternatives patching data is out of the scope of the
    running Xen featureset the BUG() in _apply_alternatives() will trigger thus
    bringing the system down.  Note the layout of struct alt_instr could also
    change between versions.  It's also possible for struct exception_table_entry
    to have changed format, hence leading to other kind of errors if parsing of the
    payload is done ahead of checking if the Xen build-id matches.
    
    Move the Xen build ID check as early as possible.  To do so introduce a new
    check_xen_buildid() function that parses and checks the Xen build-id before
    moving the payload.  Since the expected Xen build-id is used early to
    detect whether the livepatch payload could be loaded, there's no reason to
    store it in the payload struct, as a non-matching Xen build-id won't get the
    payload populated in the first place.
    
    Note printing the expected Xen build ID has part of dumping the payload
    information is no longer done: all loaded payloads would have Xen build IDs
    matching the running Xen, otherwise they would have failed to load.
    
    Fixes: 879615f5db1d ('livepatch: Always check hypervisor build ID upon livepatch upload')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/livepatch.c              | 86 +++++++++++++++++++++----------------
 xen/include/xen/livepatch_payload.h |  1 -
 2 files changed, 50 insertions(+), 37 deletions(-)

diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
index 02f862cb76..952a3b1af7 100644
--- a/xen/common/livepatch.c
+++ b/xen/common/livepatch.c
@@ -448,28 +448,6 @@ static bool section_ok(const struct livepatch_elf *elf,
     return true;
 }
 
-static int xen_build_id_dep(const struct payload *payload)
-{
-    const void *id = NULL;
-    unsigned int len = 0;
-    int rc;
-
-    ASSERT(payload->xen_dep.len);
-    ASSERT(payload->xen_dep.p);
-
-    rc = xen_build_id(&id, &len);
-    if ( rc )
-        return rc;
-
-    if ( payload->xen_dep.len != len || memcmp(id, payload->xen_dep.p, len) ) {
-        printk(XENLOG_ERR LIVEPATCH "%s: check against hypervisor build-id failed\n",
-               payload->name);
-        return -EINVAL;
-    }
-
-    return 0;
-}
-
 /* Parses build-id sections into the given destination. */
 static int parse_buildid(const struct livepatch_elf_sec *sec,
                          struct livepatch_build_id *id)
@@ -495,11 +473,56 @@ static int parse_buildid(const struct livepatch_elf_sec *sec,
    return 0;
 }
 
+static int check_xen_buildid(const struct livepatch_elf *elf)
+{
+    const void *id;
+    unsigned int len;
+    struct livepatch_build_id lp_id;
+    const struct livepatch_elf_sec *sec =
+        livepatch_elf_sec_by_name(elf, ELF_LIVEPATCH_XEN_DEPENDS);
+    int rc;
+
+    if ( !sec )
+    {
+        printk(XENLOG_ERR LIVEPATCH "%s: section %s is missing\n",
+               elf->name, ELF_LIVEPATCH_XEN_DEPENDS);
+        return -EINVAL;
+    }
+
+    rc = parse_buildid(sec, &lp_id);
+    if ( rc )
+    {
+        printk(XENLOG_ERR LIVEPATCH
+               "%s: failed to parse section %s as build-id: %d\n",
+               elf->name, ELF_LIVEPATCH_XEN_DEPENDS, rc);
+        return -EINVAL;
+    }
+
+    rc = xen_build_id(&id, &len);
+    if ( rc )
+    {
+        printk(XENLOG_ERR LIVEPATCH
+               "%s: unable to get running Xen build-id: %d\n",
+               elf->name, rc);
+        return rc;
+    }
+
+    if ( lp_id.len != len || memcmp(id, lp_id.p, len) )
+    {
+        printk(XENLOG_ERR LIVEPATCH "%s: build-id mismatch:\n"
+                                    "  livepatch: %*phN\n"
+                                    "        xen: %*phN\n",
+               elf->name, lp_id.len, lp_id.p, len, id);
+        return -EINVAL;
+    }
+
+    return 0;
+}
+
 static int check_special_sections(const struct livepatch_elf *elf)
 {
     unsigned int i;
     static const char *const names[] = { ELF_LIVEPATCH_DEPENDS,
-                                         ELF_LIVEPATCH_XEN_DEPENDS,
                                          ELF_BUILD_ID_NOTE};
 
     for ( i = 0; i < ARRAY_SIZE(names); i++ )
@@ -755,12 +778,6 @@ static int prepare_payload(struct payload *payload,
     if ( rc )
         return rc;
 
-    rc = parse_buildid(livepatch_elf_sec_by_name(elf,
-                                                 ELF_LIVEPATCH_XEN_DEPENDS),
-                       &payload->xen_dep);
-    if ( rc )
-        return rc;
-
     /* Setup the virtual region with proper data. */
     region = &payload->region;
 
@@ -1069,6 +1086,10 @@ static int load_payload_data(struct payload *payload, void *raw, size_t len)
     if ( rc )
         goto out;
 
+    rc = check_xen_buildid(&elf);
+    if ( rc )
+       goto out;
+
     rc = move_payload(payload, &elf);
     if ( rc )
         goto out;
@@ -1093,10 +1114,6 @@ static int load_payload_data(struct payload *payload, void *raw, size_t len)
     if ( rc )
         goto out;
 
-    rc = xen_build_id_dep(payload);
-    if ( rc )
-        goto out;
-
     rc = build_symbol_table(payload, &elf);
     if ( rc )
         goto out;
@@ -2199,9 +2216,6 @@ static void cf_check livepatch_printall(unsigned char key)
 
         if ( data->dep.len )
             printk("depend-on=%*phN\n", data->dep.len, data->dep.p);
-
-        if ( data->xen_dep.len )
-            printk("depend-on-xen=%*phN\n", data->xen_dep.len, data->xen_dep.p);
     }
 
     spin_unlock(&payload_lock);
diff --git a/xen/include/xen/livepatch_payload.h b/xen/include/xen/livepatch_payload.h
index 472d6a4a63..c6dc7cb5fa 100644
--- a/xen/include/xen/livepatch_payload.h
+++ b/xen/include/xen/livepatch_payload.h
@@ -62,7 +62,6 @@ struct payload {
     unsigned int nsyms;                  /* Nr of entries in .strtab and symbols. */
     struct livepatch_build_id id;        /* ELFNOTE_DESC(.note.gnu.build-id) of the payload. */
     struct livepatch_build_id dep;       /* ELFNOTE_DESC(.livepatch.depends). */
-    struct livepatch_build_id xen_dep;   /* ELFNOTE_DESC(.livepatch.xen_depends). */
     livepatch_loadcall_t *const *load_funcs;   /* The array of funcs to call after */
     livepatch_unloadcall_t *const *unload_funcs;/* load and unload of the payload. */
     struct livepatch_hooks hooks;        /* Pre and post hooks for apply and revert */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 27 15:11:32 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Sep 2024 15:11:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.806375.1217717 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1suCd2-00049F-Iy; Fri, 27 Sep 2024 15:11:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 806375.1217717; Fri, 27 Sep 2024 15:11:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1suCd2-000497-G9; Fri, 27 Sep 2024 15:11:32 +0000
Received: by outflank-mailman (input) for mailman id 806375;
 Fri, 27 Sep 2024 15:11:31 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1suCd1-000491-Qx
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 15:11:31 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1suCd1-0003Kb-QA
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 15:11:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1suCd1-0002Ub-P5
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 15:11:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=o6YyqyWCjOW+ECmHHiB39++s51qC5Am+LEn8W5NgVmo=; b=2poC4As5WvkutpQFHySN23PHrp
	9/SHLqezjDXXujd+kYUOsaKHTg/WUJ4Rn0BzGkKGSxMTGNdIC4FO9zkcxDJM6+YxNVm/chZ/FWfy3
	lOHEdrRwKkk9EdbtaKQ0UqYeBk4GVeVanWrSXcynGMOYjJgRJisj9uVLWE4KnTkt2f9c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/alternatives: do not BUG during apply
Message-Id: <E1suCd1-0002Ub-P5@xenbits.xenproject.org>
Date: Fri, 27 Sep 2024 15:11:31 +0000

commit aa5a06d5d6eda291afa3849ab143ffcd69b0d4e6
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Sep 26 12:14:30 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Sep 26 14:18:03 2024 +0100

    x86/alternatives: do not BUG during apply
    
    alternatives is used both at boot time, and when loading livepatch payloads.
    While for the former it makes sense to panic, it's not useful for the later, as
    for livepatches it's possible to fail to load the livepatch if alternatives
    cannot be resolved and continue operating normally.
    
    Relax the BUGs in _apply_alternatives() to instead return an error code.  The
    caller will figure out whether the failures are fatal and panic.
    
    Print an error message to provide some user-readable information about what
    went wrong.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/alternative.c             | 46 ++++++++++++++++++++++++++--------
 xen/arch/x86/include/asm/alternative.h |  2 +-
 xen/common/livepatch.c                 | 10 +++++++-
 3 files changed, 46 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/alternative.c b/xen/arch/x86/alternative.c
index 7824053c9d..1ba35cb9ed 100644
--- a/xen/arch/x86/alternative.c
+++ b/xen/arch/x86/alternative.c
@@ -175,9 +175,9 @@ extern void *const __initdata_cf_clobber_end[];
  * invocation, such that no CALLs/JMPs to NULL pointers will be left
  * around. See also the further comment below.
  */
-static void init_or_livepatch _apply_alternatives(struct alt_instr *start,
-                                                  struct alt_instr *end,
-                                                  bool force)
+static int init_or_livepatch _apply_alternatives(struct alt_instr *start,
+                                                 struct alt_instr *end,
+                                                 bool force)
 {
     struct alt_instr *a, *base;
 
@@ -198,9 +198,29 @@ static void init_or_livepatch _apply_alternatives(struct alt_instr *start,
         uint8_t buf[MAX_PATCH_LEN];
         unsigned int total_len = a->orig_len + a->pad_len;
 
-        BUG_ON(a->repl_len > total_len);
-        BUG_ON(total_len > sizeof(buf));
-        BUG_ON(a->cpuid >= NCAPINTS * 32);
+        if ( a->repl_len > total_len )
+        {
+            printk(XENLOG_ERR
+                   "Alt for %ps, replacement size %#x larger than origin %#x\n",
+                    ALT_ORIG_PTR(a), a->repl_len, total_len);
+            return -ENOSPC;
+        }
+
+        if ( total_len > sizeof(buf) )
+        {
+            printk(XENLOG_ERR
+                   "Alt for %ps, origin size %#x bigger than buffer %#zx\n",
+                   ALT_ORIG_PTR(a), total_len, sizeof(buf));
+            return -ENOSPC;
+        }
+
+        if ( a->cpuid >= NCAPINTS * 32 )
+        {
+             printk(XENLOG_ERR
+                   "Alt for %ps, feature %#x outside of featureset range %#x\n",
+                   ALT_ORIG_PTR(a), a->cpuid, NCAPINTS * 32);
+            return -ERANGE;
+        }
 
         /*
          * Detect sequences of alt_instr's patching the same origin site, and
@@ -356,12 +376,14 @@ static void init_or_livepatch _apply_alternatives(struct alt_instr *start,
 
         printk("altcall: Optimised away %u endbr64 instructions\n", clobbered);
     }
+
+    return 0;
 }
 
 #ifdef CONFIG_LIVEPATCH
-void apply_alternatives(struct alt_instr *start, struct alt_instr *end)
+int apply_alternatives(struct alt_instr *start, struct alt_instr *end)
 {
-    _apply_alternatives(start, end, true);
+    return _apply_alternatives(start, end, true);
 }
 #endif
 
@@ -383,6 +405,8 @@ static int __init cf_check nmi_apply_alternatives(
      */
     if ( !(alt_done & alt_todo) )
     {
+        int rc;
+
         /*
          * Relax perms on .text to be RWX, so we can modify them.
          *
@@ -394,8 +418,10 @@ static int __init cf_check nmi_apply_alternatives(
                                  PAGE_HYPERVISOR_RWX);
         flush_local(FLUSH_TLB_GLOBAL);
 
-        _apply_alternatives(__alt_instructions, __alt_instructions_end,
-                            alt_done);
+        rc = _apply_alternatives(__alt_instructions, __alt_instructions_end,
+                                 alt_done);
+        if ( rc )
+            panic("Unable to apply alternatives: %d\n", rc);
 
         /*
          * Reinstate perms on .text to be RX.  This also cleans out the dirty
diff --git a/xen/arch/x86/include/asm/alternative.h b/xen/arch/x86/include/asm/alternative.h
index a86eadfaec..69555d781e 100644
--- a/xen/arch/x86/include/asm/alternative.h
+++ b/xen/arch/x86/include/asm/alternative.h
@@ -24,7 +24,7 @@ struct __packed alt_instr {
 
 extern void add_nops(void *insns, unsigned int len);
 /* Similar to alternative_instructions except it can be run with IRQs enabled. */
-extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end);
+extern int apply_alternatives(struct alt_instr *start, struct alt_instr *end);
 extern void alternative_instructions(void);
 extern void alternative_branches(void);
 
diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
index 952a3b1af7..6ce77bf021 100644
--- a/xen/common/livepatch.c
+++ b/xen/common/livepatch.c
@@ -888,7 +888,15 @@ static int prepare_payload(struct payload *payload,
                 return -EINVAL;
             }
         }
-        apply_alternatives(start, end);
+
+        rc = apply_alternatives(start, end);
+        if ( rc )
+        {
+            printk(XENLOG_ERR LIVEPATCH "%s applying alternatives failed: %d\n",
+                   elf->name, rc);
+            return rc;
+        }
+
     alt_done:;
 #else
         printk(XENLOG_ERR LIVEPATCH "%s: We don't support alternative patching\n",
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 27 15:11:42 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Sep 2024 15:11:42 +0000
Received: from list by lists.xenproject.org with outflank-mailman.806376.1217720 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1suCdC-0004CT-K3; Fri, 27 Sep 2024 15:11:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 806376.1217720; Fri, 27 Sep 2024 15:11:42 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1suCdC-0004CL-HW; Fri, 27 Sep 2024 15:11:42 +0000
Received: by outflank-mailman (input) for mailman id 806376;
 Fri, 27 Sep 2024 15:11:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1suCdB-0004C9-Vc
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 15:11:41 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1suCdB-0003Ki-U9
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 15:11:41 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1suCdB-0002X6-SL
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 15:11:41 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PhqasY1RzhjZy1BX6kjQpr4CjDWCX7ollGKL+tFqC30=; b=JMHDEg4NUL81l/jn/yFjeKIaMM
	T7SCxU/EX0bjtEwx7bT5e/W6/Ft30q1I55XCNNMAqqfk/ZfmiK4t1QHJyKa8UzOQ5RvjoasdVdETX
	SU3ANyOmX8ZiwSUGGaj4idleviKqBn0gH5wj9iHIDCe8KLA5hZ76t4pWXYIsXLS/gwQo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/alternatives: build time check feature is in range
Message-Id: <E1suCdB-0002X6-SL@xenbits.xenproject.org>
Date: Fri, 27 Sep 2024 15:11:41 +0000

commit a184ac74f5e0c96fdea7a6f1f66d34133e1c337a
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Sep 26 12:14:31 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Sep 26 14:18:03 2024 +0100

    x86/alternatives: build time check feature is in range
    
    Ensure at build time the feature(s) used for the alternative blocks are in
    range of the featureset.
    
    No functional change intended, as all current usages are correct.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/alternative-asm.h | 3 +++
 xen/arch/x86/include/asm/alternative.h     | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/xen/arch/x86/include/asm/alternative-asm.h b/xen/arch/x86/include/asm/alternative-asm.h
index 4092f5ba70..83e8594f0e 100644
--- a/xen/arch/x86/include/asm/alternative-asm.h
+++ b/xen/arch/x86/include/asm/alternative-asm.h
@@ -12,6 +12,9 @@
  * instruction. See apply_alternatives().
  */
 .macro altinstruction_entry orig, repl, feature, orig_len, repl_len, pad_len
+    .if \feature >= NCAPINTS * 32
+        .error "alternative feature outside of featureset range"
+    .endif
     .long \orig - .
     .long \repl - .
     .word \feature
diff --git a/xen/arch/x86/include/asm/alternative.h b/xen/arch/x86/include/asm/alternative.h
index 69555d781e..38472fb58e 100644
--- a/xen/arch/x86/include/asm/alternative.h
+++ b/xen/arch/x86/include/asm/alternative.h
@@ -7,6 +7,7 @@
 #include <xen/lib.h>
 #include <xen/stringify.h>
 #include <asm/asm-macros.h>
+#include <asm/cpufeatureset.h>
 
 struct __packed alt_instr {
     int32_t  orig_offset;   /* original instruction */
@@ -59,6 +60,9 @@ extern void alternative_branches(void);
                     alt_repl_len(n2)) "-" alt_orig_len)
 
 #define ALTINSTR_ENTRY(feature, num)                                    \
+        " .if " STR(feature) " >= " STR(NCAPINTS * 32) "\n"             \
+        " .error \"alternative feature outside of featureset range\"\n" \
+        " .endif\n"                                                     \
         " .long .LXEN%=_orig_s - .\n"             /* label           */ \
         " .long " alt_repl_s(num)" - .\n"         /* new instruction */ \
         " .word " __stringify(feature) "\n"       /* feature bit     */ \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 27 15:11:52 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Sep 2024 15:11:52 +0000
Received: from list by lists.xenproject.org with outflank-mailman.806377.1217725 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1suCdM-0004F7-Le; Fri, 27 Sep 2024 15:11:52 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 806377.1217725; Fri, 27 Sep 2024 15:11:52 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1suCdM-0004Ez-Iu; Fri, 27 Sep 2024 15:11:52 +0000
Received: by outflank-mailman (input) for mailman id 806377;
 Fri, 27 Sep 2024 15:11:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1suCdM-0004Er-1a
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 15:11:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1suCdM-0003Kq-0r
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 15:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1suCdL-0002Yd-WE
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 15:11:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rv58NY8ONFoLxzWEigr79WXd/KEqXFKnElsHKTQXwRw=; b=DH4v8nCvvrF4knfyfi0Z6yz634
	14DrnXZFMjrD77YUQsbwh5N0/7FiDmm2pk/qQqZQS69Ja9TM33bQIIHb73CE/oeOesnF4GWcYCB2m
	P+m+WmiR06QVRgamARbKU1QfsPezRIVIWP1VMcaox99HKmFMWpeIfXEbK3Ocrj0oXhCE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Refactor BIOS/PVH start
Message-Id: <E1suCdL-0002Yd-WE@xenbits.xenproject.org>
Date: Fri, 27 Sep 2024 15:11:51 +0000

commit 0857c75e6f96c48f2c8d8b6c9bf9dfcbe0267fc3
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Thu Sep 26 10:21:07 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Sep 26 14:18:03 2024 +0100

    x86/boot: Refactor BIOS/PVH start
    
    The 2 code paths were sharing quite some common code, reuse it instead
    of having duplications.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/boot/head.S | 104 +++++++++++++++++------------------------------
 1 file changed, 37 insertions(+), 67 deletions(-)

diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index 267207e5a2..e0901ee400 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -25,6 +25,8 @@
 #define MB2_HT(name)      (MULTIBOOT2_HEADER_TAG_##name)
 #define MB2_TT(name)      (MULTIBOOT2_TAG_TYPE_##name)
 
+#define XEN_HVM_START_MAGIC_VALUE 0x336ec578
+
         .macro mb2ht_args arg:req, args:vararg
         .long \arg
         .ifnb \args
@@ -409,13 +411,27 @@ cs32_switch:
 ELFNOTE(Xen, XEN_ELFNOTE_PHYS32_ENTRY, .long sym_offs(__pvh_start))
 
 __pvh_start:
-        cld
+        mov     $XEN_HVM_START_MAGIC_VALUE, %eax
+        /*
+         * Fall through into BIOS code.
+         * We will use %eax to distinguish we came from PVH entry point.
+         */
+#endif /* CONFIG_PVH_GUEST */
+
+__start:
         cli
+        cld
 
         /*
-         * We need one call (i.e. push) to determine the load address.  See
-         * __start for a discussion on how to do this safely using the PVH
-         * info structure.
+         * Multiboot (both 1 and 2) and PVH specify the stack pointer as
+         * undefined.  This is unhelpful for relocatable images, where one
+         * call (i.e. push) is required to calculate the image's load address.
+         *
+         * During BIOS boot, there is one area of memory we know about with
+         * reasonable confidence that it isn't overlapped by Xen, and that's
+         * the Multiboot info structure in %ebx.  Use it as a temporary stack.
+         *
+         * During PVH boot use info structure in %ebx.
          */
 
         /* Preserve the field we're about to clobber. */
@@ -433,14 +449,7 @@ __pvh_start:
         /* Set up stack. */
         lea     STACK_SIZE - CPUINFO_sizeof + sym_esi(cpu0_stack), %esp
 
-        call    .Linitialise_bss
-
-        mov     %ebx, sym_esi(pvh_start_info_pa)
-
-        /* Force xen console.  Will revert to user choice in init code. */
-        movb    $-1, sym_esi(opt_console_xen)
-
-        /* Prepare gdt and segments */
+        /* Initialize GDTR and basic data segments. */
         add     %esi, sym_esi(gdt_boot_base)
         lgdt    sym_esi(gdt_boot_descr)
 
@@ -448,19 +457,9 @@ __pvh_start:
         mov     %ecx, %ds
         mov     %ecx, %es
         mov     %ecx, %ss
+        mov     %ecx, %fs
+        mov     %ecx, %gs
 
-        /* Skip bootloader setup and bios setup, go straight to trampoline */
-        movb    $1, sym_esi(pvh_boot)
-        movb    $1, sym_esi(skip_realmode)
-
-        /* Set trampoline_phys to use mfn 1 to avoid having a mapping at VA 0 */
-        movw    $0x1000, sym_esi(trampoline_phys)
-        mov     (%ebx), %eax /* mov $XEN_HVM_START_MAGIC_VALUE, %eax */
-        jmp     trampoline_setup
-
-#endif /* CONFIG_PVH_GUEST */
-
-.Linitialise_bss:
         /* Initialise the BSS.  Preserve %eax (BOOTLOADER_MAGIC). */
         mov     %eax, %ebp
 
@@ -472,39 +471,25 @@ __pvh_start:
         rep stosl
 
         mov     %ebp, %eax
-        ret
-
-__start:
-        cld
-        cli
-
-        /*
-         * Multiboot (both 1 and 2) specify the stack pointer as undefined
-         * when entering in BIOS circumstances.  This is unhelpful for
-         * relocatable images, where one call (i.e. push) is required to
-         * calculate the image's load address.
-         *
-         * This early in boot, there is one area of memory we know about with
-         * reasonable confidence that it isn't overlapped by Xen, and that's
-         * the Multiboot info structure in %ebx.  Use it as a temporary stack.
-         */
 
-        /* Preserve the field we're about to clobber. */
-        mov     (%ebx), %edx
-        lea     4(%ebx), %esp
+#ifdef CONFIG_PVH_GUEST
+        cmp     $XEN_HVM_START_MAGIC_VALUE, %eax
+        jne     1f
 
-        /* Calculate the load base address. */
-        call    1f
-1:      pop     %esi
-        sub     $sym_offs(1b), %esi
+        mov     %ebx, sym_esi(pvh_start_info_pa)
 
-        /* Restore the clobbered field. */
-        mov     %edx, (%ebx)
+        /* Force xen console.  Will revert to user choice in init code. */
+        movb    $-1, sym_esi(opt_console_xen)
 
-        /* Set up stack. */
-        lea     STACK_SIZE - CPUINFO_sizeof + sym_esi(cpu0_stack), %esp
+        /* Skip bootloader setup and bios setup, go straight to trampoline */
+        movb    $1, sym_esi(pvh_boot)
+        movb    $1, sym_esi(skip_realmode)
 
-        call    .Linitialise_bss
+        /* Set trampoline_phys to use mfn 1 to avoid having a mapping at VA 0 */
+        movl    $PAGE_SIZE, sym_esi(trampoline_phys)
+        jmp     trampoline_setup
+1:
+#endif /* CONFIG_PVH_GUEST */
 
         /* Bootloaders may set multiboot{1,2}.mem_lower to a nonzero value. */
         xor     %edx,%edx
@@ -563,22 +548,7 @@ __start:
 trampoline_bios_setup:
         /*
          * Called on legacy BIOS platforms only.
-         *
-         * Initialize GDTR and basic data segments.
          */
-        add     %esi,sym_esi(gdt_boot_base)
-        lgdt    sym_esi(gdt_boot_descr)
-
-        mov     $BOOT_DS,%ecx
-        mov     %ecx,%ds
-        mov     %ecx,%es
-        mov     %ecx,%ss
-        /* %esp is initialized later. */
-
-        /* Load null descriptor to unused segment registers. */
-        xor     %ecx,%ecx
-        mov     %ecx,%fs
-        mov     %ecx,%gs
 
         /* Set up trampoline segment 64k below EBDA */
         movzwl  0x40e,%ecx          /* EBDA segment */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 27 15:12:02 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Sep 2024 15:12:02 +0000
Received: from list by lists.xenproject.org with outflank-mailman.806378.1217729 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1suCdW-0004He-NI; Fri, 27 Sep 2024 15:12:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 806378.1217729; Fri, 27 Sep 2024 15:12:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1suCdW-0004HW-KL; Fri, 27 Sep 2024 15:12:02 +0000
Received: by outflank-mailman (input) for mailman id 806378;
 Fri, 27 Sep 2024 15:12:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1suCdW-0004HQ-4P
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 15:12:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1suCdW-0003LA-3h
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 15:12:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1suCdW-0002ZZ-2o
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 15:12:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fL6OiXpuQphBdWni9265GGIUUe3hlhGApOwQCm8EDag=; b=jCx/MOLKDHsIqwzs8ae0AN3L5B
	PfDnyePtpUyiK5oTqBMUGOLwbXycih8GSJescN9UU11bjNmhe9AngRJhknhK4o5lwd7xO5Dx55Yot
	KU4KiS/D2yfpxl5zL+lb3FuM3OC5UwdXujyQ0XlqEfdtbcH92xDCvFuGMt2FVabckgPk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] blkif: Fix alignment description for discard request
Message-Id: <E1suCdW-0002ZZ-2o@xenbits.xenproject.org>
Date: Fri, 27 Sep 2024 15:12:02 +0000

commit e9a0101dde5f56e3dc72799798a82913546545c2
Author:     Anthony PERARD <anthony.perard@vates.tech>
AuthorDate: Thu Sep 26 12:53:50 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Sep 26 14:18:03 2024 +0100

    blkif: Fix alignment description for discard request
    
    The discard feature have an other xenstore node to described the size
    of the blocks than can be discarded, "discard-granularity", which
    default to "sector-size" when absent as noted in the properties and in
    note 4. So discard request should be aligned on this value.
    
    Fixes: 221f2748e8da ("blkif: reconcile protocol specification with in-use implementations")
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/include/public/io/blkif.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/public/io/blkif.h b/xen/include/public/io/blkif.h
index 9b00d633d3..789bab65ab 100644
--- a/xen/include/public/io/blkif.h
+++ b/xen/include/public/io/blkif.h
@@ -668,7 +668,7 @@ typedef struct blkif_request blkif_request_t;
  *
  * The 'sector_number' field is in units of 512b, despite the value of the
  * 'sector-size' xenstore node.  Note however that the offset in
- * 'sector_number' must be aligned to 'sector-size'.
+ * 'sector_number' must be aligned to 'discard-granularity'.
  */
 struct blkif_request_discard {
     uint8_t        operation;    /* BLKIF_OP_DISCARD                     */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Sep 27 15:12:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 27 Sep 2024 15:12:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.806379.1217732 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1suCdg-0004Kb-OF; Fri, 27 Sep 2024 15:12:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 806379.1217732; Fri, 27 Sep 2024 15:12:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1suCdg-0004KU-Lk; Fri, 27 Sep 2024 15:12:12 +0000
Received: by outflank-mailman (input) for mailman id 806379;
 Fri, 27 Sep 2024 15:12:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1suCdg-0004KL-7I
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 15:12:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1suCdg-0003LL-6c
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 15:12:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1suCdg-0002ac-5m
 for xen-changelog@lists.xenproject.org; Fri, 27 Sep 2024 15:12:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NTqf8owarF/QwgUtGTt0glfPagjrGcIt71lFn1nrbps=; b=NP8vztaltLrWe0OWuAQU9mdyfP
	N0YofIRxlmlU2LRr6pVVnHWShntC5TXm+bn6Jvy2FqVAq0dw9Nca9JxJoPIBpWlg7sEc8zVItpObx
	pQEYw4jMX6qFnjJ1fV6RvydsOYGSkIzgRNYVRSg+3nET7M0ROsTC4giOolrmyTQsUy4c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] blkif: Fix a couple of typos
Message-Id: <E1suCdg-0002ac-5m@xenbits.xenproject.org>
Date: Fri, 27 Sep 2024 15:12:12 +0000

commit 457052167b4dbcda59e06300039302479cc1debf
Author:     Anthony PERARD <anthony.perard@vates.tech>
AuthorDate: Thu Sep 26 12:53:50 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Sep 26 14:18:03 2024 +0100

    blkif: Fix a couple of typos
    
    Those where fixed in OVMF's copy. (And one of them fixed in QEMU's
    copy but later discarded by an update.)
    
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Reviewed-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/include/public/io/blkif.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/include/public/io/blkif.h b/xen/include/public/io/blkif.h
index 789bab65ab..8407453324 100644
--- a/xen/include/public/io/blkif.h
+++ b/xen/include/public/io/blkif.h
@@ -42,7 +42,7 @@
  * All data in the XenStore is stored as strings.  Nodes specifying numeric
  * values are encoded in decimal.  Integer value ranges listed below are
  * expressed as fixed sized integer types capable of storing the conversion
- * of a properly formated node string, without loss of information.
+ * of a properly formatted node string, without loss of information.
  *
  * Any specified default value is in effect if the corresponding XenBus node
  * is not present in the XenStore.
@@ -328,7 +328,7 @@
  *      access (even when it should be read-only). If the frontend hits the
  *      maximum number of allowed persistently mapped grants, it can fallback
  *      to non persistent mode. This will cause a performance degradation,
- *      since the the backend driver will still try to map those grants
+ *      since the backend driver will still try to map those grants
  *      persistently. Since the persistent grants protocol is compatible with
  *      the previous protocol, a frontend driver can choose to work in
  *      persistent mode even when the backend doesn't support it.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Sep 30 08:22:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Sep 2024 08:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.807101.1218323 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svBfR-00025B-3z; Mon, 30 Sep 2024 08:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 807101.1218323; Mon, 30 Sep 2024 08:22:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svBfR-000253-1S; Mon, 30 Sep 2024 08:22:05 +0000
Received: by outflank-mailman (input) for mailman id 807101;
 Mon, 30 Sep 2024 08:22:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBfP-00024q-Qh
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:22:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBfP-0007Tg-ME
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:22:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBfP-0001Ba-Kn
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:22:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FyzlIWID5ErCTh6oZZmszBi89JHqr25nyF5mV3gVcxo=; b=usCe549M9XkZ5cLsZG4L4LHSbU
	cLtkqsL4jvvNNA+Iiuukd3/+0dZzjA9A2BSLnuCbQRslU17zuoEfSX819ZQQplvXgnZvRCqBiAAxC
	pbbfalNp6G1VL6kkN7WwPERPpxVx2nF5g8uJkUtFOTMeRu98zfDhFp7850UGVmOyDZJU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: introduce x86_seg_sys
Message-Id: <E1svBfP-0001Ba-Kn@xenbits.xenproject.org>
Date: Mon, 30 Sep 2024 08:22:03 +0000

commit 34d4227e6a018aa19cc2996564ea6bd34f18ae9a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Sep 30 10:05:25 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 30 10:05:25 2024 +0200

    x86: introduce x86_seg_sys
    
    To represent the USER-MSR bitmap access, a new segment type needs
    introducing, behaving like x86_seg_none in terms of address treatment,
    but behaving like a system segment for page walk purposes (implicit
    supervisor-mode access).
    
    While there also add x86_seg_none handling to the test harness'es
    read() hook, as will be needed for MSR-LIST support.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/tests/x86_emulator/test_x86_emulator.c | 2 ++
 xen/arch/x86/hvm/emulate.c                   | 2 +-
 xen/arch/x86/hvm/hvm.c                       | 2 +-
 xen/arch/x86/hvm/svm/svm.c                   | 1 +
 xen/arch/x86/x86_emulate/x86_emulate.h       | 3 ++-
 5 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index 24343c5d7f..d52c1c53cb 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -593,6 +593,8 @@ static int read(
     default:
         if ( !is_x86_user_segment(seg) )
             return X86EMUL_UNHANDLEABLE;
+    case x86_seg_sys:
+    case x86_seg_none:
         bytes_read += bytes;
         break;
     }
diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index ecf83795fa..aa97ca1cbf 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -840,7 +840,7 @@ static int hvmemul_virtual_to_linear(
     int okay;
     unsigned long reps = 1;
 
-    if ( seg == x86_seg_none )
+    if ( seg == x86_seg_none || seg == x86_seg_sys )
     {
         *linear = offset;
         return X86EMUL_OKAY;
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index a64eead368..b2e782d596 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -2599,7 +2599,7 @@ bool hvm_vcpu_virtual_to_linear(
      * It is expected that the access rights of reg are suitable for seg (and
      * that this is enforced at the point that seg is loaded).
      */
-    ASSERT(seg < x86_seg_none);
+    ASSERT(seg < x86_seg_sys);
 
     /* However, check that insn fetches only ever specify CS. */
     ASSERT(access_type != hvm_access_insn_fetch || seg == x86_seg_cs);
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 92bb10c504..e0793b26db 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -749,6 +749,7 @@ static void cf_check svm_set_segment_register(
         vmcb->ldtr = *reg;
         break;
 
+    case x86_seg_sys:
     case x86_seg_none:
         ASSERT_UNREACHABLE();
         break;
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.h b/xen/arch/x86/x86_emulate/x86_emulate.h
index e8a0e57228..3e819d4174 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.h
+++ b/xen/arch/x86/x86_emulate/x86_emulate.h
@@ -43,7 +43,8 @@ enum x86_segment {
     x86_seg_ldtr,
     x86_seg_gdtr,
     x86_seg_idtr,
-    /* No Segment: For accesses which are already linear. */
+    /* No Segment: For (system/normal) accesses which are already linear. */
+    x86_seg_sys,
     x86_seg_none
 };
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 30 08:22:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Sep 2024 08:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.807102.1218327 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svBfb-00027v-6H; Mon, 30 Sep 2024 08:22:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 807102.1218327; Mon, 30 Sep 2024 08:22:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svBfb-00027m-2s; Mon, 30 Sep 2024 08:22:15 +0000
Received: by outflank-mailman (input) for mailman id 807102;
 Mon, 30 Sep 2024 08:22:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBfZ-00026p-SE
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:22:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBfZ-0007Ts-R2
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:22:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBfZ-0001CQ-OU
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:22:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wBkLrObfcpFWnb+bDDn9Tjw38pcNXfRH+fz/65uttmk=; b=Xd6tOHhYvi2VoTYbYBA2oVW/II
	P+sqQ+17v2p7pdwy395rfKhaHt1yE4g4IxaiZuPko3L35fkswi4i/PiP5T+AODHAiHRwNGPhQ9tqZ
	fMGHddizNyn+7A4b8O+Ok4XxPyyVJ/e3dK7RJ3W5fitlVfrp2eoo+4b5ySIr6wdg+F5M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/intel: optional build of PSR support
Message-Id: <E1svBfZ-0001CQ-OU@xenbits.xenproject.org>
Date: Mon, 30 Sep 2024 08:22:13 +0000

commit dee9e4b1cc35568853606ad1cf0fedd45ae6c7d4
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Mon Sep 30 10:06:13 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 30 10:06:13 2024 +0200

    x86/intel: optional build of PSR support
    
    Xen's implementation of PSR only supports Intel CPUs right now, hence it can be
    made dependant on CONFIG_INTEL build option.
    Since platform implementation is not limited to single vendor, intermediate
    option CONFIG_X86_PSR introduced, which selected by CONFIG_INTEL.
    
    When !X86_PSR then PSR-related sysctls XEN_SYSCTL_psr_cmt_op &
    XEN_SYSCTL_psr_alloc are off as well.
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/Kconfig           | 10 ++++++++++
 xen/arch/x86/Makefile          |  2 +-
 xen/arch/x86/domctl.c          |  3 +++
 xen/arch/x86/include/asm/psr.h | 10 ++++++++--
 xen/arch/x86/sysctl.c          |  4 +++-
 5 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index ab862b083f..9cdd04721a 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -231,6 +231,16 @@ config TBOOT
 
 	  If unsure, stay with the default.
 
+config X86_PSR
+	bool "Platform Shared Resource support" if EXPERT
+	default INTEL
+	help
+	  Support of Platform Shared Resource technology, which is basis for
+	  monitoring and control of resources like cache and memory bandwidth.
+	  See xl-psr documentation for details.
+
+	  If unsure, stay with the default.
+
 choice
 	prompt "Alignment of Xen image"
 	default XEN_ALIGN_2M if PV_SHIM_EXCLUSIVE
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 00ab091634..1fa12ed4aa 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -57,7 +57,7 @@ obj-y += pci.o
 obj-y += percpu.o
 obj-y += physdev.o
 obj-$(CONFIG_COMPAT) += x86_64/physdev.o
-obj-y += psr.o
+obj-$(CONFIG_X86_PSR) += psr.o
 obj-y += setup.o
 obj-y += shutdown.o
 obj-y += smp.o
diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 68b5b46d1a..6c1355e378 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1195,6 +1195,7 @@ long arch_do_domctl(
     case XEN_DOMCTL_psr_alloc:
         switch ( domctl->u.psr_alloc.cmd )
         {
+#ifdef CONFIG_X86_PSR
         case XEN_DOMCTL_PSR_SET_L3_CBM:
             ret = psr_set_val(d, domctl->u.psr_alloc.target,
                               domctl->u.psr_alloc.data,
@@ -1257,6 +1258,8 @@ long arch_do_domctl(
 
 #undef domctl_psr_get_val
 
+#endif /* CONFIG_X86_PSR */
+
         default:
             ret = -EOPNOTSUPP;
             break;
diff --git a/xen/arch/x86/include/asm/psr.h b/xen/arch/x86/include/asm/psr.h
index 51df78794c..d21a59d98f 100644
--- a/xen/arch/x86/include/asm/psr.h
+++ b/xen/arch/x86/include/asm/psr.h
@@ -69,12 +69,11 @@ extern struct psr_cmt *psr_cmt;
 
 static inline bool psr_cmt_enabled(void)
 {
-    return !!psr_cmt;
+    return IS_ENABLED(CONFIG_X86_PSR) && psr_cmt;
 }
 
 int psr_alloc_rmid(struct domain *d);
 void psr_free_rmid(struct domain *d);
-void psr_ctxt_switch_to(struct domain *d);
 
 int psr_get_info(unsigned int socket, enum psr_type type,
                  uint32_t data[], unsigned int array_len);
@@ -83,8 +82,15 @@ int psr_get_val(struct domain *d, unsigned int socket,
 int psr_set_val(struct domain *d, unsigned int socket,
                 uint64_t new_val, enum psr_type type);
 
+#ifdef CONFIG_X86_PSR
+void psr_ctxt_switch_to(struct domain *d);
 void psr_domain_init(struct domain *d);
 void psr_domain_free(struct domain *d);
+#else
+static inline void psr_ctxt_switch_to(struct domain *d) {}
+static inline void psr_domain_init(struct domain *d) {}
+static inline void psr_domain_free(struct domain *d) {}
+#endif
 
 #endif /* __ASM_PSR_H__ */
 
diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c
index 1d40d82c5a..1b04947516 100644
--- a/xen/arch/x86/sysctl.c
+++ b/xen/arch/x86/sysctl.c
@@ -225,10 +225,11 @@ long arch_do_sysctl(
 
     case XEN_SYSCTL_psr_alloc:
     {
-        uint32_t data[PSR_INFO_ARRAY_SIZE] = { };
+        uint32_t __maybe_unused data[PSR_INFO_ARRAY_SIZE] = { };
 
         switch ( sysctl->u.psr_alloc.cmd )
         {
+#ifdef CONFIG_X86_PSR
         case XEN_SYSCTL_PSR_get_l3_info:
             ret = psr_get_info(sysctl->u.psr_alloc.target,
                                PSR_TYPE_L3_CBM, data, ARRAY_SIZE(data));
@@ -279,6 +280,7 @@ long arch_do_sysctl(
             if ( __copy_field_to_guest(u_sysctl, sysctl, u.psr_alloc) )
                 ret = -EFAULT;
             break;
+#endif /* CONFIG_X86_PSR */
 
         default:
             ret = -EOPNOTSUPP;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 30 08:22:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Sep 2024 08:22:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.807103.1218330 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svBfl-0002BO-76; Mon, 30 Sep 2024 08:22:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 807103.1218330; Mon, 30 Sep 2024 08:22:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svBfl-0002BG-4L; Mon, 30 Sep 2024 08:22:25 +0000
Received: by outflank-mailman (input) for mailman id 807103;
 Mon, 30 Sep 2024 08:22:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBfj-0002B6-Uq
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:22:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBfj-0007VZ-UA
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:22:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBfj-0001D8-TB
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:22:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BOXfH16w1MCEI6ZvNL3/g9UwhNd/Ira/29DPpeuchhY=; b=DY44WvvQ8HWKnRdmZTy5Of4nd8
	8Vsh9X9/4bzGhBroTdBt/bQRuih2lmol76klDN1NnRvAvYssE1yzA2qOJjhaLWHRsHm1OlCdbcW1I
	x+i80gDZenb4LBIJvtIH5slRlaY0q//s/8Gd1OiGl8DABjgtg3BX/EGQu/oV4u2S0zXE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: allow write_atomic() to work with non-scalar types
Message-Id: <E1svBfj-0001D8-TB@xenbits.xenproject.org>
Date: Mon, 30 Sep 2024 08:22:23 +0000

commit f9e69c266ee0b5d386126d3625b79326c8cab3b3
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Mon Sep 30 10:06:44 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 30 10:06:44 2024 +0200

    xen/riscv: allow write_atomic() to work with non-scalar types
    
    Update the defintion of write_atomic() to support non-scalar types,
    bringing it closer to the behavior of read_atomic().
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/atomic.h | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/xen/arch/riscv/include/asm/atomic.h b/xen/arch/riscv/include/asm/atomic.h
index 95910ebfeb..9669a3286d 100644
--- a/xen/arch/riscv/include/asm/atomic.h
+++ b/xen/arch/riscv/include/asm/atomic.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
+ /* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Taken and modified from Linux.
  *
@@ -69,10 +69,11 @@ static always_inline void _write_atomic(volatile void *p,
     }
 }
 
-#define write_atomic(p, x)                              \
-({                                                      \
-    typeof(*(p)) x_ = (x);                              \
-    _write_atomic(p, x_, sizeof(*(p)));                 \
+#define write_atomic(p, x)                                          \
+({                                                                  \
+    union { typeof(*(p)) v; unsigned long ul; } x_ = { .ul = 0UL }; \
+    x_.v = (x);                                                     \
+    _write_atomic(p, x_.ul, sizeof(*(p)));                          \
 })
 
 static always_inline void _add_sized(volatile void *p,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 30 08:22:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Sep 2024 08:22:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.807104.1218335 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svBfv-0002ER-8l; Mon, 30 Sep 2024 08:22:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 807104.1218335; Mon, 30 Sep 2024 08:22:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svBfv-0002EJ-5u; Mon, 30 Sep 2024 08:22:35 +0000
Received: by outflank-mailman (input) for mailman id 807104;
 Mon, 30 Sep 2024 08:22:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBfu-0002E9-1v
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:22:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBfu-0007Vk-19
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:22:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBfu-0001Dw-08
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:22:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=p6DQIgZkJxEcNq/bmpsWCSOBXbf0oOxB+oHOzXEA6ws=; b=PA7sb+ZB8uYAEKTv2RjLUHIzva
	NZ7OfHO7Qu1RIi9k4btyaDphRyf97P+Ykv/5joYJVZB+099qqm0uD5hc49k2eQ8vXhq0wlevMXz9b
	eP/HrfW+NBlliMw0JChVmgVufjclNay6I8814mdZEe/NzOcNKLYiupi7ic0zjUPyZMRw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: set up fixmap mappings
Message-Id: <E1svBfu-0001Dw-08@xenbits.xenproject.org>
Date: Mon, 30 Sep 2024 08:22:34 +0000

commit 13684f539e2dce9255670cf5f233189be989aa40
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Mon Sep 30 10:08:51 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 30 10:08:51 2024 +0200

    xen/riscv: set up fixmap mappings
    
    Set up fixmap mappings and the L0 page table for fixmap support.
    
    Modify the PTEs (xen_fixmap[]) directly in arch_pmap_map() instead
    of using set_fixmap() which is expected to be implemented using
    map_pages_to_xen(), which, in turn, is expected to use
    arch_pmap_map() during early boot, resulting in a loop.
    
    Define new macros in riscv/config.h for calculating
    the FIXMAP_BASE address, including BOOT_FDT_VIRT_{START, SIZE},
    XEN_VIRT_SIZE, and XEN_VIRT_END.
    
    Update the check for Xen size in riscv/xen.lds.S to use
    XEN_VIRT_SIZE instead of a hardcoded constant.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/config.h | 16 +++++++++++--
 xen/arch/riscv/include/asm/fixmap.h | 46 +++++++++++++++++++++++++++++++++++++
 xen/arch/riscv/include/asm/mm.h     |  2 ++
 xen/arch/riscv/include/asm/page.h   | 13 +++++++++++
 xen/arch/riscv/mm.c                 | 43 ++++++++++++++++++++++++++++++++++
 xen/arch/riscv/setup.c              |  2 ++
 xen/arch/riscv/xen.lds.S            |  2 +-
 7 files changed, 121 insertions(+), 3 deletions(-)

diff --git a/xen/arch/riscv/include/asm/config.h b/xen/arch/riscv/include/asm/config.h
index 50583aafdc..7dbb235685 100644
--- a/xen/arch/riscv/include/asm/config.h
+++ b/xen/arch/riscv/include/asm/config.h
@@ -41,8 +41,10 @@
  * Start addr          | End addr         | Slot       | area description
  * ============================================================================
  *                   .....                 L2 511          Unused
- *  0xffffffffc0600000  0xffffffffc0800000 L2 511          Fixmap
- *  0xffffffffc0200000  0xffffffffc0600000 L2 511          FDT
+ *  0xffffffffc0a00000  0xffffffffc0c00000 L2 511          Fixmap
+ *                   ..... ( 2 MB gap )
+ *  0xffffffffc0400000  0xffffffffc0800000 L2 511          FDT
+ *                   ..... ( 2 MB gap )
  *  0xffffffffc0000000  0xffffffffc0200000 L2 511          Xen
  *                   .....                 L2 510          Unused
  *  0x3200000000        0x7f40000000       L2 200-509      Direct map
@@ -74,6 +76,16 @@
 #error "unsupported RV_STAGE1_MODE"
 #endif
 
+#define GAP_SIZE                MB(2)
+
+#define XEN_VIRT_SIZE           MB(2)
+
+#define BOOT_FDT_VIRT_START     (XEN_VIRT_START + XEN_VIRT_SIZE + GAP_SIZE)
+#define BOOT_FDT_VIRT_SIZE      MB(4)
+
+#define FIXMAP_BASE \
+    (BOOT_FDT_VIRT_START + BOOT_FDT_VIRT_SIZE + GAP_SIZE)
+
 #define DIRECTMAP_SLOT_END      509
 #define DIRECTMAP_SLOT_START    200
 #define DIRECTMAP_VIRT_START    SLOTN(DIRECTMAP_SLOT_START)
diff --git a/xen/arch/riscv/include/asm/fixmap.h b/xen/arch/riscv/include/asm/fixmap.h
new file mode 100644
index 0000000000..63732df36c
--- /dev/null
+++ b/xen/arch/riscv/include/asm/fixmap.h
@@ -0,0 +1,46 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * fixmap.h: compile-time virtual memory allocation
+ */
+#ifndef ASM_FIXMAP_H
+#define ASM_FIXMAP_H
+
+#include <xen/bug.h>
+#include <xen/page-size.h>
+#include <xen/pmap.h>
+
+#include <asm/page.h>
+
+#define FIXMAP_ADDR(n) (FIXMAP_BASE + (n) * PAGE_SIZE)
+
+/* Fixmap slots */
+#define FIX_PMAP_BEGIN (0) /* Start of PMAP */
+#define FIX_PMAP_END (FIX_PMAP_BEGIN + NUM_FIX_PMAP - 1) /* End of PMAP */
+#define FIX_MISC (FIX_PMAP_END + 1)  /* Ephemeral mappings of hardware */
+
+#define FIX_LAST FIX_MISC
+
+#define FIXADDR_START FIXMAP_ADDR(0)
+#define FIXADDR_TOP FIXMAP_ADDR(FIX_LAST + 1)
+
+#ifndef __ASSEMBLY__
+
+/*
+ * Direct access to xen_fixmap[] should only happen when {set,
+ * clear}_fixmap() is unusable (e.g. where we would end up to
+ * recursively call the helpers).
+ */
+extern pte_t xen_fixmap[];
+
+#define fix_to_virt(slot) ((void *)FIXMAP_ADDR(slot))
+
+static inline unsigned int virt_to_fix(vaddr_t vaddr)
+{
+    BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
+
+    return ((vaddr - FIXADDR_START) >> PAGE_SHIFT);
+}
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* ASM_FIXMAP_H */
diff --git a/xen/arch/riscv/include/asm/mm.h b/xen/arch/riscv/include/asm/mm.h
index 25af9e1aaa..a0bdc2bc3a 100644
--- a/xen/arch/riscv/include/asm/mm.h
+++ b/xen/arch/riscv/include/asm/mm.h
@@ -255,4 +255,6 @@ static inline unsigned int arch_get_dma_bitsize(void)
     return 32; /* TODO */
 }
 
+void setup_fixmap_mappings(void);
+
 #endif /* _ASM_RISCV_MM_H */
diff --git a/xen/arch/riscv/include/asm/page.h b/xen/arch/riscv/include/asm/page.h
index c831e16417..d4a5009823 100644
--- a/xen/arch/riscv/include/asm/page.h
+++ b/xen/arch/riscv/include/asm/page.h
@@ -9,6 +9,7 @@
 #include <xen/bug.h>
 #include <xen/types.h>
 
+#include <asm/atomic.h>
 #include <asm/mm.h>
 #include <asm/page-bits.h>
 
@@ -81,6 +82,18 @@ static inline void flush_page_to_ram(unsigned long mfn, bool sync_icache)
     BUG_ON("unimplemented");
 }
 
+/* Write a pagetable entry. */
+static inline void write_pte(pte_t *p, pte_t pte)
+{
+    write_atomic(p, pte);
+}
+
+/* Read a pagetable entry. */
+static inline pte_t read_pte(const pte_t *p)
+{
+    return read_atomic(p);
+}
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* _ASM_RISCV_PAGE_H */
diff --git a/xen/arch/riscv/mm.c b/xen/arch/riscv/mm.c
index 7d09e781bf..b8ff91cf4e 100644
--- a/xen/arch/riscv/mm.c
+++ b/xen/arch/riscv/mm.c
@@ -12,6 +12,7 @@
 #include <asm/early_printk.h>
 #include <asm/csr.h>
 #include <asm/current.h>
+#include <asm/fixmap.h>
 #include <asm/page.h>
 #include <asm/processor.h>
 
@@ -49,6 +50,9 @@ stage1_pgtbl_root[PAGETABLE_ENTRIES];
 pte_t __section(".bss.page_aligned") __aligned(PAGE_SIZE)
 stage1_pgtbl_nonroot[PGTBL_INITIAL_COUNT * PAGETABLE_ENTRIES];
 
+pte_t __section(".bss.page_aligned") __aligned(PAGE_SIZE)
+xen_fixmap[PAGETABLE_ENTRIES];
+
 #define HANDLE_PGTBL(curr_lvl_num)                                          \
     index = pt_index(curr_lvl_num, page_addr);                              \
     if ( pte_is_valid(pgtbl[index]) )                                       \
@@ -191,6 +195,45 @@ static bool __init check_pgtbl_mode_support(struct mmu_desc *mmu_desc,
     return is_mode_supported;
 }
 
+void __init setup_fixmap_mappings(void)
+{
+    pte_t *pte, tmp;
+    unsigned int i;
+
+    BUILD_BUG_ON(FIX_LAST >= PAGETABLE_ENTRIES);
+
+    pte = &stage1_pgtbl_root[pt_index(HYP_PT_ROOT_LEVEL, FIXMAP_ADDR(0))];
+
+    /*
+     * In RISC-V page table levels are numbered from Lx to L0 where
+     * x is the highest page table level for currect  MMU mode ( for example,
+     * for Sv39 has 3 page tables so the x = 2 (L2 -> L1 -> L0) ).
+     *
+     * In this cycle we want to find L1 page table because as L0 page table
+     * xen_fixmap[] will be used.
+     */
+    for ( i = HYP_PT_ROOT_LEVEL; i-- > 1; )
+    {
+        BUG_ON(!pte_is_valid(*pte));
+
+        pte = (pte_t *)LOAD_TO_LINK(pte_to_paddr(*pte));
+        pte = &pte[pt_index(i, FIXMAP_ADDR(0))];
+    }
+
+    BUG_ON(pte_is_valid(*pte));
+
+    tmp = paddr_to_pte(LINK_TO_LOAD((unsigned long)&xen_fixmap), PTE_TABLE);
+    write_pte(pte, tmp);
+
+    RISCV_FENCE(rw, rw);
+    sfence_vma();
+
+    /*
+     * We only need the zeroeth table allocated, but not the PTEs set, because
+     * set_fixmap() will set them on the fly.
+     */
+}
+
 /*
  * setup_initial_pagetables:
  *
diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index bf9078f36a..ace5ab91e3 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -27,6 +27,8 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
 
     trap_init();
 
+    setup_fixmap_mappings();
+
     printk("All set up\n");
 
     machine_halt();
diff --git a/xen/arch/riscv/xen.lds.S b/xen/arch/riscv/xen.lds.S
index 871b47a235..558a5a992a 100644
--- a/xen/arch/riscv/xen.lds.S
+++ b/xen/arch/riscv/xen.lds.S
@@ -174,6 +174,6 @@ ASSERT(!SIZEOF(.got.plt),  ".got.plt non-empty")
  * Changing the size of Xen binary can require an update of
  * PGTBL_INITIAL_COUNT.
  */
-ASSERT(_end - _start <= MB(2), "Xen too large for early-boot assumptions")
+ASSERT(_end - _start <= XEN_VIRT_SIZE, "Xen too large for early-boot assumptions")
 
 ASSERT(_ident_end - _ident_start <= IDENT_AREA_SIZE, "identity region is too big");
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 30 08:22:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Sep 2024 08:22:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.807105.1218338 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svBg5-0002H6-A9; Mon, 30 Sep 2024 08:22:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 807105.1218338; Mon, 30 Sep 2024 08:22:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svBg5-0002Gz-7L; Mon, 30 Sep 2024 08:22:45 +0000
Received: by outflank-mailman (input) for mailman id 807105;
 Mon, 30 Sep 2024 08:22:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBg4-0002Gq-5j
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:22:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBg4-0007Vt-4w
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:22:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBg4-0001Eo-3G
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:22:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hWNuIVW5e3z5HRdUMGeFOEagmcogiEFevV3T7+Q5tss=; b=2/Avkb/ysyVX2KTfwVqcnWhZb+
	A7lWwvz00BTN55sIWg/R7E+e7syRDTc3nUzy5kfs2ZTxcV9cBy8WxxBSAod8NSkhy72eSwOQoTJ+l
	3bhU+CvR688ekehCfTV7Wh7QCXw/KW5NPEKcYS+ocZ1Oo6QXCT1jq7zYFE5504MY0kZ0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: introduce asm/pmap.h header
Message-Id: <E1svBg4-0001Eo-3G@xenbits.xenproject.org>
Date: Mon, 30 Sep 2024 08:22:44 +0000

commit f89e1a170299637138d3a0f90598e47884ef3c66
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Mon Sep 30 10:09:37 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 30 10:09:37 2024 +0200

    xen/riscv: introduce asm/pmap.h header
    
    Introduce arch_pmap_{un}map functions and select HAS_PMAP for CONFIG_RISCV.
    
    Add pte_from_mfn() for use in arch_pmap_map().
    
    Introduce flush_xen_tlb_one_local() and use it in arch_pmap_{un}map().
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/Kconfig                |  1 +
 xen/arch/riscv/include/asm/flushtlb.h |  6 ++++++
 xen/arch/riscv/include/asm/page.h     |  6 ++++++
 xen/arch/riscv/include/asm/pmap.h     | 36 +++++++++++++++++++++++++++++++++++
 4 files changed, 49 insertions(+)

diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig
index 7a113c7774..1858004676 100644
--- a/xen/arch/riscv/Kconfig
+++ b/xen/arch/riscv/Kconfig
@@ -3,6 +3,7 @@ config RISCV
 	select FUNCTION_ALIGNMENT_16B
 	select GENERIC_BUG_FRAME
 	select HAS_DEVICE_TREE
+	select HAS_PMAP
 	select HAS_VMAP
 
 config RISCV_64
diff --git a/xen/arch/riscv/include/asm/flushtlb.h b/xen/arch/riscv/include/asm/flushtlb.h
index 7ce32bea0b..f4a735fd6c 100644
--- a/xen/arch/riscv/include/asm/flushtlb.h
+++ b/xen/arch/riscv/include/asm/flushtlb.h
@@ -5,6 +5,12 @@
 #include <xen/bug.h>
 #include <xen/cpumask.h>
 
+/* Flush TLB of local processor for address va. */
+static inline void flush_tlb_one_local(vaddr_t va)
+{
+    asm volatile ( "sfence.vma %0" :: "r" (va) : "memory" );
+}
+
 /*
  * Filter the given set of CPUs, removing those that definitely flushed their
  * TLB since @page_timestamp.
diff --git a/xen/arch/riscv/include/asm/page.h b/xen/arch/riscv/include/asm/page.h
index d4a5009823..eb79cb9409 100644
--- a/xen/arch/riscv/include/asm/page.h
+++ b/xen/arch/riscv/include/asm/page.h
@@ -94,6 +94,12 @@ static inline pte_t read_pte(const pte_t *p)
     return read_atomic(p);
 }
 
+static inline pte_t pte_from_mfn(mfn_t mfn, unsigned int flags)
+{
+    unsigned long pte = (mfn_x(mfn) << PTE_PPN_SHIFT) | flags;
+    return (pte_t){ .pte = pte };
+}
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* _ASM_RISCV_PAGE_H */
diff --git a/xen/arch/riscv/include/asm/pmap.h b/xen/arch/riscv/include/asm/pmap.h
new file mode 100644
index 0000000000..60065c996f
--- /dev/null
+++ b/xen/arch/riscv/include/asm/pmap.h
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef ASM_PMAP_H
+#define ASM_PMAP_H
+
+#include <xen/bug.h>
+#include <xen/init.h>
+#include <xen/mm.h>
+#include <xen/page-size.h>
+
+#include <asm/fixmap.h>
+#include <asm/flushtlb.h>
+#include <asm/system.h>
+
+static inline void __init arch_pmap_map(unsigned int slot, mfn_t mfn)
+{
+    pte_t *entry = &xen_fixmap[slot];
+    pte_t pte;
+
+    ASSERT(!pte_is_valid(*entry));
+
+    pte = pte_from_mfn(mfn, PAGE_HYPERVISOR_RW);
+    write_pte(entry, pte);
+
+    flush_tlb_one_local(FIXMAP_ADDR(slot));
+}
+
+static inline void __init arch_pmap_unmap(unsigned int slot)
+{
+    pte_t pte = {};
+
+    write_pte(&xen_fixmap[slot], pte);
+
+    flush_tlb_one_local(FIXMAP_ADDR(slot));
+}
+
+#endif /* ASM_PMAP_H */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 30 08:22:56 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Sep 2024 08:22:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.807106.1218343 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svBgG-0002Kg-Du; Mon, 30 Sep 2024 08:22:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 807106.1218343; Mon, 30 Sep 2024 08:22:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svBgG-0002KY-BD; Mon, 30 Sep 2024 08:22:56 +0000
Received: by outflank-mailman (input) for mailman id 807106;
 Mon, 30 Sep 2024 08:22:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBgE-0002KL-8f
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:22:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBgE-0007W0-7u
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:22:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBgE-0001Fd-74
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:22:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vAyX7h2FQJtr/Z/oyJA4chM/ZpTui8RDo7DdSScP6ds=; b=h/OB4nCBkXVs8ejC3X7NmWtfhx
	SKmpqbkPrqjOQ/VZ1ocGJU23b3bRUJuHI60/cXJ7am16HBy7zeqcdLXXTKACV/tYlUOBlVw8g3xQ5
	nfciE99aYAiSnHpEQTllMmwf6e80osTTcixs8tNJrNrXRrr1dmgwpzF+nzzDaY672Pms=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: introduce functionality to work with CPU info
Message-Id: <E1svBgE-0001Fd-74@xenbits.xenproject.org>
Date: Mon, 30 Sep 2024 08:22:54 +0000

commit b6c8f34a902955ed69670b48bc1d799fc83caba8
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Mon Sep 30 10:11:18 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 30 10:11:18 2024 +0200

    xen/riscv: introduce functionality to work with CPU info
    
    Introduce struct pcpu_info to store pCPU-related information.
    Initially, it includes only processor_id and hart id, but it
    will be extended to include guest CPU information and
    temporary variables for saving/restoring vCPU registers.
    
    Add set_processor_id() function to set processor_id stored in
    pcpu_info.
    
    Define smp_processor_id() to provide accurate information,
    replacing the previous "dummy" value of 0.
    
    Initialize tp registers to point to pcpu_info[0].
    Set processor_id to 0 for logical CPU 0 and store the physical
    CPU ID in pcpu_info[0].
    
    Introduce helpers for getting/setting hart_id ( physical CPU id
    in RISC-V terms ) from Xen CPU id.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/Makefile                |  1 +
 xen/arch/riscv/include/asm/current.h   | 27 ++++++++++++++++++++++++++-
 xen/arch/riscv/include/asm/processor.h |  3 ---
 xen/arch/riscv/include/asm/smp.h       | 18 ++++++++++++++++++
 xen/arch/riscv/riscv64/asm-offsets.c   |  3 +++
 xen/arch/riscv/riscv64/head.S          | 14 ++++++++++++++
 xen/arch/riscv/setup.c                 |  5 +++++
 xen/arch/riscv/smp.c                   | 15 +++++++++++++++
 8 files changed, 82 insertions(+), 4 deletions(-)

diff --git a/xen/arch/riscv/Makefile b/xen/arch/riscv/Makefile
index d192be7b55..6832549133 100644
--- a/xen/arch/riscv/Makefile
+++ b/xen/arch/riscv/Makefile
@@ -5,6 +5,7 @@ obj-$(CONFIG_RISCV_64) += riscv64/
 obj-y += sbi.o
 obj-y += setup.o
 obj-y += shutdown.o
+obj-y += smp.o
 obj-y += stubs.o
 obj-y += traps.o
 obj-y += vm_event.o
diff --git a/xen/arch/riscv/include/asm/current.h b/xen/arch/riscv/include/asm/current.h
index aedb6dc732..6f1ec4e190 100644
--- a/xen/arch/riscv/include/asm/current.h
+++ b/xen/arch/riscv/include/asm/current.h
@@ -3,12 +3,37 @@
 #ifndef __ASM_CURRENT_H
 #define __ASM_CURRENT_H
 
-#include <xen/lib.h>
+#include <xen/bug.h>
+#include <xen/cache.h>
 #include <xen/percpu.h>
+
 #include <asm/processor.h>
 
 #ifndef __ASSEMBLY__
 
+register struct pcpu_info *tp asm ( "tp" );
+
+struct pcpu_info {
+    unsigned int processor_id; /* Xen CPU id */
+    unsigned long hart_id; /* physical CPU id */
+} __cacheline_aligned;
+
+/* tp points to one of these */
+extern struct pcpu_info pcpu_info[NR_CPUS];
+
+#define set_processor_id(id)    do { \
+    tp->processor_id = (id);         \
+} while (0)
+
+static inline unsigned int smp_processor_id(void)
+{
+    unsigned int id = tp->processor_id;
+
+    BUG_ON(id >= NR_CPUS);
+
+    return id;
+}
+
 /* Which VCPU is "current" on this PCPU. */
 DECLARE_PER_CPU(struct vcpu *, curr_vcpu);
 
diff --git a/xen/arch/riscv/include/asm/processor.h b/xen/arch/riscv/include/asm/processor.h
index 3ae164c265..e42b353b4c 100644
--- a/xen/arch/riscv/include/asm/processor.h
+++ b/xen/arch/riscv/include/asm/processor.h
@@ -12,9 +12,6 @@
 
 #ifndef __ASSEMBLY__
 
-/* TODO: need to be implemeted */
-#define smp_processor_id() 0
-
 /* On stack VCPU state */
 struct cpu_user_regs
 {
diff --git a/xen/arch/riscv/include/asm/smp.h b/xen/arch/riscv/include/asm/smp.h
index b1ea91b1eb..a824be8e78 100644
--- a/xen/arch/riscv/include/asm/smp.h
+++ b/xen/arch/riscv/include/asm/smp.h
@@ -5,6 +5,8 @@
 #include <xen/cpumask.h>
 #include <xen/percpu.h>
 
+#include <asm/current.h>
+
 DECLARE_PER_CPU(cpumask_var_t, cpu_sibling_mask);
 DECLARE_PER_CPU(cpumask_var_t, cpu_core_mask);
 
@@ -14,6 +16,22 @@ DECLARE_PER_CPU(cpumask_var_t, cpu_core_mask);
  */
 #define park_offline_cpus false
 
+/*
+ * Mapping between Xen logical cpu index and hartid.
+ */
+static inline unsigned long cpuid_to_hartid(unsigned long cpuid)
+{
+    return pcpu_info[cpuid].hart_id;
+}
+
+static inline void set_cpuid_to_hartid(unsigned long cpuid,
+                                       unsigned long hartid)
+{
+    pcpu_info[cpuid].hart_id = hartid;
+}
+
+void setup_tp(unsigned int cpuid);
+
 #endif
 
 /*
diff --git a/xen/arch/riscv/riscv64/asm-offsets.c b/xen/arch/riscv/riscv64/asm-offsets.c
index 9f663b9510..3b5daf3b36 100644
--- a/xen/arch/riscv/riscv64/asm-offsets.c
+++ b/xen/arch/riscv/riscv64/asm-offsets.c
@@ -1,5 +1,6 @@
 #define COMPILE_OFFSETS
 
+#include <asm/current.h>
 #include <asm/processor.h>
 #include <xen/types.h>
 
@@ -50,4 +51,6 @@ void asm_offsets(void)
     OFFSET(CPU_USER_REGS_SSTATUS, struct cpu_user_regs, sstatus);
     OFFSET(CPU_USER_REGS_PREGS, struct cpu_user_regs, pregs);
     BLANK();
+    DEFINE(PCPU_INFO_SIZE, sizeof(struct pcpu_info));
+    BLANK();
 }
diff --git a/xen/arch/riscv/riscv64/head.S b/xen/arch/riscv/riscv64/head.S
index 3261e9fce8..2a1b3dad91 100644
--- a/xen/arch/riscv/riscv64/head.S
+++ b/xen/arch/riscv/riscv64/head.S
@@ -1,4 +1,5 @@
 #include <asm/asm.h>
+#include <asm/asm-offsets.h>
 #include <asm/riscv_encoding.h>
 
         .section .text.header, "ax", %progbits
@@ -55,6 +56,10 @@ FUNC(start)
          */
         jal     reset_stack
 
+        /* Xen's boot cpu id is equal to 0 so setup TP register for it */
+        li      a0, 0
+        jal     setup_tp
+
         /* restore hart_id ( bootcpu_id ) and dtb address */
         mv      a0, s0
         mv      a1, s1
@@ -72,6 +77,15 @@ FUNC(reset_stack)
         ret
 END(reset_stack)
 
+/* void setup_tp(unsigned int xen_cpuid); */
+FUNC(setup_tp)
+        la      t0, pcpu_info
+        li      t1, PCPU_INFO_SIZE
+        mul     t1, a0, t1
+        add     tp, t0, t1
+        ret
+END(setup_tp)
+
         .section .text.ident, "ax", %progbits
 
 FUNC(turn_on_mmu)
diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index ace5ab91e3..b9850a9801 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -9,6 +9,7 @@
 #include <public/version.h>
 
 #include <asm/early_printk.h>
+#include <asm/smp.h>
 #include <asm/traps.h>
 
 void arch_get_xen_caps(xen_capabilities_info_t *info)
@@ -25,6 +26,10 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
 {
     remove_identity_mapping();
 
+    set_processor_id(0);
+
+    set_cpuid_to_hartid(0, bootcpu_id);
+
     trap_init();
 
     setup_fixmap_mappings();
diff --git a/xen/arch/riscv/smp.c b/xen/arch/riscv/smp.c
new file mode 100644
index 0000000000..4ca6a4e892
--- /dev/null
+++ b/xen/arch/riscv/smp.c
@@ -0,0 +1,15 @@
+#include <xen/smp.h>
+
+/*
+ * FIXME: make pcpu_info[] dynamically allocated when necessary
+ *        functionality will be ready
+ */
+/*
+ * tp points to one of these per cpu.
+ *
+ * hart_id would be valid (no matter which value) if its
+ * processor_id field is valid (less than NR_CPUS).
+ */
+struct pcpu_info pcpu_info[NR_CPUS] = { [0 ... NR_CPUS - 1] = {
+    .processor_id = NR_CPUS,
+}};
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 30 08:23:06 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Sep 2024 08:23:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.807107.1218347 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svBgQ-0002NL-FV; Mon, 30 Sep 2024 08:23:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 807107.1218347; Mon, 30 Sep 2024 08:23:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svBgQ-0002NB-Cj; Mon, 30 Sep 2024 08:23:06 +0000
Received: by outflank-mailman (input) for mailman id 807107;
 Mon, 30 Sep 2024 08:23:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBgO-0002N0-Ba
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:23:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBgO-0007Wg-As
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:23:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBgO-0001Ge-A0
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:23:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=s2kLbyaOEUp8ezrUmTnjxdT6KJdG2Bf+6WFmTzpFtVI=; b=Wp5zD5ZMywxkxNTQ/q8G5nKKe7
	6QviOIEqCQwPsw5ta1+ETvjlRQieTnc+cYsq0fFksFAFWKl5Eakf1qcEcSQBRxy9pNGAm6AeeJyiU
	X62XceQtonGqfOTFZjijDntY8lMEIKaYvlAflh9gTOz/aMz0SNx3ovBMFFQg5+qCaqQ4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: introduce and initialize SBI RFENCE extension
Message-Id: <E1svBgO-0001Ge-A0@xenbits.xenproject.org>
Date: Mon, 30 Sep 2024 08:23:04 +0000

commit c353c4775712394fab2ba413f6676fd0855bd5c5
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Mon Sep 30 10:12:40 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 30 10:12:40 2024 +0200

    xen/riscv: introduce and initialize SBI RFENCE extension
    
    Introduce functions to work with the SBI RFENCE extension for issuing
    various fence operations to remote CPUs.
    
    Add the sbi_init() function along with auxiliary functions and macro
    definitions for proper initialization and checking the availability of
    SBI extensions. Currently, this is implemented only for RFENCE.
    
    Introduce sbi_remote_sfence_vma() to send SFENCE_VMA instructions to
    a set of target HARTs. This will support the implementation of
    flush_xen_tlb_range_va().
    
    Integrate __sbi_rfence_v02 from Linux kernel 6.6.0-rc4 with minimal
    modifications:
     - Adapt to Xen code style.
     - Use cpuid_to_hartid() instead of cpuid_to_hartid_map[].
     - Update BIT(...) to BIT(..., UL).
     - Rename __sbi_rfence_v02_call to sbi_rfence_v02_real and
       remove the unused arg5.
     - Handle NULL cpu_mask to execute rfence on all CPUs by calling
       sbi_rfence_v02_real(..., 0UL, -1UL,...) instead of creating hmask.
     - change type for start_addr and size to vaddr_t and size_t.
     - Add an explanatory comment about when batching can and cannot occur,
       and why batching happens in the first place.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/sbi.h |  62 +++++++++
 xen/arch/riscv/sbi.c             | 273 ++++++++++++++++++++++++++++++++++++++-
 xen/arch/riscv/setup.c           |   3 +
 3 files changed, 337 insertions(+), 1 deletion(-)

diff --git a/xen/arch/riscv/include/asm/sbi.h b/xen/arch/riscv/include/asm/sbi.h
index 4d72a2295e..5947fed779 100644
--- a/xen/arch/riscv/include/asm/sbi.h
+++ b/xen/arch/riscv/include/asm/sbi.h
@@ -12,9 +12,42 @@
 #ifndef __ASM_RISCV_SBI_H__
 #define __ASM_RISCV_SBI_H__
 
+#include <xen/cpumask.h>
+
 #define SBI_EXT_0_1_CONSOLE_PUTCHAR		0x1
 #define SBI_EXT_0_1_SHUTDOWN			0x8
 
+#define SBI_EXT_BASE                    0x10
+#define SBI_EXT_RFENCE                  0x52464E43
+
+/* SBI function IDs for BASE extension */
+#define SBI_EXT_BASE_GET_SPEC_VERSION   0x0
+#define SBI_EXT_BASE_GET_IMP_ID         0x1
+#define SBI_EXT_BASE_GET_IMP_VERSION    0x2
+#define SBI_EXT_BASE_PROBE_EXT          0x3
+
+/* SBI function IDs for RFENCE extension */
+#define SBI_EXT_RFENCE_REMOTE_FENCE_I           0x0
+#define SBI_EXT_RFENCE_REMOTE_SFENCE_VMA        0x1
+#define SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID   0x2
+#define SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA       0x3
+#define SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA_VMID  0x4
+#define SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA       0x5
+#define SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID  0x6
+
+#define SBI_SPEC_VERSION_MAJOR_MASK     0x7f000000
+#define SBI_SPEC_VERSION_MINOR_MASK     0x00ffffff
+
+/* SBI return error codes */
+#define SBI_SUCCESS             0
+#define SBI_ERR_FAILURE         (-1)
+#define SBI_ERR_NOT_SUPPORTED   (-2)
+#define SBI_ERR_INVALID_PARAM   (-3)
+#define SBI_ERR_DENIED          (-4)
+#define SBI_ERR_INVALID_ADDRESS (-5)
+
+#define SBI_SPEC_VERSION_DEFAULT 0x1
+
 struct sbiret {
     long error;
     long value;
@@ -34,4 +67,33 @@ void sbi_console_putchar(int ch);
 
 void sbi_shutdown(void);
 
+/*
+ * Check underlying SBI implementation has RFENCE
+ *
+ * @return true for supported AND false for not-supported
+ */
+bool sbi_has_rfence(void);
+
+/*
+ * Instructs the remote harts to execute one or more SFENCE.VMA
+ * instructions, covering the range of virtual addresses between
+ * [start_addr, start_addr + size).
+ *
+ * Returns 0 if IPI was sent to all the targeted harts successfully
+ * or negative value if start_addr or size is not valid.
+ *
+ * @hart_mask a cpu mask containing all the target harts.
+ * @param start virtual address start
+ * @param size virtual address range size
+ */
+int sbi_remote_sfence_vma(const cpumask_t *cpu_mask, vaddr_t start,
+                          size_t size);
+
+/*
+ * Initialize SBI library
+ *
+ * @return 0 on success, otherwise negative errno on failure
+ */
+int sbi_init(void);
+
 #endif /* __ASM_RISCV_SBI_H__ */
diff --git a/xen/arch/riscv/sbi.c b/xen/arch/riscv/sbi.c
index c7984344bc..4209520389 100644
--- a/xen/arch/riscv/sbi.c
+++ b/xen/arch/riscv/sbi.c
@@ -5,13 +5,26 @@
  * (anup.patel@wdc.com).
  *
  * Modified by Bobby Eshleman (bobby.eshleman@gmail.com).
+ * Modified by Oleksii Kurochko (oleksii.kurochko@gmail.com).
  *
  * Copyright (c) 2019 Western Digital Corporation or its affiliates.
- * Copyright (c) 2021-2023 Vates SAS.
+ * Copyright (c) 2021-2024 Vates SAS.
  */
 
+#include <xen/compiler.h>
+#include <xen/const.h>
+#include <xen/cpumask.h>
+#include <xen/errno.h>
+#include <xen/init.h>
+#include <xen/lib.h>
+#include <xen/sections.h>
+#include <xen/smp.h>
+
+#include <asm/processor.h>
 #include <asm/sbi.h>
 
+static unsigned long __ro_after_init sbi_spec_version = SBI_SPEC_VERSION_DEFAULT;
+
 struct sbiret sbi_ecall(unsigned long ext, unsigned long fid,
                         unsigned long arg0, unsigned long arg1,
                         unsigned long arg2, unsigned long arg3,
@@ -38,6 +51,26 @@ struct sbiret sbi_ecall(unsigned long ext, unsigned long fid,
     return ret;
 }
 
+static int sbi_err_map_xen_errno(int err)
+{
+    switch ( err )
+    {
+    case SBI_SUCCESS:
+        return 0;
+    case SBI_ERR_DENIED:
+        return -EACCES;
+    case SBI_ERR_INVALID_PARAM:
+        return -EINVAL;
+    case SBI_ERR_INVALID_ADDRESS:
+        return -EFAULT;
+    case SBI_ERR_NOT_SUPPORTED:
+        return -EOPNOTSUPP;
+    case SBI_ERR_FAILURE:
+    default:
+        return -ENOSYS;
+    };
+}
+
 void sbi_console_putchar(int ch)
 {
     sbi_ecall(SBI_EXT_0_1_CONSOLE_PUTCHAR, 0, ch, 0, 0, 0, 0, 0);
@@ -47,3 +80,241 @@ void sbi_shutdown(void)
 {
     sbi_ecall(SBI_EXT_0_1_SHUTDOWN, 0, 0, 0, 0, 0, 0, 0);
 }
+
+static unsigned int sbi_major_version(void)
+{
+    return MASK_EXTR(sbi_spec_version, SBI_SPEC_VERSION_MAJOR_MASK);
+}
+
+static unsigned int sbi_minor_version(void)
+{
+    return MASK_EXTR(sbi_spec_version, SBI_SPEC_VERSION_MINOR_MASK);
+}
+
+static long sbi_ext_base_func(long fid)
+{
+    struct sbiret ret;
+
+    ret = sbi_ecall(SBI_EXT_BASE, fid, 0, 0, 0, 0, 0, 0);
+
+    if ( !ret.error )
+    {
+        /*
+         * I wasn't able to find a case in the SBI spec where sbiret.value
+         * could be negative.
+         *
+         * Unfortunately, the spec does not specify the possible values of
+         * sbiret.value, but based on the description of the SBI function,
+         * ret.value >= 0 when sbiret.error = 0. SPI spec specify only
+         * possible value for sbiret.error (<= 0 whwere 0 is SBI_SUCCESS ).
+         *
+         * Just to be sure that SBI base extension functions one day won't
+         * start to return a negative value for sbiret.value when
+         * sbiret.error < 0 BUG_ON() is added.
+         */
+        BUG_ON(ret.value < 0);
+
+        return ret.value;
+    }
+    else
+        return ret.error;
+}
+
+static int sbi_rfence_v02_real(unsigned long fid,
+                               unsigned long hmask, unsigned long hbase,
+                               vaddr_t start, size_t size,
+                               unsigned long arg4)
+{
+    struct sbiret ret = {0};
+    int result = 0;
+
+    switch ( fid )
+    {
+    case SBI_EXT_RFENCE_REMOTE_FENCE_I:
+        ret = sbi_ecall(SBI_EXT_RFENCE, fid, hmask, hbase,
+                        0, 0, 0, 0);
+        break;
+
+    case SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA:
+    case SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA:
+    case SBI_EXT_RFENCE_REMOTE_SFENCE_VMA:
+        ret = sbi_ecall(SBI_EXT_RFENCE, fid, hmask, hbase,
+                        start, size, 0, 0);
+        break;
+
+    case SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID:
+    case SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA_VMID:
+    case SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID:
+        ret = sbi_ecall(SBI_EXT_RFENCE, fid, hmask, hbase,
+                        start, size, arg4, 0);
+        break;
+
+    default:
+        printk("%s: unknown function ID [%#lx]\n",
+               __func__, fid);
+        result = -EINVAL;
+        break;
+    };
+
+    if ( ret.error )
+    {
+        result = sbi_err_map_xen_errno(ret.error);
+        printk("%s: hbase=%lu hmask=%#lx failed (error %ld)\n",
+               __func__, hbase, hmask, ret.error);
+    }
+
+    return result;
+}
+
+static int cf_check sbi_rfence_v02(unsigned long fid,
+                                   const cpumask_t *cpu_mask,
+                                   vaddr_t start, size_t size,
+                                   unsigned long arg4, unsigned long arg5)
+{
+    unsigned long hartid, cpuid, hmask = 0, hbase = 0, htop = 0;
+    int result = -EINVAL;
+
+    /*
+     * hart_mask_base can be set to -1 to indicate that hart_mask can be
+     * ignored and all available harts must be considered.
+     */
+    if ( !cpu_mask )
+        return sbi_rfence_v02_real(fid, 0UL, -1UL, start, size, arg4);
+
+    for_each_cpu ( cpuid, cpu_mask )
+    {
+        /*
+         * Hart IDs might not necessarily be numbered contiguously in
+         * a multiprocessor system.
+         *
+         * This means that it is possible for the hart ID mapping to look like:
+         *  0, 1, 3, 65, 66, 69
+         * In such cases, more than one call to sbi_rfence_v02_real() will be
+         * needed, as a single hmask can only cover sizeof(unsigned long) CPUs:
+         *  1. sbi_rfence_v02_real(hmask=0b1011, hbase=0)
+         *  2. sbi_rfence_v02_real(hmask=0b1011, hbase=65)
+         *
+         * The algorithm below tries to batch as many harts as possible before
+         * making an SBI call. However, batching may not always be possible.
+         * For example, consider the hart ID mapping:
+         *   0, 64, 1, 65, 2, 66 (1)
+         *
+         * Generally, batching is also possible for (1):
+         *    First (0,1,2), then (64,65,66).
+         * It just requires a different approach and updates to the current
+         * algorithm.
+         */
+        hartid = cpuid_to_hartid(cpuid);
+        if ( hmask )
+        {
+            if ( hartid + BITS_PER_LONG <= htop ||
+                 hbase + BITS_PER_LONG <= hartid )
+            {
+                result = sbi_rfence_v02_real(fid, hmask, hbase,
+                                             start, size, arg4);
+                hmask = 0;
+                if ( result )
+                    break;
+            }
+            else if ( hartid < hbase )
+            {
+                /* shift the mask to fit lower hartid */
+                hmask <<= hbase - hartid;
+                hbase = hartid;
+            }
+        }
+
+        if ( !hmask )
+        {
+            hbase = hartid;
+            htop = hartid;
+        }
+        else if ( hartid > htop )
+            htop = hartid;
+
+        hmask |= BIT(hartid - hbase, UL);
+    }
+
+    if ( hmask )
+        result = sbi_rfence_v02_real(fid, hmask, hbase,
+                                     start, size, arg4);
+
+    return result;
+}
+
+static int (* __ro_after_init sbi_rfence)(unsigned long fid,
+                                          const cpumask_t *cpu_mask,
+                                          vaddr_t start,
+                                          size_t size,
+                                          unsigned long arg4,
+                                          unsigned long arg5);
+
+int sbi_remote_sfence_vma(const cpumask_t *cpu_mask, vaddr_t start,
+                          size_t size)
+{
+    ASSERT(sbi_rfence);
+
+    return sbi_rfence(SBI_EXT_RFENCE_REMOTE_SFENCE_VMA,
+                      cpu_mask, start, size, 0, 0);
+}
+
+/* This function must always succeed. */
+#define sbi_get_spec_version()  \
+    sbi_ext_base_func(SBI_EXT_BASE_GET_SPEC_VERSION)
+
+#define sbi_get_firmware_id()   \
+    sbi_ext_base_func(SBI_EXT_BASE_GET_IMP_ID)
+
+#define sbi_get_firmware_version()  \
+    sbi_ext_base_func(SBI_EXT_BASE_GET_IMP_VERSION)
+
+int sbi_probe_extension(long extid)
+{
+    struct sbiret ret;
+
+    ret = sbi_ecall(SBI_EXT_BASE, SBI_EXT_BASE_PROBE_EXT, extid,
+                    0, 0, 0, 0, 0);
+    if ( !ret.error && ret.value )
+        return ret.value;
+
+    return sbi_err_map_xen_errno(ret.error);
+}
+
+static bool sbi_spec_is_0_1(void)
+{
+    return (sbi_spec_version == SBI_SPEC_VERSION_DEFAULT);
+}
+
+bool sbi_has_rfence(void)
+{
+    return (sbi_rfence != NULL);
+}
+
+int __init sbi_init(void)
+{
+    sbi_spec_version = sbi_get_spec_version();
+
+    printk("SBI specification v%u.%u detected\n",
+            sbi_major_version(), sbi_minor_version());
+
+    if ( !sbi_spec_is_0_1() )
+    {
+        long sbi_fw_id = sbi_get_firmware_id();
+        long sbi_fw_version = sbi_get_firmware_version();
+
+        BUG_ON((sbi_fw_id < 0) || (sbi_fw_version < 0));
+
+        printk("SBI implementation ID=%#lx Version=%#lx\n",
+            sbi_fw_id, sbi_fw_version);
+
+        if ( sbi_probe_extension(SBI_EXT_RFENCE) > 0 )
+        {
+            sbi_rfence = sbi_rfence_v02;
+            printk("SBI v0.2 RFENCE extension detected\n");
+        }
+    }
+    else
+        panic("Ooops. SBI spec version 0.1 detected. Need to add support");
+
+    return 0;
+}
diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index b9850a9801..1d81e0b64f 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -9,6 +9,7 @@
 #include <public/version.h>
 
 #include <asm/early_printk.h>
+#include <asm/sbi.h>
 #include <asm/smp.h>
 #include <asm/traps.h>
 
@@ -32,6 +33,8 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
 
     trap_init();
 
+    sbi_init();
+
     setup_fixmap_mappings();
 
     printk("All set up\n");
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 30 08:23:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Sep 2024 08:23:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.807108.1218351 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svBga-0002Q8-H6; Mon, 30 Sep 2024 08:23:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 807108.1218351; Mon, 30 Sep 2024 08:23:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svBga-0002Py-EF; Mon, 30 Sep 2024 08:23:16 +0000
Received: by outflank-mailman (input) for mailman id 807108;
 Mon, 30 Sep 2024 08:23:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBgY-0002Pi-Fe
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:23:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBgY-0007Ws-EB
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:23:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBgY-0001Hc-DO
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:23:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=K+i6OUVxSLxE/Ndr4IQ1rW2rjYxGh74getaQvQ1uNRs=; b=ATkpyMxWkLNTzFGxVedT6Gd8C+
	jQnskAvrVPg+Esz6Dr9L/36zIhh+kSkGKPninplBFpyhg2a98EckQpMC60QVn71B9CZmOJdMT9QNJ
	GbKQgo9D8WQMOyViujnrmq27Ryzm37OBK9j/AxLvZJ/jEfSzSpw1OXpTBWnq41DlTJOs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/irq: allow setting IRQ permissions from GSI instead of pIRQ
Message-Id: <E1svBgY-0001Hc-DO@xenbits.xenproject.org>
Date: Mon, 30 Sep 2024 08:23:14 +0000

commit d6e9a2aab39e810a5ca5bd5f80de7e4591fbd765
Author:     Jiqian Chen <Jiqian.Chen@amd.com>
AuthorDate: Mon Sep 30 10:13:15 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 30 10:13:15 2024 +0200

    x86/irq: allow setting IRQ permissions from GSI instead of pIRQ
    
    Some domains are not aware of the pIRQ abstraction layer that maps
    interrupt sources into Xen space interrupt numbers.  pIRQs values are
    only exposed to domains that have the option to route physical
    interrupts over event channels.
    
    This creates issues for PCI-passthrough from a PVH domain, as some of
    the passthrough related hypercalls use pIRQ as references to physical
    interrupts on the system.  One of such interfaces is
    XEN_DOMCTL_irq_permission, used to grant or revoke access to
    interrupts, takes a pIRQ as the reference to the interrupt to be
    adjusted.
    
    Since PVH doesn't manage interrupts in terms of pIRQs, introduce a new
    hypercall that allows setting interrupt permissions based on GSI value
    rather than pIRQ.
    
    Note the GSI hypercall parameters is translated to an IRQ value (in
    case there are ACPI overrides) before doing the checks.
    
    Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
    Signed-off-by: Huang Rui <ray.huang@amd.com>
    Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domctl.c              | 32 ++++++++++++++++++++++++++++++++
 xen/arch/x86/include/asm/io_apic.h |  2 ++
 xen/arch/x86/io_apic.c             | 19 +++++++++++++++++++
 xen/arch/x86/mpparse.c             |  7 +++----
 xen/include/public/domctl.h        | 10 ++++++++++
 xen/xsm/flask/hooks.c              |  1 +
 6 files changed, 67 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 6c1355e378..96d816cf1a 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -36,6 +36,7 @@
 #include <asm/xstate.h>
 #include <asm/psr.h>
 #include <asm/cpu-policy.h>
+#include <asm/io_apic.h>
 
 static int update_domain_cpu_policy(struct domain *d,
                                     xen_domctl_cpu_policy_t *xdpc)
@@ -237,6 +238,37 @@ long arch_do_domctl(
         break;
     }
 
+    case XEN_DOMCTL_gsi_permission:
+    {
+        int irq;
+        unsigned int gsi = domctl->u.gsi_permission.gsi;
+        uint32_t flags = domctl->u.gsi_permission.flags;
+
+        /* Check only valid bits are set */
+        ret = -EINVAL;
+        if ( flags & ~XEN_DOMCTL_GSI_ACTION_MASK )
+            break;
+
+        irq = gsi_2_irq(gsi);
+        if ( irq <= 0 )
+        {
+            ret = irq ?: -EACCES;
+            break;
+        }
+
+        ret = -EPERM;
+        if ( !irq_access_permitted(currd, irq) ||
+             xsm_irq_permission(XSM_HOOK, d, irq, flags) )
+            break;
+
+        if ( flags )
+            ret = irq_permit_access(d, irq);
+        else
+            ret = irq_deny_access(d, irq);
+
+        break;
+    }
+
     case XEN_DOMCTL_getpageframeinfo3:
     {
         unsigned int num = domctl->u.getpageframeinfo3.num;
diff --git a/xen/arch/x86/include/asm/io_apic.h b/xen/arch/x86/include/asm/io_apic.h
index 78268ea8f6..62456806c7 100644
--- a/xen/arch/x86/include/asm/io_apic.h
+++ b/xen/arch/x86/include/asm/io_apic.h
@@ -213,5 +213,7 @@ unsigned highest_gsi(void);
 
 int ioapic_guest_read( unsigned long physbase, unsigned int reg, u32 *pval);
 int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 val);
+int mp_find_ioapic(unsigned int gsi);
+int gsi_2_irq(unsigned int gsi);
 
 #endif
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index 7727005846..e40d2f7dbd 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -955,6 +955,25 @@ static int pin_2_irq(int idx, int apic, int pin)
     return irq;
 }
 
+int gsi_2_irq(unsigned int gsi)
+{
+    int ioapic, irq;
+    unsigned int pin;
+
+    if ( gsi > highest_gsi() )
+        return -ERANGE;
+
+    ioapic = mp_find_ioapic(gsi);
+    if ( ioapic < 0 )
+        return -EINVAL;
+
+    pin = gsi - io_apic_gsi_base(ioapic);
+
+    irq = apic_pin_2_gsi_irq(ioapic, pin);
+
+    return irq ?: -EINVAL;
+}
+
 static inline int IO_APIC_irq_trigger(int irq)
 {
     int apic, idx, pin;
diff --git a/xen/arch/x86/mpparse.c b/xen/arch/x86/mpparse.c
index 306d8ed97a..e13b83bbe9 100644
--- a/xen/arch/x86/mpparse.c
+++ b/xen/arch/x86/mpparse.c
@@ -842,8 +842,7 @@ static struct mp_ioapic_routing {
 } mp_ioapic_routing[MAX_IO_APICS];
 
 
-static int mp_find_ioapic (
-	int			gsi)
+int mp_find_ioapic(unsigned int gsi)
 {
 	unsigned int		i;
 
@@ -854,7 +853,7 @@ static int mp_find_ioapic (
 			return i;
 	}
 
-	printk(KERN_ERR "ERROR: Unable to locate IOAPIC for GSI %d\n", gsi);
+	printk(KERN_ERR "ERROR: Unable to locate IOAPIC for GSI %u\n", gsi);
 
 	return -1;
 }
@@ -915,7 +914,7 @@ void __init mp_register_ioapic (
 	return;
 }
 
-unsigned __init highest_gsi(void)
+unsigned highest_gsi(void)
 {
 	unsigned x, res = 0;
 	for (x = 0; x < nr_ioapics; x++)
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index 2a49fe46ce..e1028fc524 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -464,6 +464,14 @@ struct xen_domctl_irq_permission {
     uint8_t pad[3];
 };
 
+/* XEN_DOMCTL_gsi_permission */
+struct xen_domctl_gsi_permission {
+    uint32_t gsi;
+#define XEN_DOMCTL_GSI_REVOKE      0
+#define XEN_DOMCTL_GSI_GRANT       1
+#define XEN_DOMCTL_GSI_ACTION_MASK 1
+    uint32_t flags;
+};
 
 /* XEN_DOMCTL_iomem_permission */
 struct xen_domctl_iomem_permission {
@@ -1306,6 +1314,7 @@ struct xen_domctl {
 #define XEN_DOMCTL_get_paging_mempool_size       85
 #define XEN_DOMCTL_set_paging_mempool_size       86
 #define XEN_DOMCTL_dt_overlay                    87
+#define XEN_DOMCTL_gsi_permission                88
 #define XEN_DOMCTL_gdbsx_guestmemio            1000
 #define XEN_DOMCTL_gdbsx_pausevcpu             1001
 #define XEN_DOMCTL_gdbsx_unpausevcpu           1002
@@ -1328,6 +1337,7 @@ struct xen_domctl {
         struct xen_domctl_setdomainhandle   setdomainhandle;
         struct xen_domctl_setdebugging      setdebugging;
         struct xen_domctl_irq_permission    irq_permission;
+        struct xen_domctl_gsi_permission    gsi_permission;
         struct xen_domctl_iomem_permission  iomem_permission;
         struct xen_domctl_ioport_permission ioport_permission;
         struct xen_domctl_hypercall_init    hypercall_init;
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 278ad38c2a..dfa23738cd 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -695,6 +695,7 @@ static int cf_check flask_domctl(struct domain *d, unsigned int cmd,
     case XEN_DOMCTL_shadow_op:
     case XEN_DOMCTL_ioport_permission:
     case XEN_DOMCTL_ioport_mapping:
+    case XEN_DOMCTL_gsi_permission:
 #endif
 #ifdef CONFIG_HAS_PASSTHROUGH
     /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 30 08:23:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Sep 2024 08:23:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.807109.1218354 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svBgj-0002TC-Jq; Mon, 30 Sep 2024 08:23:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 807109.1218354; Mon, 30 Sep 2024 08:23:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svBgj-0002T5-HN; Mon, 30 Sep 2024 08:23:25 +0000
Received: by outflank-mailman (input) for mailman id 807109;
 Mon, 30 Sep 2024 08:23:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBgi-0002Sx-Im
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:23:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBgi-0007X3-I3
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:23:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBgi-0001Ij-GS
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:23:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=95vWqhYh4BLVjz4wE13S0g8G5tgdBmaMbcGzK2ro95U=; b=GQN2+8ztytDHy16Kc6B2Qsy/Vm
	f35SY4S16NpwjEHHz1+VeL9h7WYVr6q5C/SLLaX76D0qrOh7Si7MhLBkEI17+qW/i1tIOWWKZdYGG
	acajiU7m+rXVGyggG8dKy5p2GWn3egUKxg+pzkeFOMezqPRmI1B+/CzkDsKkH7xYEHxo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: Add new function to get gsi from dev
Message-Id: <E1svBgi-0001Ij-GS@xenbits.xenproject.org>
Date: Mon, 30 Sep 2024 08:23:24 +0000

commit b93e5981d25896d9522ba39488b4d5bbe8b02457
Author:     Jiqian Chen <Jiqian.Chen@amd.com>
AuthorDate: Mon Sep 30 10:13:46 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 30 10:13:46 2024 +0200

    tools: Add new function to get gsi from dev
    
    On PVH dom0, when passthrough a device to domU, QEMU and xl tools
    want to use gsi number to do pirq mapping, see QEMU code
    xen_pt_realize->xc_physdev_map_pirq, and xl code
    pci_add_dm_done->xc_physdev_map_pirq, but in current codes, the gsi
    number is got from file /sys/bus/pci/devices/<sbdf>/irq, that is
    wrong, because irq is not equal with gsi, they are in different
    spaces, so pirq mapping fails.
    
    And in current codes, there is no method to get gsi for userspace.
    For above purpose, add new function to get gsi, and the
    corresponding ioctl is implemented on linux kernel side.
    
    Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
    Signed-off-by: Huang Rui <ray.huang@amd.com>
    Signed-off-by: Chen Jiqian <Jiqian.Chen@amd.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/include/xen-sys/Linux/privcmd.h |  7 +++++++
 tools/include/xenctrl.h               |  2 ++
 tools/libs/ctrl/xc_freebsd.c          |  6 ++++++
 tools/libs/ctrl/xc_linux.c            | 20 ++++++++++++++++++++
 tools/libs/ctrl/xc_minios.c           |  6 ++++++
 tools/libs/ctrl/xc_netbsd.c           |  6 ++++++
 tools/libs/ctrl/xc_solaris.c          |  6 ++++++
 7 files changed, 53 insertions(+)

diff --git a/tools/include/xen-sys/Linux/privcmd.h b/tools/include/xen-sys/Linux/privcmd.h
index bc60e8fd55..607dfa2287 100644
--- a/tools/include/xen-sys/Linux/privcmd.h
+++ b/tools/include/xen-sys/Linux/privcmd.h
@@ -95,6 +95,11 @@ typedef struct privcmd_mmap_resource {
 	__u64 addr;
 } privcmd_mmap_resource_t;
 
+typedef struct privcmd_pcidev_get_gsi {
+	__u32 sbdf;
+	__u32 gsi;
+} privcmd_pcidev_get_gsi_t;
+
 /*
  * @cmd: IOCTL_PRIVCMD_HYPERCALL
  * @arg: &privcmd_hypercall_t
@@ -114,6 +119,8 @@ typedef struct privcmd_mmap_resource {
 	_IOC(_IOC_NONE, 'P', 6, sizeof(domid_t))
 #define IOCTL_PRIVCMD_MMAP_RESOURCE				\
 	_IOC(_IOC_NONE, 'P', 7, sizeof(privcmd_mmap_resource_t))
+#define IOCTL_PRIVCMD_PCIDEV_GET_GSI			\
+	_IOC(_IOC_NONE, 'P', 10, sizeof(privcmd_pcidev_get_gsi_t))
 #define IOCTL_PRIVCMD_UNIMPLEMENTED				\
 	_IOC(_IOC_NONE, 'P', 0xFF, 0)
 
diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 2c4608c09a..924f9a35f7 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -1642,6 +1642,8 @@ int xc_physdev_unmap_pirq(xc_interface *xch,
                           uint32_t domid,
                           int pirq);
 
+int xc_pcidev_get_gsi(xc_interface *xch, uint32_t sbdf);
+
 /*
  *  LOGGING AND ERROR REPORTING
  */
diff --git a/tools/libs/ctrl/xc_freebsd.c b/tools/libs/ctrl/xc_freebsd.c
index 9dd48a3a08..9019fc6633 100644
--- a/tools/libs/ctrl/xc_freebsd.c
+++ b/tools/libs/ctrl/xc_freebsd.c
@@ -60,6 +60,12 @@ void *xc_memalign(xc_interface *xch, size_t alignment, size_t size)
     return ptr;
 }
 
+int xc_pcidev_get_gsi(xc_interface *xch, uint32_t sbdf)
+{
+    errno = ENOSYS;
+    return -1;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/tools/libs/ctrl/xc_linux.c b/tools/libs/ctrl/xc_linux.c
index c67c71c08b..92591e49a1 100644
--- a/tools/libs/ctrl/xc_linux.c
+++ b/tools/libs/ctrl/xc_linux.c
@@ -66,6 +66,26 @@ void *xc_memalign(xc_interface *xch, size_t alignment, size_t size)
     return ptr;
 }
 
+int xc_pcidev_get_gsi(xc_interface *xch, uint32_t sbdf)
+{
+    int ret;
+    privcmd_pcidev_get_gsi_t dev_gsi = {
+        .sbdf = sbdf,
+        .gsi = 0,
+    };
+
+    ret = ioctl(xencall_fd(xch->xcall),
+                IOCTL_PRIVCMD_PCIDEV_GET_GSI, &dev_gsi);
+
+    if (ret < 0) {
+        PERROR("Failed to get gsi from dev");
+    } else {
+        ret = dev_gsi.gsi;
+    }
+
+    return ret;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/tools/libs/ctrl/xc_minios.c b/tools/libs/ctrl/xc_minios.c
index 3dea7a78a5..462af827b3 100644
--- a/tools/libs/ctrl/xc_minios.c
+++ b/tools/libs/ctrl/xc_minios.c
@@ -47,6 +47,12 @@ void *xc_memalign(xc_interface *xch, size_t alignment, size_t size)
     return memalign(alignment, size);
 }
 
+int xc_pcidev_get_gsi(xc_interface *xch, uint32_t sbdf)
+{
+    errno = ENOSYS;
+    return -1;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/tools/libs/ctrl/xc_netbsd.c b/tools/libs/ctrl/xc_netbsd.c
index 3197993762..1318d4d906 100644
--- a/tools/libs/ctrl/xc_netbsd.c
+++ b/tools/libs/ctrl/xc_netbsd.c
@@ -63,6 +63,12 @@ void *xc_memalign(xc_interface *xch, size_t alignment, size_t size)
     return valloc(size);
 }
 
+int xc_pcidev_get_gsi(xc_interface *xch, uint32_t sbdf)
+{
+    errno = ENOSYS;
+    return -1;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/tools/libs/ctrl/xc_solaris.c b/tools/libs/ctrl/xc_solaris.c
index 5128f3f0f4..049e28d55c 100644
--- a/tools/libs/ctrl/xc_solaris.c
+++ b/tools/libs/ctrl/xc_solaris.c
@@ -32,6 +32,12 @@ void *xc_memalign(xc_interface *xch, size_t alignment, size_t size)
     return memalign(alignment, size);
 }
 
+int xc_pcidev_get_gsi(xc_interface *xch, uint32_t sbdf)
+{
+    errno = ENOSYS;
+    return -1;
+}
+
 /*
  * Local variables:
  * mode: C
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 30 08:23:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Sep 2024 08:23:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.807110.1218359 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svBgt-0002Vr-Lf; Mon, 30 Sep 2024 08:23:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 807110.1218359; Mon, 30 Sep 2024 08:23:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svBgt-0002Vj-Iu; Mon, 30 Sep 2024 08:23:35 +0000
Received: by outflank-mailman (input) for mailman id 807110;
 Mon, 30 Sep 2024 08:23:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBgs-0002VY-M2
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:23:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBgs-0007XA-LJ
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:23:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svBgs-0001LK-Ka
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 08:23:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OBE2e1VSe68D5U1Uatu96F4BkJL09XF84RJ8txK9DSk=; b=D9mKNKtsK/bOzYETDzXUHfULGY
	yaIiTTPN64LFbb3OGCLstPdxvLhQPJyf0i0vY4iJzN+b+ou51Sy+I+MD3M6OIhDOo5svwIqsv7afb
	9TBn+BYiNKpBJSX5hcX+Vm+Go/iKWhQU23Wk07EaK/sPbIm0pJY35EnVN8hGzw9rP1So=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: Add new function to do PIRQ (un)map on PVH dom0
Message-Id: <E1svBgs-0001LK-Ka@xenbits.xenproject.org>
Date: Mon, 30 Sep 2024 08:23:34 +0000

commit f97f885c719849f55bade3b6303206e7717ecff8
Author:     Jiqian Chen <Jiqian.Chen@amd.com>
AuthorDate: Mon Sep 30 10:14:01 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 30 10:14:01 2024 +0200

    tools: Add new function to do PIRQ (un)map on PVH dom0
    
    When dom0 is PVH, and passthrough a device to dumU, xl will
    use the gsi number of device to do a pirq mapping, see
    pci_add_dm_done->xc_physdev_map_pirq, but the gsi number is
    got from file /sys/bus/pci/devices/<sbdf>/irq, that confuses
    irq and gsi, they are in different space and are not equal,
    so it will fail when mapping.
    To solve this issue, to get the real gsi and add a new function
    xc_physdev_map_pirq_gsi to get a free pirq for gsi.
    Note: why not use current function xc_physdev_map_pirq, because
    it doesn't support to allocate a free pirq, what's more, to
    prevent changing it and affecting its callers, so add
    xc_physdev_map_pirq_gsi.
    
    Besides, PVH dom0 doesn't have PIRQs flag, it doesn't do
    PHYSDEVOP_map_pirq for each gsi. So grant function callstack
    pci_add_dm_done->XEN_DOMCTL_irq_permission will fail at function
    domain_pirq_to_irq. And old hypercall XEN_DOMCTL_irq_permission
    requires passing in pirq, it is not suitable for PVH dom0 that
    doesn't have PIRQs to grant irq permission.
    To solve this issue, use the another hypercall
    XEN_DOMCTL_gsi_permission to grant the permission of irq(
    translate from gsi) to dumU when dom0 has no PIRQs.
    
    Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
    Signed-off-by: Huang Rui <ray.huang@amd.com>
    Signed-off-by: Chen Jiqian <Jiqian.Chen@amd.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/include/xenctrl.h       |  10 ++++
 tools/libs/ctrl/xc_domain.c   |  15 ++++++
 tools/libs/ctrl/xc_physdev.c  |  27 +++++++++++
 tools/libs/light/libxl_arch.h |   6 +++
 tools/libs/light/libxl_arm.c  |  15 ++++++
 tools/libs/light/libxl_pci.c  | 110 +++++++++++++++++++++++++-----------------
 tools/libs/light/libxl_x86.c  |  72 +++++++++++++++++++++++++++
 7 files changed, 210 insertions(+), 45 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 924f9a35f7..29617585c5 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -1383,6 +1383,11 @@ int xc_domain_irq_permission(xc_interface *xch,
                              uint32_t pirq,
                              bool allow_access);
 
+int xc_domain_gsi_permission(xc_interface *xch,
+                             uint32_t domid,
+                             uint32_t gsi,
+                             uint32_t flags);
+
 int xc_domain_iomem_permission(xc_interface *xch,
                                uint32_t domid,
                                unsigned long first_mfn,
@@ -1638,6 +1643,11 @@ int xc_physdev_map_pirq_msi(xc_interface *xch,
                             int entry_nr,
                             uint64_t table_base);
 
+int xc_physdev_map_pirq_gsi(xc_interface *xch,
+                            uint32_t domid,
+                            int gsi,
+                            int *pirq);
+
 int xc_physdev_unmap_pirq(xc_interface *xch,
                           uint32_t domid,
                           int pirq);
diff --git a/tools/libs/ctrl/xc_domain.c b/tools/libs/ctrl/xc_domain.c
index f2d9d14b4d..e3538ec0ba 100644
--- a/tools/libs/ctrl/xc_domain.c
+++ b/tools/libs/ctrl/xc_domain.c
@@ -1394,6 +1394,21 @@ int xc_domain_irq_permission(xc_interface *xch,
     return do_domctl(xch, &domctl);
 }
 
+int xc_domain_gsi_permission(xc_interface *xch,
+                             uint32_t domid,
+                             uint32_t gsi,
+                             uint32_t flags)
+{
+    struct xen_domctl domctl = {
+        .cmd = XEN_DOMCTL_gsi_permission,
+        .domain = domid,
+        .u.gsi_permission.gsi = gsi,
+        .u.gsi_permission.flags = flags,
+    };
+
+    return do_domctl(xch, &domctl);
+}
+
 int xc_domain_iomem_permission(xc_interface *xch,
                                uint32_t domid,
                                unsigned long first_mfn,
diff --git a/tools/libs/ctrl/xc_physdev.c b/tools/libs/ctrl/xc_physdev.c
index 460a8e779c..25e686d7b3 100644
--- a/tools/libs/ctrl/xc_physdev.c
+++ b/tools/libs/ctrl/xc_physdev.c
@@ -95,6 +95,33 @@ int xc_physdev_map_pirq_msi(xc_interface *xch,
     return rc;
 }
 
+int xc_physdev_map_pirq_gsi(xc_interface *xch,
+                            uint32_t domid,
+                            int gsi,
+                            int *pirq)
+{
+    int rc;
+    struct physdev_map_pirq map = {
+        .domid = domid,
+        .type = MAP_PIRQ_TYPE_GSI,
+        .index = gsi,
+    };
+
+    if ( !pirq )
+    {
+        errno = EINVAL;
+        return -1;
+    }
+    map.pirq = *pirq;
+
+    rc = do_physdev_op(xch, PHYSDEVOP_map_pirq, &map, sizeof(map));
+
+    if ( !rc )
+        *pirq = map.pirq;
+
+    return rc;
+}
+
 int xc_physdev_unmap_pirq(xc_interface *xch,
                           uint32_t domid,
                           int pirq)
diff --git a/tools/libs/light/libxl_arch.h b/tools/libs/light/libxl_arch.h
index f88f11d6de..c8ef52ddbe 100644
--- a/tools/libs/light/libxl_arch.h
+++ b/tools/libs/light/libxl_arch.h
@@ -91,6 +91,12 @@ void libxl__arch_update_domain_config(libxl__gc *gc,
                                       libxl_domain_config *dst,
                                       const libxl_domain_config *src);
 
+_hidden
+int libxl__arch_hvm_map_gsi(libxl__gc *gc, uint32_t sbdf, uint32_t domid);
+_hidden
+int libxl__arch_hvm_unmap_gsi(libxl__gc *gc, uint32_t sbdf, uint32_t domid);
+_hidden
+bool libxl__arch_local_domain_has_pirq_notion(libxl__gc *gc);
 #if defined(__i386__) || defined(__x86_64__)
 
 #define LAPIC_BASE_ADDRESS  0xfee00000
diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
index a4029e3ac8..5a9db5e85f 100644
--- a/tools/libs/light/libxl_arm.c
+++ b/tools/libs/light/libxl_arm.c
@@ -1774,6 +1774,21 @@ void libxl__arch_update_domain_config(libxl__gc *gc,
 {
 }
 
+int libxl__arch_hvm_map_gsi(libxl__gc *gc, uint32_t sbdf, uint32_t domid)
+{
+    return ERROR_INVAL;
+}
+
+int libxl__arch_hvm_unmap_gsi(libxl__gc *gc, uint32_t sbdf, uint32_t domid)
+{
+    return ERROR_INVAL;
+}
+
+bool libxl__arch_local_domain_has_pirq_notion(libxl__gc *gc)
+{
+    return true;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/tools/libs/light/libxl_pci.c b/tools/libs/light/libxl_pci.c
index 96cb4da079..8ef6a7b5fe 100644
--- a/tools/libs/light/libxl_pci.c
+++ b/tools/libs/light/libxl_pci.c
@@ -17,6 +17,7 @@
 #include "libxl_osdeps.h" /* must come before any other headers */
 
 #include "libxl_internal.h"
+#include "libxl_arch.h"
 
 #define PCI_BDF                "%04x:%02x:%02x.%01x"
 #define PCI_BDF_SHORT          "%02x:%02x.%01x"
@@ -1478,32 +1479,42 @@ static void pci_add_dm_done(libxl__egc *egc,
     fclose(f);
     if (!pci_supp_legacy_irq())
         goto out_no_irq;
-    sysfs_path = GCSPRINTF(SYSFS_PCI_DEV"/"PCI_BDF"/irq", pci->domain,
-                                pci->bus, pci->dev, pci->func);
-    f = fopen(sysfs_path, "r");
-    if (f == NULL) {
-        LOGED(ERROR, domainid, "Couldn't open %s", sysfs_path);
-        goto out_no_irq;
-    }
-    if ((fscanf(f, "%u", &irq) == 1) && irq) {
-        r = xc_physdev_map_pirq(ctx->xch, domid, irq, &irq);
-        if (r < 0) {
-            LOGED(ERROR, domainid, "xc_physdev_map_pirq irq=%d (error=%d)",
-                  irq, r);
-            fclose(f);
-            rc = ERROR_FAIL;
+
+    /* When dom0 is PVH, should use gsi to map pirq and grant permission */
+    if (libxl__arch_local_domain_has_pirq_notion(gc) == false) {
+        rc = libxl__arch_hvm_map_gsi(gc, pci_encode_bdf(pci), domid);
+        if (rc) {
+            LOGD(ERROR, domainid, "libxl__arch_hvm_map_gsi failed");
             goto out;
         }
-        r = xc_domain_irq_permission(ctx->xch, domid, irq, 1);
-        if (r < 0) {
-            LOGED(ERROR, domainid,
-                  "xc_domain_irq_permission irq=%d (error=%d)", irq, r);
-            fclose(f);
-            rc = ERROR_FAIL;
-            goto out;
+    } else {
+        sysfs_path = GCSPRINTF(SYSFS_PCI_DEV"/"PCI_BDF"/irq", pci->domain,
+                                    pci->bus, pci->dev, pci->func);
+        f = fopen(sysfs_path, "r");
+        if (f == NULL) {
+            LOGED(ERROR, domainid, "Couldn't open %s", sysfs_path);
+            goto out_no_irq;
+        }
+        if ((fscanf(f, "%u", &irq) == 1) && irq) {
+            r = xc_physdev_map_pirq(ctx->xch, domid, irq, &irq);
+            if (r < 0) {
+                LOGED(ERROR, domainid, "xc_physdev_map_pirq irq=%d (error=%d)",
+                    irq, r);
+                fclose(f);
+                rc = ERROR_FAIL;
+                goto out;
+            }
+            r = xc_domain_irq_permission(ctx->xch, domid, irq, 1);
+            if (r < 0) {
+                LOGED(ERROR, domainid,
+                    "xc_domain_irq_permission irq=%d (error=%d)", irq, r);
+                fclose(f);
+                rc = ERROR_FAIL;
+                goto out;
+            }
         }
+        fclose(f);
     }
-    fclose(f);
 
     /* Don't restrict writes to the PCI config space from this VM */
     if (pci->permissive) {
@@ -2229,33 +2240,42 @@ skip_bar:
     if (!pci_supp_legacy_irq())
         goto skip_legacy_irq;
 
-    sysfs_path = GCSPRINTF(SYSFS_PCI_DEV"/"PCI_BDF"/irq", pci->domain,
-                           pci->bus, pci->dev, pci->func);
-
-    f = fopen(sysfs_path, "r");
-    if (f == NULL) {
-        LOGED(ERROR, domid, "Couldn't open %s", sysfs_path);
-        goto skip_legacy_irq;
-    }
+    /* When dom0 is PVH, should use gsi to unmap pirq and deny permission */
+    if (libxl__arch_local_domain_has_pirq_notion(gc) == false) {
+        rc = libxl__arch_hvm_unmap_gsi(gc, pci_encode_bdf(pci), domid);
+        if (rc) {
+            LOGD(ERROR, domid, "libxl__arch_hvm_unmap_gsi failed");
+            goto out;
+        }
+    } else {
+        sysfs_path = GCSPRINTF(SYSFS_PCI_DEV"/"PCI_BDF"/irq", pci->domain,
+                            pci->bus, pci->dev, pci->func);
 
-    if ((fscanf(f, "%u", &irq) == 1) && irq) {
-        rc = xc_physdev_unmap_pirq(ctx->xch, domid, irq);
-        if (rc < 0) {
-            /*
-             * QEMU may have already unmapped the IRQ. So the error
-             * may be spurious. For now, still print an error message as
-             * it is not easy to distinguished between valid and
-             * spurious error.
-             */
-            LOGED(ERROR, domid, "xc_physdev_unmap_pirq irq=%d", irq);
+        f = fopen(sysfs_path, "r");
+        if (f == NULL) {
+            LOGED(ERROR, domid, "Couldn't open %s", sysfs_path);
+            goto skip_legacy_irq;
         }
-        rc = xc_domain_irq_permission(ctx->xch, domid, irq, 0);
-        if (rc < 0) {
-            LOGED(ERROR, domid, "xc_domain_irq_permission irq=%d", irq);
+
+        if ((fscanf(f, "%u", &irq) == 1) && irq) {
+            rc = xc_physdev_unmap_pirq(ctx->xch, domid, irq);
+            if (rc < 0) {
+                /*
+                 * QEMU may have already unmapped the IRQ. So the error
+                 * may be spurious. For now, still print an error message as
+                 * it is not easy to distinguished between valid and
+                 * spurious error.
+                 */
+                LOGED(ERROR, domid, "xc_physdev_unmap_pirq irq=%d", irq);
+            }
+            rc = xc_domain_irq_permission(ctx->xch, domid, irq, 0);
+            if (rc < 0) {
+                LOGED(ERROR, domid, "xc_domain_irq_permission irq=%d", irq);
+            }
         }
-    }
 
-    fclose(f);
+        fclose(f);
+    }
 
 skip_legacy_irq:
 
diff --git a/tools/libs/light/libxl_x86.c b/tools/libs/light/libxl_x86.c
index 60643d6f53..a3164a3077 100644
--- a/tools/libs/light/libxl_x86.c
+++ b/tools/libs/light/libxl_x86.c
@@ -879,6 +879,78 @@ void libxl__arch_update_domain_config(libxl__gc *gc,
                                  libxl_defbool_val(src->b_info.u.hvm.pirq));
 }
 
+bool libxl__arch_local_domain_has_pirq_notion(libxl__gc *gc)
+{
+    int r;
+    xc_domaininfo_t info;
+
+    r = xc_domain_getinfo_single(CTX->xch, LIBXL_TOOLSTACK_DOMID, &info);
+    if (r == 0) {
+        if (!(info.flags & XEN_DOMINF_hvm_guest) ||
+            (info.arch_config.emulation_flags & XEN_X86_EMU_USE_PIRQ))
+            return true;
+    } else {
+        LOGE(ERROR, "getdomaininfo failed ret=%d", r);
+    }
+
+    return false;
+}
+
+int libxl__arch_hvm_map_gsi(libxl__gc *gc, uint32_t sbdf, uint32_t domid)
+{
+    int pirq = -1, gsi, r;
+
+    gsi = xc_pcidev_get_gsi(CTX->xch, sbdf);
+    if (gsi < 0) {
+        return ERROR_FAIL;
+    }
+
+    r = xc_physdev_map_pirq_gsi(CTX->xch, domid, gsi, &pirq);
+    if (r < 0) {
+        LOGED(ERROR, domid, "xc_physdev_map_pirq_gsi gsi=%d", gsi);
+        return ERROR_FAIL;
+    }
+
+    r = xc_domain_gsi_permission(CTX->xch, domid, gsi, XEN_DOMCTL_GSI_GRANT);
+    if (r < 0) {
+        LOGED(ERROR, domid, "xc_domain_gsi_permission gsi=%d", gsi);
+        return ERROR_FAIL;
+    }
+
+    return 0;
+}
+
+int libxl__arch_hvm_unmap_gsi(libxl__gc *gc, uint32_t sbdf, uint32_t domid)
+{
+    int pirq = -1, gsi, r;
+
+    gsi = xc_pcidev_get_gsi(CTX->xch, sbdf);
+    if (gsi < 0) {
+        return ERROR_FAIL;
+    }
+
+    /* Before unmapping, use mapping to get the already mapped pirq first */
+    r = xc_physdev_map_pirq_gsi(CTX->xch, domid, gsi, &pirq);
+    if (r < 0) {
+        LOGED(ERROR, domid, "xc_physdev_map_pirq_gsi gsi=%d", gsi);
+        return ERROR_FAIL;
+    }
+
+    r = xc_physdev_unmap_pirq(CTX->xch, domid, pirq);
+    if (r < 0) {
+        LOGED(ERROR, domid, "xc_physdev_unmap_pirq gsi=%d", gsi);
+        return ERROR_FAIL;
+    }
+
+    r = xc_domain_gsi_permission(CTX->xch, domid, gsi, XEN_DOMCTL_GSI_REVOKE);
+    if (r < 0) {
+        LOGED(ERROR, domid, "xc_domain_gsi_permission gsi=%d", gsi);
+        return ERROR_FAIL;
+    }
+
+    return 0;
+}
+
 /*
  * Local variables:
  * mode: C
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Sep 30 17:00:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Sep 2024 17:00:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.807598.1219153 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svJkj-0003wk-0O; Mon, 30 Sep 2024 17:00:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 807598.1219153; Mon, 30 Sep 2024 17:00:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svJki-0003wC-TJ; Mon, 30 Sep 2024 17:00:04 +0000
Received: by outflank-mailman (input) for mailman id 807598;
 Mon, 30 Sep 2024 17:00:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svJki-0003lA-Dq
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 17:00:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svJki-0000Se-2D
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 17:00:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svJki-0007tu-0U
 for xen-changelog@lists.xenproject.org; Mon, 30 Sep 2024 17:00:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oQniMB28u2sPZek7ri1CIjHXa2SSp6FOxeZuvLD0Ecg=; b=JglLJ0Xom6c1yoKQU9AbcwBtI9
	B69wHSr/StvWTihhlmzHqUourBWPQRl+aSZ2YRJbCNhqJzsRiy8kYdZbYPK70g7l4HPcQl9PMSWeT
	ZT1IWRVpE34/++lAmSiXLmo0aC1f5VsxTKFBrdPyOsNLiQ5jeks9XvWsxpIY3D/nG1Ao=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] drivers/video: Convert source files to UTF-8
Message-Id: <E1svJki-0007tu-0U@xenbits.xenproject.org>
Date: Mon, 30 Sep 2024 17:00:04 +0000

commit 94423b8f75bd786043f8e9bb2809675007225329
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Thu Sep 26 16:46:06 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 30 17:52:24 2024 +0100

    drivers/video: Convert source files to UTF-8
    
    Most of the tools nowadays assume this encoding.
    These files do not specify any encoding so convert them to the default.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/drivers/video/font_8x14.c | 256 +++++++++++++++++++++---------------------
 xen/drivers/video/font_8x16.c | 256 +++++++++++++++++++++---------------------
 xen/drivers/video/font_8x8.c  | 256 +++++++++++++++++++++---------------------
 3 files changed, 384 insertions(+), 384 deletions(-)

diff --git a/xen/drivers/video/font_8x14.c b/xen/drivers/video/font_8x14.c
index e80d178c38..b0210de3e1 100644
--- a/xen/drivers/video/font_8x14.c
+++ b/xen/drivers/video/font_8x14.c
@@ -2059,7 +2059,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 128 0x80 ' */
+    /* 128 0x80 'Ç' */
     0x00, /* 00000000 */
     0x3c, /* 00111100 */
     0x66, /* 01100110 */
@@ -2075,7 +2075,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x70, /* 01110000 */
     0x00, /* 00000000 */
 
-    /* 129 0x81 ' */
+    /* 129 0x81 'ü' */
     0x00, /* 00000000 */
     0xcc, /* 11001100 */
     0x00, /* 00000000 */
@@ -2091,7 +2091,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 130 0x82 ' */
+    /* 130 0x82 'é' */
     0x0c, /* 00001100 */
     0x18, /* 00011000 */
     0x30, /* 00110000 */
@@ -2107,7 +2107,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 131 0x83 ' */
+    /* 131 0x83 'â' */
     0x10, /* 00010000 */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
@@ -2123,7 +2123,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 132 0x84 ' */
+    /* 132 0x84 'ä' */
     0x00, /* 00000000 */
     0xcc, /* 11001100 */
     0x00, /* 00000000 */
@@ -2139,7 +2139,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 133 0x85 ' */
+    /* 133 0x85 'à' */
     0x60, /* 01100000 */
     0x30, /* 00110000 */
     0x18, /* 00011000 */
@@ -2155,7 +2155,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 134 0x86 ' */
+    /* 134 0x86 'å' */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
     0x38, /* 00111000 */
@@ -2171,7 +2171,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 135 0x87 ' */
+    /* 135 0x87 'ç' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -2187,7 +2187,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x70, /* 01110000 */
     0x00, /* 00000000 */
 
-    /* 136 0x88 ' */
+    /* 136 0x88 'ê' */
     0x10, /* 00010000 */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
@@ -2203,7 +2203,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 137 0x89 ' */
+    /* 137 0x89 'ë' */
     0x00, /* 00000000 */
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
@@ -2219,7 +2219,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 138 0x8a ' */
+    /* 138 0x8a 'è' */
     0x60, /* 01100000 */
     0x30, /* 00110000 */
     0x18, /* 00011000 */
@@ -2235,7 +2235,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 139 0x8b ' */
+    /* 139 0x8b 'ï' */
     0x00, /* 00000000 */
     0x66, /* 01100110 */
     0x00, /* 00000000 */
@@ -2251,7 +2251,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 140 0x8c ' */
+    /* 140 0x8c 'î' */
     0x18, /* 00011000 */
     0x3c, /* 00111100 */
     0x66, /* 01100110 */
@@ -2267,7 +2267,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 141 0x8d ' */
+    /* 141 0x8d 'ì' */
     0x60, /* 01100000 */
     0x30, /* 00110000 */
     0x18, /* 00011000 */
@@ -2283,7 +2283,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 142 0x8e ' */
+    /* 142 0x8e 'Ä' */
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
     0x10, /* 00010000 */
@@ -2299,7 +2299,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 143 0x8f ' */
+    /* 143 0x8f 'Å' */
     0x6c, /* 01101100 */
     0x38, /* 00111000 */
     0x10, /* 00010000 */
@@ -2315,7 +2315,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 144 0x90 ' */
+    /* 144 0x90 'É' */
     0x18, /* 00011000 */
     0x00, /* 00000000 */
     0xfe, /* 11111110 */
@@ -2331,7 +2331,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 145 0x91 ' */
+    /* 145 0x91 'æ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -2347,7 +2347,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 146 0x92 'È */
+    /* 146 0x92 'Æ' */
     0x00, /* 00000000 */
     0x3e, /* 00111110 */
     0x6c, /* 01101100 */
@@ -2363,7 +2363,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 147 0x93 'ň */
+    /* 147 0x93 'ô' */
     0x10, /* 00010000 */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
@@ -2379,7 +2379,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 148 0x94 'ǈ */
+    /* 148 0x94 'ö' */
     0x00, /* 00000000 */
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
@@ -2395,7 +2395,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 149 0x95 'Ɉ */
+    /* 149 0x95 'ò' */
     0x60, /* 01100000 */
     0x30, /* 00110000 */
     0x18, /* 00011000 */
@@ -2411,7 +2411,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 150 0x96 'ˈ */
+    /* 150 0x96 'û' */
     0x30, /* 00110000 */
     0x78, /* 01111000 */
     0xcc, /* 11001100 */
@@ -2427,7 +2427,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 151 0x97 '͈ */
+    /* 151 0x97 'ù' */
     0x60, /* 01100000 */
     0x30, /* 00110000 */
     0x18, /* 00011000 */
@@ -2443,7 +2443,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 152 0x98 'ψ */
+    /* 152 0x98 'ÿ' */
     0x00, /* 00000000 */
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
@@ -2459,7 +2459,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x0c, /* 00001100 */
     0x78, /* 01111000 */
 
-    /* 153 0x99 'ш */
+    /* 153 0x99 'Ö' */
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
     0x7c, /* 01111100 */
@@ -2475,7 +2475,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 154 0x9a 'ӈ */
+    /* 154 0x9a 'Ü' */
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
     0xc6, /* 11000110 */
@@ -2491,7 +2491,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 155 0x9b 'Ո */
+    /* 155 0x9b '¢' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x7c, /* 01111100 */
@@ -2507,7 +2507,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 156 0x9c '׈ */
+    /* 156 0x9c '£' */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
     0x64, /* 01100100 */
@@ -2523,7 +2523,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 157 0x9d 'و */
+    /* 157 0x9d '¥' */
     0x00, /* 00000000 */
     0x66, /* 01100110 */
     0x66, /* 01100110 */
@@ -2539,7 +2539,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 158 0x9e 'ۈ */
+    /* 158 0x9e '₧' */
     0xf8, /* 11111000 */
     0xcc, /* 11001100 */
     0xcc, /* 11001100 */
@@ -2555,7 +2555,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 159 0x9f '݈ */
+    /* 159 0x9f 'ƒ' */
     0x0e, /* 00001110 */
     0x1b, /* 00011011 */
     0x18, /* 00011000 */
@@ -2571,7 +2571,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 160 0xa0 '' */
+    /* 160 0xa0 'á' */
     0x18, /* 00011000 */
     0x30, /* 00110000 */
     0x60, /* 01100000 */
@@ -2587,7 +2587,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 161 0xa1 '' */
+    /* 161 0xa1 'í' */
     0x0c, /* 00001100 */
     0x18, /* 00011000 */
     0x30, /* 00110000 */
@@ -2603,7 +2603,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 162 0xa2 '' */
+    /* 162 0xa2 'ó' */
     0x18, /* 00011000 */
     0x30, /* 00110000 */
     0x60, /* 01100000 */
@@ -2619,7 +2619,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 163 0xa3 '' */
+    /* 163 0xa3 'ú' */
     0x18, /* 00011000 */
     0x30, /* 00110000 */
     0x60, /* 01100000 */
@@ -2635,7 +2635,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 164 0xa4 '' */
+    /* 164 0xa4 'ñ' */
     0x00, /* 00000000 */
     0x76, /* 01110110 */
     0xdc, /* 11011100 */
@@ -2651,7 +2651,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 165 0xa5 '' */
+    /* 165 0xa5 'Ñ' */
     0xdc, /* 11011100 */
     0x00, /* 00000000 */
     0xc6, /* 11000110 */
@@ -2667,7 +2667,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 166 0xa6 '' */
+    /* 166 0xa6 'ª' */
     0x00, /* 00000000 */
     0x3c, /* 00111100 */
     0x6c, /* 01101100 */
@@ -2683,7 +2683,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 167 0xa7 '' */
+    /* 167 0xa7 'º' */
     0x00, /* 00000000 */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
@@ -2699,7 +2699,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 168 0xa8 '' */
+    /* 168 0xa8 '¿' */
     0x00, /* 00000000 */
     0x30, /* 00110000 */
     0x30, /* 00110000 */
@@ -2715,7 +2715,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 169 0xa9 '' */
+    /* 169 0xa9 '⌐' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -2731,7 +2731,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 170 0xaa '' */
+    /* 170 0xaa '¬' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -2747,7 +2747,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 171 0xab '' */
+    /* 171 0xab '½' */
     0x60, /* 01100000 */
     0xe0, /* 11100000 */
     0x62, /* 01100010 */
@@ -2763,7 +2763,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x3e, /* 00111110 */
     0x00, /* 00000000 */
 
-    /* 172 0xac '' */
+    /* 172 0xac '¼' */
     0x60, /* 01100000 */
     0xe0, /* 11100000 */
     0x62, /* 01100010 */
@@ -2779,7 +2779,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x06, /* 00000110 */
     0x00, /* 00000000 */
 
-    /* 173 0xad '' */
+    /* 173 0xad '¡' */
     0x00, /* 00000000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -2795,7 +2795,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 174 0xae '' */
+    /* 174 0xae '«' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -2811,7 +2811,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 175 0xaf '' */
+    /* 175 0xaf '»' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -2827,7 +2827,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 176 0xb0 '' */
+    /* 176 0xb0 '░' */
     0x44, /* 01000100 */
     0x11, /* 00010001 */
     0x44, /* 01000100 */
@@ -2843,7 +2843,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x44, /* 01000100 */
     0x11, /* 00010001 */
 
-    /* 177 0xb1 '' */
+    /* 177 0xb1 '▒' */
     0xaa, /* 10101010 */
     0x55, /* 01010101 */
     0xaa, /* 10101010 */
@@ -2859,7 +2859,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0xaa, /* 10101010 */
     0x55, /* 01010101 */
 
-    /* 178 0xb2 '' */
+    /* 178 0xb2 '▓' */
     0x77, /* 01110111 */
     0xdd, /* 11011101 */
     0x77, /* 01110111 */
@@ -2875,7 +2875,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x77, /* 01110111 */
     0xdd, /* 11011101 */
 
-    /* 179 0xb3 '' */
+    /* 179 0xb3 '│' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -2891,7 +2891,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 180 0xb4 '' */
+    /* 180 0xb4 '┤' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -2907,7 +2907,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 181 0xb5 '' */
+    /* 181 0xb5 '╡' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -2923,7 +2923,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 182 0xb6 '' */
+    /* 182 0xb6 '╢' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -2939,7 +2939,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 183 0xb7 '' */
+    /* 183 0xb7 '╖' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -2955,7 +2955,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 184 0xb8 '' */
+    /* 184 0xb8 '╕' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -2971,7 +2971,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 185 0xb9 '' */
+    /* 185 0xb9 '╣' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -2987,7 +2987,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 186 0xba '' */
+    /* 186 0xba '║' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3003,7 +3003,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 187 0xbb '' */
+    /* 187 0xbb '╗' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3019,7 +3019,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 188 0xbc '' */
+    /* 188 0xbc '╝' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3035,7 +3035,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 189 0xbd '' */
+    /* 189 0xbd '╜' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3051,7 +3051,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 190 0xbe '' */
+    /* 190 0xbe '╛' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3067,7 +3067,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 191 0xbf '' */
+    /* 191 0xbf '┐' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3083,7 +3083,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 192 0xc0 '' */
+    /* 192 0xc0 '└' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3099,7 +3099,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 193 0xc1 '' */
+    /* 193 0xc1 '┴' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3115,7 +3115,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 194 0xc2 '' */
+    /* 194 0xc2 '┬' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3131,7 +3131,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 195 0xc3 '' */
+    /* 195 0xc3 '├' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3147,7 +3147,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 196 0xc4 '' */
+    /* 196 0xc4 '─' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3163,7 +3163,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 197 0xc5 '' */
+    /* 197 0xc5 '┼' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3179,7 +3179,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 198 0xc6 '' */
+    /* 198 0xc6 '╞' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3195,7 +3195,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 199 0xc7 '' */
+    /* 199 0xc7 '╟' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3211,7 +3211,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 200 0xc8 '' */
+    /* 200 0xc8 '╚' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3227,7 +3227,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 201 0xc9 '' */
+    /* 201 0xc9 '╔' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3243,7 +3243,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 202 0xca '' */
+    /* 202 0xca '╩' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3259,7 +3259,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 203 0xcb '' */
+    /* 203 0xcb '╦' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3275,7 +3275,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 204 0xcc '' */
+    /* 204 0xcc '╠' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3291,7 +3291,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 205 0xcd '' */
+    /* 205 0xcd '═' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3307,7 +3307,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 206 0xce '' */
+    /* 206 0xce '╬' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3323,7 +3323,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 207 0xcf '' */
+    /* 207 0xcf '╧' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3339,7 +3339,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 208 0xd0 '' */
+    /* 208 0xd0 '╨' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3355,7 +3355,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 209 0xd1 '' */
+    /* 209 0xd1 '╤' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3371,7 +3371,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 210 0xd2 '' */
+    /* 210 0xd2 '╥' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3387,7 +3387,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 211 0xd3 '' */
+    /* 211 0xd3 '╙' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3403,7 +3403,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 212 0xd4 '' */
+    /* 212 0xd4 '╘' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3419,7 +3419,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 213 0xd5 '' */
+    /* 213 0xd5 '╒' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3435,7 +3435,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 214 0xd6 '' */
+    /* 214 0xd6 '╓' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3451,7 +3451,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 215 0xd7 '' */
+    /* 215 0xd7 '╫' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3467,7 +3467,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 216 0xd8 '' */
+    /* 216 0xd8 '╪' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3483,7 +3483,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 217 0xd9 '' */
+    /* 217 0xd9 '┘' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3499,7 +3499,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 218 0xda '' */
+    /* 218 0xda '┌' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3515,7 +3515,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 219 0xdb '' */
+    /* 219 0xdb '█' */
     0xff, /* 11111111 */
     0xff, /* 11111111 */
     0xff, /* 11111111 */
@@ -3531,7 +3531,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0xff, /* 11111111 */
     0xff, /* 11111111 */
 
-    /* 220 0xdc '' */
+    /* 220 0xdc '▄' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3547,7 +3547,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0xff, /* 11111111 */
     0xff, /* 11111111 */
 
-    /* 221 0xdd '' */
+    /* 221 0xdd '▌' */
     0xf0, /* 11110000 */
     0xf0, /* 11110000 */
     0xf0, /* 11110000 */
@@ -3563,7 +3563,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0xf0, /* 11110000 */
     0xf0, /* 11110000 */
 
-    /* 222 0xde '' */
+    /* 222 0xde '▐' */
     0x0f, /* 00001111 */
     0x0f, /* 00001111 */
     0x0f, /* 00001111 */
@@ -3579,7 +3579,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x0f, /* 00001111 */
     0x0f, /* 00001111 */
 
-    /* 223 0xdf '' */
+    /* 223 0xdf '▀' */
     0xff, /* 11111111 */
     0xff, /* 11111111 */
     0xff, /* 11111111 */
@@ -3595,7 +3595,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 224 0xe0 '߈ */
+    /* 224 0xe0 'α' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3611,7 +3611,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 225 0xe1 ' */
+    /* 225 0xe1 'ß' */
     0x00, /* 00000000 */
     0x78, /* 01111000 */
     0xcc, /* 11001100 */
@@ -3627,7 +3627,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 226 0xe2 ' */
+    /* 226 0xe2 'Γ' */
     0x00, /* 00000000 */
     0xfe, /* 11111110 */
     0xc6, /* 11000110 */
@@ -3643,7 +3643,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 227 0xe3 ' */
+    /* 227 0xe3 'π' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3659,7 +3659,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 228 0xe4 ' */
+    /* 228 0xe4 'Σ' */
     0x00, /* 00000000 */
     0xfe, /* 11111110 */
     0xc6, /* 11000110 */
@@ -3675,7 +3675,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 229 0xe5 ' */
+    /* 229 0xe5 'σ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3691,7 +3691,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 230 0xe6 ' */
+    /* 230 0xe6 'µ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3707,7 +3707,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x60, /* 01100000 */
     0xc0, /* 11000000 */
 
-    /* 231 0xe7 ' */
+    /* 231 0xe7 'τ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3723,7 +3723,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 232 0xe8 ' */
+    /* 232 0xe8 'Φ' */
     0x00, /* 00000000 */
     0x7e, /* 01111110 */
     0x18, /* 00011000 */
@@ -3739,7 +3739,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 233 0xe9 ' */
+    /* 233 0xe9 'Θ' */
     0x00, /* 00000000 */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
@@ -3755,7 +3755,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 234 0xea ' */
+    /* 234 0xea 'Ω' */
     0x00, /* 00000000 */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
@@ -3771,7 +3771,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 235 0xeb ' */
+    /* 235 0xeb 'δ' */
     0x00, /* 00000000 */
     0x1e, /* 00011110 */
     0x30, /* 00110000 */
@@ -3787,7 +3787,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 236 0xec ' */
+    /* 236 0xec '∞' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3803,7 +3803,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 237 0xed ' */
+    /* 237 0xed 'φ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x03, /* 00000011 */
@@ -3819,7 +3819,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 238 0xee ' */
+    /* 238 0xee 'ε' */
     0x00, /* 00000000 */
     0x1c, /* 00011100 */
     0x30, /* 00110000 */
@@ -3835,7 +3835,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 239 0xef ' */
+    /* 239 0xef '∩' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x7c, /* 01111100 */
@@ -3851,7 +3851,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 240 0xf0 '' */
+    /* 240 0xf0 '≡' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3867,7 +3867,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 241 0xf1 '' */
+    /* 241 0xf1 '±' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3883,7 +3883,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 242 0xf2 '' */
+    /* 242 0xf2 '≥' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x30, /* 00110000 */
@@ -3899,7 +3899,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 243 0xf3 '' */
+    /* 243 0xf3 '≤' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x0c, /* 00001100 */
@@ -3915,7 +3915,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 244 0xf4 '' */
+    /* 244 0xf4 '⌠' */
     0x00, /* 00000000 */
     0x0e, /* 00001110 */
     0x1b, /* 00011011 */
@@ -3931,7 +3931,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 245 0xf5 '' */
+    /* 245 0xf5 '⌡' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3947,7 +3947,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 246 0xf6 '' */
+    /* 246 0xf6 '÷' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3963,7 +3963,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 247 0xf7 '' */
+    /* 247 0xf7 '≈' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3979,7 +3979,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 248 0xf8 '' */
+    /* 248 0xf8 '°' */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
     0x6c, /* 01101100 */
@@ -3995,7 +3995,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 249 0xf9 '' */
+    /* 249 0xf9 '∙' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4011,7 +4011,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 250 0xfa '' */
+    /* 250 0xfa '·' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4027,7 +4027,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 251 0xfb '' */
+    /* 251 0xfb '√' */
     0x0f, /* 00001111 */
     0x0c, /* 00001100 */
     0x0c, /* 00001100 */
@@ -4043,7 +4043,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 252 0xfc '' */
+    /* 252 0xfc 'ⁿ' */
     0x6c, /* 01101100 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -4059,7 +4059,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 253 0xfd '' */
+    /* 253 0xfd '²' */
     0x3c, /* 00111100 */
     0x66, /* 01100110 */
     0x0c, /* 00001100 */
@@ -4075,7 +4075,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 254 0xfe '' */
+    /* 254 0xfe '■' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4091,7 +4091,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 255 0xff '' */
+    /* 255 0xff ' ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
diff --git a/xen/drivers/video/font_8x16.c b/xen/drivers/video/font_8x16.c
index c65f98dcbb..f96c13ceea 100644
--- a/xen/drivers/video/font_8x16.c
+++ b/xen/drivers/video/font_8x16.c
@@ -2315,7 +2315,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 128 0x80 '' */
+    /* 128 0x80 'Ç' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x3c, /* 00111100 */
@@ -2333,7 +2333,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 129 0x81 '' */
+    /* 129 0x81 'ü' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0xcc, /* 11001100 */
@@ -2351,7 +2351,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 130 0x82 '' */
+    /* 130 0x82 'é' */
     0x00, /* 00000000 */
     0x0c, /* 00001100 */
     0x18, /* 00011000 */
@@ -2369,7 +2369,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 131 0x83 '' */
+    /* 131 0x83 'â' */
     0x00, /* 00000000 */
     0x10, /* 00010000 */
     0x38, /* 00111000 */
@@ -2387,7 +2387,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 132 0x84 '' */
+    /* 132 0x84 'ä' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0xcc, /* 11001100 */
@@ -2405,7 +2405,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 133 0x85 '' */
+    /* 133 0x85 'à' */
     0x00, /* 00000000 */
     0x60, /* 01100000 */
     0x30, /* 00110000 */
@@ -2423,7 +2423,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 134 0x86 '' */
+    /* 134 0x86 'å' */
     0x00, /* 00000000 */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
@@ -2441,7 +2441,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 135 0x87 '' */
+    /* 135 0x87 'ç' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -2459,7 +2459,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 136 0x88 '' */
+    /* 136 0x88 'ê' */
     0x00, /* 00000000 */
     0x10, /* 00010000 */
     0x38, /* 00111000 */
@@ -2477,7 +2477,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 137 0x89 '' */
+    /* 137 0x89 'ë' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0xc6, /* 11000110 */
@@ -2495,7 +2495,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 138 0x8a '' */
+    /* 138 0x8a 'è' */
     0x00, /* 00000000 */
     0x60, /* 01100000 */
     0x30, /* 00110000 */
@@ -2513,7 +2513,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 139 0x8b '' */
+    /* 139 0x8b 'ï' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x66, /* 01100110 */
@@ -2531,7 +2531,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 140 0x8c '' */
+    /* 140 0x8c 'î' */
     0x00, /* 00000000 */
     0x18, /* 00011000 */
     0x3c, /* 00111100 */
@@ -2549,7 +2549,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 141 0x8d '' */
+    /* 141 0x8d 'ì' */
     0x00, /* 00000000 */
     0x60, /* 01100000 */
     0x30, /* 00110000 */
@@ -2567,7 +2567,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 142 0x8e '' */
+    /* 142 0x8e 'Ä' */
     0x00, /* 00000000 */
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
@@ -2585,7 +2585,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 143 0x8f '' */
+    /* 143 0x8f 'Å' */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
     0x38, /* 00111000 */
@@ -2603,7 +2603,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 144 0x90 '' */
+    /* 144 0x90 'É' */
     0x0c, /* 00001100 */
     0x18, /* 00011000 */
     0x00, /* 00000000 */
@@ -2621,7 +2621,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 145 0x91 '' */
+    /* 145 0x91 'æ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -2639,7 +2639,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 146 0x92 '' */
+    /* 146 0x92 'Æ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x3e, /* 00111110 */
@@ -2657,7 +2657,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 147 0x93 '' */
+    /* 147 0x93 'ô' */
     0x00, /* 00000000 */
     0x10, /* 00010000 */
     0x38, /* 00111000 */
@@ -2675,7 +2675,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 148 0x94 '' */
+    /* 148 0x94 'ö' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0xc6, /* 11000110 */
@@ -2693,7 +2693,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 149 0x95 '' */
+    /* 149 0x95 'ò' */
     0x00, /* 00000000 */
     0x60, /* 01100000 */
     0x30, /* 00110000 */
@@ -2711,7 +2711,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 150 0x96 '' */
+    /* 150 0x96 'û' */
     0x00, /* 00000000 */
     0x30, /* 00110000 */
     0x78, /* 01111000 */
@@ -2729,7 +2729,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 151 0x97 '' */
+    /* 151 0x97 'ù' */
     0x00, /* 00000000 */
     0x60, /* 01100000 */
     0x30, /* 00110000 */
@@ -2747,7 +2747,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 152 0x98 '' */
+    /* 152 0x98 'ÿ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0xc6, /* 11000110 */
@@ -2765,7 +2765,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x78, /* 01111000 */
     0x00, /* 00000000 */
 
-    /* 153 0x99 '' */
+    /* 153 0x99 'Ö' */
     0x00, /* 00000000 */
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
@@ -2783,7 +2783,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 154 0x9a '' */
+    /* 154 0x9a 'Ü' */
     0x00, /* 00000000 */
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
@@ -2801,7 +2801,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 155 0x9b '' */
+    /* 155 0x9b '¢' */
     0x00, /* 00000000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -2819,7 +2819,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 156 0x9c '' */
+    /* 156 0x9c '£' */
     0x00, /* 00000000 */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
@@ -2837,7 +2837,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 157 0x9d '' */
+    /* 157 0x9d '¥' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x66, /* 01100110 */
@@ -2855,7 +2855,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 158 0x9e '' */
+    /* 158 0x9e '₧' */
     0x00, /* 00000000 */
     0xf8, /* 11111000 */
     0xcc, /* 11001100 */
@@ -2873,7 +2873,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 159 0x9f '' */
+    /* 159 0x9f 'ƒ' */
     0x00, /* 00000000 */
     0x0e, /* 00001110 */
     0x1b, /* 00011011 */
@@ -2891,7 +2891,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 160 0xa0 '' */
+    /* 160 0xa0 'á' */
     0x00, /* 00000000 */
     0x18, /* 00011000 */
     0x30, /* 00110000 */
@@ -2909,7 +2909,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 161 0xa1 '' */
+    /* 161 0xa1 'í' */
     0x00, /* 00000000 */
     0x0c, /* 00001100 */
     0x18, /* 00011000 */
@@ -2927,7 +2927,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 162 0xa2 '' */
+    /* 162 0xa2 'ó' */
     0x00, /* 00000000 */
     0x18, /* 00011000 */
     0x30, /* 00110000 */
@@ -2945,7 +2945,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 163 0xa3 '' */
+    /* 163 0xa3 'ú' */
     0x00, /* 00000000 */
     0x18, /* 00011000 */
     0x30, /* 00110000 */
@@ -2963,7 +2963,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 164 0xa4 '' */
+    /* 164 0xa4 'ñ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x76, /* 01110110 */
@@ -2981,7 +2981,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 165 0xa5 '' */
+    /* 165 0xa5 'Ñ' */
     0x76, /* 01110110 */
     0xdc, /* 11011100 */
     0x00, /* 00000000 */
@@ -2999,7 +2999,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 166 0xa6 '' */
+    /* 166 0xa6 'ª' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x3c, /* 00111100 */
@@ -3017,7 +3017,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 167 0xa7 '' */
+    /* 167 0xa7 'º' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x38, /* 00111000 */
@@ -3035,7 +3035,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 168 0xa8 '' */
+    /* 168 0xa8 '¿' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x30, /* 00110000 */
@@ -3053,7 +3053,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 169 0xa9 '' */
+    /* 169 0xa9 '⌐' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3071,7 +3071,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 170 0xaa '' */
+    /* 170 0xaa '¬' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3089,7 +3089,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 171 0xab '' */
+    /* 171 0xab '½' */
     0x00, /* 00000000 */
     0x60, /* 01100000 */
     0xe0, /* 11100000 */
@@ -3107,7 +3107,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 172 0xac '' */
+    /* 172 0xac '¼' */
     0x00, /* 00000000 */
     0x60, /* 01100000 */
     0xe0, /* 11100000 */
@@ -3125,7 +3125,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 173 0xad '' */
+    /* 173 0xad '¡' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x18, /* 00011000 */
@@ -3143,7 +3143,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 174 0xae '' */
+    /* 174 0xae '«' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3161,7 +3161,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 175 0xaf '' */
+    /* 175 0xaf '»' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3179,7 +3179,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 176 0xb0 '' */
+    /* 176 0xb0 '░' */
     0x11, /* 00010001 */
     0x44, /* 01000100 */
     0x11, /* 00010001 */
@@ -3197,7 +3197,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x11, /* 00010001 */
     0x44, /* 01000100 */
 
-    /* 177 0xb1 '' */
+    /* 177 0xb1 '▒' */
     0x55, /* 01010101 */
     0xaa, /* 10101010 */
     0x55, /* 01010101 */
@@ -3215,7 +3215,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x55, /* 01010101 */
     0xaa, /* 10101010 */
 
-    /* 178 0xb2 '' */
+    /* 178 0xb2 '▓' */
     0xdd, /* 11011101 */
     0x77, /* 01110111 */
     0xdd, /* 11011101 */
@@ -3233,7 +3233,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0xdd, /* 11011101 */
     0x77, /* 01110111 */
 
-    /* 179 0xb3 '' */
+    /* 179 0xb3 '│' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3251,7 +3251,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 180 0xb4 '' */
+    /* 180 0xb4 '┤' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3269,7 +3269,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 181 0xb5 '' */
+    /* 181 0xb5 '╡' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3287,7 +3287,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 182 0xb6 '' */
+    /* 182 0xb6 '╢' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3305,7 +3305,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 183 0xb7 '' */
+    /* 183 0xb7 '╖' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3323,7 +3323,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 184 0xb8 '' */
+    /* 184 0xb8 '╕' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3341,7 +3341,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 185 0xb9 '' */
+    /* 185 0xb9 '╣' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3359,7 +3359,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 186 0xba '' */
+    /* 186 0xba '║' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3377,7 +3377,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 187 0xbb '' */
+    /* 187 0xbb '╗' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3395,7 +3395,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 188 0xbc '' */
+    /* 188 0xbc '╝' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3413,7 +3413,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 189 0xbd '' */
+    /* 189 0xbd '╜' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3431,7 +3431,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 190 0xbe '' */
+    /* 190 0xbe '╛' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3449,7 +3449,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 191 0xbf '' */
+    /* 191 0xbf '┐' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3467,7 +3467,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 192 0xc0 '' */
+    /* 192 0xc0 '└' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3485,7 +3485,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 193 0xc1 '' */
+    /* 193 0xc1 '┴' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3503,7 +3503,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 194 0xc2 '' */
+    /* 194 0xc2 '┬' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3521,7 +3521,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 195 0xc3 '' */
+    /* 195 0xc3 '├' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3539,7 +3539,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 196 0xc4 '' */
+    /* 196 0xc4 '─' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3557,7 +3557,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 197 0xc5 '' */
+    /* 197 0xc5 '┼' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3575,7 +3575,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 198 0xc6 '' */
+    /* 198 0xc6 '╞' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3593,7 +3593,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 199 0xc7 '' */
+    /* 199 0xc7 '╟' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3611,7 +3611,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 200 0xc8 '' */
+    /* 200 0xc8 '╚' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3629,7 +3629,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 201 0xc9 '' */
+    /* 201 0xc9 '╔' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3647,7 +3647,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 202 0xca '' */
+    /* 202 0xca '╩' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3665,7 +3665,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 203 0xcb '' */
+    /* 203 0xcb '╦' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3683,7 +3683,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 204 0xcc '' */
+    /* 204 0xcc '╠' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3701,7 +3701,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 205 0xcd '' */
+    /* 205 0xcd '═' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3719,7 +3719,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 206 0xce '' */
+    /* 206 0xce '╬' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3737,7 +3737,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 207 0xcf '' */
+    /* 207 0xcf '╧' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3755,7 +3755,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 208 0xd0 '' */
+    /* 208 0xd0 '╨' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3773,7 +3773,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 209 0xd1 '' */
+    /* 209 0xd1 '╤' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3791,7 +3791,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 210 0xd2 '' */
+    /* 210 0xd2 '╥' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3809,7 +3809,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 211 0xd3 '' */
+    /* 211 0xd3 '╙' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3827,7 +3827,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 212 0xd4 '' */
+    /* 212 0xd4 '╘' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3845,7 +3845,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 213 0xd5 '' */
+    /* 213 0xd5 '╒' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3863,7 +3863,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 214 0xd6 '' */
+    /* 214 0xd6 '╓' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3881,7 +3881,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 215 0xd7 '' */
+    /* 215 0xd7 '╫' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3899,7 +3899,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 216 0xd8 '' */
+    /* 216 0xd8 '╪' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3917,7 +3917,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 217 0xd9 '' */
+    /* 217 0xd9 '┘' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3935,7 +3935,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 218 0xda '' */
+    /* 218 0xda '┌' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3953,7 +3953,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 219 0xdb '' */
+    /* 219 0xdb '█' */
     0xff, /* 11111111 */
     0xff, /* 11111111 */
     0xff, /* 11111111 */
@@ -3971,7 +3971,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0xff, /* 11111111 */
     0xff, /* 11111111 */
 
-    /* 220 0xdc '' */
+    /* 220 0xdc '▄' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3989,7 +3989,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0xff, /* 11111111 */
     0xff, /* 11111111 */
 
-    /* 221 0xdd '' */
+    /* 221 0xdd '▌' */
     0xf0, /* 11110000 */
     0xf0, /* 11110000 */
     0xf0, /* 11110000 */
@@ -4007,7 +4007,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0xf0, /* 11110000 */
     0xf0, /* 11110000 */
 
-    /* 222 0xde '' */
+    /* 222 0xde '▐' */
     0x0f, /* 00001111 */
     0x0f, /* 00001111 */
     0x0f, /* 00001111 */
@@ -4025,7 +4025,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x0f, /* 00001111 */
     0x0f, /* 00001111 */
 
-    /* 223 0xdf '' */
+    /* 223 0xdf '▀' */
     0xff, /* 11111111 */
     0xff, /* 11111111 */
     0xff, /* 11111111 */
@@ -4043,7 +4043,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 224 0xe0 '' */
+    /* 224 0xe0 'α' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4061,7 +4061,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 225 0xe1 '' */
+    /* 225 0xe1 'ß' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x78, /* 01111000 */
@@ -4079,7 +4079,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 226 0xe2 '' */
+    /* 226 0xe2 'Γ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0xfe, /* 11111110 */
@@ -4097,7 +4097,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 227 0xe3 '' */
+    /* 227 0xe3 'π' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4115,7 +4115,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 228 0xe4 '' */
+    /* 228 0xe4 'Σ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0xfe, /* 11111110 */
@@ -4133,7 +4133,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 229 0xe5 '' */
+    /* 229 0xe5 'σ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4151,7 +4151,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 230 0xe6 '' */
+    /* 230 0xe6 'µ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4169,7 +4169,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0xc0, /* 11000000 */
     0x00, /* 00000000 */
 
-    /* 231 0xe7 '' */
+    /* 231 0xe7 'τ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4187,7 +4187,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 232 0xe8 '' */
+    /* 232 0xe8 'Φ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x7e, /* 01111110 */
@@ -4205,7 +4205,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 233 0xe9 '' */
+    /* 233 0xe9 'Θ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x38, /* 00111000 */
@@ -4223,7 +4223,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 234 0xea '' */
+    /* 234 0xea 'Ω' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x38, /* 00111000 */
@@ -4241,7 +4241,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 235 0xeb '' */
+    /* 235 0xeb 'δ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x1e, /* 00011110 */
@@ -4259,7 +4259,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 236 0xec '' */
+    /* 236 0xec '∞' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4277,7 +4277,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 237 0xed '' */
+    /* 237 0xed 'φ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4295,7 +4295,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 238 0xee '' */
+    /* 238 0xee 'ε' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x1c, /* 00011100 */
@@ -4313,7 +4313,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 239 0xef '' */
+    /* 239 0xef '∩' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4331,7 +4331,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 240 0xf0 '' */
+    /* 240 0xf0 '≡' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4349,7 +4349,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 241 0xf1 '' */
+    /* 241 0xf1 '±' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4367,7 +4367,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 242 0xf2 '' */
+    /* 242 0xf2 '≥' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4385,7 +4385,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 243 0xf3 '' */
+    /* 243 0xf3 '≤' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4403,7 +4403,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 244 0xf4 '' */
+    /* 244 0xf4 '⌠' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x0e, /* 00001110 */
@@ -4421,7 +4421,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 245 0xf5 '' */
+    /* 245 0xf5 '⌡' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -4439,7 +4439,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 246 0xf6 '' */
+    /* 246 0xf6 '÷' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4457,7 +4457,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 247 0xf7 '' */
+    /* 247 0xf7 '≈' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4475,7 +4475,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 248 0xf8 '' */
+    /* 248 0xf8 '°' */
     0x00, /* 00000000 */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
@@ -4493,7 +4493,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 249 0xf9 '' */
+    /* 249 0xf9 '∙' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4511,7 +4511,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 250 0xfa '' */
+    /* 250 0xfa '·' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4529,7 +4529,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 251 0xfb '' */
+    /* 251 0xfb '√' */
     0x00, /* 00000000 */
     0x0f, /* 00001111 */
     0x0c, /* 00001100 */
@@ -4547,7 +4547,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 252 0xfc '' */
+    /* 252 0xfc 'ⁿ' */
     0x00, /* 00000000 */
     0x6c, /* 01101100 */
     0x36, /* 00110110 */
@@ -4565,7 +4565,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 253 0xfd '' */
+    /* 253 0xfd '²' */
     0x00, /* 00000000 */
     0x3c, /* 00111100 */
     0x66, /* 01100110 */
@@ -4583,7 +4583,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 254 0xfe '' */
+    /* 254 0xfe '■' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4601,7 +4601,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 255 0xff '' */
+    /* 255 0xff ' ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
diff --git a/xen/drivers/video/font_8x8.c b/xen/drivers/video/font_8x8.c
index 9441429b42..e6c693a977 100644
--- a/xen/drivers/video/font_8x8.c
+++ b/xen/drivers/video/font_8x8.c
@@ -1291,7 +1291,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0xfe, /* 11111110 */
     0x00, /* 00000000 */
 
-    /* 128 0x80 '' */
+    /* 128 0x80 'Ç' */
     0x7c, /* 01111100 */
     0xc6, /* 11000110 */
     0xc0, /* 11000000 */
@@ -1301,7 +1301,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x0c, /* 00001100 */
     0x78, /* 01111000 */
 
-    /* 129 0x81 '' */
+    /* 129 0x81 'ü' */
     0xcc, /* 11001100 */
     0x00, /* 00000000 */
     0xcc, /* 11001100 */
@@ -1311,7 +1311,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x76, /* 01110110 */
     0x00, /* 00000000 */
 
-    /* 130 0x82 '' */
+    /* 130 0x82 'é' */
     0x0c, /* 00001100 */
     0x18, /* 00011000 */
     0x7c, /* 01111100 */
@@ -1321,7 +1321,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x7c, /* 01111100 */
     0x00, /* 00000000 */
 
-    /* 131 0x83 '' */
+    /* 131 0x83 'â' */
     0x7c, /* 01111100 */
     0x82, /* 10000010 */
     0x78, /* 01111000 */
@@ -1331,7 +1331,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x76, /* 01110110 */
     0x00, /* 00000000 */
 
-    /* 132 0x84 '' */
+    /* 132 0x84 'ä' */
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
     0x78, /* 01111000 */
@@ -1341,7 +1341,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x76, /* 01110110 */
     0x00, /* 00000000 */
 
-    /* 133 0x85 '' */
+    /* 133 0x85 'à' */
     0x30, /* 00110000 */
     0x18, /* 00011000 */
     0x78, /* 01111000 */
@@ -1351,7 +1351,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x76, /* 01110110 */
     0x00, /* 00000000 */
 
-    /* 134 0x86 '' */
+    /* 134 0x86 'å' */
     0x30, /* 00110000 */
     0x30, /* 00110000 */
     0x78, /* 01111000 */
@@ -1361,7 +1361,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x76, /* 01110110 */
     0x00, /* 00000000 */
 
-    /* 135 0x87 '' */
+    /* 135 0x87 'ç' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x7e, /* 01111110 */
@@ -1371,7 +1371,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x0c, /* 00001100 */
     0x38, /* 00111000 */
 
-    /* 136 0x88 '' */
+    /* 136 0x88 'ê' */
     0x7c, /* 01111100 */
     0x82, /* 10000010 */
     0x7c, /* 01111100 */
@@ -1381,7 +1381,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x7c, /* 01111100 */
     0x00, /* 00000000 */
 
-    /* 137 0x89 '' */
+    /* 137 0x89 'ë' */
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
     0x7c, /* 01111100 */
@@ -1391,7 +1391,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x7c, /* 01111100 */
     0x00, /* 00000000 */
 
-    /* 138 0x8a '' */
+    /* 138 0x8a 'è' */
     0x30, /* 00110000 */
     0x18, /* 00011000 */
     0x7c, /* 01111100 */
@@ -1401,7 +1401,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x7c, /* 01111100 */
     0x00, /* 00000000 */
 
-    /* 139 0x8b '' */
+    /* 139 0x8b 'ï' */
     0x66, /* 01100110 */
     0x00, /* 00000000 */
     0x38, /* 00111000 */
@@ -1411,7 +1411,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x3c, /* 00111100 */
     0x00, /* 00000000 */
 
-    /* 140 0x8c '' */
+    /* 140 0x8c 'î' */
     0x7c, /* 01111100 */
     0x82, /* 10000010 */
     0x38, /* 00111000 */
@@ -1421,7 +1421,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x3c, /* 00111100 */
     0x00, /* 00000000 */
 
-    /* 141 0x8d '' */
+    /* 141 0x8d 'ì' */
     0x30, /* 00110000 */
     0x18, /* 00011000 */
     0x00, /* 00000000 */
@@ -1431,7 +1431,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x3c, /* 00111100 */
     0x00, /* 00000000 */
 
-    /* 142 0x8e '' */
+    /* 142 0x8e 'Ä' */
     0xc6, /* 11000110 */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
@@ -1441,7 +1441,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
 
-    /* 143 0x8f '' */
+    /* 143 0x8f 'Å' */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
     0x7c, /* 01111100 */
@@ -1451,7 +1451,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
 
-    /* 144 0x90 '' */
+    /* 144 0x90 'É' */
     0x18, /* 00011000 */
     0x30, /* 00110000 */
     0xfe, /* 11111110 */
@@ -1461,7 +1461,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0xfe, /* 11111110 */
     0x00, /* 00000000 */
 
-    /* 145 0x91 '' */
+    /* 145 0x91 'æ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x7e, /* 01111110 */
@@ -1471,7 +1471,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x7e, /* 01111110 */
     0x00, /* 00000000 */
 
-    /* 146 0x92 '' */
+    /* 146 0x92 'Æ' */
     0x3e, /* 00111110 */
     0x6c, /* 01101100 */
     0xcc, /* 11001100 */
@@ -1481,7 +1481,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0xce, /* 11001110 */
     0x00, /* 00000000 */
 
-    /* 147 0x93 '' */
+    /* 147 0x93 'ô' */
     0x7c, /* 01111100 */
     0x82, /* 10000010 */
     0x7c, /* 01111100 */
@@ -1491,7 +1491,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x7c, /* 01111100 */
     0x00, /* 00000000 */
 
-    /* 148 0x94 '' */
+    /* 148 0x94 'ö' */
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
     0x7c, /* 01111100 */
@@ -1501,7 +1501,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x7c, /* 01111100 */
     0x00, /* 00000000 */
 
-    /* 149 0x95 '' */
+    /* 149 0x95 'ò' */
     0x30, /* 00110000 */
     0x18, /* 00011000 */
     0x7c, /* 01111100 */
@@ -1511,7 +1511,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x7c, /* 01111100 */
     0x00, /* 00000000 */
 
-    /* 150 0x96 '' */
+    /* 150 0x96 'û' */
     0x78, /* 01111000 */
     0x84, /* 10000100 */
     0x00, /* 00000000 */
@@ -1521,7 +1521,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x76, /* 01110110 */
     0x00, /* 00000000 */
 
-    /* 151 0x97 '' */
+    /* 151 0x97 'ù' */
     0x60, /* 01100000 */
     0x30, /* 00110000 */
     0xcc, /* 11001100 */
@@ -1531,7 +1531,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x76, /* 01110110 */
     0x00, /* 00000000 */
 
-    /* 152 0x98 '' */
+    /* 152 0x98 'ÿ' */
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
     0xc6, /* 11000110 */
@@ -1541,7 +1541,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x06, /* 00000110 */
     0xfc, /* 11111100 */
 
-    /* 153 0x99 '' */
+    /* 153 0x99 'Ö' */
     0xc6, /* 11000110 */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
@@ -1551,7 +1551,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x38, /* 00111000 */
     0x00, /* 00000000 */
 
-    /* 154 0x9a '' */
+    /* 154 0x9a 'Ü' */
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
     0xc6, /* 11000110 */
@@ -1561,7 +1561,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x7c, /* 01111100 */
     0x00, /* 00000000 */
 
-    /* 155 0x9b '' */
+    /* 155 0x9b '¢' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x7e, /* 01111110 */
@@ -1571,7 +1571,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 156 0x9c '' */
+    /* 156 0x9c '£' */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
     0x64, /* 01100100 */
@@ -1581,7 +1581,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0xfc, /* 11111100 */
     0x00, /* 00000000 */
 
-    /* 157 0x9d '' */
+    /* 157 0x9d '¥' */
     0x66, /* 01100110 */
     0x66, /* 01100110 */
     0x3c, /* 00111100 */
@@ -1591,7 +1591,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 158 0x9e '' */
+    /* 158 0x9e '₧' */
     0xf8, /* 11111000 */
     0xcc, /* 11001100 */
     0xcc, /* 11001100 */
@@ -1601,7 +1601,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0xc6, /* 11000110 */
     0xc7, /* 11000111 */
 
-    /* 159 0x9f '' */
+    /* 159 0x9f 'ƒ' */
     0x0e, /* 00001110 */
     0x1b, /* 00011011 */
     0x18, /* 00011000 */
@@ -1611,7 +1611,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x70, /* 01110000 */
     0x00, /* 00000000 */
 
-    /* 160 0xa0 '' */
+    /* 160 0xa0 'á' */
     0x18, /* 00011000 */
     0x30, /* 00110000 */
     0x78, /* 01111000 */
@@ -1621,7 +1621,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x76, /* 01110110 */
     0x00, /* 00000000 */
 
-    /* 161 0xa1 '' */
+    /* 161 0xa1 'í' */
     0x0c, /* 00001100 */
     0x18, /* 00011000 */
     0x00, /* 00000000 */
@@ -1631,7 +1631,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x3c, /* 00111100 */
     0x00, /* 00000000 */
 
-    /* 162 0xa2 '' */
+    /* 162 0xa2 'ó' */
     0x0c, /* 00001100 */
     0x18, /* 00011000 */
     0x7c, /* 01111100 */
@@ -1641,7 +1641,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x7c, /* 01111100 */
     0x00, /* 00000000 */
 
-    /* 163 0xa3 '' */
+    /* 163 0xa3 'ú' */
     0x18, /* 00011000 */
     0x30, /* 00110000 */
     0xcc, /* 11001100 */
@@ -1651,7 +1651,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x76, /* 01110110 */
     0x00, /* 00000000 */
 
-    /* 164 0xa4 '' */
+    /* 164 0xa4 'ñ' */
     0x76, /* 01110110 */
     0xdc, /* 11011100 */
     0x00, /* 00000000 */
@@ -1661,7 +1661,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x66, /* 01100110 */
     0x00, /* 00000000 */
 
-    /* 165 0xa5 '' */
+    /* 165 0xa5 'Ñ' */
     0x76, /* 01110110 */
     0xdc, /* 11011100 */
     0x00, /* 00000000 */
@@ -1671,7 +1671,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0xce, /* 11001110 */
     0x00, /* 00000000 */
 
-    /* 166 0xa6 '' */
+    /* 166 0xa6 'ª' */
     0x3c, /* 00111100 */
     0x6c, /* 01101100 */
     0x6c, /* 01101100 */
@@ -1681,7 +1681,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 167 0xa7 '' */
+    /* 167 0xa7 'º' */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
     0x6c, /* 01101100 */
@@ -1691,7 +1691,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 168 0xa8 '' */
+    /* 168 0xa8 '¿' */
     0x18, /* 00011000 */
     0x00, /* 00000000 */
     0x18, /* 00011000 */
@@ -1701,7 +1701,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x3e, /* 00111110 */
     0x00, /* 00000000 */
 
-    /* 169 0xa9 '' */
+    /* 169 0xa9 '⌐' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -1711,7 +1711,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 170 0xaa '' */
+    /* 170 0xaa '¬' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -1721,7 +1721,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 171 0xab '' */
+    /* 171 0xab '½' */
     0x63, /* 01100011 */
     0xe6, /* 11100110 */
     0x6c, /* 01101100 */
@@ -1731,7 +1731,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0xcc, /* 11001100 */
     0x0f, /* 00001111 */
 
-    /* 172 0xac '' */
+    /* 172 0xac '¼' */
     0x63, /* 01100011 */
     0xe6, /* 11100110 */
     0x6c, /* 01101100 */
@@ -1741,7 +1741,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0xdf, /* 11011111 */
     0x06, /* 00000110 */
 
-    /* 173 0xad '' */
+    /* 173 0xad '¡' */
     0x18, /* 00011000 */
     0x00, /* 00000000 */
     0x18, /* 00011000 */
@@ -1751,7 +1751,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x00, /* 00000000 */
 
-    /* 174 0xae '' */
+    /* 174 0xae '«' */
     0x00, /* 00000000 */
     0x33, /* 00110011 */
     0x66, /* 01100110 */
@@ -1761,7 +1761,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 175 0xaf '' */
+    /* 175 0xaf '»' */
     0x00, /* 00000000 */
     0xcc, /* 11001100 */
     0x66, /* 01100110 */
@@ -1771,7 +1771,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 176 0xb0 '' */
+    /* 176 0xb0 '░' */
     0x22, /* 00100010 */
     0x88, /* 10001000 */
     0x22, /* 00100010 */
@@ -1781,7 +1781,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x22, /* 00100010 */
     0x88, /* 10001000 */
 
-    /* 177 0xb1 '' */
+    /* 177 0xb1 '▒' */
     0x55, /* 01010101 */
     0xaa, /* 10101010 */
     0x55, /* 01010101 */
@@ -1791,7 +1791,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x55, /* 01010101 */
     0xaa, /* 10101010 */
 
-    /* 178 0xb2 '' */
+    /* 178 0xb2 '▓' */
     0x77, /* 01110111 */
     0xdd, /* 11011101 */
     0x77, /* 01110111 */
@@ -1801,7 +1801,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x77, /* 01110111 */
     0xdd, /* 11011101 */
 
-    /* 179 0xb3 '' */
+    /* 179 0xb3 '│' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -1811,7 +1811,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 180 0xb4 '' */
+    /* 180 0xb4 '┤' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -1821,7 +1821,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 181 0xb5 '' */
+    /* 181 0xb5 '╡' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0xf8, /* 11111000 */
@@ -1831,7 +1831,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 182 0xb6 '' */
+    /* 182 0xb6 '╢' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -1841,7 +1841,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 183 0xb7 '' */
+    /* 183 0xb7 '╖' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -1851,7 +1851,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 184 0xb8 '' */
+    /* 184 0xb8 '╕' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0xf8, /* 11111000 */
@@ -1861,7 +1861,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 185 0xb9 '' */
+    /* 185 0xb9 '╣' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0xf6, /* 11110110 */
@@ -1871,7 +1871,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 186 0xba '' */
+    /* 186 0xba '║' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -1881,7 +1881,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 187 0xbb '' */
+    /* 187 0xbb '╗' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0xfe, /* 11111110 */
@@ -1891,7 +1891,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 188 0xbc '' */
+    /* 188 0xbc '╝' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0xf6, /* 11110110 */
@@ -1901,7 +1901,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 189 0xbd '' */
+    /* 189 0xbd '╜' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -1911,7 +1911,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 190 0xbe '' */
+    /* 190 0xbe '╛' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0xf8, /* 11111000 */
@@ -1921,7 +1921,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 191 0xbf '' */
+    /* 191 0xbf '┐' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -1931,7 +1931,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 192 0xc0 '' */
+    /* 192 0xc0 '└' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -1941,7 +1941,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 193 0xc1 '' */
+    /* 193 0xc1 '┴' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -1951,7 +1951,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 194 0xc2 '' */
+    /* 194 0xc2 '┬' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -1961,7 +1961,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 195 0xc3 '' */
+    /* 195 0xc3 '├' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -1971,7 +1971,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 196 0xc4 '' */
+    /* 196 0xc4 '─' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -1981,7 +1981,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 197 0xc5 '' */
+    /* 197 0xc5 '┼' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -1991,7 +1991,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 198 0xc6 '' */
+    /* 198 0xc6 '╞' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x1f, /* 00011111 */
@@ -2001,7 +2001,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 199 0xc7 '' */
+    /* 199 0xc7 '╟' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -2011,7 +2011,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 200 0xc8 '' */
+    /* 200 0xc8 '╚' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x37, /* 00110111 */
@@ -2021,7 +2021,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */


