diff --git a/.qubesbuilder b/.qubesbuilder index 5a7a5520..2e84bcc1 100644 --- a/.qubesbuilder +++ b/.qubesbuilder @@ -12,7 +12,7 @@ source: # signature: https://downloads.xenproject.org/release/xen/@VERSION@/xen-@VERSION@.tar.gz.sig # - git-url: https://gitlab.com/xen-project/xen.git - git-url: https://xenbits.xenproject.org/git-http/xen.git - tag: RELEASE-4.17.4 - git-basename: xen-4.17.4 + tag: RELEASE-4.19.0 + git-basename: xen-@VERSION@ pubkeys: - xen.org-key.asc diff --git a/0201-EFI-early-Add-noexit-to-inhibit-calling-ExitBootServ.patch b/0200-EFI-early-Add-noexit-to-inhibit-calling-ExitBootServ.patch similarity index 80% rename from 0201-EFI-early-Add-noexit-to-inhibit-calling-ExitBootServ.patch rename to 0200-EFI-early-Add-noexit-to-inhibit-calling-ExitBootServ.patch index 251b549c..a4886f3a 100644 --- a/0201-EFI-early-Add-noexit-to-inhibit-calling-ExitBootServ.patch +++ b/0200-EFI-early-Add-noexit-to-inhibit-calling-ExitBootServ.patch @@ -1,8 +1,7 @@ -From 097d3f0c0c735cd3fee4bcbb707cbccb4fd0770b Mon Sep 17 00:00:00 2001 +From bf8e7496d95c2a71a3bdac4340e1a9c03b86b0af Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Fri, 24 Apr 2015 16:47:18 -0400 -Subject: [PATCH 01/26] EFI/early: Add /noexit to inhibit calling - ExitBootServices +Subject: [PATCH] EFI/early: Add /noexit to inhibit calling ExitBootServices The '/noexitboot' parameter will inhibit Xen in calling ExitBootServices. @@ -18,10 +17,10 @@ Signed-off-by: Marcus of Wetware Labs 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h -index e82ac9daa7ad..2221cdec681a 100644 +index f282358435f1..39cc8baef4bc 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h -@@ -816,7 +816,7 @@ void __init efi_multiboot2(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable +@@ -909,7 +909,7 @@ void asmlinkage __init efi_multiboot2(EFI_HANDLE ImageHandle, efi_relocate_esrt(SystemTable); @@ -31,10 +30,10 @@ index e82ac9daa7ad..2221cdec681a 100644 /* diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c -index db0340c8e262..d78a315e56e0 100644 +index efbec00af9da..8004cf4d1303 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c -@@ -145,7 +145,7 @@ static void efi_tables(void); +@@ -146,7 +146,7 @@ static void efi_tables(void); static void setup_efi_pci(void); static void efi_variables(void); static void efi_set_gop_mode(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, UINTN gop_mode); @@ -43,7 +42,7 @@ index db0340c8e262..d78a315e56e0 100644 static const EFI_BOOT_SERVICES *__initdata efi_bs; static UINT32 __initdata efi_bs_revision; -@@ -1175,7 +1175,7 @@ static void __init efi_relocate_esrt(EFI_SYSTEM_TABLE *SystemTable) +@@ -1180,7 +1180,7 @@ static void __init efi_set_gop_mode(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, UINTN gop #define INVALID_VIRTUAL_ADDRESS (0xBAAADUL << \ (EFI_PAGE_SHIFT + BITS_PER_LONG - 32)) @@ -52,7 +51,7 @@ index db0340c8e262..d78a315e56e0 100644 { EFI_STATUS status; UINTN info_size = 0, map_key; -@@ -1206,8 +1206,11 @@ static void __init efi_exit_boot(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *Syste +@@ -1211,8 +1211,11 @@ static void __init efi_exit_boot(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *Syste efi_arch_pre_exit_boot(); @@ -65,7 +64,7 @@ index db0340c8e262..d78a315e56e0 100644 efi_bs = NULL; if ( status != EFI_INVALID_PARAMETER || retry ) break; -@@ -1262,7 +1265,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) +@@ -1268,7 +1271,7 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE ImageHandle, EFI_SHIM_LOCK_PROTOCOL *shim_lock; EFI_GRAPHICS_OUTPUT_PROTOCOL *gop = NULL; union string section = { NULL }, name; @@ -74,7 +73,7 @@ index db0340c8e262..d78a315e56e0 100644 const char *option_str; bool use_cfg_file; int dt_modules_found; -@@ -1312,6 +1315,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) +@@ -1318,6 +1321,8 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE ImageHandle, base_video = true; else if ( wstrcmp(ptr + 1, L"mapbs") == 0 ) map_bs = true; @@ -83,7 +82,7 @@ index db0340c8e262..d78a315e56e0 100644 else if ( wstrncmp(ptr + 1, L"cfg=", 4) == 0 ) cfg_file_name = ptr + 5; else if ( i + 1 < argc && wstrcmp(ptr + 1, L"cfg") == 0 ) -@@ -1322,6 +1327,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) +@@ -1328,6 +1333,7 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE ImageHandle, PrintStr(L"Xen EFI Loader options:\r\n"); PrintStr(L"-basevideo retain current video mode\r\n"); PrintStr(L"-mapbs map EfiBootServices{Code,Data}\r\n"); @@ -91,7 +90,7 @@ index db0340c8e262..d78a315e56e0 100644 PrintStr(L"-cfg= specify configuration file\r\n"); PrintStr(L"-help, -? display this help\r\n"); blexit(NULL); -@@ -1539,7 +1545,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) +@@ -1541,7 +1547,7 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE ImageHandle, efi_relocate_esrt(SystemTable); @@ -101,5 +100,5 @@ index db0340c8e262..d78a315e56e0 100644 efi_arch_post_exit_boot(); /* Doesn't return. */ } -- -2.37.3 +2.44.0 diff --git a/0202-efi-Ensure-incorrectly-typed-runtime-services-get-ma.patch b/0201-efi-Ensure-incorrectly-typed-runtime-services-get-ma.patch similarity index 81% rename from 0202-efi-Ensure-incorrectly-typed-runtime-services-get-ma.patch rename to 0201-efi-Ensure-incorrectly-typed-runtime-services-get-ma.patch index af6c2d6c..ea152a32 100644 --- a/0202-efi-Ensure-incorrectly-typed-runtime-services-get-ma.patch +++ b/0201-efi-Ensure-incorrectly-typed-runtime-services-get-ma.patch @@ -1,8 +1,7 @@ -From f0ec9a1726a66278249f58a46c2b4f9394b32eff Mon Sep 17 00:00:00 2001 +From 6707e983682615765b5ac1df7c9e811852cc683d Mon Sep 17 00:00:00 2001 From: Ross Lagerwall Date: Fri, 20 Mar 2015 14:32:04 +0000 -Subject: [PATCH 02/26] efi: Ensure incorrectly typed runtime services get - mapped +Subject: [PATCH] efi: Ensure incorrectly typed runtime services get mapped Some firmware implementations do not correctly mark memory needed for runtime services, not setting the EFI_MEMORY_RUNTIME bit and giving it a type @@ -28,10 +27,10 @@ Signed-off-by: Ross Lagerwall 1 file changed, 6 insertions(+) diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c -index d78a315e56e0..4fb755bc4e43 100644 +index 8004cf4d1303..b34521c5e74a 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c -@@ -156,6 +156,7 @@ static SIMPLE_TEXT_OUTPUT_INTERFACE *__initdata StdErr; +@@ -157,6 +157,7 @@ static SIMPLE_TEXT_OUTPUT_INTERFACE *__initdata StdErr; static UINT32 __initdata mdesc_ver; static bool __initdata map_bs; @@ -39,7 +38,7 @@ index d78a315e56e0..4fb755bc4e43 100644 static struct file __initdata cfg; static struct file __initdata kernel; -@@ -1717,6 +1718,11 @@ void __init efi_init_memory(void) +@@ -1723,6 +1724,11 @@ void __init efi_init_memory(void) if ( !map_bs ) continue; break; @@ -52,5 +51,5 @@ index d78a315e56e0..4fb755bc4e43 100644 } -- -2.37.3 +2.44.0 diff --git a/0203-Add-xen.cfg-options-for-mapbs-and-noexitboot.patch b/0202-Add-xen.cfg-options-for-mapbs-and-noexitboot.patch similarity index 75% rename from 0203-Add-xen.cfg-options-for-mapbs-and-noexitboot.patch rename to 0202-Add-xen.cfg-options-for-mapbs-and-noexitboot.patch index f86e4bf6..232e297a 100644 --- a/0203-Add-xen.cfg-options-for-mapbs-and-noexitboot.patch +++ b/0202-Add-xen.cfg-options-for-mapbs-and-noexitboot.patch @@ -1,8 +1,8 @@ -From 9fbad03a0bac47d127bf7a62c8c3c374e4ca950e Mon Sep 17 00:00:00 2001 +From d837a8e0ea14164a237d15b6355c915b8d4e5ff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sat, 4 Jun 2016 19:13:31 +0200 -Subject: [PATCH 03/26] Add xen.cfg options for /mapbs and /noexitboot +Subject: [PATCH] Add xen.cfg options for /mapbs and /noexitboot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -15,12 +15,12 @@ Signed-off-by: Marek Marczykowski-Górecki 1 file changed, 12 insertions(+) diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c -index 4fb755bc4e43..8e880fe30c75 100644 +index b34521c5e74a..ad8488f7f9d7 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c -@@ -1470,6 +1470,18 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) +@@ -1472,6 +1472,18 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE ImageHandle, name.s = get_value(&cfg, section.s, "options"); - efi_arch_handle_cmdline(argc ? *argv : NULL, options, name.s); + efi_arch_handle_cmdline(options, name.s); + name.s = get_value(&cfg, section.s, "mapbs"); + if ( name.s ) @@ -38,5 +38,5 @@ index 4fb755bc4e43..8e880fe30c75 100644 { name.cs = get_value(&cfg, section.s, "video"); -- -2.37.3 +2.44.0 diff --git a/0203-xen.efi.build.patch b/0203-xen.efi.build.patch new file mode 100644 index 00000000..718e26b6 --- /dev/null +++ b/0203-xen.efi.build.patch @@ -0,0 +1,27 @@ +From 22a0881b94f0b17d369ce090cbf3cced6366fae5 Mon Sep 17 00:00:00 2001 +From: Fedora developers +Date: Mon, 8 Jul 2024 13:35:51 +0200 +Subject: [PATCH] xen.efi.build + +--- + xen/arch/x86/arch.mk | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk +index 4f6c086988dd..0efc664bc919 100644 +--- a/xen/arch/x86/arch.mk ++++ b/xen/arch/x86/arch.mk +@@ -91,7 +91,9 @@ 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 ++# use a reduced set of options from LDFLAGS ++EFI_LDFLAGS = --as-needed --build-id=sha1 -mi386pep --subsystem=10 + 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) + +-- +2.44.0 + diff --git a/0204-xen.efi.build.patch b/0204-xen.efi.build.patch deleted file mode 100644 index 06ee2492..00000000 --- a/0204-xen.efi.build.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- xen-4.17.0/xen/arch/x86/arch.mk.orig 2022-12-08 18:03:08.000000000 +0000 -+++ xen-4.17.0/xen/arch/x86/arch.mk 2022-12-10 12:13:11.043182208 +0000 -@@ -94,7 +94,9 @@ - XEN_BUILD_EFI := $(call if-success,$(CC) $(CFLAGS) -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 -+# use a reduced set of options from LDFLAGS -+EFI_LDFLAGS = --as-needed --build-id=sha1 -mi386pep --subsystem=10 - 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) - diff --git a/0301-x86-mm-shadow-avoid-assuming-a-specific-Xen-PAT.patch b/0301-x86-mm-shadow-avoid-assuming-a-specific-Xen-PAT.patch deleted file mode 100644 index 5238b0f8..00000000 --- a/0301-x86-mm-shadow-avoid-assuming-a-specific-Xen-PAT.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 53ba5e1b48a538c366e4621634b493f4585bcac0 Mon Sep 17 00:00:00 2001 -From: Demi Marie Obenour -Date: Tue, 6 Dec 2022 13:54:33 +0100 -Subject: [PATCH 1/9] x86/mm/shadow: avoid assuming a specific Xen PAT -To: xen-devel@lists.xenproject.org -Cc: Marek Marczykowski-Górecki , - Jan Beulich , - Andrew Cooper , - "Roger Pau Monné" , - Wei Liu , - Jun Nakajima , - Kevin Tian , - George Dunlap , - Tim Deegan - -This makes the code easier to understand and more robust if Xen's PAT -ever changes. - -Signed-off-by: Demi Marie Obenour -Reviewed-by: Andrew Cooper ---- - xen/arch/x86/mm/shadow/multi.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c -index 2370b3060285fee895f335f2a82d3d22ca5d31ed..4e94fec3d50cde0e5a26ecb62ff4d00dd00f759d 100644 ---- a/xen/arch/x86/mm/shadow/multi.c -+++ b/xen/arch/x86/mm/shadow/multi.c -@@ -629,8 +629,8 @@ _sh_propagate(struct vcpu *v, - else if ( p2mt == p2m_mmio_direct && - rangeset_contains_singleton(mmio_ro_ranges, mfn_x(target_mfn)) ) - { -- sflags &= ~(_PAGE_RW | _PAGE_PAT); -- sflags |= _PAGE_PCD | _PAGE_PWT; -+ sflags &= ~(_PAGE_RW | PAGE_CACHE_ATTRS); -+ sflags |= _PAGE_UC; - } - - // protect guest page tables --- -Sincerely, -Demi Marie Obenour (she/her/hers) -Invisible Things Lab diff --git a/0302-x86-mm-shadow-do-not-open-code-PAGE_CACHE_ATTRS.patch b/0302-x86-mm-shadow-do-not-open-code-PAGE_CACHE_ATTRS.patch deleted file mode 100644 index 54a36395..00000000 --- a/0302-x86-mm-shadow-do-not-open-code-PAGE_CACHE_ATTRS.patch +++ /dev/null @@ -1,49 +0,0 @@ -From a6da84524ceaf24ff997d03407b93f60c12857f3 Mon Sep 17 00:00:00 2001 -From: Demi Marie Obenour -Date: Tue, 6 Dec 2022 13:55:07 +0100 -Subject: [PATCH 2/9] x86/mm/shadow: do not open-code PAGE_CACHE_ATTRS -To: xen-devel@lists.xenproject.org -Cc: Marek Marczykowski-Górecki , - Jan Beulich , - Andrew Cooper , - "Roger Pau Monné" , - Wei Liu , - Jun Nakajima , - Kevin Tian , - George Dunlap , - Tim Deegan - -This makes the code easier to understand. - -Signed-off-by: Demi Marie Obenour -Acked-by: Jan Beulich ---- - xen/arch/x86/mm/shadow/multi.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c -index 4e94fec3d50cde0e5a26ecb62ff4d00dd00f759d..6bb564b0145285afc93b72a60b7797fcfe8696dc 100644 ---- a/xen/arch/x86/mm/shadow/multi.c -+++ b/xen/arch/x86/mm/shadow/multi.c -@@ -535,7 +535,7 @@ _sh_propagate(struct vcpu *v, - if ( guest_nx_enabled(v) ) - pass_thru_flags |= _PAGE_NX_BIT; - if ( level == 1 && !shadow_mode_refcounts(d) && mmio_mfn ) -- pass_thru_flags |= _PAGE_PAT | _PAGE_PCD | _PAGE_PWT; -+ pass_thru_flags |= PAGE_CACHE_ATTRS; - sflags = gflags & pass_thru_flags; - - /* -@@ -548,7 +548,7 @@ _sh_propagate(struct vcpu *v, - { - int type; - -- ASSERT(!(sflags & (_PAGE_PAT | _PAGE_PCD | _PAGE_PWT))); -+ ASSERT(!(sflags & PAGE_CACHE_ATTRS)); - - /* compute the PAT index for shadow page entry when VT-d is enabled - * and device assigned. --- -Sincerely, -Demi Marie Obenour (she/her/hers) -Invisible Things Lab diff --git a/0303-p2m-pt-Avoid-hard-coding-Xen-s-PAT.patch b/0303-p2m-pt-Avoid-hard-coding-Xen-s-PAT.patch deleted file mode 100644 index 2857f75e..00000000 --- a/0303-p2m-pt-Avoid-hard-coding-Xen-s-PAT.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 1ca8af08dfa46a8b3c376e0bd1b74ccde579f48d Mon Sep 17 00:00:00 2001 -From: Demi Marie Obenour -Date: Thu, 15 Dec 2022 17:03:45 +0100 -Subject: [PATCH 3/9] p2m-pt: Avoid hard-coding Xen's PAT -To: xen-devel@lists.xenproject.org -Cc: Marek Marczykowski-Górecki , - Jan Beulich , - Andrew Cooper , - "Roger Pau Monné" , - Wei Liu , - Jun Nakajima , - Kevin Tian , - George Dunlap , - Tim Deegan - -This makes the code much easier to understand. No functional change -intended. As per Andrew Cooper, the existing logic is questionable, but -this does not make it any worse. - -Signed-off-by: Demi Marie Obenour -Acked-by: Jan Beulich ---- - xen/arch/x86/mm/p2m-pt.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c -index eaba2b0fb4e6830f52b7d112fba8175dfe6d2770..cd1af33b6772ab1016e8d4c3284a6bc5d282869d 100644 ---- a/xen/arch/x86/mm/p2m-pt.c -+++ b/xen/arch/x86/mm/p2m-pt.c -@@ -99,13 +99,13 @@ static unsigned long p2m_type_to_flags(const struct p2m_domain *p2m, - return flags | P2M_BASE_FLAGS | _PAGE_RW | _PAGE_NX_BIT; - case p2m_mmio_direct: - if ( !rangeset_contains_singleton(mmio_ro_ranges, mfn_x(mfn)) ) -- flags |= _PAGE_RW; -+ flags |= _PAGE_RW | _PAGE_UCM; - else - { -- flags |= _PAGE_PWT; -+ flags |= _PAGE_UC; - ASSERT(!level); - } -- return flags | P2M_BASE_FLAGS | _PAGE_PCD; -+ return flags | P2M_BASE_FLAGS; - } - } - --- -Sincerely, -Demi Marie Obenour (she/her/hers) -Invisible Things Lab diff --git a/0304-efi-Avoid-hard-coding-the-various-PAT-constants.patch b/0304-efi-Avoid-hard-coding-the-various-PAT-constants.patch deleted file mode 100644 index 7de0431c..00000000 --- a/0304-efi-Avoid-hard-coding-the-various-PAT-constants.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 32b61bcafccc1f12b7e98d2d2e3cef763ac1fb60 Mon Sep 17 00:00:00 2001 -From: Demi Marie Obenour -Date: Thu, 15 Dec 2022 17:04:40 +0100 -Subject: [PATCH 4/9] efi: Avoid hard-coding the various PAT constants -To: xen-devel@lists.xenproject.org -Cc: Marek Marczykowski-Górecki , - Jan Beulich , - Andrew Cooper , - "Roger Pau Monné" , - Wei Liu , - Jun Nakajima , - Kevin Tian , - George Dunlap , - Tim Deegan - -This makes the code much easier to understand, and avoids problems if -Xen's PAT ever changes in the future. - -Signed-off-by: Demi Marie Obenour -Reviewed-by: Jan Beulich ---- - xen/common/efi/boot.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c -index d521b47bc6d9513ca6e65c3170abb94881a71910..e1248d63e7f99d598a6b1df04e34ed34ed0b6910 100644 ---- a/xen/common/efi/boot.c -+++ b/xen/common/efi/boot.c -@@ -1748,23 +1748,23 @@ void __init efi_init_memory(void) - emfn = PFN_UP(desc->PhysicalStart + len); - - if ( desc->Attribute & EFI_MEMORY_WB ) -- /* nothing */; -+ prot |= _PAGE_WB; - else if ( desc->Attribute & EFI_MEMORY_WT ) -- prot |= _PAGE_PWT | MAP_SMALL_PAGES; -+ prot |= _PAGE_WT | MAP_SMALL_PAGES; - else if ( desc->Attribute & EFI_MEMORY_WC ) -- prot |= _PAGE_PAT | MAP_SMALL_PAGES; -+ prot |= _PAGE_WC | MAP_SMALL_PAGES; - else if ( desc->Attribute & (EFI_MEMORY_UC | EFI_MEMORY_UCE) ) -- prot |= _PAGE_PWT | _PAGE_PCD | MAP_SMALL_PAGES; -+ prot |= _PAGE_UC | MAP_SMALL_PAGES; - else if ( efi_bs_revision >= EFI_REVISION(2, 5) && - (desc->Attribute & EFI_MEMORY_WP) ) -- prot |= _PAGE_PAT | _PAGE_PWT | MAP_SMALL_PAGES; -+ prot |= _PAGE_WP | MAP_SMALL_PAGES; - else - { - printk(XENLOG_ERR "Unknown cachability for MFNs %#lx-%#lx%s\n", - smfn, emfn - 1, efi_map_uc ? ", assuming UC" : ""); - if ( !efi_map_uc ) - continue; -- prot |= _PAGE_PWT | _PAGE_PCD | MAP_SMALL_PAGES; -+ prot |= _PAGE_UC | MAP_SMALL_PAGES; - } - - if ( desc->Attribute & (efi_bs_revision < EFI_REVISION(2, 5) --- -Sincerely, -Demi Marie Obenour (she/her/hers) -Invisible Things Lab diff --git a/0305-x86-Add-memory-type-constants.patch b/0305-x86-Add-memory-type-constants.patch deleted file mode 100644 index 05a8c6ac..00000000 --- a/0305-x86-Add-memory-type-constants.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 4714ae256f8cf75af2631eadc6d275e04f4d5d17 Mon Sep 17 00:00:00 2001 -From: Demi Marie Obenour -Date: Tue, 20 Dec 2022 16:49:16 +0100 -Subject: [PATCH 5/9] x86: Add memory type constants -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit -To: xen-devel@lists.xenproject.org -Cc: Marek Marczykowski-Górecki , - Jan Beulich , - Andrew Cooper , - "Roger Pau Monné" , - Wei Liu , - Jun Nakajima , - Kevin Tian , - George Dunlap , - Tim Deegan - -These are not currently used, so there is no functional change. Future -patches will use these constants. - -Suggested-by: Andrew Cooper -Signed-off-by: Demi Marie Obenour -Acked-by: Jan Beulich ---- - xen/arch/x86/include/asm/x86-defns.h | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h -index 28628807cb9897cf6fa8e266f71f5f220813984d..42b5f382d438d21ac97b6438e8c810c7b964cf6d 100644 ---- a/xen/arch/x86/include/asm/x86-defns.h -+++ b/xen/arch/x86/include/asm/x86-defns.h -@@ -153,4 +153,15 @@ - (1u << X86_EXC_AC) | (1u << X86_EXC_CP) | \ - (1u << X86_EXC_VC) | (1u << X86_EXC_SX)) - -+/* Memory types */ -+#define X86_MT_UC 0x00 /* uncachable */ -+#define X86_MT_WC 0x01 /* write-combined */ -+#define X86_MT_RSVD_2 0x02 /* reserved */ -+#define X86_MT_RSVD_3 0x03 /* reserved */ -+#define X86_MT_WT 0x04 /* write-through */ -+#define X86_MT_WP 0x05 /* write-protect */ -+#define X86_MT_WB 0x06 /* write-back */ -+#define X86_MT_UCM 0x07 /* UC- */ -+#define X86_NUM_MT 0x08 -+ - #endif /* __XEN_X86_DEFNS_H__ */ --- -Sincerely, -Demi Marie Obenour (she/her/hers) -Invisible Things Lab diff --git a/0306-x86-Replace-PAT_-with-X86_MT_.patch b/0306-x86-Replace-PAT_-with-X86_MT_.patch deleted file mode 100644 index aad8119a..00000000 --- a/0306-x86-Replace-PAT_-with-X86_MT_.patch +++ /dev/null @@ -1,282 +0,0 @@ -From 60b8f9a73987e22ab652ac0d4bdd2db81d1dc33a Mon Sep 17 00:00:00 2001 -From: Demi Marie Obenour -Date: Tue, 20 Dec 2022 16:49:35 +0100 -Subject: [PATCH 6/9] x86: Replace PAT_* with X86_MT_* -To: xen-devel@lists.xenproject.org -Cc: Marek Marczykowski-Górecki , - Jan Beulich , - Andrew Cooper , - "Roger Pau Monné" , - Wei Liu , - Jun Nakajima , - Kevin Tian , - George Dunlap , - Tim Deegan - -This allows eliminating the former. - -Suggested-by: Andrew Cooper -Signed-off-by: Demi Marie Obenour -Reviewed-by: Jan Beulich ---- - xen/arch/x86/hvm/hvm.c | 12 ++++---- - xen/arch/x86/hvm/mtrr.c | 52 ++++++++++++++++----------------- - xen/arch/x86/hvm/vmx/vmx.c | 16 +++++----- - xen/arch/x86/include/asm/mtrr.h | 12 +------- - xen/arch/x86/mm/p2m-ept.c | 4 +-- - xen/arch/x86/mm/shadow/multi.c | 4 +-- - 6 files changed, 45 insertions(+), 55 deletions(-) - -diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c -index ae4368ec4b338cf8c6cb14d383f612c91c98e800..00b3fa56e25e2934e2870e11fd19b120daff2715 100644 ---- a/xen/arch/x86/hvm/hvm.c -+++ b/xen/arch/x86/hvm/hvm.c -@@ -307,12 +307,12 @@ int hvm_set_guest_pat(struct vcpu *v, uint64_t guest_pat) - for ( i = 0, tmp = guest_pat; i < 8; i++, tmp >>= 8 ) - switch ( tmp & 0xff ) - { -- case PAT_TYPE_UC_MINUS: -- case PAT_TYPE_UNCACHABLE: -- case PAT_TYPE_WRBACK: -- case PAT_TYPE_WRCOMB: -- case PAT_TYPE_WRPROT: -- case PAT_TYPE_WRTHROUGH: -+ case X86_MT_UCM: -+ case X86_MT_UC: -+ case X86_MT_WB: -+ case X86_MT_WC: -+ case X86_MT_WP: -+ case X86_MT_WT: - break; - default: - return 0; -diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c -index 4d2aa6def86de45aeeaade7a1a7815c5ef2b3d7a..242623f3c239ee18a44f882ecb3910a00c615825 100644 ---- a/xen/arch/x86/hvm/mtrr.c -+++ b/xen/arch/x86/hvm/mtrr.c -@@ -37,7 +37,7 @@ static const uint8_t pat_entry_2_pte_flags[8] = { - _PAGE_PAT | _PAGE_PCD, _PAGE_PAT | _PAGE_PCD | _PAGE_PWT }; - - /* Effective mm type lookup table, according to MTRR and PAT. */ --static const uint8_t mm_type_tbl[MTRR_NUM_TYPES][PAT_TYPE_NUMS] = { -+static const uint8_t mm_type_tbl[MTRR_NUM_TYPES][X86_NUM_MT] = { - #define RS MEMORY_NUM_TYPES - #define UC MTRR_TYPE_UNCACHABLE - #define WB MTRR_TYPE_WRBACK -@@ -72,8 +72,8 @@ static uint8_t __read_mostly mtrr_epat_tbl[MTRR_NUM_TYPES][MEMORY_NUM_TYPES] = - }; - - /* Lookup table for PAT entry of a given PAT value in host PAT. */ --static uint8_t __read_mostly pat_entry_tbl[PAT_TYPE_NUMS] = -- { [0 ... PAT_TYPE_NUMS-1] = INVALID_MEM_TYPE }; -+static uint8_t __read_mostly pat_entry_tbl[X86_NUM_MT] = -+ { [0 ... X86_NUM_MT - 1] = INVALID_MEM_TYPE }; - - static int __init cf_check hvm_mtrr_pat_init(void) - { -@@ -81,7 +81,7 @@ static int __init cf_check hvm_mtrr_pat_init(void) - - for ( i = 0; i < MTRR_NUM_TYPES; i++ ) - { -- for ( j = 0; j < PAT_TYPE_NUMS; j++ ) -+ for ( j = 0; j < X86_NUM_MT; j++ ) - { - unsigned int tmp = mm_type_tbl[i][j]; - -@@ -90,9 +90,9 @@ static int __init cf_check hvm_mtrr_pat_init(void) - } - } - -- for ( i = 0; i < PAT_TYPE_NUMS; i++ ) -+ for ( i = 0; i < X86_NUM_MT; i++ ) - { -- for ( j = 0; j < PAT_TYPE_NUMS; j++ ) -+ for ( j = 0; j < X86_NUM_MT; j++ ) - { - if ( pat_cr_2_paf(XEN_MSR_PAT, j) == i ) - { -@@ -115,7 +115,7 @@ uint8_t pat_type_2_pte_flags(uint8_t pat_type) - * given pat_type. If host PAT covers all the PAT types, it can't happen. - */ - if ( unlikely(pat_entry == INVALID_MEM_TYPE) ) -- pat_entry = pat_entry_tbl[PAT_TYPE_UNCACHABLE]; -+ pat_entry = pat_entry_tbl[X86_MT_UC]; - - return pat_entry_2_pte_flags[pat_entry]; - } -@@ -145,14 +145,14 @@ int hvm_vcpu_cacheattr_init(struct vcpu *v) - m->mtrr_cap = (1u << 10) | (1u << 8) | num_var_ranges; - - v->arch.hvm.pat_cr = -- ((uint64_t)PAT_TYPE_WRBACK) | /* PAT0: WB */ -- ((uint64_t)PAT_TYPE_WRTHROUGH << 8) | /* PAT1: WT */ -- ((uint64_t)PAT_TYPE_UC_MINUS << 16) | /* PAT2: UC- */ -- ((uint64_t)PAT_TYPE_UNCACHABLE << 24) | /* PAT3: UC */ -- ((uint64_t)PAT_TYPE_WRBACK << 32) | /* PAT4: WB */ -- ((uint64_t)PAT_TYPE_WRTHROUGH << 40) | /* PAT5: WT */ -- ((uint64_t)PAT_TYPE_UC_MINUS << 48) | /* PAT6: UC- */ -- ((uint64_t)PAT_TYPE_UNCACHABLE << 56); /* PAT7: UC */ -+ ((uint64_t)X86_MT_WB) | /* PAT0: WB */ -+ ((uint64_t)X86_MT_WT << 8) | /* PAT1: WT */ -+ ((uint64_t)X86_MT_UCM << 16) | /* PAT2: UC- */ -+ ((uint64_t)X86_MT_UC << 24) | /* PAT3: UC */ -+ ((uint64_t)X86_MT_WB << 32) | /* PAT4: WB */ -+ ((uint64_t)X86_MT_WT << 40) | /* PAT5: WT */ -+ ((uint64_t)X86_MT_UCM << 48) | /* PAT6: UC- */ -+ ((uint64_t)X86_MT_UC << 56); /* PAT7: UC */ - - if ( is_hardware_domain(v->domain) ) - { -@@ -356,7 +356,7 @@ uint32_t get_pat_flags(struct vcpu *v, - */ - pat_entry_value = mtrr_epat_tbl[shadow_mtrr_type][guest_eff_mm_type]; - /* If conflit occurs(e.g host MTRR is UC, guest memory type is -- * WB),set UC as effective memory. Here, returning PAT_TYPE_UNCACHABLE will -+ * WB), set UC as effective memory. Here, returning X86_MT_UC will - * always set effective memory as UC. - */ - if ( pat_entry_value == INVALID_MEM_TYPE ) -@@ -371,7 +371,7 @@ uint32_t get_pat_flags(struct vcpu *v, - "because the host mtrr type is:%d\n", - gl1e_flags, (uint64_t)gpaddr, guest_eff_mm_type, - shadow_mtrr_type); -- pat_entry_value = PAT_TYPE_UNCACHABLE; -+ pat_entry_value = X86_MT_UC; - } - /* 4. Get the pte flags */ - return pat_type_2_pte_flags(pat_entry_value); -@@ -620,13 +620,13 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start, - p2m_memory_type_changed(d); - switch ( type ) - { -- case PAT_TYPE_UC_MINUS: -+ case X86_MT_UCM: - /* - * For EPT we can also avoid the flush in this case; - * see epte_get_entry_emt(). - */ - if ( hap_enabled(d) && cpu_has_vmx ) -- case PAT_TYPE_UNCACHABLE: -+ case X86_MT_UC: - break; - /* fall through */ - default: -@@ -638,12 +638,12 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start, - domain_unlock(d); - return -ENOENT; - -- case PAT_TYPE_UC_MINUS: -- case PAT_TYPE_UNCACHABLE: -- case PAT_TYPE_WRBACK: -- case PAT_TYPE_WRCOMB: -- case PAT_TYPE_WRPROT: -- case PAT_TYPE_WRTHROUGH: -+ case X86_MT_UCM: -+ case X86_MT_UC: -+ case X86_MT_WB: -+ case X86_MT_WC: -+ case X86_MT_WP: -+ case X86_MT_WT: - break; - - default: -@@ -681,7 +681,7 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start, - xfree(newr); - - p2m_memory_type_changed(d); -- if ( type != PAT_TYPE_WRBACK ) -+ if ( type != X86_MT_WB ) - flush_all(FLUSH_CACHE); - - return rc; -diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c -index 7c81b80710f99e08fe8291d3e413c449322b777d..b543c3983d77ae807e8bd97330691a79d8d39bae 100644 ---- a/xen/arch/x86/hvm/vmx/vmx.c -+++ b/xen/arch/x86/hvm/vmx/vmx.c -@@ -1231,14 +1231,14 @@ static void cf_check vmx_handle_cd(struct vcpu *v, unsigned long value) - * memory type are all UC. - */ - u64 uc_pat = -- ((uint64_t)PAT_TYPE_UNCACHABLE) | /* PAT0 */ -- ((uint64_t)PAT_TYPE_UNCACHABLE << 8) | /* PAT1 */ -- ((uint64_t)PAT_TYPE_UNCACHABLE << 16) | /* PAT2 */ -- ((uint64_t)PAT_TYPE_UNCACHABLE << 24) | /* PAT3 */ -- ((uint64_t)PAT_TYPE_UNCACHABLE << 32) | /* PAT4 */ -- ((uint64_t)PAT_TYPE_UNCACHABLE << 40) | /* PAT5 */ -- ((uint64_t)PAT_TYPE_UNCACHABLE << 48) | /* PAT6 */ -- ((uint64_t)PAT_TYPE_UNCACHABLE << 56); /* PAT7 */ -+ ((uint64_t)X86_MT_UC) | /* PAT0 */ -+ ((uint64_t)X86_MT_UC << 8) | /* PAT1 */ -+ ((uint64_t)X86_MT_UC << 16) | /* PAT2 */ -+ ((uint64_t)X86_MT_UC << 24) | /* PAT3 */ -+ ((uint64_t)X86_MT_UC << 32) | /* PAT4 */ -+ ((uint64_t)X86_MT_UC << 40) | /* PAT5 */ -+ ((uint64_t)X86_MT_UC << 48) | /* PAT6 */ -+ ((uint64_t)X86_MT_UC << 56); /* PAT7 */ - - vmx_get_guest_pat(v, pat); - vmx_set_guest_pat(v, uc_pat); -diff --git a/xen/arch/x86/include/asm/mtrr.h b/xen/arch/x86/include/asm/mtrr.h -index 7733800b798fc2c72ba87e4ce6500e4183553d04..92fc930c692039b6c709d6a04f6553593f40aa55 100644 ---- a/xen/arch/x86/include/asm/mtrr.h -+++ b/xen/arch/x86/include/asm/mtrr.h -@@ -16,17 +16,7 @@ - #define NORMAL_CACHE_MODE 0 - #define NO_FILL_CACHE_MODE 2 - --enum { -- PAT_TYPE_UNCACHABLE=0, -- PAT_TYPE_WRCOMB=1, -- PAT_TYPE_WRTHROUGH=4, -- PAT_TYPE_WRPROT=5, -- PAT_TYPE_WRBACK=6, -- PAT_TYPE_UC_MINUS=7, -- PAT_TYPE_NUMS --}; -- --#define INVALID_MEM_TYPE PAT_TYPE_NUMS -+#define INVALID_MEM_TYPE X86_NUM_MT - - /* In the Intel processor's MTRR interface, the MTRR type is always held in - an 8 bit field: */ -diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c -index d61d66c20e4180f8cbe21bcd97b568519e0b738e..126437285d8a9f222fca6a7b6ff4434b60637847 100644 ---- a/xen/arch/x86/mm/p2m-ept.c -+++ b/xen/arch/x86/mm/p2m-ept.c -@@ -573,8 +573,8 @@ int epte_get_entry_emt(struct domain *d, gfn_t gfn, mfn_t mfn, - if ( gmtrr_mtype >= 0 ) - { - *ipat = true; -- return gmtrr_mtype != PAT_TYPE_UC_MINUS ? gmtrr_mtype -- : MTRR_TYPE_UNCACHABLE; -+ return gmtrr_mtype != X86_MT_UCM ? gmtrr_mtype -+ : MTRR_TYPE_UNCACHABLE; - } - if ( gmtrr_mtype == -EADDRNOTAVAIL ) - return -1; -diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c -index 6bb564b0145285afc93b72a60b7797fcfe8696dc..b64bba70fc17906236872a017ad48ce91fd30803 100644 ---- a/xen/arch/x86/mm/shadow/multi.c -+++ b/xen/arch/x86/mm/shadow/multi.c -@@ -561,7 +561,7 @@ _sh_propagate(struct vcpu *v, - (type = hvm_get_mem_pinned_cacheattr(d, target_gfn, 0)) >= 0 ) - sflags |= pat_type_2_pte_flags(type); - else if ( d->arch.hvm.is_in_uc_mode ) -- sflags |= pat_type_2_pte_flags(PAT_TYPE_UNCACHABLE); -+ sflags |= pat_type_2_pte_flags(X86_MT_UC); - else - if ( iomem_access_permitted(d, mfn_x(target_mfn), mfn_x(target_mfn)) ) - { -@@ -572,7 +572,7 @@ _sh_propagate(struct vcpu *v, - mfn_to_maddr(target_mfn), - MTRR_TYPE_UNCACHABLE); - else if ( iommu_snoop ) -- sflags |= pat_type_2_pte_flags(PAT_TYPE_WRBACK); -+ sflags |= pat_type_2_pte_flags(X86_MT_WB); - else - sflags |= get_pat_flags(v, - gflags, --- -Sincerely, -Demi Marie Obenour (she/her/hers) -Invisible Things Lab diff --git a/0307-x86-Replace-MTRR_-constants-with-X86_MT_-constants.patch b/0307-x86-Replace-MTRR_-constants-with-X86_MT_-constants.patch deleted file mode 100644 index 6867ed05..00000000 --- a/0307-x86-Replace-MTRR_-constants-with-X86_MT_-constants.patch +++ /dev/null @@ -1,418 +0,0 @@ -From 6eaaa1fcb96438f35f69443cd375fe0b85595b7b Mon Sep 17 00:00:00 2001 -From: Demi Marie Obenour -Date: Tue, 20 Dec 2022 16:50:38 +0100 -Subject: [PATCH 7/9] x86: Replace MTRR_* constants with X86_MT_* constants -To: xen-devel@lists.xenproject.org -Cc: Marek Marczykowski-Górecki , - Jan Beulich , - Andrew Cooper , - "Roger Pau Monné" , - Wei Liu , - Jun Nakajima , - Kevin Tian , - George Dunlap , - Tim Deegan - -This allows eliminating of the former, with the exception of -MTRR_NUM_TYPES. MTRR_NUM_TYPES is kept, as due to a quirk of the x86 -architecture X86_MT_UCM (7) is not valid in an MTRR. - -Suggested-by: Andrew Cooper -Signed-off-by: Demi Marie Obenour -Reviewed-by: Jan Beulich ---- - xen/arch/x86/cpu/mtrr/generic.c | 10 ++--- - xen/arch/x86/cpu/mtrr/main.c | 26 ++++++------- - xen/arch/x86/e820.c | 4 +- - xen/arch/x86/hvm/mtrr.c | 30 +++++++-------- - xen/arch/x86/hvm/vmx/vmcs.c | 2 +- - xen/arch/x86/hvm/vmx/vmx.c | 2 +- - xen/arch/x86/include/asm/hvm/vmx/vmcs.h | 2 +- - xen/arch/x86/include/asm/mtrr.h | 10 +---- - xen/arch/x86/mm/p2m-ept.c | 51 ++++++++++++------------- - xen/arch/x86/mm/shadow/multi.c | 2 +- - 10 files changed, 66 insertions(+), 73 deletions(-) - -diff --git a/xen/arch/x86/cpu/mtrr/generic.c b/xen/arch/x86/cpu/mtrr/generic.c -index 47aaf76226e0a8a0712b7211ed339a4a032ab3f3..660ae26c2350b3436a471155fc0426699ba8ac1d 100644 ---- a/xen/arch/x86/cpu/mtrr/generic.c -+++ b/xen/arch/x86/cpu/mtrr/generic.c -@@ -127,11 +127,11 @@ static const char *__init mtrr_attrib_to_str(mtrr_type x) - { - static const char __initconst strings[MTRR_NUM_TYPES][16] = - { -- [MTRR_TYPE_UNCACHABLE] = "uncachable", -- [MTRR_TYPE_WRCOMB] = "write-combining", -- [MTRR_TYPE_WRTHROUGH] = "write-through", -- [MTRR_TYPE_WRPROT] = "write-protect", -- [MTRR_TYPE_WRBACK] = "write-back", -+ [X86_MT_UC] = "uncachable", -+ [X86_MT_WC] = "write-combining", -+ [X86_MT_WT] = "write-through", -+ [X86_MT_WP] = "write-protect", -+ [X86_MT_WB] = "write-back", - }; - - return (x < ARRAY_SIZE(strings) && strings[x][0]) ? strings[x] : "?"; -diff --git a/xen/arch/x86/cpu/mtrr/main.c b/xen/arch/x86/cpu/mtrr/main.c -index 4e01c8d6f9df6562b94438f265d79a0a6fca8de6..2946003b84938f3b83c98b62dfaa3ace90822983 100644 ---- a/xen/arch/x86/cpu/mtrr/main.c -+++ b/xen/arch/x86/cpu/mtrr/main.c -@@ -163,10 +163,10 @@ static void cf_check ipi_handler(void *info) - } - - static inline int types_compatible(mtrr_type type1, mtrr_type type2) { -- return type1 == MTRR_TYPE_UNCACHABLE || -- type2 == MTRR_TYPE_UNCACHABLE || -- (type1 == MTRR_TYPE_WRTHROUGH && type2 == MTRR_TYPE_WRBACK) || -- (type1 == MTRR_TYPE_WRBACK && type2 == MTRR_TYPE_WRTHROUGH); -+ return type1 == X86_MT_UC || -+ type2 == X86_MT_UC || -+ (type1 == X86_MT_WT && type2 == X86_MT_WB) || -+ (type1 == X86_MT_WB && type2 == X86_MT_WT); - } - - /** -@@ -297,13 +297,13 @@ static void set_mtrr(unsigned int reg, unsigned long base, - * - * The available types are - * -- * %MTRR_TYPE_UNCACHABLE - No caching -+ * %X86_MT_UC - No caching - * -- * %MTRR_TYPE_WRBACK - Write data back in bursts whenever -+ * %X86_MT_WB - Write data back in bursts whenever - * -- * %MTRR_TYPE_WRCOMB - Write data back soon but allow bursts -+ * %X86_MT_WC - Write data back soon but allow bursts - * -- * %MTRR_TYPE_WRTHROUGH - Cache reads but not writes -+ * %X86_MT_WT - Cache reads but not writes - * - * BUGS: Needs a quiet flag for the cases where drivers do not mind - * failures and do not wish system log messages to be sent. -@@ -328,7 +328,7 @@ int mtrr_add_page(unsigned long base, unsigned long size, - } - - /* If the type is WC, check that this processor supports it */ -- if ((type == MTRR_TYPE_WRCOMB) && mtrr_have_wrcomb()) { -+ if ((type == X86_MT_WC) && !mtrr_have_wrcomb()) { - printk(KERN_WARNING - "mtrr: your processor doesn't support write-combining\n"); - return -EOPNOTSUPP; -@@ -442,13 +442,13 @@ static int mtrr_check(unsigned long base, unsigned long size) - * - * The available types are - * -- * %MTRR_TYPE_UNCACHABLE - No caching -+ * %X86_MT_UC - No caching - * -- * %MTRR_TYPE_WRBACK - Write data back in bursts whenever -+ * %X86_MT_WB - Write data back in bursts whenever - * -- * %MTRR_TYPE_WRCOMB - Write data back soon but allow bursts -+ * %X86_MT_WC - Write data back soon but allow bursts - * -- * %MTRR_TYPE_WRTHROUGH - Cache reads but not writes -+ * %X86_MT_WT - Cache reads but not writes - * - * BUGS: Needs a quiet flag for the cases where drivers do not mind - * failures and do not wish system log messages to be sent. -diff --git a/xen/arch/x86/e820.c b/xen/arch/x86/e820.c -index b653a19c93afb98c2d64330384cb4fa7b4d2e1ec..c5911cf48dc4a281c03ddef35f23b19bc7af42eb 100644 ---- a/xen/arch/x86/e820.c -+++ b/xen/arch/x86/e820.c -@@ -459,7 +459,7 @@ static uint64_t __init mtrr_top_of_ram(void) - printk(" MTRR cap: %"PRIx64" type: %"PRIx64"\n", mtrr_cap, mtrr_def); - - /* MTRRs enabled, and default memory type is not writeback? */ -- if ( !test_bit(11, &mtrr_def) || ((uint8_t)mtrr_def == MTRR_TYPE_WRBACK) ) -+ if ( !test_bit(11, &mtrr_def) || ((uint8_t)mtrr_def == X86_MT_WB) ) - return 0; - - /* -@@ -476,7 +476,7 @@ static uint64_t __init mtrr_top_of_ram(void) - printk(" MTRR[%d]: base %"PRIx64" mask %"PRIx64"\n", - i, base, mask); - -- if ( !test_bit(11, &mask) || ((uint8_t)base != MTRR_TYPE_WRBACK) ) -+ if ( !test_bit(11, &mask) || ((uint8_t)base != X86_MT_WB) ) - continue; - base &= addr_mask; - mask &= addr_mask; -diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c -index 242623f3c239ee18a44f882ecb3910a00c615825..093103f6c768cf64f880d1b20e1c14f5918c1250 100644 ---- a/xen/arch/x86/hvm/mtrr.c -+++ b/xen/arch/x86/hvm/mtrr.c -@@ -39,11 +39,11 @@ static const uint8_t pat_entry_2_pte_flags[8] = { - /* Effective mm type lookup table, according to MTRR and PAT. */ - static const uint8_t mm_type_tbl[MTRR_NUM_TYPES][X86_NUM_MT] = { - #define RS MEMORY_NUM_TYPES --#define UC MTRR_TYPE_UNCACHABLE --#define WB MTRR_TYPE_WRBACK --#define WC MTRR_TYPE_WRCOMB --#define WP MTRR_TYPE_WRPROT --#define WT MTRR_TYPE_WRTHROUGH -+#define UC X86_MT_UC -+#define WB X86_MT_WB -+#define WC X86_MT_WC -+#define WP X86_MT_WP -+#define WT X86_MT_WT - - /* PAT(UC, WC, RS, RS, WT, WP, WB, UC-) */ - /* MTRR(UC) */ {UC, WC, RS, RS, UC, UC, UC, UC}, -@@ -202,7 +202,7 @@ int mtrr_get_type(const struct mtrr_state *m, paddr_t pa, unsigned int order) - unsigned int seg, num_var_ranges = MASK_EXTR(m->mtrr_cap, MTRRcap_VCNT); - - if ( unlikely(!m->enabled) ) -- return MTRR_TYPE_UNCACHABLE; -+ return X86_MT_UC; - - pa &= mask; - if ( (pa < 0x100000) && m->fixed_enabled ) -@@ -277,13 +277,13 @@ int mtrr_get_type(const struct mtrr_state *m, paddr_t pa, unsigned int order) - return -1; - - /* Two or more matches, one being UC? */ -- if ( overlap_mtrr & (1 << MTRR_TYPE_UNCACHABLE) ) -- return MTRR_TYPE_UNCACHABLE; -+ if ( overlap_mtrr & (1 << X86_MT_UC) ) -+ return X86_MT_UC; - - /* Two or more matches, all of them WT and WB? */ - if ( overlap_mtrr == -- ((1 << MTRR_TYPE_WRTHROUGH) | (1 << MTRR_TYPE_WRBACK)) ) -- return MTRR_TYPE_WRTHROUGH; -+ ((1 << X86_MT_WT) | (1 << X86_MT_WB)) ) -+ return X86_MT_WT; - - /* Behaviour is undefined, but return the last overlapped type. */ - return overlap_mtrr_pos; -@@ -381,11 +381,11 @@ static inline bool_t valid_mtrr_type(uint8_t type) - { - switch ( type ) - { -- case MTRR_TYPE_UNCACHABLE: -- case MTRR_TYPE_WRBACK: -- case MTRR_TYPE_WRCOMB: -- case MTRR_TYPE_WRPROT: -- case MTRR_TYPE_WRTHROUGH: -+ case X86_MT_UC: -+ case X86_MT_WB: -+ case X86_MT_WC: -+ case X86_MT_WP: -+ case X86_MT_WT: - return 1; - } - return 0; -diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c -index 84dbb88d33b76111833a37339186199f8bc03b5e..f0825216d722d978f221bb34a797d8de5505cb80 100644 ---- a/xen/arch/x86/hvm/vmx/vmcs.c -+++ b/xen/arch/x86/hvm/vmx/vmcs.c -@@ -555,7 +555,7 @@ static int vmx_init_vmcs_config(bool bsp) - /* Require Write-Back (WB) memory type for VMCS accesses. */ - opt = (vmx_basic_msr_high & (VMX_BASIC_MEMORY_TYPE_MASK >> 32)) / - ((VMX_BASIC_MEMORY_TYPE_MASK & -VMX_BASIC_MEMORY_TYPE_MASK) >> 32); -- if ( opt != MTRR_TYPE_WRBACK ) -+ if ( opt != X86_MT_WB ) - { - printk("VMX: CPU%d has unexpected VMCS access type %u\n", - smp_processor_id(), opt); -diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c -index b543c3983d77ae807e8bd97330691a79d8d39bae..4ae7dd56c9981d32ac545d6e7b7c126b15f68969 100644 ---- a/xen/arch/x86/hvm/vmx/vmx.c -+++ b/xen/arch/x86/hvm/vmx/vmx.c -@@ -434,7 +434,7 @@ static void cf_check domain_creation_finished(struct domain *d) - return; - - ASSERT(epte_get_entry_emt(d, gfn, apic_access_mfn, 0, &ipat, -- p2m_mmio_direct) == MTRR_TYPE_WRBACK); -+ p2m_mmio_direct) == X86_MT_WB); - ASSERT(ipat); - - if ( set_mmio_p2m_entry(d, gfn, apic_access_mfn, PAGE_ORDER_4K) ) -diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h -index 75f9928abfad28e3895fe3dd4058b2b0a6e145c3..65e9e27b5437adff59abc46976f73a9f2cc587da 100644 ---- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h -+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h -@@ -38,7 +38,7 @@ struct vmx_msr_entry { - u64 data; - }; - --#define EPT_DEFAULT_MT MTRR_TYPE_WRBACK -+#define EPT_DEFAULT_MT X86_MT_WB - - struct ept_data { - union { -diff --git a/xen/arch/x86/include/asm/mtrr.h b/xen/arch/x86/include/asm/mtrr.h -index 92fc930c692039b6c709d6a04f6553593f40aa55..e4f6ca6048334b2094a1836cc2f298453641232f 100644 ---- a/xen/arch/x86/include/asm/mtrr.h -+++ b/xen/arch/x86/include/asm/mtrr.h -@@ -3,15 +3,9 @@ - - #include - --/* These are the region types. They match the architectural specification. */ --#define MTRR_TYPE_UNCACHABLE 0 --#define MTRR_TYPE_WRCOMB 1 --#define MTRR_TYPE_WRTHROUGH 4 --#define MTRR_TYPE_WRPROT 5 --#define MTRR_TYPE_WRBACK 6 --#define MTRR_NUM_TYPES 7 -+#define MTRR_NUM_TYPES X86_MT_UCM - #define MEMORY_NUM_TYPES MTRR_NUM_TYPES --#define NO_HARDCODE_MEM_TYPE MTRR_NUM_TYPES -+#define NO_HARDCODE_MEM_TYPE MTRR_NUM_TYPES - - #define NORMAL_CACHE_MODE 0 - #define NO_FILL_CACHE_MODE 2 -diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c -index 126437285d8a9f222fca6a7b6ff4434b60637847..bb143c6c42c69db4e054b9156aad9a18ea0b2378 100644 ---- a/xen/arch/x86/mm/p2m-ept.c -+++ b/xen/arch/x86/mm/p2m-ept.c -@@ -506,7 +506,7 @@ int epte_get_entry_emt(struct domain *d, gfn_t gfn, mfn_t mfn, - mfn_x(mfn) | ((1UL << order) - 1)) ) - { - *ipat = true; -- return MTRR_TYPE_UNCACHABLE; -+ return X86_MT_UC; - } - /* Force invalid memory type so resolve_misconfig() will split it */ - return -1; -@@ -515,7 +515,7 @@ int epte_get_entry_emt(struct domain *d, gfn_t gfn, mfn_t mfn, - if ( !mfn_valid(mfn) ) - { - *ipat = true; -- return MTRR_TYPE_UNCACHABLE; -+ return X86_MT_UC; - } - - /* -@@ -526,7 +526,7 @@ int epte_get_entry_emt(struct domain *d, gfn_t gfn, mfn_t mfn, - !cache_flush_permitted(d) ) - { - *ipat = true; -- return MTRR_TYPE_WRBACK; -+ return X86_MT_WB; - } - - for ( special_pgs = i = 0; i < (1ul << order); i++ ) -@@ -539,13 +539,13 @@ int epte_get_entry_emt(struct domain *d, gfn_t gfn, mfn_t mfn, - return -1; - - *ipat = true; -- return MTRR_TYPE_WRBACK; -+ return X86_MT_WB; - } - - switch ( type ) - { - case p2m_mmio_direct: -- return MTRR_TYPE_UNCACHABLE; -+ return X86_MT_UC; - - case p2m_grant_map_ro: - case p2m_grant_map_rw: -@@ -563,7 +563,7 @@ int epte_get_entry_emt(struct domain *d, gfn_t gfn, mfn_t mfn, - * diverges. See p2m_type_to_flags for the AMD attributes. - */ - *ipat = true; -- return MTRR_TYPE_WRBACK; -+ return X86_MT_WB; - - default: - break; -@@ -573,15 +573,14 @@ int epte_get_entry_emt(struct domain *d, gfn_t gfn, mfn_t mfn, - if ( gmtrr_mtype >= 0 ) - { - *ipat = true; -- return gmtrr_mtype != X86_MT_UCM ? gmtrr_mtype -- : MTRR_TYPE_UNCACHABLE; -+ return gmtrr_mtype != X86_MT_UCM ? gmtrr_mtype : X86_MT_UC; - } - if ( gmtrr_mtype == -EADDRNOTAVAIL ) - return -1; - - gmtrr_mtype = v ? mtrr_get_type(&v->arch.hvm.mtrr, - gfn_x(gfn) << PAGE_SHIFT, order) -- : MTRR_TYPE_WRBACK; -+ : X86_MT_WB; - hmtrr_mtype = mtrr_get_type(&mtrr_state, mfn_x(mfn) << PAGE_SHIFT, - order); - if ( gmtrr_mtype < 0 || hmtrr_mtype < 0 ) -@@ -592,14 +591,14 @@ int epte_get_entry_emt(struct domain *d, gfn_t gfn, mfn_t mfn, - return hmtrr_mtype; - - /* If either type is UC, we have to go with that one. */ -- if ( gmtrr_mtype == MTRR_TYPE_UNCACHABLE || -- hmtrr_mtype == MTRR_TYPE_UNCACHABLE ) -- return MTRR_TYPE_UNCACHABLE; -+ if ( gmtrr_mtype == X86_MT_UC || -+ hmtrr_mtype == X86_MT_UC ) -+ return X86_MT_UC; - - /* If either type is WB, we have to go with the other one. */ -- if ( gmtrr_mtype == MTRR_TYPE_WRBACK ) -+ if ( gmtrr_mtype == X86_MT_WB ) - return hmtrr_mtype; -- if ( hmtrr_mtype == MTRR_TYPE_WRBACK ) -+ if ( hmtrr_mtype == X86_MT_WB ) - return gmtrr_mtype; - - /* -@@ -610,13 +609,13 @@ int epte_get_entry_emt(struct domain *d, gfn_t gfn, mfn_t mfn, - * permit this), while WT and WP require writes to go straight to memory - * (WC can buffer them). - */ -- if ( (gmtrr_mtype == MTRR_TYPE_WRTHROUGH && -- hmtrr_mtype == MTRR_TYPE_WRPROT) || -- (gmtrr_mtype == MTRR_TYPE_WRPROT && -- hmtrr_mtype == MTRR_TYPE_WRTHROUGH) ) -- return MTRR_TYPE_WRPROT; -+ if ( (gmtrr_mtype == X86_MT_WT && -+ hmtrr_mtype == X86_MT_WP) || -+ (gmtrr_mtype == X86_MT_WP && -+ hmtrr_mtype == X86_MT_WT) ) -+ return X86_MT_WP; - -- return MTRR_TYPE_UNCACHABLE; -+ return X86_MT_UC; - } - - /* -@@ -1426,12 +1425,12 @@ void ept_p2m_uninit(struct p2m_domain *p2m) - static const char *memory_type_to_str(unsigned int x) - { - static const char memory_types[8][3] = { -- [MTRR_TYPE_UNCACHABLE] = "UC", -- [MTRR_TYPE_WRCOMB] = "WC", -- [MTRR_TYPE_WRTHROUGH] = "WT", -- [MTRR_TYPE_WRPROT] = "WP", -- [MTRR_TYPE_WRBACK] = "WB", -- [MTRR_NUM_TYPES] = "??" -+ [X86_MT_UC] = "UC", -+ [X86_MT_WC] = "WC", -+ [X86_MT_WT] = "WT", -+ [X86_MT_WP] = "WP", -+ [X86_MT_WB] = "WB", -+ [MTRR_NUM_TYPES] = "??", - }; - - ASSERT(x < ARRAY_SIZE(memory_types)); -diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c -index b64bba70fc17906236872a017ad48ce91fd30803..f5f7ff021bd9e057c5b6f6329de7acb5ef05d58f 100644 ---- a/xen/arch/x86/mm/shadow/multi.c -+++ b/xen/arch/x86/mm/shadow/multi.c -@@ -570,7 +570,7 @@ _sh_propagate(struct vcpu *v, - gflags, - gfn_to_paddr(target_gfn), - mfn_to_maddr(target_mfn), -- MTRR_TYPE_UNCACHABLE); -+ X86_MT_UC); - else if ( iommu_snoop ) - sflags |= pat_type_2_pte_flags(X86_MT_WB); - else --- -Sincerely, -Demi Marie Obenour (she/her/hers) -Invisible Things Lab diff --git a/0308-x86-Replace-EPT_EMT_-constants-with-X86_MT_.patch b/0308-x86-Replace-EPT_EMT_-constants-with-X86_MT_.patch deleted file mode 100644 index 38aa1981..00000000 --- a/0308-x86-Replace-EPT_EMT_-constants-with-X86_MT_.patch +++ /dev/null @@ -1,64 +0,0 @@ -From b7dd0f590aa69431f26f825ae3d568623ee7fe54 Mon Sep 17 00:00:00 2001 -From: Demi Marie Obenour -Date: Tue, 20 Dec 2022 16:51:18 +0100 -Subject: [PATCH 8/9] x86: Replace EPT_EMT_* constants with X86_MT_* -To: xen-devel@lists.xenproject.org -Cc: Marek Marczykowski-Górecki , - Jan Beulich , - Andrew Cooper , - "Roger Pau Monné" , - Wei Liu , - Jun Nakajima , - Kevin Tian , - George Dunlap , - Tim Deegan - -This allows eliminating the former. No functional change intended. - -Suggested-by: Andrew Cooper -Signed-off-by: Demi Marie Obenour -Reviewed-by: Jan Beulich ---- - xen/arch/x86/include/asm/hvm/vmx/vmx.h | 9 --------- - xen/arch/x86/mm/hap/nested_ept.c | 4 ++-- - 2 files changed, 2 insertions(+), 11 deletions(-) - -diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmx.h b/xen/arch/x86/include/asm/hvm/vmx/vmx.h -index 8eedf59155e01ec1ca84dcc6b30961f9c884cb3b..49fe9822fac5eae15b67f0cfd3d0cb96347dc7ed 100644 ---- a/xen/arch/x86/include/asm/hvm/vmx/vmx.h -+++ b/xen/arch/x86/include/asm/hvm/vmx/vmx.h -@@ -80,15 +80,6 @@ typedef enum { - #define EPTE_RWX_MASK 0x7 - #define EPTE_FLAG_MASK 0x7f - --#define EPT_EMT_UC 0 --#define EPT_EMT_WC 1 --#define EPT_EMT_RSV0 2 --#define EPT_EMT_RSV1 3 --#define EPT_EMT_WT 4 --#define EPT_EMT_WP 5 --#define EPT_EMT_WB 6 --#define EPT_EMT_RSV2 7 -- - #define PI_xAPIC_NDST_MASK 0xFF00 - - void vmx_asm_vmexit_handler(struct cpu_user_regs); -diff --git a/xen/arch/x86/mm/hap/nested_ept.c b/xen/arch/x86/mm/hap/nested_ept.c -index 1cb7fefc37091bf7d92a277203e652add5611871..23fb3889b7605be62805731218c314819d5027b5 100644 ---- a/xen/arch/x86/mm/hap/nested_ept.c -+++ b/xen/arch/x86/mm/hap/nested_ept.c -@@ -84,8 +84,8 @@ static bool_t nept_emt_bits_check(ept_entry_t e, uint32_t level) - { - if ( e.sp || level == 1 ) - { -- if ( e.emt == EPT_EMT_RSV0 || e.emt == EPT_EMT_RSV1 || -- e.emt == EPT_EMT_RSV2 ) -+ if ( e.emt == X86_MT_RSVD_2 || e.emt == X86_MT_RSVD_3 || -+ e.emt == X86_MT_UCM ) - return 1; - } - return 0; --- -Sincerely, -Demi Marie Obenour (she/her/hers) -Invisible Things Lab diff --git a/0309-x86-Derive-XEN_MSR_PAT-from-its-individual-entries.patch b/0309-x86-Derive-XEN_MSR_PAT-from-its-individual-entries.patch deleted file mode 100644 index cb2ebadf..00000000 --- a/0309-x86-Derive-XEN_MSR_PAT-from-its-individual-entries.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 4b40d68e663e87eb916b5bdf3da9743a17f43537 Mon Sep 17 00:00:00 2001 -From: Demi Marie Obenour -Date: Tue, 20 Dec 2022 16:51:55 +0100 -Subject: [PATCH 9/9] x86: Derive XEN_MSR_PAT from its individual entries -To: xen-devel@lists.xenproject.org -Cc: Marek Marczykowski-Górecki , - Jan Beulich , - Andrew Cooper , - "Roger Pau Monné" , - Wei Liu , - Jun Nakajima , - Kevin Tian , - George Dunlap , - Tim Deegan - -This avoids it being a magic constant that is difficult for humans to -decode. Use BUILD_BUG_ON to check that the old and new values are -identical. - -Signed-off-by: Demi Marie Obenour -Reviewed-by: Jan Beulich ---- - xen/arch/x86/include/asm/processor.h | 9 ++++++++- - xen/arch/x86/mm.c | 11 +++++++++++ - 2 files changed, 19 insertions(+), 1 deletion(-) - -diff --git a/xen/arch/x86/include/asm/processor.h b/xen/arch/x86/include/asm/processor.h -index 8e2816fae9b97bd4e153a30cc3802971fe0355af..60b902060914584957db8afa5c7c1e6abdad4d13 100644 ---- a/xen/arch/x86/include/asm/processor.h -+++ b/xen/arch/x86/include/asm/processor.h -@@ -96,7 +96,14 @@ - * Host IA32_CR_PAT value to cover all memory types. This is not the default - * MSR_PAT value, and is an ABI with PV guests. - */ --#define XEN_MSR_PAT _AC(0x050100070406, ULL) -+#define XEN_MSR_PAT ((_AC(X86_MT_WB, ULL) << 0x00) | \ -+ (_AC(X86_MT_WT, ULL) << 0x08) | \ -+ (_AC(X86_MT_UCM, ULL) << 0x10) | \ -+ (_AC(X86_MT_UC, ULL) << 0x18) | \ -+ (_AC(X86_MT_WC, ULL) << 0x20) | \ -+ (_AC(X86_MT_WP, ULL) << 0x28) | \ -+ (_AC(X86_MT_UC, ULL) << 0x30) | \ -+ (_AC(X86_MT_UC, ULL) << 0x38)) - - #ifndef __ASSEMBLY__ - -diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c -index 78b1972e4170cacccc9c37c6e64e76e66a7da87f..84dcec34b9ad8d5d6024667a14875eae86fdb267 100644 ---- a/xen/arch/x86/mm.c -+++ b/xen/arch/x86/mm.c -@@ -6350,6 +6350,17 @@ unsigned long get_upper_mfn_bound(void) - return min(max_mfn, 1UL << (paddr_bits - PAGE_SHIFT)) - 1; - } - -+static void __init __maybe_unused build_assertions(void) -+{ -+ /* -+ * If this trips, any guests that blindly rely on the public API in xen.h -+ * (instead of reading the PAT from Xen, as Linux 3.19+ does) will be -+ * broken. Furthermore, live migration of PV guests between Xen versions -+ * using different PATs will not work. -+ */ -+ BUILD_BUG_ON(XEN_MSR_PAT != 0x050100070406ULL); -+} -+ - /* - * Local variables: - * mode: C --- -Sincerely, -Demi Marie Obenour (she/her/hers) -Invisible Things Lab diff --git a/0314-drivers-char-support-up-to-1M-BAR0-of-xhci.patch b/0314-drivers-char-support-up-to-1M-BAR0-of-xhci.patch deleted file mode 100644 index 8a628f80..00000000 --- a/0314-drivers-char-support-up-to-1M-BAR0-of-xhci.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 549b042943a57b748ce80070d1174e4ff5b8ef0b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= - -Date: Wed, 14 Dec 2022 12:04:26 +0100 -Subject: [PATCH] drivers/char: support up to 1M BAR0 of xhci -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -AMD's XHCI has BAR0 of 1M (compared to 64K on Intel). Map it as a whole -(reserving more space in the fixmap). Make fixmap slot conditional on -CONFIG_XHCI. - -Signed-off-by: Marek Marczykowski-Górecki -Reviewed-by: Jan Beulich ---- - xen/arch/x86/include/asm/fixmap.h | 4 +++- - xen/drivers/char/xhci-dbc.c | 6 ++++-- - 2 files changed, 7 insertions(+), 3 deletions(-) - -diff --git a/xen/arch/x86/include/asm/fixmap.h b/xen/arch/x86/include/asm/fixmap.h -index bc39ffe896b1..516ec3fa6c95 100644 ---- a/xen/arch/x86/include/asm/fixmap.h -+++ b/xen/arch/x86/include/asm/fixmap.h -@@ -25,7 +25,7 @@ - #include - #include - --#define MAX_XHCI_PAGES 16 -+#define MAX_XHCI_PAGES 256 - - /* - * Here we define all the compile-time 'special' virtual -@@ -45,8 +45,10 @@ enum fixed_addresses { - FIX_COM_BEGIN, - FIX_COM_END, - FIX_EHCI_DBGP, -+#ifdef CONFIG_XHCI - FIX_XHCI_BEGIN, - FIX_XHCI_END = FIX_XHCI_BEGIN + MAX_XHCI_PAGES - 1, -+#endif - #ifdef CONFIG_XEN_GUEST - FIX_PV_CONSOLE, - FIX_XEN_SHARED_INFO, -diff --git a/xen/drivers/char/xhci-dbc.c b/xen/drivers/char/xhci-dbc.c -index 86f6df6bef67..60b781f87202 100644 ---- a/xen/drivers/char/xhci-dbc.c -+++ b/xen/drivers/char/xhci-dbc.c -@@ -268,10 +268,12 @@ static void *dbc_sys_map_xhc(uint64_t phys, size_t size) - { - size_t i; - -- if ( size != MAX_XHCI_PAGES * PAGE_SIZE ) -+ if ( size > MAX_XHCI_PAGES * PAGE_SIZE ) - return NULL; - -- for ( i = FIX_XHCI_END; i >= FIX_XHCI_BEGIN; i-- ) -+ size >>= PAGE_SHIFT; -+ -+ for ( i = FIX_XHCI_END; i > FIX_XHCI_END - size; i-- ) - { - set_fixmap_nocache(i, phys); - phys += PAGE_SIZE; --- -2.41.0 - diff --git a/0315-IOMMU-store-name-for-extra-reserved-device-memory.patch b/0315-IOMMU-store-name-for-extra-reserved-device-memory.patch deleted file mode 100644 index fd1f41e7..00000000 --- a/0315-IOMMU-store-name-for-extra-reserved-device-memory.patch +++ /dev/null @@ -1,80 +0,0 @@ -From a97de92e76a62e786cb8a3b5cd75f9df5c96e8e6 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= - -Date: Tue, 19 Mar 2024 11:23:06 +0100 -Subject: [PATCH] IOMMU: store name for extra reserved device memory -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -It will be useful for error reporting in a subsequent patch. - -Signed-off-by: Marek Marczykowski-Górecki -Acked-by: Jan Beulich ---- - xen/drivers/char/xhci-dbc.c | 3 ++- - xen/drivers/passthrough/iommu.c | 5 ++++- - xen/include/xen/iommu.h | 3 ++- - 3 files changed, 8 insertions(+), 3 deletions(-) - -diff --git a/xen/drivers/char/xhci-dbc.c b/xen/drivers/char/xhci-dbc.c -index 3bf389be7d0b..8e2037f1a5f7 100644 ---- a/xen/drivers/char/xhci-dbc.c -+++ b/xen/drivers/char/xhci-dbc.c -@@ -1421,7 +1421,8 @@ void __init xhci_dbc_uart_init(void) - iommu_add_extra_reserved_device_memory( - PFN_DOWN(virt_to_maddr(&dbc_dma_bufs)), - PFN_UP(sizeof(dbc_dma_bufs)), -- uart->dbc.sbdf); -+ uart->dbc.sbdf, -+ "XHCI console"); - serial_register_uart(SERHND_XHCI, &dbc_uart_driver, &dbc_uart); - } - } -diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c -index 996c31be1284..03587c0cd680 100644 ---- a/xen/drivers/passthrough/iommu.c -+++ b/xen/drivers/passthrough/iommu.c -@@ -682,6 +682,7 @@ struct extra_reserved_range { - unsigned long start; - unsigned long nr; - pci_sbdf_t sbdf; -+ const char *name; - }; - static unsigned int __initdata nr_extra_reserved_ranges; - static struct extra_reserved_range __initdata -@@ -689,7 +690,8 @@ static struct extra_reserved_range __initdata - - int __init iommu_add_extra_reserved_device_memory(unsigned long start, - unsigned long nr, -- pci_sbdf_t sbdf) -+ pci_sbdf_t sbdf, -+ const char *name) - { - unsigned int idx; - -@@ -700,6 +702,7 @@ int __init iommu_add_extra_reserved_device_memory(unsigned long start, - extra_reserved_ranges[idx].start = start; - extra_reserved_ranges[idx].nr = nr; - extra_reserved_ranges[idx].sbdf = sbdf; -+ extra_reserved_ranges[idx].name = name; - - return 0; - } -diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h -index ef57f31417d0..a9c9457c07b2 100644 ---- a/xen/include/xen/iommu.h -+++ b/xen/include/xen/iommu.h -@@ -326,7 +326,8 @@ struct iommu_ops { - */ - extern int iommu_add_extra_reserved_device_memory(unsigned long start, - unsigned long nr, -- pci_sbdf_t sbdf); -+ pci_sbdf_t sbdf, -+ const char *name); - /* - * To be called by specific IOMMU driver during initialization, - * to fetch ranges registered with iommu_add_extra_reserved_device_memory(). --- -2.44.0 - diff --git a/0316-drivers-char-mark-extra-reserved-device-memory-in-me.patch b/0316-drivers-char-mark-extra-reserved-device-memory-in-me.patch deleted file mode 100644 index 548fa990..00000000 --- a/0316-drivers-char-mark-extra-reserved-device-memory-in-me.patch +++ /dev/null @@ -1,96 +0,0 @@ -From dd5101a6169f89b9e3f3b72f0b0fcdb38db2fb35 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= - -Date: Wed, 3 Apr 2024 09:34:22 +0200 -Subject: [PATCH] drivers/char: mark extra reserved device memory in memory map -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The IOMMU driver checks if RMRR/IVMD are marked as reserved in memory -map. This should be true for addresses coming from the firmware, but -when extra pages used by Xen itself are included in the mapping, those -are taken from usable RAM used. Mark those pages as reserved too. - -Not marking the pages as reserved didn't caused issues before due to -another a bug in IOMMU driver code, that was fixed in 83afa3135830 -("amd-vi: fix IVMD memory type checks"). - -Failing to reserve memory will lead to panic in IOMMU setup code. And -not including the page in IOMMU mapping will lead to broken console (due -to IOMMU faults). The pages chosen by the XHCI console driver should -still be usable by the CPU though, and the console code already can deal -with too slow console by dropping characters (and console not printing -anything is a special case of "slow"). When reserving fails print an error -message showing which pages failed and who requested them. This should -be enough hint to find why XHCI console doesn't work. - -Fixes: 3a1a7b809ffa "drivers/char: mark DMA buffers as reserved for the XHCI" -Signed-off-by: Marek Marczykowski-Górecki -Acked-by: Jan Beulich ---- - xen/drivers/passthrough/iommu.c | 17 +++++++++++++++++ - xen/include/xen/iommu.h | 5 ++++- - 2 files changed, 21 insertions(+), 1 deletion(-) - -diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c -index 03587c0cd680..ba18136c461c 100644 ---- a/xen/drivers/passthrough/iommu.c -+++ b/xen/drivers/passthrough/iommu.c -@@ -22,6 +22,10 @@ - #include - #include - -+#ifdef CONFIG_X86 -+#include -+#endif -+ - unsigned int __read_mostly iommu_dev_iotlb_timeout = 1000; - integer_param("iommu_dev_iotlb_timeout", iommu_dev_iotlb_timeout); - -@@ -715,6 +719,19 @@ int __init iommu_get_extra_reserved_device_memory(iommu_grdm_t *func, - - for ( idx = 0; idx < nr_extra_reserved_ranges; idx++ ) - { -+#ifdef CONFIG_X86 -+ paddr_t start = pfn_to_paddr(extra_reserved_ranges[idx].start); -+ paddr_t end = pfn_to_paddr(extra_reserved_ranges[idx].start + -+ extra_reserved_ranges[idx].nr); -+ -+ if ( !reserve_e820_ram(&e820, start, end) ) -+ { -+ printk(XENLOG_ERR "Failed to reserve [%"PRIx64"-%"PRIx64") for %s, " -+ "skipping IOMMU mapping for it, some functionality may be broken\n", -+ start, end, extra_reserved_ranges[idx].name); -+ continue; -+ } -+#endif - ret = func(extra_reserved_ranges[idx].start, - extra_reserved_ranges[idx].nr, - extra_reserved_ranges[idx].sbdf.sbdf, -diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h -index a9c9457c07b2..92db6f124f13 100644 ---- a/xen/include/xen/iommu.h -+++ b/xen/include/xen/iommu.h -@@ -321,7 +321,8 @@ struct iommu_ops { - }; - - /* -- * To be called by Xen internally, to register extra RMRR/IVMD ranges. -+ * To be called by Xen internally, to register extra RMRR/IVMD ranges for RAM -+ * pages. - * Needs to be called before IOMMU initialization. - */ - extern int iommu_add_extra_reserved_device_memory(unsigned long start, -@@ -331,6 +332,8 @@ extern int iommu_add_extra_reserved_device_memory(unsigned long start, - /* - * To be called by specific IOMMU driver during initialization, - * to fetch ranges registered with iommu_add_extra_reserved_device_memory(). -+ * This has a side effect of marking requested ranges as "reserved" in the -+ * memory map. - */ - extern int iommu_get_extra_reserved_device_memory(iommu_grdm_t *func, - void *ctxt); --- -2.44.0 - diff --git a/0604-libxl-create-writable-error-xenstore-dir.patch b/0600-libxl-create-writable-error-xenstore-dir.patch similarity index 83% rename from 0604-libxl-create-writable-error-xenstore-dir.patch rename to 0600-libxl-create-writable-error-xenstore-dir.patch index 9313ed96..15727f42 100644 --- a/0604-libxl-create-writable-error-xenstore-dir.patch +++ b/0600-libxl-create-writable-error-xenstore-dir.patch @@ -1,8 +1,8 @@ -From e6d202a31e64ffd318e4aea3199b3281647b578c Mon Sep 17 00:00:00 2001 +From ddaa31a57aae1ddeb7ed410eb2d4801b02dde8c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 16 Nov 2022 00:26:48 +0100 -Subject: [PATCH 04/26] libxl: create writable 'error' xenstore dir +Subject: [PATCH] libxl: create writable 'error' xenstore dir MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -17,10 +17,10 @@ Signed-off-by: Marek Marczykowski-Górecki 1 file changed, 3 insertions(+) diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c -index 612eacfc7fac..ed7da5f9cdc8 100644 +index edeadd57ef5a..48c625992149 100644 --- a/tools/libs/light/libxl_create.c +++ b/tools/libs/light/libxl_create.c -@@ -867,6 +867,9 @@ retry_transaction: +@@ -900,6 +900,9 @@ retry_transaction: libxl__xs_mknod(gc, t, GCSPRINTF("%s/data", dom_path), rwperm, ARRAY_SIZE(rwperm)); @@ -31,5 +31,5 @@ index 612eacfc7fac..ed7da5f9cdc8 100644 GCSPRINTF("%s/drivers", dom_path), rwperm, ARRAY_SIZE(rwperm)); -- -2.37.3 +2.44.0 diff --git a/0605-libxl-do-not-wait-for-backend-on-PCI-remove-when-bac.patch b/0601-libxl-do-not-wait-for-backend-on-PCI-remove-when-bac.patch similarity index 91% rename from 0605-libxl-do-not-wait-for-backend-on-PCI-remove-when-bac.patch rename to 0601-libxl-do-not-wait-for-backend-on-PCI-remove-when-bac.patch index cda62dad..e2040702 100644 --- a/0605-libxl-do-not-wait-for-backend-on-PCI-remove-when-bac.patch +++ b/0601-libxl-do-not-wait-for-backend-on-PCI-remove-when-bac.patch @@ -1,9 +1,9 @@ -From 6f2e64671cd1dc2c82bcd8574b449ed2798b0401 Mon Sep 17 00:00:00 2001 +From 2d3814dffffc293f64271704d43b8e44a4d21dae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 5 Mar 2014 02:18:52 +0100 -Subject: [PATCH 05/26] libxl: do not wait for backend on PCI remove when - backend already closed +Subject: [PATCH] libxl: do not wait for backend on PCI remove when backend + already closed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -18,7 +18,7 @@ Signed-off-by: Marek Marczykowski-Górecki 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/libs/light/libxl_pci.c b/tools/libs/light/libxl_pci.c -index f4c4f175454d..b863da2f0d60 100644 +index 96cb4da0794e..38bffed56238 100644 --- a/tools/libs/light/libxl_pci.c +++ b/tools/libs/light/libxl_pci.c @@ -226,7 +226,7 @@ out: @@ -55,5 +55,5 @@ index f4c4f175454d..b863da2f0d60 100644 xs_write(ctx->xsh, t, GCSPRINTF("%s/state-%d", be_path, i), GCSPRINTF("%d", XenbusStateClosing), 1); xs_write(ctx->xsh, t, GCSPRINTF("%s/state", be_path), GCSPRINTF("%d", XenbusStateReconfiguring), 1); -- -2.37.3 +2.44.0 diff --git a/0606-libxl-do-not-fail-device-removal-if-backend-domain-i.patch b/0602-libxl-do-not-fail-device-removal-if-backend-domain-i.patch similarity index 85% rename from 0606-libxl-do-not-fail-device-removal-if-backend-domain-i.patch rename to 0602-libxl-do-not-fail-device-removal-if-backend-domain-i.patch index 124b6f8f..975b846e 100644 --- a/0606-libxl-do-not-fail-device-removal-if-backend-domain-i.patch +++ b/0602-libxl-do-not-fail-device-removal-if-backend-domain-i.patch @@ -1,9 +1,8 @@ -From 4a925c66fb28641aed768a9b87910e68fa516913 Mon Sep 17 00:00:00 2001 +From bb52a87ac232cc9e13398b96b49ec866dc3a98fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sun, 28 Jan 2018 03:46:47 +0100 -Subject: [PATCH 06/26] libxl: do not fail device removal if backend domain is - gone +Subject: [PATCH] libxl: do not fail device removal if backend domain is gone MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -25,10 +24,10 @@ Signed-off-by: Marek Marczykowski-Górecki 1 file changed, 7 insertions(+) diff --git a/tools/libs/light/libxl_device.c b/tools/libs/light/libxl_device.c -index a75c21d4337c..fe559c04a218 100644 +index 4faa5fa3bd11..5095dc406355 100644 --- a/tools/libs/light/libxl_device.c +++ b/tools/libs/light/libxl_device.c -@@ -1050,6 +1050,13 @@ void libxl__initiate_device_generic_remove(libxl__egc *egc, +@@ -1081,6 +1081,13 @@ void libxl__initiate_device_generic_remove(libxl__egc *egc, goto out; } @@ -43,5 +42,5 @@ index a75c21d4337c..fe559c04a218 100644 if (rc) goto out; -- -2.37.3 +2.44.0 diff --git a/0607-libvchan-use-xengntshr_unshare-instead-of-munmap-dir.patch b/0603-libvchan-use-xengntshr_unshare-instead-of-munmap-dir.patch similarity index 86% rename from 0607-libvchan-use-xengntshr_unshare-instead-of-munmap-dir.patch rename to 0603-libvchan-use-xengntshr_unshare-instead-of-munmap-dir.patch index 317d2107..ca354d79 100644 --- a/0607-libvchan-use-xengntshr_unshare-instead-of-munmap-dir.patch +++ b/0603-libvchan-use-xengntshr_unshare-instead-of-munmap-dir.patch @@ -1,8 +1,7 @@ -From ff801e2db2cf73bbb4f4ee6eafeb4c5b5686ae96 Mon Sep 17 00:00:00 2001 +From 8cb93fca88461bd5b099ce15e7b38ece3c49c260 Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Fri, 26 Apr 2013 14:40:05 +0200 -Subject: [PATCH 07/26] libvchan: use xengntshr_unshare instead of munmap - directly +Subject: [PATCH] libvchan: use xengntshr_unshare instead of munmap directly Signed-off-by: Marek Marczykowski --- @@ -28,5 +27,5 @@ index 1f201ad554f2..9339e97c79d0 100644 if (ctrl->is_server) { ctrl->ring->srv_live = 0; -- -2.37.3 +2.44.0 diff --git a/0608-x86-time-Don-t-use-EFI-s-GetTime-call-by-default.patch b/0604-x86-time-Don-t-use-EFI-s-GetTime-call-by-default.patch similarity index 84% rename from 0608-x86-time-Don-t-use-EFI-s-GetTime-call-by-default.patch rename to 0604-x86-time-Don-t-use-EFI-s-GetTime-call-by-default.patch index b9026457..15ee9fff 100644 --- a/0608-x86-time-Don-t-use-EFI-s-GetTime-call-by-default.patch +++ b/0604-x86-time-Don-t-use-EFI-s-GetTime-call-by-default.patch @@ -1,7 +1,7 @@ -From c79035d499bf68f29f87e47da228d956bb44f2da Mon Sep 17 00:00:00 2001 +From d84e22ff2a88663e5dcb3cdced45faf2aac2fac1 Mon Sep 17 00:00:00 2001 From: Ross Lagerwall Date: Tue, 1 Dec 2015 16:57:46 +0000 -Subject: [PATCH 08/26] x86/time: Don't use EFI's GetTime call by default +Subject: [PATCH] x86/time: Don't use EFI's GetTime call by default When EFI is used, don't use EFI's GetTime() to get the time, because it is broken on many platforms. From Linux commit 7efe665903d0 ("rtc: @@ -16,10 +16,10 @@ Signed-off-by: Ross Lagerwall 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c -index b01acd390dc1..b6938e743f3c 100644 +index a97d78484105..45f6baf6270b 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c -@@ -1180,20 +1180,25 @@ static void __get_cmos_time(struct rtc_time *rtc) +@@ -1245,20 +1245,25 @@ static void __get_cmos_time(struct rtc_time *rtc) rtc->year += 100; } @@ -48,5 +48,5 @@ index b01acd390dc1..b6938e743f3c 100644 if ( likely(!(acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_CMOS_RTC)) ) cmos_rtc_probe = false; -- -2.37.3 +2.44.0 diff --git a/0609-libxl-automatically-enable-gfx_passthru-if-IGD-is-as.patch b/0605-libxl-automatically-enable-gfx_passthru-if-IGD-is-as.patch similarity index 93% rename from 0609-libxl-automatically-enable-gfx_passthru-if-IGD-is-as.patch rename to 0605-libxl-automatically-enable-gfx_passthru-if-IGD-is-as.patch index e7f8ac34..ce22362f 100644 --- a/0609-libxl-automatically-enable-gfx_passthru-if-IGD-is-as.patch +++ b/0605-libxl-automatically-enable-gfx_passthru-if-IGD-is-as.patch @@ -1,9 +1,8 @@ -From 59bb85dbfbc7d079afcc6c80255f05e951a26b54 Mon Sep 17 00:00:00 2001 +From 573919b6c6903ddb920963a10cf5becd398d5d35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sat, 6 Jun 2020 05:02:33 +0200 -Subject: [PATCH 09/26] libxl: automatically enable gfx_passthru if IGD is - assigned +Subject: [PATCH] libxl: automatically enable gfx_passthru if IGD is assigned MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -32,10 +31,10 @@ Signed-off-by: Marek Marczykowski-Górecki 3 files changed, 30 insertions(+), 20 deletions(-) diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in -index 31e58b73b0c9..77ca4e9510a5 100644 +index ac3f88fd5718..bce4b2979881 100644 --- a/docs/man/xl.cfg.5.pod.in +++ b/docs/man/xl.cfg.5.pod.in -@@ -1215,6 +1215,9 @@ Intel Graphics Device. +@@ -1247,6 +1247,9 @@ Intel Graphics Device. =back @@ -46,7 +45,7 @@ index 31e58b73b0c9..77ca4e9510a5 100644 necessarily require the B option, so you can use the normal Xen PCI passthrough to assign the graphics card as a secondary graphics diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c -index ed7da5f9cdc8..e23d3c866feb 100644 +index 48c625992149..ac8d3c395163 100644 --- a/tools/libs/light/libxl_create.c +++ b/tools/libs/light/libxl_create.c @@ -71,6 +71,22 @@ void libxl__rdm_setdefault(libxl__gc *gc, libxl_domain_build_info *b_info) @@ -82,7 +81,7 @@ index ed7da5f9cdc8..e23d3c866feb 100644 libxl__rdm_setdefault(gc, b_info); break; -@@ -1237,6 +1254,14 @@ int libxl__domain_config_setdefault(libxl__gc *gc, +@@ -1265,6 +1282,14 @@ int libxl__domain_config_setdefault(libxl__gc *gc, ? libxl__get_required_iommu_memory(d_config->b_info.max_memkb) : 0; @@ -98,7 +97,7 @@ index ed7da5f9cdc8..e23d3c866feb 100644 if (ret) { LOGD(ERROR, domid, "Unable to set domain build info defaults"); diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c -index fc264a3a13a6..98b900bd7b9d 100644 +index ff8ddeec9a37..bcbaac8d8f1d 100644 --- a/tools/libs/light/libxl_dm.c +++ b/tools/libs/light/libxl_dm.c @@ -996,22 +996,6 @@ static char *dm_spice_options(libxl__gc *gc, @@ -136,5 +135,5 @@ index fc264a3a13a6..98b900bd7b9d 100644 machinearg = GCSPRINTF("%s,igd-passthru=on", machinearg); break; -- -2.37.3 +2.44.0 diff --git a/0610-autoconf-fix-handling-absolute-PYTHON-path.patch b/0606-autoconf-fix-handling-absolute-PYTHON-path.patch similarity index 81% rename from 0610-autoconf-fix-handling-absolute-PYTHON-path.patch rename to 0606-autoconf-fix-handling-absolute-PYTHON-path.patch index 938e5ced..0b1ffd00 100644 --- a/0610-autoconf-fix-handling-absolute-PYTHON-path.patch +++ b/0606-autoconf-fix-handling-absolute-PYTHON-path.patch @@ -1,8 +1,8 @@ -From 202b21563f23f853f1e0704cf61af21433d5e689 Mon Sep 17 00:00:00 2001 +From a2c4f630467fdcfa76d3a1b8ac3ef32727eb15c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 2 Jun 2021 05:24:09 +0200 -Subject: [PATCH 10/26] autoconf: fix handling absolute $PYTHON path +Subject: [PATCH] autoconf: fix handling absolute $PYTHON path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -22,7 +22,7 @@ Signed-off-by: Marek Marczykowski-Górecki 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/m4/python_devel.m4 b/m4/python_devel.m4 -index bbf1e0354b2b..676489b8e978 100644 +index bb60857b030a..c3b38052ae69 100644 --- a/m4/python_devel.m4 +++ b/m4/python_devel.m4 @@ -2,7 +2,11 @@ AC_DEFUN([AX_CHECK_PYTHON_DEVEL], [ @@ -37,19 +37,19 @@ index bbf1e0354b2b..676489b8e978 100644 +]) AS_IF([test x"$pyconfig" = x"no"], [ dnl For those that don't have python-config - CPPFLAGS="$CFLAGS `$PYTHON -c 'import distutils.sysconfig; \ + CPPFLAGS="$CFLAGS `$PYTHON -c 'import sysconfig; \ diff --git a/tools/configure.ac b/tools/configure.ac -index 18e481d77e4c..5758726fe1f9 100644 +index be58f06be450..d4f03d4ba15b 100644 --- a/tools/configure.ac +++ b/tools/configure.ac -@@ -358,7 +358,6 @@ AS_IF([test -z "$PYTHON"], [AC_CHECK_PROGS([PYTHON], [python3 python python2], e +@@ -382,7 +382,6 @@ AS_IF([test -z "$PYTHON"], [AC_CHECK_PROGS([PYTHON], [python3 python python2], e AS_IF([test "$PYTHON" = "err"], [AC_MSG_ERROR([No python interpreter found])]) AS_IF([echo "$PYTHON" | grep -q "^/"], [], [AC_PATH_PROG([PYTHON], [$PYTHON])]) PYTHONPATH=$PYTHON -PYTHON=`basename $PYTHONPATH` AX_PATH_PROG_OR_FAIL([PYTHONPATH], [$PYTHON]) - AX_CHECK_PYTHON_VERSION([2], [6]) + AX_CHECK_PYTHON_VERSION([2], [7]) -- -2.37.3 +2.44.0 diff --git a/0611-libxl-do-not-require-filling-backend_domid-to-remove.patch b/0607-libxl-do-not-require-filling-backend_domid-to-remove.patch similarity index 89% rename from 0611-libxl-do-not-require-filling-backend_domid-to-remove.patch rename to 0607-libxl-do-not-require-filling-backend_domid-to-remove.patch index ffe19b9e..b53731ac 100644 --- a/0611-libxl-do-not-require-filling-backend_domid-to-remove.patch +++ b/0607-libxl-do-not-require-filling-backend_domid-to-remove.patch @@ -1,9 +1,8 @@ -From f2c696a0d70e8fadd25a90bbd7e73af3fcd158ae Mon Sep 17 00:00:00 2001 +From 8b8674f70b90757ebb10ba58d374175b79a8a19b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 8 Nov 2021 03:50:35 +0100 -Subject: [PATCH 11/26] libxl: do not require filling backend_domid to remove - device +Subject: [PATCH] libxl: do not require filling backend_domid to remove device MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -26,7 +25,7 @@ Signed-off-by: Marek Marczykowski-Górecki 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/tools/libs/light/libxl_device.c b/tools/libs/light/libxl_device.c -index fe559c04a218..90bf4bed3422 100644 +index 5095dc406355..5a0da92eeece 100644 --- a/tools/libs/light/libxl_device.c +++ b/tools/libs/light/libxl_device.c @@ -75,6 +75,25 @@ char *libxl__device_libxl_path(libxl__gc *gc, libxl__device *device) @@ -55,7 +54,7 @@ index fe559c04a218..90bf4bed3422 100644 char *libxl__domain_device_libxl_path(libxl__gc *gc, uint32_t domid, uint32_t devid, libxl__device_kind device_kind) { -@@ -986,7 +1005,7 @@ void libxl__initiate_device_generic_remove(libxl__egc *egc, +@@ -1017,7 +1036,7 @@ void libxl__initiate_device_generic_remove(libxl__egc *egc, { STATE_AO_GC(aodev->ao); xs_transaction_t t = 0; @@ -64,7 +63,7 @@ index fe559c04a218..90bf4bed3422 100644 char *state_path = GCSPRINTF("%s/state", be_path); char *online_path = GCSPRINTF("%s/online", be_path); const char *state; -@@ -994,6 +1013,17 @@ void libxl__initiate_device_generic_remove(libxl__egc *egc, +@@ -1025,6 +1044,17 @@ void libxl__initiate_device_generic_remove(libxl__egc *egc, uint32_t my_domid, domid = aodev->dev->domid; int rc = 0; @@ -83,10 +82,10 @@ index fe559c04a218..90bf4bed3422 100644 rc = libxl__get_domid(gc, &my_domid); diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h -index cb9e8b3b8b5a..a8297f23b08a 100644 +index 3b58bb2d7f43..e455d46dc5ef 100644 --- a/tools/libs/light/libxl_internal.h +++ b/tools/libs/light/libxl_internal.h -@@ -1526,6 +1526,7 @@ _hidden char *libxl__domain_device_backend_path(libxl__gc *gc, uint32_t backend_ +@@ -1525,6 +1525,7 @@ _hidden char *libxl__domain_device_backend_path(libxl__gc *gc, uint32_t backend_ _hidden char *libxl__device_libxl_path(libxl__gc *gc, libxl__device *device); _hidden char *libxl__domain_device_libxl_path(libxl__gc *gc, uint32_t domid, uint32_t devid, libxl__device_kind device_kind); @@ -95,5 +94,5 @@ index cb9e8b3b8b5a..a8297f23b08a 100644 libxl__device *dev); _hidden int libxl__console_tty_path(libxl__gc *gc, uint32_t domid, int cons_num, -- -2.37.3 +2.44.0 diff --git a/0612-libxl-add-pcidevs-to-stubdomain-earlier.patch b/0608-libxl-add-pcidevs-to-stubdomain-earlier.patch similarity index 92% rename from 0612-libxl-add-pcidevs-to-stubdomain-earlier.patch rename to 0608-libxl-add-pcidevs-to-stubdomain-earlier.patch index fca58279..9ac61f85 100644 --- a/0612-libxl-add-pcidevs-to-stubdomain-earlier.patch +++ b/0608-libxl-add-pcidevs-to-stubdomain-earlier.patch @@ -1,8 +1,8 @@ -From af9bed0e0e40d28d8827d04bed64c554421456e7 Mon Sep 17 00:00:00 2001 +From 87acd6cc196c9633fe102e329c4c41c8a3a94818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 30 Dec 2021 21:12:00 +0100 -Subject: [PATCH 12/26] libxl: add pcidevs to stubdomain earlier +Subject: [PATCH] libxl: add pcidevs to stubdomain earlier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -37,10 +37,10 @@ Signed-off-by: Marek Marczykowski-Górecki 3 files changed, 46 insertions(+), 11 deletions(-) diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c -index 98b900bd7b9d..f5d930bb94f0 100644 +index bcbaac8d8f1d..160d4e065d08 100644 --- a/tools/libs/light/libxl_dm.c +++ b/tools/libs/light/libxl_dm.c -@@ -2233,6 +2233,9 @@ static void spawn_stubdom_pvqemu_cb(libxl__egc *egc, +@@ -2232,6 +2232,9 @@ static void spawn_stubdom_pvqemu_cb(libxl__egc *egc, libxl__dm_spawn_state *stubdom_dmss, int rc); @@ -50,7 +50,7 @@ index 98b900bd7b9d..f5d930bb94f0 100644 static void spawn_stub_launch_dm(libxl__egc *egc, libxl__multidev *aodevs, int ret); -@@ -2438,7 +2441,7 @@ retry_transaction: +@@ -2447,7 +2450,7 @@ retry_transaction: goto retry_transaction; libxl__multidev_begin(ao, &sdss->multidev); @@ -59,7 +59,7 @@ index 98b900bd7b9d..f5d930bb94f0 100644 libxl__add_disks(egc, ao, dm_domid, dm_config, &sdss->multidev); libxl__multidev_prepared(egc, &sdss->multidev, 0); -@@ -2449,6 +2452,33 @@ out: +@@ -2458,6 +2461,33 @@ out: spawn_stubdom_pvqemu_cb(egc, &sdss->pvqemu, ret); } @@ -93,7 +93,7 @@ index 98b900bd7b9d..f5d930bb94f0 100644 static void spawn_stub_launch_dm(libxl__egc *egc, libxl__multidev *multidev, int ret) { -@@ -2468,7 +2498,7 @@ static void spawn_stub_launch_dm(libxl__egc *egc, +@@ -2477,7 +2507,7 @@ static void spawn_stub_launch_dm(libxl__egc *egc, int need_qemu; if (ret) { @@ -103,10 +103,10 @@ index 98b900bd7b9d..f5d930bb94f0 100644 } diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h -index a8297f23b08a..6df2452c6bd9 100644 +index e455d46dc5ef..6e2363d03196 100644 --- a/tools/libs/light/libxl_internal.h +++ b/tools/libs/light/libxl_internal.h -@@ -1732,6 +1732,9 @@ _hidden int libxl__device_pci_setdefault(libxl__gc *gc, uint32_t domid, +@@ -1731,6 +1731,9 @@ _hidden int libxl__device_pci_setdefault(libxl__gc *gc, uint32_t domid, libxl_device_pci *pci, bool hotplug); _hidden bool libxl__is_igd_vga_passthru(libxl__gc *gc, const libxl_domain_config *d_config); @@ -117,7 +117,7 @@ index a8297f23b08a..6df2452c6bd9 100644 /* from libxl_dtdev */ diff --git a/tools/libs/light/libxl_pci.c b/tools/libs/light/libxl_pci.c -index b863da2f0d60..c9e01900ecfc 100644 +index 38bffed56238..bf4acb46d6e8 100644 --- a/tools/libs/light/libxl_pci.c +++ b/tools/libs/light/libxl_pci.c @@ -1434,10 +1434,6 @@ static void pci_add_dm_done(libxl__egc *egc, @@ -169,5 +169,5 @@ index b863da2f0d60..c9e01900ecfc 100644 AO_GC; add_pcis_state *apds; -- -2.37.3 +2.44.0 diff --git a/0613-Fix-buildid-alignment.patch b/0609-Fix-buildid-alignment.patch similarity index 81% rename from 0613-Fix-buildid-alignment.patch rename to 0609-Fix-buildid-alignment.patch index 9eb113ec..5afab09a 100644 --- a/0613-Fix-buildid-alignment.patch +++ b/0609-Fix-buildid-alignment.patch @@ -1,8 +1,8 @@ -From a89b0e338dda631ac254b380c27e1d6acf614418 Mon Sep 17 00:00:00 2001 +From f3e1be07dd30aa29011f0b51accf9b48e5a7cc15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 16 Nov 2022 01:24:37 +0100 -Subject: [PATCH 13/26] Fix buildid alignment +Subject: [PATCH] Fix buildid alignment Fixes `objcopy: xen.efi: Data Directory size (1c) exceeds space left in section (8)`. @@ -16,10 +16,10 @@ Reported by @jevank 1 file changed, 1 insertion(+) diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S -index 8930e14fc40e..acfdf61ba307 100644 +index 9a1dfe1b340a..26a23a7b0651 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S -@@ -184,6 +184,7 @@ SECTIONS +@@ -171,6 +171,7 @@ SECTIONS __note_gnu_build_id_end = .; } PHDR(note) PHDR(text) #elif defined(BUILD_ID_EFI) @@ -28,5 +28,5 @@ index 8930e14fc40e..acfdf61ba307 100644 __note_gnu_build_id_start = .; *(.buildid) -- -2.37.3 +2.44.0 diff --git a/0614-vchan-socket-proxy-add-reconnect-marker-support.patch b/0610-vchan-socket-proxy-add-reconnect-marker-support.patch similarity index 97% rename from 0614-vchan-socket-proxy-add-reconnect-marker-support.patch rename to 0610-vchan-socket-proxy-add-reconnect-marker-support.patch index cb9698a8..98754892 100644 --- a/0614-vchan-socket-proxy-add-reconnect-marker-support.patch +++ b/0610-vchan-socket-proxy-add-reconnect-marker-support.patch @@ -1,8 +1,8 @@ -From d02ba25ba05722588c7389d9bf91e407095521b3 Mon Sep 17 00:00:00 2001 +From 0098ec225dc2080b1c14fea603fb602416798d7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sat, 3 Sep 2022 03:48:42 +0200 -Subject: [PATCH 14/26] vchan-socket-proxy: add reconnect marker support +Subject: [PATCH] vchan-socket-proxy: add reconnect marker support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -22,7 +22,7 @@ Signed-off-by: Marek Marczykowski-Górecki 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/tools/vchan/vchan-socket-proxy.c b/tools/vchan/vchan-socket-proxy.c -index e1d959c6d15c..1e7defe9bae7 100644 +index 9c4c336b03bb..250ee137d0a5 100644 --- a/tools/vchan/vchan-socket-proxy.c +++ b/tools/vchan/vchan-socket-proxy.c @@ -31,6 +31,7 @@ @@ -142,5 +142,5 @@ index e1d959c6d15c..1e7defe9bae7 100644 break; /* don't reconnect if output was stdout */ -- -2.37.3 +2.44.0 diff --git a/0615-tools-libxl-enable-in-band-reconnect-marker-for-stub.patch b/0611-tools-libxl-enable-in-band-reconnect-marker-for-stub.patch similarity index 86% rename from 0615-tools-libxl-enable-in-band-reconnect-marker-for-stub.patch rename to 0611-tools-libxl-enable-in-band-reconnect-marker-for-stub.patch index 7f088b62..e5b007f1 100644 --- a/0615-tools-libxl-enable-in-band-reconnect-marker-for-stub.patch +++ b/0611-tools-libxl-enable-in-band-reconnect-marker-for-stub.patch @@ -1,9 +1,9 @@ -From 419baf62a844182b7ce16b70dd45bc728c785a02 Mon Sep 17 00:00:00 2001 +From 3af534eeacc8c2369c0a1c92137cb854ec1bd3a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sat, 3 Sep 2022 04:31:34 +0200 -Subject: [PATCH 15/26] tools/libxl: enable in-band reconnect marker for - stubdom QMP proxy +Subject: [PATCH] tools/libxl: enable in-band reconnect marker for stubdom QMP + proxy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -25,10 +25,10 @@ Signed-off-by: Marek Marczykowski-Górecki 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c -index f5d930bb94f0..f0895f192cf8 100644 +index 160d4e065d08..d3df66786c45 100644 --- a/tools/libs/light/libxl_dm.c +++ b/tools/libs/light/libxl_dm.c -@@ -2637,10 +2637,11 @@ static void spawn_qmp_proxy(libxl__egc *egc, +@@ -2646,10 +2646,11 @@ static void spawn_qmp_proxy(libxl__egc *egc, sdss->qmp_proxy_spawn.failure_cb = qmp_proxy_startup_failed; sdss->qmp_proxy_spawn.detached_cb = qmp_proxy_detached; @@ -42,5 +42,5 @@ index f5d930bb94f0..f0895f192cf8 100644 args[nr++] = GCSPRINTF("%s/device-model/%u/qmp-vchan", dom_path, guest_domid); args[nr++] = (char*)libxl__qemu_qmp_path(gc, guest_domid); -- -2.37.3 +2.44.0 diff --git a/0616-libxl-Add-a-utility-function-for-domain-resume.patch b/0612-libxl-Add-a-utility-function-for-domain-resume.patch similarity index 87% rename from 0616-libxl-Add-a-utility-function-for-domain-resume.patch rename to 0612-libxl-Add-a-utility-function-for-domain-resume.patch index 0d3afe12..d4042fd0 100644 --- a/0616-libxl-Add-a-utility-function-for-domain-resume.patch +++ b/0612-libxl-Add-a-utility-function-for-domain-resume.patch @@ -1,7 +1,7 @@ -From d59d3e9799e24ae2aed3daa1454abbfa2d71b56b Mon Sep 17 00:00:00 2001 +From 10cdd589b0fa637bfd4eb41cc5157ea579e2f1a8 Mon Sep 17 00:00:00 2001 From: Demi Marie Obenour Date: Mon, 26 Sep 2022 10:48:26 -0400 -Subject: [PATCH 16/26] libxl: Add a utility function for domain resume +Subject: [PATCH] libxl: Add a utility function for domain resume It is necessary to all xs_resume_domain after any successful call to xc_domain_resume, so that XenStore is notified of the resumption. @@ -19,10 +19,10 @@ Signed-off-by: Demi Marie Obenour 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/tools/libs/light/libxl_dom_suspend.c b/tools/libs/light/libxl_dom_suspend.c -index 4fa22bb73910..fa50e8801f35 100644 +index 6091a5f3f695..ce501a932643 100644 --- a/tools/libs/light/libxl_dom_suspend.c +++ b/tools/libs/light/libxl_dom_suspend.c -@@ -451,6 +451,22 @@ int libxl__domain_resume_device_model_deprecated(libxl__gc *gc, uint32_t domid) +@@ -446,6 +446,22 @@ int libxl__domain_resume_device_model_deprecated(libxl__gc *gc, uint32_t domid) return 0; } @@ -45,7 +45,7 @@ index 4fa22bb73910..fa50e8801f35 100644 int libxl__domain_resume_deprecated(libxl__gc *gc, uint32_t domid, int suspend_cancel) { int rc = 0; -@@ -469,16 +485,7 @@ int libxl__domain_resume_deprecated(libxl__gc *gc, uint32_t domid, int suspend_c +@@ -464,16 +480,7 @@ int libxl__domain_resume_deprecated(libxl__gc *gc, uint32_t domid, int suspend_c } } @@ -63,7 +63,7 @@ index 4fa22bb73910..fa50e8801f35 100644 out: return rc; } -@@ -660,19 +667,9 @@ static void domain_resume_done(libxl__egc *egc, +@@ -655,19 +662,9 @@ static void domain_resume_done(libxl__egc *egc, /* Convenience aliases */ libxl_domid domid = dmrs->domid; @@ -86,5 +86,5 @@ index 4fa22bb73910..fa50e8801f35 100644 } -- -2.37.3 +2.44.0 diff --git a/0618-libxl-Properly-suspend-stubdomains.patch b/0613-libxl-Properly-suspend-stubdomains.patch similarity index 93% rename from 0618-libxl-Properly-suspend-stubdomains.patch rename to 0613-libxl-Properly-suspend-stubdomains.patch index 8888e8cf..868044ae 100644 --- a/0618-libxl-Properly-suspend-stubdomains.patch +++ b/0613-libxl-Properly-suspend-stubdomains.patch @@ -1,7 +1,7 @@ -From 207582af51a027342e1f63d5c4497459aba4e67d Mon Sep 17 00:00:00 2001 +From 32cdc76ed616df3de6ee1fb6ff4e01beb8c7696e Mon Sep 17 00:00:00 2001 From: Demi Marie Obenour Date: Fri, 16 Sep 2022 07:31:57 -0400 -Subject: [PATCH 18/26] libxl: Properly suspend stubdomains +Subject: [PATCH] libxl: Properly suspend stubdomains MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -28,12 +28,12 @@ Co-authored-by: Marek Marczykowski-Górecki Signed-off-by: Marek Marczykowski-Górecki Signed-off-by: Demi Marie Obenour --- - tools/libs/light/libxl_dom_suspend.c | 171 +++++++++++++++++++++++---- + tools/libs/light/libxl_dom_suspend.c | 176 +++++++++++++++++++++++---- tools/libs/light/libxl_internal.h | 1 + - 2 files changed, 150 insertions(+), 22 deletions(-) + 2 files changed, 154 insertions(+), 23 deletions(-) diff --git a/tools/libs/light/libxl_dom_suspend.c b/tools/libs/light/libxl_dom_suspend.c -index d2a88ea34efb..d276b3c17e70 100644 +index ce501a932643..1c7ceee60dbf 100644 --- a/tools/libs/light/libxl_dom_suspend.c +++ b/tools/libs/light/libxl_dom_suspend.c @@ -19,9 +19,9 @@ @@ -212,7 +212,7 @@ index d2a88ea34efb..d276b3c17e70 100644 return; err: -@@ -528,6 +615,7 @@ void libxl__dm_resume(libxl__egc *egc, +@@ -514,6 +601,7 @@ void libxl__dm_resume(libxl__egc *egc, { STATE_AO_GC(dmrs->ao); int rc = 0; @@ -220,7 +220,7 @@ index d2a88ea34efb..d276b3c17e70 100644 /* Convenience aliases */ libxl_domid domid = dmrs->domid; -@@ -543,7 +631,6 @@ void libxl__dm_resume(libxl__egc *egc, +@@ -529,7 +617,6 @@ void libxl__dm_resume(libxl__egc *egc, switch (libxl__device_model_version_running(gc, domid)) { case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL: { @@ -228,7 +228,7 @@ index d2a88ea34efb..d276b3c17e70 100644 const char *path, *state; path = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, "/state"); -@@ -563,14 +650,54 @@ void libxl__dm_resume(libxl__egc *egc, +@@ -549,14 +636,57 @@ void libxl__dm_resume(libxl__egc *egc, if (rc) goto out; break; } @@ -238,6 +238,8 @@ index d2a88ea34efb..d276b3c17e70 100644 - qmp->callback = dm_resume_qmp_done; - qmp->payload_fd = -1; - rc = libxl__ev_qmp_send(egc, qmp, "cont", NULL); +- if (rc) goto out; +- break; + case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN: { + xc_domaininfo_t dm_info; + @@ -254,9 +256,11 @@ index d2a88ea34efb..d276b3c17e70 100644 + + LOGD(DEBUG, domid, "Resuming modern stubdomain: ID %" PRIu32, dm_domid); + -+ rc = check_guest_status(gc, dm_domid, &dm_info, "resuming"); - if (rc) goto out; -- break; ++ rc = xc_domain_getinfo_single(CTX->xch, dm_domid, &dm_info); ++ if (rc < 0) { ++ LOGED(ERROR, dm_domid, "guest we were resuming has been destroyed"); ++ goto out; ++ } + + if ((dm_info.flags & XEN_DOMINF_paused)) { + rc = xc_domain_unpause(CTX->xch, dm_domid); @@ -291,10 +295,10 @@ index d2a88ea34efb..d276b3c17e70 100644 rc = ERROR_INVAL; goto out; diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h -index 6df2452c6bd9..a86c21a7ce21 100644 +index 6e2363d03196..d19174cbd727 100644 --- a/tools/libs/light/libxl_internal.h +++ b/tools/libs/light/libxl_internal.h -@@ -3631,6 +3631,7 @@ struct libxl__domain_suspend_state { +@@ -3630,6 +3630,7 @@ struct libxl__domain_suspend_state { struct libxl__domain_suspend_state*, int rc); void (*callback_common_done)(libxl__egc*, struct libxl__domain_suspend_state*, int ok); @@ -303,5 +307,5 @@ index 6df2452c6bd9..a86c21a7ce21 100644 int libxl__domain_suspend_init(libxl__egc *egc, libxl__domain_suspend_state *dsps, -- -2.37.3 +2.44.0 diff --git a/0619-libxl-Fix-race-condition-in-domain-suspension.patch b/0614-libxl-Fix-race-condition-in-domain-suspension.patch similarity index 83% rename from 0619-libxl-Fix-race-condition-in-domain-suspension.patch rename to 0614-libxl-Fix-race-condition-in-domain-suspension.patch index 3325f29e..ac44ae81 100644 --- a/0619-libxl-Fix-race-condition-in-domain-suspension.patch +++ b/0614-libxl-Fix-race-condition-in-domain-suspension.patch @@ -1,7 +1,7 @@ -From a7d721415da567e40ae1932c853cca074f45cff6 Mon Sep 17 00:00:00 2001 +From 8d68f1f26f4dcea3957d66470adc5cf1cd3f2d79 Mon Sep 17 00:00:00 2001 From: Demi Marie Obenour Date: Thu, 22 Sep 2022 12:27:32 -0400 -Subject: [PATCH 19/26] libxl: Fix race condition in domain suspension +Subject: [PATCH] libxl: Fix race condition in domain suspension Check if the domain has suspended after setting the XenStore watch to prevent race conditions. Also check if a guest has suspended when the @@ -13,7 +13,7 @@ Signed-off-by: Demi Marie Obenour 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/libs/light/libxl_dom_suspend.c b/tools/libs/light/libxl_dom_suspend.c -index d276b3c17e70..42c0e0a152e0 100644 +index 1c7ceee60dbf..1ee3e5d88af8 100644 --- a/tools/libs/light/libxl_dom_suspend.c +++ b/tools/libs/light/libxl_dom_suspend.c @@ -209,7 +209,8 @@ static void domain_suspend_common_wait_guest_evtchn(libxl__egc *egc, @@ -26,8 +26,8 @@ index d276b3c17e70..42c0e0a152e0 100644 libxl__domain_suspend_state *dsps); static void suspend_common_wait_guest_timeout(libxl__egc *egc, libxl__ev_time *ev, const struct timeval *requested_abs, int rc); -@@ -426,7 +427,7 @@ static int check_guest_status(libxl__gc *gc, const uint32_t domid, - return 0; +@@ -408,7 +409,7 @@ static void suspend_common_wait_guest_watch(libxl__egc *egc, + suspend_common_wait_guest_check(egc, dsps); } -static void suspend_common_wait_guest_check(libxl__egc *egc, @@ -35,7 +35,7 @@ index d276b3c17e70..42c0e0a152e0 100644 libxl__domain_suspend_state *dsps) { STATE_AO_GC(dsps->ao); -@@ -441,7 +442,7 @@ static void suspend_common_wait_guest_check(libxl__egc *egc, +@@ -427,7 +428,7 @@ static void suspend_common_wait_guest_check(libxl__egc *egc, if (!(info.flags & XEN_DOMINF_shutdown)) /* keep waiting */ @@ -44,7 +44,7 @@ index d276b3c17e70..42c0e0a152e0 100644 shutdown_reason = (info.flags >> XEN_DOMINF_shutdownshift) & XEN_DOMINF_shutdownmask; -@@ -452,11 +453,15 @@ static void suspend_common_wait_guest_check(libxl__egc *egc, +@@ -438,11 +439,15 @@ static void suspend_common_wait_guest_check(libxl__egc *egc, } LOGD(DEBUG, domid, "guest has suspended"); @@ -61,7 +61,7 @@ index d276b3c17e70..42c0e0a152e0 100644 } static void suspend_common_wait_guest_timeout(libxl__egc *egc, -@@ -464,6 +469,8 @@ static void suspend_common_wait_guest_timeout(libxl__egc *egc, +@@ -450,6 +455,8 @@ static void suspend_common_wait_guest_timeout(libxl__egc *egc, { libxl__domain_suspend_state *dsps = CONTAINER_OF(ev, *dsps, guest_timeout); STATE_AO_GC(dsps->ao); @@ -71,5 +71,5 @@ index d276b3c17e70..42c0e0a152e0 100644 LOGD(ERROR, dsps->domid, "guest did not suspend, timed out"); rc = ERROR_GUEST_TIMEDOUT; -- -2.37.3 +2.44.0 diff --git a/0620-libxl-Add-additional-domain-suspend-resume-logs.patch b/0615-libxl-Add-additional-domain-suspend-resume-logs.patch similarity index 84% rename from 0620-libxl-Add-additional-domain-suspend-resume-logs.patch rename to 0615-libxl-Add-additional-domain-suspend-resume-logs.patch index 47c15dd8..d4719285 100644 --- a/0620-libxl-Add-additional-domain-suspend-resume-logs.patch +++ b/0615-libxl-Add-additional-domain-suspend-resume-logs.patch @@ -1,7 +1,7 @@ -From 1227dd53e848563f1552afdf04d4d32b1f1d440f Mon Sep 17 00:00:00 2001 +From 0b9478cf367e6a0838fcb3cd8e6c542a4e9f2237 Mon Sep 17 00:00:00 2001 From: Demi Marie Obenour Date: Mon, 26 Sep 2022 11:05:32 -0400 -Subject: [PATCH 20/26] libxl: Add additional domain suspend/resume logs +Subject: [PATCH] libxl: Add additional domain suspend/resume logs This was useful when debugging, but is not required. @@ -12,7 +12,7 @@ Signed-off-by: Demi Marie Obenour 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/tools/libs/light/libxl_dom_suspend.c b/tools/libs/light/libxl_dom_suspend.c -index 42c0e0a152e0..55a172a46f87 100644 +index 1ee3e5d88af8..3d53a8f7b460 100644 --- a/tools/libs/light/libxl_dom_suspend.c +++ b/tools/libs/light/libxl_dom_suspend.c @@ -321,9 +321,11 @@ static void domain_suspend_common_pvcontrol_suspending(libxl__egc *egc, @@ -39,9 +39,9 @@ index 42c0e0a152e0..55a172a46f87 100644 suspend_common_wait_guest_check(egc, dsps); } -@@ -440,9 +445,11 @@ static bool suspend_common_wait_guest_check(libxl__egc *egc, - if (check_guest_status(gc, domid, &info, "suspending")) +@@ -426,9 +431,11 @@ static bool suspend_common_wait_guest_check(libxl__egc *egc, goto err; + } - if (!(info.flags & XEN_DOMINF_shutdown)) + if (!(info.flags & XEN_DOMINF_shutdown)) { @@ -52,7 +52,7 @@ index 42c0e0a152e0..55a172a46f87 100644 shutdown_reason = (info.flags >> XEN_DOMINF_shutdownshift) & XEN_DOMINF_shutdownmask; -@@ -469,11 +476,14 @@ static void suspend_common_wait_guest_timeout(libxl__egc *egc, +@@ -455,11 +462,14 @@ static void suspend_common_wait_guest_timeout(libxl__egc *egc, { libxl__domain_suspend_state *dsps = CONTAINER_OF(ev, *dsps, guest_timeout); STATE_AO_GC(dsps->ao); @@ -67,7 +67,7 @@ index 42c0e0a152e0..55a172a46f87 100644 } domain_suspend_common_done(egc, dsps, rc); } -@@ -628,6 +638,8 @@ void libxl__dm_resume(libxl__egc *egc, +@@ -614,6 +624,8 @@ void libxl__dm_resume(libxl__egc *egc, libxl_domid domid = dmrs->domid; libxl__ev_qmp *qmp = &dmrs->qmp; @@ -76,7 +76,7 @@ index 42c0e0a152e0..55a172a46f87 100644 dm_resume_init(dmrs); rc = libxl__ev_time_register_rel(dmrs->ao, -@@ -640,6 +652,7 @@ void libxl__dm_resume(libxl__egc *egc, +@@ -626,6 +638,7 @@ void libxl__dm_resume(libxl__egc *egc, case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL: { const char *path, *state; @@ -84,7 +84,7 @@ index 42c0e0a152e0..55a172a46f87 100644 path = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, "/state"); rc = libxl__xs_read_checked(gc, XBT_NULL, path, &state); if (rc) goto out; -@@ -706,6 +719,7 @@ void libxl__dm_resume(libxl__egc *egc, +@@ -695,6 +708,7 @@ void libxl__dm_resume(libxl__egc *egc, goto out; } default: @@ -92,7 +92,7 @@ index 42c0e0a152e0..55a172a46f87 100644 rc = ERROR_INVAL; goto out; } -@@ -782,6 +796,8 @@ void libxl__domain_resume(libxl__egc *egc, +@@ -771,6 +785,8 @@ void libxl__domain_resume(libxl__egc *egc, int rc = 0; libxl_domain_type type = libxl__domain_type(gc, dmrs->domid); @@ -102,10 +102,10 @@ index 42c0e0a152e0..55a172a46f87 100644 rc = ERROR_FAIL; goto out; diff --git a/tools/libs/light/libxl_domain.c b/tools/libs/light/libxl_domain.c -index 7f0986c18569..f518daada6c9 100644 +index 6751fc785f72..324a4c6607e7 100644 --- a/tools/libs/light/libxl_domain.c +++ b/tools/libs/light/libxl_domain.c -@@ -567,6 +567,7 @@ int libxl_domain_suspend_only(libxl_ctx *ctx, uint32_t domid, +@@ -563,6 +563,7 @@ int libxl_domain_suspend_only(libxl_ctx *ctx, uint32_t domid, dsps->ao = ao; dsps->domid = domid; dsps->type = type; @@ -114,5 +114,5 @@ index 7f0986c18569..f518daada6c9 100644 if (rc < 0) goto out_err; dsps->callback_common_done = domain_suspend_empty_cb; -- -2.37.3 +2.44.0 diff --git a/0621-libxl-workaround-for-Windows-PV-drivers-removing-con.patch b/0616-libxl-workaround-for-Windows-PV-drivers-removing-con.patch similarity index 87% rename from 0621-libxl-workaround-for-Windows-PV-drivers-removing-con.patch rename to 0616-libxl-workaround-for-Windows-PV-drivers-removing-con.patch index db94bce7..052183d0 100644 --- a/0621-libxl-workaround-for-Windows-PV-drivers-removing-con.patch +++ b/0616-libxl-workaround-for-Windows-PV-drivers-removing-con.patch @@ -1,8 +1,8 @@ -From 9573fd4455bcfb04494068e32b95ae744961ebf2 Mon Sep 17 00:00:00 2001 +From 13173fb5e3e683b97f6f8a7fdb1be7da1c4913ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 27 Oct 2022 21:16:18 +0200 -Subject: [PATCH 21/26] libxl: workaround for Windows PV drivers removing +Subject: [PATCH] libxl: workaround for Windows PV drivers removing control/shutdown node MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -22,10 +22,10 @@ Signed-off-by: Marek Marczykowski-Górecki 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/tools/libs/light/libxl_domain.c b/tools/libs/light/libxl_domain.c -index f518daada6c9..6451b4a145ee 100644 +index 324a4c6607e7..25cde778352d 100644 --- a/tools/libs/light/libxl_domain.c +++ b/tools/libs/light/libxl_domain.c -@@ -771,7 +771,12 @@ int libxl__domain_pvcontrol(libxl__egc *egc, libxl__xswait_state *pvcontrol, +@@ -767,7 +767,12 @@ int libxl__domain_pvcontrol(libxl__egc *egc, libxl__xswait_state *pvcontrol, domid_t domid, const char *cmd) { STATE_AO_GC(pvcontrol->ao); @@ -38,7 +38,7 @@ index f518daada6c9..6451b4a145ee 100644 int rc; rc = libxl__domain_pvcontrol_available(gc, domid); -@@ -785,9 +790,28 @@ int libxl__domain_pvcontrol(libxl__egc *egc, libxl__xswait_state *pvcontrol, +@@ -781,9 +786,28 @@ int libxl__domain_pvcontrol(libxl__egc *egc, libxl__xswait_state *pvcontrol, if (!shutdown_path) return ERROR_FAIL; @@ -70,5 +70,5 @@ index f518daada6c9..6451b4a145ee 100644 pvcontrol->path = shutdown_path; pvcontrol->what = GCSPRINTF("guest acknowledgement of %s request", cmd); -- -2.37.3 +2.44.0 diff --git a/0617-libxl-Add-utility-function-to-check-guest-status.patch b/0617-libxl-Add-utility-function-to-check-guest-status.patch deleted file mode 100644 index 7c88e6e9..00000000 --- a/0617-libxl-Add-utility-function-to-check-guest-status.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 935975ced3906f06a03d554b90b13404895c2000 Mon Sep 17 00:00:00 2001 -From: Demi Marie Obenour -Date: Mon, 26 Sep 2022 10:57:55 -0400 -Subject: [PATCH 17/26] libxl: Add utility function to check guest status - -This is used to check that a guest has not been destroyed and to obtain -information about it. It will be used in subsequent patches. - -Signed-off-by: Demi Marie Obenour ---- - tools/libs/light/libxl_dom_suspend.c | 29 ++++++++++++++++++---------- - 1 file changed, 19 insertions(+), 10 deletions(-) - -diff --git a/tools/libs/light/libxl_dom_suspend.c b/tools/libs/light/libxl_dom_suspend.c -index fa50e8801f35..d2a88ea34efb 100644 ---- a/tools/libs/light/libxl_dom_suspend.c -+++ b/tools/libs/light/libxl_dom_suspend.c -@@ -321,27 +321,36 @@ static void suspend_common_wait_guest_watch(libxl__egc *egc, - suspend_common_wait_guest_check(egc, dsps); - } - -+static int check_guest_status(libxl__gc *gc, const uint32_t domid, -+ xc_domaininfo_t *info, const char *what) -+{ -+ int ret = xc_domain_getinfolist(CTX->xch, domid, 1, info); -+ -+ if (ret < 0) { -+ LOGED(ERROR, domid, "unable to check for status of guest"); -+ return ERROR_FAIL; -+ } -+ -+ if (!(ret == 1 && info->domain == domid)) { -+ LOGED(ERROR, domid, "guest we were %s has been destroyed", what); -+ return ERROR_FAIL; -+ } -+ -+ return 0; -+} -+ - static void suspend_common_wait_guest_check(libxl__egc *egc, - libxl__domain_suspend_state *dsps) - { - STATE_AO_GC(dsps->ao); - xc_domaininfo_t info; -- int ret; - int shutdown_reason; - - /* Convenience aliases */ - const uint32_t domid = dsps->domid; - -- ret = xc_domain_getinfolist(CTX->xch, domid, 1, &info); -- if (ret < 0) { -- LOGED(ERROR, domid, "unable to check for status of guest"); -+ if (check_guest_status(gc, domid, &info, "suspending")) - goto err; -- } -- -- if (!(ret == 1 && info.domain == domid)) { -- LOGED(ERROR, domid, "guest we were suspending has been destroyed"); -- goto err; -- } - - if (!(info.flags & XEN_DOMINF_shutdown)) - /* keep waiting */ --- -2.37.3 - diff --git a/0622-libxl-check-control-feature-before-issuing-pvcontrol.patch b/0617-libxl-check-control-feature-before-issuing-pvcontrol.patch similarity index 82% rename from 0622-libxl-check-control-feature-before-issuing-pvcontrol.patch rename to 0617-libxl-check-control-feature-before-issuing-pvcontrol.patch index b32b9441..e0e7e9c4 100644 --- a/0622-libxl-check-control-feature-before-issuing-pvcontrol.patch +++ b/0617-libxl-check-control-feature-before-issuing-pvcontrol.patch @@ -1,8 +1,8 @@ -From 4b602273b9d179ef2c375c7db7d3d1fbb9546c9f Mon Sep 17 00:00:00 2001 +From 64e3c902dace81021e306de3acdad757a8e24db3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 27 Oct 2022 21:27:05 +0200 -Subject: [PATCH 22/26] libxl: check control/feature-* before issuing pvcontrol +Subject: [PATCH] libxl: check control/feature-* before issuing pvcontrol command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -17,10 +17,10 @@ Signed-off-by: Marek Marczykowski-Górecki 1 file changed, 10 insertions(+) diff --git a/tools/libs/light/libxl_domain.c b/tools/libs/light/libxl_domain.c -index 6451b4a145ee..0d5d1ef6663c 100644 +index 25cde778352d..f4bcb0b198cb 100644 --- a/tools/libs/light/libxl_domain.c +++ b/tools/libs/light/libxl_domain.c -@@ -777,6 +777,7 @@ int libxl__domain_pvcontrol(libxl__egc *egc, libxl__xswait_state *pvcontrol, +@@ -773,6 +773,7 @@ int libxl__domain_pvcontrol(libxl__egc *egc, libxl__xswait_state *pvcontrol, struct xs_permissions perms[] = { { .id = domid, .perms = XS_PERM_NONE }, }; @@ -28,7 +28,7 @@ index 6451b4a145ee..0d5d1ef6663c 100644 int rc; rc = libxl__domain_pvcontrol_available(gc, domid); -@@ -795,6 +796,15 @@ int libxl__domain_pvcontrol(libxl__egc *egc, libxl__xswait_state *pvcontrol, +@@ -791,6 +792,15 @@ int libxl__domain_pvcontrol(libxl__egc *egc, libxl__xswait_state *pvcontrol, if (!t) return ERROR_FAIL; @@ -45,5 +45,5 @@ index 6451b4a145ee..0d5d1ef6663c 100644 if (rc) { xs_transaction_end(ctx->xsh, t, 1); -- -2.37.3 +2.44.0 diff --git a/0623-tools-kdd-mute-spurious-gcc-warning.patch b/0618-tools-kdd-mute-spurious-gcc-warning.patch similarity index 91% rename from 0623-tools-kdd-mute-spurious-gcc-warning.patch rename to 0618-tools-kdd-mute-spurious-gcc-warning.patch index 799fc201..20e84272 100644 --- a/0623-tools-kdd-mute-spurious-gcc-warning.patch +++ b/0618-tools-kdd-mute-spurious-gcc-warning.patch @@ -1,8 +1,8 @@ -From a759637c90570063a9527555a37596d92dee7323 Mon Sep 17 00:00:00 2001 +From 7ec12946362cb0fd6a58c3f45464e847b3cd422d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 5 Apr 2018 01:06:12 +0200 -Subject: [PATCH 23/26] tools/kdd: mute spurious gcc warning +Subject: [PATCH] tools/kdd: mute spurious gcc warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -41,5 +41,5 @@ index 320c623edabe..c42a19989ab9 100644 } -- -2.37.3 +2.44.0 diff --git a/0624-libxl-do-not-start-qemu-in-dom0-just-for-extra-conso.patch b/0619-libxl-do-not-start-qemu-in-dom0-just-for-extra-conso.patch similarity index 81% rename from 0624-libxl-do-not-start-qemu-in-dom0-just-for-extra-conso.patch rename to 0619-libxl-do-not-start-qemu-in-dom0-just-for-extra-conso.patch index a4ca88e7..763f32c1 100644 --- a/0624-libxl-do-not-start-qemu-in-dom0-just-for-extra-conso.patch +++ b/0619-libxl-do-not-start-qemu-in-dom0-just-for-extra-conso.patch @@ -1,9 +1,8 @@ -From 39b219794cb55df609fa5bf4afc9523a16e919b6 Mon Sep 17 00:00:00 2001 +From 4d368a22ba8e13bba930f2395d395b3dcd869236 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 16 Nov 2022 01:28:47 +0100 -Subject: [PATCH 24/26] libxl: do not start qemu in dom0 just for extra - consoles +Subject: [PATCH] libxl: do not start qemu in dom0 just for extra consoles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -17,10 +16,10 @@ Signed-off-by: Marek Marczykowski-Górecki 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c -index f0895f192cf8..09f0c2a83ead 100644 +index d3df66786c45..e1593e255be7 100644 --- a/tools/libs/light/libxl_dm.c +++ b/tools/libs/light/libxl_dm.c -@@ -2583,7 +2583,7 @@ static void spawn_stub_launch_dm(libxl__egc *egc, +@@ -2592,7 +2592,7 @@ static void spawn_stub_launch_dm(libxl__egc *egc, * Until xenconsoled learns how to handle multiple consoles, require qemu * in dom0 to serve consoles for a stubdomain - it require at least 3 of them. */ @@ -29,7 +28,7 @@ index f0895f192cf8..09f0c2a83ead 100644 for (i = 0; i < num_console; i++) { libxl__device device; -@@ -2720,7 +2720,7 @@ static void qmp_proxy_spawn_outcome(libxl__egc *egc, +@@ -2729,7 +2729,7 @@ static void qmp_proxy_spawn_outcome(libxl__egc *egc, * Until xenconsoled learns how to handle multiple consoles, require qemu * in dom0 to serve consoles for a stubdomain - it require at least 3 of them. */ @@ -39,5 +38,5 @@ index f0895f192cf8..09f0c2a83ead 100644 if (rc) goto out; -- -2.37.3 +2.44.0 diff --git a/0625-libxl-Allow-stubdomain-to-control-interupts-of-PCI-d.patch b/0620-libxl-Allow-stubdomain-to-control-interupts-of-PCI-d.patch similarity index 87% rename from 0625-libxl-Allow-stubdomain-to-control-interupts-of-PCI-d.patch rename to 0620-libxl-Allow-stubdomain-to-control-interupts-of-PCI-d.patch index 97969d90..913b8d07 100644 --- a/0625-libxl-Allow-stubdomain-to-control-interupts-of-PCI-d.patch +++ b/0620-libxl-Allow-stubdomain-to-control-interupts-of-PCI-d.patch @@ -1,9 +1,8 @@ -From f139b8e8b64bf5bca7f32b9c35ac6af6db4a0bb8 Mon Sep 17 00:00:00 2001 +From b264671e40262b0e81cf7b1badef2a4da3837946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 16 Nov 2022 01:31:42 +0100 -Subject: [PATCH 25/26] libxl: Allow stubdomain to control interupts of PCI - device +Subject: [PATCH] libxl: Allow stubdomain to control interupts of PCI device MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -18,7 +17,7 @@ Signed-off-by: Marek Marczykowski-Górecki 1 file changed, 11 insertions(+) diff --git a/tools/libs/light/libxl_pci.c b/tools/libs/light/libxl_pci.c -index c9e01900ecfc..2f73e963d028 100644 +index bf4acb46d6e8..e87c58100127 100644 --- a/tools/libs/light/libxl_pci.c +++ b/tools/libs/light/libxl_pci.c @@ -1512,6 +1512,17 @@ static void pci_add_dm_done(libxl__egc *egc, @@ -40,5 +39,5 @@ index c9e01900ecfc..2f73e963d028 100644 out_no_irq: -- -2.37.3 +2.44.0 diff --git a/0626-Validate-EFI-memory-descriptors.patch b/0621-Validate-EFI-memory-descriptors.patch similarity index 80% rename from 0626-Validate-EFI-memory-descriptors.patch rename to 0621-Validate-EFI-memory-descriptors.patch index 18f83383..b8bc1930 100644 --- a/0626-Validate-EFI-memory-descriptors.patch +++ b/0621-Validate-EFI-memory-descriptors.patch @@ -1,11 +1,7 @@ -From fac0c8e2e1328cf58f2ede6c69122bd7a96c40d3 Mon Sep 17 00:00:00 2001 -Message-Id: -In-Reply-To: -References: +From b05040c39c83f3872064948303be67edcdc9357d Mon Sep 17 00:00:00 2001 From: Demi Marie Obenour Date: Fri, 18 Nov 2022 22:51:04 -0500 -Subject: [PATCH 1/2] Validate EFI memory descriptors -Cc: Marek Marczykowski-Górecki +Subject: [PATCH] Validate EFI memory descriptors It turns out that these can be invalid in various ways. Based on code Ard Biesheuvel contributed for Linux. @@ -24,7 +20,7 @@ Signed-off-by: Demi Marie Obenour 4 files changed, 39 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h -index 83b4e28cbcba7a134e569c5e6ef0ca95c311c01c..abfc7ab0f31511e2c1ee402a09ac533d260444b2 100644 +index 39cc8baef4bc..d9666517f256 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -164,9 +164,11 @@ static void __init efi_arch_process_memory_map(EFI_SYSTEM_TABLE *SystemTable, @@ -39,12 +35,12 @@ index 83b4e28cbcba7a134e569c5e6ef0ca95c311c01c..abfc7ab0f31511e2c1ee402a09ac533d + continue; switch ( desc->Type ) { - case EfiBootServicesCode: + default: diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c -index e1248d63e7f99d598a6b1df04e34ed34ed0b6910..32ae6b43bb53448421c908819cda552757157c1f 100644 +index ad8488f7f9d7..8d017abf9be8 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c -@@ -592,15 +592,14 @@ static UINTN __initdata esrt = EFI_INVALID_TABLE_ADDR; +@@ -593,15 +593,14 @@ static UINTN __initdata esrt = EFI_INVALID_TABLE_ADDR; static size_t __init get_esrt_size(const EFI_MEMORY_DESCRIPTOR *desc) { @@ -71,8 +67,8 @@ index e1248d63e7f99d598a6b1df04e34ed34ed0b6910..32ae6b43bb53448421c908819cda5527 + uint64_t len = efi_memory_descriptor_len(desc); unsigned long smfn, emfn; unsigned int prot = PAGE_HYPERVISOR_RWX; - -@@ -1707,6 +1706,16 @@ void __init efi_init_memory(void) + paddr_t mem_base; +@@ -1709,6 +1708,16 @@ void __init efi_init_memory(void) ROUNDUP(desc->PhysicalStart + len, PAGE_SIZE)); } @@ -90,12 +86,12 @@ index e1248d63e7f99d598a6b1df04e34ed34ed0b6910..32ae6b43bb53448421c908819cda5527 continue; diff --git a/xen/common/efi/efi.h b/xen/common/efi/efi.h -index c9aa65d506b14de69c90b6538c934747fcf0fb80..9e5389b667e07455e3940802a32396abcadf97b8 100644 +index c02fbb7b69fc..c86450eb7093 100644 --- a/xen/common/efi/efi.h +++ b/xen/common/efi/efi.h @@ -51,3 +51,24 @@ void free_ebmalloc_unused_mem(void); - const void *pe_find_section(const void *image_base, const size_t image_size, + const void *pe_find_section(const void *image, const UINTN image_size, const CHAR16 *section_name, UINTN *size_out); + +static inline UINT64 @@ -119,7 +115,7 @@ index c9aa65d506b14de69c90b6538c934747fcf0fb80..9e5389b667e07455e3940802a32396ab + return desc->NumberOfPages << EFI_PAGE_SHIFT; +} diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c -index 13b0975866e3a80c46a7e37788012a716a455b6a..6dd799f9662d0fd1d335b5b6c064ac889cf36847 100644 +index d952c3ba785e..84cc5f73f8b0 100644 --- a/xen/common/efi/runtime.c +++ b/xen/common/efi/runtime.c @@ -270,7 +270,7 @@ int efi_get_info(uint32_t idx, union xenpf_efi_info *info) @@ -132,7 +128,5 @@ index 13b0975866e3a80c46a7e37788012a716a455b6a..6dd799f9662d0fd1d335b5b6c064ac88 if ( info->mem.addr >= desc->PhysicalStart && info->mem.addr < desc->PhysicalStart + len ) -- -Sincerely, -Demi Marie Obenour (she/her/hers) -Invisible Things Lab +2.44.0 diff --git a/0628-x86-mm-make-code-robust-to-future-PAT-changes.patch b/0622-x86-mm-make-code-robust-to-future-PAT-changes.patch similarity index 74% rename from 0628-x86-mm-make-code-robust-to-future-PAT-changes.patch rename to 0622-x86-mm-make-code-robust-to-future-PAT-changes.patch index 6a5310c0..8cecfa80 100644 --- a/0628-x86-mm-make-code-robust-to-future-PAT-changes.patch +++ b/0622-x86-mm-make-code-robust-to-future-PAT-changes.patch @@ -1,20 +1,7 @@ -From dd64d599a4d5a768ebbf90609982d4cc9bd09872 Mon Sep 17 00:00:00 2001 -Message-Id: -In-Reply-To: -References: +From deecde46e68bffdcfe51e8ccd0cadd91e178db50 Mon Sep 17 00:00:00 2001 From: Demi Marie Obenour Date: Mon, 5 Dec 2022 18:19:05 -0500 -Subject: [PATCH v6 3/5] x86/mm: make code robust to future PAT changes -To: xen-devel@lists.xenproject.org -Cc: Marek Marczykowski-Górecki , - Jan Beulich , - Andrew Cooper , - "Roger Pau Monné" , - Wei Liu , - Jun Nakajima , - Kevin Tian , - George Dunlap , - Tim Deegan +Subject: [PATCH] x86/mm: make code robust to future PAT changes It may be desirable to change Xen's PAT for various reasons. This requires changes to several _PAGE_* macros as well. Add static @@ -22,22 +9,15 @@ assertions to check that XEN_MSR_PAT is consistent with the _PAGE_* macros, and that _PAGE_WB is 0 as required by Linux. Signed-off-by: Demi Marie Obenour ---- -Changes since v4: -- Add lots of comments explaining what the various BUILD_BUG_ON()s mean. - -Changes since v3: -- Refactor some macros -- Avoid including a string literal in BUILD_BUG_ON --- xen/arch/x86/mm.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c -index 3558ca215b02a517d55d75329d645ae5905424e4..a4fa6e4b43334eb10c8f07a0a1667fe0c4523496 100644 +index 648d6dd475ba..702c76a879e5 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c -@@ -6352,6 +6352,11 @@ unsigned long get_upper_mfn_bound(void) +@@ -6358,6 +6358,11 @@ unsigned long get_upper_mfn_bound(void) return min(max_mfn, 1UL << (paddr_bits - PAGE_SHIFT)) - 1; } @@ -49,7 +29,7 @@ index 3558ca215b02a517d55d75329d645ae5905424e4..a4fa6e4b43334eb10c8f07a0a1667fe0 static void __init __maybe_unused build_assertions(void) { /* -@@ -6361,6 +6366,72 @@ static void __init __maybe_unused build_assertions(void) +@@ -6367,6 +6372,72 @@ static void __init __maybe_unused build_assertions(void) * using different PATs will not work. */ BUILD_BUG_ON(XEN_MSR_PAT != 0x050100070406ULL); @@ -123,6 +103,5 @@ index 3558ca215b02a517d55d75329d645ae5905424e4..a4fa6e4b43334eb10c8f07a0a1667fe0 /* -- -Sincerely, -Demi Marie Obenour (she/her/hers) -Invisible Things Lab +2.44.0 + diff --git a/0630-Drop-ELF-notes-from-non-EFI-binary-too.patch b/0623-Drop-ELF-notes-from-non-EFI-binary-too.patch similarity index 87% rename from 0630-Drop-ELF-notes-from-non-EFI-binary-too.patch rename to 0623-Drop-ELF-notes-from-non-EFI-binary-too.patch index f9b5e0e8..af794405 100644 --- a/0630-Drop-ELF-notes-from-non-EFI-binary-too.patch +++ b/0623-Drop-ELF-notes-from-non-EFI-binary-too.patch @@ -1,4 +1,4 @@ -From aa8b1a2c36a3fa694341fa530ffb8586c7002a90 Mon Sep 17 00:00:00 2001 +From 8e2ec0998c012ba00588e166ea7a935b4d55836d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 13 Feb 2023 15:12:55 +0100 @@ -18,10 +18,10 @@ Signed-off-by: Marek Marczykowski-Górecki 1 file changed, 7 deletions(-) diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S -index 8930e14fc40e..f0831bd677e7 100644 +index 26a23a7b0651..09c068db41cd 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S -@@ -192,13 +192,6 @@ SECTIONS +@@ -180,13 +180,6 @@ SECTIONS #endif #endif @@ -36,5 +36,5 @@ index 8930e14fc40e..f0831bd677e7 100644 . = ALIGN(SECTION_ALIGN); -- -2.37.3 +2.44.0 diff --git a/0641-xenpm-Factor-out-a-non-fatal-cpuid_parse-variant.patch b/0624-xenpm-Factor-out-a-non-fatal-cpuid_parse-variant.patch similarity index 84% rename from 0641-xenpm-Factor-out-a-non-fatal-cpuid_parse-variant.patch rename to 0624-xenpm-Factor-out-a-non-fatal-cpuid_parse-variant.patch index fbcf5251..953d65c9 100644 --- a/0641-xenpm-Factor-out-a-non-fatal-cpuid_parse-variant.patch +++ b/0624-xenpm-Factor-out-a-non-fatal-cpuid_parse-variant.patch @@ -1,7 +1,7 @@ -From 7f28ae02cac08a87ac2be3605f82c74919423a25 Mon Sep 17 00:00:00 2001 +From 8ffa3626d98bda43aa4065fb0a8d02493b59dbab Mon Sep 17 00:00:00 2001 From: Jason Andryuk Date: Wed, 10 Aug 2022 15:29:42 -0400 -Subject: [PATCH 11/13] xenpm: Factor out a non-fatal cpuid_parse variant +Subject: [PATCH] xenpm: Factor out a non-fatal cpuid_parse variant Allow cpuid_parse to be re-used without terminating xenpm. HWP will re-use it to optionally parse a cpuid. Unlike other uses of @@ -14,10 +14,10 @@ Signed-off-by: Jason Andryuk 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c -index 610a516213b3..5b28e2f6ddf5 100644 +index 336d246346bb..1db91e386228 100644 --- a/tools/misc/xenpm.c +++ b/tools/misc/xenpm.c -@@ -79,17 +79,26 @@ void help_func(int argc, char *argv[]) +@@ -105,17 +105,26 @@ void help_func(int argc, char *argv[]) show_help(); } @@ -50,5 +50,5 @@ index 610a516213b3..5b28e2f6ddf5 100644 static void parse_cpuid_and_int(int argc, char *argv[], -- -2.37.3 +2.44.0 diff --git a/0671-x86-idle-Get-PC-8.10-counters-for-Tiger-and-Alder-La.patch b/0625-x86-idle-Get-PC-8.10-counters-for-Tiger-and-Alder-La.patch similarity index 68% rename from 0671-x86-idle-Get-PC-8.10-counters-for-Tiger-and-Alder-La.patch rename to 0625-x86-idle-Get-PC-8.10-counters-for-Tiger-and-Alder-La.patch index 8b7d9024..0dd7fe13 100644 --- a/0671-x86-idle-Get-PC-8.10-counters-for-Tiger-and-Alder-La.patch +++ b/0625-x86-idle-Get-PC-8.10-counters-for-Tiger-and-Alder-La.patch @@ -1,34 +1,23 @@ -From 6ca7bb0e831200eb9bec6cb850489be514591e7f Mon Sep 17 00:00:00 2001 +From c106af4d692da9b569d69e7ce25afb41c7bb054d Mon Sep 17 00:00:00 2001 : : Upstreaming needs more verbose log message and since Intel's SDM doesn't : properly document those MSRs we need to argue about that. -: +: : https://lore.kernel.org/xen-devel/20230718132334.2087-1-simon@invisiblethingslab.com/ -: +: From: Simon Gaiser -To: xen-devel@lists.xenproject.org -Cc: Jan Beulich -Cc: Andrew Cooper -Cc: "Roger Pau Monné" -Cc: Wei Liu -Cc: Marek Marczykowski-Górecki -Subject: [XEN PATCH v2] x86/idle: Get PC{8..10} counters for Tiger and Alder Lake +Date: Mon, 8 Jul 2024 13:39:12 +0200 +Subject: [PATCH] x86/idle: Get PC{8..10} counters for Tiger and Alder Lake TODO Signed-off-by: Simon Gaiser --- -Changes in v2: - - Fix wrong subject prefix - - Add missing Signed-off-by - - TODO ---- - xen/arch/x86/acpi/cpu_idle.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c -index 557bc6ef86..a6d3175156 100644 +index 57ac98479029..ca0b1217913b 100644 --- a/xen/arch/x86/acpi/cpu_idle.c +++ b/xen/arch/x86/acpi/cpu_idle.c @@ -155,6 +155,12 @@ static void cf_check do_get_hw_residencies(void *arg) @@ -55,5 +44,5 @@ index 557bc6ef86..a6d3175156 100644 case 0x8E: case 0x9E: -- -2.40.1 +2.44.0 diff --git a/0672-x86-ACPI-Ignore-entries-marked-as-unusable-when-pars.patch b/0626-x86-ACPI-Ignore-entries-marked-as-unusable-when-pars.patch similarity index 93% rename from 0672-x86-ACPI-Ignore-entries-marked-as-unusable-when-pars.patch rename to 0626-x86-ACPI-Ignore-entries-marked-as-unusable-when-pars.patch index 5deac4d9..a8bfe08b 100644 --- a/0672-x86-ACPI-Ignore-entries-marked-as-unusable-when-pars.patch +++ b/0626-x86-ACPI-Ignore-entries-marked-as-unusable-when-pars.patch @@ -1,4 +1,4 @@ -From 5d7a1a552199908db046b47893c9312ecf119e62 Mon Sep 17 00:00:00 2001 +From 9168d4279b6dc17b72fe4d6bada91db610071870 Mon Sep 17 00:00:00 2001 : : Upstreaming in progress : https://lore.kernel.org/xen-devel/ac77ecba-6804-1d16-60dc-f184e5d31dcb@invisiblethingslab.com/ @@ -6,7 +6,7 @@ From 5d7a1a552199908db046b47893c9312ecf119e62 Mon Sep 17 00:00:00 2001 : From: Simon Gaiser Date: Mon, 14 Aug 2023 10:21:38 +0200 -Subject: [XEN PATCH] x86/ACPI: Ignore entries marked as unusable when parsing MADT +Subject: [PATCH] x86/ACPI: Ignore entries marked as unusable when parsing MADT Up to version 6.2 Errata B [2] the ACPI spec only defines ACPI_MADT_ENABLE as: @@ -56,7 +56,7 @@ Signed-off-by: Simon Gaiser 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/acpi/boot.c b/xen/arch/x86/acpi/boot.c -index 54b72d716b..df5e0c4f25 100644 +index 170f9783c55e..15ce62be0480 100644 --- a/xen/arch/x86/acpi/boot.c +++ b/xen/arch/x86/acpi/boot.c @@ -77,6 +77,17 @@ static int __init cf_check acpi_parse_madt(struct acpi_table_header *table) @@ -88,7 +88,7 @@ index 54b72d716b..df5e0c4f25 100644 return 0; if ((processor->lapic_flags & ACPI_MADT_ENABLED) || -@@ -144,9 +153,7 @@ acpi_parse_lapic(struct acpi_subtable_header * header, const unsigned long end) +@@ -148,9 +157,7 @@ acpi_parse_lapic(struct acpi_subtable_header * header, const unsigned long end) return -EINVAL; /* Don't register processors that cannot be onlined. */ @@ -100,5 +100,5 @@ index 54b72d716b..df5e0c4f25 100644 if ((processor->lapic_flags & ACPI_MADT_ENABLED) || -- -2.40.1 +2.44.0 diff --git a/0627-x86-mm-Avoid-hard-coding-PAT-in-get_page_from_l1e.patch b/0627-x86-mm-Avoid-hard-coding-PAT-in-get_page_from_l1e.patch deleted file mode 100644 index 6705a692..00000000 --- a/0627-x86-mm-Avoid-hard-coding-PAT-in-get_page_from_l1e.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 42da0d18476a3fbb01199f1d84ec0ebd845920ed Mon Sep 17 00:00:00 2001 -Message-Id: <42da0d18476a3fbb01199f1d84ec0ebd845920ed.1671692395.git.demi@invisiblethingslab.com> -In-Reply-To: -References: -From: Demi Marie Obenour -Date: Mon, 5 Dec 2022 11:17:11 -0500 -Subject: [PATCH v6 1/5] x86/mm: Avoid hard-coding PAT in get_page_from_l1e() -To: xen-devel@lists.xenproject.org -Cc: Marek Marczykowski-Górecki , - Jan Beulich , - Andrew Cooper , - "Roger Pau Monné" , - Wei Liu , - Jun Nakajima , - Kevin Tian , - George Dunlap , - Tim Deegan - -get_page_from_l1e() relied on Xen's choice of PAT, which is brittle in -the face of future PAT changes. Instead, compute the actual cacheability -used by the CPU and switch on that, as this will work no matter what PAT -Xen uses. - -No functional change intended. This code is itself questionable and may -be removed in the future, but removing it would be an observable -behavior change and so is out of scope for this patch series. - -Signed-off-by: Demi Marie Obenour -Reviewed-by: Jan Beulich ---- -Changes since v5: -- Make comment in get_page_from_l1e() future-proof. -- Explicitly state how known-uncacheable and potentially-cacheable types - are handled. - -Changes since v4: -- Do not add new pte_flags_to_cacheability() helper, as this code may be - removed in the near future and so adding a new helper for it is a bad - idea. -- Do not BUG() in the event of an unexpected cacheability. This cannot - happen, but it is simpler to force such types to UC than to prove that - the BUG() is not reachable. - -Changes since v3: -- Compute and use the actual cacheability as seen by the processor. - -Changes since v2: -- Improve commit message. ---- - xen/arch/x86/mm.c | 14 ++++++++------ - 1 file changed, 8 insertions(+), 6 deletions(-) - -diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c -index 1bda1ba697b434b6c884f17e599aa9b6d3b3dd76..3558ca215b02a517d55d75329d645ae5905424e4 100644 ---- a/xen/arch/x86/mm.c -+++ b/xen/arch/x86/mm.c -@@ -959,14 +959,16 @@ get_page_from_l1e( - flip = _PAGE_RW; - } - -- switch ( l1f & PAGE_CACHE_ATTRS ) -+ switch ( 0xFF & (XEN_MSR_PAT >> (8 * pte_flags_to_cacheattr(l1f))) ) - { -- case 0: /* WB */ -- flip |= _PAGE_PWT | _PAGE_PCD; -+ case X86_MT_UC: -+ case X86_MT_UCM: -+ case X86_MT_WC: -+ /* not cacheable, allow */ - break; -- case _PAGE_PWT: /* WT */ -- case _PAGE_PWT | _PAGE_PAT: /* WP */ -- flip |= _PAGE_PCD | (l1f & _PAGE_PAT); -+ default: -+ /* potentially cacheable, force to UC */ -+ flip |= ((l1f & PAGE_CACHE_ATTRS) ^ _PAGE_UC); - break; - } - --- -Sincerely, -Demi Marie Obenour (she/her/hers) -Invisible Things Lab - diff --git a/0673-x86-msr-Allow-hardware-domain-to-read-C-state-reside.patch b/0627-x86-msr-Allow-hardware-domain-to-read-package-C-stat.patch similarity index 77% rename from 0673-x86-msr-Allow-hardware-domain-to-read-C-state-reside.patch rename to 0627-x86-msr-Allow-hardware-domain-to-read-package-C-stat.patch index 807e57e3..154c418a 100644 --- a/0673-x86-msr-Allow-hardware-domain-to-read-C-state-reside.patch +++ b/0627-x86-msr-Allow-hardware-domain-to-read-package-C-stat.patch @@ -1,17 +1,12 @@ -From 946e5494801866c93332cc5d9ec0fa03a4df00d7 Mon Sep 17 00:00:00 2001 +From f6be7ac78ebb5646a0f63200676a311ab5e224e2 Mon Sep 17 00:00:00 2001 : : NAKed by upstream: https://lore.kernel.org/xen-devel/15a30769-4a61-ca22-7b5a-6249186cd8a2@suse.com/ : Keep it in Qubes for now since it's very helpful for debugging with : existing software. : From: Simon Gaiser -To: xen-devel@lists.xenproject.org -Cc: Jan Beulich -Cc: Andrew Cooper -Cc: "Roger Pau Monné" -Cc: Wei Liu -Cc: Marek Marczykowski-Górecki -Subject: [XEN PATCH] x86/msr: Allow hardware domain to read package C-state +Date: Mon, 8 Jul 2024 13:39:12 +0200 +Subject: [PATCH] x86/msr: Allow hardware domain to read package C-state residency counters Since it's limited to the hardware domain it should be safe and it's @@ -19,14 +14,14 @@ very useful to have access to this directly in dom0 when debugging power related things for example S0ix. --- xen/arch/x86/include/asm/msr-index.h | 9 +++++++++ - xen/arch/x86/pv/emul-priv-op.c | 14 ++++++++++++++ - 2 files changed, 23 insertions(+) + xen/arch/x86/pv/emul-priv-op.c | 19 +++++++++++++++++++ + 2 files changed, 28 insertions(+) diff --git a/xen/arch/x86/include/asm/msr-index.h b/xen/arch/x86/include/asm/msr-index.h -index 4f861c0bb4..7e7255383d 100644 +index 9cdb5b262566..17dd857af802 100644 --- a/xen/arch/x86/include/asm/msr-index.h +++ b/xen/arch/x86/include/asm/msr-index.h -@@ -704,4 +704,13 @@ +@@ -698,4 +698,13 @@ #define MSR_PKGC9_IRTL 0x00000634 #define MSR_PKGC10_IRTL 0x00000635 @@ -41,10 +36,10 @@ index 4f861c0bb4..7e7255383d 100644 + #endif /* __ASM_MSR_INDEX_H */ diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c -index 5da00e24e4..9e0e582c5d 100644 +index f101510a1bab..29f3f00e8ed2 100644 --- a/xen/arch/x86/pv/emul-priv-op.c +++ b/xen/arch/x86/pv/emul-priv-op.c -@@ -979,6 +979,25 @@ static int cf_check read_msr( +@@ -965,6 +965,25 @@ static int cf_check read_msr( *val = 0; return X86EMUL_OKAY; @@ -71,5 +66,5 @@ index 5da00e24e4..9e0e582c5d 100644 case MSR_P6_EVNTSEL(0) ... MSR_P6_EVNTSEL(3): case MSR_CORE_PERF_FIXED_CTR0 ... MSR_CORE_PERF_FIXED_CTR2: -- -2.40.1 +2.44.0 diff --git a/0674-x86-mwait-idle-Use-ACPI-for-CPUs-without-hardcoded-C.patch b/0628-x86-mwait-idle-Use-ACPI-for-CPUs-without-hardcoded-C.patch similarity index 94% rename from 0674-x86-mwait-idle-Use-ACPI-for-CPUs-without-hardcoded-C.patch rename to 0628-x86-mwait-idle-Use-ACPI-for-CPUs-without-hardcoded-C.patch index 5b2b6059..b108088b 100644 --- a/0674-x86-mwait-idle-Use-ACPI-for-CPUs-without-hardcoded-C.patch +++ b/0628-x86-mwait-idle-Use-ACPI-for-CPUs-without-hardcoded-C.patch @@ -1,4 +1,4 @@ -From ed046789908a154d98cdd8202050810aade9c6a6 Mon Sep 17 00:00:00 2001 +From 2b4cd4c5ce29c48f49ddb63d09a4c720b6cfe11e Mon Sep 17 00:00:00 2001 : : It's currently unclear if it's really needed or not. Keep it disabled : by default but compile it in such that testing with it is easy, @@ -10,8 +10,8 @@ From ed046789908a154d98cdd8202050810aade9c6a6 Mon Sep 17 00:00:00 2001 : From: Simon Gaiser Date: Mon, 14 Aug 2023 10:09:59 +0200 -Subject: [RFC XEN PATCH] x86/mwait-idle: Use ACPI for CPUs without hardcoded - C-state table +Subject: [PATCH] x86/mwait-idle: Use ACPI for CPUs without hardcoded C-state + table mwait-idle includes a hardcoded config for many CPUs. But some are missing, for example Tiger Lake. Linux' driver reads the config from @@ -29,7 +29,7 @@ Signed-off-by: Simon Gaiser 3 files changed, 142 insertions(+), 34 deletions(-) diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c -index cfce4cc040..ca8f25fe2f 100644 +index ca0b1217913b..4f7530d25be1 100644 --- a/xen/arch/x86/acpi/cpu_idle.c +++ b/xen/arch/x86/acpi/cpu_idle.c @@ -78,6 +78,7 @@ @@ -40,7 +40,7 @@ index cfce4cc040..ca8f25fe2f 100644 bool lapic_timer_init(void) { -@@ -1313,6 +1314,26 @@ static void print_cx_pminfo(uint32_t cpu, struct xen_processor_power *power) +@@ -1316,6 +1317,26 @@ static void print_cx_pminfo(uint32_t cpu, struct xen_processor_power *power) #define print_cx_pminfo(c, p) #endif @@ -67,7 +67,7 @@ index cfce4cc040..ca8f25fe2f 100644 long set_cx_pminfo(uint32_t acpi_id, struct xen_processor_power *power) { XEN_GUEST_HANDLE(xen_processor_cx_t) states; -@@ -1360,24 +1381,27 @@ long set_cx_pminfo(uint32_t acpi_id, struct xen_processor_power *power) +@@ -1363,24 +1384,27 @@ long set_cx_pminfo(uint32_t acpi_id, struct xen_processor_power *power) set_cx(acpi_power, &xen_cx); } @@ -111,7 +111,7 @@ index cfce4cc040..ca8f25fe2f 100644 else if ( cpuidle_current_governor->enable ) { ret = cpuidle_current_governor->enable(acpi_power); -@@ -1677,7 +1701,7 @@ static int __init cf_check cpuidle_presmp_init(void) +@@ -1680,7 +1704,7 @@ static int __init cf_check cpuidle_presmp_init(void) if ( !xen_cpuidle ) return 0; @@ -121,7 +121,7 @@ index cfce4cc040..ca8f25fe2f 100644 cpu_nfb.notifier_call(&cpu_nfb, CPU_ONLINE, cpu); register_cpu_notifier(&cpu_nfb); diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c -index ff5c808bc9..b8fe28c3d7 100644 +index ae6987117169..511c666f2d6b 100644 --- a/xen/arch/x86/cpu/mwait-idle.c +++ b/xen/arch/x86/cpu/mwait-idle.c @@ -60,15 +60,20 @@ @@ -309,18 +309,18 @@ index ff5c808bc9..b8fe28c3d7 100644 hpet_broadcast_init(); if (xen_cpuidle < 0 && !hpet_broadcast_is_available()) diff --git a/xen/arch/x86/include/asm/cpuidle.h b/xen/arch/x86/include/asm/cpuidle.h -index 3edd7a75d2..f8913c7304 100644 +index 707b3e948d45..3f5cd40fd596 100644 --- a/xen/arch/x86/include/asm/cpuidle.h +++ b/xen/arch/x86/include/asm/cpuidle.h @@ -15,7 +15,7 @@ extern void (*lapic_timer_on)(void); extern uint64_t (*cpuidle_get_tick)(void); --int mwait_idle_init(struct notifier_block *); -+int mwait_idle_init(struct notifier_block *, bool); +-int mwait_idle_init(struct notifier_block *nfb); ++int mwait_idle_init(struct notifier_block *nfb, bool); int cpuidle_init_cpu(unsigned int cpu); void cf_check default_dead_idle(void); void cf_check acpi_dead_idle(void); -- -2.40.1 +2.44.0 diff --git a/0675-libxl_pci-Pass-power_mgmt-via-QMP.patch b/0629-libxl_pci-Pass-power_mgmt-via-QMP.patch similarity index 81% rename from 0675-libxl_pci-Pass-power_mgmt-via-QMP.patch rename to 0629-libxl_pci-Pass-power_mgmt-via-QMP.patch index 034d7785..7ed5967b 100644 --- a/0675-libxl_pci-Pass-power_mgmt-via-QMP.patch +++ b/0629-libxl_pci-Pass-power_mgmt-via-QMP.patch @@ -1,4 +1,4 @@ -From cace989bbe09b45b6936f32a8a06d03d6cf5d5d7 Mon Sep 17 00:00:00 2001 +From 139292ed87c6730454afc74e10a48643f3ec60ea Mon Sep 17 00:00:00 2001 : : Upstreaming only makes sense once QEMU has proper support for this. : @@ -12,10 +12,10 @@ Signed-off-by: Simon Gaiser 1 file changed, 2 insertions(+) diff --git a/tools/libs/light/libxl_pci.c b/tools/libs/light/libxl_pci.c -index f4c4f17545..4b48698f18 100644 +index e87c58100127..a6b0e3adcb68 100644 --- a/tools/libs/light/libxl_pci.c +++ b/tools/libs/light/libxl_pci.c -@@ -1240,6 +1240,8 @@ static void pci_add_qmp_device_add(libxl__egc *egc, pci_add_state *pas) +@@ -1243,6 +1243,8 @@ static void pci_add_qmp_device_add(libxl__egc *egc, pci_add_state *pas) */ if (pci->permissive) libxl__qmp_param_add_bool(gc, &args, "permissive", true); @@ -25,5 +25,5 @@ index f4c4f17545..4b48698f18 100644 qmp->ao = pas->aodev->ao; qmp->domid = domid; -- -2.43.0 +2.44.0 diff --git a/0631-cpufreq-Allow-restricting-to-internal-governors-only.patch b/0631-cpufreq-Allow-restricting-to-internal-governors-only.patch deleted file mode 100644 index e6a56f0f..00000000 --- a/0631-cpufreq-Allow-restricting-to-internal-governors-only.patch +++ /dev/null @@ -1,62 +0,0 @@ -From c0a69ba8e4210bf42cc545afd02ad7fe1135fe96 Mon Sep 17 00:00:00 2001 -From: Jason Andryuk -Date: Wed, 10 Aug 2022 15:29:32 -0400 -Subject: [PATCH 01/13] cpufreq: Allow restricting to internal governors only - -For hwp, the standard governors are not usable, and only the internal -one is applicable. Add the cpufreq_governor_internal boolean to -indicate when an internal governor, like hwp-internal, will be used. -This is set during presmp_initcall, so that it can suppress governor -registration during initcall. Only a governor with a name containing -"-internal" will be allowed in that case. - -This way, the unuseable governors are not registered, so they internal -one is the only one returned to userspace. This means incompatible -governors won't be advertised to userspace. - -Signed-off-by: Jason Andryuk -Acked-by: Jan Beulich ---- - xen/drivers/cpufreq/cpufreq.c | 5 +++++ - xen/include/acpi/cpufreq/cpufreq.h | 2 ++ - 2 files changed, 7 insertions(+) - -diff --git a/xen/drivers/cpufreq/cpufreq.c b/xen/drivers/cpufreq/cpufreq.c -index a94520ee57ac..1fdd63d7b564 100644 ---- a/xen/drivers/cpufreq/cpufreq.c -+++ b/xen/drivers/cpufreq/cpufreq.c -@@ -57,6 +57,7 @@ struct cpufreq_dom { - }; - static LIST_HEAD_READ_MOSTLY(cpufreq_dom_list_head); - -+bool __read_mostly cpufreq_governor_internal; - struct cpufreq_governor *__read_mostly cpufreq_opt_governor; - LIST_HEAD_READ_MOSTLY(cpufreq_governor_list); - -@@ -122,6 +123,10 @@ int __init cpufreq_register_governor(struct cpufreq_governor *governor) - if (!governor) - return -EINVAL; - -+ if (cpufreq_governor_internal && -+ strstr(governor->name, "-internal") == NULL) -+ return -EINVAL; -+ - if (__find_governor(governor->name) != NULL) - return -EEXIST; - -diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/cpufreq.h -index 35dcf21e8f0c..0da32ef51903 100644 ---- a/xen/include/acpi/cpufreq/cpufreq.h -+++ b/xen/include/acpi/cpufreq/cpufreq.h -@@ -114,6 +114,8 @@ extern struct cpufreq_governor cpufreq_gov_userspace; - extern struct cpufreq_governor cpufreq_gov_performance; - extern struct cpufreq_governor cpufreq_gov_powersave; - -+extern bool cpufreq_governor_internal; -+ - extern struct list_head cpufreq_governor_list; - - extern int cpufreq_register_governor(struct cpufreq_governor *governor); --- -2.37.3 - diff --git a/0632-cpufreq-Add-perf_freq-to-cpuinfo.patch b/0632-cpufreq-Add-perf_freq-to-cpuinfo.patch deleted file mode 100644 index a2b9af94..00000000 --- a/0632-cpufreq-Add-perf_freq-to-cpuinfo.patch +++ /dev/null @@ -1,61 +0,0 @@ -From fed49894b171851eefce5a91900217a57cac396e Mon Sep 17 00:00:00 2001 -From: Jason Andryuk -Date: Wed, 10 Aug 2022 15:29:33 -0400 -Subject: [PATCH 02/13] cpufreq: Add perf_freq to cpuinfo - -acpi-cpufreq scales the aperf/mperf measurements by max_freq, but HWP -needs to scale by base frequency. Settings max_freq to base_freq -"works" but the code is not obvious, and returning values to userspace -is tricky. Add an additonal perf_freq member which is used for scaling -aperf/mperf measurements. - -Signed-off-by: Jason Andryuk -Acked-by: Jan Beulich ---- - xen/arch/x86/acpi/cpufreq/cpufreq.c | 2 +- - xen/drivers/cpufreq/utility.c | 1 + - xen/include/acpi/cpufreq/cpufreq.h | 3 +++ - 3 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/xen/arch/x86/acpi/cpufreq/cpufreq.c b/xen/arch/x86/acpi/cpufreq/cpufreq.c -index c27cbb2304f2..ded0150b3b00 100644 ---- a/xen/arch/x86/acpi/cpufreq/cpufreq.c -+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c -@@ -317,7 +317,7 @@ unsigned int get_measured_perf(unsigned int cpu, unsigned int flag) - else - perf_percent = 0; - -- return policy->cpuinfo.max_freq * perf_percent / 100; -+ return policy->cpuinfo.perf_freq * perf_percent / 100; - } - - static unsigned int cf_check get_cur_freq_on_cpu(unsigned int cpu) -diff --git a/xen/drivers/cpufreq/utility.c b/xen/drivers/cpufreq/utility.c -index 9eb7ecedcd29..6831f62851cd 100644 ---- a/xen/drivers/cpufreq/utility.c -+++ b/xen/drivers/cpufreq/utility.c -@@ -236,6 +236,7 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, - - policy->min = policy->cpuinfo.min_freq = min_freq; - policy->max = policy->cpuinfo.max_freq = max_freq; -+ policy->cpuinfo.perf_freq = max_freq; - policy->cpuinfo.second_max_freq = second_max_freq; - - if (policy->min == ~0) -diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/cpufreq.h -index 0da32ef51903..a06aa92f6209 100644 ---- a/xen/include/acpi/cpufreq/cpufreq.h -+++ b/xen/include/acpi/cpufreq/cpufreq.h -@@ -37,6 +37,9 @@ extern struct acpi_cpufreq_data *cpufreq_drv_data[NR_CPUS]; - struct cpufreq_cpuinfo { - unsigned int max_freq; - unsigned int second_max_freq; /* P1 if Turbo Mode is on */ -+ unsigned int perf_freq; /* Scaling freq for aperf/mpref. -+ acpi-cpufreq uses max_freq, but HWP uses -+ base_freq.*/ - unsigned int min_freq; - unsigned int transition_latency; /* in 10^(-9) s = nanoseconds */ - }; --- -2.37.3 - diff --git a/0633-cpufreq-Export-intel_feature_detect.patch b/0633-cpufreq-Export-intel_feature_detect.patch deleted file mode 100644 index 594249f4..00000000 --- a/0633-cpufreq-Export-intel_feature_detect.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 6b5101014c6e4ee32d13993e0d3d19857817c228 Mon Sep 17 00:00:00 2001 -From: Jason Andryuk -Date: Wed, 10 Aug 2022 15:29:34 -0400 -Subject: [PATCH 03/13] cpufreq: Export intel_feature_detect - -Export feature_detect as intel_feature_detect so it can be re-used by -HWP. - -Signed-off-by: Jason Andryuk ---- - xen/arch/x86/acpi/cpufreq/cpufreq.c | 8 ++++++-- - xen/include/acpi/cpufreq/cpufreq.h | 2 ++ - 2 files changed, 8 insertions(+), 2 deletions(-) - -diff --git a/xen/arch/x86/acpi/cpufreq/cpufreq.c b/xen/arch/x86/acpi/cpufreq/cpufreq.c -index ded0150b3b00..b5eb869227a7 100644 ---- a/xen/arch/x86/acpi/cpufreq/cpufreq.c -+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c -@@ -340,9 +340,8 @@ static unsigned int cf_check get_cur_freq_on_cpu(unsigned int cpu) - return extract_freq(get_cur_val(cpumask_of(cpu)), data); - } - --static void cf_check feature_detect(void *info) -+void intel_feature_detect(struct cpufreq_policy *policy) - { -- struct cpufreq_policy *policy = info; - unsigned int eax; - - eax = cpuid_eax(6); -@@ -354,6 +353,11 @@ static void cf_check feature_detect(void *info) - } - } - -+static void cf_check feature_detect(void *info) -+{ -+ intel_feature_detect((struct cpufreq_policy *)info); -+} -+ - static unsigned int check_freqs(const cpumask_t *mask, unsigned int freq, - struct acpi_cpufreq_data *data) - { -diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/cpufreq.h -index a06aa92f6209..0f334d2a432b 100644 ---- a/xen/include/acpi/cpufreq/cpufreq.h -+++ b/xen/include/acpi/cpufreq/cpufreq.h -@@ -243,4 +243,6 @@ int write_userspace_scaling_setspeed(unsigned int cpu, unsigned int freq); - void cpufreq_dbs_timer_suspend(void); - void cpufreq_dbs_timer_resume(void); - -+void intel_feature_detect(struct cpufreq_policy *policy); -+ - #endif /* __XEN_CPUFREQ_PM_H__ */ --- -2.37.3 - diff --git a/0634-cpufreq-Add-Hardware-P-State-HWP-driver.patch b/0634-cpufreq-Add-Hardware-P-State-HWP-driver.patch deleted file mode 100644 index ccd2cd8b..00000000 --- a/0634-cpufreq-Add-Hardware-P-State-HWP-driver.patch +++ /dev/null @@ -1,761 +0,0 @@ -From bafb8de666b04b519a5bbe663683181e441214bb Mon Sep 17 00:00:00 2001 -From: Jason Andryuk -Date: Wed, 10 Aug 2022 15:29:35 -0400 -Subject: [PATCH 04/13] cpufreq: Add Hardware P-State (HWP) driver - -From the Intel SDM: "Hardware-Controlled Performance States (HWP), which -autonomously selects performance states while utilizing OS supplied -performance guidance hints." - -Enable HWP to run in autonomous mode by poking the correct MSRs. -cpufreq=xen:hwp enables and cpufreq=xen:hwp=0 disables. The same for -hdc. - -There is no interface to configure - xen_sysctl_pm_op/xenpm will -be to be extended to configure in subsequent patches. It will run with -the default values, which should be the default 0x80 (out -of 0x0-0xff) energy/performance preference. - -Unscientific powertop measurement of an mostly idle, customized OpenXT -install: -A 10th gen 6-core laptop showed battery discharge drop from ~9.x to -~7.x watts. -A 8th gen 4-core laptop dropped from ~10 to ~9 - -Power usage depends on many factors, especially display brightness, but -this does show an power saving in balanced mode when CPU utilization is -low. - -HWP isn't compatible with an external governor - it doesn't take -explicit frequency requests. Therefore a minimal internal governor, -hwp-internal, is also added as a placeholder. - -While adding to the xen-command-line.pandoc entry, un-nest verbose from -minfreq. They are independent. - -Signed-off-by: Jason Andryuk - -Marek: -- add cf_check to cpufreq_gov_hwp_init() ---- - docs/misc/xen-command-line.pandoc | 8 +- - xen/arch/x86/acpi/cpufreq/Makefile | 1 + - xen/arch/x86/acpi/cpufreq/cpufreq.c | 5 +- - xen/arch/x86/acpi/cpufreq/hwp.c | 506 ++++++++++++++++++++++ - xen/arch/x86/include/asm/cpufeature.h | 13 +- - xen/arch/x86/include/asm/msr-index.h | 13 + - xen/drivers/cpufreq/cpufreq.c | 32 ++ - xen/include/acpi/cpufreq/cpufreq.h | 3 + - xen/include/acpi/cpufreq/processor_perf.h | 3 + - xen/include/public/sysctl.h | 1 + - 10 files changed, 581 insertions(+), 4 deletions(-) - create mode 100644 xen/arch/x86/acpi/cpufreq/hwp.c - -diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc -index 923910f553c5..633aa5580e2f 100644 ---- a/docs/misc/xen-command-line.pandoc -+++ b/docs/misc/xen-command-line.pandoc -@@ -494,7 +494,7 @@ If set, force use of the performance counters for oprofile, rather than detectin - available support. - - ### cpufreq --> `= none | {{ | xen } [:[powersave|performance|ondemand|userspace][,][,[][,[verbose]]]]} | dom0-kernel` -+> `= none | {{ | xen } [:[powersave|performance|ondemand|userspace][,][,[]][,[]][,[]][,[verbose]]]} | dom0-kernel` - - > Default: `xen` - -@@ -505,6 +505,12 @@ choice of `dom0-kernel` is deprecated and not supported by all Dom0 kernels. - * `` and `` are integers which represent max and min processor frequencies - respectively. - * `verbose` option can be included as a string or also as `verbose=` -+* `` is a boolean to enable Hardware-Controlled Performance States (HWP) -+ on supported Intel hardware. HWP is a Skylake+ feature which provides better -+ CPU power management. The default is disabled. -+* `` is a boolean to enable Hardware Duty Cycling (HDC). HDC enables the -+ processor to autonomously force physical package components into idle state. -+ The default is enabled, but the option only applies when `` is enabled. - - ### cpuid (x86) - > `= List of comma separated booleans` -diff --git a/xen/arch/x86/acpi/cpufreq/Makefile b/xen/arch/x86/acpi/cpufreq/Makefile -index f75da9b9cad9..db83aa6b1475 100644 ---- a/xen/arch/x86/acpi/cpufreq/Makefile -+++ b/xen/arch/x86/acpi/cpufreq/Makefile -@@ -1,2 +1,3 @@ - obj-y += cpufreq.o -+obj-y += hwp.o - obj-y += powernow.o -diff --git a/xen/arch/x86/acpi/cpufreq/cpufreq.c b/xen/arch/x86/acpi/cpufreq/cpufreq.c -index b5eb869227a7..baafaf9b90ab 100644 ---- a/xen/arch/x86/acpi/cpufreq/cpufreq.c -+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c -@@ -643,7 +643,10 @@ static int __init cf_check cpufreq_driver_init(void) - switch ( boot_cpu_data.x86_vendor ) - { - case X86_VENDOR_INTEL: -- ret = cpufreq_register_driver(&acpi_cpufreq_driver); -+ if ( hwp_available() ) -+ ret = hwp_register_driver(); -+ else -+ ret = cpufreq_register_driver(&acpi_cpufreq_driver); - break; - - case X86_VENDOR_AMD: -diff --git a/xen/arch/x86/acpi/cpufreq/hwp.c b/xen/arch/x86/acpi/cpufreq/hwp.c -new file mode 100644 -index 000000000000..ee9daa63ab55 ---- /dev/null -+++ b/xen/arch/x86/acpi/cpufreq/hwp.c -@@ -0,0 +1,506 @@ -+/* SPDX-License-Identifier: GPL-2.0 */ -+/* -+ * hwp.c cpufreq driver to run Intel Hardware P-States (HWP) -+ * -+ * Copyright (C) 2021 Jason Andryuk -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static bool feature_hwp; -+static bool feature_hwp_notification; -+static bool feature_hwp_activity_window; -+static bool feature_hwp_energy_perf; -+static bool feature_hwp_pkg_level_ctl; -+static bool feature_hwp_peci; -+ -+static bool feature_hdc; -+ -+__initdata bool opt_cpufreq_hwp = false; -+__initdata bool opt_cpufreq_hdc = true; -+ -+#define HWP_ENERGY_PERF_BALANCE 0x80 -+#define IA32_ENERGY_BIAS_BALANCE 0x7 -+#define IA32_ENERGY_BIAS_MAX_POWERSAVE 0xf -+#define IA32_ENERGY_BIAS_MASK 0xf -+ -+union hwp_request -+{ -+ struct -+ { -+ uint64_t min_perf:8; -+ uint64_t max_perf:8; -+ uint64_t desired:8; -+ uint64_t energy_perf:8; -+ uint64_t activity_window:10; -+ uint64_t package_control:1; -+ uint64_t reserved:16; -+ uint64_t activity_window_valid:1; -+ uint64_t energy_perf_valid:1; -+ uint64_t desired_valid:1; -+ uint64_t max_perf_valid:1; -+ uint64_t min_perf_valid:1; -+ }; -+ uint64_t raw; -+}; -+ -+struct hwp_drv_data -+{ -+ union -+ { -+ uint64_t hwp_caps; -+ struct -+ { -+ uint64_t highest:8; -+ uint64_t guaranteed:8; -+ uint64_t most_efficient:8; -+ uint64_t lowest:8; -+ uint64_t reserved:32; -+ } hw; -+ }; -+ union hwp_request curr_req; -+ uint16_t activity_window; -+ uint8_t minimum; -+ uint8_t maximum; -+ uint8_t desired; -+ uint8_t energy_perf; -+}; -+DEFINE_PER_CPU_READ_MOSTLY(struct hwp_drv_data *, hwp_drv_data); -+ -+#define hwp_err(...) printk(XENLOG_ERR __VA_ARGS__) -+#define hwp_info(...) printk(XENLOG_INFO __VA_ARGS__) -+#define hwp_verbose(...) \ -+({ \ -+ if ( cpufreq_verbose ) \ -+ printk(XENLOG_DEBUG __VA_ARGS__); \ -+}) -+ -+static int cf_check hwp_governor(struct cpufreq_policy *policy, -+ unsigned int event) -+{ -+ int ret; -+ -+ if ( policy == NULL ) -+ return -EINVAL; -+ -+ switch ( event ) -+ { -+ case CPUFREQ_GOV_START: -+ case CPUFREQ_GOV_LIMITS: -+ ret = 0; -+ break; -+ -+ case CPUFREQ_GOV_STOP: -+ default: -+ ret = -EINVAL; -+ break; -+ } -+ -+ return ret; -+} -+ -+static struct cpufreq_governor hwp_cpufreq_governor = -+{ -+ .name = XEN_HWP_GOVERNOR, -+ .governor = hwp_governor, -+}; -+ -+static int __init cf_check cpufreq_gov_hwp_init(void) -+{ -+ return cpufreq_register_governor(&hwp_cpufreq_governor); -+} -+__initcall(cpufreq_gov_hwp_init); -+ -+bool __init hwp_available(void) -+{ -+ unsigned int eax, ecx, unused; -+ bool use_hwp; -+ -+ if ( boot_cpu_data.cpuid_level < CPUID_PM_LEAF ) -+ { -+ hwp_verbose("cpuid_level (%u) lacks HWP support\n", -+ boot_cpu_data.cpuid_level); -+ return false; -+ } -+ -+ if ( boot_cpu_data.cpuid_level < 0x16 ) -+ { -+ hwp_info("HWP disabled: cpuid_level %x < 0x16 lacks CPU freq info\n", -+ boot_cpu_data.cpuid_level); -+ return false; -+ } -+ -+ cpuid(CPUID_PM_LEAF, &eax, &unused, &ecx, &unused); -+ -+ if ( !(eax & CPUID6_EAX_HWP_ENERGY_PERFORMANCE_PREFERENCE) && -+ !(ecx & CPUID6_ECX_IA32_ENERGY_PERF_BIAS) ) -+ { -+ hwp_verbose("HWP disabled: No energy/performance preference available"); -+ return false; -+ } -+ -+ feature_hwp = eax & CPUID6_EAX_HWP; -+ feature_hwp_notification = eax & CPUID6_EAX_HWP_NOTIFICATION; -+ feature_hwp_activity_window = eax & CPUID6_EAX_HWP_ACTIVITY_WINDOW; -+ feature_hwp_energy_perf = -+ eax & CPUID6_EAX_HWP_ENERGY_PERFORMANCE_PREFERENCE; -+ feature_hwp_pkg_level_ctl = eax & CPUID6_EAX_HWP_PACKAGE_LEVEL_REQUEST; -+ feature_hwp_peci = eax & CPUID6_EAX_HWP_PECI; -+ -+ hwp_verbose("HWP: %d notify: %d act-window: %d energy-perf: %d pkg-level: %d peci: %d\n", -+ feature_hwp, feature_hwp_notification, -+ feature_hwp_activity_window, feature_hwp_energy_perf, -+ feature_hwp_pkg_level_ctl, feature_hwp_peci); -+ -+ if ( !feature_hwp ) -+ return false; -+ -+ feature_hdc = eax & CPUID6_EAX_HDC; -+ -+ hwp_verbose("HWP: Hardware Duty Cycling (HDC) %ssupported%s\n", -+ feature_hdc ? "" : "not ", -+ feature_hdc ? opt_cpufreq_hdc ? ", enabled" : ", disabled" -+ : ""); -+ -+ feature_hdc = feature_hdc && opt_cpufreq_hdc; -+ -+ hwp_verbose("HWP: HW_FEEDBACK %ssupported\n", -+ (eax & CPUID6_EAX_HW_FEEDBACK) ? "" : "not "); -+ -+ use_hwp = feature_hwp && opt_cpufreq_hwp; -+ cpufreq_governor_internal = use_hwp; -+ -+ if ( use_hwp ) -+ hwp_info("Using HWP for cpufreq\n"); -+ -+ return use_hwp; -+} -+ -+static void hdc_set_pkg_hdc_ctl(bool val) -+{ -+ uint64_t msr; -+ -+ if ( rdmsr_safe(MSR_IA32_PKG_HDC_CTL, msr) ) -+ { -+ hwp_err("error rdmsr_safe(MSR_IA32_PKG_HDC_CTL)\n"); -+ -+ return; -+ } -+ -+ if ( val ) -+ msr |= IA32_PKG_HDC_CTL_HDC_PKG_ENABLE; -+ else -+ msr &= ~IA32_PKG_HDC_CTL_HDC_PKG_ENABLE; -+ -+ if ( wrmsr_safe(MSR_IA32_PKG_HDC_CTL, msr) ) -+ hwp_err("error wrmsr_safe(MSR_IA32_PKG_HDC_CTL): %016lx\n", msr); -+} -+ -+static void hdc_set_pm_ctl1(bool val) -+{ -+ uint64_t msr; -+ -+ if ( rdmsr_safe(MSR_IA32_PM_CTL1, msr) ) -+ { -+ hwp_err("error rdmsr_safe(MSR_IA32_PM_CTL1)\n"); -+ -+ return; -+ } -+ -+ if ( val ) -+ msr |= IA32_PM_CTL1_HDC_ALLOW_BLOCK; -+ else -+ msr &= ~IA32_PM_CTL1_HDC_ALLOW_BLOCK; -+ -+ if ( wrmsr_safe(MSR_IA32_PM_CTL1, msr) ) -+ hwp_err("error wrmsr_safe(MSR_IA32_PM_CTL1): %016lx\n", msr); -+} -+ -+static void hwp_get_cpu_speeds(struct cpufreq_policy *policy) -+{ -+ uint32_t base_khz, max_khz, bus_khz, edx; -+ -+ cpuid(0x16, &base_khz, &max_khz, &bus_khz, &edx); -+ -+ /* aperf/mperf scales base. */ -+ policy->cpuinfo.perf_freq = base_khz * 1000; -+ policy->cpuinfo.min_freq = base_khz * 1000; -+ policy->cpuinfo.max_freq = max_khz * 1000; -+ policy->min = base_khz * 1000; -+ policy->max = max_khz * 1000; -+ policy->cur = 0; -+} -+ -+static void cf_check hwp_init_msrs(void *info) -+{ -+ struct cpufreq_policy *policy = info; -+ struct hwp_drv_data *data = this_cpu(hwp_drv_data); -+ uint64_t val; -+ -+ /* -+ * Package level MSR, but we don't have a good idea of packages here, so -+ * just do it everytime. -+ */ -+ if ( rdmsr_safe(MSR_IA32_PM_ENABLE, val) ) -+ { -+ hwp_err("CPU%u: error rdmsr_safe(MSR_IA32_PM_ENABLE)\n", policy->cpu); -+ data->curr_req.raw = -1; -+ return; -+ } -+ -+ /* Ensure we don't generate interrupts */ -+ if ( feature_hwp_notification ) -+ wrmsr_safe(MSR_IA32_HWP_INTERRUPT, 0); -+ -+ hwp_verbose("CPU%u: MSR_IA32_PM_ENABLE: %016lx\n", policy->cpu, val); -+ if ( !(val & IA32_PM_ENABLE_HWP_ENABLE) ) -+ { -+ val |= IA32_PM_ENABLE_HWP_ENABLE; -+ if ( wrmsr_safe(MSR_IA32_PM_ENABLE, val) ) -+ { -+ hwp_err("CPU%u: error wrmsr_safe(MSR_IA32_PM_ENABLE, %lx)\n", -+ policy->cpu, val); -+ data->curr_req.raw = -1; -+ return; -+ } -+ } -+ -+ if ( rdmsr_safe(MSR_IA32_HWP_CAPABILITIES, data->hwp_caps) ) -+ { -+ hwp_err("CPU%u: error rdmsr_safe(MSR_IA32_HWP_CAPABILITIES)\n", -+ policy->cpu); -+ data->curr_req.raw = -1; -+ return; -+ } -+ -+ if ( rdmsr_safe(MSR_IA32_HWP_REQUEST, data->curr_req.raw) ) -+ { -+ hwp_err("CPU%u: error rdmsr_safe(MSR_IA32_HWP_REQUEST)\n", policy->cpu); -+ data->curr_req.raw = -1; -+ return; -+ } -+ -+ if ( !feature_hwp_energy_perf ) { -+ if ( rdmsr_safe(MSR_IA32_ENERGY_PERF_BIAS, val) ) -+ { -+ hwp_err("error rdmsr_safe(MSR_IA32_ENERGY_PERF_BIAS)\n"); -+ data->curr_req.raw = -1; -+ -+ return; -+ } -+ -+ data->energy_perf = val & IA32_ENERGY_BIAS_MASK; -+ } -+ -+ /* -+ * Check for APERF/MPERF support in hardware -+ * also check for boost/turbo support -+ */ -+ intel_feature_detect(policy); -+ -+ if ( feature_hdc ) -+ { -+ hdc_set_pkg_hdc_ctl(true); -+ hdc_set_pm_ctl1(true); -+ } -+ -+ hwp_get_cpu_speeds(policy); -+} -+ -+static int cf_check hwp_cpufreq_verify(struct cpufreq_policy *policy) -+{ -+ struct hwp_drv_data *data = per_cpu(hwp_drv_data, policy->cpu); -+ -+ if ( !feature_hwp_energy_perf && data->energy_perf ) -+ { -+ if ( data->energy_perf > IA32_ENERGY_BIAS_MAX_POWERSAVE ) -+ { -+ hwp_err("energy_perf %d exceeds IA32_ENERGY_PERF_BIAS range 0-15\n", -+ data->energy_perf); -+ -+ return -EINVAL; -+ } -+ } -+ -+ if ( !feature_hwp_activity_window && data->activity_window ) -+ { -+ hwp_err("HWP activity window not supported\n"); -+ -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+/* val 0 - highest performance, 15 - maximum energy savings */ -+static void hwp_energy_perf_bias(const struct hwp_drv_data *data) -+{ -+ uint64_t msr; -+ uint8_t val = data->energy_perf; -+ -+ ASSERT(val <= IA32_ENERGY_BIAS_MAX_POWERSAVE); -+ -+ if ( rdmsr_safe(MSR_IA32_ENERGY_PERF_BIAS, msr) ) -+ { -+ hwp_err("error rdmsr_safe(MSR_IA32_ENERGY_PERF_BIAS)\n"); -+ -+ return; -+ } -+ -+ msr &= ~IA32_ENERGY_BIAS_MASK; -+ msr |= val; -+ -+ if ( wrmsr_safe(MSR_IA32_ENERGY_PERF_BIAS, msr) ) -+ hwp_err("error wrmsr_safe(MSR_IA32_ENERGY_PERF_BIAS): %016lx\n", msr); -+} -+ -+static void cf_check hwp_write_request(void *info) -+{ -+ struct cpufreq_policy *policy = info; -+ struct hwp_drv_data *data = this_cpu(hwp_drv_data); -+ union hwp_request hwp_req = data->curr_req; -+ -+ BUILD_BUG_ON(sizeof(union hwp_request) != sizeof(uint64_t)); -+ if ( wrmsr_safe(MSR_IA32_HWP_REQUEST, hwp_req.raw) ) -+ { -+ hwp_err("CPU%u: error wrmsr_safe(MSR_IA32_HWP_REQUEST, %lx)\n", -+ policy->cpu, hwp_req.raw); -+ rdmsr_safe(MSR_IA32_HWP_REQUEST, data->curr_req.raw); -+ } -+ -+ if ( !feature_hwp_energy_perf ) -+ hwp_energy_perf_bias(data); -+ -+} -+ -+static int cf_check hwp_cpufreq_target(struct cpufreq_policy *policy, -+ unsigned int target_freq, -+ unsigned int relation) -+{ -+ unsigned int cpu = policy->cpu; -+ struct hwp_drv_data *data = per_cpu(hwp_drv_data, cpu); -+ /* Zero everything to ensure reserved bits are zero... */ -+ union hwp_request hwp_req = { .raw = 0 }; -+ -+ /* .. and update from there */ -+ hwp_req.min_perf = data->minimum; -+ hwp_req.max_perf = data->maximum; -+ hwp_req.desired = data->desired; -+ if ( feature_hwp_energy_perf ) -+ hwp_req.energy_perf = data->energy_perf; -+ if ( feature_hwp_activity_window ) -+ hwp_req.activity_window = data->activity_window; -+ -+ if ( hwp_req.raw == data->curr_req.raw ) -+ return 0; -+ -+ data->curr_req = hwp_req; -+ -+ hwp_verbose("CPU%u: wrmsr HWP_REQUEST %016lx\n", cpu, hwp_req.raw); -+ on_selected_cpus(cpumask_of(cpu), hwp_write_request, policy, 1); -+ -+ return 0; -+} -+ -+static int cf_check hwp_cpufreq_cpu_init(struct cpufreq_policy *policy) -+{ -+ unsigned int cpu = policy->cpu; -+ struct hwp_drv_data *data; -+ -+ data = xzalloc(struct hwp_drv_data); -+ if ( !data ) -+ return -ENOMEM; -+ -+ if ( cpufreq_opt_governor ) -+ printk(XENLOG_WARNING -+ "HWP: governor \"%s\" is incompatible with hwp. Using default \"%s\"\n", -+ cpufreq_opt_governor->name, hwp_cpufreq_governor.name); -+ policy->governor = &hwp_cpufreq_governor; -+ -+ per_cpu(hwp_drv_data, cpu) = data; -+ -+ on_selected_cpus(cpumask_of(cpu), hwp_init_msrs, policy, 1); -+ -+ if ( data->curr_req.raw == -1 ) -+ { -+ hwp_err("CPU%u: Could not initialize HWP properly\n", cpu); -+ XFREE(per_cpu(hwp_drv_data, cpu)); -+ return -ENODEV; -+ } -+ -+ data->minimum = data->curr_req.min_perf; -+ data->maximum = data->curr_req.max_perf; -+ data->desired = data->curr_req.desired; -+ /* the !feature_hwp_energy_perf case was handled in hwp_init_msrs(). */ -+ if ( feature_hwp_energy_perf ) -+ data->energy_perf = data->curr_req.energy_perf; -+ -+ hwp_verbose("CPU%u: IA32_HWP_CAPABILITIES: %016lx\n", cpu, data->hwp_caps); -+ -+ hwp_verbose("CPU%u: rdmsr HWP_REQUEST %016lx\n", cpu, data->curr_req.raw); -+ -+ return 0; -+} -+ -+static int cf_check hwp_cpufreq_cpu_exit(struct cpufreq_policy *policy) -+{ -+ XFREE(per_cpu(hwp_drv_data, policy->cpu)); -+ -+ return 0; -+} -+ -+/* -+ * The SDM reads like turbo should be disabled with MSR_IA32_PERF_CTL and -+ * PERF_CTL_TURBO_DISENGAGE, but that does not seem to actually work, at least -+ * with my HWP testing. MSR_IA32_MISC_ENABLE and MISC_ENABLE_TURBO_DISENGAGE -+ * is what Linux uses and seems to work. -+ */ -+static void cf_check hwp_set_misc_turbo(void *info) -+{ -+ const struct cpufreq_policy *policy = info; -+ uint64_t msr; -+ -+ if ( rdmsr_safe(MSR_IA32_MISC_ENABLE, msr) ) -+ { -+ hwp_err("CPU%u: error rdmsr_safe(MSR_IA32_MISC_ENABLE)\n", policy->cpu); -+ -+ return; -+ } -+ -+ if ( policy->turbo == CPUFREQ_TURBO_ENABLED ) -+ msr &= ~MSR_IA32_MISC_ENABLE_TURBO_DISENGAGE; -+ else -+ msr |= MSR_IA32_MISC_ENABLE_TURBO_DISENGAGE; -+ -+ if ( wrmsr_safe(MSR_IA32_MISC_ENABLE, msr) ) -+ hwp_err("CPU%u: error wrmsr_safe(MSR_IA32_MISC_ENABLE): %016lx\n", -+ policy->cpu, msr); -+} -+ -+static int cf_check hwp_cpufreq_update(int cpuid, struct cpufreq_policy *policy) -+{ -+ on_selected_cpus(cpumask_of(cpuid), hwp_set_misc_turbo, policy, 1); -+ -+ return 0; -+} -+ -+static const struct cpufreq_driver __initconstrel hwp_cpufreq_driver = -+{ -+ .name = "hwp-cpufreq", -+ .verify = hwp_cpufreq_verify, -+ .target = hwp_cpufreq_target, -+ .init = hwp_cpufreq_cpu_init, -+ .exit = hwp_cpufreq_cpu_exit, -+ .update = hwp_cpufreq_update, -+}; -+ -+int __init hwp_register_driver(void) -+{ -+ return cpufreq_register_driver(&hwp_cpufreq_driver); -+} -diff --git a/xen/arch/x86/include/asm/cpufeature.h b/xen/arch/x86/include/asm/cpufeature.h -index a3ad9ebee4e9..2d5e64ad4a22 100644 ---- a/xen/arch/x86/include/asm/cpufeature.h -+++ b/xen/arch/x86/include/asm/cpufeature.h -@@ -22,8 +22,17 @@ - #define cpu_has(c, bit) test_bit(bit, (c)->x86_capability) - #define boot_cpu_has(bit) test_bit(bit, boot_cpu_data.x86_capability) - --#define CPUID_PM_LEAF 6 --#define CPUID6_ECX_APERFMPERF_CAPABILITY 0x1 -+#define CPUID_PM_LEAF 6 -+#define CPUID6_EAX_HWP (_AC(1, U) << 7) -+#define CPUID6_EAX_HWP_NOTIFICATION (_AC(1, U) << 8) -+#define CPUID6_EAX_HWP_ACTIVITY_WINDOW (_AC(1, U) << 9) -+#define CPUID6_EAX_HWP_ENERGY_PERFORMANCE_PREFERENCE (_AC(1, U) << 10) -+#define CPUID6_EAX_HWP_PACKAGE_LEVEL_REQUEST (_AC(1, U) << 11) -+#define CPUID6_EAX_HDC (_AC(1, U) << 13) -+#define CPUID6_EAX_HWP_PECI (_AC(1, U) << 16) -+#define CPUID6_EAX_HW_FEEDBACK (_AC(1, U) << 19) -+#define CPUID6_ECX_APERFMPERF_CAPABILITY 0x1 -+#define CPUID6_ECX_IA32_ENERGY_PERF_BIAS 0x8 - - /* CPUID level 0x00000001.edx */ - #define cpu_has_fpu 1 -diff --git a/xen/arch/x86/include/asm/msr-index.h b/xen/arch/x86/include/asm/msr-index.h -index 0a8852f3c246..2f626da66335 100644 ---- a/xen/arch/x86/include/asm/msr-index.h -+++ b/xen/arch/x86/include/asm/msr-index.h -@@ -148,6 +148,13 @@ - #define MSR_PL3_SSP 0x000006a7 - #define MSR_INTERRUPT_SSP_TABLE 0x000006a8 - -+#define MSR_IA32_PM_ENABLE 0x00000770 -+#define IA32_PM_ENABLE_HWP_ENABLE (_AC(1, ULL) << 0) -+ -+#define MSR_IA32_HWP_CAPABILITIES 0x00000771 -+#define MSR_IA32_HWP_INTERRUPT 0x00000773 -+#define MSR_IA32_HWP_REQUEST 0x00000774 -+ - #define MSR_X2APIC_FIRST 0x00000800 - #define MSR_X2APIC_LAST 0x000008ff - -@@ -162,6 +169,11 @@ - #define PASID_PASID_MASK 0x000fffff - #define PASID_VALID (_AC(1, ULL) << 31) - -+#define MSR_IA32_PKG_HDC_CTL 0x00000db0 -+#define IA32_PKG_HDC_CTL_HDC_PKG_ENABLE (_AC(1, ULL) << 0) -+#define MSR_IA32_PM_CTL1 0x00000db1 -+#define IA32_PM_CTL1_HDC_ALLOW_BLOCK (_AC(1, ULL) << 0) -+ - #define MSR_UARCH_MISC_CTRL 0x00001b01 - #define UARCH_CTRL_DOITM (_AC(1, ULL) << 0) - -@@ -497,6 +509,7 @@ - #define MSR_IA32_MISC_ENABLE_LIMIT_CPUID (1<<22) - #define MSR_IA32_MISC_ENABLE_XTPR_DISABLE (1<<23) - #define MSR_IA32_MISC_ENABLE_XD_DISABLE (1ULL << 34) -+#define MSR_IA32_MISC_ENABLE_TURBO_DISENGAGE (1ULL << 38) - - #define MSR_IA32_TSC_DEADLINE 0x000006E0 - #define MSR_IA32_ENERGY_PERF_BIAS 0x000001b0 -diff --git a/xen/drivers/cpufreq/cpufreq.c b/xen/drivers/cpufreq/cpufreq.c -index 1fdd63d7b564..634f0a8a499d 100644 ---- a/xen/drivers/cpufreq/cpufreq.c -+++ b/xen/drivers/cpufreq/cpufreq.c -@@ -563,6 +563,38 @@ static void cpufreq_cmdline_common_para(struct cpufreq_policy *new_policy) - - static int __init cpufreq_handle_common_option(const char *name, const char *val) - { -+ if (!strcmp(name, "hdc")) { -+ if (val) { -+ int ret = parse_bool(val, NULL); -+ if (ret != -1) { -+ opt_cpufreq_hdc = ret; -+ return 1; -+ } -+ } else { -+ opt_cpufreq_hdc = true; -+ return 1; -+ } -+ } else if (!strcmp(name, "no-hdc")) { -+ opt_cpufreq_hdc = false; -+ return 1; -+ } -+ -+ if (!strcmp(name, "hwp")) { -+ if (val) { -+ int ret = parse_bool(val, NULL); -+ if (ret != -1) { -+ opt_cpufreq_hwp = ret; -+ return 1; -+ } -+ } else { -+ opt_cpufreq_hwp = true; -+ return 1; -+ } -+ } else if (!strcmp(name, "no-hwp")) { -+ opt_cpufreq_hwp = false; -+ return 1; -+ } -+ - if (!strcmp(name, "maxfreq") && val) { - usr_max_freq = simple_strtoul(val, NULL, 0); - return 1; -diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/cpufreq.h -index 0f334d2a432b..29a712a4f1f3 100644 ---- a/xen/include/acpi/cpufreq/cpufreq.h -+++ b/xen/include/acpi/cpufreq/cpufreq.h -@@ -245,4 +245,7 @@ void cpufreq_dbs_timer_resume(void); - - void intel_feature_detect(struct cpufreq_policy *policy); - -+extern bool opt_cpufreq_hwp; -+extern bool opt_cpufreq_hdc; -+ - #endif /* __XEN_CPUFREQ_PM_H__ */ -diff --git a/xen/include/acpi/cpufreq/processor_perf.h b/xen/include/acpi/cpufreq/processor_perf.h -index d8a1ba68a6bd..b751ca493726 100644 ---- a/xen/include/acpi/cpufreq/processor_perf.h -+++ b/xen/include/acpi/cpufreq/processor_perf.h -@@ -7,6 +7,9 @@ - - #define XEN_PX_INIT 0x80000000 - -+bool hwp_available(void); -+int hwp_register_driver(void); -+ - int powernow_cpufreq_init(void); - unsigned int powernow_register_driver(void); - unsigned int get_measured_perf(unsigned int cpu, unsigned int flag); -diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h -index 001a4de27375..21b0459999f4 100644 ---- a/xen/include/public/sysctl.h -+++ b/xen/include/public/sysctl.h -@@ -292,6 +292,7 @@ struct xen_ondemand { - uint32_t up_threshold; - }; - -+#define XEN_HWP_GOVERNOR "hwp-internal" - /* - * cpufreq para name of this structure named - * same as sysfs file name of native linux --- -2.37.3 - diff --git a/0635-xenpm-Change-get-cpufreq-para-output-for-internal.patch b/0635-xenpm-Change-get-cpufreq-para-output-for-internal.patch deleted file mode 100644 index f6d41bd0..00000000 --- a/0635-xenpm-Change-get-cpufreq-para-output-for-internal.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 7d4a691550b7b19a017bfdb6f98e49a718ed58c2 Mon Sep 17 00:00:00 2001 -From: Jason Andryuk -Date: Wed, 10 Aug 2022 15:29:36 -0400 -Subject: [PATCH 05/13] xenpm: Change get-cpufreq-para output for internal - -When using HWP, some of the returned data is not applicable. In that -case, we should just omit it to avoid confusing the user. So switch to -printing the base and turbo frequencies since those are relevant to HWP. -Similarly, stop printing the CPU frequencies since those do not apply. - -Signed-off-by: Jason Andryuk ---- - tools/misc/xenpm.c | 41 +++++++++++++++++++++++++---------------- - 1 file changed, 25 insertions(+), 16 deletions(-) - -diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c -index 4f8cde690a7c..179f9f1f9660 100644 ---- a/tools/misc/xenpm.c -+++ b/tools/misc/xenpm.c -@@ -711,6 +711,7 @@ void start_gather_func(int argc, char *argv[]) - /* print out parameters about cpu frequency */ - static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq) - { -+ bool internal = strstr(p_cpufreq->scaling_governor, XEN_HWP_GOVERNOR); - int i; - - printf("cpu id : %d\n", cpuid); -@@ -720,10 +721,15 @@ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq) - printf(" %d", p_cpufreq->affected_cpus[i]); - printf("\n"); - -- printf("cpuinfo frequency : max [%u] min [%u] cur [%u]\n", -- p_cpufreq->cpuinfo_max_freq, -- p_cpufreq->cpuinfo_min_freq, -- p_cpufreq->cpuinfo_cur_freq); -+ if ( internal ) -+ printf("cpuinfo frequency : base [%u] turbo [%u]\n", -+ p_cpufreq->cpuinfo_min_freq, -+ p_cpufreq->cpuinfo_max_freq); -+ else -+ printf("cpuinfo frequency : max [%u] min [%u] cur [%u]\n", -+ p_cpufreq->cpuinfo_max_freq, -+ p_cpufreq->cpuinfo_min_freq, -+ p_cpufreq->cpuinfo_cur_freq); - - printf("scaling_driver : %s\n", p_cpufreq->scaling_driver); - -@@ -750,19 +756,22 @@ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq) - p_cpufreq->u.ondemand.up_threshold); - } - -- printf("scaling_avail_freq :"); -- for ( i = 0; i < p_cpufreq->freq_num; i++ ) -- if ( p_cpufreq->scaling_available_frequencies[i] == -- p_cpufreq->scaling_cur_freq ) -- printf(" *%d", p_cpufreq->scaling_available_frequencies[i]); -- else -- printf(" %d", p_cpufreq->scaling_available_frequencies[i]); -- printf("\n"); -+ if ( !internal ) -+ { -+ printf("scaling_avail_freq :"); -+ for ( i = 0; i < p_cpufreq->freq_num; i++ ) -+ if ( p_cpufreq->scaling_available_frequencies[i] == -+ p_cpufreq->scaling_cur_freq ) -+ printf(" *%d", p_cpufreq->scaling_available_frequencies[i]); -+ else -+ printf(" %d", p_cpufreq->scaling_available_frequencies[i]); -+ printf("\n"); - -- printf("scaling frequency : max [%u] min [%u] cur [%u]\n", -- p_cpufreq->scaling_max_freq, -- p_cpufreq->scaling_min_freq, -- p_cpufreq->scaling_cur_freq); -+ printf("scaling frequency : max [%u] min [%u] cur [%u]\n", -+ p_cpufreq->scaling_max_freq, -+ p_cpufreq->scaling_min_freq, -+ p_cpufreq->scaling_cur_freq); -+ } - - printf("turbo mode : %s\n", - p_cpufreq->turbo_enabled ? "enabled" : "disabled or n/a"); --- -2.37.3 - diff --git a/0636-cpufreq-Export-HWP-parameters-to-userspace.patch b/0636-cpufreq-Export-HWP-parameters-to-userspace.patch deleted file mode 100644 index f504661d..00000000 --- a/0636-cpufreq-Export-HWP-parameters-to-userspace.patch +++ /dev/null @@ -1,135 +0,0 @@ -From 7ad14846665ff309e5b431fc2d9716091b1916ce Mon Sep 17 00:00:00 2001 -From: Jason Andryuk -Date: Wed, 10 Aug 2022 15:29:37 -0400 -Subject: [PATCH 06/13] cpufreq: Export HWP parameters to userspace - -Extend xen_get_cpufreq_para to return hwp parameters. These match the -hardware rather closely. - -We need the features bitmask to indicated fields supported by the actual -hardware. - -The use of uint8_t parameters matches the hardware size. uint32_t -entries grows the sysctl_t past the build assertion in setup.c. The -uint8_t ranges are supported across multiple generations, so hopefully -they won't change. - -Signed-off-by: Jason Andryuk ---- - xen/arch/x86/acpi/cpufreq/hwp.c | 25 +++++++++++++++++++++++++ - xen/drivers/acpi/pmstat.c | 5 +++++ - xen/include/acpi/cpufreq/cpufreq.h | 2 ++ - xen/include/public/sysctl.h | 26 ++++++++++++++++++++++++++ - 4 files changed, 58 insertions(+) - -diff --git a/xen/arch/x86/acpi/cpufreq/hwp.c b/xen/arch/x86/acpi/cpufreq/hwp.c -index ee9daa63ab55..bba83d76db24 100644 ---- a/xen/arch/x86/acpi/cpufreq/hwp.c -+++ b/xen/arch/x86/acpi/cpufreq/hwp.c -@@ -500,6 +500,31 @@ static const struct cpufreq_driver __initconstrel hwp_cpufreq_driver = - .update = hwp_cpufreq_update, - }; - -+int get_hwp_para(const struct cpufreq_policy *policy, -+ struct xen_hwp_para *hwp_para) -+{ -+ unsigned int cpu = policy->cpu; -+ const struct hwp_drv_data *data = per_cpu(hwp_drv_data, cpu); -+ -+ if ( data == NULL ) -+ return -EINVAL; -+ -+ hwp_para->features = -+ (feature_hwp_activity_window ? XEN_SYSCTL_HWP_FEAT_ACT_WINDOW : 0) | -+ (feature_hwp_energy_perf ? XEN_SYSCTL_HWP_FEAT_ENERGY_PERF : 0); -+ hwp_para->lowest = data->hw.lowest; -+ hwp_para->most_efficient = data->hw.most_efficient; -+ hwp_para->guaranteed = data->hw.guaranteed; -+ hwp_para->highest = data->hw.highest; -+ hwp_para->minimum = data->minimum; -+ hwp_para->maximum = data->maximum; -+ hwp_para->energy_perf = data->energy_perf; -+ hwp_para->activity_window = data->activity_window; -+ hwp_para->desired = data->desired; -+ -+ return 0; -+} -+ - int __init hwp_register_driver(void) - { - return cpufreq_register_driver(&hwp_cpufreq_driver); -diff --git a/xen/drivers/acpi/pmstat.c b/xen/drivers/acpi/pmstat.c -index 1bae6351019b..67fd9dabd47e 100644 ---- a/xen/drivers/acpi/pmstat.c -+++ b/xen/drivers/acpi/pmstat.c -@@ -290,6 +290,11 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op) - &op->u.get_para.u.ondemand.sampling_rate, - &op->u.get_para.u.ondemand.up_threshold); - } -+ -+ if ( !strncasecmp(op->u.get_para.scaling_governor, XEN_HWP_GOVERNOR, -+ CPUFREQ_NAME_LEN) ) -+ ret = get_hwp_para(policy, &op->u.get_para.u.hwp_para); -+ - op->u.get_para.turbo_enabled = cpufreq_get_turbo_status(op->cpuid); - - return ret; -diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/cpufreq.h -index 29a712a4f1f3..92b4c7e79c5c 100644 ---- a/xen/include/acpi/cpufreq/cpufreq.h -+++ b/xen/include/acpi/cpufreq/cpufreq.h -@@ -247,5 +247,7 @@ void intel_feature_detect(struct cpufreq_policy *policy); - - extern bool opt_cpufreq_hwp; - extern bool opt_cpufreq_hdc; -+int get_hwp_para(const struct cpufreq_policy *policy, -+ struct xen_hwp_para *hwp_para); - - #endif /* __XEN_CPUFREQ_PM_H__ */ -diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h -index 21b0459999f4..b69bfdaa2a68 100644 ---- a/xen/include/public/sysctl.h -+++ b/xen/include/public/sysctl.h -@@ -292,6 +292,31 @@ struct xen_ondemand { - uint32_t up_threshold; - }; - -+struct xen_hwp_para { -+ /* -+ * bits 6:0 - 7bit mantissa -+ * bits 9:7 - 3bit base-10 exponent -+ * btis 15:10 - Unused - must be 0 -+ */ -+#define HWP_ACT_WINDOW_MANTISSA_MASK 0x7f -+#define HWP_ACT_WINDOW_EXPONENT_MASK 0x7 -+#define HWP_ACT_WINDOW_EXPONENT_SHIFT 7 -+ uint16_t activity_window; -+ /* energy_perf range 0-255 if 1. Otherwise 0-15 */ -+#define XEN_SYSCTL_HWP_FEAT_ENERGY_PERF (1 << 0) -+ /* activity_window supported if 1 */ -+#define XEN_SYSCTL_HWP_FEAT_ACT_WINDOW (1 << 1) -+ uint8_t features; /* bit flags for features */ -+ uint8_t lowest; -+ uint8_t most_efficient; -+ uint8_t guaranteed; -+ uint8_t highest; -+ uint8_t minimum; -+ uint8_t maximum; -+ uint8_t desired; -+ uint8_t energy_perf; -+}; -+ - #define XEN_HWP_GOVERNOR "hwp-internal" - /* - * cpufreq para name of this structure named -@@ -324,6 +349,7 @@ struct xen_get_cpufreq_para { - union { - struct xen_userspace userspace; - struct xen_ondemand ondemand; -+ struct xen_hwp_para hwp_para; - } u; - - int32_t turbo_enabled; --- -2.37.3 - diff --git a/0637-libxc-Include-hwp_para-in-definitions.patch b/0637-libxc-Include-hwp_para-in-definitions.patch deleted file mode 100644 index 34da89ba..00000000 --- a/0637-libxc-Include-hwp_para-in-definitions.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 640193925ca912f7ff090bbfbc8448df225cbf5a Mon Sep 17 00:00:00 2001 -From: Jason Andryuk -Date: Wed, 10 Aug 2022 15:29:38 -0400 -Subject: [PATCH 07/13] libxc: Include hwp_para in definitions - -Expose the hwp_para fields through libxc. - -Signed-off-by: Jason Andryuk ---- - tools/include/xenctrl.h | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h -index 23037874d3d5..9d50947530ac 100644 ---- a/tools/include/xenctrl.h -+++ b/tools/include/xenctrl.h -@@ -1903,6 +1903,7 @@ int xc_smt_disable(xc_interface *xch); - */ - typedef struct xen_userspace xc_userspace_t; - typedef struct xen_ondemand xc_ondemand_t; -+typedef struct xen_hwp_para xc_hwp_para_t; - - struct xc_get_cpufreq_para { - /* IN/OUT variable */ -@@ -1930,6 +1931,7 @@ struct xc_get_cpufreq_para { - union { - xc_userspace_t userspace; - xc_ondemand_t ondemand; -+ xc_hwp_para_t hwp_para; - } u; - - int32_t turbo_enabled; --- -2.37.3 - diff --git a/0638-xenpm-Print-HWP-parameters.patch b/0638-xenpm-Print-HWP-parameters.patch deleted file mode 100644 index 21b5316e..00000000 --- a/0638-xenpm-Print-HWP-parameters.patch +++ /dev/null @@ -1,99 +0,0 @@ -From bda99b74b8de06367bb4ad98d93a3d813a4f0ba2 Mon Sep 17 00:00:00 2001 -From: Jason Andryuk -Date: Wed, 10 Aug 2022 15:29:39 -0400 -Subject: [PATCH 08/13] xenpm: Print HWP parameters - -Print HWP-specific parameters. Some are always present, but others -depend on hardware support. - -Signed-off-by: Jason Andryuk ---- - tools/misc/xenpm.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 65 insertions(+) - -diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c -index 179f9f1f9660..610a516213b3 100644 ---- a/tools/misc/xenpm.c -+++ b/tools/misc/xenpm.c -@@ -708,6 +708,44 @@ void start_gather_func(int argc, char *argv[]) - pause(); - } - -+static void calculate_hwp_activity_window(const xc_hwp_para_t *hwp, -+ unsigned int *activity_window, -+ const char **units) -+{ -+ unsigned int mantissa = hwp->activity_window & HWP_ACT_WINDOW_MANTISSA_MASK; -+ unsigned int exponent = -+ (hwp->activity_window >> HWP_ACT_WINDOW_EXPONENT_SHIFT) & -+ HWP_ACT_WINDOW_EXPONENT_MASK; -+ unsigned int multiplier = 1; -+ unsigned int i; -+ -+ if ( hwp->activity_window == 0 ) -+ { -+ *units = "hardware selected"; -+ *activity_window = 0; -+ -+ return; -+ } -+ -+ if ( exponent >= 6 ) -+ { -+ *units = "s"; -+ exponent -= 6; -+ } -+ else if ( exponent >= 3 ) -+ { -+ *units = "ms"; -+ exponent -= 3; -+ } -+ else -+ *units = "us"; -+ -+ for ( i = 0; i < exponent; i++ ) -+ multiplier *= 10; -+ -+ *activity_window = mantissa * multiplier; -+} -+ - /* print out parameters about cpu frequency */ - static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq) - { -@@ -773,6 +811,33 @@ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq) - p_cpufreq->scaling_cur_freq); - } - -+ if ( strcmp(p_cpufreq->scaling_governor, XEN_HWP_GOVERNOR) == 0 ) -+ { -+ const xc_hwp_para_t *hwp = &p_cpufreq->u.hwp_para; -+ -+ printf("hwp variables :\n"); -+ printf(" hardware limits : lowest [%u] most_efficient [%u]\n", -+ hwp->lowest, hwp->most_efficient); -+ printf(" : guaranteed [%u] highest [%u]\n", -+ hwp->guaranteed, hwp->highest); -+ printf(" configured limits : min [%u] max [%u] energy_perf [%u]\n", -+ hwp->minimum, hwp->maximum, hwp->energy_perf); -+ -+ if ( hwp->features & XEN_SYSCTL_HWP_FEAT_ACT_WINDOW ) -+ { -+ unsigned int activity_window; -+ const char *units; -+ -+ calculate_hwp_activity_window(hwp, &activity_window, &units); -+ printf(" : activity_window [%u %s]\n", -+ activity_window, units); -+ } -+ -+ printf(" : desired [%u%s]\n", -+ hwp->desired, -+ hwp->desired ? "" : " hw autonomous"); -+ } -+ - printf("turbo mode : %s\n", - p_cpufreq->turbo_enabled ? "enabled" : "disabled or n/a"); - printf("\n"); --- -2.37.3 - diff --git a/0639-xen-Add-SET_CPUFREQ_HWP-xen_sysctl_pm_op.patch b/0639-xen-Add-SET_CPUFREQ_HWP-xen_sysctl_pm_op.patch deleted file mode 100644 index d49e0fa6..00000000 --- a/0639-xen-Add-SET_CPUFREQ_HWP-xen_sysctl_pm_op.patch +++ /dev/null @@ -1,255 +0,0 @@ -From a2e17e712dd51a8d7d83875181ef55ff21b97aca Mon Sep 17 00:00:00 2001 -From: Jason Andryuk -Date: Wed, 10 Aug 2022 15:29:40 -0400 -Subject: [PATCH 09/13] xen: Add SET_CPUFREQ_HWP xen_sysctl_pm_op - -Add SET_CPUFREQ_HWP xen_sysctl_pm_op to set HWP parameters. The sysctl -supports setting multiple values simultaneously as indicated by the -set_params bits. This allows atomically applying new HWP configuration -via a single wrmsr. - -XEN_SYSCTL_HWP_SET_PRESET_BALANCE/PERFORMANCE/POWERSAVE provide three -common presets. Setting them depends on hardware limits which the -hypervisor is already caching. So using them allows skipping a -hypercall to query the limits (lowest/highest) to then set those same -values. The code is organized to allow a preset to be refined with -additional stuff if desired. - -"most_efficient" and "guaranteed" could be additional presets in the -future, but the are not added now. Those levels can change at runtime, -but we don't have code in place to monitor and update for those events. - -Signed-off-by: Jason Andryuk ---- - xen/arch/x86/acpi/cpufreq/hwp.c | 96 ++++++++++++++++++++++++++++++ - xen/drivers/acpi/pmstat.c | 23 +++++++ - xen/include/acpi/cpufreq/cpufreq.h | 2 + - xen/include/public/sysctl.h | 30 ++++++++++ - 4 files changed, 151 insertions(+) - -diff --git a/xen/arch/x86/acpi/cpufreq/hwp.c b/xen/arch/x86/acpi/cpufreq/hwp.c -index bba83d76db24..ef640ef5eaf0 100644 ---- a/xen/arch/x86/acpi/cpufreq/hwp.c -+++ b/xen/arch/x86/acpi/cpufreq/hwp.c -@@ -25,7 +25,9 @@ static bool feature_hdc; - __initdata bool opt_cpufreq_hwp = false; - __initdata bool opt_cpufreq_hdc = true; - -+#define HWP_ENERGY_PERF_MAX_PERFORMANCE 0 - #define HWP_ENERGY_PERF_BALANCE 0x80 -+#define HWP_ENERGY_PERF_MAX_POWERSAVE 0xff - #define IA32_ENERGY_BIAS_BALANCE 0x7 - #define IA32_ENERGY_BIAS_MAX_POWERSAVE 0xf - #define IA32_ENERGY_BIAS_MASK 0xf -@@ -525,6 +527,100 @@ int get_hwp_para(const struct cpufreq_policy *policy, - return 0; - } - -+int set_hwp_para(struct cpufreq_policy *policy, -+ struct xen_set_hwp_para *set_hwp) -+{ -+ unsigned int cpu = policy->cpu; -+ struct hwp_drv_data *data = per_cpu(hwp_drv_data, cpu); -+ -+ if ( data == NULL ) -+ return -EINVAL; -+ -+ /* Validate all parameters first */ -+ if ( set_hwp->set_params & ~XEN_SYSCTL_HWP_SET_PARAM_MASK ) -+ return -EINVAL; -+ -+ if ( set_hwp->activity_window & ~XEN_SYSCTL_HWP_ACT_WINDOW_MASK ) -+ return -EINVAL; -+ -+ if ( !feature_hwp_energy_perf && -+ (set_hwp->set_params & XEN_SYSCTL_HWP_SET_ENERGY_PERF) && -+ set_hwp->energy_perf > IA32_ENERGY_BIAS_MAX_POWERSAVE ) -+ return -EINVAL; -+ -+ if ( (set_hwp->set_params & XEN_SYSCTL_HWP_SET_DESIRED) && -+ set_hwp->desired != 0 && -+ (set_hwp->desired < data->hw.lowest || -+ set_hwp->desired > data->hw.highest) ) -+ return -EINVAL; -+ -+ /* -+ * minimum & maximum are not validated as hardware doesn't seem to care -+ * and the SDM says CPUs will clip internally. -+ */ -+ -+ /* Apply presets */ -+ switch ( set_hwp->set_params & XEN_SYSCTL_HWP_SET_PRESET_MASK ) -+ { -+ case XEN_SYSCTL_HWP_SET_PRESET_POWERSAVE: -+ data->minimum = data->hw.lowest; -+ data->maximum = data->hw.lowest; -+ data->activity_window = 0; -+ if ( feature_hwp_energy_perf ) -+ data->energy_perf = HWP_ENERGY_PERF_MAX_POWERSAVE; -+ else -+ data->energy_perf = IA32_ENERGY_BIAS_MAX_POWERSAVE; -+ data->desired = 0; -+ break; -+ -+ case XEN_SYSCTL_HWP_SET_PRESET_PERFORMANCE: -+ data->minimum = data->hw.highest; -+ data->maximum = data->hw.highest; -+ data->activity_window = 0; -+ data->energy_perf = HWP_ENERGY_PERF_MAX_PERFORMANCE; -+ data->desired = 0; -+ break; -+ -+ case XEN_SYSCTL_HWP_SET_PRESET_BALANCE: -+ data->minimum = data->hw.lowest; -+ data->maximum = data->hw.highest; -+ data->activity_window = 0; -+ if ( feature_hwp_energy_perf ) -+ data->energy_perf = HWP_ENERGY_PERF_BALANCE; -+ else -+ data->energy_perf = IA32_ENERGY_BIAS_BALANCE; -+ data->desired = 0; -+ break; -+ -+ case XEN_SYSCTL_HWP_SET_PRESET_NONE: -+ break; -+ -+ default: -+ return -EINVAL; -+ } -+ -+ /* Further customize presets if needed */ -+ if ( set_hwp->set_params & XEN_SYSCTL_HWP_SET_MINIMUM ) -+ data->minimum = set_hwp->minimum; -+ -+ if ( set_hwp->set_params & XEN_SYSCTL_HWP_SET_MAXIMUM ) -+ data->maximum = set_hwp->maximum; -+ -+ if ( set_hwp->set_params & XEN_SYSCTL_HWP_SET_ENERGY_PERF ) -+ data->energy_perf = set_hwp->energy_perf; -+ -+ if ( set_hwp->set_params & XEN_SYSCTL_HWP_SET_DESIRED ) -+ data->desired = set_hwp->desired; -+ -+ if ( set_hwp->set_params & XEN_SYSCTL_HWP_SET_ACT_WINDOW ) -+ data->activity_window = set_hwp->activity_window & -+ XEN_SYSCTL_HWP_ACT_WINDOW_MASK; -+ -+ hwp_cpufreq_target(policy, 0, 0); -+ -+ return 0; -+} -+ - int __init hwp_register_driver(void) - { - return cpufreq_register_driver(&hwp_cpufreq_driver); -diff --git a/xen/drivers/acpi/pmstat.c b/xen/drivers/acpi/pmstat.c -index 67fd9dabd47e..55e2b285b56e 100644 ---- a/xen/drivers/acpi/pmstat.c -+++ b/xen/drivers/acpi/pmstat.c -@@ -398,6 +398,25 @@ static int set_cpufreq_para(struct xen_sysctl_pm_op *op) - return ret; - } - -+static int set_cpufreq_hwp(struct xen_sysctl_pm_op *op) -+{ -+ struct cpufreq_policy *policy; -+ -+ if ( !cpufreq_governor_internal ) -+ return -EINVAL; -+ -+ policy = per_cpu(cpufreq_cpu_policy, op->cpuid); -+ -+ if ( !policy || !policy->governor ) -+ return -EINVAL; -+ -+ if ( strncasecmp(policy->governor->name, XEN_HWP_GOVERNOR, -+ CPUFREQ_NAME_LEN) ) -+ return -EINVAL; -+ -+ return set_hwp_para(policy, &op->u.set_hwp); -+} -+ - int do_pm_op(struct xen_sysctl_pm_op *op) - { - int ret = 0; -@@ -470,6 +489,10 @@ int do_pm_op(struct xen_sysctl_pm_op *op) - break; - } - -+ case SET_CPUFREQ_HWP: -+ ret = set_cpufreq_hwp(op); -+ break; -+ - case GET_CPUFREQ_AVGFREQ: - { - op->u.get_avgfreq = cpufreq_driver_getavg(op->cpuid, USR_GETAVG); -diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/cpufreq.h -index 92b4c7e79c5c..b8831b2cd390 100644 ---- a/xen/include/acpi/cpufreq/cpufreq.h -+++ b/xen/include/acpi/cpufreq/cpufreq.h -@@ -249,5 +249,7 @@ extern bool opt_cpufreq_hwp; - extern bool opt_cpufreq_hdc; - int get_hwp_para(const struct cpufreq_policy *policy, - struct xen_hwp_para *hwp_para); -+int set_hwp_para(struct cpufreq_policy *policy, -+ struct xen_set_hwp_para *set_hwp); - - #endif /* __XEN_CPUFREQ_PM_H__ */ -diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h -index b69bfdaa2a68..83a6ea5a047b 100644 ---- a/xen/include/public/sysctl.h -+++ b/xen/include/public/sysctl.h -@@ -317,6 +317,34 @@ struct xen_hwp_para { - uint8_t energy_perf; - }; - -+/* set multiple values simultaneously when set_args bit is set */ -+struct xen_set_hwp_para { -+#define XEN_SYSCTL_HWP_SET_DESIRED (1U << 0) -+#define XEN_SYSCTL_HWP_SET_ENERGY_PERF (1U << 1) -+#define XEN_SYSCTL_HWP_SET_ACT_WINDOW (1U << 2) -+#define XEN_SYSCTL_HWP_SET_MINIMUM (1U << 3) -+#define XEN_SYSCTL_HWP_SET_MAXIMUM (1U << 4) -+#define XEN_SYSCTL_HWP_SET_PRESET_MASK 0xf000 -+#define XEN_SYSCTL_HWP_SET_PRESET_NONE 0x0000 -+#define XEN_SYSCTL_HWP_SET_PRESET_BALANCE 0x1000 -+#define XEN_SYSCTL_HWP_SET_PRESET_POWERSAVE 0x2000 -+#define XEN_SYSCTL_HWP_SET_PRESET_PERFORMANCE 0x3000 -+#define XEN_SYSCTL_HWP_SET_PARAM_MASK ( \ -+ XEN_SYSCTL_HWP_SET_PRESET_MASK | \ -+ XEN_SYSCTL_HWP_SET_DESIRED | \ -+ XEN_SYSCTL_HWP_SET_ENERGY_PERF | \ -+ XEN_SYSCTL_HWP_SET_ACT_WINDOW | \ -+ XEN_SYSCTL_HWP_SET_MINIMUM | \ -+ XEN_SYSCTL_HWP_SET_MAXIMUM ) -+ uint16_t set_params; /* bitflags for valid values */ -+#define XEN_SYSCTL_HWP_ACT_WINDOW_MASK 0x03ff -+ uint16_t activity_window; /* See comment in struct xen_hwp_para */ -+ uint8_t minimum; -+ uint8_t maximum; -+ uint8_t desired; -+ uint8_t energy_perf; /* 0-255 or 0-15 depending on HW support */ -+}; -+ - #define XEN_HWP_GOVERNOR "hwp-internal" - /* - * cpufreq para name of this structure named -@@ -379,6 +407,7 @@ struct xen_sysctl_pm_op { - #define SET_CPUFREQ_GOV (CPUFREQ_PARA | 0x02) - #define SET_CPUFREQ_PARA (CPUFREQ_PARA | 0x03) - #define GET_CPUFREQ_AVGFREQ (CPUFREQ_PARA | 0x04) -+ #define SET_CPUFREQ_HWP (CPUFREQ_PARA | 0x05) - - /* set/reset scheduler power saving option */ - #define XEN_SYSCTL_pm_op_set_sched_opt_smt 0x21 -@@ -405,6 +434,7 @@ struct xen_sysctl_pm_op { - struct xen_get_cpufreq_para get_para; - struct xen_set_cpufreq_gov set_gov; - struct xen_set_cpufreq_para set_para; -+ struct xen_set_hwp_para set_hwp; - uint64_aligned_t get_avgfreq; - uint32_t set_sched_opt_smt; - #define XEN_SYSCTL_CX_UNLIMITED 0xffffffff --- -2.37.3 - diff --git a/0640-libxc-Add-xc_set_cpufreq_hwp.patch b/0640-libxc-Add-xc_set_cpufreq_hwp.patch deleted file mode 100644 index a88629bf..00000000 --- a/0640-libxc-Add-xc_set_cpufreq_hwp.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 3ff9dbb055b3f6fc9e9cb0ad04996af20f45e50e Mon Sep 17 00:00:00 2001 -From: Jason Andryuk -Date: Wed, 10 Aug 2022 15:29:41 -0400 -Subject: [PATCH 10/13] libxc: Add xc_set_cpufreq_hwp - -Add xc_set_cpufreq_hwp to allow calling xen_systctl_pm_op -SET_CPUFREQ_HWP. - -Signed-off-by: Jason Andryuk ---- - tools/include/xenctrl.h | 4 ++++ - tools/libs/ctrl/xc_pm.c | 18 ++++++++++++++++++ - 2 files changed, 22 insertions(+) - -diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h -index 9d50947530ac..8ba9d27c7a80 100644 ---- a/tools/include/xenctrl.h -+++ b/tools/include/xenctrl.h -@@ -1937,11 +1937,15 @@ struct xc_get_cpufreq_para { - int32_t turbo_enabled; - }; - -+typedef struct xen_set_hwp_para xc_set_hwp_para_t; -+ - int xc_get_cpufreq_para(xc_interface *xch, int cpuid, - struct xc_get_cpufreq_para *user_para); - int xc_set_cpufreq_gov(xc_interface *xch, int cpuid, char *govname); - int xc_set_cpufreq_para(xc_interface *xch, int cpuid, - int ctrl_type, int ctrl_value); -+int xc_set_cpufreq_hwp(xc_interface *xch, int cpuid, -+ const xc_set_hwp_para_t *set_hwp); - int xc_get_cpufreq_avgfreq(xc_interface *xch, int cpuid, int *avg_freq); - - int xc_set_sched_opt_smt(xc_interface *xch, uint32_t value); -diff --git a/tools/libs/ctrl/xc_pm.c b/tools/libs/ctrl/xc_pm.c -index 76d7eb7f265d..87c636f8208f 100644 ---- a/tools/libs/ctrl/xc_pm.c -+++ b/tools/libs/ctrl/xc_pm.c -@@ -330,6 +330,24 @@ int xc_set_cpufreq_para(xc_interface *xch, int cpuid, - return xc_sysctl(xch, &sysctl); - } - -+int xc_set_cpufreq_hwp(xc_interface *xch, int cpuid, -+ const xc_set_hwp_para_t *set_hwp) -+{ -+ DECLARE_SYSCTL; -+ -+ if ( !xch ) -+ { -+ errno = EINVAL; -+ return -1; -+ } -+ sysctl.cmd = XEN_SYSCTL_pm_op; -+ sysctl.u.pm_op.cmd = SET_CPUFREQ_HWP; -+ sysctl.u.pm_op.cpuid = cpuid; -+ sysctl.u.pm_op.u.set_hwp = *set_hwp; -+ -+ return xc_sysctl(xch, &sysctl); -+} -+ - int xc_get_cpufreq_avgfreq(xc_interface *xch, int cpuid, int *avg_freq) - { - int ret = 0; --- -2.37.3 - diff --git a/0642-xenpm-Add-set-cpufreq-hwp-subcommand.patch b/0642-xenpm-Add-set-cpufreq-hwp-subcommand.patch deleted file mode 100644 index 57b99d6b..00000000 --- a/0642-xenpm-Add-set-cpufreq-hwp-subcommand.patch +++ /dev/null @@ -1,287 +0,0 @@ -From 94dd4d4b3fc357ede4d9e462e5daf8d98f26217a Mon Sep 17 00:00:00 2001 -From: Jason Andryuk -Date: Wed, 10 Aug 2022 15:29:43 -0400 -Subject: [PATCH 12/13] xenpm: Add set-cpufreq-hwp subcommand - -set-cpufreq-hwp allows setting the Hardware P-State (HWP) parameters. - -It can be run on all or just a single cpu. There are presets of -balance, powersave & performance. Those can be further tweaked by -param:val arguments as explained in the usage description. - -Parameter names are just checked to the first 3 characters to shorten -typing. - -Some options are hardware dependent, and ranges can be found in -get-cpufreq-para. - -Signed-off-by: Jason Andryuk ---- - tools/misc/xenpm.c | 230 +++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 230 insertions(+) - -diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c -index 5b28e2f6ddf5..c66ba7c95960 100644 ---- a/tools/misc/xenpm.c -+++ b/tools/misc/xenpm.c -@@ -16,6 +16,7 @@ - */ - #define MAX_NR_CPU 512 - -+#include - #include - #include - #include -@@ -67,6 +68,27 @@ void show_help(void) - " set-max-cstate |'unlimited' [|'unlimited']\n" - " set the C-State limitation ( >= 0) and\n" - " optionally the C-sub-state limitation ( >= 0)\n" -+ " set-cpufreq-hwp [cpuid] [balance|performance|powersave] *\n" -+ " set Hardware P-State (HWP) parameters\n" -+ " optionally a preset of one of\n" -+ " balance|performance|powersave\n" -+ " an optional list of param:val arguments\n" -+ " minimum:N lowest ... highest\n" -+ " maximum:N lowest ... highest\n" -+ " desired:N lowest ... highest\n" -+ " Set explicit performance target.\n" -+ " non-zero disables auto-HWP mode.\n" -+ " energy-perf:0-255 (or 0-15)\n" -+ " energy/performance hint\n" -+ " lower - favor performance\n" -+ " higher - favor powersave\n" -+ " 128 (or 7) - balance\n" -+ " act-window:N{,m,u}s range 1us-1270s\n" -+ " window for internal calculations.\n" -+ " Defaults to us without units.\n" -+ " Truncates un-representable values.\n" -+ " 0 lets the hardware decide.\n" -+ " get-cpufreq-para returns lowest/highest.\n" - " start [seconds] start collect Cx/Px statistics,\n" - " output after CTRL-C or SIGINT or several seconds.\n" - " enable-turbo-mode [cpuid] enable Turbo Mode for processors that support it.\n" -@@ -1299,6 +1321,213 @@ void disable_turbo_mode(int argc, char *argv[]) - errno, strerror(errno)); - } - -+/* -+ * Parse activity_window:NNN{us,ms,s} and validate range. -+ * -+ * Activity window is a 7bit mantissa (0-127) with a 3bit exponent (0-7) base -+ * 10 in microseconds. So the range is 1 microsecond to 1270 seconds. A value -+ * of 0 lets the hardware autonomously select the window. -+ * -+ * Return 0 on success -+ * -1 on error -+ */ -+static int parse_activity_window(xc_set_hwp_para_t *set_hwp, unsigned long u, -+ const char *suffix) -+{ -+ unsigned int exponent = 0; -+ unsigned int multiplier = 1; -+ -+ if ( suffix && suffix[0] ) -+ { -+ if ( strcasecmp(suffix, "s") == 0 ) -+ { -+ multiplier = 1000 * 1000; -+ exponent = 6; -+ } -+ else if ( strcasecmp(suffix, "ms") == 0 ) -+ { -+ multiplier = 1000; -+ exponent = 3; -+ } -+ else if ( strcasecmp(suffix, "us") == 0 ) -+ { -+ multiplier = 1; -+ exponent = 0; -+ } -+ else -+ { -+ fprintf(stderr, "invalid activity window units: \"%s\"\n", suffix); -+ -+ return -1; -+ } -+ } -+ -+ /* u * multipler > 1270 * 1000 * 1000 transformed to avoid overflow. */ -+ if ( u > 1270 * 1000 * 1000 / multiplier ) -+ { -+ fprintf(stderr, "activity window is too large\n"); -+ -+ return -1; -+ } -+ -+ /* looking for 7 bits of mantissa and 3 bits of exponent */ -+ while ( u > 127 ) -+ { -+ u += 5; /* Round up to mitigate truncation rounding down -+ e.g. 128 -> 120 vs 128 -> 130. */ -+ u /= 10; -+ exponent += 1; -+ } -+ -+ set_hwp->activity_window = (exponent & HWP_ACT_WINDOW_EXPONENT_MASK) << -+ HWP_ACT_WINDOW_EXPONENT_SHIFT | -+ (u & HWP_ACT_WINDOW_MANTISSA_MASK); -+ set_hwp->set_params |= XEN_SYSCTL_HWP_SET_ACT_WINDOW; -+ -+ return 0; -+} -+ -+static int parse_hwp_opts(xc_set_hwp_para_t *set_hwp, int *cpuid, -+ int argc, char *argv[]) -+{ -+ int i = 0; -+ -+ if ( argc < 1 ) { -+ fprintf(stderr, "Missing arguments\n"); -+ return -1; -+ } -+ -+ if ( parse_cpuid_non_fatal(argv[i], cpuid) == 0 ) -+ { -+ i++; -+ } -+ -+ if ( i == argc ) { -+ fprintf(stderr, "Missing arguments\n"); -+ return -1; -+ } -+ -+ if ( strcasecmp(argv[i], "powersave") == 0 ) -+ { -+ set_hwp->set_params = XEN_SYSCTL_HWP_SET_PRESET_POWERSAVE; -+ i++; -+ } -+ else if ( strcasecmp(argv[i], "performance") == 0 ) -+ { -+ set_hwp->set_params = XEN_SYSCTL_HWP_SET_PRESET_PERFORMANCE; -+ i++; -+ } -+ else if ( strcasecmp(argv[i], "balance") == 0 ) -+ { -+ set_hwp->set_params = XEN_SYSCTL_HWP_SET_PRESET_BALANCE; -+ i++; -+ } -+ -+ for ( ; i < argc; i++) -+ { -+ unsigned long val; -+ char *param = argv[i]; -+ char *value; -+ char *suffix; -+ int ret; -+ -+ value = strchr(param, ':'); -+ if ( value == NULL ) -+ { -+ fprintf(stderr, "\"%s\" is an invalid hwp parameter\n", argv[i]); -+ return -1; -+ } -+ -+ value[0] = '\0'; -+ value++; -+ -+ errno = 0; -+ val = strtoul(value, &suffix, 10); -+ if ( (errno && val == ULONG_MAX) || value == suffix ) -+ { -+ fprintf(stderr, "Could not parse number \"%s\"\n", value); -+ return -1; -+ } -+ -+ if ( strncasecmp(param, "act-window", strlen(param)) == 0 ) -+ { -+ ret = parse_activity_window(set_hwp, val, suffix); -+ if (ret) -+ return -1; -+ -+ continue; -+ } -+ -+ if ( val > 255 ) -+ { -+ fprintf(stderr, "\"%s\" value \"%lu\" is out of range\n", param, -+ val); -+ return -1; -+ } -+ -+ if ( suffix && suffix[0] ) -+ { -+ fprintf(stderr, "Suffix \"%s\" is invalid\n", suffix); -+ return -1; -+ } -+ -+ if ( strncasecmp(param, "minimum", MAX(2, strlen(param))) == 0 ) -+ { -+ set_hwp->minimum = val; -+ set_hwp->set_params |= XEN_SYSCTL_HWP_SET_MINIMUM; -+ } -+ else if ( strncasecmp(param, "maximum", MAX(2, strlen(param))) == 0 ) -+ { -+ set_hwp->maximum = val; -+ set_hwp->set_params |= XEN_SYSCTL_HWP_SET_MAXIMUM; -+ } -+ else if ( strncasecmp(param, "desired", strlen(param)) == 0 ) -+ { -+ set_hwp->desired = val; -+ set_hwp->set_params |= XEN_SYSCTL_HWP_SET_DESIRED; -+ } -+ else if ( strncasecmp(param, "energy-perf", strlen(param)) == 0 ) -+ { -+ set_hwp->energy_perf = val; -+ set_hwp->set_params |= XEN_SYSCTL_HWP_SET_ENERGY_PERF; -+ } -+ else -+ { -+ fprintf(stderr, "\"%s\" is an invalid parameter\n", param); -+ return -1; -+ } -+ } -+ -+ if ( set_hwp->set_params == 0 ) -+ { -+ fprintf(stderr, "No parameters set in request\n"); -+ return -1; -+ } -+ -+ return 0; -+} -+ -+static void hwp_set_func(int argc, char *argv[]) -+{ -+ xc_set_hwp_para_t set_hwp = {}; -+ int cpuid = -1; -+ int i = 0; -+ -+ if ( parse_hwp_opts(&set_hwp, &cpuid, argc, argv) ) -+ exit(EINVAL); -+ -+ if ( cpuid != -1 ) -+ { -+ i = cpuid; -+ max_cpu_nr = i + 1; -+ } -+ -+ for ( ; i < max_cpu_nr; i++ ) -+ if ( xc_set_cpufreq_hwp(xc_handle, i, &set_hwp) ) -+ fprintf(stderr, "[CPU%d] failed to set hwp params (%d - %s)\n", -+ i, errno, strerror(errno)); -+} -+ - struct { - const char *name; - void (*function)(int argc, char *argv[]); -@@ -1309,6 +1538,7 @@ struct { - { "get-cpufreq-average", cpufreq_func }, - { "start", start_gather_func }, - { "get-cpufreq-para", cpufreq_para_func }, -+ { "set-cpufreq-hwp", hwp_set_func }, - { "set-scaling-maxfreq", scaling_max_freq_func }, - { "set-scaling-minfreq", scaling_min_freq_func }, - { "set-scaling-governor", scaling_governor_func }, --- -2.37.3 - diff --git a/0643-cpufreq-enable-HWP-by-default.patch b/0643-cpufreq-enable-HWP-by-default.patch deleted file mode 100644 index 9b2cef4f..00000000 --- a/0643-cpufreq-enable-HWP-by-default.patch +++ /dev/null @@ -1,44 +0,0 @@ -From a210c229dc7a151e1040e46060083e580240f8f3 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= - -Date: Wed, 1 Feb 2023 21:51:27 +0100 -Subject: [PATCH] cpufreq: enable HWP by default -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Marek Marczykowski-Górecki ---- - docs/misc/xen-command-line.pandoc | 2 +- - xen/arch/x86/acpi/cpufreq/hwp.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc -index 633aa5580e2f..520e90375b3a 100644 ---- a/docs/misc/xen-command-line.pandoc -+++ b/docs/misc/xen-command-line.pandoc -@@ -507,7 +507,7 @@ choice of `dom0-kernel` is deprecated and not supported by all Dom0 kernels. - * `verbose` option can be included as a string or also as `verbose=` - * `` is a boolean to enable Hardware-Controlled Performance States (HWP) - on supported Intel hardware. HWP is a Skylake+ feature which provides better -- CPU power management. The default is disabled. -+ CPU power management. The default is enabled. - * `` is a boolean to enable Hardware Duty Cycling (HDC). HDC enables the - processor to autonomously force physical package components into idle state. - The default is enabled, but the option only applies when `` is enabled. -diff --git a/xen/arch/x86/acpi/cpufreq/hwp.c b/xen/arch/x86/acpi/cpufreq/hwp.c -index ef640ef5eaf0..8406893c0afa 100644 ---- a/xen/arch/x86/acpi/cpufreq/hwp.c -+++ b/xen/arch/x86/acpi/cpufreq/hwp.c -@@ -22,7 +22,7 @@ static bool feature_hwp_peci; - - static bool feature_hdc; - --__initdata bool opt_cpufreq_hwp = false; -+__initdata bool opt_cpufreq_hwp = true; - __initdata bool opt_cpufreq_hdc = true; - - #define HWP_ENERGY_PERF_MAX_PERFORMANCE 0 --- -2.37.3 - diff --git a/0651-x86-msi-passthrough-all-MSI-X-vector-ctrl-writes-to-.patch b/0651-x86-msi-passthrough-all-MSI-X-vector-ctrl-writes-to-.patch deleted file mode 100644 index ef29fdac..00000000 --- a/0651-x86-msi-passthrough-all-MSI-X-vector-ctrl-writes-to-.patch +++ /dev/null @@ -1,224 +0,0 @@ -From 829e622f3a84b62ec9593568e06122023bffe9f2 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= - -Date: Mon, 14 Nov 2022 13:56:56 +0100 -Subject: [PATCH 1/2] x86/msi: passthrough all MSI-X vector ctrl writes to - device model -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -QEMU needs to know whether clearing maskbit of a vector is really -clearing, or was already cleared before. Currently Xen sends only -clearing that bit to the device model, but not setting it, so QEMU -cannot detect it. Because of that, QEMU is working this around by -checking via /dev/mem, but that isn't the proper approach. - -Give all necessary information to QEMU by passing all ctrl writes, -including masking a vector. Advertise the new behavior via -XENVER_get_features, so QEMU can know it doesn't need to access /dev/mem -anymore. - -While this commit doesn't move the whole maskbit handling to QEMU (as -discussed on xen-devel as one of the possibilities), it is a necessary -first step anyway. Including telling QEMU it will get all the required -information to do so. The actual implementation would need to include: - - a hypercall for QEMU to control just maskbit (without (re)binding the - interrupt again - - a methor for QEMU to tell Xen it will actually do the work -Those are not part of this series. - -Signed-off-by: Marek Marczykowski-Górecki ---- -I did not added any control to enable/disable this new behavior (as -Roget have suggested for possible non-QEMU ioreqs). And especially not -as part of XEN_DMOP_get_ioreq_server_info, as the behavior isn't really -per-ioreq-server but at best per-device (or system-wide, as it's -currently done). I don't see how the new behavior could be problematic -for some existing ioreq server (they already received writes to those -addresses, just not all of them), but if that's really necessary, I can -probably add a command line option to restore previous behavior -system-wide. - -Changes in v4: -- ignore unaligned writes with X86EMUL_OKAY -- restructure the code to forward all writes in _msixtbl_write() instead - of manipulating return value of msixtbl_write() - this makes - WRITE_LEN4_COMPLETION special case unnecessary -- advertise the changed behavior via XENVER_get_features instead of DMOP -v3: - - advertise changed behavior in XEN_DMOP_get_ioreq_server_info - make - "flags" parameter IN/OUT - - move len check back to msixtbl_write() - will be needed there anyway - in a later patch -v2: - - passthrough quad writes to emulator too (Jan) - - (ab)use len==0 for write len=4 completion (Jan), but add descriptive - #define for this magic value ---- - xen/arch/x86/hvm/vmsi.c | 27 ++++++++++++++++++++++----- - xen/common/ioreq.c | 9 +++++++-- - xen/common/kernel.c | 1 + - xen/include/public/features.h | 8 ++++++++ - xen/include/public/hvm/dm_op.h | 12 ++++++++---- - 5 files changed, 46 insertions(+), 11 deletions(-) - -diff --git a/xen/arch/x86/hvm/vmsi.c b/xen/arch/x86/hvm/vmsi.c -index 3cd4923060c8..ebc052b8ea84 100644 ---- a/xen/arch/x86/hvm/vmsi.c -+++ b/xen/arch/x86/hvm/vmsi.c -@@ -272,6 +272,14 @@ out: - return r; - } - -+/* -+ * This function returns X86EMUL_UNHANDLEABLE even if write is properly -+ * handled, to propagate it to the device model (so it can keep its internal -+ * state in sync). -+ * len==0 means really len==4, but as a write completion that will return -+ * X86EMUL_OKAY on successful processing. Use WRITE_LEN4_COMPLETION to make it -+ * less confusing. -+ */ - static int msixtbl_write(struct vcpu *v, unsigned long address, - unsigned int len, unsigned long val) - { -@@ -283,8 +291,8 @@ static int msixtbl_write(struct vcpu *v, unsigned long address, - unsigned long flags; - struct irq_desc *desc; - -- if ( (len != 4 && len != 8) || (address & (len - 1)) ) -- return r; -+ if ( !IS_ALIGNED(address, len) ) -+ return X86EMUL_OKAY; - - rcu_read_lock(&msixtbl_rcu_lock); - -@@ -345,8 +353,7 @@ static int msixtbl_write(struct vcpu *v, unsigned long address, - - unlock: - spin_unlock_irqrestore(&desc->lock, flags); -- if ( len == 4 ) -- r = X86EMUL_OKAY; -+ r = X86EMUL_OKAY; - - out: - rcu_read_unlock(&msixtbl_rcu_lock); -@@ -357,7 +364,17 @@ static int cf_check _msixtbl_write( - const struct hvm_io_handler *handler, uint64_t address, uint32_t len, - uint64_t val) - { -- return msixtbl_write(current, address, len, val); -+ /* ignore invalid length or unaligned writes */ -+ if ( len != 4 && len != 8 || !IS_ALIGNED(address, len) ) -+ return X86EMUL_OKAY; -+ -+ /* -+ * This function returns X86EMUL_UNHANDLEABLE even if write is properly -+ * handled, to propagate it to the device model (so it can keep its -+ * internal state in sync). -+ */ -+ msixtbl_write(current, address, len, val); -+ return X86EMUL_UNHANDLEABLE; - } - - static bool cf_check msixtbl_range( -diff --git a/xen/common/ioreq.c b/xen/common/ioreq.c -index ecb8f545e1c4..bd6f074c1e85 100644 ---- a/xen/common/ioreq.c -+++ b/xen/common/ioreq.c -@@ -743,7 +743,8 @@ static int ioreq_server_destroy(struct domain *d, ioservid_t id) - static int ioreq_server_get_info(struct domain *d, ioservid_t id, - unsigned long *ioreq_gfn, - unsigned long *bufioreq_gfn, -- evtchn_port_t *bufioreq_port) -+ evtchn_port_t *bufioreq_port, -+ uint16_t *flags) - { - struct ioreq_server *s; - int rc; -@@ -779,6 +780,9 @@ static int ioreq_server_get_info(struct domain *d, ioservid_t id, - *bufioreq_port = s->bufioreq_evtchn; - } - -+ /* Advertise supported features/behaviors. */ -+ *flags = XEN_DMOP_all_msix_writes; -+ - rc = 0; - - out: -@@ -1374,7 +1378,8 @@ int ioreq_server_dm_op(struct xen_dm_op *op, struct domain *d, bool *const_op) - NULL : (unsigned long *)&data->ioreq_gfn, - (data->flags & XEN_DMOP_no_gfns) ? - NULL : (unsigned long *)&data->bufioreq_gfn, -- &data->bufioreq_port); -+ &data->bufioreq_port, &data->flags); -+ - break; - } - -diff --git a/xen/common/kernel.c b/xen/common/kernel.c -index 0e8abe0cf8a8..37386f74797b 100644 ---- a/xen/common/kernel.c -+++ b/xen/common/kernel.c -@@ -578,6 +578,7 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) - fi.submap |= (1U << XENFEAT_direct_mapped); - else - fi.submap |= (1U << XENFEAT_not_direct_mapped); -+ fi.submap |= (1U << XENFEAT_dm_msix_all_writes); - break; - default: - return -EINVAL; -diff --git a/xen/include/public/features.h b/xen/include/public/features.h -index d2a9175aae67..7b936655aadb 100644 ---- a/xen/include/public/features.h -+++ b/xen/include/public/features.h -@@ -111,6 +111,14 @@ - #define XENFEAT_not_direct_mapped 16 - #define XENFEAT_direct_mapped 17 - -+/* -+ * If set, Xen will passthrough all MSI-X vector ctrl writes to device model, -+ * not only those unmasking an entry. This allows device model to properly keep -+ * track of the MSI-X table without having to read it from the device behind -+ * Xen's backs. This information is relevant only for device models. -+ */ -+#define XENFEAT_dm_msix_all_writes 18 -+ - #define XENFEAT_NR_SUBMAPS 1 - - #endif /* __XEN_PUBLIC_FEATURES_H__ */ -diff --git a/xen/include/public/hvm/dm_op.h b/xen/include/public/hvm/dm_op.h -index acdf91693d0b..490b151c5dd7 100644 ---- a/xen/include/public/hvm/dm_op.h -+++ b/xen/include/public/hvm/dm_op.h -@@ -70,7 +70,9 @@ typedef struct xen_dm_op_create_ioreq_server xen_dm_op_create_ioreq_server_t; - * not contain XEN_DMOP_no_gfns then these pages will be made available and - * the frame numbers passed back in gfns and - * respectively. (If the IOREQ Server is not handling buffered emulation -- * only will be valid). -+ * only will be valid). When Xen returns XEN_DMOP_all_msix_writes -+ * flag set, it will notify the IOREQ server about all writes to MSI-X table -+ * (if it's handled by this IOREQ server), not only those clearing a mask bit. - * - * NOTE: To access the synchronous ioreq structures and buffered ioreq - * ring, it is preferable to use the XENMEM_acquire_resource memory -@@ -81,11 +83,13 @@ typedef struct xen_dm_op_create_ioreq_server xen_dm_op_create_ioreq_server_t; - struct xen_dm_op_get_ioreq_server_info { - /* IN - server id */ - ioservid_t id; -- /* IN - flags */ -+ /* IN/OUT - flags */ - uint16_t flags; - --#define _XEN_DMOP_no_gfns 0 --#define XEN_DMOP_no_gfns (1u << _XEN_DMOP_no_gfns) -+#define _XEN_DMOP_no_gfns 0 /* IN */ -+#define _XEN_DMOP_all_msix_writes 1 /* OUT */ -+#define XEN_DMOP_no_gfns (1u << _XEN_DMOP_no_gfns) -+#define XEN_DMOP_all_msix_writes (1u << _XEN_DMOP_all_msix_writes) - - /* OUT - buffered ioreq port */ - evtchn_port_t bufioreq_port; --- -2.41.0 - diff --git a/0652-x86-hvm-Allow-writes-to-registers-on-the-same-page-a.patch b/0652-x86-hvm-Allow-writes-to-registers-on-the-same-page-a.patch deleted file mode 100644 index 2cd3a7ff..00000000 --- a/0652-x86-hvm-Allow-writes-to-registers-on-the-same-page-a.patch +++ /dev/null @@ -1,440 +0,0 @@ -From 308f548ee8f7171d8a34238f3f435dcf861ee499 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= - -Date: Mon, 14 Nov 2022 15:50:46 +0100 -Subject: [PATCH 2/2] x86/hvm: Allow writes to registers on the same page as - MSI-X table -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Some devices (notably Intel Wifi 6 AX210 card) keep auxiliary registers -on the same page as MSI-X table. Device model (especially one in -stubdomain) cannot really handle those, as direct writes to that page is -refused (page is on the mmio_ro_ranges list). Instead, extend -msixtbl_mmio_ops to handle such accesses too. - -Doing this, requires correlating write location with guest view -of MSI-X table address. Since QEMU doesn't map MSI-X table to the guest, -it requires msixtbl_entry->gtable, which is HVM-only. Similar feature -for PV would need to be done separately. - -This will be also used to read Pending Bit Array, if it lives on the same -page, making QEMU not needing /dev/mem access at all (especially helpful -with lockdown enabled in dom0). If PBA lives on another page, QEMU will -map it to the guest directly. -If PBA lives on the same page, discard writes and log a message. -Technically, writes outside of PBA could be allowed, but at this moment -the precise location of PBA isn't saved, and also no known device abuses -the spec in this way (at least yet). - -To access those registers, msixtbl_mmio_ops need the relevant page -mapped. MSI handling already has infrastructure for that, using fixmap, -so try to map first/last page of the MSI-X table (if necessary) and save -their fixmap indexes. Note that msix_get_fixmap() does reference -counting and reuses existing mapping, so just call it directly, even if -the page was mapped before. Also, it uses a specific range of fixmap -indexes which doesn't include 0, so use 0 as default ("not mapped") -value - which simplifies code a bit. - -GCC gets confused about 'desc' variable: - - arch/x86/hvm/vmsi.c: In function ‘msixtbl_range’: - arch/x86/hvm/vmsi.c:553:8: error: ‘desc’ may be used uninitialized [-Werror=maybe-uninitialized] - 553 | if ( desc ) - | ^ - arch/x86/hvm/vmsi.c:537:28: note: ‘desc’ was declared here - 537 | const struct msi_desc *desc; - | ^~~~ - -It's conditional initialization is actually correct (in the case where -it isn't initialized, function returns early), but to avoid -build failure initialize it explicitly to NULL anyway. - -Signed-off-by: Marek Marczykowski-Górecki ---- -Changes in v4: -- drop same_page parameter of msixtbl_find_entry(), distinguish two - cases in relevant callers -- rename adj_access_table_idx to adj_access_idx -- code style fixes -- drop alignment check in adjacent_{read,write}() - all callers already - have it earlier -- delay mapping first/last MSI-X pages until preparing device for a - passthrough -v3: - - merge handling into msixtbl_mmio_ops - - extend commit message -v2: - - adjust commit message - - pass struct domain to msixtbl_page_handler_get_hwaddr() - - reduce local variables used only once - - log a warning if write is forbidden if MSI-X and PBA lives on the same - page - - do not passthrough unaligned accesses - - handle accesses both before and after MSI-X table ---- - xen/arch/x86/hvm/vmsi.c | 191 +++++++++++++++++++++++++++++++-- - xen/arch/x86/include/asm/msi.h | 5 + - xen/arch/x86/msi.c | 40 +++++++ - 3 files changed, 225 insertions(+), 11 deletions(-) - -diff --git a/xen/arch/x86/hvm/vmsi.c b/xen/arch/x86/hvm/vmsi.c -index ebc052b8ea84..e21c09f0f5cb 100644 ---- a/xen/arch/x86/hvm/vmsi.c -+++ b/xen/arch/x86/hvm/vmsi.c -@@ -180,6 +180,10 @@ static bool msixtbl_initialised(const struct domain *d) - return d->arch.hvm.msixtbl_list.next; - } - -+/* -+ * Lookup an msixtbl_entry on the same page as given addr. It's up to the -+ * caller to check if address is strictly part of the table - if relevant. -+ */ - static struct msixtbl_entry *msixtbl_find_entry( - struct vcpu *v, unsigned long addr) - { -@@ -187,8 +191,8 @@ static struct msixtbl_entry *msixtbl_find_entry( - struct domain *d = v->domain; - - list_for_each_entry( entry, &d->arch.hvm.msixtbl_list, list ) -- if ( addr >= entry->gtable && -- addr < entry->gtable + entry->table_len ) -+ if ( PFN_DOWN(addr) >= PFN_DOWN(entry->gtable) && -+ PFN_DOWN(addr) <= PFN_DOWN(entry->gtable + entry->table_len - 1) ) - return entry; - - return NULL; -@@ -213,6 +217,131 @@ static struct msi_desc *msixtbl_addr_to_desc( - return NULL; - } - -+/* -+ * Returns: -+ * - UINT_MAX if no handling should be done -+ * - UINT_MAX-1 if write should be discarded -+ * - a fixmap idx to use for handling -+ */ -+#define ADJACENT_DONT_HANDLE UINT_MAX -+#define ADJACENT_DISCARD_WRITE (UINT_MAX - 1) -+static unsigned int adjacent_handle( -+ const struct msixtbl_entry *entry, unsigned long addr, bool write) -+{ -+ unsigned int adj_type; -+ const struct arch_msix *msix; -+ -+ if ( !entry || !entry->pdev ) -+ return ADJACENT_DONT_HANDLE; -+ -+ if ( PFN_DOWN(addr) == PFN_DOWN(entry->gtable) && addr < entry->gtable ) -+ adj_type = ADJ_IDX_FIRST; -+ else if ( PFN_DOWN(addr) == PFN_DOWN(entry->gtable + entry->table_len - 1) && -+ addr >= entry->gtable + entry->table_len ) -+ adj_type = ADJ_IDX_LAST; -+ else -+ return ADJACENT_DONT_HANDLE; -+ -+ msix = entry->pdev->msix; -+ ASSERT(msix); -+ -+ if ( !msix->adj_access_idx[adj_type] ) -+ { -+ gprintk(XENLOG_WARNING, -+ "Page for adjacent(%d) MSI-X table access not initialized for %pp (addr %#lx, gtable %#lx\n", -+ adj_type, &entry->pdev->sbdf, addr, entry->gtable); -+ -+ return ADJACENT_DONT_HANDLE; -+ } -+ -+ /* If PBA lives on the same page too, discard writes. */ -+ if ( write && -+ ((adj_type == ADJ_IDX_LAST && -+ msix->table.last == msix->pba.first) || -+ (adj_type == ADJ_IDX_FIRST && -+ msix->table.first == msix->pba.last)) ) -+ { -+ gprintk(XENLOG_WARNING, -+ "MSI-X table and PBA of %pp live on the same page, " -+ "writing to other registers there is not implemented\n", -+ &entry->pdev->sbdf); -+ return ADJACENT_DISCARD_WRITE; -+ } -+ -+ return msix->adj_access_idx[adj_type]; -+} -+ -+static int adjacent_read( -+ unsigned int fixmap_idx, -+ paddr_t address, unsigned int len, uint64_t *pval) -+{ -+ const void __iomem *hwaddr; -+ -+ *pval = ~0UL; -+ -+ ASSERT(fixmap_idx != ADJACENT_DISCARD_WRITE); -+ -+ hwaddr = fix_to_virt(fixmap_idx) + PAGE_OFFSET(address); -+ -+ switch ( len ) -+ { -+ case 1: -+ *pval = readb(hwaddr); -+ break; -+ -+ case 2: -+ *pval = readw(hwaddr); -+ break; -+ -+ case 4: -+ *pval = readl(hwaddr); -+ break; -+ -+ case 8: -+ *pval = readq(hwaddr); -+ break; -+ -+ default: -+ ASSERT_UNREACHABLE(); -+ } -+ return X86EMUL_OKAY; -+} -+ -+static int adjacent_write( -+ unsigned int fixmap_idx, -+ uint64_t address, uint32_t len, uint64_t val) -+{ -+ void __iomem *hwaddr; -+ -+ if ( fixmap_idx == ADJACENT_DISCARD_WRITE ) -+ return X86EMUL_OKAY; -+ -+ hwaddr = fix_to_virt(fixmap_idx) + PAGE_OFFSET(address); -+ -+ switch ( len ) -+ { -+ case 1: -+ writeb(val, hwaddr); -+ break; -+ -+ case 2: -+ writew(val, hwaddr); -+ break; -+ -+ case 4: -+ writel(val, hwaddr); -+ break; -+ -+ case 8: -+ writeq(val, hwaddr); -+ break; -+ -+ default: -+ ASSERT_UNREACHABLE(); -+ } -+ return X86EMUL_OKAY; -+} -+ - static int cf_check msixtbl_read( - const struct hvm_io_handler *handler, uint64_t address, uint32_t len, - uint64_t *pval) -@@ -220,16 +349,31 @@ static int cf_check msixtbl_read( - unsigned long offset; - struct msixtbl_entry *entry; - unsigned int nr_entry, index; -+ unsigned int adjacent_fixmap; - int r = X86EMUL_UNHANDLEABLE; - -- if ( (len != 4 && len != 8) || (address & (len - 1)) ) -+ if ( !IS_ALIGNED(address, len) ) - return r; - - rcu_read_lock(&msixtbl_rcu_lock); -- - entry = msixtbl_find_entry(current, address); - if ( !entry ) - goto out; -+ -+ adjacent_fixmap = adjacent_handle(entry, address, false); -+ if ( adjacent_fixmap != ADJACENT_DONT_HANDLE ) -+ { -+ r = adjacent_read(adjacent_fixmap, address, len, pval); -+ goto out; -+ } -+ -+ if ( address < entry->gtable || -+ address >= entry->gtable + entry->table_len ) -+ goto out; -+ -+ if ( len != 4 && len != 8 ) -+ goto out; -+ - offset = address & (PCI_MSIX_ENTRY_SIZE - 1); - - if ( offset != PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET ) -@@ -290,6 +434,7 @@ static int msixtbl_write(struct vcpu *v, unsigned long address, - int r = X86EMUL_UNHANDLEABLE; - unsigned long flags; - struct irq_desc *desc; -+ unsigned int adjacent_fixmap; - - if ( !IS_ALIGNED(address, len) ) - return X86EMUL_OKAY; -@@ -299,6 +444,19 @@ static int msixtbl_write(struct vcpu *v, unsigned long address, - entry = msixtbl_find_entry(v, address); - if ( !entry ) - goto out; -+ -+ adjacent_fixmap = adjacent_handle(entry, address, true); -+ if ( adjacent_fixmap != ADJACENT_DONT_HANDLE ) -+ { -+ r = adjacent_write(adjacent_fixmap, address, len, val); -+ goto out; -+ } -+ if ( address < entry->gtable || -+ address >= entry->gtable + entry->table_len ) -+ goto out; -+ if ( len != 4 && len != 8 ) -+ goto out; -+ - nr_entry = array_index_nospec(((address - entry->gtable) / - PCI_MSIX_ENTRY_SIZE), - MAX_MSIX_TABLE_ENTRIES); -@@ -364,8 +522,8 @@ static int cf_check _msixtbl_write( - const struct hvm_io_handler *handler, uint64_t address, uint32_t len, - uint64_t val) - { -- /* ignore invalid length or unaligned writes */ -- if ( len != 4 && len != 8 || !IS_ALIGNED(address, len) ) -+ /* ignore unaligned writes */ -+ if ( !IS_ALIGNED(address, len) ) - return X86EMUL_OKAY; - - /* -@@ -382,14 +540,22 @@ static bool cf_check msixtbl_range( - { - struct vcpu *curr = current; - unsigned long addr = r->addr; -- const struct msi_desc *desc; -+ const struct msixtbl_entry *entry; -+ const struct msi_desc *desc = NULL; -+ unsigned int adjacent_fixmap; - - ASSERT(r->type == IOREQ_TYPE_COPY); - - rcu_read_lock(&msixtbl_rcu_lock); -- desc = msixtbl_addr_to_desc(msixtbl_find_entry(curr, addr), addr); -+ entry = msixtbl_find_entry(curr, addr); -+ adjacent_fixmap = adjacent_handle(entry, addr, false); -+ if ( adjacent_fixmap == ADJACENT_DONT_HANDLE ) -+ desc = msixtbl_addr_to_desc(entry, addr); - rcu_read_unlock(&msixtbl_rcu_lock); - -+ if ( adjacent_fixmap != ADJACENT_DONT_HANDLE ) -+ return 1; -+ - if ( desc ) - return 1; - -@@ -630,12 +796,15 @@ void msix_write_completion(struct vcpu *v) - v->arch.hvm.hvm_io.msix_snoop_gpa ) - { - unsigned int token = hvmemul_cache_disable(v); -- const struct msi_desc *desc; -+ const struct msi_desc *desc = NULL; -+ const struct msixtbl_entry *entry; - uint32_t data; - - rcu_read_lock(&msixtbl_rcu_lock); -- desc = msixtbl_addr_to_desc(msixtbl_find_entry(v, snoop_addr), -- snoop_addr); -+ entry = msixtbl_find_entry(v, snoop_addr); -+ if ( entry && snoop_addr >= entry->gtable && -+ snoop_addr < entry->gtable + entry->table_len ) -+ desc = msixtbl_addr_to_desc(entry, snoop_addr); - rcu_read_unlock(&msixtbl_rcu_lock); - - if ( desc && -diff --git a/xen/arch/x86/include/asm/msi.h b/xen/arch/x86/include/asm/msi.h -index fe670895eed2..86acae3adc6a 100644 ---- a/xen/arch/x86/include/asm/msi.h -+++ b/xen/arch/x86/include/asm/msi.h -@@ -229,6 +229,10 @@ struct __packed msg_address { - PCI_MSIX_ENTRY_SIZE + \ - (~PCI_MSIX_BIRMASK & (PAGE_SIZE - 1))) - -+/* indexes in adj_access_idx[] below */ -+#define ADJ_IDX_FIRST 0 -+#define ADJ_IDX_LAST 1 -+ - struct arch_msix { - unsigned int nr_entries, used_entries; - struct { -@@ -236,6 +240,7 @@ struct arch_msix { - } table, pba; - int table_refcnt[MAX_MSIX_TABLE_PAGES]; - int table_idx[MAX_MSIX_TABLE_PAGES]; -+ unsigned int adj_access_idx[2]; - spinlock_t table_lock; - bool host_maskall, guest_maskall; - domid_t warned; -diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c -index d0bf63df1def..7673c1cffe43 100644 ---- a/xen/arch/x86/msi.c -+++ b/xen/arch/x86/msi.c -@@ -928,6 +928,36 @@ static int msix_capability_init(struct pci_dev *dev, - list_add_tail(&entry->list, &dev->msi_list); - *desc = entry; - } -+ else -+ { -+ /* -+ * If the MSI-X table doesn't start at the page boundary, map the first page for -+ * passthrough accesses. -+ */ -+ if ( PAGE_OFFSET(table_paddr) ) -+ { -+ int idx = msix_get_fixmap(msix, table_paddr, table_paddr); -+ -+ if ( idx > 0 ) -+ msix->adj_access_idx[ADJ_IDX_FIRST] = idx; -+ else -+ gprintk(XENLOG_ERR, "Failed to map first MSI-X table page: %d\n", idx); -+ } -+ /* -+ * If the MSI-X table doesn't end on the page boundary, map the last page -+ * for passthrough accesses. -+ */ -+ if ( PAGE_OFFSET(table_paddr + msix->nr_entries * PCI_MSIX_ENTRY_SIZE) ) -+ { -+ uint64_t entry_paddr = table_paddr + msix->nr_entries * PCI_MSIX_ENTRY_SIZE; -+ int idx = msix_get_fixmap(msix, table_paddr, entry_paddr); -+ -+ if ( idx > 0 ) -+ msix->adj_access_idx[ADJ_IDX_LAST] = idx; -+ else -+ gprintk(XENLOG_ERR, "Failed to map last MSI-X table page: %d\n", idx); -+ } -+ } - - if ( !msix->used_entries ) - { -@@ -1090,6 +1120,16 @@ static void _pci_cleanup_msix(struct arch_msix *msix) - WARN(); - msix->table.first = 0; - msix->table.last = 0; -+ if ( msix->adj_access_idx[ADJ_IDX_FIRST] ) -+ { -+ msix_put_fixmap(msix, msix->adj_access_idx[ADJ_IDX_FIRST]); -+ msix->adj_access_idx[ADJ_IDX_FIRST] = 0; -+ } -+ if ( msix->adj_access_idx[ADJ_IDX_LAST] ) -+ { -+ msix_put_fixmap(msix, msix->adj_access_idx[ADJ_IDX_LAST]); -+ msix->adj_access_idx[ADJ_IDX_LAST] = 0; -+ } - - if ( rangeset_remove_range(mmio_ro_ranges, msix->pba.first, - msix->pba.last) ) --- -2.41.0 - diff --git a/0670-x86-hpet-Disable-legacy-replacement-mode-after-test-.patch b/0670-x86-hpet-Disable-legacy-replacement-mode-after-test-.patch deleted file mode 100644 index d71f5834..00000000 --- a/0670-x86-hpet-Disable-legacy-replacement-mode-after-test-.patch +++ /dev/null @@ -1,60 +0,0 @@ -From a112f0fbbb333fc29a35d0a81853d59409a33fde Mon Sep 17 00:00:00 2001 -: -: Upstreaming should be done soon: -: https://lore.kernel.org/xen-devel/20230807113117.1277-1-simon@invisiblethingslab.com/ -: -From: Simon Gaiser -To: xen-devel@lists.xenproject.org -Cc: Jan Beulich -Cc: Andrew Cooper -Cc: "Roger Pau Monné" -Cc: Wei Liu -Cc: Marek Marczykowski-Górecki -Date: Mon, 31 Jul 2023 12:13:42 +0200 -Subject: [XEN PATCH v3] x86/hpet: Disable legacy replacement mode after IRQ test - -As far as I understand the HPET legacy mode is not required after the -timer IRQ test. For previous discussion see [1] and [2]. Keeping it -enabled prevents reaching deeper C-states on some systems and thereby -also S0ix residency. So disable it after the timer IRQ test worked. Note -that this code path is only reached when opt_hpet_legacy_replacement < 0, -so explicit user choice is still honored. - -Link: https://lore.kernel.org/xen-devel/cb408368-077d-edb5-b4ad-f80086db48c1@invisiblethingslab.com/ # [1] -Link: https://lore.kernel.org/xen-devel/20230718122603.2002-1-simon@invisiblethingslab.com/ # [2] -Signed-off-by: Simon Gaiser ---- - -[ Resending v3, now with a unique Message-ID, sorry. ] - -Changes in v3: - - - Edit log message and downgrade it to XENLOG_DEBUG. - -Changes in v2: - - - Always disable legacy mode after test, not only when ARAT is - available. See [3] for reasoning. - -[3]: https://lore.kernel.org/xen-devel/ac77ecba-6804-1d16-60dc-f184e5d31dcb@invisiblethingslab.com/ - ---- - xen/arch/x86/io_apic.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c -index 041233b9b7..b4b4cd5939 100644 ---- a/xen/arch/x86/io_apic.c -+++ b/xen/arch/x86/io_apic.c -@@ -1967,6 +1967,8 @@ static void __init check_timer(void) - - if ( timer_irq_works() ) - { -+ printk(XENLOG_DEBUG "IRQ test with HPET Legacy Replacement Mode worked - disabling it again\n"); -+ hpet_disable_legacy_replacement_mode(); - local_irq_restore(flags); - return; - } --- -2.40.1 - diff --git a/1000-Do-not-access-network-during-the-build.patch b/1000-Do-not-access-network-during-the-build.patch index 2c1adc85..a06df86b 100644 --- a/1000-Do-not-access-network-during-the-build.patch +++ b/1000-Do-not-access-network-during-the-build.patch @@ -1,8 +1,8 @@ -From c6e02913d26e1db97abbd8d9674efee1ee55f6d6 Mon Sep 17 00:00:00 2001 +From 22eb30cf82065492dfc76a46ffde2cd50ab6a2e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 16 Nov 2022 01:35:00 +0100 -Subject: [PATCH 1000/1018] Do not access network during the build +Subject: [PATCH] Do not access network during the build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -53,5 +53,5 @@ index c1a72c189c8f..e800e29366b9 100644 AC_SUBST(FETCHER) ]) -- -2.37.3 +2.44.0 diff --git a/1001-hotplug-store-block-params-for-cleanup.patch b/1001-hotplug-store-block-params-for-cleanup.patch index 1116acae..57154eb1 100644 --- a/1001-hotplug-store-block-params-for-cleanup.patch +++ b/1001-hotplug-store-block-params-for-cleanup.patch @@ -1,8 +1,8 @@ -From 796c78e913d0243dfa24f680f2d02796444d00d1 Mon Sep 17 00:00:00 2001 +From eaae036362dadc00a51441706239d47a170f8f97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 16 Nov 2022 01:38:52 +0100 -Subject: [PATCH 1001/1018] hotplug: store block params for cleanup +Subject: [PATCH] hotplug: store block params for cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -66,5 +66,5 @@ index 2691b56951c9..dc4466906e70 100644 exit 0 ;; -- -2.37.3 +2.44.0 diff --git a/1002-libxl-do-not-start-dom0-qemu-when-not-needed.patch b/1002-libxl-do-not-start-dom0-qemu-when-not-needed.patch index 8a1940aa..b130257c 100644 --- a/1002-libxl-do-not-start-dom0-qemu-when-not-needed.patch +++ b/1002-libxl-do-not-start-dom0-qemu-when-not-needed.patch @@ -1,8 +1,8 @@ -From cb24bc96d6ed8a57ff8ef4a1b2b8fce12194e5c8 Mon Sep 17 00:00:00 2001 +From 7a7682f5a50005fdd99809148481dcd2b39e7408 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 21 Apr 2015 03:50:04 +0200 -Subject: [PATCH 1002/1018] libxl: do not start dom0 qemu when not needed +Subject: [PATCH] libxl: do not start dom0 qemu when not needed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -13,19 +13,19 @@ needed. Signed-off-by: Marek Marczykowski-Górecki --- - tools/libs/light/libxl_disk.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) + tools/libs/light/libxl_disk.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/libs/light/libxl_disk.c b/tools/libs/light/libxl_disk.c -index ea3623dd6fe5..36b89b63b61a 100644 +index 1f1e5c6567da..2ec7f5f37eda 100644 --- a/tools/libs/light/libxl_disk.c +++ b/tools/libs/light/libxl_disk.c -@@ -56,10 +56,12 @@ static void disk_eject_xswatch_callback(libxl__egc *egc, libxl__ev_xswatch *w, - "/local/domain/%d/backend/%" TOSTRING(BACKEND_STRING_SIZE) +@@ -57,11 +57,12 @@ static void disk_eject_xswatch_callback(libxl__egc *egc, libxl__ev_xswatch *w, "[a-z]/%*d/%*d", &disk->backend_domid, backend_type); -- if (!strcmp(backend_type, "tap") || !strcmp(backend_type, "vbd")) { -+ if (!strcmp(backend_type, "tap")) { + if (!strcmp(backend_type, "tap") || +- !strcmp(backend_type, "vbd") || + !strcmp(backend_type, "vbd3")) { disk->backend = LIBXL_DISK_BACKEND_TAP; } else if (!strcmp(backend_type, "qdisk")) { disk->backend = LIBXL_DISK_BACKEND_QDISK; @@ -35,5 +35,5 @@ index ea3623dd6fe5..36b89b63b61a 100644 disk->backend = LIBXL_DISK_BACKEND_UNKNOWN; } -- -2.37.3 +2.44.0 diff --git a/1003-libxl-do-not-start-qemu-in-dom0-if-possible.patch b/1003-libxl-do-not-start-qemu-in-dom0-if-possible.patch index e381066a..0003c602 100644 --- a/1003-libxl-do-not-start-qemu-in-dom0-if-possible.patch +++ b/1003-libxl-do-not-start-qemu-in-dom0-if-possible.patch @@ -1,8 +1,8 @@ -From bfc0302ab5367b98a077532f4e8b7e30ba02b8ce Mon Sep 17 00:00:00 2001 +From 09c71e4a620e87185e2d860e7db0e0a146f09401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 21 Apr 2015 03:56:36 +0200 -Subject: [PATCH 1003/1018] libxl: do not start qemu in dom0 if possible +Subject: [PATCH] libxl: do not start qemu in dom0 if possible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -17,10 +17,10 @@ Signed-off-by: Marek Marczykowski-Górecki 1 file changed, 3 insertions(+) diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c -index 09f0c2a83ead..02da900a6f39 100644 +index e1593e255be7..2a09c8953423 100644 --- a/tools/libs/light/libxl_dm.c +++ b/tools/libs/light/libxl_dm.c -@@ -2530,6 +2530,9 @@ static void spawn_stub_launch_dm(libxl__egc *egc, +@@ -2539,6 +2539,9 @@ static void spawn_stub_launch_dm(libxl__egc *egc, while (*(serial++)) num_console++; } @@ -31,5 +31,5 @@ index 09f0c2a83ead..02da900a6f39 100644 console = libxl__calloc(gc, num_console, sizeof(libxl__device_console)); -- -2.37.3 +2.44.0 diff --git a/1004-systemd-enable-xenconsoled-logging-by-default.patch b/1004-systemd-enable-xenconsoled-logging-by-default.patch index daff36a4..0d563a7d 100644 --- a/1004-systemd-enable-xenconsoled-logging-by-default.patch +++ b/1004-systemd-enable-xenconsoled-logging-by-default.patch @@ -1,8 +1,8 @@ -From 11f4fd8d796a1803c8d15fc2c8b7c060e8edb38f Mon Sep 17 00:00:00 2001 +From 7f085dc8b9cab734f3f0bc22640b3088a048669e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 19 Oct 2015 03:25:16 +0200 -Subject: [PATCH 1004/1018] systemd: enable xenconsoled logging by default +Subject: [PATCH] systemd: enable xenconsoled logging by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -13,7 +13,7 @@ Signed-off-by: Marek Marczykowski-Górecki 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/hotplug/Linux/systemd/xenconsoled.service.in b/tools/hotplug/Linux/systemd/xenconsoled.service.in -index 1f03de9041ed..31f9a10cc8ab 100644 +index d84c09aa9c51..206d75625d44 100644 --- a/tools/hotplug/Linux/systemd/xenconsoled.service.in +++ b/tools/hotplug/Linux/systemd/xenconsoled.service.in @@ -6,8 +6,8 @@ ConditionPathExists=/proc/xen/capabilities @@ -28,5 +28,5 @@ index 1f03de9041ed..31f9a10cc8ab 100644 EnvironmentFile=-@CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities -- -2.37.3 +2.44.0 diff --git a/1005-hotplug-trigger-udev-event-on-block-attach-detach.patch b/1005-hotplug-trigger-udev-event-on-block-attach-detach.patch index e6e68d8f..148bd3e0 100644 --- a/1005-hotplug-trigger-udev-event-on-block-attach-detach.patch +++ b/1005-hotplug-trigger-udev-event-on-block-attach-detach.patch @@ -1,8 +1,8 @@ -From 9d9eb5b76af0eca2ff73f674a40c80f30bcad3c7 Mon Sep 17 00:00:00 2001 +From 060a68175d9650285a55471f6a2f0e82480962fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 16 Nov 2022 01:43:37 +0100 -Subject: [PATCH 1005/1018] hotplug: trigger udev event on block attach/detach +Subject: [PATCH] hotplug: trigger udev event on block attach/detach MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -55,5 +55,5 @@ index dc4466906e70..c0d509ef8ccd 100644 ;; -- -2.37.3 +2.44.0 diff --git a/1006-libxl-use-EHCI-for-providing-tablet-USB-device.patch b/1006-libxl-use-EHCI-for-providing-tablet-USB-device.patch index e8de2b58..a6b50faf 100644 --- a/1006-libxl-use-EHCI-for-providing-tablet-USB-device.patch +++ b/1006-libxl-use-EHCI-for-providing-tablet-USB-device.patch @@ -1,7 +1,7 @@ -From 3ceba6a97da58c0ef1c5b8a8e54409de902a2022 Mon Sep 17 00:00:00 2001 +From 977cf5dc8d7f94c2a610f29bc61f0822509d4bd0 Mon Sep 17 00:00:00 2001 From: alcreator <24826469+alcreator@users.noreply.github.com> Date: Mon, 17 Sep 2018 23:01:36 +1000 -Subject: [PATCH 1006/1018] libxl: use EHCI for providing tablet USB device +Subject: [PATCH] libxl: use EHCI for providing tablet USB device MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -18,7 +18,7 @@ Signed-off-by: Marek Marczykowski-Górecki 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c -index 02da900a6f39..aba36518a9f4 100644 +index 2a09c8953423..7fd53df13ed0 100644 --- a/tools/libs/light/libxl_dm.c +++ b/tools/libs/light/libxl_dm.c @@ -1463,18 +1463,20 @@ static int libxl__build_device_model_args_new(libxl__gc *gc, @@ -49,5 +49,5 @@ index 02da900a6f39..aba36518a9f4 100644 } } else if (b_info->u.hvm.usbversion) { -- -2.37.3 +2.44.0 diff --git a/1007-libxl-allow-kernel-cmdline-without-kernel-if-stubdom.patch b/1007-libxl-allow-kernel-cmdline-without-kernel-if-stubdom.patch index 070348cd..09dcc139 100644 --- a/1007-libxl-allow-kernel-cmdline-without-kernel-if-stubdom.patch +++ b/1007-libxl-allow-kernel-cmdline-without-kernel-if-stubdom.patch @@ -1,9 +1,9 @@ -From 0e1ec70e77d62a5f4149f6eca68f8c2239aa289b Mon Sep 17 00:00:00 2001 +From f8215431b84b465716ac814a6bfe66c952d9f862 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 16 Nov 2022 01:45:25 +0100 -Subject: [PATCH 1007/1018] libxl: allow kernel cmdline without kernel if - stubdomain is used +Subject: [PATCH] libxl: allow kernel cmdline without kernel if stubdomain is + used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -18,7 +18,7 @@ Signed-off-by: Marek Marczykowski-Górecki 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c -index e23d3c866feb..d9937f5edc25 100644 +index ac8d3c395163..7629f6157832 100644 --- a/tools/libs/light/libxl_create.c +++ b/tools/libs/light/libxl_create.c @@ -182,7 +182,8 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, @@ -32,5 +32,5 @@ index e23d3c866feb..d9937f5edc25 100644 return ERROR_INVAL; } -- -2.37.3 +2.44.0 diff --git a/1008-libxl-Force-emulating-readonly-disks-as-SCSI.patch b/1008-libxl-Force-emulating-readonly-disks-as-SCSI.patch index a1f46a58..24e7bcd2 100644 --- a/1008-libxl-Force-emulating-readonly-disks-as-SCSI.patch +++ b/1008-libxl-Force-emulating-readonly-disks-as-SCSI.patch @@ -1,8 +1,8 @@ -From 7febcbd1ad92f899f8b0d5a895db501f37a12382 Mon Sep 17 00:00:00 2001 +From 16441a7526d355dc4150e30cd1062b6626de2305 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 16 Nov 2022 01:48:34 +0100 -Subject: [PATCH 1008/1018] libxl: Force emulating readonly disks as SCSI +Subject: [PATCH] libxl: Force emulating readonly disks as SCSI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -15,7 +15,7 @@ Signed-off-by: Marek Marczykowski-Górecki 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c -index aba36518a9f4..07839e374bca 100644 +index 7fd53df13ed0..ed2772ab0456 100644 --- a/tools/libs/light/libxl_dm.c +++ b/tools/libs/light/libxl_dm.c @@ -1364,7 +1364,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc, @@ -27,7 +27,7 @@ index aba36518a9f4..07839e374bca 100644 flexarray_vappend(dm_args, "-device", "lsi53c895a", NULL); break; } -@@ -1953,7 +1953,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc, +@@ -1952,7 +1952,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc, colo_mode = LIBXL__COLO_NONE; } @@ -37,5 +37,5 @@ index aba36518a9f4..07839e374bca 100644 if (colo_mode == LIBXL__COLO_SECONDARY) { drive = libxl__sprintf -- -2.37.3 +2.44.0 diff --git a/1009-tools-xenconsole-replace-ESC-char-on-xenconsole-outp.patch b/1009-tools-xenconsole-replace-ESC-char-on-xenconsole-outp.patch index ad3b06ef..02358a79 100644 --- a/1009-tools-xenconsole-replace-ESC-char-on-xenconsole-outp.patch +++ b/1009-tools-xenconsole-replace-ESC-char-on-xenconsole-outp.patch @@ -1,9 +1,9 @@ -From 4f1797a596480363cf9a6912323a68bb5eb10995 Mon Sep 17 00:00:00 2001 +From e952a87a9869f87f8cb6183d7c2d4ab4e5d234f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sun, 10 Feb 2019 02:11:50 +0100 -Subject: [PATCH 1009/1018] tools/xenconsole: replace ESC char on xenconsole - output by default +Subject: [PATCH] tools/xenconsole: replace ESC char on xenconsole output by + default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -19,31 +19,32 @@ Signed-off-by: Marek Marczykowski-Górecki --- tools/console/client/main.c | 21 ++++++++++++++++++--- tools/xl/xl_cmdtable.c | 3 ++- - tools/xl/xl_console.c | 8 +++++++- - 3 files changed, 27 insertions(+), 5 deletions(-) + tools/xl/xl_console.c | 7 ++++++- + 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/tools/console/client/main.c b/tools/console/client/main.c -index 1a6fa162f750..02fe3eebc740 100644 +index d2dcc3ddcac3..3d6cea805908 100644 --- a/tools/console/client/main.c +++ b/tools/console/client/main.c -@@ -77,6 +77,7 @@ static void usage(const char *program) { - " -n, --num N use console number N\n" +@@ -78,6 +78,7 @@ static void usage(const char *program) { " --type TYPE console type. must be 'pv', 'serial' or 'vuart'\n" " --start-notify-fd N file descriptor used to notify parent\n" + " --escape E escape sequence to exit console\n" + " -r, --no-replace-escape Do not replace ESC character with dot\n" , program); } -@@ -174,7 +175,7 @@ static void restore_term(int fd, struct termios *old) +@@ -175,7 +176,8 @@ static void restore_term(int fd, struct termios *old) } static int console_loop(int fd, struct xs_handle *xs, char *pty_path, -- bool interactive) -+ bool interactive, bool replace_escape) +- bool interactive, char escape_character) ++ bool interactive, char escape_character, ++ bool replace_escape) { int ret, xs_fd = xs_fileno(xs), max_fd = -1; -@@ -248,6 +249,12 @@ static int console_loop(int fd, struct xs_handle *xs, char *pty_path, +@@ -249,6 +251,12 @@ static int console_loop(int fd, struct xs_handle *xs, char *pty_path, fd = -1; continue; } @@ -56,7 +57,7 @@ index 1a6fa162f750..02fe3eebc740 100644 if (!write_sync(STDOUT_FILENO, msg, len)) { perror("write() failed"); -@@ -324,7 +331,7 @@ int main(int argc, char **argv) +@@ -325,7 +333,7 @@ int main(int argc, char **argv) { struct termios attr; int domid; @@ -65,20 +66,21 @@ index 1a6fa162f750..02fe3eebc740 100644 int ch; unsigned int num = 0; int opt_ind=0; -@@ -335,6 +342,7 @@ int main(int argc, char **argv) - { "help", 0, 0, 'h' }, +@@ -337,6 +345,7 @@ int main(int argc, char **argv) { "start-notify-fd", 1, 0, 's' }, { "interactive", 0, 0, 'i' }, + { "escape", 1, 0, 'e' }, + { "no-replace-escape", 0, 0, 'r' }, { 0 }, }; -@@ -344,8 +352,12 @@ int main(int argc, char **argv) +@@ -346,9 +355,13 @@ int main(int argc, char **argv) char *end; console_type type = CONSOLE_INVAL; bool interactive = 0; + bool replace_escape = 1; const char *console_names = "serial, pv, vuart"; + char escape_character = DEFAULT_ESCAPE_CHARACTER; + if (getenv("XEN_CONSOLE_REPLACE_ESCAPE")) + replace_escape = atoi(getenv("XEN_CONSOLE_REPLACE_ESCAPE")); @@ -86,69 +88,69 @@ index 1a6fa162f750..02fe3eebc740 100644 while((ch = getopt_long(argc, argv, sopt, lopt, &opt_ind)) != -1) { switch(ch) { case 'h': -@@ -375,6 +387,9 @@ int main(int argc, char **argv) - case 'i': - interactive = 1; - break; +@@ -387,6 +400,8 @@ int main(int argc, char **argv) + fprintf(stderr, "Invalid escape argument\n"); + exit(EINVAL); + } + case 'r': + replace_escape = 0; -+ break; + break; default: fprintf(stderr, "Invalid argument\n"); - fprintf(stderr, "Try `%s --help' for more information.\n", -@@ -494,7 +509,7 @@ int main(int argc, char **argv) +@@ -506,7 +521,7 @@ int main(int argc, char **argv) close(start_notify_fd); } -- console_loop(spty, xs, path, interactive); -+ console_loop(spty, xs, path, interactive, replace_escape); +- console_loop(spty, xs, path, interactive, escape_character); ++ console_loop(spty, xs, path, interactive, escape_character, replace_escape); free(path); free(dom_path); diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c -index 35182ca19630..1d9a59e58b1f 100644 +index 42751228c1d1..2185777525d2 100644 --- a/tools/xl/xl_cmdtable.c +++ b/tools/xl/xl_cmdtable.c -@@ -141,7 +141,8 @@ const struct cmd_spec cmd_table[] = { - "Attach to domain's console", +@@ -142,7 +142,8 @@ const struct cmd_spec cmd_table[] = { "[options] \n" "-t console type, pv , serial or vuart\n" -- "-n console number" -+ "-n console number\n" + "-n console number\n" +- "-e escape character" ++ "-e escape character\n" + "-r do not replace ESC character with dot" }, { "vncviewer", &main_vncviewer, 0, 0, diff --git a/tools/xl/xl_console.c b/tools/xl/xl_console.c -index b27f9e013697..212cb66db786 100644 +index 5633c6f6f7e6..0d8b3e858303 100644 --- a/tools/xl/xl_console.c +++ b/tools/xl/xl_console.c -@@ -27,9 +27,10 @@ int main_console(int argc, char **argv) +@@ -27,10 +27,11 @@ int main_console(int argc, char **argv) uint32_t domid; int opt = 0, num = 0; libxl_console_type type = 0; + bool replace_escape = true; const char *console_names = "pv, serial, vuart"; + char* escape_character = NULL; -- SWITCH_FOREACH_OPT(opt, "n:t:", NULL, "console", 1) { -+ SWITCH_FOREACH_OPT(opt, "n:t:r", NULL, "console", 1) { +- SWITCH_FOREACH_OPT(opt, "n:t:e:", NULL, "console", 1) { ++ SWITCH_FOREACH_OPT(opt, "n:t:e:r", NULL, "console", 1) { case 't': if (!strcmp(optarg, "pv")) type = LIBXL_CONSOLE_TYPE_PV; -@@ -45,8 +46,13 @@ int main_console(int argc, char **argv) - case 'n': - num = atoi(optarg); +@@ -48,9 +49,13 @@ int main_console(int argc, char **argv) break; + case 'e': + escape_character = optarg; + case 'r': + replace_escape = false; -+ break; + break; } + setenv("XEN_CONSOLE_REPLACE_ESCAPE", replace_escape ? "1" : "0", 1); + domid = find_domain(argv[optind]); if (!type) - libxl_primary_console_exec(ctx, domid, -1); + libxl_primary_console_exec(ctx, domid, -1, escape_character); -- -2.37.3 +2.44.0 diff --git a/1010-libxl-disable-vkb-by-default.patch b/1010-libxl-disable-vkb-by-default.patch index df126911..9c2a47ad 100644 --- a/1010-libxl-disable-vkb-by-default.patch +++ b/1010-libxl-disable-vkb-by-default.patch @@ -1,8 +1,8 @@ -From 11be62cc9b8dbdbf498f38a3a4b0869d431eb8f4 Mon Sep 17 00:00:00 2001 +From 32de757dcbc01de77c3a557c914aaa6c54c1547c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sat, 18 Jan 2020 01:53:41 +0100 -Subject: [PATCH 1010/1018] libxl: disable vkb by default +Subject: [PATCH] libxl: disable vkb by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -15,18 +15,18 @@ Signed-off-by: Marek Marczykowski-Górecki 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c -index d9937f5edc25..8047cf0ee100 100644 +index 7629f6157832..1d43725d5eed 100644 --- a/tools/libs/light/libxl_create.c +++ b/tools/libs/light/libxl_create.c -@@ -391,7 +391,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, +@@ -390,7 +390,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, + libxl_defbool_setdefault(&b_info->u.hvm.hpet, true); libxl_defbool_setdefault(&b_info->u.hvm.vpt_align, true); - libxl_defbool_setdefault(&b_info->u.hvm.altp2m, false); libxl_defbool_setdefault(&b_info->u.hvm.usb, false); - libxl_defbool_setdefault(&b_info->u.hvm.vkb_device, true); + libxl_defbool_setdefault(&b_info->u.hvm.vkb_device, false); libxl_defbool_setdefault(&b_info->u.hvm.xen_platform_pci, true); + libxl_defbool_setdefault(&b_info->u.hvm.pirq, false); - libxl_defbool_setdefault(&b_info->u.hvm.spice.enable, false); -- -2.37.3 +2.44.0 diff --git a/1011-Always-allocate-domid-sequentially-and-do-not-reuse-.patch b/1011-Always-allocate-domid-sequentially-and-do-not-reuse-.patch index de683f30..f56c7c15 100644 --- a/1011-Always-allocate-domid-sequentially-and-do-not-reuse-.patch +++ b/1011-Always-allocate-domid-sequentially-and-do-not-reuse-.patch @@ -1,21 +1,20 @@ -From c8d6fd40bc3af9928061910b3cdb463f1c8dcd9f Mon Sep 17 00:00:00 2001 +From 5f8607649d9601eb421a4ee137bce5a4449076d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Fri, 3 Dec 2021 21:13:23 +0100 -Subject: [PATCH 1011/1018] Always allocate domid sequentially, and do not - reuse them +Subject: [PATCH] Always allocate domid sequentially, and do not reuse them While domid wrapping around is unlikely on Qubes, make sure it wont happen, to avoid various corner cases. --- - xen/common/domctl.c | 34 ++++++++++++---------------------- - 1 file changed, 12 insertions(+), 22 deletions(-) + xen/common/domctl.c | 36 +++++++++++++----------------------- + 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/xen/common/domctl.c b/xen/common/domctl.c -index 69fb9abd346f..67858eb9c6aa 100644 +index 2c0331bb05ed..459a3a502154 100644 --- a/xen/common/domctl.c +++ b/xen/common/domctl.c -@@ -408,32 +408,22 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) +@@ -412,32 +412,22 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) case XEN_DOMCTL_createdomain: { domid_t dom; @@ -42,11 +41,12 @@ index 69fb9abd346f..67858eb9c6aa 100644 - ret = -ENOMEM; - if ( dom == rover ) - break; +- +- rover = dom; + /* Refuse explicit domid via op->domain */ + if ( (op->domain > 0) && (op->domain < DOMID_FIRST_RESERVED) ) + return -EINVAL; - -- rover = dom; ++ + if ( rover >= DOMID_FIRST_RESERVED ) { + printk(XENLOG_ERR + "domctl: out of available domid values, reboot the system\n"); @@ -61,5 +61,5 @@ index 69fb9abd346f..67858eb9c6aa 100644 if ( IS_ERR(d) ) { -- -2.37.3 +2.44.0 diff --git a/1012-libxl-add-qubes-gui-graphics.patch b/1012-libxl-add-qubes-gui-graphics.patch index da23608e..6a26675d 100644 --- a/1012-libxl-add-qubes-gui-graphics.patch +++ b/1012-libxl-add-qubes-gui-graphics.patch @@ -1,8 +1,8 @@ -From b590fe086102fdce92ae5b553c93a341d0ef948b Mon Sep 17 00:00:00 2001 +From 24afae20152a98298fa196eb54ddbff5b62d525a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 16 Nov 2022 01:52:34 +0100 -Subject: [PATCH 1012/1018] libxl: add qubes-gui graphics +Subject: [PATCH] libxl: add qubes-gui graphics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -11,11 +11,11 @@ Signed-off-by: Marek Marczykowski-Górecki --- tools/libs/light/libxl_create.c | 12 ++++++++++++ tools/libs/light/libxl_dm.c | 7 +++++++ - tools/libs/light/libxl_types.idl | 9 +++++++++ - 3 files changed, 28 insertions(+) + tools/libs/light/libxl_types.idl | 8 ++++++++ + 3 files changed, 27 insertions(+) diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c -index 8047cf0ee100..c7b57a677ea4 100644 +index 1d43725d5eed..0ed0d026de2e 100644 --- a/tools/libs/light/libxl_create.c +++ b/tools/libs/light/libxl_create.c @@ -429,6 +429,18 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, @@ -38,7 +38,7 @@ index 8047cf0ee100..c7b57a677ea4 100644 libxl_defbool_setdefault(&b_info->u.hvm.spice.disable_ticketing, false); diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c -index 07839e374bca..af0944a55762 100644 +index ed2772ab0456..4710ded5deec 100644 --- a/tools/libs/light/libxl_dm.c +++ b/tools/libs/light/libxl_dm.c @@ -1720,6 +1720,13 @@ static int libxl__build_device_model_args_new(libxl__gc *gc, @@ -56,10 +56,10 @@ index 07839e374bca..af0944a55762 100644 if (!sdl && !vnc) { flexarray_append(dm_args, "-nographic"); diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl -index d634f304cda2..d79a6e29121b 100644 +index 4e65e6fda5f1..1ad4d8dd1d3f 100644 --- a/tools/libs/light/libxl_types.idl +++ b/tools/libs/light/libxl_types.idl -@@ -343,6 +343,13 @@ libxl_sdl_info = Struct("sdl_info", [ +@@ -354,6 +354,13 @@ libxl_sdl_info = Struct("sdl_info", [ ("xauthority", string), ]) @@ -73,15 +73,14 @@ index d634f304cda2..d79a6e29121b 100644 libxl_dominfo = Struct("dominfo",[ ("uuid", libxl_uuid), ("domid", libxl_domid), -@@ -636,6 +643,8 @@ libxl_domain_build_info = Struct("domain_build_info",[ - ("rdm", libxl_rdm_reserve), +@@ -699,6 +706,7 @@ libxl_domain_build_info = Struct("domain_build_info",[ ("rdm_mem_boundary_memkb", MemKB), ("mca_caps", uint64), -+ -+ ("qubes_gui", libxl_qubes_gui_info), + ("pirq", libxl_defbool), ++ ("qubes_gui", libxl_qubes_gui_info), ])), ("pv", Struct(None, [("kernel", string, {'deprecated_by': 'kernel'}), ("slack_memkb", MemKB), -- -2.37.3 +2.44.0 diff --git a/1014-Additional-support-in-ACPI-builder-to-support-SLIC-a.patch b/1013-Additional-support-in-ACPI-builder-to-support-SLIC-a.patch similarity index 91% rename from 1014-Additional-support-in-ACPI-builder-to-support-SLIC-a.patch rename to 1013-Additional-support-in-ACPI-builder-to-support-SLIC-a.patch index d2543a88..35867a50 100644 --- a/1014-Additional-support-in-ACPI-builder-to-support-SLIC-a.patch +++ b/1013-Additional-support-in-ACPI-builder-to-support-SLIC-a.patch @@ -1,9 +1,9 @@ -From 3b2ac02a9978910d9147916a3b8f87a20c7746d6 Mon Sep 17 00:00:00 2001 +From 666298baed7a550e4e5e65097861a4aa06056689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 16 Nov 2022 02:20:15 +0100 -Subject: [PATCH 1014/1018] Additional support in ACPI builder to support SLIC - and OEM installs. +Subject: [PATCH] Additional support in ACPI builder to support SLIC and OEM + installs. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -27,10 +27,10 @@ Signed-off-by: Marek Marczykowski-Górecki 1 file changed, 100 insertions(+), 6 deletions(-) diff --git a/tools/libacpi/build.c b/tools/libacpi/build.c -index fe2db66a62e6..51de7e37a0f3 100644 +index 2f29863db154..55cc81ff18ce 100644 --- a/tools/libacpi/build.c +++ b/tools/libacpi/build.c -@@ -340,6 +340,66 @@ static int construct_passthrough_tables(struct acpi_ctxt *ctxt, +@@ -332,6 +332,66 @@ static int construct_passthrough_tables(struct acpi_ctxt *ctxt, return nr_added; } @@ -97,7 +97,7 @@ index fe2db66a62e6..51de7e37a0f3 100644 static int construct_secondary_tables(struct acpi_ctxt *ctxt, unsigned long *table_ptrs, struct acpi_config *config, -@@ -513,6 +573,8 @@ int acpi_build_tables(struct acpi_ctxt *ctxt, struct acpi_config *config) +@@ -552,6 +612,8 @@ int acpi_build_tables(struct acpi_ctxt *ctxt, struct acpi_config *config) unsigned long secondary_tables[ACPI_MAX_SECONDARY_TABLES]; int nr_secondaries, i; unsigned int fadt_size; @@ -106,7 +106,7 @@ index fe2db66a62e6..51de7e37a0f3 100644 acpi_info = (struct acpi_info *)config->infop; memset(acpi_info, 0, sizeof(*acpi_info)); -@@ -632,6 +694,27 @@ int acpi_build_tables(struct acpi_ctxt *ctxt, struct acpi_config *config) +@@ -671,6 +733,27 @@ int acpi_build_tables(struct acpi_ctxt *ctxt, struct acpi_config *config) if ( nr_secondaries < 0 ) goto oom; @@ -134,7 +134,7 @@ index fe2db66a62e6..51de7e37a0f3 100644 xsdt = ctxt->mem_ops.alloc(ctxt, sizeof(struct acpi_20_xsdt) + sizeof(uint64_t) * nr_secondaries, 16); -@@ -641,9 +724,13 @@ int acpi_build_tables(struct acpi_ctxt *ctxt, struct acpi_config *config) +@@ -680,9 +763,13 @@ int acpi_build_tables(struct acpi_ctxt *ctxt, struct acpi_config *config) for ( i = 0; secondary_tables[i]; i++ ) xsdt->entry[i+1] = secondary_tables[i]; xsdt->header.length = sizeof(struct acpi_header) + (i+1)*sizeof(uint64_t); @@ -151,7 +151,7 @@ index fe2db66a62e6..51de7e37a0f3 100644 rsdt = ctxt->mem_ops.alloc(ctxt, sizeof(struct acpi_20_rsdt) + sizeof(uint32_t) * nr_secondaries, -@@ -654,9 +741,13 @@ int acpi_build_tables(struct acpi_ctxt *ctxt, struct acpi_config *config) +@@ -693,9 +780,13 @@ int acpi_build_tables(struct acpi_ctxt *ctxt, struct acpi_config *config) for ( i = 0; secondary_tables[i]; i++ ) rsdt->entry[i+1] = secondary_tables[i]; rsdt->header.length = sizeof(struct acpi_header) + (i+1)*sizeof(uint32_t); @@ -168,7 +168,7 @@ index fe2db66a62e6..51de7e37a0f3 100644 /* * Fill in low-memory data structures: acpi_info and RSDP. -@@ -666,6 +757,9 @@ int acpi_build_tables(struct acpi_ctxt *ctxt, struct acpi_config *config) +@@ -705,6 +796,9 @@ int acpi_build_tables(struct acpi_ctxt *ctxt, struct acpi_config *config) memcpy(rsdp, &Rsdp, sizeof(struct acpi_20_rsdp)); rsdp->rsdt_address = ctxt->mem_ops.v2p(ctxt, rsdt); rsdp->xsdt_address = ctxt->mem_ops.v2p(ctxt, xsdt); @@ -179,5 +179,5 @@ index fe2db66a62e6..51de7e37a0f3 100644 offsetof(struct acpi_10_rsdp, checksum), sizeof(struct acpi_10_rsdp)); -- -2.37.3 +2.44.0 diff --git a/1013-libxl-do-not-force-qdisk-backend-for-cdrom.patch b/1013-libxl-do-not-force-qdisk-backend-for-cdrom.patch deleted file mode 100644 index 43f2d7da..00000000 --- a/1013-libxl-do-not-force-qdisk-backend-for-cdrom.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 744ab8d355ed1fdc973212836b54b3a8a94ed3a9 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= - -Date: Mon, 28 Aug 2017 02:14:25 +0200 -Subject: [PATCH 1013/1018] libxl: do not force qdisk backend for cdrom -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -There is no qemu in dom0 in Qubes, every block device use vbd backend -type and only then is appropriately handled by stubdomain. - -Signed-off-by: Marek Marczykowski-Górecki ---- - tools/libs/light/libxl_disk.c | 11 ----------- - 1 file changed, 11 deletions(-) - -diff --git a/tools/libs/light/libxl_disk.c b/tools/libs/light/libxl_disk.c -index 36b89b63b61a..a6bae7c4fc55 100644 ---- a/tools/libs/light/libxl_disk.c -+++ b/tools/libs/light/libxl_disk.c -@@ -190,17 +190,6 @@ static int libxl__device_disk_setdefault(libxl__gc *gc, uint32_t domid, - return ERROR_FAIL; - } - -- /* Force Qdisk backend for CDROM devices of guests with a device model. */ -- if (disk->is_cdrom != 0 && -- libxl__domain_type(gc, domid) == LIBXL_DOMAIN_TYPE_HVM) { -- if (!(disk->backend == LIBXL_DISK_BACKEND_QDISK || -- disk->backend == LIBXL_DISK_BACKEND_UNKNOWN)) { -- LOGD(ERROR, domid, "Backend for CD devices on HVM guests must be Qdisk"); -- return ERROR_FAIL; -- } -- disk->backend = LIBXL_DISK_BACKEND_QDISK; -- } -- - rc = libxl__device_disk_set_backend(gc, disk); - return rc; - } --- -2.37.3 - diff --git a/1015-libxl-conditionally-allow-PCI-passthrough-on-PV-with.patch b/1014-libxl-conditionally-allow-PCI-passthrough-on-PV-with.patch similarity index 88% rename from 1015-libxl-conditionally-allow-PCI-passthrough-on-PV-with.patch rename to 1014-libxl-conditionally-allow-PCI-passthrough-on-PV-with.patch index e20da54b..3450f90a 100644 --- a/1015-libxl-conditionally-allow-PCI-passthrough-on-PV-with.patch +++ b/1014-libxl-conditionally-allow-PCI-passthrough-on-PV-with.patch @@ -1,9 +1,9 @@ -From dda5ab4e32dc6cf6bda80cce7a610152603c5bce Mon Sep 17 00:00:00 2001 +From 22491e622845c3afc7006fa2dc621dde9f68ffb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sat, 16 Jan 2021 05:06:18 +0100 -Subject: [PATCH 1015/1018] libxl: conditionally allow PCI passthrough on PV - without IOMMU +Subject: [PATCH] libxl: conditionally allow PCI passthrough on PV without + IOMMU MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -22,10 +22,10 @@ Signed-off-by: Marek Marczykowski-Górecki 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c -index c7b57a677ea4..72c45cd67f07 100644 +index 0ed0d026de2e..d89515b8693e 100644 --- a/tools/libs/light/libxl_create.c +++ b/tools/libs/light/libxl_create.c -@@ -1181,12 +1181,18 @@ int libxl__domain_config_setdefault(libxl__gc *gc, +@@ -1209,12 +1209,18 @@ int libxl__domain_config_setdefault(libxl__gc *gc, * This will be insufficient if and when ARM does PCI hotplug. */ bool need_pt = d_config->num_pcidevs || d_config->num_dtdevs; @@ -46,10 +46,10 @@ index c7b57a677ea4..72c45cd67f07 100644 LOGD(ERROR, domid, "passthrough not supported on this platform\n"); diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h -index a86c21a7ce21..f7d2d29f82d5 100644 +index d19174cbd727..622bb92f490e 100644 --- a/tools/libs/light/libxl_internal.h +++ b/tools/libs/light/libxl_internal.h -@@ -4850,6 +4850,8 @@ static inline const char *libxl__qemu_qmp_path(libxl__gc *gc, int domid) +@@ -4851,6 +4851,8 @@ static inline const char *libxl__qemu_qmp_path(libxl__gc *gc, int domid) return GCSPRINTF("%s/qmp-libxl-%d", libxl__run_dir_path(), domid); } @@ -59,10 +59,10 @@ index a86c21a7ce21..f7d2d29f82d5 100644 _hidden int libxl__domain_pvcontrol(libxl__egc *egc, libxl__xswait_state *pvcontrol, diff --git a/tools/libs/light/libxl_pci.c b/tools/libs/light/libxl_pci.c -index eecc7571c849..ccb80e4e26b0 100644 +index a6b0e3adcb68..0302b5990f06 100644 --- a/tools/libs/light/libxl_pci.c +++ b/tools/libs/light/libxl_pci.c -@@ -1537,8 +1537,10 @@ out_no_irq: +@@ -1539,8 +1539,10 @@ out_no_irq: r = xc_assign_device(ctx->xch, domid, pci_encode_bdf(pci), flag); if (r < 0 && (hvm || errno != ENOSYS)) { LOGED(ERROR, domainid, "xc_assign_device failed"); @@ -75,7 +75,7 @@ index eecc7571c849..ccb80e4e26b0 100644 } } -@@ -1589,6 +1591,41 @@ static int libxl__device_pci_reset(libxl__gc *gc, unsigned int domain, unsigned +@@ -1591,6 +1593,41 @@ static int libxl__device_pci_reset(libxl__gc *gc, unsigned int domain, unsigned return -1; } @@ -118,5 +118,5 @@ index eecc7571c849..ccb80e4e26b0 100644 libxl_device_pci *pci, bool hotplug) { -- -2.37.3 +2.44.0 diff --git a/1016-gnttab-disable-grant-tables-v2-by-default.patch b/1015-gnttab-disable-grant-tables-v2-by-default.patch similarity index 82% rename from 1016-gnttab-disable-grant-tables-v2-by-default.patch rename to 1015-gnttab-disable-grant-tables-v2-by-default.patch index 0c2c587c..9d559e70 100644 --- a/1016-gnttab-disable-grant-tables-v2-by-default.patch +++ b/1015-gnttab-disable-grant-tables-v2-by-default.patch @@ -1,8 +1,8 @@ -From 588952430826123ef62bae4dcd1eb87213c40931 Mon Sep 17 00:00:00 2001 +From f2ce35f0da8dace989b1fd1ea37833eacbca4640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 25 Aug 2021 02:41:51 +0200 -Subject: [PATCH 1016/1018] gnttab: disable grant tables v2 by default +Subject: [PATCH] gnttab: disable grant tables v2 by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -15,7 +15,7 @@ Signed-off-by: Marek Marczykowski-Górecki 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c -index ee7cc496b8cb..5a2e2db8ae76 100644 +index ebe2d2a3ceec..632c4c307c33 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -179,7 +179,7 @@ static int cf_check parse_gnttab_max_maptrack_frames(const char *arg) @@ -28,5 +28,5 @@ index ee7cc496b8cb..5a2e2db8ae76 100644 unsigned int __read_mostly opt_gnttab_max_version = GNTTAB_MAX_VERSION; -- -2.37.3 +2.44.0 diff --git a/1016-cpufreq-enable-HWP-by-default.patch b/1016-cpufreq-enable-HWP-by-default.patch new file mode 100644 index 00000000..33a760ed --- /dev/null +++ b/1016-cpufreq-enable-HWP-by-default.patch @@ -0,0 +1,46 @@ +From fee444ebc6f2a46041f9a76a2a14d042eac98c04 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= + +Date: Wed, 1 Feb 2023 21:51:27 +0100 +Subject: [PATCH] cpufreq: enable HWP by default +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Marek Marczykowski-Górecki +--- + docs/misc/xen-command-line.pandoc | 2 +- + xen/drivers/cpufreq/cpufreq.c | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc +index 98a45211556b..2096ae5841de 100644 +--- a/docs/misc/xen-command-line.pandoc ++++ b/docs/misc/xen-command-line.pandoc +@@ -513,7 +513,7 @@ choice of `dom0-kernel` is deprecated and not supported by all Dom0 kernels. + for `xen`. It is a boolean for `hwp`. + * `hwp` selects Hardware-Controlled Performance States (HWP) on supported Intel + hardware. HWP is a Skylake+ feature which provides better CPU power +- management. The default is disabled. If `hwp` is selected, but hardware ++ management. The default is enabled. If `hwp` is selected, but hardware + support is not available, Xen will fallback to cpufreq=xen. + * `` is a boolean to enable Hardware Duty Cycling (HDC). HDC enables the + processor to autonomously force physical package components into idle state. +diff --git a/xen/drivers/cpufreq/cpufreq.c b/xen/drivers/cpufreq/cpufreq.c +index 8659ad3aee51..cfea722b3683 100644 +--- a/xen/drivers/cpufreq/cpufreq.c ++++ b/xen/drivers/cpufreq/cpufreq.c +@@ -64,8 +64,8 @@ LIST_HEAD_READ_MOSTLY(cpufreq_governor_list); + /* set xen as default cpufreq */ + enum cpufreq_controller cpufreq_controller = FREQCTL_xen; + +-enum cpufreq_xen_opt __initdata cpufreq_xen_opts[2] = { CPUFREQ_xen, +- CPUFREQ_none }; ++enum cpufreq_xen_opt __initdata cpufreq_xen_opts[2] = { CPUFREQ_hwp, ++ CPUFREQ_xen }; + unsigned int __initdata cpufreq_xen_cnt = 1; + + static int __init cpufreq_cmdline_parse(const char *s, const char *e); +-- +2.44.0 + diff --git a/1018-Fix-IGD-passthrough-with-linux-stubdomain.patch b/1017-Fix-IGD-passthrough-with-linux-stubdomain.patch similarity index 95% rename from 1018-Fix-IGD-passthrough-with-linux-stubdomain.patch rename to 1017-Fix-IGD-passthrough-with-linux-stubdomain.patch index 4d857f2d..473db85a 100644 --- a/1018-Fix-IGD-passthrough-with-linux-stubdomain.patch +++ b/1017-Fix-IGD-passthrough-with-linux-stubdomain.patch @@ -1,7 +1,7 @@ -From 0aafce690689818524c98a76bcacf12a76012cf1 Mon Sep 17 00:00:00 2001 +From e6482ffa566bae21c006c90d0879c64baa678579 Mon Sep 17 00:00:00 2001 From: Grzegorz Uriasz Date: Thu, 13 Feb 2020 02:30:36 +0000 -Subject: [PATCH 1018/1018] Fix IGD passthrough with linux stubdomain +Subject: [PATCH] Fix IGD passthrough with linux stubdomain - Give permissions for VGA IOPORTS - Give permission for opregions @@ -11,10 +11,10 @@ Subject: [PATCH 1018/1018] Fix IGD passthrough with linux stubdomain 1 file changed, 126 insertions(+), 26 deletions(-) diff --git a/tools/libs/light/libxl_pci.c b/tools/libs/light/libxl_pci.c -index ccb80e4e26b0..e16abd5fd2a2 100644 +index 0302b5990f06..35e3e1360423 100644 --- a/tools/libs/light/libxl_pci.c +++ b/tools/libs/light/libxl_pci.c -@@ -2577,17 +2577,128 @@ void libxl__device_pci_destroy_all(libxl__egc *egc, uint32_t domid, +@@ -2594,17 +2594,128 @@ void libxl__device_pci_destroy_all(libxl__egc *egc, uint32_t domid, libxl_device_pci_list_free(pcis, num); } @@ -147,7 +147,7 @@ index ccb80e4e26b0..e16abd5fd2a2 100644 libxl_device_pci *pci = &d_config->pcidevs[i]; unsigned long pci_device_class; -@@ -2596,30 +2707,19 @@ int libxl__grant_vga_iomem_permission(libxl__gc *gc, const uint32_t domid, +@@ -2613,30 +2724,19 @@ int libxl__grant_vga_iomem_permission(libxl__gc *gc, const uint32_t domid, if (pci_device_class != 0x030000) /* VGA class */ continue; @@ -190,5 +190,5 @@ index ccb80e4e26b0..e16abd5fd2a2 100644 static int libxl_device_pci_compare(const libxl_device_pci *d1, -- -2.37.3 +2.44.0 diff --git a/1019-Use-Linux-s-PAT.patch b/1018-x86-Use-Linux-s-PAT.patch similarity index 71% rename from 1019-Use-Linux-s-PAT.patch rename to 1018-x86-Use-Linux-s-PAT.patch index bdcad280..d006dfcd 100644 --- a/1019-Use-Linux-s-PAT.patch +++ b/1018-x86-Use-Linux-s-PAT.patch @@ -1,20 +1,7 @@ -From f5c5982b365ae6a84a92a007964b90f0fd56a409 Mon Sep 17 00:00:00 2001 -Message-Id: -In-Reply-To: -References: +From 7f3f94f443f652e4a59c111d4cf8b5fb3b771612 Mon Sep 17 00:00:00 2001 From: Demi Marie Obenour Date: Sun, 4 Dec 2022 07:57:44 -0500 -Subject: [PATCH v6 5/5] x86: Use Linux's PAT -To: xen-devel@lists.xenproject.org -Cc: Marek Marczykowski-Górecki , - Jan Beulich , - Andrew Cooper , - "Roger Pau Monné" , - Wei Liu , - Jun Nakajima , - Kevin Tian , - George Dunlap , - Tim Deegan +Subject: [PATCH] x86: Use Linux's PAT This is purely for testing, to see if it works around a bug in i915. It is not intended to be merged. @@ -27,10 +14,10 @@ NOT-signed-off-by: DO NOT MERGE 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/xen/arch/x86/include/asm/page.h b/xen/arch/x86/include/asm/page.h -index b585235d064a567082582c8e92a4e8283fd949ca..ab9b46f1d0901e50a83fd035ff28d1bda0b781a2 100644 +index 350d1fb1100f..2624cc6bdae5 100644 --- a/xen/arch/x86/include/asm/page.h +++ b/xen/arch/x86/include/asm/page.h -@@ -333,11 +333,11 @@ void efi_update_l4_pgtable(unsigned int l4idx, l4_pgentry_t); +@@ -333,11 +333,11 @@ void efi_update_l4_pgtable(unsigned int l4idx, l4_pgentry_t l4e); /* Memory types, encoded under Xen's choice of MSR_PAT. */ #define _PAGE_WB ( 0) @@ -45,10 +32,10 @@ index b585235d064a567082582c8e92a4e8283fd949ca..ab9b46f1d0901e50a83fd035ff28d1bd /* * Debug option: Ensure that granted mappings are not implicitly unmapped. diff --git a/xen/arch/x86/include/asm/processor.h b/xen/arch/x86/include/asm/processor.h -index 60b902060914584957db8afa5c7c1e6abdad4d13..3993d5638626f0948bb7ac8192d2eda187eb1bdb 100644 +index c26ef9090c3a..ec881b880d4d 100644 --- a/xen/arch/x86/include/asm/processor.h +++ b/xen/arch/x86/include/asm/processor.h -@@ -94,16 +94,16 @@ +@@ -65,16 +65,16 @@ /* * Host IA32_CR_PAT value to cover all memory types. This is not the default @@ -71,10 +58,10 @@ index 60b902060914584957db8afa5c7c1e6abdad4d13..3993d5638626f0948bb7ac8192d2eda1 #ifndef __ASSEMBLY__ diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c -index 4f63af1057b467dfd56724311063ef5f58309618..c56dce300c276b83e6270a28833518496baaeb91 100644 +index 702c76a879e5..b30453b9de11 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c -@@ -6387,14 +6387,6 @@ unsigned long get_upper_mfn_bound(void) +@@ -6365,14 +6365,6 @@ unsigned long get_upper_mfn_bound(void) */ static void __init __maybe_unused build_assertions(void) { @@ -90,7 +77,5 @@ index 4f63af1057b467dfd56724311063ef5f58309618..c56dce300c276b83e6270a2883351849 * _PAGE_WB must be zero for several reasons, not least because Linux * assumes it. -- -Sincerely, -Demi Marie Obenour (she/her/hers) -Invisible Things Lab +2.44.0 diff --git a/1020-xen-tools-qubes-vm.patch b/1020-xen-tools-qubes-vm.patch index 75b28f7b..3699a4a4 100644 --- a/1020-xen-tools-qubes-vm.patch +++ b/1020-xen-tools-qubes-vm.patch @@ -12,13 +12,14 @@ diff --git a/tools/Makefile b/tools/Makefile index 9e28027835..bf06a778bb 100644 --- a/tools/Makefile +++ b/tools/Makefile -@@ -6,38 +6,15 @@ include $(XEN_ROOT)/tools/Rules.mk +@@ -6,40 +6,17 @@ include $(XEN_ROOT)/tools/Rules.mk SUBDIRS-y := SUBDIRS-y += libs -SUBDIRS-y += flask -SUBDIRS-y += fuzz - SUBDIRS-y += xenstore + SUBDIRS-y += xs-clients + SUBDIRS-$(XENSTORE_XENSTORED) += xenstored -SUBDIRS-y += misc -SUBDIRS-y += examples SUBDIRS-y += hotplug @@ -28,7 +29,7 @@ index 9e28027835..bf06a778bb 100644 -SUBDIRS-y += console -SUBDIRS-y += xenmon -SUBDIRS-$(XENSTAT_XENTOP) += xentop --SUBDIRS-y += libfsimage +-SUBDIRS-$(CONFIG_LIBFSIMAGE) += libfsimage SUBDIRS-$(CONFIG_Linux) += vchan -# do not recurse in to a dir we are about to delete @@ -41,12 +42,13 @@ index 9e28027835..bf06a778bb 100644 SUBDIRS-$(CONFIG_GOLANG) += golang SUBDIRS-y += xl SUBDIRS-y += helpers + SUBDIRS-y += 9pfsd -SUBDIRS-$(CONFIG_X86) += xenpaging -SUBDIRS-$(CONFIG_X86) += debugger -SUBDIRS-$(CONFIG_TESTS) += tests SUBDIRS-y += python --SUBDIRS-y += pygrub +-SUBDIRS-$(CONFIG_PYGRUB) += pygrub -SUBDIRS-$(OCAML_TOOLS) += ocaml ifeq ($(CONFIG_RUMP),y) diff --git a/1100-Define-build-dates-time-based-on-SOURCE_DATE_EPOCH.patch b/1100-Define-build-dates-time-based-on-SOURCE_DATE_EPOCH.patch index a49f262f..9fdac44a 100644 --- a/1100-Define-build-dates-time-based-on-SOURCE_DATE_EPOCH.patch +++ b/1100-Define-build-dates-time-based-on-SOURCE_DATE_EPOCH.patch @@ -1,8 +1,8 @@ -From ff55b35b061b87748304b3776042394b9af01364 Mon Sep 17 00:00:00 2001 +From a2855b81da57771863829568d535de53ba572d7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?= Date: Sat, 31 Oct 2020 14:57:49 +0100 -Subject: [PATCH 1100/1103] Define build dates/time based on SOURCE_DATE_EPOCH +Subject: [PATCH] Define build dates/time based on SOURCE_DATE_EPOCH Varibles impacting reproducibility are now defined with respect to SOURCE_DATE_EPOCH. @@ -17,10 +17,10 @@ Improvements from Jan Beuluch . 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Config.mk b/Config.mk -index 8d91e4c4d5b5..b4985f044913 100644 +index e7aa8ceaaf3b..729ed9e8434e 100644 --- a/Config.mk +++ b/Config.mk -@@ -253,3 +253,5 @@ QEMU_UPSTREAM_LOC ?= $(call or,$(wildcard $(QEMU_UPSTREAM_INTREE)),\ +@@ -249,3 +249,5 @@ QEMU_UPSTREAM_LOC ?= $(call or,$(wildcard $(QEMU_UPSTREAM_INTREE)),\ $(QEMU_UPSTREAM_URL)) CONFIG_TESTS ?= y @@ -28,10 +28,10 @@ index 8d91e4c4d5b5..b4985f044913 100644 +DATE_EPOCH_OPTS := $(if $(SOURCE_DATE_EPOCH),-u -d "@$(SOURCE_DATE_EPOCH)") \ No newline at end of file diff --git a/INSTALL b/INSTALL -index 0d3eb89f0298..2ce1f78b4d6a 100644 +index 88c1464816bd..22fce650f9a0 100644 --- a/INSTALL +++ b/INSTALL -@@ -241,6 +241,12 @@ XEN_BUILD_TIME=hh:mm:ss +@@ -235,6 +235,12 @@ XEN_BUILD_TIME=hh:mm:ss SMBIOS_REL_DATE=mm/dd/yyyy VGABIOS_REL_DATE="dd Mon yyyy" @@ -45,17 +45,17 @@ index 0d3eb89f0298..2ce1f78b4d6a 100644 GIT= diff --git a/tools/firmware/hvmloader/Makefile b/tools/firmware/hvmloader/Makefile -index 4f31c881613c..4f8e8c808443 100644 +index 84cba171cd6b..d94df1cd88b6 100644 --- a/tools/firmware/hvmloader/Makefile +++ b/tools/firmware/hvmloader/Makefile -@@ -21,7 +21,7 @@ XEN_ROOT = $(CURDIR)/../../.. - include $(XEN_ROOT)/tools/firmware/Rules.mk +@@ -23,7 +23,7 @@ include $(XEN_ROOT)/tools/firmware/Rules.mk + ld-option = $(shell if $(LD) -v $(1) >/dev/null 2>&1; then echo y; else echo n; fi) # SMBIOS spec requires format mm/dd/yyyy -SMBIOS_REL_DATE ?= $(shell date +%m/%d/%Y) +SMBIOS_REL_DATE ?= $(shell date $(DATE_EPOCH_OPTS) +%m/%d/%Y) - CFLAGS += $(CFLAGS_xeninclude) + CFLAGS += $(CFLAGS_xeninclude) -fno-pic diff --git a/tools/firmware/vgabios/Makefile b/tools/firmware/vgabios/Makefile index 3284812fdec8..4350ef402127 100644 @@ -72,7 +72,7 @@ index 3284812fdec8..4350ef402127 100644 VGABIOS_DATE = "-DVGABIOS_DATE=\"$(VGABIOS_REL_DATE)\"" diff --git a/xen/Makefile b/xen/Makefile -index a46e6330dbca..9ac87ea9b27c 100644 +index e9fd19536f2c..02e947da95a0 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -15,10 +15,10 @@ ifeq ($(origin XEN_DOMAIN), undefined) @@ -89,5 +89,5 @@ index a46e6330dbca..9ac87ea9b27c 100644 ifeq ($(origin XEN_BUILD_HOST), undefined) export XEN_BUILD_HOST := $(shell hostname) -- -2.41.0 +2.44.0 diff --git a/1101-docs-rename-DATE-to-PANDOC_REL_DATE-and-allow-to-spe.patch b/1101-docs-rename-DATE-to-PANDOC_REL_DATE-and-allow-to-spe.patch index 9c5bee7b..d868076e 100644 --- a/1101-docs-rename-DATE-to-PANDOC_REL_DATE-and-allow-to-spe.patch +++ b/1101-docs-rename-DATE-to-PANDOC_REL_DATE-and-allow-to-spe.patch @@ -1,9 +1,8 @@ -From d33dcefccfb3c6b362a936b45f04dfdd7e401bd6 Mon Sep 17 00:00:00 2001 +From c8256e48f9f0c98d34a12aa4880e8153ac84c4c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?= Date: Sat, 7 Nov 2020 16:35:55 +0100 -Subject: [PATCH 1101/1103] docs: rename DATE to PANDOC_REL_DATE and allow to - specify it +Subject: [PATCH] docs: rename DATE to PANDOC_REL_DATE and allow to specify it PANDOC_REL_DATE is now defined with respect to SOURCE_DATE_EPOCH (if set). It improves reproducibility. @@ -13,10 +12,10 @@ SOURCE_DATE_EPOCH (if set). It improves reproducibility. 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/INSTALL b/INSTALL -index 2ce1f78b4d6a..84c93ab9d518 100644 +index 22fce650f9a0..14edf0b8ccce 100644 --- a/INSTALL +++ b/INSTALL -@@ -240,6 +240,7 @@ XEN_BUILD_DATE= +@@ -234,6 +234,7 @@ XEN_BUILD_DATE= XEN_BUILD_TIME=hh:mm:ss SMBIOS_REL_DATE=mm/dd/yyyy VGABIOS_REL_DATE="dd Mon yyyy" @@ -25,7 +24,7 @@ index 2ce1f78b4d6a..84c93ab9d518 100644 It is sufficient to define only SOURCE_DATE_EPOCH instead of the above variables for having reproducible builds. By default, they use diff --git a/docs/Makefile b/docs/Makefile -index 8de1efb6f5bc..92ef1b5238f8 100644 +index 966a104490ac..a9da3ce3e9b1 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -3,7 +3,7 @@ include $(XEN_ROOT)/Config.mk @@ -47,5 +46,5 @@ index 8de1efb6f5bc..92ef1b5238f8 100644 else @echo "pandoc not installed; skipping $$@" -- -2.37.3 +2.44.0 diff --git a/1102-docs-xen-headers-use-alphabetical-sorting-for-incont.patch b/1102-docs-xen-headers-use-alphabetical-sorting-for-incont.patch index 72b08815..9f65354f 100644 --- a/1102-docs-xen-headers-use-alphabetical-sorting-for-incont.patch +++ b/1102-docs-xen-headers-use-alphabetical-sorting-for-incont.patch @@ -1,9 +1,8 @@ -From 84042f512c73fd43d980c7bd2b10443115a51658 Mon Sep 17 00:00:00 2001 +From 712ff31d4f89098be98ca0fd420d77633bdac543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?= Date: Sat, 7 Nov 2020 18:21:07 +0100 -Subject: [PATCH 1102/1103] docs/xen-headers: use alphabetical sorting for - @incontents +Subject: [PATCH] docs/xen-headers: use alphabetical sorting for @incontents It makes the build reproducible with fileordering flags --- @@ -24,5 +23,5 @@ index 8c434d77e20e..98ffe814500b 100755 } $o .= "\n"; -- -2.37.3 +2.44.0 diff --git a/1103-Strip-build-path-directories-in-tools-xen-and-xen-ar.patch b/1103-Strip-build-path-directories-in-tools-xen-and-xen-ar.patch index 2a96a1ec..b5511d14 100644 --- a/1103-Strip-build-path-directories-in-tools-xen-and-xen-ar.patch +++ b/1103-Strip-build-path-directories-in-tools-xen-and-xen-ar.patch @@ -1,9 +1,8 @@ -From 4c7ed3308ce0270d47c196c910e7aad0f6032d3a Mon Sep 17 00:00:00 2001 +From 2a8b51484175163641d115b9a9ecf6c3db31e438 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?= Date: Sun, 8 Nov 2020 16:17:29 +0100 -Subject: [PATCH 1103/1103] Strip build path directories in tools, xen and - xen/arch/x86 +Subject: [PATCH] Strip build path directories in tools, xen and xen/arch/x86 Ensure to have a realpath for XEN_ROOT else it fails to substitute properly pathes in strings sections @@ -14,7 +13,7 @@ properly pathes in strings sections 3 files changed, 5 insertions(+) diff --git a/tools/Rules.mk b/tools/Rules.mk -index a5229bb5acb4..e4ec18fc7782 100644 +index 18cf83f5be83..5bb089e6b238 100644 --- a/tools/Rules.mk +++ b/tools/Rules.mk @@ -176,6 +176,8 @@ endif @@ -27,10 +26,10 @@ index a5229bb5acb4..e4ec18fc7782 100644 INSTALL_PYTHON_PROG = \ diff --git a/xen/Makefile b/xen/Makefile -index 9ac87ea9b27c..bc9656b8ab41 100644 +index 02e947da95a0..c7340bedbe40 100644 --- a/xen/Makefile +++ b/xen/Makefile -@@ -404,6 +404,8 @@ ifneq ($(CONFIG_CC_IS_CLANG),y) +@@ -408,6 +408,8 @@ ifneq ($(CONFIG_CC_IS_CLANG),y) CFLAGS += -Wa,--strip-local-absolute endif @@ -40,10 +39,10 @@ index 9ac87ea9b27c..bc9656b8ab41 100644 $(call cc-option-add,AFLAGS,CC,-Wa$$(comma)--noexecstack) diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile -index f213a6b56a4d..4eec76510612 100644 +index d902fb7accd9..898065e78950 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile -@@ -133,6 +133,7 @@ $(TARGET): $(TARGET)-syms $(efi-y) $(obj)/boot/mkelf32 +@@ -135,6 +135,7 @@ $(TARGET): $(TARGET)-syms $(efi-y) $(obj)/boot/mkelf32 mv $(TMP) $(TARGET) CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI @@ -52,5 +51,5 @@ index f213a6b56a4d..4eec76510612 100644 $(TARGET)-syms: $(objtree)/prelink.o $(obj)/xen.lds $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \ -- -2.41.0 +2.44.0 diff --git a/1200-hypercall-XENMEM_get_mfn_from_pfn.patch b/1200-hypercall-XENMEM_get_mfn_from_pfn.patch index a9c68777..f5feac9e 100644 --- a/1200-hypercall-XENMEM_get_mfn_from_pfn.patch +++ b/1200-hypercall-XENMEM_get_mfn_from_pfn.patch @@ -1,7 +1,7 @@ -From 6e4ca304008ef32ba4560cfbbffa15963af8151f Mon Sep 17 00:00:00 2001 +From 6dea874a453d50cf064dd198679c26d22f84b527 Mon Sep 17 00:00:00 2001 From: Wei Ye Date: Thu, 21 Aug 2014 03:45:38 +0800 -Subject: [PATCH 1200/1202] hypercall: XENMEM_get_mfn_from_pfn +Subject: [PATCH] hypercall: XENMEM_get_mfn_from_pfn Suppose that we should find an existing method to achieve the same goal. @@ -14,10 +14,10 @@ Signed-off-by: Yu Zhang 2 files changed, 87 insertions(+) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c -index db1817b691f8..78b1972e4170 100644 +index b30453b9de11..54734371681e 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c -@@ -4676,6 +4676,61 @@ static int cf_check handle_iomem_range( +@@ -4693,6 +4693,61 @@ static int cf_check handle_iomem_range( return err || s > e ? err : _handle_iomem_range(s, e, p); } @@ -79,7 +79,7 @@ index db1817b691f8..78b1972e4170 100644 long arch_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg) { int rc; -@@ -4886,6 +4941,15 @@ long arch_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg) +@@ -4903,6 +4958,15 @@ long arch_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg) } #endif @@ -96,10 +96,10 @@ index db1817b691f8..78b1972e4170 100644 return subarch_memory_op(cmd, arg); } diff --git a/xen/include/public/memory.h b/xen/include/public/memory.h -index f8d26fb77d32..157a19fd0e7a 100644 +index 5e545ae9a418..c522241e141f 100644 --- a/xen/include/public/memory.h +++ b/xen/include/public/memory.h -@@ -699,6 +699,29 @@ struct xen_mem_acquire_resource { +@@ -682,6 +682,29 @@ struct xen_mem_acquire_resource { typedef struct xen_mem_acquire_resource xen_mem_acquire_resource_t; DEFINE_XEN_GUEST_HANDLE(xen_mem_acquire_resource_t); @@ -130,5 +130,5 @@ index f8d26fb77d32..157a19fd0e7a 100644 * XENMEM_get_vnumainfo used by guest to get * vNUMA topology from hypervisor. -- -2.37.3 +2.44.0 diff --git a/1201-patch-gvt-hvmloader.patch.patch b/1201-patch-gvt-hvmloader.patch.patch index c00bbc36..753f6647 100644 --- a/1201-patch-gvt-hvmloader.patch.patch +++ b/1201-patch-gvt-hvmloader.patch.patch @@ -1,8 +1,8 @@ -From 0cb9bf001f4f35ee8c7cd720b9668c7515cd9d6b Mon Sep 17 00:00:00 2001 +From 8cb3e7fdb79dd869edbe7f294e91e781808241d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 16 Nov 2022 02:38:06 +0100 -Subject: [PATCH 1201/1202] patch-gvt-hvmloader.patch +Subject: [PATCH] patch-gvt-hvmloader.patch This patches based on Intel XenGT preview, XCP-NG Project. --- @@ -14,7 +14,7 @@ This patches based on Intel XenGT preview, XCP-NG Project. create mode 100644 tools/firmware/hvmloader/vgt.h diff --git a/tools/firmware/hvmloader/config.h b/tools/firmware/hvmloader/config.h -index c82adf6dc508..d6166b202a67 100644 +index cd716bf39245..c9184366641b 100644 --- a/tools/firmware/hvmloader/config.h +++ b/tools/firmware/hvmloader/config.h @@ -4,7 +4,7 @@ @@ -27,7 +27,7 @@ index c82adf6dc508..d6166b202a67 100644 extern unsigned long igd_opregion_pgbase; diff --git a/tools/firmware/hvmloader/pci.c b/tools/firmware/hvmloader/pci.c -index 257a6feb6148..89b8ed3413a1 100644 +index c3c61ca060a6..fe5ad75e9eb4 100644 --- a/tools/firmware/hvmloader/pci.c +++ b/tools/firmware/hvmloader/pci.c @@ -23,6 +23,7 @@ @@ -38,7 +38,7 @@ index 257a6feb6148..89b8ed3413a1 100644 #include #include -@@ -84,6 +85,7 @@ void pci_setup(void) +@@ -91,6 +92,7 @@ void pci_setup(void) uint16_t class, vendor_id, device_id; unsigned int bar, pin, link, isa_irq; uint8_t pci_devfn_decode_type[256] = {}; @@ -46,7 +46,7 @@ index 257a6feb6148..89b8ed3413a1 100644 /* Resources assignable to PCI devices via BARs. */ struct resource { -@@ -163,6 +165,9 @@ void pci_setup(void) +@@ -170,6 +172,9 @@ void pci_setup(void) ASSERT((devfn != PCI_ISA_DEVFN) || ((vendor_id == 0x8086) && (device_id == 0x7000))); @@ -56,7 +56,7 @@ index 257a6feb6148..89b8ed3413a1 100644 switch ( class ) { case 0x0300: -@@ -536,6 +541,36 @@ void pci_setup(void) +@@ -548,6 +553,36 @@ void pci_setup(void) if ( vga_devfn != 256 ) { @@ -136,5 +136,5 @@ index 000000000000..f5b3f3475392 + +#endif /* _VGT_DEVTABLE_H */ -- -2.37.3 +2.44.0 diff --git a/1202-libxl-Add-partially-Intel-GVT-g-support-xengt-device.patch b/1202-libxl-Add-partially-Intel-GVT-g-support-xengt-device.patch index a93f675c..e2f43184 100644 --- a/1202-libxl-Add-partially-Intel-GVT-g-support-xengt-device.patch +++ b/1202-libxl-Add-partially-Intel-GVT-g-support-xengt-device.patch @@ -1,8 +1,7 @@ -From 17cb4762597c08be62feb9dbcb5dcfbcba072ad2 Mon Sep 17 00:00:00 2001 +From 1b0acc68addd4fe6c2e9928e65904b1110d9ea47 Mon Sep 17 00:00:00 2001 From: Ivan Kardykov Date: Wed, 16 Nov 2022 02:40:06 +0100 -Subject: [PATCH 1202/1202] libxl: Add partially Intel GVT-g support (xengt - device) +Subject: [PATCH] libxl: Add partially Intel GVT-g support (xengt device) This requires to add minimal support Intel GVT-g mediated passtrough to Qubes OS. This patches based on Intel XenGT preview, XCP-NG @@ -15,7 +14,7 @@ Project. 4 files changed, 68 insertions(+) diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c -index 72c45cd67f07..57398cefd5a6 100644 +index d89515b8693e..a3a1e99ace44 100644 --- a/tools/libs/light/libxl_create.c +++ b/tools/libs/light/libxl_create.c @@ -26,6 +26,36 @@ @@ -63,7 +62,7 @@ index 72c45cd67f07..57398cefd5a6 100644 case LIBXL_VGA_INTERFACE_TYPE_CIRRUS: default: if (b_info->video_memkb == LIBXL_MEMKB_DEFAULT) -@@ -1831,6 +1862,9 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, +@@ -1877,6 +1908,9 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, if ( ret ) goto error_out; @@ -74,7 +73,7 @@ index 72c45cd67f07..57398cefd5a6 100644 } case LIBXL_DOMAIN_TYPE_PV: diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c -index af0944a55762..e085e33c17d1 100644 +index 4710ded5deec..af96dcae5ffd 100644 --- a/tools/libs/light/libxl_dm.c +++ b/tools/libs/light/libxl_dm.c @@ -1446,6 +1446,9 @@ static int libxl__build_device_model_args_new(libxl__gc *gc, @@ -88,10 +87,10 @@ index af0944a55762..e085e33c17d1 100644 LOGD(ERROR, guest_domid, "Invalid emulated video card specified"); return ERROR_INVAL; diff --git a/tools/libs/light/libxl_domain.c b/tools/libs/light/libxl_domain.c -index 0d5d1ef6663c..36f653a5deae 100644 +index f4bcb0b198cb..db257d45ebb7 100644 --- a/tools/libs/light/libxl_domain.c +++ b/tools/libs/light/libxl_domain.c -@@ -1114,6 +1114,30 @@ static void domain_destroy_callback(libxl__egc *egc, +@@ -1110,6 +1110,30 @@ static void domain_destroy_callback(libxl__egc *egc, static void destroy_finish_check(libxl__egc *egc, libxl__domain_destroy_state *dds); @@ -132,7 +131,7 @@ index 0d5d1ef6663c..36f653a5deae 100644 /* Clean up qemu-save and qemu-resume files. They are diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl -index d79a6e29121b..e4ab86bb2cf0 100644 +index 1ad4d8dd1d3f..ba362dc43e61 100644 --- a/tools/libs/light/libxl_types.idl +++ b/tools/libs/light/libxl_types.idl @@ -38,6 +38,7 @@ libxl_ms_vm_genid = Builtin("ms_vm_genid", passby=PASS_BY_REFERENCE, check_defau @@ -143,7 +142,7 @@ index d79a6e29121b..e4ab86bb2cf0 100644 # # Constants / Enumerations -@@ -232,6 +233,7 @@ libxl_vga_interface_type = Enumeration("vga_interface_type", [ +@@ -238,6 +239,7 @@ libxl_vga_interface_type = Enumeration("vga_interface_type", [ (2, "STD"), (3, "NONE"), (4, "QXL"), @@ -151,7 +150,7 @@ index d79a6e29121b..e4ab86bb2cf0 100644 ], init_val = "LIBXL_VGA_INTERFACE_TYPE_UNKNOWN") libxl_vendor_device = Enumeration("vendor_device", [ -@@ -615,6 +617,9 @@ libxl_domain_build_info = Struct("domain_build_info",[ +@@ -677,6 +679,9 @@ libxl_domain_build_info = Struct("domain_build_info",[ ("hdtype", libxl_hdtype), ("nographic", libxl_defbool), ("vga", libxl_vga_interface_info), @@ -162,5 +161,5 @@ index d79a6e29121b..e4ab86bb2cf0 100644 # keyboard layout, default is en-us keyboard ("keymap", string), -- -2.37.3 +2.44.0 diff --git a/archlinux/PKGBUILD.in b/archlinux/PKGBUILD.in index 4b425b17..ed1e2860 100644 --- a/archlinux/PKGBUILD.in +++ b/archlinux/PKGBUILD.in @@ -35,7 +35,6 @@ prepare() { # Fix Install Paths. sed 's,/var/run,/run,g' -i tools/hotplug/Linux/locking.sh - sed 's,/var/run,/run,g' -i tools/misc/xenpvnetboot sed 's,/var/run,/run,g' -i tools/xenmon/xenbaked.c sed 's,/var/run,/run,g' -i tools/xenmon/xenmon.py sed 's,/var/run,/run,g' -i tools/pygrub/src/pygrub @@ -47,6 +46,7 @@ build() { ./configure --prefix=/usr \ --sbindir=/usr/bin \ --libdir=/usr/lib \ + --enable-systemd \ --disable-ocaml \ --disable-pvshim \ --disable-blktap2 @@ -99,8 +99,6 @@ package() { rm -rf "$pkgdir"/etc/sysconfig rm -rf "$pkgdir"/etc/rc.d/init.d - rm -r ""$pkgdir"/var/run" - # udev rm -f "$pkgdir"/etc/udev/rules.d/xend.rules diff --git a/version b/version index 66800301..a69aa5a4 100644 --- a/version +++ b/version @@ -1 +1 @@ -4.17.4 +4.19.0 diff --git a/xen.spec.in b/xen.spec.in index 8c7df048..56ec2050 100644 --- a/xen.spec.in +++ b/xen.spec.in @@ -56,8 +56,11 @@ # hardlinked sources) %define _unpackaged_files_terminate_build 0 +# xen.efi.elf doesn't have proper build-id +%define _missing_build_ids_terminate_build 0 + # Hypervisor ABI -%define hv_abi 4.17 +%define hv_abi 4.19 %define upstream_version @VERSION@ %define rctag %(echo @VERSION@ | sed -n -e 's/.*-\\(rc[0-9]*\\).*/0.\\1./;/rc/p') @@ -88,86 +91,50 @@ Provides: xen-gvt # 1100+: Others # EFI workarounds -Patch0201: 0201-EFI-early-Add-noexit-to-inhibit-calling-ExitBootServ.patch -Patch0202: 0202-efi-Ensure-incorrectly-typed-runtime-services-get-ma.patch -Patch0203: 0203-Add-xen.cfg-options-for-mapbs-and-noexitboot.patch -Patch0204: 0204-xen.efi.build.patch - -# Backports -Patch0301: 0301-x86-mm-shadow-avoid-assuming-a-specific-Xen-PAT.patch -Patch0302: 0302-x86-mm-shadow-do-not-open-code-PAGE_CACHE_ATTRS.patch -Patch0303: 0303-p2m-pt-Avoid-hard-coding-Xen-s-PAT.patch -Patch0304: 0304-efi-Avoid-hard-coding-the-various-PAT-constants.patch -Patch0305: 0305-x86-Add-memory-type-constants.patch -Patch0306: 0306-x86-Replace-PAT_-with-X86_MT_.patch -Patch0307: 0307-x86-Replace-MTRR_-constants-with-X86_MT_-constants.patch -Patch0308: 0308-x86-Replace-EPT_EMT_-constants-with-X86_MT_.patch -Patch0309: 0309-x86-Derive-XEN_MSR_PAT-from-its-individual-entries.patch -Patch0314: 0314-drivers-char-support-up-to-1M-BAR0-of-xhci.patch -Patch0315: 0315-IOMMU-store-name-for-extra-reserved-device-memory.patch -Patch0316: 0316-drivers-char-mark-extra-reserved-device-memory-in-me.patch -Patch0317: 0317-xen-list-add-LIST_HEAD_RO_AFTER_INIT.patch -Patch0318: 0318-x86-mm-add-API-for-marking-only-part-of-a-MMIO-page-.patch -Patch0319: 0319-drivers-char-Use-sub-page-ro-API-to-make-just-xhci-d.patch - -# Security fixes -Patch0500: 0500-xsa458.patch - -# Upstreamable patches -Patch0604: 0604-libxl-create-writable-error-xenstore-dir.patch -Patch0605: 0605-libxl-do-not-wait-for-backend-on-PCI-remove-when-bac.patch -Patch0606: 0606-libxl-do-not-fail-device-removal-if-backend-domain-i.patch -Patch0607: 0607-libvchan-use-xengntshr_unshare-instead-of-munmap-dir.patch -Patch0608: 0608-x86-time-Don-t-use-EFI-s-GetTime-call-by-default.patch -Patch0609: 0609-libxl-automatically-enable-gfx_passthru-if-IGD-is-as.patch -Patch0610: 0610-autoconf-fix-handling-absolute-PYTHON-path.patch -Patch0611: 0611-libxl-do-not-require-filling-backend_domid-to-remove.patch -Patch0612: 0612-libxl-add-pcidevs-to-stubdomain-earlier.patch -Patch0613: 0613-Fix-buildid-alignment.patch -Patch0614: 0614-vchan-socket-proxy-add-reconnect-marker-support.patch -Patch0615: 0615-tools-libxl-enable-in-band-reconnect-marker-for-stub.patch -Patch0616: 0616-libxl-Add-a-utility-function-for-domain-resume.patch -Patch0617: 0617-libxl-Add-utility-function-to-check-guest-status.patch -Patch0618: 0618-libxl-Properly-suspend-stubdomains.patch -Patch0619: 0619-libxl-Fix-race-condition-in-domain-suspension.patch -Patch0620: 0620-libxl-Add-additional-domain-suspend-resume-logs.patch -Patch0621: 0621-libxl-workaround-for-Windows-PV-drivers-removing-con.patch -Patch0622: 0622-libxl-check-control-feature-before-issuing-pvcontrol.patch -Patch0623: 0623-tools-kdd-mute-spurious-gcc-warning.patch -Patch0624: 0624-libxl-do-not-start-qemu-in-dom0-just-for-extra-conso.patch -Patch0625: 0625-libxl-Allow-stubdomain-to-control-interupts-of-PCI-d.patch -Patch0626: 0626-Validate-EFI-memory-descriptors.patch -Patch0627: 0627-x86-mm-Avoid-hard-coding-PAT-in-get_page_from_l1e.patch -Patch0628: 0628-x86-mm-make-code-robust-to-future-PAT-changes.patch -Patch0630: 0630-Drop-ELF-notes-from-non-EFI-binary-too.patch - -# Intel HWP support -Patch0631: 0631-cpufreq-Allow-restricting-to-internal-governors-only.patch -Patch0632: 0632-cpufreq-Add-perf_freq-to-cpuinfo.patch -Patch0633: 0633-cpufreq-Export-intel_feature_detect.patch -Patch0634: 0634-cpufreq-Add-Hardware-P-State-HWP-driver.patch -Patch0635: 0635-xenpm-Change-get-cpufreq-para-output-for-internal.patch -Patch0636: 0636-cpufreq-Export-HWP-parameters-to-userspace.patch -Patch0637: 0637-libxc-Include-hwp_para-in-definitions.patch -Patch0638: 0638-xenpm-Print-HWP-parameters.patch -Patch0639: 0639-xen-Add-SET_CPUFREQ_HWP-xen_sysctl_pm_op.patch -Patch0640: 0640-libxc-Add-xc_set_cpufreq_hwp.patch -Patch0641: 0641-xenpm-Factor-out-a-non-fatal-cpuid_parse-variant.patch -Patch0642: 0642-xenpm-Add-set-cpufreq-hwp-subcommand.patch -Patch0643: 0643-cpufreq-enable-HWP-by-default.patch - -PAtch0651: 0651-x86-msi-passthrough-all-MSI-X-vector-ctrl-writes-to-.patch -PAtch0652: 0652-x86-hvm-Allow-writes-to-registers-on-the-same-page-a.patch +Patch0200: 0200-EFI-early-Add-noexit-to-inhibit-calling-ExitBootServ.patch +Patch0201: 0201-efi-Ensure-incorrectly-typed-runtime-services-get-ma.patch +Patch0202: 0202-Add-xen.cfg-options-for-mapbs-and-noexitboot.patch +Patch0203: 0203-xen.efi.build.patch + +# Backports (300+) + +# Security fixes (500+) + +# Upstreamable patches (600+) +Patch0600: 0600-libxl-create-writable-error-xenstore-dir.patch +Patch0601: 0601-libxl-do-not-wait-for-backend-on-PCI-remove-when-bac.patch +Patch0602: 0602-libxl-do-not-fail-device-removal-if-backend-domain-i.patch +Patch0603: 0603-libvchan-use-xengntshr_unshare-instead-of-munmap-dir.patch +Patch0604: 0604-x86-time-Don-t-use-EFI-s-GetTime-call-by-default.patch +Patch0605: 0605-libxl-automatically-enable-gfx_passthru-if-IGD-is-as.patch +Patch0606: 0606-autoconf-fix-handling-absolute-PYTHON-path.patch +Patch0607: 0607-libxl-do-not-require-filling-backend_domid-to-remove.patch +Patch0608: 0608-libxl-add-pcidevs-to-stubdomain-earlier.patch +Patch0609: 0609-Fix-buildid-alignment.patch +Patch0610: 0610-vchan-socket-proxy-add-reconnect-marker-support.patch +Patch0611: 0611-tools-libxl-enable-in-band-reconnect-marker-for-stub.patch +Patch0612: 0612-libxl-Add-a-utility-function-for-domain-resume.patch +Patch0613: 0613-libxl-Properly-suspend-stubdomains.patch +Patch0614: 0614-libxl-Fix-race-condition-in-domain-suspension.patch +Patch0615: 0615-libxl-Add-additional-domain-suspend-resume-logs.patch +Patch0616: 0616-libxl-workaround-for-Windows-PV-drivers-removing-con.patch +Patch0617: 0617-libxl-check-control-feature-before-issuing-pvcontrol.patch +Patch0618: 0618-tools-kdd-mute-spurious-gcc-warning.patch +Patch0619: 0619-libxl-do-not-start-qemu-in-dom0-just-for-extra-conso.patch +Patch0620: 0620-libxl-Allow-stubdomain-to-control-interupts-of-PCI-d.patch +Patch0621: 0621-Validate-EFI-memory-descriptors.patch +Patch0622: 0622-x86-mm-make-code-robust-to-future-PAT-changes.patch +Patch0623: 0623-Drop-ELF-notes-from-non-EFI-binary-too.patch +Patch0624: 0624-xenpm-Factor-out-a-non-fatal-cpuid_parse-variant.patch Patch0653: 0653-python-avoid-conflicting-_FORTIFY_SOURCE-values.patch # S0ix support -Patch0670: 0670-x86-hpet-Disable-legacy-replacement-mode-after-test-.patch -Patch0671: 0671-x86-idle-Get-PC-8.10-counters-for-Tiger-and-Alder-La.patch -Patch0672: 0672-x86-ACPI-Ignore-entries-marked-as-unusable-when-pars.patch -Patch0673: 0673-x86-msr-Allow-hardware-domain-to-read-C-state-reside.patch -Patch0674: 0674-x86-mwait-idle-Use-ACPI-for-CPUs-without-hardcoded-C.patch -Patch0675: 0675-libxl_pci-Pass-power_mgmt-via-QMP.patch +Patch0625: 0625-x86-idle-Get-PC-8.10-counters-for-Tiger-and-Alder-La.patch +Patch0626: 0626-x86-ACPI-Ignore-entries-marked-as-unusable-when-pars.patch +Patch0627: 0627-x86-msr-Allow-hardware-domain-to-read-package-C-stat.patch +Patch0628: 0628-x86-mwait-idle-Use-ACPI-for-CPUs-without-hardcoded-C.patch +Patch0629: 0629-libxl_pci-Pass-power_mgmt-via-QMP.patch # Qubes specific patches Patch1000: 1000-Do-not-access-network-during-the-build.patch @@ -183,12 +150,12 @@ Patch1009: 1009-tools-xenconsole-replace-ESC-char-on-xenconsole-outp.patch Patch1010: 1010-libxl-disable-vkb-by-default.patch Patch1011: 1011-Always-allocate-domid-sequentially-and-do-not-reuse-.patch Patch1012: 1012-libxl-add-qubes-gui-graphics.patch -Patch1013: 1013-libxl-do-not-force-qdisk-backend-for-cdrom.patch -Patch1014: 1014-Additional-support-in-ACPI-builder-to-support-SLIC-a.patch -Patch1015: 1015-libxl-conditionally-allow-PCI-passthrough-on-PV-with.patch -Patch1016: 1016-gnttab-disable-grant-tables-v2-by-default.patch -Patch1018: 1018-Fix-IGD-passthrough-with-linux-stubdomain.patch -Patch1019: 1019-Use-Linux-s-PAT.patch +Patch1013: 1013-Additional-support-in-ACPI-builder-to-support-SLIC-a.patch +Patch1014: 1014-libxl-conditionally-allow-PCI-passthrough-on-PV-with.patch +Patch1015: 1015-gnttab-disable-grant-tables-v2-by-default.patch +Patch1016: 1016-cpufreq-enable-HWP-by-default.patch +Patch1017: 1017-Fix-IGD-passthrough-with-linux-stubdomain.patch +Patch1018: 1018-x86-Use-Linux-s-PAT.patch # Reproducible builds Patch1100: 1100-Define-build-dates-time-based-on-SOURCE_DATE_EPOCH.patch @@ -225,9 +192,9 @@ BuildRequires: libuuid-devel BuildRequires: acpica-tools # modern compressed kernels BuildRequires: bzip2-devel xz-devel libzstd-devel -# libfsimage -BuildRequires: e2fsprogs-devel # BEGIN QUBES SPECIFIC PART +## libfsimage +#BuildRequires: e2fsprogs-devel # tools now require yajl and wget BuildRequires: yajl-devel # END QUBES SPECIFIC PART @@ -452,7 +419,7 @@ CONFIG_EXTRA="$CONFIG_EXTRA --with-system-seabios=/usr/share/seabios/bios-256k.b %else CONFIG_EXTRA="$CONFIG_EXTRA --disable-seabios" %endif -./configure --prefix=%{_prefix} --libdir=%{_libdir} --libexecdir=%{_libexecdir} --with-system-qemu=/usr/bin/qemu-system-i386 --with-linux-backend-modules="xen-evtchn xen-gntdev xen-gntalloc xen-blkback xen-netback xen-pciback xen-scsiback xen-acpi-processor" $CONFIG_EXTRA +./configure --prefix=%{_prefix} --libdir=%{_libdir} --libexecdir=%{_libexecdir} --with-system-qemu=/usr/bin/qemu-system-i386 --with-linux-backend-modules="xen-evtchn xen-gntdev xen-gntalloc xen-blkback xen-netback xen-pciback xen-scsiback xen-acpi-processor" --enable-systemd --disable-pygrub $CONFIG_EXTRA unset CFLAGS CXXFLAGS FFLAGS LDFLAGS export LDFLAGS="$LDFLAGS_SAVE" export CFLAGS="$CFLAGS_SAVE -Wno-error=address" @@ -620,15 +587,12 @@ rm %{buildroot}%{_sysconfdir}/%{initdloc}/xendriverdomain # BEGIN QUBES SPECIFIC PART rm %{buildroot}%{_sysconfdir}/sysconfig/xendomains +mkdir -p %{buildroot}/usr/lib/modules-load.d cp %{SOURCE32} %{buildroot}/usr/lib/modules-load.d/xen.conf # get rid of standard domain starting scripts rm %{buildroot}%{_unitdir}/xen-qemu-dom0-disk-backend.service rm %{buildroot}%{_unitdir}/xendomains.service - -# unused and dangerous -rm -f %{buildroot}/%{_bindir}/pygrub -rm -rf %{buildroot}/%{python3_sitearch}/pygrub* # END QUBES SPECIFIC PART ############ create dirs in /var ############ @@ -816,7 +780,6 @@ fi #files -f xen-xm.lang %files %doc COPYING README -%{_bindir}/xencons # BEGIN QUBES SPECIFIC PART %files -n python%{python3_pkgversion}-%{name} @@ -843,7 +806,6 @@ fi %{_libdir}/libxenevtchn.so.1.2 %{_libdir}/libxenforeignmemory.so.1 %{_libdir}/libxenforeignmemory.so.1.4 -%{_libdir}/libxenfsimage.so.4.* %{_libdir}/libxengnttab.so.1 %{_libdir}/libxengnttab.so.1.2 %{_libdir}/libxenguest.so.4.* @@ -857,7 +819,6 @@ fi %{_libdir}/libxentoollog.so.1.0 %{_libdir}/libxenvchan.so.4.* %{_libdir}/libxlutil.so.4.* -%{_libdir}/xenfsimage %{_libdir}/libxenhypfs.so.1 %{_libdir}/libxenhypfs.so.1.0 @@ -907,7 +868,6 @@ fi # man pages %if %build_docs %{_mandir}/man1/xentop.1* -%{_mandir}/man1/xentrace_format.1* %{_mandir}/man8/xentrace.8* %{_mandir}/man1/xl.1* %{_mandir}/man5/xl.cfg.5* @@ -927,12 +887,6 @@ fi %{_mandir}/man5/xl-pci-configuration.5.gz %endif -%{python3_sitearch}/xenfsimage*.so -%{python3_sitearch}/grub -# BEGIN QUBES SPECIFIC PART -# %{python3_sitearch}/pygrub-*.egg-info -# END QUBES SPECIFIC PART - # The firmware %ifarch %{ix86} x86_64 %dir %{_libexecdir}/%{name}/boot @@ -969,10 +923,6 @@ fi # END QUBES SPECIFIC PART %{_bindir}/xenstore %{_bindir}/xenstore-* -# BEGIN QUBES SPECIFIC PART -#%{_bindir}/pygrub -# END QUBES SPECIFIC PART -%{_bindir}/xentrace* #%#{_bindir}/remus # XSM # BEGIN QUBES SPECIFIC PART